ReactOS 0.4.15-dev-7958-gcd0bb1a
progman_dde.c File Reference
#include <stdio.h>
#include <wine/test.h>
#include <winbase.h>
#include "dde.h"
#include "ddeml.h"
#include "winuser.h"
#include "shlobj.h"
Include dependency graph for progman_dde.c:

Go to the source code of this file.

Functions

static HRESULT (WINAPI *pSHGetLocalizedName)(LPCWSTR
 
static int *static void init_function_pointers (void)
 
static BOOL use_common (void)
 
static BOOL full_title (void)
 
static void init_strings (void)
 
static HDDEDATA CALLBACK DdeCallback (UINT type, UINT format, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hDDEData, ULONG_PTR data1, ULONG_PTR data2)
 
static UINT dde_execute (DWORD instance, HCONV hconv, const char *command_str)
 
static chardde_request (DWORD instance, HCONV hconv, const char *request_str)
 
static BOOL check_window_exists (const char *name)
 
static BOOL check_exists (const char *name)
 
static void test_parser (DWORD instance, HCONV hConv)
 
static void test_progman_dde (DWORD instance, HCONV hConv)
 
static void test_progman_dde2 (DWORD instance, HCONV hConv)
 
static BOOL check_in_programs_list (const char *list, const char *group)
 
static void test_request_groups (DWORD instance, HCONV hconv)
 
 START_TEST (progman_dde)
 

Variables

static LPWSTR
 
static UINT
 
static char ProgramsDir [MAX_PATH]
 

Function Documentation

◆ check_exists()

static BOOL check_exists ( const char name)
static

Definition at line 181 of file progman_dde.c.

182{
183 char path[MAX_PATH];
184
186 strcat(path, "\\");
187 strcat(path, name);
189}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
static char ProgramsDir[MAX_PATH]
Definition: progman_dde.c:90
Definition: name.c:39
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by test_parser(), test_progman_dde(), and test_progman_dde2().

◆ check_in_programs_list()

static BOOL check_in_programs_list ( const char list,
const char group 
)
static

Definition at line 383 of file progman_dde.c.

384{
385 while (1)
386 {
387 if (!strncmp(list, group, strlen(group)) && list[strlen(group)] == '\r')
388 return TRUE;
389 if (!(list = strchr(list, '\r'))) break;
390 list += 2;
391 }
392 return FALSE;
393}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
char * strchr(const char *String, int ch)
Definition: utclib.c:501
Definition: list.h:37
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLboolean GLuint group
Definition: glext.h:11120

Referenced by test_request_groups().

◆ check_window_exists()

static BOOL check_window_exists ( const char name)
static

Definition at line 152 of file progman_dde.c.

153{
154 char title[MAX_PATH];
155 HWND window = NULL;
156 int i;
157
158 if (full_title())
159 {
161 strcat(title, "\\");
162 strcat(title, name);
163 }
164 else
165 strcpy(title, name);
166
167 for (i = 0; i < 20; i++)
168 {
169 Sleep(100 * i);
170 if ((window = FindWindowA("ExplorerWClass", title)) ||
171 (window = FindWindowA("CabinetWClass", title)))
172 {
174 break;
175 }
176 }
177
178 return (window != NULL);
179}
#define NULL
Definition: types.h:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static IHTMLWindow2 * window
Definition: events.c:77
static BOOL full_title(void)
Definition: progman_dde.c:80
static char title[]
Definition: ps.c:92
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define WM_SYSCOMMAND
Definition: winuser.h:1741
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SC_CLOSE
Definition: winuser.h:2592
HWND WINAPI FindWindowA(_In_opt_ LPCSTR, _In_opt_ LPCSTR)

Referenced by test_parser(), and test_progman_dde().

◆ dde_execute()

static UINT dde_execute ( DWORD  instance,
HCONV  hconv,
const char command_str 
)
static

Definition at line 117 of file progman_dde.c.

118{
119 HDDEDATA command, hdata;
121 UINT ret;
122
123 command = DdeCreateDataHandle(instance, (BYTE *)command_str, strlen(command_str)+1, 0, 0, 0, 0);
124 ok(command != NULL, "DdeCreateDataHandle() failed: %u\n", DdeGetLastError(instance));
125
126 hdata = DdeClientTransaction((BYTE *)command, -1, hconv, 0, 0, XTYP_EXECUTE, 2000, &result);
128 /* PROGMAN always returns 1 on success */
129 ok((UINT_PTR)hdata == !ret, "expected %u, got %p\n", !ret, hdata);
130
131 return ret;
132}
#define ok(value,...)
Definition: atltest.h:57
HDDEDATA WINAPI DdeClientTransaction(LPBYTE, DWORD, HCONV, HSZ, UINT, UINT, DWORD, LPDWORD)
Definition: ddeclient.c:1122
HDDEDATA WINAPI DdeCreateDataHandle(DWORD, LPBYTE, DWORD, DWORD, HSZ, UINT, UINT)
Definition: ddemisc.c:1275
UINT WINAPI DdeGetLastError(DWORD)
Definition: ddemisc.c:253
#define XTYP_EXECUTE
Definition: ddeml.h:185
static HINSTANCE instance
Definition: main.c:40
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint64EXT * result
Definition: glext.h:11304
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
int ret
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_parser(), test_progman_dde(), and test_progman_dde2().

◆ dde_request()

static char * dde_request ( DWORD  instance,
HCONV  hconv,
const char request_str 
)
static

Definition at line 134 of file progman_dde.c.

135{
136 static char data[2000];
137 HDDEDATA hdata;
138 HSZ item;
140
142 ok(item != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
143
144 hdata = DdeClientTransaction(NULL, -1, hconv, item, CF_TEXT, XTYP_REQUEST, 2000, &result);
145 if (hdata == NULL) return NULL;
146
147 DdeGetData(hdata, (BYTE *)data, 2000, 0);
148
149 return data;
150}
#define CF_TEXT
Definition: constants.h:396
HSZ WINAPI DdeCreateStringHandleA(DWORD, LPCSTR, INT)
Definition: ddemisc.c:577
#define XTYP_REQUEST
Definition: ddeml.h:191
#define CP_WINANSI
Definition: ddeml.h:32
DWORD WINAPI DdeGetData(HDDEDATA, LPBYTE, DWORD, DWORD)
Definition: ddemisc.c:1379
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static ATOM item
Definition: dde.c:856

Referenced by test_request_groups().

◆ DdeCallback()

static HDDEDATA CALLBACK DdeCallback ( UINT  type,
UINT  format,
HCONV  hConv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hDDEData,
ULONG_PTR  data1,
ULONG_PTR  data2 
)
static

Definition at line 110 of file progman_dde.c.

112{
113 trace("Callback: type=%i, format=%i\n", type, format);
114 return NULL;
115}
#define trace
Definition: atltest.h:70
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

Referenced by START_TEST().

◆ full_title()

static BOOL full_title ( void  )
static

Definition at line 80 of file progman_dde.c.

81{
83
84 memset(&cs, 0, sizeof(cs));
85 ReadCabinetState(&cs, sizeof(cs));
86
87 return (cs.fFullPathTitle == -1);
88}
#define cs
Definition: i386-dis.c:442
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
Definition: shellord.c:1609

Referenced by check_window_exists().

◆ HRESULT()

static HRESULT ( WINAPI pSHGetLocalizedName)
static

◆ init_function_pointers()

static int *static void init_function_pointers ( void  )
static

Definition at line 39 of file progman_dde.c.

40{
42
43 hmod = GetModuleHandleA("shell32.dll");
44 pSHGetLocalizedName = (void*)GetProcAddress(hmod, "SHGetLocalizedName");
45}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143

Referenced by START_TEST().

◆ init_strings()

static void init_strings ( void  )
static

Definition at line 92 of file progman_dde.c.

93{
94 char commonprograms[MAX_PATH];
95 char programs[MAX_PATH];
96
99
100 /* ProgramsDir on Vista+ is always the users one (CSIDL_PROGRAMS). Before Vista
101 * it depends on whether the user is an administrator (CSIDL_COMMON_PROGRAMS) or
102 * not (CSIDL_PROGRAMS).
103 */
104 if (use_common())
105 lstrcpyA(ProgramsDir, commonprograms);
106 else
108}
BOOL WINAPI SHGetSpecialFolderPathA(HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3079
const GLuint * programs
Definition: glext.h:6724
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static BOOL use_common(void)
Definition: progman_dde.c:47
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2180
#define CSIDL_PROGRAMS
Definition: shlobj.h:2160

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( progman_dde  )

Definition at line 418 of file progman_dde.c.

419{
420 DWORD instance = 0;
421 UINT err;
422 HSZ hszProgman;
423 HCONV hConv;
424 BOOL ret;
425
427 init_strings();
428
429 /* Initialize DDE Instance */
431 ok(err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err);
432
433 /* Create Connection */
434 hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
435 ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
436 hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
437 ret = DdeFreeStringHandle(instance, hszProgman);
438 ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
439 /* Seeing failures on early versions of Windows Connecting to progman, exit if connection fails */
440 if (hConv == NULL)
441 {
442 ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
443 return;
444 }
445
446 test_parser(instance, hConv);
449
450 /* Cleanup & Exit */
451 ret = DdeDisconnect(hConv);
452 ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
454 ok(ret, "DdeUninitialize() failed: %u\n", DdeGetLastError(instance));
455
456 /* 2nd Instance (Followup Tests) */
457 /* Initialize DDE Instance */
458 instance = 0;
460 ok (err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err);
461
462 /* Create Connection */
463 hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
464 ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
465 hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
466 ok(hConv != NULL, "DdeConnect() failed: %u\n", DdeGetLastError(instance));
467 ret = DdeFreeStringHandle(instance, hszProgman);
468 ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
469
470 /* Run Tests */
472
473 /* Cleanup & Exit */
474 ret = DdeDisconnect(hConv);
475 ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
477 ok(ret, "DdeUninitialize() failed: %u\n", DdeGetLastError(instance));
478}
#define DMLERR_NO_ERROR
Definition: ddeml.h:242
BOOL WINAPI DdeUninitialize(DWORD)
Definition: ddemisc.c:1112
HCONV WINAPI DdeConnect(DWORD, HSZ, HSZ, PCONVCONTEXT)
Definition: ddeclient.c:84
BOOL WINAPI DdeFreeStringHandle(DWORD, HSZ)
Definition: ddemisc.c:631
BOOL WINAPI DdeDisconnect(HCONV)
Definition: ddeclient.c:1363
#define APPCMD_CLIENTONLY
Definition: ddeml.h:122
UINT WINAPI DdeInitializeA(LPDWORD, PFNCALLBACK, DWORD, DWORD)
Definition: ddemisc.c:1075
unsigned int BOOL
Definition: ntddk_ex.h:94
static void init_strings(void)
Definition: progman_dde.c:92
static int *static void init_function_pointers(void)
Definition: progman_dde.c:39
static void test_parser(DWORD instance, HCONV hConv)
Definition: progman_dde.c:191
static void test_request_groups(DWORD instance, HCONV hconv)
Definition: progman_dde.c:395
static void test_progman_dde2(DWORD instance, HCONV hConv)
Definition: progman_dde.c:369
static HDDEDATA CALLBACK DdeCallback(UINT type, UINT format, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hDDEData, ULONG_PTR data1, ULONG_PTR data2)
Definition: progman_dde.c:110
static void test_progman_dde(DWORD instance, HCONV hConv)
Definition: progman_dde.c:260
#define err(...)

◆ test_parser()

static void test_parser ( DWORD  instance,
HCONV  hConv 
)
static

Definition at line 191 of file progman_dde.c.

192{
193 UINT error;
194
195 /* Invalid Command */
196 error = dde_execute(instance, hConv, "[InvalidCommand()]");
197 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
198
199 /* test parsing */
200 error = dde_execute(instance, hConv, "");
201 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
202
203 error = dde_execute(instance, hConv, "CreateGroup");
204 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
205
206 error = dde_execute(instance, hConv, "[CreateGroup");
207 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
208
209 error = dde_execute(instance, hConv, "[CreateGroup]");
210 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
211
212 error = dde_execute(instance, hConv, "[CreateGroup()]");
213 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
214
215 error = dde_execute(instance, hConv, "[cREATEgROUP(test)]");
216 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
217 ok(check_exists("test"), "directory not created\n");
218 ok(check_window_exists("test"), "window not created\n");
219
220 error = dde_execute(instance, hConv, "[AddItem(notepad,foobar)]");
221 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
222 ok(check_exists("test/foobar.lnk"), "link not created\n");
223
224 error = dde_execute(instance, hConv, "[AddItem(notepad,foo bar)]");
225 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
226 ok(check_exists("test/foo bar.lnk"), "link not created\n");
227
228 error = dde_execute(instance, hConv, "[AddItem(notepad,a[b,c]d)]");
229 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
230
231 error = dde_execute(instance, hConv, "[AddItem(notepad,\"a[b,c]d\")]");
232 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
233 ok(check_exists("test/a[b,c]d.lnk"), "link not created\n");
234
235 error = dde_execute(instance, hConv, " [ AddItem ( notepad , test ) ] ");
236 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
237 ok(check_exists("test/test.lnk"), "link not created\n");
238
239 error = dde_execute(instance, hConv, "[AddItem(notepad,one)][AddItem(notepad,two)]");
240 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
241 ok(check_exists("test/one.lnk"), "link not created\n");
242 ok(check_exists("test/two.lnk"), "link not created\n");
243
244 error = dde_execute(instance, hConv, "[FakeCommand(test)][DeleteGroup(test)]");
245 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
246 ok(check_exists("test"), "directory should exist\n");
247
248 error = dde_execute(instance, hConv, "[DeleteGroup(test)]");
249 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
250 ok(!check_exists("test"), "directory should not exist\n");
251
252 error = dde_execute(instance, hConv, "[ExitProgman()]");
253 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
254
255 error = dde_execute(instance, hConv, "[ExitProgman]");
256 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
257}
#define DMLERR_NOTPROCESSED
Definition: ddeml.h:255
#define error(str)
Definition: mkdosfs.c:1605
static BOOL check_exists(const char *name)
Definition: progman_dde.c:181
static BOOL check_window_exists(const char *name)
Definition: progman_dde.c:152
static UINT dde_execute(DWORD instance, HCONV hconv, const char *command_str)
Definition: progman_dde.c:117

Referenced by START_TEST().

◆ test_progman_dde()

static void test_progman_dde ( DWORD  instance,
HCONV  hConv 
)
static

Definition at line 260 of file progman_dde.c.

261{
262 UINT error;
263
264 /* test creating and deleting groups and items */
265 error = dde_execute(instance, hConv, "[CreateGroup(Group1)]");
266 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
267 ok(check_exists("Group1"), "directory not created\n");
268 ok(check_window_exists("Group1"), "window not created\n");
269
270 error = dde_execute(instance, hConv, "[AddItem]");
271 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
272
273 error = dde_execute(instance, hConv, "[AddItem(test)]");
274 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
275
276 error = dde_execute(instance, hConv, "[AddItem(notepad.exe)]");
277 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
278 ok(check_exists("Group1/notepad.lnk"), "link not created\n");
279
280 error = dde_execute(instance, hConv, "[DeleteItem(notepad.exe)]");
281 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
282
283 error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
284 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
285 ok(!check_exists("Group1/notepad.lnk"), "link should not exist\n");
286
287 error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
288 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
289
290 error = dde_execute(instance, hConv, "[AddItem(notepad)]");
291 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
292 ok(check_exists("Group1/notepad.lnk"), "link not created\n");
293
294 error = dde_execute(instance, hConv, "[AddItem(notepad)]");
295 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
296
297 /* XP allows any valid path even if it does not exist; Vista+ requires that
298 * the path both exist and be a file (directories are invalid). */
299
300 error = dde_execute(instance, hConv, "[AddItem(C:\\windows\\system.ini)]");
301 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
302 ok(check_exists("Group1/system.lnk"), "link not created\n");
303
304 error = dde_execute(instance, hConv, "[AddItem(notepad,test1)]");
305 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
306 ok(check_exists("Group1/test1.lnk"), "link not created\n");
307
308 error = dde_execute(instance, hConv, "[DeleteItem(test1)]");
309 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
310 ok(!check_exists("Group1/test1.lnk"), "link should not exist\n");
311
312 error = dde_execute(instance, hConv, "[AddItem(notepad,test1)]");
313 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
314 ok(check_exists("Group1/test1.lnk"), "link not created\n");
315
316 error = dde_execute(instance, hConv, "[ReplaceItem(test1)]");
317 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
318 ok(!check_exists("Group1/test1.lnk"), "link should not exist\n");
319
320 error = dde_execute(instance, hConv, "[AddItem(regedit)]");
321 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
322 ok(check_exists("Group1/regedit.lnk"), "link not created\n");
323
324 /* test ShowGroup() and test which group an item gets added to */
325 error = dde_execute(instance, hConv, "[ShowGroup(Group1)]");
326 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
327
328 error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
329 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
330 ok(check_window_exists("Group1"), "window not created\n");
331
332 error = dde_execute(instance, hConv, "[CreateGroup(Group2)]");
333 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
334 ok(check_exists("Group2"), "directory not created\n");
335 ok(check_window_exists("Group2"), "window not created\n");
336
337 error = dde_execute(instance, hConv, "[AddItem(notepad,test2)]");
338 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
339 ok(check_exists("Group2/test2.lnk"), "link not created\n");
340
341 error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
342 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
343 ok(check_window_exists("Group1"), "window not created\n");
344
345 error = dde_execute(instance, hConv, "[AddItem(notepad,test3)]");
346 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
347 ok(check_exists("Group1/test3.lnk"), "link not created\n");
348
349 error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
350 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
351 ok(!check_exists("Group1"), "directory should not exist\n");
352
353 error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
354 ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
355
356 error = dde_execute(instance, hConv, "[ShowGroup(Group2, 0)]");
357 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
358 ok(check_window_exists("Group2"), "window not created\n");
359
360 error = dde_execute(instance, hConv, "[ExitProgman(1)]");
361 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
362
363 error = dde_execute(instance, hConv, "[AddItem(notepad,test4)]");
364 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
365 ok(check_exists("Group2/test4.lnk"), "link not created\n");
366}

Referenced by START_TEST().

◆ test_progman_dde2()

static void test_progman_dde2 ( DWORD  instance,
HCONV  hConv 
)
static

Definition at line 369 of file progman_dde.c.

370{
371 UINT error;
372
373 /* last open group is retained across connections */
374 error = dde_execute(instance, hConv, "[AddItem(notepad)]");
375 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
376 ok(check_exists("Group2/notepad.lnk"), "link not created\n");
377
378 error = dde_execute(instance, hConv, "[DeleteGroup(Group2)]");
379 ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
380 ok(!check_exists("Group2"), "directory should not exist\n");
381}

Referenced by START_TEST().

◆ test_request_groups()

static void test_request_groups ( DWORD  instance,
HCONV  hconv 
)
static

Definition at line 395 of file progman_dde.c.

396{
397 char *list;
398 char programs[MAX_PATH];
399 WIN32_FIND_DATAA finddata;
400 HANDLE hfind;
401
402 list = dde_request(instance, hconv, "Groups");
403 ok(list != NULL, "request failed: %u\n", DdeGetLastError(instance));
405 strcat(programs, "/*");
406 hfind = FindFirstFileA(programs, &finddata);
407 do
408 {
409 if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && finddata.cFileName[0] != '.')
410 {
411 ok(check_in_programs_list(list, finddata.cFileName),
412 "directory '%s' missing from group list\n", finddata.cFileName);
413 }
414 } while (FindNextFileA(hfind, &finddata));
415 FindClose(hfind);
416}
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:263
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileA(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:336
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
static char * dde_request(DWORD instance, HCONV hconv, const char *request_str)
Definition: progman_dde.c:134
static BOOL check_in_programs_list(const char *list, const char *group)
Definition: progman_dde.c:383
#define list
Definition: rosglue.h:35

Referenced by START_TEST().

◆ use_common()

static BOOL use_common ( void  )
static

Definition at line 47 of file progman_dde.c.

48{
50 static BOOL (WINAPI *pIsNTAdmin)(DWORD, LPDWORD);
51
52 /* IsNTAdmin() is available on all platforms. */
53 hmod = LoadLibraryA("advpack.dll");
54 pIsNTAdmin = (void*)GetProcAddress(hmod, "IsNTAdmin");
55
56 if (!pIsNTAdmin(0, NULL))
57 {
58 /* We are definitely not an administrator */
60 return FALSE;
61 }
63
64 /* If we end up here we are on NT4+ as Win9x and WinMe don't have the
65 * notion of administrators (as we need it).
66 */
67
68 /* As of Vista we should always use the users directory. Tests with the
69 * real Administrator account on Windows 7 proved this.
70 *
71 * FIXME: We need a better way of identifying Vista+ as currently this check
72 * also covers Wine and we don't know yet which behavior we want to follow.
73 */
74 if (pSHGetLocalizedName)
75 return FALSE;
76
77 return TRUE;
78}
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define BOOL
Definition: nt_native.h:43
#define LPDWORD
Definition: nt_native.h:46
#define DWORD
Definition: nt_native.h:44
#define WINAPI
Definition: msvc.h:6

Referenced by init_strings().

Variable Documentation

◆ LPWSTR

Definition at line 37 of file progman_dde.c.

◆ ProgramsDir

char ProgramsDir[MAX_PATH]
static

Definition at line 90 of file progman_dde.c.

Referenced by check_exists(), check_window_exists(), init_strings(), and test_request_groups().

◆ UINT

Definition at line 37 of file progman_dde.c.