2 * Unit test of the Program Manager DDE Interfaces
4 * Copyright 2009 Mikey Alexander
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 /* DDE Program Manager Tests
22 * - Covers basic CreateGroup, ShowGroup, DeleteGroup, AddItem, and DeleteItem
24 * - Todo: Handle CommonGroupFlag
25 * Handle Difference between administrator and non-administrator calls
27 * Better AddItem Tests (Lots of parameters to test)
28 * Tests for Invalid Characters in Names / Invalid Parameters
29 * - Technically, calling as an administrator creates groups in the CSIDL_COMMON_PROGRAMS
30 * directory. Win 9x and non-administrator calls us CSIDL_PROGRAMS directory.
31 * Original plans were to check that items/groups were created in appropriate
32 * places. As of this writing and in order to simplify the test code, it now
33 * checks for existence in either place. From web searches, it is not at all
34 * obvious or trivial to detect if the call is coming from an administrator or
35 * non-administrator. IsUserAnAdmin
39 #include <wine/test.h>
46 /* Timeout on DdeClientTransaction Call */
47 #define MS_TIMEOUT_VAL 1000
48 /* # of times to poll for window creation */
49 #define PDDE_POLL_NUM 150
50 /* time to sleep between polls */
51 #define PDDE_POLL_TIME 300
54 #define DDE_TEST_MISC 0x00010000
55 #define DDE_TEST_CREATEGROUP 0x00020000
56 #define DDE_TEST_DELETEGROUP 0x00030000
57 #define DDE_TEST_SHOWGROUP 0x00040000
58 #define DDE_TEST_ADDITEM 0x00050000
59 #define DDE_TEST_DELETEITEM 0x00060000
60 #define DDE_TEST_COMPOUND 0x00070000
61 #define DDE_TEST_CALLMASK 0x00ff0000
63 /* Type of Test (Common, Individual) */
64 #define DDE_TEST_COMMON 0x01000000
65 #define DDE_TEST_INDIVIDUAL 0x02000000
67 #define DDE_TEST_NUMMASK 0x0000ffff
69 static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
70 static BOOL (WINAPI *pReadCabinetState)(CABINETSTATE *, int);
72 static void init_function_pointers(void)
76 hmod = GetModuleHandleA("shell32.dll");
77 pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA");
78 pReadCabinetState = (void*)GetProcAddress(hmod, "ReadCabinetState");
79 if (!pReadCabinetState)
80 pReadCabinetState = (void*)GetProcAddress(hmod, (LPSTR)651);
83 static char CommonPrograms[MAX_PATH];
84 static char Programs[MAX_PATH];
86 static char Group1Title[MAX_PATH] = "Group1";
87 static char Group2Title[MAX_PATH] = "Group2";
88 static char Group3Title[MAX_PATH] = "Group3";
89 static char Startup[MAX_PATH] = "Startup";
90 static char StartupTitle[MAX_PATH] = "Startup";
92 static void init_strings(void)
94 char startup[MAX_PATH];
97 if (pSHGetSpecialFolderPathA)
99 pSHGetSpecialFolderPathA(NULL, Programs, CSIDL_PROGRAMS, FALSE);
100 if (!pSHGetSpecialFolderPathA(NULL, CommonPrograms, CSIDL_COMMON_PROGRAMS, FALSE))
103 lstrcpyA(CommonPrograms, Programs);
105 if (GetProcAddress(GetModuleHandleA("shell32.dll"), "SHGetKnownFolderPath"))
107 /* Vista and higher use CSIDL_PROGRAMS for these tests.
108 * Wine doesn't have SHGetKnownFolderPath yet but should most likely follow
109 * this new ProgMan DDE behavior once implemented.
111 lstrcpyA(CommonPrograms, Programs);
113 pSHGetSpecialFolderPathA(NULL, startup, CSIDL_STARTUP, FALSE);
114 lstrcpyA(Startup, (strrchr(startup, '\\') + 1));
122 /* Older Win9x and NT4 */
123 RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
124 size = sizeof(CommonPrograms);
125 res = RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&CommonPrograms, &size);
127 if (res != ERROR_SUCCESS)
130 lstrcpyA(CommonPrograms, Programs);
133 RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
134 size = sizeof(Programs);
135 RegQueryValueExA(key, "Programs", NULL, NULL, (LPBYTE)&Programs, &size);
136 size = sizeof(startup);
137 RegQueryValueExA(key, "Startup", NULL, NULL, (LPBYTE)&startup, &size);
138 lstrcpyA(Startup, (strrchr(startup, '\\') + 1));
142 memset(&cs, 0, sizeof(cs));
143 pReadCabinetState(&cs, sizeof(cs));
144 if (cs.fFullPathTitle == -1)
146 lstrcpyA(Group1Title, CommonPrograms);
147 lstrcatA(Group1Title, "\\Group1");
148 lstrcpyA(Group2Title, CommonPrograms);
149 lstrcatA(Group2Title, "\\Group2");
150 lstrcpyA(Group3Title, CommonPrograms);
151 lstrcatA(Group3Title, "\\Group3");
153 lstrcpyA(StartupTitle, startup);
157 static HDDEDATA CALLBACK DdeCallback(UINT type, UINT format, HCONV hConv, HSZ hsz1, HSZ hsz2,
158 HDDEDATA hDDEData, ULONG_PTR data1, ULONG_PTR data2)
160 trace("Callback: type=%i, format=%i\n", type, format);
165 * Encoded String for Error Messages so that inner failures can determine
166 * what test is failing. Format is: [Code:TestNum]
168 static const char * GetStringFromTestParams(int testParams)
171 static char testParamString[64];
174 testNum = testParams & DDE_TEST_NUMMASK;
175 switch (testParams & DDE_TEST_CALLMASK)
181 case DDE_TEST_CREATEGROUP:
184 case DDE_TEST_DELETEGROUP:
187 case DDE_TEST_SHOWGROUP:
190 case DDE_TEST_ADDITEM:
193 case DDE_TEST_DELETEITEM:
196 case DDE_TEST_COMPOUND:
201 sprintf(testParamString, " [%s:%i]", callId, testNum);
202 return testParamString;
205 /* Transfer DMLERR's into text readable strings for Error Messages */
206 #define DMLERR_TO_STR(x) case x: return#x;
207 static const char * GetStringFromError(UINT err)
211 DMLERR_TO_STR(DMLERR_NO_ERROR);
212 DMLERR_TO_STR(DMLERR_ADVACKTIMEOUT);
213 DMLERR_TO_STR(DMLERR_BUSY);
214 DMLERR_TO_STR(DMLERR_DATAACKTIMEOUT);
215 DMLERR_TO_STR(DMLERR_DLL_NOT_INITIALIZED);
216 DMLERR_TO_STR(DMLERR_DLL_USAGE);
217 DMLERR_TO_STR(DMLERR_EXECACKTIMEOUT);
218 DMLERR_TO_STR(DMLERR_INVALIDPARAMETER);
219 DMLERR_TO_STR(DMLERR_LOW_MEMORY);
220 DMLERR_TO_STR(DMLERR_MEMORY_ERROR);
221 DMLERR_TO_STR(DMLERR_NOTPROCESSED);
222 DMLERR_TO_STR(DMLERR_NO_CONV_ESTABLISHED);
223 DMLERR_TO_STR(DMLERR_POKEACKTIMEOUT);
224 DMLERR_TO_STR(DMLERR_POSTMSG_FAILED);
225 DMLERR_TO_STR(DMLERR_REENTRANCY);
226 DMLERR_TO_STR(DMLERR_SERVER_DIED);
227 DMLERR_TO_STR(DMLERR_SYS_ERROR);
228 DMLERR_TO_STR(DMLERR_UNADVACKTIMEOUT);
229 DMLERR_TO_STR(DMLERR_UNFOUND_QUEUE_ID);
231 return "Unknown DML Error";
235 /* Helper Function to Transfer DdeGetLastError into a String */
236 static const char * GetDdeLastErrorStr(DWORD instance)
238 UINT err = DdeGetLastError(instance);
240 return GetStringFromError(err);
243 /* Execute a Dde Command and return the error & result */
244 /* Note: Progman DDE always returns a pointer to 0x00000001 on a successful result */
245 static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, HDDEDATA *hData, UINT *err, int testParams)
249 command = DdeCreateDataHandle(instance, (LPBYTE) strCmd, strlen(strCmd)+1, 0, 0L, 0, 0);
250 ok (command != NULL, "DdeCreateDataHandle Error %s.%s\n",
251 GetDdeLastErrorStr(instance), GetStringFromTestParams(testParams));
252 *hData = DdeClientTransaction((void *) command,
261 /* hData is technically a pointer, but for Program Manager,
262 * it is NULL (error) or 1 (success)
263 * TODO: Check other versions of Windows to verify 1 is returned.
264 * While it is unlikely that anyone is actually testing that the result is 1
265 * if all versions of windows return 1, Wine should also.
269 *err = DdeGetLastError(instance);
273 *err = DMLERR_NO_ERROR;
276 ok(*hData == (HDDEDATA) 1, "Expected HDDEDATA Handle == 1, actually %p.%s\n",
277 *hData, GetStringFromTestParams(testParams));
280 DdeFreeDataHandle(command);
284 * Check if Window is onscreen with the appropriate name.
286 * Windows are not created synchronously. So we do not know
287 * when and if the window will be created/shown on screen.
288 * This function implements a polling mechanism to determine
290 * A more complicated method would be to use SetWindowsHookEx.
291 * Since polling worked fine in my testing, no reason to implement
292 * the other. Comments about other methods of determining when
293 * window creation happened were not encouraging (not including
296 static void CheckWindowCreated(const char *winName, int closeWindow, int testParams)
301 /* Poll for Window Creation */
302 for (i = 0; window == NULL && i < PDDE_POLL_NUM; i++)
304 Sleep(PDDE_POLL_TIME);
305 window = FindWindowA(NULL, winName);
307 ok (window != NULL, "Window \"%s\" was not created in %i seconds - assumed failure.%s\n",
308 winName, PDDE_POLL_NUM*PDDE_POLL_TIME/1000, GetStringFromTestParams(testParams));
310 /* Close Window as desired. */
311 if (window != NULL && closeWindow)
313 SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
317 /* Check for Existence (or non-existence) of a file or group
318 * When testing for existence of a group, groupName is not needed
320 static void CheckFileExistsInProgramGroups(const char *nameToCheck, int shouldExist, int isGroup,
321 const char *groupName, int testParams)
327 if (testParams & DDE_TEST_COMMON)
328 lstrcpyA(path, CommonPrograms);
330 lstrcpyA(path, Programs);
332 len = strlen(path) + strlen(nameToCheck)+1;
333 if (groupName != NULL)
335 len += strlen(groupName)+1;
337 ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams));
340 if (groupName != NULL)
343 strcat(path, groupName);
346 strcat(path, nameToCheck);
347 attributes = GetFileAttributes(path);
350 ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
351 path, GetStringFromTestParams(testParams));
353 if (attributes == INVALID_FILE_ATTRIBUTES)
355 ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams));
356 } else if (isGroup) {
357 ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n",
358 path, attributes, GetStringFromTestParams(testParams));
360 ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n",
361 path, attributes, GetStringFromTestParams(testParams));
367 /* Create Group Test.
368 * command and expected_result.
369 * if expected_result is DMLERR_NO_ERROR, test
370 * 1. group was created
373 static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
374 const char *groupName, const char *windowTitle, int testParams)
379 /* Execute Command & Check Result */
380 DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
383 ok (expected_result == error, "CreateGroup %s: Expected Error %s, received %s.%s\n",
384 groupName, GetStringFromError(expected_result), GetStringFromError(error),
385 GetStringFromTestParams(testParams));
389 if (error == DMLERR_NO_ERROR)
392 /* Check if Group Now Exists */
393 CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
394 /* Check if Window is Open (polling) */
395 CheckWindowCreated(windowTitle, TRUE, testParams);
400 * DDE command, expected_result, and the group name to check for existence
401 * if expected_result is DMLERR_NO_ERROR, test
404 static void ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
405 const char *groupName, const char *windowTitle, int closeAfterShowing, int testParams)
410 DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
411 /* todo_wine... Is expected to fail, wine stubbed functions DO fail */
412 /* TODO REMOVE THIS CODE!!! */
413 if (expected_result == DMLERR_NOTPROCESSED)
415 ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n",
416 groupName, GetStringFromError(expected_result), GetStringFromError(error),
417 GetStringFromTestParams(testParams));
421 ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n",
422 groupName, GetStringFromError(expected_result), GetStringFromError(error),
423 GetStringFromTestParams(testParams));
427 if (error == DMLERR_NO_ERROR)
429 /* Check if Window is Open (polling) */
430 CheckWindowCreated(windowTitle, closeAfterShowing, testParams);
434 /* Delete Group Test.
435 * DDE command, expected_result, and the group name to check for existence
436 * if expected_result is DMLERR_NO_ERROR, test
437 * 1. group does not exist
439 static void DeleteGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
440 const char *groupName, int testParams)
445 DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
448 ok (expected_result == error, "DeleteGroup %s: Expected Error %s, received %s.%s\n",
449 groupName, GetStringFromError(expected_result), GetStringFromError(error),
450 GetStringFromTestParams(testParams));
453 if (error == DMLERR_NO_ERROR)
455 /* Check that Group does not exist */
456 CheckFileExistsInProgramGroups(groupName, FALSE, TRUE, NULL, testParams);
461 * DDE command, expected result, and group and file name where it should exist.
462 * checks to make sure error code matches expected error code
463 * checks to make sure item exists if successful
465 static void AddItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
466 const char *fileName, const char *groupName, int testParams)
471 DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
474 ok (expected_result == error, "AddItem %s: Expected Error %s, received %s.%s\n",
475 fileName, GetStringFromError(expected_result), GetStringFromError(error),
476 GetStringFromTestParams(testParams));
479 if (error == DMLERR_NO_ERROR)
481 /* Check that File exists */
482 CheckFileExistsInProgramGroups(fileName, TRUE, FALSE, groupName, testParams);
487 * DDE command, expected result, and group and file name where it should exist.
488 * checks to make sure error code matches expected error code
489 * checks to make sure item does not exist if successful
491 static void DeleteItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
492 const char *fileName, const char *groupName, int testParams)
497 DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
500 ok (expected_result == error, "DeleteItem %s: Expected Error %s, received %s.%s\n",
501 fileName, GetStringFromError(expected_result), GetStringFromError(error),
502 GetStringFromTestParams(testParams));
505 if (error == DMLERR_NO_ERROR)
507 /* Check that File does not exist */
508 CheckFileExistsInProgramGroups(fileName, FALSE, FALSE, groupName, testParams);
512 /* Compound Command Test.
513 * not really generic, assumes command of the form:
514 * [CreateGroup ...][AddItem ...][AddItem ...]
515 * All samples I've seen using Compound were of this form (CreateGroup,
516 * AddItems) so this covers minimum expected functionality.
518 static void CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
519 const char *groupName, const char *windowTitle, const char *fileName1,
520 const char *fileName2, int testParams)
525 DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
528 ok (expected_result == error, "Compound String %s: Expected Error %s, received %s.%s\n",
529 command, GetStringFromError(expected_result), GetStringFromError(error),
530 GetStringFromTestParams(testParams));
533 if (error == DMLERR_NO_ERROR)
535 /* Check that File exists */
536 CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
537 CheckWindowCreated(windowTitle, FALSE, testParams);
538 CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams);
539 CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams);
543 static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name)
545 lstrcpyA(itemtext, "[AddItem(");
546 lstrcatA(itemtext, cmdline);
547 lstrcatA(itemtext, ",");
548 lstrcatA(itemtext, name);
549 lstrcatA(itemtext, ")]");
552 /* 1st set of tests */
553 static int DdeTestProgman(DWORD instance, HCONV hConv)
558 char temppath[MAX_PATH];
559 char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH];
560 char itemtext[MAX_PATH + 20];
561 char comptext[2 * (MAX_PATH + 20) + 21];
564 /* Invalid Command */
565 DdeExecuteCommand(instance, hConv, "[InvalidCommand()]", &hData, &error, DDE_TEST_MISC|testnum++);
566 ok (error == DMLERR_NOTPROCESSED, "InvalidCommand(), expected error %s, received %s.\n",
567 GetStringFromError(DMLERR_NOTPROCESSED), GetStringFromError(error));
569 /* On Vista+ the files have to exist when adding a link */
570 GetTempPathA(MAX_PATH, temppath);
571 GetTempFileNameA(temppath, "dde", 0, f1g1);
572 GetTempFileNameA(temppath, "dde", 0, f2g1);
573 GetTempFileNameA(temppath, "dde", 0, f3g1);
574 GetTempFileNameA(temppath, "dde", 0, f1g3);
575 GetTempFileNameA(temppath, "dde", 0, f2g3);
577 /* CreateGroup Tests (including AddItem, DeleteItem) */
578 CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_COMMON|DDE_TEST_CREATEGROUP|testnum++);
579 CreateAddItemText(itemtext, f1g1, "f1g1Name");
580 AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f1g1Name.lnk", "Group1", DDE_TEST_COMMON|DDE_TEST_ADDITEM|testnum++);
581 CreateAddItemText(itemtext, f2g1, "f2g1Name");
582 AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_COMMON|DDE_TEST_ADDITEM|testnum++);
583 DeleteItemTest(instance, hConv, "[DeleteItem(f2g1Name)]", DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_COMMON|DDE_TEST_DELETEITEM|testnum++);
584 CreateAddItemText(itemtext, f3g1, "f3g1Name");
585 AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_COMMON|DDE_TEST_ADDITEM|testnum++);
586 CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_COMMON|DDE_TEST_CREATEGROUP|testnum++);
587 /* Create Group that already exists - same instance */
588 CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_COMMON|DDE_TEST_CREATEGROUP|testnum++);
590 /* ShowGroup Tests */
591 ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, Startup, StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++);
592 DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_COMMON|DDE_TEST_DELETEITEM|testnum++);
593 ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, Startup, StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++);
594 ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++);
596 /* DeleteGroup Test - Note that Window is Open for this test */
597 DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++);
599 /* Compound Execute String Command */
600 lstrcpyA(comptext, "[CreateGroup(Group3)]");
601 CreateAddItemText(itemtext, f1g3, "f1g3Name");
602 lstrcatA(comptext, itemtext);
603 CreateAddItemText(itemtext, f2g3, "f2g3Name");
604 lstrcatA(comptext, itemtext);
605 CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMMON|DDE_TEST_COMPOUND|testnum++);
607 DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++);
609 /* Full Parameters of Add Item */
610 /* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */
621 /* 2nd set of tests - 2nd connection */
622 static void DdeTestProgman2(DWORD instance, HCONV hConv, int testnum)
624 /* Create Group that already exists on a separate connection */
625 CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_COMMON|DDE_TEST_CREATEGROUP|testnum++);
626 DeleteGroupTest(instance, hConv, "[DeleteGroup(Group2)]", DMLERR_NO_ERROR, "Group2", DDE_TEST_COMMON|DDE_TEST_DELETEGROUP|testnum++);
629 START_TEST(progman_dde)
637 init_function_pointers();
640 /* Initialize DDE Instance */
641 err = DdeInitialize(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
642 ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
644 /* Create Connection */
645 hszProgman = DdeCreateStringHandle(instance, "PROGMAN", CP_WINANSI);
646 ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
647 hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
648 ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
649 /* Seeing failures on early versions of Windows Connecting to progman, exit if connection fails */
652 ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
657 testnum = DdeTestProgman(instance, hConv);
660 ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
661 ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
663 /* 2nd Instance (Followup Tests) */
664 /* Initialize DDE Instance */
666 err = DdeInitialize(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
667 ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
669 /* Create Connection */
670 hszProgman = DdeCreateStringHandle(instance, "PROGMAN", CP_WINANSI);
671 ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
672 hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
673 ok (hConv != NULL, "DdeConnect Error %s\n", GetDdeLastErrorStr(instance));
674 ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
677 DdeTestProgman2(instance, hConv, testnum);
680 ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
681 ok (DdeUninitialize(instance), "DdeUninitialize failed\n");