Reactos

[SHELL32_WINETEST] Sync with Wine Staging 3.3. CORE-14434

+1858 -1480
+1 -1
modules/rostests/winetests/shell32/CMakeLists.txt
··· 32 32 33 33 target_link_libraries(shell32_winetest uuid) 34 34 set_module_type(shell32_winetest win32cui) 35 - add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 gdi32 advapi32 msvcrt kernel32) 35 + add_importlibs(shell32_winetest shell32 shlwapi ole32 oleaut32 user32 gdi32 advapi32 msvcrt kernel32) 36 36 37 37 if(MSVC) 38 38 add_importlibs(shell32_winetest ntdll)
+6 -1
modules/rostests/winetests/shell32/appbar.c
··· 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 18 */ 19 19 20 - #include "precomp.h" 20 + #include <stdarg.h> 21 + 22 + #include <windows.h> 23 + #include "shellapi.h" 24 + 25 + #include "wine/test.h" 21 26 22 27 #define MSG_APPBAR WM_APP 23 28
+12 -4
modules/rostests/winetests/shell32/assoc.c
··· 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 18 */ 19 19 20 - #include "precomp.h" 20 + #define COBJMACROS 21 21 22 - #include <shobjidl.h> 22 + #include <stdarg.h> 23 + 24 + #include "shlwapi.h" 25 + #include "shlguid.h" 26 + #include "shobjidl.h" 27 + 28 + #include "wine/heap.h" 29 + #include "wine/test.h" 30 + 23 31 24 32 static void test_IQueryAssociations_QueryInterface(void) 25 33 { ··· 114 122 return; 115 123 } 116 124 117 - buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); 125 + buffer = heap_alloc(len * sizeof(WCHAR)); 118 126 ok_(__FILE__, line)(buffer != NULL, "out of memory\n"); 119 127 hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len); 120 128 ok_(__FILE__, line)(hr == S_OK, "GetString returned 0x%x, expected S_OK\n", hr); ··· 126 134 } 127 135 128 136 IQueryAssociations_Release(assoc); 129 - HeapFree(GetProcessHeap(), 0, buffer); 137 + heap_free(buffer); 130 138 } 131 139 132 140 static void test_IQueryAssociations_GetString(void)
+179 -1
modules/rostests/winetests/shell32/autocomplete.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #define COBJMACROS 22 + 23 + #include <stdarg.h> 24 + 25 + #include "windows.h" 26 + #include "shobjidl.h" 27 + #include "shlguid.h" 28 + #include "initguid.h" 29 + #include "shldisp.h" 30 + 31 + #include "wine/heap.h" 32 + #include "wine/test.h" 22 33 23 34 static HWND hMainWnd, hEdit; 24 35 static HINSTANCE hinst; ··· 216 227 CW_USEDEFAULT, CW_USEDEFAULT, 130, 105, NULL, NULL, GetModuleHandleA(NULL), 0); 217 228 } 218 229 230 + struct string_enumerator 231 + { 232 + IEnumString IEnumString_iface; 233 + LONG ref; 234 + WCHAR **data; 235 + int data_len; 236 + int cur; 237 + }; 238 + 239 + static struct string_enumerator *impl_from_IEnumString(IEnumString *iface) 240 + { 241 + return CONTAINING_RECORD(iface, struct string_enumerator, IEnumString_iface); 242 + } 243 + 244 + static HRESULT WINAPI string_enumerator_QueryInterface(IEnumString *iface, REFIID riid, void **ppv) 245 + { 246 + if (IsEqualGUID(riid, &IID_IEnumString) || IsEqualGUID(riid, &IID_IUnknown)) 247 + { 248 + IUnknown_AddRef(iface); 249 + *ppv = iface; 250 + return S_OK; 251 + } 252 + 253 + *ppv = NULL; 254 + return E_NOINTERFACE; 255 + } 256 + 257 + static ULONG WINAPI string_enumerator_AddRef(IEnumString *iface) 258 + { 259 + struct string_enumerator *this = impl_from_IEnumString(iface); 260 + 261 + ULONG ref = InterlockedIncrement(&this->ref); 262 + 263 + return ref; 264 + } 265 + 266 + static ULONG WINAPI string_enumerator_Release(IEnumString *iface) 267 + { 268 + struct string_enumerator *this = impl_from_IEnumString(iface); 269 + 270 + ULONG ref = InterlockedDecrement(&this->ref); 271 + 272 + if (!ref) 273 + heap_free(this); 274 + 275 + return ref; 276 + } 277 + 278 + static HRESULT WINAPI string_enumerator_Next(IEnumString *iface, ULONG num, LPOLESTR *strings, ULONG *num_returned) 279 + { 280 + struct string_enumerator *this = impl_from_IEnumString(iface); 281 + int i, len; 282 + 283 + *num_returned = 0; 284 + for (i = 0; i < num; i++) 285 + { 286 + if (this->cur >= this->data_len) 287 + return S_FALSE; 288 + 289 + len = lstrlenW(this->data[this->cur]) + 1; 290 + 291 + strings[i] = CoTaskMemAlloc(len * sizeof(WCHAR)); 292 + memcpy(strings[i], this->data[this->cur], len * sizeof(WCHAR)); 293 + 294 + (*num_returned)++; 295 + this->cur++; 296 + } 297 + 298 + return S_OK; 299 + } 300 + 301 + static HRESULT WINAPI string_enumerator_Reset(IEnumString *iface) 302 + { 303 + struct string_enumerator *this = impl_from_IEnumString(iface); 304 + 305 + this->cur = 0; 306 + 307 + return S_OK; 308 + } 309 + 310 + static HRESULT WINAPI string_enumerator_Skip(IEnumString *iface, ULONG num) 311 + { 312 + struct string_enumerator *this = impl_from_IEnumString(iface); 313 + 314 + this->cur += num; 315 + 316 + return S_OK; 317 + } 318 + 319 + static HRESULT WINAPI string_enumerator_Clone(IEnumString *iface, IEnumString **out) 320 + { 321 + *out = NULL; 322 + return E_NOTIMPL; 323 + } 324 + 325 + static IEnumStringVtbl string_enumerator_vtlb = 326 + { 327 + string_enumerator_QueryInterface, 328 + string_enumerator_AddRef, 329 + string_enumerator_Release, 330 + string_enumerator_Next, 331 + string_enumerator_Skip, 332 + string_enumerator_Reset, 333 + string_enumerator_Clone 334 + }; 335 + 336 + static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int count) 337 + { 338 + struct string_enumerator *object; 339 + 340 + object = heap_alloc_zero(sizeof(*object)); 341 + object->IEnumString_iface.lpVtbl = &string_enumerator_vtlb; 342 + object->ref = 1; 343 + object->data = suggestions; 344 + object->data_len = count; 345 + object->cur = 0; 346 + 347 + *ppv = &object->IEnumString_iface; 348 + 349 + return S_OK; 350 + } 351 + 352 + static void test_custom_source(void) 353 + { 354 + static WCHAR str_alpha[] = {'t','e','s','t','1',0}; 355 + static WCHAR str_alpha2[] = {'t','e','s','t','2',0}; 356 + static WCHAR str_beta[] = {'a','u','t','o',' ','c','o','m','p','l','e','t','e',0}; 357 + static WCHAR *suggestions[] = { str_alpha, str_alpha2, str_beta }; 358 + IUnknown *enumerator; 359 + IAutoComplete2 *autocomplete; 360 + HWND hwnd_edit; 361 + WCHAR buffer[20]; 362 + HRESULT hr; 363 + MSG msg; 364 + 365 + ShowWindow(hMainWnd, SW_SHOW); 366 + 367 + hwnd_edit = CreateWindowA("Edit", "", WS_OVERLAPPED | WS_VISIBLE | WS_CHILD | WS_BORDER, 50, 5, 200, 20, hMainWnd, 0, NULL, 0); 368 + 369 + hr = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (void**)&autocomplete); 370 + ok(hr == S_OK, "CoCreateInstance failed: %x\n", hr); 371 + 372 + string_enumerator_create((void**)&enumerator, suggestions, sizeof(suggestions) / sizeof(*suggestions)); 373 + 374 + hr = IAutoComplete2_SetOptions(autocomplete, ACO_AUTOSUGGEST | ACO_AUTOAPPEND); 375 + ok(hr == S_OK, "IAutoComplete2_SetOptions failed: %x\n", hr); 376 + hr = IAutoComplete2_Init(autocomplete, hwnd_edit, enumerator, NULL, NULL); 377 + ok(hr == S_OK, "IAutoComplete_Init failed: %x\n", hr); 378 + 379 + SendMessageW(hwnd_edit, WM_CHAR, 'a', 1); 380 + /* Send a keyup message since wine doesn't handle WM_CHAR yet */ 381 + SendMessageW(hwnd_edit, WM_KEYUP, 'u', 1); 382 + Sleep(100); 383 + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) 384 + { 385 + TranslateMessage(&msg); 386 + DispatchMessageA(&msg); 387 + } 388 + SendMessageW(hwnd_edit, WM_GETTEXT, sizeof(buffer) / sizeof(*buffer), (LPARAM)buffer); 389 + ok(lstrcmpW(str_beta, buffer) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str_beta), wine_dbgstr_w(buffer)); 390 + 391 + ShowWindow(hMainWnd, SW_HIDE); 392 + DestroyWindow(hwnd_edit); 393 + } 394 + 219 395 START_TEST(autocomplete) 220 396 { 221 397 HRESULT r; ··· 236 412 if (!ac) 237 413 goto cleanup; 238 414 test_killfocus(); 415 + 416 + test_custom_source(); 239 417 240 418 PostQuitMessage(0); 241 419 while(GetMessageA(&msg,0,0,0)) {
+8 -1
modules/rostests/winetests/shell32/brsfolder.c
··· 19 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 20 20 */ 21 21 22 - #include "precomp.h" 22 + #define COBJMACROS 23 + 24 + #include <windows.h> 25 + #include <shlobj.h> 26 + #include <shobjidl.h> 27 + #include <string.h> 28 + #include "shellapi.h" 23 29 30 + #include "wine/test.h" 24 31 #define IDD_MAKENEWFOLDER 0x3746 /* From "../shresdef.h" */ 25 32 #define TIMER_WAIT_MS 50 /* Should be long enough for slow systems */ 26 33
+18 -9
modules/rostests/winetests/shell32/ebrowser.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #include <stdio.h> 22 + 23 + #define COBJMACROS 24 + #define CONST_VTABLE 22 25 23 - #include <initguid.h> 24 - #include <mshtml.h> 26 + #include "shlobj.h" 27 + #include "shlwapi.h" 28 + 29 + #include "wine/heap.h" 30 + #include "wine/test.h" 31 + 32 + #include "initguid.h" 33 + #include "mshtml.h" 25 34 26 35 /********************************************************************** 27 36 * Some IIDs for test_SetSite. ··· 231 240 ULONG ref = InterlockedDecrement(&This->ref); 232 241 233 242 if(!ref) 234 - HeapFree(GetProcessHeap(), 0, This); 243 + heap_free(This); 235 244 236 245 return ref; 237 246 } ··· 277 286 { 278 287 IExplorerPaneVisibilityImpl *epv; 279 288 280 - epv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IExplorerPaneVisibilityImpl)); 289 + epv = heap_alloc_zero(sizeof(*epv)); 281 290 epv->IExplorerPaneVisibility_iface.lpVtbl = &epvvt; 282 291 epv->ref = 1; 283 292 ··· 320 329 ULONG ref = InterlockedDecrement(&This->ref); 321 330 322 331 if(!ref) 323 - HeapFree(GetProcessHeap(), 0, This); 332 + heap_free(This); 324 333 325 334 return ref; 326 335 } ··· 431 440 { 432 441 ICommDlgBrowser3Impl *cdb; 433 442 434 - cdb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICommDlgBrowser3Impl)); 443 + cdb = heap_alloc_zero(sizeof(*cdb)); 435 444 cdb->ICommDlgBrowser3_iface.lpVtbl = &cdbvtbl; 436 445 cdb->ref = 1; 437 446 ··· 489 498 LONG ref = InterlockedDecrement(&This->ref); 490 499 491 500 if(!ref) 492 - HeapFree(GetProcessHeap(), 0, This); 501 + heap_free(This); 493 502 494 503 return ref; 495 504 } ··· 540 549 541 550 static IServiceProviderImpl *create_serviceprovider(void) 542 551 { 543 - IServiceProviderImpl *sp = HeapAlloc(GetProcessHeap(), 0, sizeof(IServiceProviderImpl)); 552 + IServiceProviderImpl *sp = heap_alloc(sizeof(*sp)); 544 553 sp->IServiceProvider_iface.lpVtbl = &spvtbl; 545 554 sp->ref = 1; 546 555 return sp;
+18 -1
modules/rostests/winetests/shell32/generated.c
··· 5 5 * Unit tests for data structure packing 6 6 */ 7 7 8 - #include "precomp.h" 8 + #ifndef __REACTOS__ 9 + #define WINVER 0x0501 10 + #define _WIN32_IE 0x0501 11 + #define _WIN32_WINNT 0x0501 12 + #endif 13 + 14 + #define WINE_NOWINSOCK 15 + 16 + #include <stdarg.h> 17 + #include "windef.h" 18 + #include "winbase.h" 19 + #include "wtypes.h" 20 + #include "shellapi.h" 21 + #include "winuser.h" 22 + #include "wingdi.h" 23 + #include "shlobj.h" 24 + 25 + #include "wine/test.h" 9 26 10 27 /*********************************************************************** 11 28 * Compatibility macros
+10 -7
modules/rostests/winetests/shell32/msg.h
··· 20 20 21 21 #pragma once 22 22 23 + #include <assert.h> 24 + #include <windows.h> 25 + 26 + #include "wine/heap.h" 27 + #include "wine/test.h" 28 + 23 29 /* undocumented SWP flags - from SDK 3.1 */ 24 30 #define SWP_NOCLIENTSIZE 0x0800 25 31 #define SWP_NOCLIENTMOVE 0x1000 ··· 64 70 if (!msg_seq->sequence) 65 71 { 66 72 msg_seq->size = 10; 67 - msg_seq->sequence = HeapAlloc(GetProcessHeap(), 0, 68 - msg_seq->size * sizeof (struct message)); 73 + msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (struct message)); 69 74 } 70 75 71 76 if (msg_seq->count == msg_seq->size) 72 77 { 73 78 msg_seq->size *= 2; 74 - msg_seq->sequence = HeapReAlloc(GetProcessHeap(), 0, 75 - msg_seq->sequence, 76 - msg_seq->size * sizeof (struct message)); 79 + msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message)); 77 80 } 78 81 79 82 assert(msg_seq->sequence); ··· 90 93 static void flush_sequence(struct msg_sequence **seg, int sequence_index) 91 94 { 92 95 struct msg_sequence *msg_seq = seg[sequence_index]; 93 - HeapFree(GetProcessHeap(), 0, msg_seq->sequence); 96 + heap_free(msg_seq->sequence); 94 97 msg_seq->sequence = NULL; 95 98 msg_seq->count = msg_seq->size = 0; 96 99 } ··· 288 291 int i; 289 292 290 293 for (i = 0; i < n; i++) 291 - seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct msg_sequence)); 294 + seq[i] = heap_alloc_zero(sizeof(struct msg_sequence)); 292 295 }
+4 -7
modules/rostests/winetests/shell32/precomp.h
··· 1 + 1 2 #ifndef _SHELL32_WINETEST_PRECOMP_H_ 2 3 #define _SHELL32_WINETEST_PRECOMP_H_ 3 4 ··· 5 6 #include <stdio.h> 6 7 7 8 #define WIN32_NO_STATUS 8 - #define _INC_WINDOWS 9 - #define COM_NO_WINDOWS_H 10 9 11 10 #define COBJMACROS 12 11 #define CONST_VTABLE 13 12 13 + #include <windows.h> 14 + 15 + #include <wine/heap.h> 14 16 #include <wine/test.h> 15 17 16 - #include <winreg.h> 17 - #include <winnls.h> 18 - #include <winuser.h> 19 - #include <wincon.h> 20 18 #include <shellapi.h> 21 19 #include <shlwapi.h> 22 20 #include <shlguid.h> 23 21 #include <shlobj.h> 24 - #include <ddeml.h> 25 22 #include <commoncontrols.h> 26 23 #include <reactos/undocshell.h> 27 24
+263 -534
modules/rostests/winetests/shell32/progman_dde.c
··· 26 26 * Tests for Invalid Characters in Names / Invalid Parameters 27 27 */ 28 28 29 - #include "precomp.h" 30 - 31 - /* Timeout on DdeClientTransaction Call */ 32 - #define MS_TIMEOUT_VAL 1000 33 - /* # of times to poll for window creation */ 34 - #define PDDE_POLL_NUM 150 35 - /* time to sleep between polls */ 36 - #define PDDE_POLL_TIME 300 37 - 38 - /* Call Info */ 39 - #define DDE_TEST_MISC 0x00010000 40 - #define DDE_TEST_CREATEGROUP 0x00020000 41 - #define DDE_TEST_DELETEGROUP 0x00030000 42 - #define DDE_TEST_SHOWGROUP 0x00040000 43 - #define DDE_TEST_ADDITEM 0x00050000 44 - #define DDE_TEST_DELETEITEM 0x00060000 45 - #define DDE_TEST_COMPOUND 0x00070000 46 - #define DDE_TEST_CALLMASK 0x00ff0000 47 - 48 - #define DDE_TEST_NUMMASK 0x0000ffff 29 + #include <stdio.h> 30 + #include <wine/test.h> 31 + #include <winbase.h> 32 + #include "dde.h" 33 + #include "ddeml.h" 34 + #include "winuser.h" 35 + #include "shlobj.h" 49 36 50 37 static HRESULT (WINAPI *pSHGetLocalizedName)(LPCWSTR, LPWSTR, UINT, int *); 51 - static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL); 52 - static BOOL (WINAPI *pReadCabinetState)(CABINETSTATE *, int); 53 38 54 39 static void init_function_pointers(void) 55 40 { ··· 57 42 58 43 hmod = GetModuleHandleA("shell32.dll"); 59 44 pSHGetLocalizedName = (void*)GetProcAddress(hmod, "SHGetLocalizedName"); 60 - pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA"); 61 - pReadCabinetState = (void*)GetProcAddress(hmod, "ReadCabinetState"); 62 - if (!pReadCabinetState) 63 - pReadCabinetState = (void*)GetProcAddress(hmod, (LPSTR)651); 64 45 } 65 46 66 47 static BOOL use_common(void) ··· 101 82 CABINETSTATE cs; 102 83 103 84 memset(&cs, 0, sizeof(cs)); 104 - if (pReadCabinetState) 105 - { 106 - pReadCabinetState(&cs, sizeof(cs)); 107 - } 108 - else 109 - { 110 - HKEY key; 111 - DWORD size; 112 - 113 - win_skip("ReadCabinetState is not available, reading registry directly\n"); 114 - RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &key); 115 - size = sizeof(cs); 116 - RegQueryValueExA(key, "Settings", NULL, NULL, (LPBYTE)&cs, &size); 117 - RegCloseKey(key); 118 - } 85 + ReadCabinetState(&cs, sizeof(cs)); 119 86 120 87 return (cs.fFullPathTitle == -1); 121 88 } 122 89 123 90 static char ProgramsDir[MAX_PATH]; 124 91 125 - static char Group1Title[MAX_PATH] = "Group1"; 126 - static char Group2Title[MAX_PATH] = "Group2"; 127 - static char Group3Title[MAX_PATH] = "Group3"; 128 - static char StartupTitle[MAX_PATH] = "Startup"; 129 - 130 92 static void init_strings(void) 131 93 { 132 - char startup[MAX_PATH]; 133 94 char commonprograms[MAX_PATH]; 134 95 char programs[MAX_PATH]; 135 96 136 - if (pSHGetSpecialFolderPathA) 137 - { 138 - pSHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE); 139 - pSHGetSpecialFolderPathA(NULL, commonprograms, CSIDL_COMMON_PROGRAMS, FALSE); 140 - pSHGetSpecialFolderPathA(NULL, startup, CSIDL_STARTUP, FALSE); 141 - } 142 - else 143 - { 144 - HKEY key; 145 - DWORD size; 146 - 147 - /* Older Win9x and NT4 */ 148 - 149 - RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key); 150 - size = sizeof(programs); 151 - RegQueryValueExA(key, "Programs", NULL, NULL, (LPBYTE)&programs, &size); 152 - size = sizeof(startup); 153 - RegQueryValueExA(key, "Startup", NULL, NULL, (LPBYTE)&startup, &size); 154 - RegCloseKey(key); 155 - 156 - RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key); 157 - size = sizeof(commonprograms); 158 - RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&commonprograms, &size); 159 - RegCloseKey(key); 160 - } 97 + SHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE); 98 + SHGetSpecialFolderPathA(NULL, commonprograms, CSIDL_COMMON_PROGRAMS, FALSE); 161 99 162 100 /* ProgramsDir on Vista+ is always the users one (CSIDL_PROGRAMS). Before Vista 163 101 * it depends on whether the user is an administrator (CSIDL_COMMON_PROGRAMS) or ··· 167 105 lstrcpyA(ProgramsDir, commonprograms); 168 106 else 169 107 lstrcpyA(ProgramsDir, programs); 170 - 171 - if (full_title()) 172 - { 173 - lstrcpyA(Group1Title, ProgramsDir); 174 - lstrcatA(Group1Title, "\\Group1"); 175 - lstrcpyA(Group2Title, ProgramsDir); 176 - lstrcatA(Group2Title, "\\Group2"); 177 - lstrcpyA(Group3Title, ProgramsDir); 178 - lstrcatA(Group3Title, "\\Group3"); 179 - 180 - lstrcpyA(StartupTitle, startup); 181 - } 182 - else 183 - { 184 - /* Vista has the nice habit of displaying the full path in English 185 - * and the short one localized. CSIDL_STARTUP on Vista gives us the 186 - * English version so we have to 'translate' this one. 187 - * 188 - * MSDN claims it should be used for files not folders but this one 189 - * suits our purposes just fine. 190 - */ 191 - if (pSHGetLocalizedName) 192 - { 193 - WCHAR startupW[MAX_PATH]; 194 - WCHAR module[MAX_PATH]; 195 - WCHAR module_expanded[MAX_PATH]; 196 - WCHAR localized[MAX_PATH]; 197 - HRESULT hr; 198 - int id; 199 - 200 - MultiByteToWideChar(CP_ACP, 0, startup, -1, startupW, sizeof(startupW)/sizeof(WCHAR)); 201 - hr = pSHGetLocalizedName(startupW, module, MAX_PATH, &id); 202 - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); 203 - /* check to be removed when SHGetLocalizedName is implemented */ 204 - if (hr == S_OK) 205 - { 206 - ExpandEnvironmentStringsW(module, module_expanded, MAX_PATH); 207 - LoadStringW(GetModuleHandleW(module_expanded), id, localized, MAX_PATH); 208 - 209 - WideCharToMultiByte(CP_ACP, 0, localized, -1, StartupTitle, sizeof(StartupTitle), NULL, NULL); 210 - } 211 - else 212 - lstrcpyA(StartupTitle, (strrchr(startup, '\\') + 1)); 213 - } 214 - else 215 - { 216 - lstrcpyA(StartupTitle, (strrchr(startup, '\\') + 1)); 217 - } 218 - } 219 108 } 220 109 221 110 static HDDEDATA CALLBACK DdeCallback(UINT type, UINT format, HCONV hConv, HSZ hsz1, HSZ hsz2, ··· 225 114 return NULL; 226 115 } 227 116 228 - /* 229 - * Encoded String for Error Messages so that inner failures can determine 230 - * what test is failing. Format is: [Code:TestNum] 231 - */ 232 - static const char * GetStringFromTestParams(int testParams) 117 + static UINT dde_execute(DWORD instance, HCONV hconv, const char *command_str) 233 118 { 234 - int testNum; 235 - static char testParamString[64]; 236 - const char *callId; 119 + HDDEDATA command, hdata; 120 + DWORD result; 121 + UINT ret; 237 122 238 - testNum = testParams & DDE_TEST_NUMMASK; 239 - switch (testParams & DDE_TEST_CALLMASK) 240 - { 241 - default: 242 - case DDE_TEST_MISC: 243 - callId = "MISC"; 244 - break; 245 - case DDE_TEST_CREATEGROUP: 246 - callId = "C_G"; 247 - break; 248 - case DDE_TEST_DELETEGROUP: 249 - callId = "D_G"; 250 - break; 251 - case DDE_TEST_SHOWGROUP: 252 - callId = "S_G"; 253 - break; 254 - case DDE_TEST_ADDITEM: 255 - callId = "A_I"; 256 - break; 257 - case DDE_TEST_DELETEITEM: 258 - callId = "D_I"; 259 - break; 260 - case DDE_TEST_COMPOUND: 261 - callId = "CPD"; 262 - break; 263 - } 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)); 264 125 265 - sprintf(testParamString, " [%s:%i]", callId, testNum); 266 - return testParamString; 267 - } 126 + hdata = DdeClientTransaction((BYTE *)command, -1, hconv, 0, 0, XTYP_EXECUTE, 2000, &result); 127 + ret = DdeGetLastError(instance); 128 + /* PROGMAN always returns 1 on success */ 129 + ok((UINT_PTR)hdata == !ret, "expected %u, got %p\n", !ret, hdata); 268 130 269 - /* Transfer DMLERR's into text readable strings for Error Messages */ 270 - #define DMLERR_TO_STR(x) case x: return#x; 271 - static const char * GetStringFromError(UINT err) 272 - { 273 - switch (err) 274 - { 275 - DMLERR_TO_STR(DMLERR_NO_ERROR); 276 - DMLERR_TO_STR(DMLERR_ADVACKTIMEOUT); 277 - DMLERR_TO_STR(DMLERR_BUSY); 278 - DMLERR_TO_STR(DMLERR_DATAACKTIMEOUT); 279 - DMLERR_TO_STR(DMLERR_DLL_NOT_INITIALIZED); 280 - DMLERR_TO_STR(DMLERR_DLL_USAGE); 281 - DMLERR_TO_STR(DMLERR_EXECACKTIMEOUT); 282 - DMLERR_TO_STR(DMLERR_INVALIDPARAMETER); 283 - DMLERR_TO_STR(DMLERR_LOW_MEMORY); 284 - DMLERR_TO_STR(DMLERR_MEMORY_ERROR); 285 - DMLERR_TO_STR(DMLERR_NOTPROCESSED); 286 - DMLERR_TO_STR(DMLERR_NO_CONV_ESTABLISHED); 287 - DMLERR_TO_STR(DMLERR_POKEACKTIMEOUT); 288 - DMLERR_TO_STR(DMLERR_POSTMSG_FAILED); 289 - DMLERR_TO_STR(DMLERR_REENTRANCY); 290 - DMLERR_TO_STR(DMLERR_SERVER_DIED); 291 - DMLERR_TO_STR(DMLERR_SYS_ERROR); 292 - DMLERR_TO_STR(DMLERR_UNADVACKTIMEOUT); 293 - DMLERR_TO_STR(DMLERR_UNFOUND_QUEUE_ID); 294 - default: 295 - return "Unknown DML Error"; 296 - } 131 + return ret; 297 132 } 298 133 299 - /* Helper Function to Transfer DdeGetLastError into a String */ 300 - static const char * GetDdeLastErrorStr(DWORD instance) 134 + static char *dde_request(DWORD instance, HCONV hconv, const char *request_str) 301 135 { 302 - UINT err = DdeGetLastError(instance); 136 + static char data[2000]; 137 + HDDEDATA hdata; 138 + HSZ item; 139 + DWORD result; 303 140 304 - return GetStringFromError(err); 305 - } 141 + item = DdeCreateStringHandleA(instance, request_str, CP_WINANSI); 142 + ok(item != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance)); 306 143 307 - /* Execute a Dde Command and return the error & result */ 308 - /* Note: Progman DDE always returns a pointer to 0x00000001 on a successful result */ 309 - static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, HDDEDATA *hData, UINT *err, int testParams) 310 - { 311 - HDDEDATA command; 144 + hdata = DdeClientTransaction(NULL, -1, hconv, item, CF_TEXT, XTYP_REQUEST, 2000, &result); 145 + if (hdata == NULL) return NULL; 312 146 313 - command = DdeCreateDataHandle(instance, (LPBYTE) strCmd, strlen(strCmd)+1, 0, 0L, 0, 0); 314 - ok (command != NULL, "DdeCreateDataHandle Error %s.%s\n", 315 - GetDdeLastErrorStr(instance), GetStringFromTestParams(testParams)); 316 - *hData = DdeClientTransaction((void *) command, 317 - -1, 318 - hConv, 319 - 0, 320 - 0, 321 - XTYP_EXECUTE, 322 - MS_TIMEOUT_VAL, 323 - NULL); 147 + DdeGetData(hdata, (BYTE *)data, 2000, 0); 324 148 325 - /* hData is technically a pointer, but for Program Manager, 326 - * it is NULL (error) or 1 (success) 327 - * TODO: Check other versions of Windows to verify 1 is returned. 328 - * While it is unlikely that anyone is actually testing that the result is 1 329 - * if all versions of windows return 1, Wine should also. 330 - */ 331 - if (*hData == NULL) 332 - { 333 - *err = DdeGetLastError(instance); 334 - } 335 - else 336 - { 337 - *err = DMLERR_NO_ERROR; 338 - todo_wine 339 - { 340 - ok(*hData == (HDDEDATA) 1, "Expected HDDEDATA Handle == 1, actually %p.%s\n", 341 - *hData, GetStringFromTestParams(testParams)); 342 - } 343 - } 344 - DdeFreeDataHandle(command); 149 + return data; 345 150 } 346 151 347 - /* 348 - * Check if Window is onscreen with the appropriate name. 349 - * 350 - * Windows are not created synchronously. So we do not know 351 - * when and if the window will be created/shown on screen. 352 - * This function implements a polling mechanism to determine 353 - * creation. 354 - * A more complicated method would be to use SetWindowsHookEx. 355 - * Since polling worked fine in my testing, no reason to implement 356 - * the other. Comments about other methods of determining when 357 - * window creation happened were not encouraging (not including 358 - * SetWindowsHookEx). 359 - */ 360 - static HWND CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams) 152 + static BOOL check_window_exists(const char *name) 361 153 { 154 + char title[MAX_PATH]; 362 155 HWND window = NULL; 363 156 int i; 364 157 365 - /* Poll for Window Creation */ 366 - for (i = 0; window == NULL && i < PDDE_POLL_NUM; i++) 158 + if (full_title()) 367 159 { 368 - Sleep(PDDE_POLL_TIME); 369 - /* Specify the window class name to make sure what we find is really an 370 - * Explorer window. Explorer used two different window classes so try 371 - * both. 372 - */ 373 - window = FindWindowA("ExplorerWClass", winName); 374 - if (!window) 375 - window = FindWindowA("CabinetWClass", winName); 160 + strcpy(title, ProgramsDir); 161 + strcat(title, "\\"); 162 + strcat(title, name); 376 163 } 377 - ok (window != NULL, "Window \"%s\" was not created in %i seconds - assumed failure.%s\n", 378 - winName, PDDE_POLL_NUM*PDDE_POLL_TIME/1000, GetStringFromTestParams(testParams)); 164 + else 165 + strcpy(title, name); 379 166 380 - /* Close Window as desired. */ 381 - if (window != NULL && closeWindow) 167 + for (i = 0; i < 20; i++) 382 168 { 383 - SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0); 384 - window = NULL; 169 + Sleep(100); 170 + if ((window = FindWindowA("ExplorerWClass", title)) || 171 + (window = FindWindowA("CabinetWClass", title))) 172 + { 173 + SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0); 174 + break; 175 + } 385 176 } 386 - return window; 177 + 178 + return (window != NULL); 387 179 } 388 180 389 - /* Check for Existence (or non-existence) of a file or group 390 - * When testing for existence of a group, groupName is not needed 391 - */ 392 - static void CheckFileExistsInProgramGroups(const char *nameToCheck, BOOL shouldExist, BOOL isGroup, 393 - const char *groupName, int testParams) 181 + static BOOL check_exists(const char *name) 394 182 { 395 183 char path[MAX_PATH]; 396 - DWORD attributes; 397 - int len; 398 184 399 - lstrcpyA(path, ProgramsDir); 400 - 401 - len = strlen(path) + strlen(nameToCheck)+1; 402 - if (groupName != NULL) 403 - { 404 - len += strlen(groupName)+1; 405 - } 406 - ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams)); 407 - if (len <= MAX_PATH) 408 - { 409 - if (groupName != NULL) 410 - { 411 - strcat(path, "\\"); 412 - strcat(path, groupName); 413 - } 414 - strcat(path, "\\"); 415 - strcat(path, nameToCheck); 416 - attributes = GetFileAttributesA(path); 417 - if (!shouldExist) 418 - { 419 - ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n", 420 - path, GetStringFromTestParams(testParams)); 421 - } else { 422 - if (attributes == INVALID_FILE_ATTRIBUTES) 423 - { 424 - ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams)); 425 - } else if (isGroup) { 426 - ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n", 427 - path, attributes, GetStringFromTestParams(testParams)); 428 - } else { 429 - ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n", 430 - path, attributes, GetStringFromTestParams(testParams)); 431 - } 432 - } 433 - } 185 + strcpy(path, ProgramsDir); 186 + strcat(path, "\\"); 187 + strcat(path, name); 188 + return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES; 434 189 } 435 190 436 - /* Create Group Test. 437 - * command and expected_result. 438 - * if expected_result is DMLERR_NO_ERROR, test 439 - * 1. group was created 440 - * 2. window is open 441 - */ 442 - static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, 443 - const char *groupName, const char *windowTitle, int testParams) 191 + static void test_parser(DWORD instance, HCONV hConv) 444 192 { 445 - HDDEDATA hData; 446 193 UINT error; 447 194 448 - /* Execute Command & Check Result */ 449 - DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); 450 - todo_wine 451 - { 452 - ok (expected_result == error, "CreateGroup %s: Expected Error %s, received %s.%s\n", 453 - groupName, GetStringFromError(expected_result), GetStringFromError(error), 454 - GetStringFromTestParams(testParams)); 455 - } 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); 456 230 457 - /* No Error */ 458 - if (error == DMLERR_NO_ERROR) 459 - { 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"); 460 234 461 - /* Check if Group Now Exists */ 462 - CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams); 463 - /* Check if Window is Open (polling) */ 464 - CheckWindowCreated(windowTitle, TRUE, testParams); 465 - } 466 - } 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"); 467 238 468 - /* Show Group Test. 469 - * DDE command, expected_result, and the group name to check for existence 470 - * if expected_result is DMLERR_NO_ERROR, test 471 - * 1. window is open 472 - */ 473 - static HWND ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, 474 - const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams) 475 - { 476 - HDDEDATA hData; 477 - UINT error; 478 - HWND hwnd = 0; 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"); 479 243 480 - DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); 481 - /* todo_wine... Is expected to fail, wine stubbed functions DO fail */ 482 - /* TODO REMOVE THIS CODE!!! */ 483 - todo_wine_if (expected_result != DMLERR_NOTPROCESSED) 484 - ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n", 485 - groupName, GetStringFromError(expected_result), GetStringFromError(error), 486 - GetStringFromTestParams(testParams)); 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"); 487 247 488 - if (error == DMLERR_NO_ERROR) 489 - { 490 - /* Check if Window is Open (polling) */ 491 - hwnd = CheckWindowCreated(windowTitle, closeAfterShowing, testParams); 492 - } 493 - return hwnd; 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); 494 257 } 495 258 496 - /* Delete Group Test. 497 - * DDE command, expected_result, and the group name to check for existence 498 - * if expected_result is DMLERR_NO_ERROR, test 499 - * 1. group does not exist 500 - */ 501 - static void DeleteGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, 502 - const char *groupName, int testParams) 259 + /* 1st set of tests */ 260 + static void test_progman_dde(DWORD instance, HCONV hConv) 503 261 { 504 - HDDEDATA hData; 505 262 UINT error; 506 263 507 - DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); 508 - todo_wine 509 - { 510 - ok (expected_result == error, "DeleteGroup %s: Expected Error %s, received %s.%s\n", 511 - groupName, GetStringFromError(expected_result), GetStringFromError(error), 512 - GetStringFromTestParams(testParams)); 513 - } 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"); 514 269 515 - if (error == DMLERR_NO_ERROR) 516 - { 517 - /* Check that Group does not exist */ 518 - CheckFileExistsInProgramGroups(groupName, FALSE, TRUE, NULL, testParams); 519 - } 520 - } 270 + error = dde_execute(instance, hConv, "[AddItem]"); 271 + ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error); 521 272 522 - /* Add Item Test 523 - * DDE command, expected result, and group and file name where it should exist. 524 - * checks to make sure error code matches expected error code 525 - * checks to make sure item exists if successful 526 - */ 527 - static void AddItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, 528 - const char *fileName, const char *groupName, int testParams) 529 - { 530 - HDDEDATA hData; 531 - UINT error; 273 + error = dde_execute(instance, hConv, "[AddItem(test)]"); 274 + ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error); 532 275 533 - DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); 534 - todo_wine 535 - { 536 - ok (expected_result == error, "AddItem %s: Expected Error %s, received %s.%s\n", 537 - fileName, GetStringFromError(expected_result), GetStringFromError(error), 538 - GetStringFromTestParams(testParams)); 539 - } 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"); 540 279 541 - if (error == DMLERR_NO_ERROR) 542 - { 543 - /* Check that File exists */ 544 - CheckFileExistsInProgramGroups(fileName, TRUE, FALSE, groupName, testParams); 545 - } 546 - } 280 + error = dde_execute(instance, hConv, "[DeleteItem(notepad.exe)]"); 281 + ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error); 547 282 548 - /* Delete Item Test. 549 - * DDE command, expected result, and group and file name where it should exist. 550 - * checks to make sure error code matches expected error code 551 - * checks to make sure item does not exist if successful 552 - */ 553 - static void DeleteItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, 554 - const char *fileName, const char *groupName, int testParams) 555 - { 556 - HDDEDATA hData; 557 - UINT error; 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"); 558 286 559 - DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); 560 - todo_wine 561 - { 562 - ok (expected_result == error, "DeleteItem %s: Expected Error %s, received %s.%s\n", 563 - fileName, GetStringFromError(expected_result), GetStringFromError(error), 564 - GetStringFromTestParams(testParams)); 565 - } 287 + error = dde_execute(instance, hConv, "[DeleteItem(notepad)]"); 288 + ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error); 566 289 567 - if (error == DMLERR_NO_ERROR) 568 - { 569 - /* Check that File does not exist */ 570 - CheckFileExistsInProgramGroups(fileName, FALSE, FALSE, groupName, testParams); 571 - } 572 - } 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"); 573 293 574 - /* Compound Command Test. 575 - * not really generic, assumes command of the form: 576 - * [CreateGroup ...][AddItem ...][AddItem ...] 577 - * All samples I've seen using Compound were of this form (CreateGroup, 578 - * AddItems) so this covers minimum expected functionality. 579 - */ 580 - static HWND CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, 581 - const char *groupName, const char *windowTitle, const char *fileName1, 582 - const char *fileName2, int testParams) 583 - { 584 - HDDEDATA hData; 585 - UINT error; 586 - HWND hwnd = 0; 294 + error = dde_execute(instance, hConv, "[AddItem(notepad)]"); 295 + ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error); 587 296 588 - DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); 589 - todo_wine 590 - { 591 - ok (expected_result == error, "Compound String %s: Expected Error %s, received %s.%s\n", 592 - command, GetStringFromError(expected_result), GetStringFromError(error), 593 - GetStringFromTestParams(testParams)); 594 - } 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). */ 595 299 596 - if (error == DMLERR_NO_ERROR) 597 - { 598 - /* Check that File exists */ 599 - CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams); 600 - hwnd = CheckWindowCreated(windowTitle, FALSE, testParams); 601 - CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams); 602 - CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams); 603 - } 604 - return hwnd; 605 - } 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"); 606 303 607 - static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name) 608 - { 609 - lstrcpyA(itemtext, "[AddItem("); 610 - lstrcatA(itemtext, cmdline); 611 - lstrcatA(itemtext, ","); 612 - lstrcatA(itemtext, name); 613 - lstrcatA(itemtext, ")]"); 614 - } 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"); 615 307 616 - /* 1st set of tests */ 617 - static int DdeTestProgman(DWORD instance, HCONV hConv) 618 - { 619 - HDDEDATA hData; 620 - UINT error; 621 - int testnum; 622 - char temppath[MAX_PATH]; 623 - char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH]; 624 - char itemtext[MAX_PATH + 20]; 625 - char comptext[2 * (MAX_PATH + 20) + 21]; 626 - HWND hwnd; 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"); 627 311 628 - testnum = 1; 629 - /* Invalid Command */ 630 - DdeExecuteCommand(instance, hConv, "[InvalidCommand()]", &hData, &error, DDE_TEST_MISC|testnum++); 631 - ok (error == DMLERR_NOTPROCESSED, "InvalidCommand(), expected error %s, received %s.\n", 632 - GetStringFromError(DMLERR_NOTPROCESSED), GetStringFromError(error)); 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"); 633 315 634 - /* On Vista+ the files have to exist when adding a link */ 635 - GetTempPathA(MAX_PATH, temppath); 636 - GetTempFileNameA(temppath, "dde", 0, f1g1); 637 - GetTempFileNameA(temppath, "dde", 0, f2g1); 638 - GetTempFileNameA(temppath, "dde", 0, f3g1); 639 - GetTempFileNameA(temppath, "dde", 0, f1g3); 640 - GetTempFileNameA(temppath, "dde", 0, f2g3); 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"); 641 319 642 - /* CreateGroup Tests (including AddItem, DeleteItem) */ 643 - CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++); 644 - CreateAddItemText(itemtext, f1g1, "f1g1Name"); 645 - AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f1g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++); 646 - CreateAddItemText(itemtext, f2g1, "f2g1Name"); 647 - AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++); 648 - DeleteItemTest(instance, hConv, "[DeleteItem(f2g1Name)]", DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++); 649 - CreateAddItemText(itemtext, f3g1, "f3g1Name"); 650 - AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++); 651 - CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++); 652 - /* Create Group that already exists - same instance */ 653 - CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++); 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"); 654 323 655 - /* ShowGroup Tests */ 656 - ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, "Group1", Group1Title, TRUE, DDE_TEST_SHOWGROUP|testnum++); 657 - DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++); 658 - ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, "Startup", StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++); 659 - hwnd = ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++); 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); 660 327 661 - /* DeleteGroup Test - Note that Window is Open for this test */ 662 - DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++); 663 - if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); 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"); 664 331 665 - /* Compound Execute String Command */ 666 - lstrcpyA(comptext, "[CreateGroup(Group3)]"); 667 - CreateAddItemText(itemtext, f1g3, "f1g3Name"); 668 - lstrcatA(comptext, itemtext); 669 - CreateAddItemText(itemtext, f2g3, "f2g3Name"); 670 - lstrcatA(comptext, itemtext); 671 - hwnd = CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMPOUND|testnum++); 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"); 672 348 673 - DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++); 674 - if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); 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"); 675 352 676 - /* Full Parameters of Add Item */ 677 - /* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */ 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"); 678 359 679 - DeleteFileA(f1g1); 680 - DeleteFileA(f2g1); 681 - DeleteFileA(f3g1); 682 - DeleteFileA(f1g3); 683 - DeleteFileA(f2g3); 360 + error = dde_execute(instance, hConv, "[ExitProgman(1)]"); 361 + ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error); 684 362 685 - return testnum; 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"); 686 366 } 687 367 688 368 /* 2nd set of tests - 2nd connection */ 689 - static void DdeTestProgman2(DWORD instance, HCONV hConv, int testnum) 369 + static void test_progman_dde2(DWORD instance, HCONV hConv) 690 370 { 691 - /* Create Group that already exists on a separate connection */ 692 - CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++); 693 - DeleteGroupTest(instance, hConv, "[DeleteGroup(Group2)]", DMLERR_NO_ERROR, "Group2", DDE_TEST_DELETEGROUP|testnum++); 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 + } 382 + 383 + static BOOL check_in_programs_list(const char *list, const char *group) 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 + } 394 + 395 + static void test_request_groups(DWORD instance, HCONV hconv) 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)); 404 + strcpy(programs, ProgramsDir); 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); 694 416 } 695 417 696 418 START_TEST(progman_dde) ··· 699 421 UINT err; 700 422 HSZ hszProgman; 701 423 HCONV hConv; 702 - int testnum; 424 + BOOL ret; 703 425 704 426 init_function_pointers(); 705 427 init_strings(); 706 428 707 429 /* Initialize DDE Instance */ 708 430 err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0); 709 - ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err)); 431 + ok(err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err); 710 432 711 433 /* Create Connection */ 712 434 hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI); 713 - ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance)); 435 + ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance)); 714 436 hConv = DdeConnect(instance, hszProgman, hszProgman, NULL); 715 - ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n"); 437 + ret = DdeFreeStringHandle(instance, hszProgman); 438 + ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance)); 716 439 /* Seeing failures on early versions of Windows Connecting to progman, exit if connection fails */ 717 440 if (hConv == NULL) 718 441 { ··· 720 443 return; 721 444 } 722 445 723 - /* Run Tests */ 724 - testnum = DdeTestProgman(instance, hConv); 446 + test_parser(instance, hConv); 447 + test_progman_dde(instance, hConv); 448 + test_request_groups(instance, hConv); 725 449 726 450 /* Cleanup & Exit */ 727 - ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance)); 728 - ok (DdeUninitialize(instance), "DdeUninitialize failed\n"); 451 + ret = DdeDisconnect(hConv); 452 + ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance)); 453 + ret = DdeUninitialize(instance); 454 + ok(ret, "DdeUninitialize() failed: %u\n", DdeGetLastError(instance)); 729 455 730 456 /* 2nd Instance (Followup Tests) */ 731 457 /* Initialize DDE Instance */ 732 458 instance = 0; 733 459 err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0); 734 - ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err)); 460 + ok (err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err); 735 461 736 462 /* Create Connection */ 737 463 hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI); 738 - ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance)); 464 + ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance)); 739 465 hConv = DdeConnect(instance, hszProgman, hszProgman, NULL); 740 - ok (hConv != NULL, "DdeConnect Error %s\n", GetDdeLastErrorStr(instance)); 741 - ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n"); 466 + ok(hConv != NULL, "DdeConnect() failed: %u\n", DdeGetLastError(instance)); 467 + ret = DdeFreeStringHandle(instance, hszProgman); 468 + ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance)); 742 469 743 470 /* Run Tests */ 744 - DdeTestProgman2(instance, hConv, testnum); 471 + test_progman_dde2(instance, hConv); 745 472 746 473 /* Cleanup & Exit */ 747 - ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance)); 748 - ok (DdeUninitialize(instance), "DdeUninitialize failed\n"); 474 + ret = DdeDisconnect(hConv); 475 + ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance)); 476 + ret = DdeUninitialize(instance); 477 + ok(ret, "DdeUninitialize() failed: %u\n", DdeGetLastError(instance)); 749 478 }
+6 -1
modules/rostests/winetests/shell32/recyclebin.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #define WIN32_LEAN_AND_MEAN 22 + #include <windows.h> 23 + #include "shellapi.h" 24 + 25 + #include <stdio.h> 26 + #include "wine/test.h" 22 27 23 28 static int (WINAPI *pSHQueryRecycleBinA)(LPCSTR,LPSHQUERYRBINFO); 24 29 static int (WINAPI *pSHFileOperationA)(LPSHFILEOPSTRUCTA);
+525 -161
modules/rostests/winetests/shell32/shelldispatch.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #define COBJMACROS 22 + #define NONAMELESSUNION 23 + #define NONAMELESSSTRUCT 22 24 23 - #include <winsvc.h> 24 - #include <initguid.h> 25 + #include "shldisp.h" 26 + #include "shlobj.h" 27 + #include "shlwapi.h" 28 + #include "winsvc.h" 29 + 30 + #include "wine/heap.h" 31 + #include "wine/test.h" 32 + 33 + #include "initguid.h" 25 34 26 35 #define EXPECT_HR(hr,hr_exp) \ 27 36 ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) 28 37 38 + #define EXPECT_REF(obj,ref) _expect_ref((IUnknown *)obj, ref, __LINE__) 39 + static void _expect_ref(IUnknown *obj, ULONG ref, int line) 40 + { 41 + ULONG rc; 42 + IUnknown_AddRef(obj); 43 + rc = IUnknown_Release(obj); 44 + ok_(__FILE__,line)(rc == ref, "Unexpected refcount %d, expected %d\n", rc, ref); 45 + } 46 + 29 47 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0}; 30 48 31 - static HRESULT (WINAPI *pSHGetFolderPathW)(HWND, int, HANDLE, DWORD, LPWSTR); 32 49 static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*); 33 - static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *); 34 - static DWORD (WINAPI *pGetLongPathNameW)(LPCWSTR, LPWSTR, DWORD); 35 50 36 51 /* Updated Windows 7 has a new IShellDispatch6 in its typelib */ 37 52 DEFINE_GUID(IID_IWin7ShellDispatch6, 0x34936ba1, 0x67ad, 0x4c41, 0x99,0xb8, 0x8c,0x12,0xdf,0xf1,0xe9,0x74); 38 53 54 + static BSTR a2bstr(const char *str) 55 + { 56 + BSTR ret; 57 + int len; 58 + 59 + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); 60 + ret = SysAllocStringLen(NULL, len); 61 + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); 62 + 63 + return ret; 64 + } 65 + 66 + static void variant_set_string(VARIANT *v, const char *s) 67 + { 68 + V_VT(v) = VT_BSTR; 69 + V_BSTR(v) = a2bstr(s); 70 + } 71 + 39 72 static void init_function_pointers(void) 40 73 { 41 - HMODULE hshell32, hkernel32; 74 + HMODULE hshell32; 42 75 43 76 hshell32 = GetModuleHandleA("shell32.dll"); 44 - hkernel32 = GetModuleHandleA("kernel32.dll"); 45 - pSHGetFolderPathW = (void*)GetProcAddress(hshell32, "SHGetFolderPathW"); 46 77 pSHGetNameFromIDList = (void*)GetProcAddress(hshell32, "SHGetNameFromIDList"); 47 - pSHGetSpecialFolderLocation = (void*)GetProcAddress(hshell32, 48 - "SHGetSpecialFolderLocation"); 49 - pGetLongPathNameW = (void*)GetProcAddress(hkernel32, "GetLongPathNameW"); 50 78 } 51 79 52 80 static void test_namespace(void) ··· 108 136 FolderItem *item; 109 137 VARIANT var; 110 138 BSTR title, item_path; 139 + IDispatch *disp; 111 140 int len, i; 112 141 113 - r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, 114 - &IID_IShellDispatch, (LPVOID*)&sd); 115 - if (r == REGDB_E_CLASSNOTREG) /* NT4 */ 116 - { 117 - win_skip("skipping IShellDispatch tests\n"); 118 - return; 119 - } 120 - ok(SUCCEEDED(r), "CoCreateInstance failed: %08x\n", r); 121 - if (FAILED(r)) 122 - return; 142 + r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void **)&sd); 143 + ok(SUCCEEDED(r), "Failed to create ShellDispatch object: %#x.\n", r); 144 + 145 + disp = NULL; 146 + r = IShellDispatch_get_Application(sd, &disp); 147 + ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r); 148 + ok(disp == (IDispatch *)sd, "Unexpected application pointer %p.\n", disp); 149 + IDispatch_Release(disp); 150 + 151 + disp = NULL; 152 + r = IShellDispatch_get_Parent(sd, &disp); 153 + ok(r == S_OK, "Failed to get Shell object parent, hr %#x.\n", r); 154 + ok(disp == (IDispatch *)sd, "Unexpected parent pointer %p.\n", disp); 155 + IDispatch_Release(disp); 123 156 124 157 VariantInit(&var); 125 158 folder = (void*)0xdeadbeef; ··· 135 168 folder = (void*)0xdeadbeef; 136 169 r = IShellDispatch_NameSpace(sd, var, &folder); 137 170 if (special_folders[i] == ssfALTSTARTUP || special_folders[i] == ssfCOMMONALTSTARTUP) 171 + todo_wine 138 172 ok(r == S_OK || broken(r == S_FALSE) /* winxp */, "Failed to get folder for index %#x, got %08x\n", special_folders[i], r); 139 173 else 140 174 ok(r == S_OK, "Failed to get folder for index %#x, got %08x\n", special_folders[i], r); ··· 144 178 145 179 V_VT(&var) = VT_I4; 146 180 V_I4(&var) = -1; 147 - folder = (void*)0xdeadbeef; 181 + folder = (void *)0xdeadbeef; 148 182 r = IShellDispatch_NameSpace(sd, var, &folder); 149 - todo_wine { 150 - ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); 151 - ok(folder == NULL, "got %p\n", folder); 152 - if (r == S_OK) 153 - Folder_Release(folder); 154 - } 183 + ok(r == S_FALSE, "Unexpected hr %#x.\n", r); 184 + ok(folder == NULL, "Unexpected folder instance %p\n", folder); 185 + 155 186 V_VT(&var) = VT_I4; 156 187 V_I4(&var) = ssfPROGRAMFILES; 157 188 r = IShellDispatch_NameSpace(sd, var, &folder); 158 - ok(r == S_OK || 159 - broken(r == S_FALSE), /* NT4 */ 160 - "IShellDispatch::NameSpace failed: %08x\n", r); 189 + ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r); 161 190 if (r == S_OK) 162 191 { 163 192 static WCHAR path[MAX_PATH]; 164 193 165 - if (pSHGetFolderPathW) 166 - { 167 - r = pSHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL, 168 - SHGFP_TYPE_CURRENT, path); 169 - ok(r == S_OK, "SHGetFolderPath failed: %08x\n", r); 170 - } 194 + r = SHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, path); 195 + ok(r == S_OK, "Failed to get folder path: %#x.\n", r); 196 + 171 197 r = Folder_get_Title(folder, &title); 172 - todo_wine 173 198 ok(r == S_OK, "Folder::get_Title failed: %08x\n", r); 174 199 if (r == S_OK) 175 200 { ··· 177 202 HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir. 178 203 On newer Windows it seems constant and is not changed 179 204 if the program files directory name is changed */ 180 - if (pSHGetSpecialFolderLocation && pSHGetNameFromIDList) 205 + if (pSHGetNameFromIDList) 181 206 { 182 207 LPITEMIDLIST pidl; 183 208 PWSTR name; 184 209 185 - r = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl); 210 + r = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl); 186 211 ok(r == S_OK, "SHGetSpecialFolderLocation failed: %08x\n", r); 187 212 r = pSHGetNameFromIDList(pidl, SIGDN_NORMALDISPLAY, &name); 188 213 ok(r == S_OK, "SHGetNameFromIDList failed: %08x\n", r); 189 - todo_wine 190 - ok(!lstrcmpW(title, name), "expected %s, got %s\n", 191 - wine_dbgstr_w(name), wine_dbgstr_w(title)); 214 + ok(!lstrcmpW(title, name), "expected %s, got %s\n", wine_dbgstr_w(name), wine_dbgstr_w(title)); 192 215 CoTaskMemFree(name); 193 216 CoTaskMemFree(pidl); 194 217 } 195 - else if (pSHGetFolderPathW) 218 + else 196 219 { 197 220 WCHAR *p; 198 221 ··· 202 225 ok(!lstrcmpiW(title, p), "expected %s, got %s\n", 203 226 wine_dbgstr_w(p), wine_dbgstr_w(title)); 204 227 } 205 - else skip("skipping Folder::get_Title test\n"); 206 228 SysFreeString(title); 207 229 } 208 230 r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2); ··· 215 237 { 216 238 r = FolderItem_get_Path(item, &item_path); 217 239 ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r); 218 - if (pSHGetFolderPathW) 219 - ok(!lstrcmpiW(item_path, path), "expected %s, got %s\n", 220 - wine_dbgstr_w(path), wine_dbgstr_w(item_path)); 240 + ok(!lstrcmpiW(item_path, path), "expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(item_path)); 221 241 SysFreeString(item_path); 222 242 FolderItem_Release(item); 223 243 } ··· 229 249 V_VT(&var) = VT_I4; 230 250 V_I4(&var) = ssfBITBUCKET; 231 251 r = IShellDispatch_NameSpace(sd, var, &folder); 232 - ok(r == S_OK || 233 - broken(r == S_FALSE), /* NT4 */ 234 - "IShellDispatch::NameSpace failed: %08x\n", r); 235 - if (r == S_OK) 236 - { 237 - r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2); 238 - ok(r == S_OK || 239 - broken(r == E_NOINTERFACE), /* NT4 */ 240 - "Folder::QueryInterface failed: %08x\n", r); 241 - if (r == S_OK) 242 - { 243 - r = Folder2_get_Self(folder2, &item); 244 - ok(r == S_OK, "Folder::get_Self failed: %08x\n", r); 245 - if (r == S_OK) 246 - { 247 - r = FolderItem_get_Path(item, &item_path); 248 - todo_wine 249 - ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r); 250 - todo_wine 251 - ok(!lstrcmpW(item_path, clsidW), "expected %s, got %s\n", 252 - wine_dbgstr_w(clsidW), wine_dbgstr_w(item_path)); 253 - SysFreeString(item_path); 254 - FolderItem_Release(item); 255 - } 256 - Folder2_Release(folder2); 257 - } 258 - Folder_Release(folder); 259 - } 252 + ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r); 253 + 254 + r = Folder_QueryInterface(folder, &IID_Folder2, (void **)&folder2); 255 + ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r); 256 + r = Folder2_get_Self(folder2, &item); 257 + ok(r == S_OK, "Folder::get_Self failed: %08x\n", r); 258 + r = FolderItem_get_Path(item, &item_path); 259 + ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r); 260 + /* TODO: we return lowercase GUID here */ 261 + ok(!lstrcmpiW(item_path, clsidW), "expected %s, got %s\n", wine_dbgstr_w(clsidW), wine_dbgstr_w(item_path)); 262 + 263 + SysFreeString(item_path); 264 + FolderItem_Release(item); 265 + Folder2_Release(folder2); 266 + Folder_Release(folder); 260 267 261 268 GetTempPathW(MAX_PATH, tempW); 262 269 GetCurrentDirectoryW(MAX_PATH, curW); ··· 269 276 SysFreeString(V_BSTR(&var)); 270 277 271 278 GetFullPathNameW(winetestW, MAX_PATH, tempW, NULL); 272 - if (pGetLongPathNameW) 273 - { 274 - len = pGetLongPathNameW(tempW, NULL, 0); 275 - long_pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); 276 - if (long_pathW) 277 - pGetLongPathNameW(tempW, long_pathW, len); 278 - } 279 + 280 + len = GetLongPathNameW(tempW, NULL, 0); 281 + long_pathW = heap_alloc(len * sizeof(WCHAR)); 282 + GetLongPathNameW(tempW, long_pathW, len); 283 + 279 284 V_VT(&var) = VT_BSTR; 280 285 V_BSTR(&var) = SysAllocString(tempW); 281 286 r = IShellDispatch_NameSpace(sd, var, &folder); 282 287 ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r); 283 - if (r == S_OK) 284 - { 285 - r = Folder_get_Title(folder, &title); 286 - ok(r == S_OK, "Folder::get_Title failed: %08x\n", r); 287 - if (r == S_OK) 288 - { 289 - ok(!lstrcmpW(title, winetestW), "bad title: %s\n", 290 - wine_dbgstr_w(title)); 291 - SysFreeString(title); 292 - } 293 - r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2); 294 - ok(r == S_OK || 295 - broken(r == E_NOINTERFACE), /* NT4 */ 296 - "Folder::QueryInterface failed: %08x\n", r); 297 - if (r == S_OK) 298 - { 299 - r = Folder2_get_Self(folder2, &item); 300 - ok(r == S_OK, "Folder::get_Self failed: %08x\n", r); 301 - if (r == S_OK) 302 - { 303 - r = FolderItem_get_Path(item, &item_path); 304 - ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r); 305 - if (long_pathW) 306 - ok(!lstrcmpW(item_path, long_pathW), 307 - "expected %s, got %s\n", wine_dbgstr_w(long_pathW), 308 - wine_dbgstr_w(item_path)); 309 - SysFreeString(item_path); 310 - FolderItem_Release(item); 311 - } 312 - Folder2_Release(folder2); 313 - } 314 - Folder_Release(folder); 315 - } 316 - SysFreeString(V_BSTR(&var)); 288 + 289 + disp = (void *)0xdeadbeef; 290 + r = Folder_get_Parent(folder, &disp); 291 + ok(r == E_NOTIMPL, "Unexpected hr %#x.\n", r); 292 + ok(disp == NULL, "Unexpected parent pointer %p.\n", disp); 293 + 294 + r = Folder_get_Title(folder, &title); 295 + ok(r == S_OK, "Failed to get folder title: %#x.\n", r); 296 + ok(!lstrcmpW(title, winetestW), "Unexpected title: %s\n", wine_dbgstr_w(title)); 297 + SysFreeString(title); 298 + 299 + r = Folder_QueryInterface(folder, &IID_Folder2, (void **)&folder2); 300 + ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r); 301 + r = Folder2_get_Self(folder2, &item); 302 + ok(r == S_OK, "Folder::get_Self failed: %08x\n", r); 303 + r = FolderItem_get_Path(item, &item_path); 304 + ok(r == S_OK, "Failed to get item path: %#x.\n", r); 305 + ok(!lstrcmpW(item_path, long_pathW), "Unexpected path %s, got %s\n", wine_dbgstr_w(item_path), wine_dbgstr_w(long_pathW)); 306 + SysFreeString(item_path); 307 + FolderItem_Release(item); 308 + Folder2_Release(folder2); 309 + 310 + Folder_Release(folder); 311 + VariantClear(&var); 317 312 318 313 len = lstrlenW(tempW); 319 314 if (len < MAX_PATH - 1) ··· 334 329 SysFreeString(title); 335 330 } 336 331 r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2); 337 - ok(r == S_OK || 338 - broken(r == E_NOINTERFACE), /* NT4 */ 339 - "Folder::QueryInterface failed: %08x\n", r); 332 + ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r); 340 333 if (r == S_OK) 341 334 { 342 335 r = Folder2_get_Self(folder2, &item); ··· 345 338 { 346 339 r = FolderItem_get_Path(item, &item_path); 347 340 ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r); 348 - if (long_pathW) 349 - ok(!lstrcmpW(item_path, long_pathW), 350 - "expected %s, got %s\n", wine_dbgstr_w(long_pathW), 351 - wine_dbgstr_w(item_path)); 341 + ok(!lstrcmpW(item_path, long_pathW), "Unexpected path %s, got %s\n", wine_dbgstr_w(item_path), 342 + wine_dbgstr_w(long_pathW)); 352 343 SysFreeString(item_path); 353 344 FolderItem_Release(item); 354 345 } ··· 359 350 SysFreeString(V_BSTR(&var)); 360 351 } 361 352 362 - HeapFree(GetProcessHeap(), 0, long_pathW); 353 + heap_free(long_pathW); 363 354 RemoveDirectoryW(winetestW); 364 355 SetCurrentDirectoryW(curW); 365 356 IShellDispatch_Release(sd); ··· 367 358 368 359 static void test_items(void) 369 360 { 370 - WCHAR wstr[MAX_PATH], orig_dir[MAX_PATH]; 361 + static const struct 362 + { 363 + char name[32]; 364 + enum 365 + { 366 + DIRECTORY, 367 + EMPTY_FILE, 368 + } 369 + type; 370 + } 371 + file_defs[] = 372 + { 373 + { "00-Myfolder", DIRECTORY }, 374 + { "01-empty.bin", EMPTY_FILE }, 375 + }; 376 + WCHAR path[MAX_PATH], cur_dir[MAX_PATH], orig_dir[MAX_PATH]; 371 377 HRESULT r; 372 378 IShellDispatch *sd = NULL; 373 379 Folder *folder = NULL; 374 - FolderItems *items = NULL; 380 + FolderItems *items; 375 381 FolderItems2 *items2 = NULL; 376 382 FolderItems3 *items3 = NULL; 377 - FolderItem *item = (FolderItem*)0xdeadbeef; 378 - IDispatch *disp = NULL; 379 - IUnknown *unk = NULL; 383 + FolderItem *item = (FolderItem*)0xdeadbeef, *item2; 380 384 FolderItemVerbs *verbs = (FolderItemVerbs*)0xdeadbeef; 381 - VARIANT var; 382 - LONG lcount = -1; 385 + VARIANT var, int_index, str_index, str_index2; 386 + IDispatch *disp, *disp2; 387 + LONG count = -1; 388 + IUnknown *unk; 389 + HANDLE file; 390 + BSTR bstr; 391 + char cstr[64]; 392 + BOOL ret; 393 + int i; 383 394 384 395 r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void**)&sd); 385 396 ok(SUCCEEDED(r), "CoCreateInstance failed: %08x\n", r); 386 397 ok(!!sd, "sd is null\n"); 387 398 388 - GetTempPathW(MAX_PATH, wstr); 399 + /* create and enter a temporary directory and a folder object for it */ 400 + GetTempPathW(MAX_PATH, path); 389 401 GetCurrentDirectoryW(MAX_PATH, orig_dir); 390 - SetCurrentDirectoryW(wstr); 391 - CreateDirectoryW(winetestW, NULL); 392 - GetFullPathNameW(winetestW, MAX_PATH, wstr, NULL); 402 + SetCurrentDirectoryW(path); 403 + ret = CreateDirectoryW(winetestW, NULL); 404 + ok(ret, "CreateDirectory failed: %08x\n", GetLastError()); 405 + GetFullPathNameW(winetestW, MAX_PATH, path, NULL); 393 406 V_VT(&var) = VT_BSTR; 394 - V_BSTR(&var) = SysAllocString(wstr); 407 + V_BSTR(&var) = SysAllocString(path); 408 + 409 + EXPECT_REF(sd, 1); 395 410 r = IShellDispatch_NameSpace(sd, var, &folder); 396 411 ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r); 397 412 ok(!!folder, "folder is null\n"); 398 - SysFreeString(V_BSTR(&var)); 399 - IShellDispatch_Release(sd); 413 + EXPECT_REF(folder, 1); 414 + EXPECT_REF(sd, 1); 415 + 416 + VariantClear(&var); 400 417 SetCurrentDirectoryW(winetestW); 418 + GetCurrentDirectoryW(MAX_PATH, path); 419 + GetLongPathNameW(path, cur_dir, MAX_PATH); 401 420 421 + /* FolderItems grabs its Folder reference */ 422 + items = NULL; 402 423 r = Folder_Items(folder, &items); 403 424 ok(r == S_OK, "Folder::Items failed: %08x\n", r); 404 425 ok(!!items, "items is null\n"); 405 - r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2); 406 - ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r); 407 - ok(!!items2 || broken(!items2) /* xp and later */, "items2 is null\n"); 408 - r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3); 409 - ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r); 410 - ok(!!items3, "items3 is null\n"); 411 - Folder_Release(folder); 426 + EXPECT_REF(folder, 2); 427 + EXPECT_REF(items, 1); 428 + 429 + unk = NULL; 430 + r = Folder_Items(folder, (FolderItems **)&unk); 431 + ok(r == S_OK, "Folder::Items failed: %08x\n", r); 432 + EXPECT_REF(folder, 3); 433 + IUnknown_Release(unk); 434 + EXPECT_REF(folder, 2); 435 + 436 + FolderItems_AddRef(items); 437 + EXPECT_REF(folder, 2); 438 + FolderItems_Release(items); 439 + 440 + /* Application property */ 441 + disp = NULL; 442 + EXPECT_REF(sd, 1); 443 + r = Folder_get_Application(folder, &disp); 444 + ok(r == S_OK, "Failed to get application %#x.\n", r); 445 + ok(disp != (IDispatch *)sd, "Unexpected application pointer\n"); 446 + EXPECT_REF(sd, 1); 447 + 448 + disp2 = NULL; 449 + r = Folder_get_Application(folder, &disp2); 450 + ok(r == S_OK, "Failed to get application %#x.\n", r); 451 + ok(disp2 == disp, "Unexpected application pointer\n"); 452 + IDispatch_Release(disp2); 453 + 454 + r = IDispatch_QueryInterface(disp, &IID_IShellDispatch, (void **)&disp2); 455 + ok(r == S_OK, "Wrong instance, hr %#x.\n", r); 456 + IDispatch_Release(disp2); 457 + IDispatch_Release(disp); 412 458 413 459 if (0) /* crashes on all versions of Windows */ 414 460 r = FolderItems_get_Count(items, NULL); 415 461 416 - r = FolderItems_get_Count(items, &lcount); 462 + r = FolderItems_get_Count(items, &count); 417 463 ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r); 418 - ok(!lcount, "expected 0 files, got %d\n", lcount); 464 + ok(!count, "expected 0 files, got %d\n", count); 419 465 420 466 V_VT(&var) = VT_I4; 421 467 V_I4(&var) = 0; ··· 424 470 r = FolderItems_Item(items, var, NULL); 425 471 426 472 r = FolderItems_Item(items, var, &item); 427 - todo_wine 473 + ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); 474 + ok(!item, "item is not null\n"); 475 + 476 + /* create test files */ 477 + for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++) 478 + { 479 + switch (file_defs[i].type) 480 + { 481 + case DIRECTORY: 482 + r = CreateDirectoryA(file_defs[i].name, NULL); 483 + ok(r, "CreateDirectory failed: %08x\n", GetLastError()); 484 + PathCombineA(cstr, file_defs[i].name, "foo.txt"); 485 + file = CreateFileA(cstr, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 486 + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %08x\n", GetLastError()); 487 + CloseHandle(file); 488 + break; 489 + 490 + case EMPTY_FILE: 491 + file = CreateFileA(file_defs[i].name, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 492 + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %08x\n", GetLastError()); 493 + CloseHandle(file); 494 + break; 495 + } 496 + } 497 + 498 + /* test that get_Count is not aware of the newly created files */ 499 + count = -1; 500 + r = FolderItems_get_Count(items, &count); 501 + ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r); 502 + ok(!count, "expected 0 files, got %d\n", count); 503 + 504 + /* test that the newly created files CAN be retrieved by string index */ 505 + variant_set_string(&var, file_defs[0].name); 506 + item = NULL; 507 + r = FolderItems_Item(items, var, &item); 508 + ok(r == S_OK, "FolderItems::Item failed: %08x\n", r); 509 + ok(!!item, "item is null\n"); 510 + 511 + disp = (void *)0xdeadbeef; 512 + r = FolderItems_get_Parent(items, &disp); 513 + ok(r == E_NOTIMPL, "Unexpected hr %#x.\n", r); 514 + ok(disp == NULL, "Unexpected parent pointer %p.\n", disp); 515 + 516 + r = FolderItem_get_Parent(item, &disp); 517 + ok(r == S_OK, "Failed to get parent pointer, hr %#x.\n", r); 518 + ok(disp == (IDispatch *)folder, "Unexpected parent pointer %p.\n", disp); 519 + IDispatch_Release(disp); 520 + 521 + if (item) FolderItem_Release(item); 522 + VariantClear(&var); 523 + 524 + /* recreate the items object */ 525 + FolderItems_Release(items); 526 + items = NULL; 527 + r = Folder_Items(folder, &items); 528 + ok(r == S_OK, "Folder::Items failed: %08x\n", r); 529 + ok(!!items, "items is null\n"); 530 + r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2); 531 + ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r); 532 + if (r == S_OK) 533 + { 534 + ok(!!items2, "items2 is null\n"); 535 + FolderItems2_Release(items2); 536 + } 537 + r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3); 538 + ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r); 539 + ok(!!items3, "items3 is null\n"); 540 + 541 + count = -1; 542 + r = FolderItems_get_Count(items, &count); 543 + ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r); 544 + ok(count == sizeof(file_defs)/sizeof(file_defs[0]), 545 + "expected %d files, got %d\n", (LONG)(sizeof(file_defs)/sizeof(file_defs[0])), count); 546 + 547 + V_VT(&var) = VT_EMPTY; 548 + item = (FolderItem*)0xdeadbeef; 549 + r = FolderItems_Item(items, var, &item); 550 + ok(r == E_NOTIMPL, "expected E_NOTIMPL, got %08x\n", r); 551 + ok(!item, "item is not null\n"); 552 + 553 + V_VT(&var) = VT_I2; 554 + V_I2(&var) = 0; 555 + 556 + EXPECT_REF(folder, 2); 557 + EXPECT_REF(items, 2); 558 + item = NULL; 559 + r = FolderItems_Item(items, var, &item); 560 + ok(r == S_OK, "FolderItems::Item failed: %08x\n", r); 561 + ok(!!item, "item is null\n"); 562 + EXPECT_REF(folder, 3); 563 + EXPECT_REF(items, 2); 564 + 565 + r = Folder_get_Application(folder, &disp); 566 + ok(r == S_OK, "Failed to get application pointer %#x.\n", r); 567 + r = FolderItem_get_Application(item, &disp2); 568 + ok(r == S_OK, "Failed to get application pointer %#x.\n", r); 569 + ok(disp == disp2, "Unexpected application pointer.\n"); 570 + IDispatch_Release(disp2); 571 + IDispatch_Release(disp); 572 + 573 + FolderItem_Release(item); 574 + 575 + V_VT(&var) = VT_I4; 576 + V_I4(&var) = 0; 577 + item = NULL; 578 + r = FolderItems_Item(items, var, &item); 579 + ok(r == S_OK, "FolderItems::Item failed: %08x\n", r); 580 + ok(!!item, "item is null\n"); 581 + if (item) FolderItem_Release(item); 582 + 583 + V_I4(&var) = -1; 584 + item = (FolderItem*)0xdeadbeef; 585 + r = FolderItems_Item(items, var, &item); 586 + ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); 587 + ok(!item, "item is not null\n"); 588 + 589 + V_VT(&var) = VT_ERROR; 590 + V_ERROR(&var) = 0; 591 + item = NULL; 592 + r = FolderItems_Item(items, var, &item); 593 + ok(r == S_OK, "expected S_OK, got %08x\n", r); 594 + ok(!!item, "item is null\n"); 595 + if (item) 596 + { 597 + bstr = NULL; 598 + r = FolderItem_get_Path(item, &bstr); 599 + ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r); 600 + ok(!lstrcmpW(bstr, cur_dir), 601 + "expected %s, got %s\n", wine_dbgstr_w(cur_dir), wine_dbgstr_w(bstr)); 602 + SysFreeString(bstr); 603 + FolderItem_Release(item); 604 + } 605 + 606 + V_VT(&int_index) = VT_I4; 607 + 608 + /* test the folder item corresponding to each file */ 609 + for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++) 610 + { 611 + VARIANT_BOOL b; 612 + BSTR name; 613 + 614 + V_I4(&int_index) = i; 615 + variant_set_string(&str_index, file_defs[i].name); 616 + 617 + item = NULL; 618 + r = FolderItems_Item(items, int_index, &item); 619 + ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r); 620 + ok(!!item, "file_defs[%d]: item is null\n", i); 621 + 622 + item2 = NULL; 623 + r = FolderItems_Item(items, int_index, &item2); 624 + ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r); 625 + ok(item2 != item, "file_defs[%d]: item and item2 are the same\n", i); 626 + FolderItem_Release(item2); 627 + 628 + bstr = NULL; 629 + r = FolderItem_get_Path(item, &bstr); 630 + ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r); 631 + PathCombineW(path, cur_dir, V_BSTR(&str_index)); 632 + ok(!lstrcmpW(bstr, path), 633 + "file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr)); 634 + SysFreeString(bstr); 635 + 636 + bstr = a2bstr(file_defs[i].name); 637 + r = FolderItem_get_Name(item, &name); 638 + ok(r == S_OK, "Failed to get item name, hr %#x.\n", r); 639 + /* Returned display name does not have to strictly match file name, e.g. extension could be omitted. */ 640 + ok(lstrlenW(name) <= lstrlenW(bstr), "file_defs[%d]: unexpected name length.\n", i); 641 + ok(!memcmp(bstr, name, lstrlenW(name) * sizeof(WCHAR)), "file_defs[%d]: unexpected name %s.\n", i, wine_dbgstr_w(name)); 642 + SysFreeString(name); 643 + SysFreeString(bstr); 644 + 645 + FolderItem_Release(item); 646 + 647 + item = NULL; 648 + r = FolderItems_Item(items, str_index, &item); 649 + ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r); 650 + ok(!!item, "file_defs[%d]: item is null\n", i); 651 + 652 + bstr = NULL; 653 + r = FolderItem_get_Path(item, &bstr); 654 + ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r); 655 + PathCombineW(path, cur_dir, V_BSTR(&str_index)); 656 + ok(!lstrcmpW(bstr, path), 657 + "file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr)); 658 + SysFreeString(bstr); 659 + 660 + b = 0xdead; 661 + r = FolderItem_get_IsFolder(item, &b); 662 + ok(r == S_OK, "Failed to get IsFolder property, %#x.\n", r); 663 + ok(file_defs[i].type == DIRECTORY ? b == VARIANT_TRUE : b == VARIANT_FALSE, "Unexpected prop value %#x.\n", b); 664 + 665 + FolderItem_Release(item); 666 + 667 + if (file_defs[i].type == DIRECTORY) 668 + { 669 + /* test that getting an item object for a file in a subdirectory succeeds */ 670 + PathCombineA(cstr, file_defs[i].name, "foo.txt"); 671 + variant_set_string(&str_index2, cstr); 672 + item2 = NULL; 673 + r = FolderItems_Item(items, str_index2, &item2); 674 + ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r); 675 + ok(!!item2, "file_defs[%d]: item is null\n", i); 676 + if (item2) FolderItem_Release(item2); 677 + VariantClear(&str_index2); 678 + 679 + /* delete the file in the subdirectory */ 680 + ret = DeleteFileA(cstr); 681 + ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError()); 682 + 683 + /* test that getting an item object via a relative path fails */ 684 + strcpy(cstr, file_defs[i].name); 685 + strcat(cstr, "\\..\\"); 686 + strcat(cstr, file_defs[i].name); 687 + variant_set_string(&str_index2, cstr); 688 + item2 = (FolderItem*)0xdeadbeef; 689 + r = FolderItems_Item(items, str_index2, &item2); 690 + todo_wine { 691 + ok(r == S_FALSE, "file_defs[%d]: expected S_FALSE, got %08x\n", i, r); 692 + ok(!item2, "file_defs[%d]: item is not null\n", i); 693 + } 694 + if (item2) FolderItem_Release(item2); 695 + VariantClear(&str_index2); 696 + 697 + /* remove the directory */ 698 + ret = RemoveDirectoryA(file_defs[i].name); 699 + ok(ret, "file_defs[%d]: RemoveDirectory failed: %08x\n", i, GetLastError()); 700 + } 701 + else 702 + { 703 + ret = DeleteFileA(file_defs[i].name); 704 + ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError()); 705 + } 706 + 707 + /* test that the folder item is still accessible by integer index */ 708 + item = NULL; 709 + r = FolderItems_Item(items, int_index, &item); 710 + ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r); 711 + ok(!!item, "file_defs[%d]: item is null\n", i); 712 + 713 + bstr = NULL; 714 + r = FolderItem_get_Path(item, &bstr); 715 + ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r); 716 + PathCombineW(path, cur_dir, V_BSTR(&str_index)); 717 + ok(!lstrcmpW(bstr, path), 718 + "file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr)); 719 + SysFreeString(bstr); 720 + 721 + FolderItem_Release(item); 722 + 723 + /* test that the folder item is no longer accessible by string index */ 724 + item = (FolderItem*)0xdeadbeef; 725 + r = FolderItems_Item(items, str_index, &item); 726 + ok(r == S_FALSE, "file_defs[%d]: expected S_FALSE, got %08x\n", i, r); 727 + ok(!item, "file_defs[%d]: item is not null\n", i); 728 + 729 + VariantClear(&str_index); 730 + } 731 + 732 + /* test that there are only as many folder items as there were files */ 733 + V_I4(&int_index) = sizeof(file_defs)/sizeof(file_defs[0]); 734 + item = (FolderItem*)0xdeadbeef; 735 + r = FolderItems_Item(items, int_index, &item); 428 736 ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); 429 737 ok(!item, "item is not null\n"); 430 738 ··· 435 743 } 436 744 437 745 r = FolderItems_get_Application(items, &disp); 438 - todo_wine 439 746 ok(r == S_OK, "FolderItems::get_Application failed: %08x\n", r); 440 - todo_wine 441 - ok(!!disp, "disp is null\n"); 442 - if (disp) IDispatch_Release(disp); 747 + 748 + r = Folder_get_Application(folder, &disp2); 749 + ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r); 750 + ok(disp == disp2, "Unexpected application pointer.\n"); 751 + IDispatch_Release(disp2); 752 + IDispatch_Release(disp); 443 753 444 754 if (0) /* crashes on xp */ 445 755 { ··· 483 793 ok(!verbs, "verbs is not null\n"); 484 794 } 485 795 486 - GetTempPathW(MAX_PATH, wstr); 487 - SetCurrentDirectoryW(wstr); 488 - RemoveDirectoryW(winetestW); 796 + /* remove the temporary directory and restore the original working directory */ 797 + GetTempPathW(MAX_PATH, path); 798 + SetCurrentDirectoryW(path); 799 + ret = RemoveDirectoryW(winetestW); 800 + ok(ret, "RemoveDirectory failed: %08x\n", GetLastError()); 489 801 SetCurrentDirectoryW(orig_dir); 490 802 803 + /* test that everything stops working after the directory has been removed */ 804 + count = -1; 805 + r = FolderItems_get_Count(items, &count); 806 + ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r); 807 + ok(!count, "expected 0 files, got %d\n", count); 808 + 809 + item = NULL; 810 + V_I4(&int_index) = 0; 811 + item = (FolderItem*)0xdeadbeef; 812 + r = FolderItems_Item(items, int_index, &item); 813 + ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); 814 + ok(!item, "item is not null\n"); 815 + 816 + variant_set_string(&str_index, file_defs[0].name); 817 + item = (FolderItem*)0xdeadbeef; 818 + r = FolderItems_Item(items, str_index, &item); 819 + ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); 820 + ok(!item, "item is not null\n"); 821 + VariantClear(&str_index); 822 + 491 823 FolderItems_Release(items); 492 - if (items2) FolderItems2_Release(items2); 824 + Folder_Release(folder); 493 825 if (items3) FolderItems3_Release(items3); 826 + IShellDispatch_Release(sd); 494 827 } 495 828 496 829 static void test_service(void) ··· 739 1072 ok(hr == S_OK || broken(hr == S_FALSE), "got 0x%08x\n", hr); 740 1073 if (hr == S_FALSE) /* winxp and earlier */ { 741 1074 win_skip("SWC_DESKTOP is not supported, some tests will be skipped.\n"); 742 - /* older versions allowed to regiser SWC_DESKTOP and access it with FindWindowSW */ 1075 + /* older versions allowed to register SWC_DESKTOP and access it with FindWindowSW */ 743 1076 ok(disp == NULL, "got %p\n", disp); 744 1077 ok(ret == 0, "got %d\n", ret); 745 1078 } ··· 763 1096 IUnknown *unk; 764 1097 765 1098 ok(disp != NULL, "got %p\n", disp); 1099 + 1100 + if (disp == NULL) goto skip_disp_tests; 1101 + 766 1102 ok(ret != HandleToUlong(hwnd), "got %d\n", ret); 767 1103 768 1104 /* IDispatch-related tests */ ··· 840 1176 IServiceProvider_Release(sp); 841 1177 IDispatch_Release(disp); 842 1178 } 1179 + skip_disp_tests: 843 1180 844 1181 disp = (void*)0xdeadbeef; 845 1182 ret = 0xdead; ··· 934 1271 935 1272 static void test_Verbs(void) 936 1273 { 937 - FolderItemVerbs *verbs; 1274 + FolderItemVerbs *verbs, *verbs2; 938 1275 WCHAR pathW[MAX_PATH]; 939 1276 FolderItemVerb *verb; 940 1277 IShellDispatch *sd; 941 1278 FolderItem *item; 942 1279 Folder2 *folder2; 1280 + IDispatch *disp; 943 1281 Folder *folder; 944 1282 HRESULT hr; 945 1283 LONG count, i; ··· 972 1310 hr = FolderItem_Verbs(item, &verbs); 973 1311 ok(hr == S_OK, "got 0x%08x\n", hr); 974 1312 1313 + hr = FolderItem_Verbs(item, &verbs2); 1314 + ok(hr == S_OK, "got 0x%08x\n", hr); 1315 + ok(verbs2 != verbs, "Unexpected verbs pointer.\n"); 1316 + FolderItemVerbs_Release(verbs2); 1317 + 1318 + disp = (void *)0xdeadbeef; 1319 + hr = FolderItemVerbs_get_Application(verbs, &disp); 1320 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 1321 + ok(disp == NULL, "Unexpected application pointer.\n"); 1322 + 1323 + disp = (void *)0xdeadbeef; 1324 + hr = FolderItemVerbs_get_Parent(verbs, &disp); 1325 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 1326 + ok(disp == NULL, "Unexpected parent pointer %p.\n", disp); 1327 + 975 1328 if (0) { /* crashes on winxp/win2k3 */ 976 1329 hr = FolderItemVerbs_get_Count(verbs, NULL); 977 1330 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); ··· 998 1351 ok(hr == S_OK, "got 0x%08x\n", hr); 999 1352 ok(str != NULL, "%d: name %s\n", i, wine_dbgstr_w(str)); 1000 1353 if (i == count) 1001 - ok(str[0] == 0, "%d: got teminating item %s\n", i, wine_dbgstr_w(str)); 1354 + ok(str[0] == 0, "%d: got terminating item %s\n", i, wine_dbgstr_w(str)); 1355 + 1356 + disp = (void *)0xdeadbeef; 1357 + hr = FolderItemVerb_get_Parent(verb, &disp); 1358 + ok(hr == E_NOTIMPL, "got %#x.\n", hr); 1359 + ok(disp == NULL, "Unexpected parent pointer %p.\n", disp); 1360 + 1361 + disp = (void *)0xdeadbeef; 1362 + hr = FolderItemVerb_get_Application(verb, &disp); 1363 + ok(hr == E_NOTIMPL, "got %#x.\n", hr); 1364 + ok(disp == NULL, "Unexpected parent pointer %p.\n", disp); 1002 1365 1003 1366 SysFreeString(str); 1004 1367 FolderItemVerb_Release(verb); ··· 1054 1417 ok(hr == S_OK, "ShellExecute failed: %08x\n", hr); 1055 1418 1056 1419 SysFreeString(name); 1420 + IShellDispatch2_Release(sd); 1057 1421 } 1058 1422 1059 1423 START_TEST(shelldispatch)
+78 -8
modules/rostests/winetests/shell32/shelllink.c
··· 19 19 * 20 20 */ 21 21 22 - #include "precomp.h" 22 + #define COBJMACROS 23 + 24 + #include "initguid.h" 25 + #include "windows.h" 26 + #include "shlguid.h" 27 + #include "shobjidl.h" 28 + #include "shlobj.h" 29 + #include "shellapi.h" 30 + #include "commoncontrols.h" 31 + 32 + #include "wine/heap.h" 33 + #include "wine/test.h" 34 + 35 + #include "shell32_test.h" 36 + 37 + #ifdef __REACTOS__ 38 + #include <reactos/undocshell.h> 39 + #endif 23 40 24 41 #ifndef SLDF_HAS_LOGO3ID 25 42 # define SLDF_HAS_LOGO3ID 0x00000800 /* not available in the Vista SDK */ ··· 28 45 static void (WINAPI *pILFree)(LPITEMIDLIST); 29 46 static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST); 30 47 static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*); 48 + static HRESULT (WINAPI *pSHGetFolderLocation)(HWND,INT,HANDLE,DWORD,PIDLIST_ABSOLUTE*); 31 49 static HRESULT (WINAPI *pSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT); 32 50 static HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID, UINT, SHSTOCKICONINFO *); 33 51 static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD); ··· 71 89 int len; 72 90 73 91 len=MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0); 74 - pathW=HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); 92 + pathW = heap_alloc(len * sizeof(WCHAR)); 75 93 MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len); 76 94 77 95 r=pSHILCreateFromPath(pathW, &pidl, NULL); 78 96 ok(r == S_OK, "SHILCreateFromPath failed (0x%08x)\n", r); 79 - HeapFree(GetProcessHeap(), 0, pathW); 97 + heap_free(pathW); 80 98 } 81 99 return pidl; 82 100 } ··· 93 111 IShellLinkW *slW = NULL; 94 112 char mypath[MAX_PATH]; 95 113 char buffer[INFOTIPSIZE]; 114 + WIN32_FIND_DATAA finddata; 96 115 LPITEMIDLIST pidl, tmp_pidl; 97 116 const char * str; 98 117 int i; ··· 145 164 /* Test Getting / Setting the path */ 146 165 strcpy(buffer,"garbage"); 147 166 r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 148 - todo_wine ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r); 167 + ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r); 149 168 ok(*buffer=='\0', "GetPath returned '%s'\n", buffer); 150 169 151 - CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, 152 - &IID_IShellLinkW, (LPVOID*)&slW); 170 + strcpy(buffer,"garbage"); 171 + memset(&finddata, 0xaa, sizeof(finddata)); 172 + r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH); 173 + ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r); 174 + ok(*buffer=='\0', "GetPath returned '%s'\n", buffer); 175 + ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes); 176 + ok(finddata.cFileName[0] == 0, "unexpected filename '%s'\n", finddata.cFileName); 177 + 178 + r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, 179 + &IID_IShellLinkW, (LPVOID*)&slW); 180 + ok(r == S_OK, "CoCreateInstance failed (0x%08x)\n", r); 153 181 if (!slW /* Win9x */ || !pGetLongPathNameA /* NT4 */) 154 182 skip("SetPath with NULL parameter crashes on Win9x and some NT4\n"); 155 183 else ··· 166 194 167 195 strcpy(buffer,"garbage"); 168 196 r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 169 - todo_wine ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r); 197 + ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r); 170 198 ok(*buffer=='\0', "GetPath returned '%s'\n", buffer); 171 199 172 200 /* Win98 returns S_FALSE, but WinXP returns S_OK */ ··· 179 207 ok(r == S_OK, "GetPath failed (0x%08x)\n", r); 180 208 ok(lstrcmpiA(buffer,str)==0, "GetPath returned '%s'\n", buffer); 181 209 210 + strcpy(buffer,"garbage"); 211 + memset(&finddata, 0xaa, sizeof(finddata)); 212 + r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH); 213 + ok(r == S_OK, "GetPath failed (0x%08x)\n", r); 214 + ok(lstrcmpiA(buffer,str)==0, "GetPath returned '%s'\n", buffer); 215 + ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes); 216 + ok(lstrcmpiA(finddata.cFileName, "file") == 0, "unexpected filename '%s'\n", finddata.cFileName); 217 + 182 218 /* Get some real path to play with */ 183 219 GetWindowsDirectoryA( mypath, sizeof(mypath)-12 ); 184 220 strcat(mypath, "\\regedit.exe"); ··· 228 264 strcpy(buffer,"garbage"); 229 265 r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 230 266 ok(r == S_OK, "GetPath failed (0x%08x)\n", r); 231 - todo_wine 267 + ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer); 268 + 269 + strcpy(buffer,"garbage"); 270 + memset(&finddata, 0xaa, sizeof(finddata)); 271 + r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH); 272 + ok(r == S_OK, "GetPath failed (0x%08x)\n", r); 232 273 ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer); 274 + ok(finddata.dwFileAttributes != 0, "unexpected attributes %x\n", finddata.dwFileAttributes); 275 + ok(lstrcmpiA(finddata.cFileName, "regedit.exe") == 0, "unexpected filename '%s'\n", finddata.cFileName); 276 + } 277 + 278 + if (pSHGetFolderLocation) 279 + { 280 + LPITEMIDLIST pidl_controls; 281 + 282 + r = pSHGetFolderLocation(NULL, CSIDL_CONTROLS, NULL, 0, &pidl_controls); 283 + ok(r == S_OK, "SHGetFolderLocation failed (0x%08x)\n", r); 284 + 285 + r = IShellLinkA_SetIDList(sl, pidl_controls); 286 + ok(r == S_OK, "SetIDList failed (0x%08x)\n", r); 287 + 288 + strcpy(buffer,"garbage"); 289 + r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 290 + ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r); 291 + ok(buffer[0] == 0, "GetPath returned '%s'\n", buffer); 292 + 293 + strcpy(buffer,"garbage"); 294 + memset(&finddata, 0xaa, sizeof(finddata)); 295 + r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH); 296 + ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r); 297 + ok(buffer[0] == 0, "GetPath returned '%s'\n", buffer); 298 + ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes); 299 + ok(finddata.cFileName[0] == 0, "unexpected filename '%s'\n", finddata.cFileName); 300 + 301 + pILFree(pidl_controls); 233 302 } 234 303 235 304 /* test path with quotes (IShellLinkA_SetPath returns S_FALSE on W2K and below and S_OK on XP and above */ ··· 1396 1465 pILFree = (void *)GetProcAddress(hmod, (LPSTR)155); 1397 1466 pILIsEqual = (void *)GetProcAddress(hmod, (LPSTR)21); 1398 1467 pSHILCreateFromPath = (void *)GetProcAddress(hmod, (LPSTR)28); 1468 + pSHGetFolderLocation = (void *)GetProcAddress(hmod, "SHGetFolderLocation"); 1399 1469 pSHDefExtractIconA = (void *)GetProcAddress(hmod, "SHDefExtractIconA"); 1400 1470 pSHGetStockIconInfo = (void *)GetProcAddress(hmod, "SHGetStockIconInfo"); 1401 1471 pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
+12 -2
modules/rostests/winetests/shell32/shellole.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "precomp.h" 19 + #define COBJMACROS 20 + #define CONST_VTABLE 21 + #ifndef __REACTOS__ 22 + #define NONAMELESSUNION 23 + #endif 20 24 21 - #include <initguid.h> 25 + #include <stdio.h> 26 + #include <wine/test.h> 27 + 28 + #include "winbase.h" 29 + #include "shlobj.h" 30 + #include "shellapi.h" 31 + #include "initguid.h" 22 32 23 33 DEFINE_GUID(FMTID_Test,0x12345678,0x1234,0x1234,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12); 24 34 DEFINE_GUID(FMTID_NotExisting, 0x12345678,0x1234,0x1234,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13);
+26 -16
modules/rostests/winetests/shell32/shellpath.c
··· 21 21 * namespace) path for a given folder (CSIDL value). 22 22 */ 23 23 24 - #include "precomp.h" 24 + #define COBJMACROS 25 + 26 + #include <stdarg.h> 27 + #include <stdio.h> 28 + #include "windef.h" 29 + #include "winbase.h" 30 + #include "shlguid.h" 31 + #include "shlobj.h" 32 + #include "shlwapi.h" 33 + #include "knownfolders.h" 34 + #include "shellapi.h" 35 + #include "wine/test.h" 25 36 26 - #include <initguid.h> 37 + #include "initguid.h" 27 38 28 39 /* CSIDL_MYDOCUMENTS is now the same as CSIDL_PERSONAL, but what we want 29 40 * here is its original value. ··· 1887 1898 { 0 } 1888 1899 }; 1889 1900 #undef KNOWN_FOLDER 1890 - BOOL known_folder_found[sizeof(known_folders)/sizeof(known_folders[0])-1]; 1901 + BOOL known_folder_found[ARRAY_SIZE(known_folders)-1]; 1891 1902 1892 1903 static BOOL is_in_strarray(const WCHAR *needle, const char *hay) 1893 1904 { ··· 1903 1914 if(strcmp(hay, "(null)") == 0 && !needle) 1904 1915 return TRUE; 1905 1916 1906 - ret = MultiByteToWideChar(CP_ACP, 0, hay, -1, wstr, sizeof(wstr)/sizeof(wstr[0])); 1917 + ret = MultiByteToWideChar(CP_ACP, 0, hay, -1, wstr, ARRAY_SIZE(wstr)); 1907 1918 if(ret == 0) 1908 1919 { 1909 1920 ok(0, "Failed to convert string\n"); ··· 1956 1967 ok_(__FILE__, known_folder->line)(hr == S_OK, "cannot get known folder definition for %s\n", known_folder->sFolderId); 1957 1968 if(SUCCEEDED(hr)) 1958 1969 { 1959 - ret = MultiByteToWideChar(CP_ACP, 0, known_folder->sName, -1, sName, sizeof(sName)/sizeof(sName[0])); 1970 + ret = MultiByteToWideChar(CP_ACP, 0, known_folder->sName, -1, sName, ARRAY_SIZE(sName)); 1960 1971 ok_(__FILE__, known_folder->line)(ret != 0, "cannot convert known folder name \"%s\" to wide characters\n", known_folder->sName); 1961 1972 1962 1973 ok_(__FILE__, known_folder->line)(lstrcmpW(kfd.pszName, sName)==0, "invalid known folder name returned for %s: %s expected, but %s retrieved\n", known_folder->sFolderId, wine_dbgstr_w(sName), wine_dbgstr_w(kfd.pszName)); ··· 2052 2063 2053 2064 GetWindowsDirectoryW( sWinDir, MAX_PATH ); 2054 2065 2055 - GetTempPathW(sizeof(sExamplePath)/sizeof(sExamplePath[0]), sExamplePath); 2066 + GetTempPathW(ARRAY_SIZE(sExamplePath), sExamplePath); 2056 2067 lstrcatW(sExamplePath, sExample); 2057 2068 2058 - GetTempPathW(sizeof(sExample2Path)/sizeof(sExample2Path[0]), sExample2Path); 2069 + GetTempPathW(ARRAY_SIZE(sExample2Path), sExample2Path); 2059 2070 lstrcatW(sExample2Path, sExample2); 2060 2071 2061 2072 lstrcpyW(sSubFolderPath, sExamplePath); ··· 2110 2121 CoTaskMemFree(folderPath); 2111 2122 2112 2123 hr = IKnownFolder_GetRedirectionCapabilities(folder, &redirectionCapabilities); 2113 - todo_wine 2114 2124 ok(hr == S_OK, "failed to get redirection capabilities: 0x%08x\n", hr); 2115 2125 todo_wine 2116 2126 ok(redirectionCapabilities==0, "invalid redirection capabilities returned: %d\n", redirectionCapabilities); ··· 2162 2172 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got 0x%08x\n", hr); 2163 2173 ok(folder == NULL, "got %p\n", folder); 2164 2174 2165 - for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i) 2175 + for(i=0; i < ARRAY_SIZE(known_folder_found); ++i) 2166 2176 known_folder_found[i] = FALSE; 2167 2177 2168 2178 hr = IKnownFolderManager_GetFolderIds(mgr, &folders, &nCount); ··· 2170 2180 for(i=0;i<nCount;++i) 2171 2181 check_known_folder(mgr, &folders[i]); 2172 2182 2173 - for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i) 2183 + for(i=0; i < ARRAY_SIZE(known_folder_found); ++i) 2174 2184 if(!known_folder_found[i]) 2175 2185 trace("Known folder %s not found on current platform\n", known_folders[i].sFolderId); 2176 2186 ··· 2544 2554 memset(bufferA, '#', MAX_PATH - 1); 2545 2555 bufferA[MAX_PATH - 1] = 0; 2546 2556 lstrcpyA(bufferA, names[i]); 2547 - MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); 2557 + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW)); 2548 2558 2549 2559 res2 = ExpandEnvironmentStringsA(names[i], expectedA, MAX_PATH); 2550 2560 res = DoEnvironmentSubstA(bufferA, MAX_PATH); ··· 2575 2585 memset(bufferA, '#', MAX_PATH - 1); 2576 2586 bufferA[len + 2] = 0; 2577 2587 lstrcpyA(bufferA, names[i]); 2578 - MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); 2588 + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW)); 2579 2589 2580 2590 res2 = ExpandEnvironmentStringsA(bufferA, expectedA, MAX_PATH); 2581 2591 res = DoEnvironmentSubstA(bufferA, len + 1); ··· 2596 2606 memset(bufferA, '#', MAX_PATH - 1); 2597 2607 bufferA[len + 2] = 0; 2598 2608 lstrcpyA(bufferA, names[i]); 2599 - MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); 2609 + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW)); 2600 2610 2601 2611 /* ANSI version failed without an extra byte, as documented on msdn */ 2602 2612 res = DoEnvironmentSubstA(bufferA, len); ··· 2619 2629 memset(bufferA, '#', MAX_PATH - 1); 2620 2630 bufferA[len + 2] = 0; 2621 2631 lstrcpyA(bufferA, names[i]); 2622 - MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); 2632 + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW)); 2623 2633 2624 2634 res = DoEnvironmentSubstA(bufferA, len - 1); 2625 2635 ok(!HIWORD(res) && (LOWORD(res) == (len - 1)), ··· 2640 2650 memset(bufferA, '#', MAX_PATH - 1); 2641 2651 bufferA[MAX_PATH - 1] = 0; 2642 2652 lstrcpyA(bufferA, does_not_existA); 2643 - MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); 2653 + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW)); 2644 2654 2645 2655 res2 = lstrlenA(does_not_existA) + 1; 2646 2656 res = DoEnvironmentSubstA(bufferA, MAX_PATH); ··· 2691 2701 ok(!ret, "got %d\n", ret); 2692 2702 } 2693 2703 2694 - GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); 2704 + GetTempPathW(ARRAY_SIZE(pathW), pathW); 2695 2705 2696 2706 /* Using short name only first */ 2697 2707 nameW[0] = 0;
+15 -1
modules/rostests/winetests/shell32/shfldr_special.c
··· 19 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 20 20 */ 21 21 22 - #include "precomp.h" 22 + #include <stdarg.h> 23 + #include <stdio.h> 24 + 25 + #define COBJMACROS 26 + #ifndef __REACTOS__ 27 + #define NONAMELESSUNION 28 + #define NONAMELESSSTRUCT 29 + #endif 30 + 31 + #define WIN32_LEAN_AND_MEAN 32 + #include <windows.h> 33 + #include "shellapi.h" 34 + #include "shlobj.h" 35 + 36 + #include "wine/test.h" 23 37 24 38 static inline BOOL SHELL_OsIsUnicode(void) 25 39 {
+26 -5
modules/rostests/winetests/shell32/shlexec.c
··· 30 30 * we could check 31 31 */ 32 32 33 - #include "precomp.h" 33 + /* Needed to get SEE_MASK_NOZONECHECKS with the PSDK */ 34 + #ifndef __REACTOS__ 35 + #define NTDDI_WINXPSP1 0x05010100 36 + #define NTDDI_VERSION NTDDI_WINXPSP1 37 + #define _WIN32_WINNT 0x0501 38 + #endif 39 + 40 + #include <stdio.h> 41 + #include <assert.h> 42 + 43 + #include "wtypes.h" 44 + #include "winbase.h" 45 + #include "windef.h" 46 + #include "shellapi.h" 47 + #include "shlwapi.h" 48 + #include "ddeml.h" 49 + 50 + #include "wine/heap.h" 51 + #include "wine/test.h" 52 + 53 + #include "shell32_test.h" 54 + 34 55 35 56 static char argv0[MAX_PATH]; 36 57 static int myARGC; ··· 742 763 if (dwMaxLen > sizeof(szNameBuf)/sizeof(CHAR)) 743 764 { 744 765 /* Name too big: alloc a buffer for it */ 745 - if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(CHAR)))) 766 + if (!(lpszName = heap_alloc(dwMaxLen*sizeof(CHAR)))) 746 767 { 747 768 ret = ERROR_NOT_ENOUGH_MEMORY; 748 769 goto cleanup; ··· 777 798 cleanup: 778 799 /* Free buffer if allocated */ 779 800 if (lpszName != szNameBuf) 780 - HeapFree( GetProcessHeap(), 0, lpszName); 801 + heap_free(lpszName); 781 802 if(lpszSubKey) 782 803 RegCloseKey(hSubKey); 783 804 return ret; ··· 837 858 } 838 859 else 839 860 { 840 - cmd=HeapAlloc(GetProcessHeap(), 0, strlen(argv0)+10+strlen(child_file)+2+strlen(cmdtail)+1); 861 + cmd = heap_alloc(strlen(argv0) + 10 + strlen(child_file) + 2 + strlen(cmdtail) + 1); 841 862 sprintf(cmd,"%s shlexec \"%s\" %s", argv0, child_file, cmdtail); 842 863 rc=RegSetValueExA(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmd, strlen(cmd)+1); 843 864 ok(rc == ERROR_SUCCESS, "setting command failed with %d\n", rc); 844 - HeapFree(GetProcessHeap(), 0, cmd); 865 + heap_free(cmd); 845 866 } 846 867 847 868 if (ddeexec)
+15 -1
modules/rostests/winetests/shell32/shlfileop.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #include <stdarg.h> 22 + #include <stdio.h> 23 + 24 + #define COBJMACROS 25 + #define WINE_NOWINSOCK 26 + #include <windows.h> 27 + #include "shellapi.h" 28 + #include "shlobj.h" 29 + #include "commoncontrols.h" 30 + 31 + #include "wine/test.h" 32 + 33 + #ifdef __REACTOS__ 34 + #include <reactos/undocshell.h> 35 + #endif 22 36 23 37 #ifndef FOF_NORECURSION 24 38 #define FOF_NORECURSION 0x1000
+550 -704
modules/rostests/winetests/shell32/shlfolder.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #include <stdarg.h> 22 + #include <stdio.h> 23 + 24 + #define COBJMACROS 25 + #define CONST_VTABLE 26 + 27 + #include "windef.h" 28 + #include "winbase.h" 29 + #include "wtypes.h" 30 + #include "shellapi.h" 31 + 32 + 33 + #include "shlguid.h" 34 + #include "shlobj.h" 35 + #include "shobjidl.h" 36 + #include "shlwapi.h" 37 + #include "ocidl.h" 38 + #include "oleauto.h" 39 + 40 + #include "wine/heap.h" 41 + #include "wine/test.h" 22 42 23 43 #include <initguid.h> 24 44 DEFINE_GUID(IID_IParentAndItem, 0xB3A4B685, 0xB685, 0x4805, 0x99,0xD9, 0x5D,0xEA,0xD2,0x87,0x32,0x36); ··· 26 46 27 47 static IMalloc *ppM; 28 48 29 - static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*); 30 - static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR); 31 - static HRESULT (WINAPI *pSHGetFolderPathAndSubDirA)(HWND, int, HANDLE, DWORD, LPCSTR, LPSTR); 32 - static BOOL (WINAPI *pSHGetPathFromIDListW)(LPCITEMIDLIST,LPWSTR); 33 - static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *); 34 - static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL); 35 - static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL); 36 - static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT); 37 - static LPITEMIDLIST (WINAPI *pILFindLastID)(LPCITEMIDLIST); 38 - static void (WINAPI *pILFree)(LPITEMIDLIST); 39 - static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST); 40 49 static HRESULT (WINAPI *pSHCreateItemFromIDList)(PCIDLIST_ABSOLUTE pidl, REFIID riid, void **ppv); 41 50 static HRESULT (WINAPI *pSHCreateItemFromParsingName)(PCWSTR,IBindCtx*,REFIID,void**); 42 51 static HRESULT (WINAPI *pSHCreateItemFromRelativeName)(IShellItem*,PCWSTR,IBindCtx*,REFIID,void**); ··· 46 55 static HRESULT (WINAPI *pSHCreateShellItemArrayFromIDLists)(UINT, PCIDLIST_ABSOLUTE*, IShellItemArray**); 47 56 static HRESULT (WINAPI *pSHCreateShellItemArrayFromDataObject)(IDataObject*, REFIID, void **); 48 57 static HRESULT (WINAPI *pSHCreateShellItemArrayFromShellItem)(IShellItem*, REFIID, void **); 49 - static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST); 50 - static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*); 51 - static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPathAW)(LPCVOID); 52 58 static HRESULT (WINAPI *pSHGetKnownFolderPath)(REFKNOWNFOLDERID,DWORD,HANDLE,PWSTR*); 53 59 static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*); 54 60 static HRESULT (WINAPI *pSHGetItemFromDataObject)(IDataObject*,DATAOBJ_GET_ITEM_FLAGS,REFIID,void**); 55 61 static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*); 56 62 static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**); 57 63 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); 58 - static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT); 59 64 static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**); 60 - static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*); 61 65 static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS); 62 66 63 67 static WCHAR *make_wstr(const char *str) ··· 72 76 if(!len || len < 0) 73 77 return NULL; 74 78 75 - ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); 79 + ret = heap_alloc(len * sizeof(WCHAR)); 76 80 if(!ret) 77 81 return NULL; 78 82 ··· 96 100 hmod = GetModuleHandleA("shell32.dll"); 97 101 98 102 #define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f)) 99 - MAKEFUNC(SHBindToParent); 100 103 MAKEFUNC(SHCreateItemFromIDList); 101 104 MAKEFUNC(SHCreateItemFromParsingName); 102 105 MAKEFUNC(SHCreateItemFromRelativeName); ··· 106 109 MAKEFUNC(SHCreateShellItemArrayFromIDLists); 107 110 MAKEFUNC(SHCreateShellItemArrayFromDataObject); 108 111 MAKEFUNC(SHCreateShellItemArrayFromShellItem); 109 - MAKEFUNC(SHGetFolderPathA); 110 - MAKEFUNC(SHGetFolderPathAndSubDirA); 111 - MAKEFUNC(SHGetPathFromIDListW); 112 - MAKEFUNC(SHGetSpecialFolderPathA); 113 - MAKEFUNC(SHGetSpecialFolderPathW); 114 - MAKEFUNC(SHGetSpecialFolderLocation); 115 - MAKEFUNC(SHParseDisplayName); 116 112 MAKEFUNC(SHGetKnownFolderPath); 117 113 MAKEFUNC(SHGetNameFromIDList); 118 114 MAKEFUNC(SHGetItemFromDataObject); ··· 122 118 MAKEFUNC(SHGetPathFromIDListEx); 123 119 #undef MAKEFUNC 124 120 125 - #define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord))) 126 - MAKEFUNC_ORD(ILFindLastID, 16); 127 - MAKEFUNC_ORD(ILIsEqual, 21); 128 - MAKEFUNC_ORD(ILCombine, 25); 129 - MAKEFUNC_ORD(SHILCreateFromPath, 28); 130 - MAKEFUNC_ORD(ILFree, 155); 131 - MAKEFUNC_ORD(SHSimpleIDListFromPathAW, 162); 132 - #undef MAKEFUNC_ORD 133 - 134 121 /* test named exports */ 135 122 ptr = GetProcAddress(hmod, "ILFree"); 136 123 ok(broken(ptr == 0) || ptr != 0, "expected named export for ILFree\n"); ··· 157 144 TESTNAMED(ILSaveToStream); 158 145 #undef TESTNAMED 159 146 } 160 - 161 - hmod = GetModuleHandleA("shlwapi.dll"); 162 - pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW"); 163 147 164 148 hmod = GetModuleHandleA("kernel32.dll"); 165 149 pIsWow64Process = (void*)GetProcAddress(hmod, "IsWow64Process"); 166 - pGetSystemWow64DirectoryW = (void*)GetProcAddress(hmod, "GetSystemWow64DirectoryW"); 167 150 168 151 hr = SHGetMalloc(&ppM); 169 152 ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr); ··· 206 189 ok(hr == S_OK, "Expected SHGetDesktopFolder to return S_OK, got 0x%08x\n", hr); 207 190 if(hr != S_OK) return; 208 191 209 - /* Tests crash on W2K and below (SHCreateShellItem available as of XP) */ 210 192 if (pSHCreateShellItem) 211 193 { 212 194 if (0) 213 195 { 214 - /* null name and pidl, also crashes on Windows 8 */ 196 + /* null name and pidl, crashes on Windows 8 */ 215 197 hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, 216 198 NULL, NULL, NULL, 0); 217 199 ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr); ··· 225 207 ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr); 226 208 } 227 209 else 228 - win_skip("Tests would crash on W2K and below\n"); 210 + win_skip("SHCreateShellItem requires XP SP1 or later\n"); 229 211 230 212 MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH); 231 - hr = IShellFolder_ParseDisplayName(IDesktopFolder, 232 - NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 233 - todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */, 234 - "ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr); 213 + hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 214 + todo_wine ok(hr == S_OK, "ParseDisplayName returned %08x, expected SUCCESS\n", hr); 235 215 if (hr == S_OK) 236 216 { 237 - ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type " 238 - "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]); 217 + ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type " 218 + "PT_IESPECIAL1, but is: %02x\n", ILFindLastID(newPIDL)->mkid.abID[0]); 239 219 IMalloc_Free(ppM, newPIDL); 240 220 } 241 221 242 222 MultiByteToWideChar(CP_ACP, 0, cInetTest2A, -1, cTestDirW, MAX_PATH); 243 223 hr = IShellFolder_ParseDisplayName(IDesktopFolder, 244 224 NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 245 - todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */, 246 - "ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr); 225 + todo_wine ok(hr == S_OK, "ParseDisplayName returned %08x, expected SUCCESS\n", hr); 247 226 if (hr == S_OK) 248 227 { 249 - ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type " 250 - "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]); 228 + ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type " 229 + "PT_IESPECIAL1, but is: %02x\n", ILFindLastID(newPIDL)->mkid.abID[0]); 251 230 IMalloc_Free(ppM, newPIDL); 252 231 } 253 232 ··· 259 238 } 260 239 261 240 MultiByteToWideChar(CP_ACP, 0, cNonExistDir1A, -1, cTestDirW, MAX_PATH); 262 - hr = IShellFolder_ParseDisplayName(IDesktopFolder, 241 + hr = IShellFolder_ParseDisplayName(IDesktopFolder, 263 242 NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 264 - ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL), 265 - "ParseDisplayName returned %08x, expected 80070002 or E_FAIL\n", hr); 243 + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), 244 + "ParseDisplayName returned %08x, expected 0x80070002\n", hr); 266 245 267 246 res = GetFileAttributesA(cNonExistDir2A); 268 247 if(res != INVALID_FILE_ATTRIBUTES) ··· 272 251 } 273 252 274 253 MultiByteToWideChar(CP_ACP, 0, cNonExistDir2A, -1, cTestDirW, MAX_PATH); 275 - hr = IShellFolder_ParseDisplayName(IDesktopFolder, 254 + hr = IShellFolder_ParseDisplayName(IDesktopFolder, 276 255 NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 277 - ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL) || (hr == E_INVALIDARG), 278 - "ParseDisplayName returned %08x, expected 80070002, E_FAIL or E_INVALIDARG\n", hr); 256 + todo_wine ok(hr == E_INVALIDARG, "ParseDisplayName returned %08x, expected E_INVALIDARG\n", hr); 279 257 280 258 /* I thought that perhaps the DesktopFolder's ParseDisplayName would recognize the 281 259 * path corresponding to CSIDL_PERSONAL and return a CLSID_MyDocuments PIDL. Turns 282 260 * out it doesn't. The magic seems to happen in the file dialogs, then. */ 283 - if (!pSHGetSpecialFolderPathW || !pILFindLastID) 284 - { 285 - win_skip("SHGetSpecialFolderPathW and/or ILFindLastID are not available\n"); 286 - goto finished; 287 - } 288 261 289 - bRes = pSHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE); 262 + bRes = SHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE); 290 263 ok(bRes, "SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %u\n", GetLastError()); 291 264 if (!bRes) goto finished; 292 265 ··· 294 267 ok(hr == S_OK, "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr); 295 268 if (hr != S_OK) goto finished; 296 269 297 - ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 || 298 - pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */ 299 - "Last pidl should be of type PT_FOLDER or PT_IESPECIAL2, but is: %02x\n", 300 - pILFindLastID(newPIDL)->mkid.abID[0]); 270 + ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x31, 271 + "Last pidl should be of type PT_FOLDER, but is: %02x\n", 272 + ILFindLastID(newPIDL)->mkid.abID[0]); 301 273 IMalloc_Free(ppM, newPIDL); 302 - 274 + 303 275 finished: 304 276 IShellFolder_Release(IDesktopFolder); 305 277 } ··· 422 394 flags &= SFGAO_testfor; 423 395 ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr); 424 396 ok(flags == (attrs[i]) || 425 - flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR) || /* Win9x, NT4 */ 426 397 flags == ((attrs[i] & ~SFGAO_CAPABILITYMASK) | SFGAO_VISTA), /* Vista and higher */ 427 398 "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]); 428 399 ··· 430 401 hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags); 431 402 flags &= SFGAO_testfor; 432 403 ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr); 433 - ok(flags == attrs[i] || 434 - flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR), /* Win9x, NT4 */ 435 - "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]); 404 + ok(flags == attrs[i], "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]); 436 405 437 406 flags = ~0u; 438 407 hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags); ··· 493 462 hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 494 463 ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr); 495 464 496 - if (0) 497 - { 498 - /* this call segfaults on 98SE */ 499 465 hr = IShellFolder_BindToObject(psfMyComputer, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 500 466 ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr); 501 - } 502 467 503 468 cChars = GetSystemDirectoryA(szSystemDir, MAX_PATH); 504 469 ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryA failed! LastError: %u\n", GetLastError()); ··· 525 490 ok (hr == E_INVALIDARG, 526 491 "FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr); 527 492 528 - if (0) 529 - { 530 - /* this call segfaults on 98SE */ 531 493 hr = IShellFolder_BindToObject(psfSystemDir, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 532 494 ok (hr == E_INVALIDARG, 533 495 "FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr); 534 - } 535 496 536 497 IShellFolder_Release(psfSystemDir); 537 498 ··· 567 528 { 568 529 IPersist *pp; 569 530 hr = IShellFolder_QueryInterface(psfChild, &IID_IPersist, (void**)&pp); 570 - ok(hr == S_OK || 571 - broken(hr == E_NOINTERFACE), /* Win9x, NT4, W2K */ 572 - "Got 0x%08x\n", hr); 531 + ok(hr == S_OK, "Got 0x%08x\n", hr); 573 532 if(SUCCEEDED(hr)) 574 533 { 575 534 CLSID id; 576 535 hr = IPersist_GetClassID(pp, &id); 577 536 ok(hr == S_OK, "Got 0x%08x\n", hr); 578 - /* CLSID_ShellFSFolder on some w2k systems */ 579 - ok(IsEqualIID(&id, &CLSID_ShellDocObjView) || broken(IsEqualIID(&id, &CLSID_ShellFSFolder)), 580 - "Unexpected classid %s\n", wine_dbgstr_guid(&id)); 537 + ok(IsEqualIID(&id, &CLSID_ShellDocObjView), "Unexpected classid %s\n", wine_dbgstr_guid(&id)); 581 538 IPersist_Release(pp); 582 539 } 583 540 584 541 IShellFolder_Release(psfChild); 585 542 } 586 - pILFree(pidl); 543 + ILFree(pidl); 587 544 } 588 545 DeleteFileA(pathA); 589 546 } ··· 604 561 { 605 562 hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild); 606 563 ok(hr == E_FAIL || /* Vista+ */ 607 - hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */ 608 - hr == E_INVALIDARG || /* W2K item in top dir */ 609 - broken(hr == S_OK), /* Win9x, NT4, W2K */ 564 + hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */ 610 565 "Got 0x%08x\n", hr); 611 566 if(SUCCEEDED(hr)) IShellFolder_Release(psfChild); 612 - pILFree(pidl); 567 + ILFree(pidl); 613 568 } 614 569 DeleteFileA(pathA); 615 570 } ··· 630 585 { 631 586 hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild); 632 587 ok(hr == E_FAIL || /* Vista+ */ 633 - hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */ 634 - hr == E_INVALIDARG || /* W2K item in top dir */ 635 - broken(hr == S_OK), /* Win9x, NT4, W2K */ 588 + hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */ 636 589 "Got 0x%08x\n", hr); 637 590 if(SUCCEEDED(hr)) IShellFolder_Release(psfChild); 638 - pILFree(pidl); 591 + ILFree(pidl); 639 592 } 640 593 DeleteFileA(pathA); 641 594 } ··· 643 596 win_skip("Failed to create .foo testfile.\n"); 644 597 645 598 /* And on the desktop */ 646 - if(pSHGetSpecialFolderPathA) 647 - { 648 - pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE); 649 - lstrcatA(pathA, "\\"); 650 - lstrcatA(pathA, filename_html); 651 - hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); 652 - if(hfile != INVALID_HANDLE_VALUE) 653 - { 654 - CloseHandle(hfile); 655 - MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH); 656 - hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL); 657 - ok(hr == S_OK, "Got 0x%08x\n", hr); 658 - if(SUCCEEDED(hr)) 659 - { 660 - hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild); 661 - ok(hr == S_OK || 662 - hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */ 663 - "Got 0x%08x\n", hr); 664 - if(SUCCEEDED(hr)) IShellFolder_Release(psfChild); 665 - pILFree(pidl); 666 - } 667 - if(!DeleteFileA(pathA)) 668 - trace("Failed to delete: %d\n", GetLastError()); 599 + SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE); 600 + lstrcatA(pathA, "\\"); 601 + lstrcatA(pathA, filename_html); 602 + hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); 669 603 670 - } 671 - else 672 - win_skip("Failed to create .html testfile.\n"); 604 + CloseHandle(hfile); 605 + MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH); 606 + hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL); 607 + ok(hr == S_OK, "Got 0x%08x\n", hr); 608 + 609 + hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild); 610 + ok(hr == S_OK || 611 + hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */ 612 + "Got 0x%08x\n", hr); 613 + if(SUCCEEDED(hr)) IShellFolder_Release(psfChild); 614 + ILFree(pidl); 615 + if(!DeleteFileA(pathA)) 616 + trace("Failed to delete: %d\n", GetLastError()); 617 + 618 + SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE); 619 + lstrcatA(pathA, "\\"); 620 + lstrcatA(pathA, filename_foo); 621 + hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); 622 + 623 + CloseHandle(hfile); 624 + MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH); 625 + hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL); 626 + ok(hr == S_OK, "Got 0x%08x\n", hr); 673 627 674 - pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE); 675 - lstrcatA(pathA, "\\"); 676 - lstrcatA(pathA, filename_foo); 677 - hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); 678 - if(hfile != INVALID_HANDLE_VALUE) 679 - { 680 - CloseHandle(hfile); 681 - MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH); 682 - hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL); 683 - ok(hr == S_OK, "Got 0x%08x\n", hr); 684 - if(SUCCEEDED(hr)) 685 - { 686 - hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild); 687 - ok(hr == E_FAIL || /* Vista+ */ 688 - hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */ 689 - broken(hr == S_OK), /* Win9x, NT4, W2K */ 690 - "Got 0x%08x\n", hr); 691 - if(SUCCEEDED(hr)) IShellFolder_Release(psfChild); 692 - pILFree(pidl); 693 - } 694 - DeleteFileA(pathA); 695 - } 696 - else 697 - win_skip("Failed to create .foo testfile.\n"); 698 - } 628 + hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild); 629 + ok(hr == E_FAIL || /* Vista+ */ 630 + hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */ 631 + "Got 0x%08x\n", hr); 632 + if(SUCCEEDED(hr)) IShellFolder_Release(psfChild); 633 + ILFree(pidl); 634 + DeleteFileA(pathA); 699 635 700 636 IShellFolder_Release(psfDesktop); 701 637 } ··· 718 654 static const WCHAR wszFileName[] = { 'w','i','n','e','t','e','s','t','.','f','o','o',0 }; 719 655 static const WCHAR wszDirName[] = { 'w','i','n','e','t','e','s','t',0 }; 720 656 657 + /* It's ok to use this fixed path. Call will fail anyway. */ 658 + WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 }; 659 + LPITEMIDLIST pidlNew; 660 + 721 661 /* I'm trying to figure if there is a functional difference between calling 722 662 * SHGetPathFromIDListW and calling GetDisplayNameOf(SHGDN_FORPARSING) after 723 663 * binding to the shellfolder. One thing I thought of was that perhaps ··· 726 666 * no functional difference in this respect. 727 667 */ 728 668 729 - if(!pSHGetSpecialFolderPathA) { 730 - win_skip("SHGetSpecialFolderPathA is not available\n"); 731 - return; 732 - } 733 - 734 669 /* First creating a directory in MyDocuments and a file in this directory. */ 735 - result = pSHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE); 670 + result = SHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE); 736 671 ok(result, "SHGetSpecialFolderPathA failed! Last error: %u\n", GetLastError()); 737 672 if (!result) return; 738 673 ··· 768 703 return; 769 704 } 770 705 771 - pidlLast = pILFindLastID(pidlTestFile); 772 - ok(pidlLast->mkid.cb >=76 || 773 - broken(pidlLast->mkid.cb == 28) || /* W2K */ 774 - broken(pidlLast->mkid.cb == 40), /* Win9x, WinME */ 775 - "Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb); 706 + pidlLast = ILFindLastID(pidlTestFile); 707 + ok(pidlLast->mkid.cb >= 76, "Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb); 776 708 if (pidlLast->mkid.cb >= 28) { 777 709 ok(!lstrcmpA((CHAR*)&pidlLast->mkid.abID[12], szFileName), 778 710 "Filename should be stored as ansi-string at this position!\n"); ··· 790 722 */ 791 723 hr = IShellFolder_BindToObject(psfDesktop, pidlTestFile, NULL, &IID_IUnknown, (VOID**)&psfFile); 792 724 ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || 793 - hr == E_NOTIMPL || /* Vista */ 794 - broken(hr == S_OK), /* Win9x, W2K */ 725 + hr == E_NOTIMPL, /* Vista */ 795 726 "hr = %08x\n", hr); 796 727 if (hr == S_OK) { 797 728 IUnknown_Release(psfFile); 798 729 } 799 730 800 - if (!pSHBindToParent) 801 - { 802 - win_skip("SHBindToParent is missing\n"); 803 - DeleteFileA(szTestFile); 804 - RemoveDirectoryA(szTestDir); 805 - return; 806 - } 807 - 808 731 /* Some tests for IShellFolder::SetNameOf */ 809 - if (pSHGetFolderPathAndSubDirA) 810 - { 811 - hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 812 - ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr); 813 - if (hr == S_OK) { 814 - /* It's ok to use this fixed path. Call will fail anyway. */ 815 - WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 }; 816 - LPITEMIDLIST pidlNew; 732 + hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast); 733 + ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr); 817 734 818 - /* The pidl returned through the last parameter of SetNameOf is a simple one. */ 819 - hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew); 820 - ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr); 821 - if (hr == S_OK) 822 - { 823 - ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0, 824 - "pidl returned from SetNameOf should be simple!\n"); 735 + /* The pidl returned through the last parameter of SetNameOf is a simple one. */ 736 + hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew); 737 + ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr); 825 738 826 - /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf 827 - * is implemented on top of SHFileOperation in WinXP. */ 828 - hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename, 829 - SHGDN_FORPARSING, NULL); 830 - ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr); 739 + ok (((ITEMIDLIST *)((BYTE *)pidlNew + pidlNew->mkid.cb))->mkid.cb == 0, 740 + "pidl returned from SetNameOf should be simple!\n"); 831 741 832 - /* Rename the file back to its original name. SetNameOf ignores the fact, that the 833 - * SHGDN flags specify an absolute path. */ 834 - hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL); 835 - ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr); 742 + /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf 743 + * is implemented on top of SHFileOperation in WinXP. */ 744 + hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename, SHGDN_FORPARSING, NULL); 745 + ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr); 836 746 837 - pILFree(pidlNew); 838 - } 747 + /* Rename the file back to its original name. SetNameOf ignores the fact, that the 748 + * SHGDN flags specify an absolute path. */ 749 + hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL); 750 + ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr); 839 751 840 - IShellFolder_Release(psfPersonal); 841 - } 842 - } 843 - else 844 - win_skip("Avoid needs of interaction on Win2k\n"); 752 + ILFree(pidlNew); 753 + IShellFolder_Release(psfPersonal); 845 754 846 755 /* Deleting the file and the directory */ 847 756 DeleteFileA(szTestFile); 848 757 RemoveDirectoryA(szTestDir); 849 758 850 759 /* SHGetPathFromIDListW still works, although the file is not present anymore. */ 851 - if (pSHGetPathFromIDListW) 852 - { 853 - result = pSHGetPathFromIDListW(pidlTestFile, wszTestFile2); 854 - ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError()); 855 - ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n"); 856 - } 760 + result = SHGetPathFromIDListW(pidlTestFile, wszTestFile2); 761 + ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError()); 762 + ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n"); 857 763 858 764 /* SHBindToParent fails, if called with a NULL PIDL. */ 859 - hr = pSHBindToParent(NULL, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 860 - ok (hr != S_OK, "SHBindToParent(NULL) should fail!\n"); 765 + hr = SHBindToParent(NULL, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast); 766 + ok (hr == E_INVALIDARG || broken(hr == E_OUTOFMEMORY) /* XP */, 767 + "SHBindToParent(NULL) should fail! hr = %08x\n", hr); 861 768 862 769 /* But it succeeds with an empty PIDL. */ 863 - hr = pSHBindToParent(pidlEmpty, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 770 + hr = SHBindToParent(pidlEmpty, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast); 864 771 ok (hr == S_OK, "SHBindToParent(empty PIDL) should succeed! hr = %08x\n", hr); 865 772 ok (pidlLast == pidlEmpty, "The last element of an empty PIDL should be the PIDL itself!\n"); 866 773 if (hr == S_OK) 867 774 IShellFolder_Release(psfPersonal); 868 - 775 + 869 776 /* Binding to the folder and querying the display name of the file also works. */ 870 - hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 777 + hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast); 871 778 ok (hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr); 872 779 if (hr != S_OK) { 873 780 IShellFolder_Release(psfDesktop); 874 781 return; 875 782 } 876 783 877 - /* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into 784 + /* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into 878 785 * pidlTestFile (In accordance with MSDN). */ 879 - ok (pILFindLastID(pidlTestFile) == pidlLast, 786 + ok (ILFindLastID(pidlTestFile) == pidlLast, 880 787 "SHBindToParent doesn't return the last id of the pidl param!\n"); 881 - 788 + 882 789 hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret); 883 790 ok (hr == S_OK, "Personal->GetDisplayNameOf failed! hr = %08x\n", hr); 884 791 if (hr != S_OK) { ··· 887 794 return; 888 795 } 889 796 890 - if (pStrRetToBufW) 891 - { 892 - hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH); 893 - ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 894 - ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n"); 895 - } 896 - 797 + hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH); 798 + ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 799 + ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n"); 800 + 897 801 ILFree(pidlTestFile); 898 802 IShellFolder_Release(psfDesktop); 899 803 IShellFolder_Release(psfPersonal); ··· 931 835 hr = SHGetDesktopFolder(&psfDesktop); 932 836 ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr); 933 837 if (hr != S_OK) return; 934 - 935 - hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL, 838 + 839 + hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL, 936 840 &pidlMyDocuments, NULL); 937 - ok (hr == S_OK || 938 - broken(hr == E_INVALIDARG), /* Win95, NT4 */ 841 + ok (hr == S_OK, 939 842 "Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n", hr); 940 843 if (hr != S_OK) { 941 844 IShellFolder_Release(psfDesktop); ··· 1030 933 LPCITEMIDLIST pidlEmpty = (LPCITEMIDLIST)&emptyitem; 1031 934 LPITEMIDLIST pidlMyComputer; 1032 935 DWORD dwFlags; 1033 - static const DWORD desktopFlags[] = { 1034 - /* WinXP */ 1035 - SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR | 1036 - SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER, 1037 - /* Win2k */ 1038 - SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_STREAM | SFGAO_FILESYSANCESTOR | 1039 - SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER, 1040 - /* WinMe, Win9x, WinNT*/ 1041 - SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSANCESTOR | 1042 - SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER 1043 - }; 1044 - static const DWORD myComputerFlags[] = { 1045 - /* WinXP */ 1046 - SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | 1047 - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER, 1048 - /* Win2k */ 1049 - SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_STREAM | 1050 - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER, 1051 - /* WinMe, Win9x, WinNT */ 1052 - SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | 1053 - SFGAO_FOLDER | SFGAO_HASSUBFOLDER, 1054 - /* Win95, WinNT when queried directly */ 1055 - SFGAO_CANLINK | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | 1056 - SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER 1057 - }; 1058 - WCHAR wszMyComputer[] = { 936 + static const DWORD desktopFlags = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | 937 + SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER; 938 + static const DWORD myComputerFlags = SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | 939 + SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 940 + WCHAR wszMyComputer[] = { 1059 941 ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-', 1060 942 'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 }; 1061 943 char cCurrDirA [MAX_PATH] = {0}; ··· 1063 945 static WCHAR cTestDirW[] = {'t','e','s','t','d','i','r',0}; 1064 946 IShellFolder *IDesktopFolder, *testIShellFolder; 1065 947 ITEMIDLIST *newPIDL; 1066 - int len, i; 1067 - BOOL foundFlagsMatch; 948 + int len; 1068 949 1069 950 hr = SHGetDesktopFolder(&psfDesktop); 1070 951 ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr); ··· 1074 955 dwFlags = 0xffffffff; 1075 956 hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &dwFlags); 1076 957 ok (hr == S_OK, "Desktop->GetAttributesOf(empty pidl) failed! hr = %08x\n", hr); 1077 - for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch && 1078 - i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++) 1079 - { 1080 - if (desktopFlags[i] == dwFlags) 1081 - foundFlagsMatch = TRUE; 1082 - } 1083 - ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags); 958 + ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags); 1084 959 1085 960 /* .. or with no itemidlist at all. */ 1086 961 dwFlags = 0xffffffff; 1087 962 hr = IShellFolder_GetAttributesOf(psfDesktop, 0, NULL, &dwFlags); 1088 963 ok (hr == S_OK, "Desktop->GetAttributesOf(NULL) failed! hr = %08x\n", hr); 1089 - for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch && 1090 - i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++) 1091 - { 1092 - if (desktopFlags[i] == dwFlags) 1093 - foundFlagsMatch = TRUE; 1094 - } 1095 - ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags); 1096 - 964 + ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags); 965 + 1097 966 /* Testing the attributes of the MyComputer shellfolder */ 1098 967 hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL); 1099 968 ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr); ··· 1108 977 dwFlags = 0xffffffff; 1109 978 hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags); 1110 979 ok (hr == S_OK, "Desktop->GetAttributesOf(MyComputer) failed! hr = %08x\n", hr); 1111 - for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch && 1112 - i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++) 1113 - { 1114 - if ((myComputerFlags[i] | SFGAO_CANLINK) == dwFlags) 1115 - foundFlagsMatch = TRUE; 1116 - } 1117 980 todo_wine 1118 - ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags); 981 + ok (dwFlags == (myComputerFlags | SFGAO_CANLINK), "Wrong MyComputer attributes: %08x\n", dwFlags); 1119 982 1120 983 hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer); 1121 984 ok (hr == S_OK, "Desktop failed to bind to MyComputer object! hr = %08x\n", hr); ··· 1125 988 1126 989 hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags); 1127 990 todo_wine 1128 - ok (hr == E_INVALIDARG || 1129 - broken(hr == S_OK), /* W2K and earlier */ 1130 - "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr); 991 + ok (hr == E_INVALIDARG, "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr); 1131 992 1132 993 dwFlags = 0xffffffff; 1133 994 hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags); 1134 995 ok (hr == S_OK, "MyComputer->GetAttributesOf(NULL) failed! hr = %08x\n", hr); 1135 - for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch && 1136 - i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++) 1137 - { 1138 - if (myComputerFlags[i] == dwFlags) 1139 - foundFlagsMatch = TRUE; 1140 - } 1141 996 todo_wine 1142 - ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags); 997 + ok (dwFlags == myComputerFlags, "Wrong MyComputer attributes: %08x\n", dwFlags); 1143 998 1144 999 IShellFolder_Release(psfMyComputer); 1145 1000 ··· 1227 1082 'w','i','n','e','t','e','s','t','.','f','o','o',0 }; 1228 1083 LPITEMIDLIST pidlPrograms; 1229 1084 1230 - if(!pSHGetPathFromIDListW || !pSHGetSpecialFolderPathW) 1231 - { 1232 - win_skip("SHGetPathFromIDListW() or SHGetSpecialFolderPathW() is missing\n"); 1233 - return; 1234 - } 1235 - 1236 1085 /* Calling SHGetPathFromIDListW with no pidl should return the empty string */ 1237 1086 wszPath[0] = 'a'; 1238 1087 wszPath[1] = '\0'; 1239 - result = pSHGetPathFromIDListW(NULL, wszPath); 1088 + result = SHGetPathFromIDListW(NULL, wszPath); 1240 1089 ok(!result, "Expected failure\n"); 1241 1090 ok(!wszPath[0], "Expected empty string\n"); 1242 1091 1243 1092 /* Calling SHGetPathFromIDListW with an empty pidl should return the desktop folder's path. */ 1244 - result = pSHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE); 1093 + result = SHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE); 1245 1094 ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u\n", GetLastError()); 1246 1095 if (!result) return; 1247 1096 1248 - /* Check if we are on Win9x */ 1249 - SetLastError(0xdeadbeef); 1250 - lstrcmpiW(wszDesktop, wszDesktop); 1251 - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) 1252 - { 1253 - win_skip("Most W-calls are not implemented\n"); 1254 - return; 1255 - } 1256 - 1257 - result = pSHGetPathFromIDListW(pidlEmpty, wszPath); 1097 + result = SHGetPathFromIDListW(pidlEmpty, wszPath); 1258 1098 ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError()); 1259 1099 if (!result) return; 1260 1100 ok(!lstrcmpiW(wszDesktop, wszPath), "SHGetPathFromIDListW didn't return desktop path for empty pidl!\n"); ··· 1274 1114 SetLastError(0xdeadbeef); 1275 1115 wszPath[0] = 'a'; 1276 1116 wszPath[1] = '\0'; 1277 - result = pSHGetPathFromIDListW(pidlMyComputer, wszPath); 1117 + result = SHGetPathFromIDListW(pidlMyComputer, wszPath); 1278 1118 ok (!result, "SHGetPathFromIDListW succeeded where it shouldn't!\n"); 1279 1119 ok (GetLastError()==0xdeadbeef || 1280 1120 GetLastError()==ERROR_SUCCESS, /* Vista and higher */ ··· 1287 1127 1288 1128 IMalloc_Free(ppM, pidlMyComputer); 1289 1129 1290 - result = pSHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE); 1130 + result = SHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE); 1291 1131 ok(result, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError()); 1292 1132 if (!result) { 1293 1133 IShellFolder_Release(psfDesktop); ··· 1322 1162 IMalloc_Free(ppM, pidlTestFile); 1323 1163 return; 1324 1164 } 1325 - if (pStrRetToBufW) 1326 - { 1327 - pStrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH); 1328 - ok(0 == lstrcmpW(wszFileName, wszPath), 1329 - "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) " 1330 - "returned incorrect path for file placed on desktop\n"); 1331 - } 1165 + StrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH); 1166 + ok(0 == lstrcmpW(wszFileName, wszPath), 1167 + "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) " 1168 + "returned incorrect path for file placed on desktop\n"); 1332 1169 1333 - result = pSHGetPathFromIDListW(pidlTestFile, wszPath); 1170 + result = SHGetPathFromIDListW(pidlTestFile, wszPath); 1334 1171 ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError()); 1335 1172 ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n"); 1336 1173 ··· 1362 1199 IMalloc_Free(ppM, pidlTestFile); 1363 1200 1364 1201 /* Test if we can get the path from the start menu "program files" PIDL. */ 1365 - hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms); 1202 + hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms); 1366 1203 ok(hr == S_OK, "SHGetFolderLocation failed: 0x%08x\n", hr); 1367 1204 1368 1205 SetLastError(0xdeadbeef); 1369 - result = pSHGetPathFromIDListW(pidlPrograms, wszPath); 1206 + result = SHGetPathFromIDListW(pidlPrograms, wszPath); 1370 1207 IMalloc_Free(ppM, pidlPrograms); 1371 1208 ok(result, "SHGetPathFromIDListW failed\n"); 1372 1209 } ··· 1459 1296 'T','a','r','g','e','t','K','n','o','w','n','F','o','l','d','e','r',0 }; 1460 1297 static const WCHAR wszCLSID[] = { 1461 1298 'C','L','S','I','D',0 }; 1462 - 1299 + 1463 1300 if (!lstrcmpW(pszPropName, wszTargetSpecialFolder)) { 1464 - ok(V_VT(pVar) == VT_I4 || 1465 - broken(V_VT(pVar) == VT_BSTR), /* Win2k */ 1466 - "Wrong variant type for 'TargetSpecialFolder' property!\n"); 1301 + ok(V_VT(pVar) == VT_I4, "Wrong variant type for 'TargetSpecialFolder' property!\n"); 1467 1302 return E_INVALIDARG; 1468 1303 } 1469 1304 ··· 1476 1311 if (!lstrcmpW(pszPropName, wszTarget)) { 1477 1312 WCHAR wszPath[MAX_PATH]; 1478 1313 BOOL result; 1479 - 1480 - ok(V_VT(pVar) == VT_BSTR || 1481 - broken(V_VT(pVar) == VT_EMPTY), /* Win2k */ 1482 - "Wrong variant type for 'Target' property!\n"); 1314 + 1315 + ok(V_VT(pVar) == VT_BSTR, "Wrong variant type for 'Target' property!\n"); 1483 1316 if (V_VT(pVar) != VT_BSTR) return E_INVALIDARG; 1484 1317 1485 - result = pSHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1318 + result = SHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1486 1319 ok(result, "SHGetSpecialFolderPathW(DESKTOPDIRECTORY) failed! %u\n", GetLastError()); 1487 1320 if (!result) return E_INVALIDARG; 1488 1321 ··· 1559 1392 static const GUID CLSID_UnixDosFolder = 1560 1393 {0x9d20aae8, 0x0625, 0x44b0, {0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9}}; 1561 1394 1562 - if (!pSHGetSpecialFolderPathW || !pStrRetToBufW) { 1563 - win_skip("SHGetSpecialFolderPathW and/or StrRetToBufW are not available\n"); 1564 - return; 1565 - } 1566 - 1567 - if (!pSHGetFolderPathAndSubDirA) 1568 - { 1569 - win_skip("FolderShortcut test doesn't work on Win2k\n"); 1570 - return; 1571 - } 1572 - 1573 1395 /* These tests basically show, that CLSID_FolderShortcuts are initialized 1574 1396 * via their IPersistPropertyBag interface. And that the target folder 1575 1397 * is taken from the IPropertyBag's 'Target' property. ··· 1604 1426 return; 1605 1427 } 1606 1428 1607 - result = pSHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1429 + result = SHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1608 1430 ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u\n", GetLastError()); 1609 1431 if (!result) return; 1610 1432 1611 - pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH); 1433 + StrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH); 1612 1434 ok(!lstrcmpiW(wszDesktopPath, wszBuffer), "FolderShortcut returned incorrect folder!\n"); 1613 1435 1614 1436 hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (LPVOID*)&pPersistFolder3); ··· 1649 1471 ok (hr == S_OK, "IPersistFolder3::Initialize failed! hr = %08x\n", hr); 1650 1472 if (hr != S_OK) { 1651 1473 IPersistFolder3_Release(pPersistFolder3); 1652 - pILFree(pidlWineTestFolder); 1474 + ILFree(pidlWineTestFolder); 1653 1475 return; 1654 1476 } 1655 1477 1656 1478 hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder); 1657 1479 ok(hr == S_OK, "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr); 1658 - ok(pILIsEqual(pidlCurrentFolder, pidlWineTestFolder), 1480 + ok(ILIsEqual(pidlCurrentFolder, pidlWineTestFolder), 1659 1481 "IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n"); 1660 - pILFree(pidlCurrentFolder); 1661 - pILFree(pidlWineTestFolder); 1482 + ILFree(pidlCurrentFolder); 1483 + ILFree(pidlWineTestFolder); 1662 1484 1663 1485 hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (LPVOID*)&pShellFolder); 1664 1486 IPersistFolder3_Release(pPersistFolder3); ··· 1672 1494 return; 1673 1495 } 1674 1496 1675 - pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH); 1497 + StrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH); 1676 1498 ok(!lstrcmpiW(wszDesktopPath, wszBuffer), "FolderShortcut returned incorrect folder!\n"); 1677 1499 1678 1500 /* Next few lines are meant to show that children of FolderShortcuts are not FolderShortcuts, ··· 1696 1518 hr = IShellFolder_BindToObject(pShellFolder, pidlSubFolder, NULL, &IID_IPersistFolder3, 1697 1519 (LPVOID*)&pPersistFolder3); 1698 1520 IShellFolder_Release(pShellFolder); 1699 - pILFree(pidlSubFolder); 1521 + ILFree(pidlSubFolder); 1700 1522 ok (hr == S_OK, "IShellFolder::BindToObject failed! hr = %08x\n", hr); 1701 1523 if (hr != S_OK) 1702 1524 return; ··· 1748 1570 { 'l','o','n','g','e','r','_','t','h','a','n','.','8','_','3',0 } }; 1749 1571 int i; 1750 1572 1751 - if (!pSHGetSpecialFolderPathW) return; 1752 - 1753 - bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE); 1573 + bResult = SHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE); 1754 1574 ok(bResult, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError()); 1755 1575 if (!bResult) return; 1756 1576 ··· 1777 1597 hr = IShellFolder_BindToObject(psfDesktop, pidlPersonal, NULL, &IID_IShellFolder, 1778 1598 (LPVOID*)&psfPersonal); 1779 1599 IShellFolder_Release(psfDesktop); 1780 - pILFree(pidlPersonal); 1600 + ILFree(pidlPersonal); 1781 1601 ok(hr == S_OK, "psfDesktop->BindToObject failed! hr = %08x\n", hr); 1782 1602 if (hr != S_OK) return; 1783 1603 ··· 1818 1638 * current habit of storing the long filename here, which seems to work 1819 1639 * just fine. */ 1820 1640 todo_wine 1821 - ok(pidlFile->mkid.abID[18] == '~' || 1822 - broken(pidlFile->mkid.abID[34] == '~'), /* Win2k */ 1823 - "Should be derived 8.3 name!\n"); 1641 + ok(pidlFile->mkid.abID[18] == '~', "Should be derived 8.3 name!\n"); 1824 1642 1825 1643 if (i == 0) /* First file name has an even number of chars. No need for alignment. */ 1826 - ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0' || 1827 - broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1), /* Win2k */ 1644 + ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0', 1828 1645 "Alignment byte, where there shouldn't be!\n"); 1829 1646 1830 1647 if (i == 1) /* Second file name has an uneven number of chars => alignment byte */ ··· 1834 1651 /* The offset of the FileStructW member is stored as a WORD at the end of the pidl. */ 1835 1652 cbOffset = *(WORD*)(((LPBYTE)pidlFile)+pidlFile->mkid.cb-sizeof(WORD)); 1836 1653 ok ((cbOffset >= sizeof(struct FileStructA) && 1837 - cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)) || 1838 - broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1) || /* Win2k on short names */ 1839 - broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 12 + 1), /* Win2k on long names */ 1654 + cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)), 1840 1655 "Wrong offset value (%d) stored at the end of the PIDL\n", cbOffset); 1841 1656 1842 1657 if (cbOffset >= sizeof(struct FileStructA) && ··· 1888 1703 } 1889 1704 } 1890 1705 1891 - pILFree(pidlFile); 1706 + ILFree(pidlFile); 1892 1707 } 1893 1708 1894 1709 IShellFolder_Release(psfPersonal); ··· 1904 1719 HRESULT hr; 1905 1720 HKEY key; 1906 1721 1907 - if (!pSHGetFolderPathA) 1908 - { 1909 - win_skip("SHGetFolderPathA not present\n"); 1910 - return; 1911 - } 1912 1722 if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; 1913 1723 1914 - hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path ); 1724 + hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path ); 1915 1725 ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr ); 1916 - hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 ); 1726 + hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 ); 1917 1727 if (hr == E_FAIL) 1918 1728 { 1919 1729 win_skip( "Program Files (x86) not supported\n" ); ··· 1946 1756 RegCloseKey( key ); 1947 1757 } 1948 1758 1949 - hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path ); 1759 + hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path ); 1950 1760 ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr ); 1951 - hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 ); 1761 + hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 ); 1952 1762 if (hr == E_FAIL) 1953 1763 { 1954 1764 win_skip( "Common Files (x86) not supported\n" ); ··· 1993 1803 static char testpath[MAX_PATH]; 1994 1804 static char toolongpath[MAX_PATH+1]; 1995 1805 1996 - if(!pSHGetFolderPathAndSubDirA) 1997 - { 1998 - win_skip("SHGetFolderPathAndSubDirA not present!\n"); 1999 - return; 2000 - } 2001 - 2002 - if(!pSHGetFolderPathA) { 2003 - win_skip("SHGetFolderPathA not present!\n"); 2004 - return; 2005 - } 2006 - if(FAILED(pSHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata))) 1806 + if(FAILED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata))) 2007 1807 { 2008 1808 win_skip("SHGetFolderPathA failed for CSIDL_LOCAL_APPDATA!\n"); 2009 1809 return; ··· 2024 1824 } 2025 1825 2026 1826 /* test invalid second parameter */ 2027 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath); 1827 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath); 2028 1828 ok(E_INVALIDARG == ret, "expected E_INVALIDARG, got %x\n", ret); 2029 1829 2030 1830 /* test fourth parameter */ 2031 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath); 1831 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath); 2032 1832 switch(ret) { 2033 1833 case S_OK: /* winvista */ 2034 1834 ok(!strncmp(appdata, testpath, strlen(appdata)), ··· 2044 1844 2045 1845 /* test fifth parameter */ 2046 1846 testpath[0] = '\0'; 2047 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath); 1847 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath); 2048 1848 ok(S_OK == ret, "expected S_OK, got %x\n", ret); 2049 1849 ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath); 2050 1850 2051 1851 testpath[0] = '\0'; 2052 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath); 1852 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath); 2053 1853 ok(S_OK == ret, "expected S_OK, got %x\n", ret); 2054 1854 ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath); 2055 1855 2056 1856 testpath[0] = '\0'; 2057 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath); 1857 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath); 2058 1858 ok(S_OK == ret, "expected S_OK, got %x\n", ret); 2059 1859 ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath); 2060 1860 2061 1861 for(i=0; i< MAX_PATH; i++) 2062 1862 toolongpath[i] = '0' + i % 10; 2063 1863 toolongpath[MAX_PATH] = '\0'; 2064 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath); 1864 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath); 2065 1865 ok(HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) == ret, 2066 1866 "expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), ret); 2067 1867 2068 1868 testpath[0] = '\0'; 2069 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL); 1869 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL); 2070 1870 ok((S_OK == ret) || (E_INVALIDARG == ret), "expected S_OK or E_INVALIDARG, got %x\n", ret); 2071 1871 2072 1872 /* test a not existing path */ 2073 1873 testpath[0] = '\0'; 2074 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath); 1874 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath); 2075 1875 ok(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == ret, 2076 1876 "expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), ret); 2077 1877 2078 1878 /* create a directory inside a not existing directory */ 2079 1879 testpath[0] = '\0'; 2080 - ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath); 1880 + ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath); 2081 1881 ok(S_OK == ret, "expected S_OK, got %x\n", ret); 2082 1882 ok(!strncmp(appdata, testpath, strlen(appdata)), 2083 1883 "expected %s to start with %s\n", testpath, appdata); ··· 2162 1962 hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER, &strret); 2163 1963 ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr); 2164 1964 2165 - if (hr == S_OK && pStrRetToBufW) 2166 - { 2167 - hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR)); 2168 - ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 2169 - todo_wine 2170 - ok (!lstrcmpiW(tempbufW, folderdisplayW) || 2171 - broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */ 2172 - "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW)); 2173 - } 1965 + hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR)); 1966 + ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 1967 + todo_wine 1968 + ok (!lstrcmpiW(tempbufW, folderdisplayW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW)); 2174 1969 2175 1970 /* editing name is also read from the resource */ 2176 1971 hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FOREDITING, &strret); 2177 1972 ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr); 2178 1973 2179 - if (hr == S_OK && pStrRetToBufW) 2180 - { 2181 - hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR)); 2182 - ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 2183 - todo_wine 2184 - ok (!lstrcmpiW(tempbufW, folderdisplayW) || 2185 - broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */ 2186 - "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW)); 2187 - } 1974 + hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR)); 1975 + ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 1976 + todo_wine 1977 + ok (!lstrcmpiW(tempbufW, folderdisplayW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW)); 2188 1978 2189 1979 /* parsing name is unchanged */ 2190 1980 hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FORPARSING, &strret); 2191 1981 ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr); 2192 1982 2193 - if (hr == S_OK && pStrRetToBufW) 2194 - { 2195 - hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR)); 2196 - ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 2197 - ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW)); 2198 - } 1983 + hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR)); 1984 + ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr); 1985 + ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW)); 2199 1986 2200 1987 IShellFolder_Release(IDesktopFolder); 2201 1988 IShellFolder_Release(testIShellFolder); ··· 2234 2021 return; 2235 2022 } 2236 2023 2237 - if(pSHGetSpecialFolderLocation) 2238 - { 2239 - ret = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 2240 - ok(ret == S_OK, "Got 0x%08x\n", ret); 2241 - } 2242 - else 2243 - { 2244 - win_skip("pSHGetSpecialFolderLocation missing.\n"); 2245 - pidl_desktop = NULL; 2246 - } 2024 + ret = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 2025 + ok(ret == S_OK, "Got 0x%08x\n", ret); 2247 2026 2248 2027 MultiByteToWideChar(CP_ACP, 0, curdirA, -1, curdirW, MAX_PATH); 2249 2028 ··· 2261 2040 ret = IShellFolder_ParseDisplayName(currentfolder, NULL, NULL, testfileW, NULL, &pidl_testfile, NULL); 2262 2041 ok(SUCCEEDED(ret), "ParseDisplayName returned %x\n", ret); 2263 2042 2264 - pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile); 2043 + pidl_abstestfile = ILCombine(pidl_cwd, pidl_testfile); 2265 2044 2266 2045 shellitem = (void*)0xdeadbeef; 2267 2046 ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem); ··· 2289 2068 if (SUCCEEDED(ret)) 2290 2069 { 2291 2070 ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n"); 2292 - pILFree(pidl_test); 2071 + ILFree(pidl_test); 2293 2072 } 2294 2073 IPersistIDList_Release(persistidl); 2295 2074 } ··· 2309 2088 if (SUCCEEDED(ret)) 2310 2089 { 2311 2090 ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n"); 2312 - pILFree(pidl_test); 2091 + ILFree(pidl_test); 2313 2092 } 2314 2093 IPersistIDList_Release(persistidl); 2315 2094 } ··· 2327 2106 if (SUCCEEDED(ret)) 2328 2107 { 2329 2108 ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n"); 2330 - pILFree(pidl_test); 2109 + ILFree(pidl_test); 2331 2110 } 2332 2111 IPersistIDList_Release(persistidl); 2333 2112 } ··· 2350 2129 if (SUCCEEDED(ret)) 2351 2130 { 2352 2131 ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n"); 2353 - pILFree(pidl_test); 2132 + ILFree(pidl_test); 2354 2133 } 2355 2134 IPersistIDList_Release(persistidl); 2356 2135 } ··· 2371 2150 if (SUCCEEDED(ret)) 2372 2151 { 2373 2152 ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n"); 2374 - pILFree(pidl_test); 2153 + ILFree(pidl_test); 2375 2154 } 2376 2155 IPersistIDList_Release(persistidl); 2377 2156 } ··· 2391 2170 if (SUCCEEDED(ret)) 2392 2171 { 2393 2172 ok(ILIsEqual(pidl_testfile, pidl_test), "id lists are not equal\n"); 2394 - pILFree(pidl_test); 2173 + ILFree(pidl_test); 2395 2174 } 2396 2175 IPersistIDList_Release(persistidl); 2397 2176 } ··· 2476 2255 if (SUCCEEDED(ret)) 2477 2256 { 2478 2257 ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n"); 2479 - pILFree(pidl_test); 2258 + ILFree(pidl_test); 2480 2259 } 2481 2260 IPersistIDList_Release(persistidl); 2482 2261 } ··· 2496 2275 if (SUCCEEDED(ret)) 2497 2276 { 2498 2277 ok(ILIsEqual(pidl_testfile, pidl_test), "id lists are not equal\n"); 2499 - pILFree(pidl_test); 2278 + ILFree(pidl_test); 2500 2279 } 2501 2280 IPersistIDList_Release(persistidl); 2502 2281 } ··· 2573 2352 ret = IShellItem_Compare(shellitem, shellitem2, 0, &order); 2574 2353 ok(ret == S_OK, "IShellItem_Compare fail: 0x%08x.\n", ret); 2575 2354 ok(!order, "order got wrong value: %d.\n", order); 2576 - pILFree(pidl_desktop_testfile); 2355 + ILFree(pidl_desktop_testfile); 2577 2356 IShellItem_Release(shellitem2); 2578 2357 2579 2358 IShellItem_Release(shellitem); ··· 2664 2443 ret = IShellItem_Compare(shellitem, shellitem2, 0, &order); 2665 2444 ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret); 2666 2445 ok(!order, "order got wrong value: %d.\n", order); 2667 - pILFree(pidl_desktop_testfile); 2446 + ILFree(pidl_desktop_testfile); 2668 2447 IShellItem_Release(shellitem2); 2669 2448 2670 2449 IShellItem_Release(shellitem); ··· 2696 2475 win_skip("No SHCreateItemInKnownFolder or SHGetKnownFolderPath\n"); 2697 2476 2698 2477 DeleteFileA(".\\testfile"); 2699 - pILFree(pidl_abstestfile); 2700 - pILFree(pidl_testfile); 2701 - pILFree(pidl_desktop); 2702 - pILFree(pidl_cwd); 2478 + ILFree(pidl_abstestfile); 2479 + ILFree(pidl_testfile); 2480 + ILFree(pidl_desktop); 2481 + ILFree(pidl_cwd); 2703 2482 IShellFolder_Release(currentfolder); 2704 2483 IShellFolder_Release(desktopfolder); 2705 2484 } ··· 2723 2502 return; 2724 2503 } 2725 2504 2726 - /* These should be available on any platform that passed the above test. */ 2505 + /* This should be available on any platform that passed the above test. */ 2727 2506 ok(pSHCreateShellItem != NULL, "SHCreateShellItem missing.\n"); 2728 - ok(pSHBindToParent != NULL, "SHBindToParent missing.\n"); 2729 - ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n"); 2730 - ok(pStrRetToBufW != NULL, "StrRetToBufW missing.\n"); 2731 2507 2732 2508 if(0) 2733 2509 { ··· 2739 2515 ok(hres == E_INVALIDARG, "Got 0x%08x\n", hres); 2740 2516 2741 2517 /* Test the desktop */ 2742 - hres = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl); 2518 + hres = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl); 2743 2519 ok(hres == S_OK, "Got 0x%08x\n", hres); 2744 2520 hres = pSHCreateShellItem(NULL, NULL, pidl, &shellitem); 2745 2521 ok(hres == S_OK, "Got 0x%08x\n", hres); ··· 2767 2543 2768 2544 if(SUCCEEDED(hrSF)) 2769 2545 { 2770 - pStrRetToBufW(&strret, NULL, buf, MAX_PATH); 2546 + StrRetToBufW(&strret, NULL, buf, MAX_PATH); 2771 2547 if(SUCCEEDED(hrSI)) 2772 2548 ok(!lstrcmpW(nameSI, buf), "Strings differ.\n"); 2773 2549 if(SUCCEEDED(hrSF)) ··· 2778 2554 } 2779 2555 IShellFolder_Release(psf); 2780 2556 2781 - if(pSHGetPathFromIDListW){ 2782 - hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI); 2783 - ok(hrSI == S_OK, "Got 0x%08x\n", hrSI); 2784 - res = pSHGetPathFromIDListW(pidl, buf); 2785 - ok(res == TRUE, "Got %d\n", res); 2786 - if(SUCCEEDED(hrSI) && res) 2787 - ok(!lstrcmpW(nameSI, buf), "Strings differ.\n"); 2788 - if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI); 2789 - }else 2790 - win_skip("pSHGetPathFromIDListW not available\n"); 2557 + hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI); 2558 + ok(hrSI == S_OK, "Got 0x%08x\n", hrSI); 2559 + res = SHGetPathFromIDListW(pidl, buf); 2560 + ok(res == TRUE, "Got %d\n", res); 2561 + if(SUCCEEDED(hrSI) && res) 2562 + ok(!lstrcmpW(nameSI, buf), "Strings differ.\n"); 2563 + if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI); 2791 2564 2792 2565 hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string); 2793 2566 todo_wine ok(hres == S_OK, "Got 0x%08x\n", hres); ··· 2795 2568 2796 2569 IShellItem_Release(shellitem); 2797 2570 } 2798 - pILFree(pidl); 2571 + ILFree(pidl); 2799 2572 2800 2573 /* Test the control panel */ 2801 - hres = pSHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl); 2574 + hres = SHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl); 2802 2575 ok(hres == S_OK, "Got 0x%08x\n", hres); 2803 2576 hres = pSHCreateShellItem(NULL, NULL, pidl, &shellitem); 2804 2577 ok(hres == S_OK, "Got 0x%08x\n", hres); ··· 2826 2599 2827 2600 if(SUCCEEDED(hrSF)) 2828 2601 { 2829 - pStrRetToBufW(&strret, NULL, buf, MAX_PATH); 2602 + StrRetToBufW(&strret, NULL, buf, MAX_PATH); 2830 2603 if(SUCCEEDED(hrSI)) 2831 2604 ok(!lstrcmpW(nameSI, buf), "Strings differ.\n"); 2832 2605 if(SUCCEEDED(hrSF)) ··· 2837 2610 } 2838 2611 IShellFolder_Release(psf); 2839 2612 2840 - if(pSHGetPathFromIDListW){ 2841 - hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI); 2842 - ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI); 2843 - res = pSHGetPathFromIDListW(pidl, buf); 2844 - ok(res == FALSE, "Got %d\n", res); 2845 - if(SUCCEEDED(hrSI) && res) 2846 - ok(!lstrcmpW(nameSI, buf), "Strings differ.\n"); 2847 - if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI); 2848 - }else 2849 - win_skip("pSHGetPathFromIDListW not available\n"); 2613 + hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI); 2614 + ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI); 2615 + res = SHGetPathFromIDListW(pidl, buf); 2616 + ok(res == FALSE, "Got %d\n", res); 2617 + if(SUCCEEDED(hrSI) && res) 2618 + ok(!lstrcmpW(nameSI, buf), "Strings differ.\n"); 2619 + if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI); 2850 2620 2851 2621 hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string); 2852 2622 todo_wine ok(hres == E_NOTIMPL /* Win7 */ || hres == S_OK /* Vista */, ··· 2855 2625 2856 2626 IShellItem_Release(shellitem); 2857 2627 } 2858 - pILFree(pidl); 2628 + ILFree(pidl); 2859 2629 } 2860 2630 2861 2631 static void test_SHGetItemFromDataObject(void) ··· 2960 2730 skip("zero or one file found - skipping multi-file test.\n"); 2961 2731 2962 2732 for(i = 0; i < count; i++) 2963 - pILFree(apidl[i]); 2733 + ILFree(apidl[i]); 2964 2734 2965 2735 IEnumIDList_Release(peidl); 2966 2736 } ··· 3035 2805 { 3036 2806 hr = pSHCreateShellItem(NULL, NULL, pidl_testfile, &psi[i]); 3037 2807 ok(hr == S_OK, "Got 0x%08x\n", hr); 3038 - pILFree(pidl_testfile); 2808 + ILFree(pidl_testfile); 3039 2809 } 3040 2810 if(FAILED(hr)) failed = TRUE; 3041 2811 } ··· 3270 3040 return; 3271 3041 } 3272 3042 3273 - ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n"); 3274 - 3275 3043 if(0) 3276 3044 { 3277 3045 /* Crashes native */ ··· 3282 3050 hres = pSHGetIDListFromObject(NULL, &pidl); 3283 3051 ok(hres == E_NOINTERFACE, "Got %x\n", hres); 3284 3052 3285 - punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl)); 3053 + punkimpl = heap_alloc(sizeof(*punkimpl)); 3286 3054 punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown; 3287 3055 punkimpl->ifaces = ifaces; 3288 3056 punkimpl->unknown = 0; ··· 3299 3067 "interface not requested.\n"); 3300 3068 3301 3069 ok(!punkimpl->unknown, "Got %d unknown.\n", punkimpl->unknown); 3302 - HeapFree(GetProcessHeap(), 0, punkimpl); 3070 + heap_free(punkimpl); 3303 3071 3304 3072 pidl_desktop = NULL; 3305 - pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 3073 + SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 3306 3074 ok(pidl_desktop != NULL, "Failed to get desktop pidl.\n"); 3307 3075 3308 3076 SHGetDesktopFolder(&psfdesktop); ··· 3320 3088 if(SUCCEEDED(hres)) 3321 3089 { 3322 3090 ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n"); 3323 - pILFree(pidl); 3091 + ILFree(pidl); 3324 3092 } 3325 3093 IShellItem_Release(shellitem); 3326 3094 } ··· 3334 3102 if(SUCCEEDED(hres)) 3335 3103 { 3336 3104 ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n"); 3337 - pILFree(pidl); 3105 + ILFree(pidl); 3338 3106 } 3339 3107 3340 3108 hres = IShellFolder_CreateViewObject(psfdesktop, NULL, &IID_IShellView, (void**)&psv); ··· 3351 3119 if(SUCCEEDED(hres)) 3352 3120 { 3353 3121 ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n"); 3354 - pILFree(pidl); 3122 + ILFree(pidl); 3355 3123 } 3356 3124 3357 3125 /* Test IDataObject */ ··· 3378 3146 ok(hres == S_OK, "got 0x%08x\n", hres); 3379 3147 ok(pidl != NULL, "pidl is NULL.\n"); 3380 3148 ok(ILIsEqual(pidl, apidl[0]), "pidl not equal.\n"); 3381 - pILFree(pidl); 3149 + ILFree(pidl); 3382 3150 3383 3151 IDataObject_Release(pdo); 3384 3152 } ··· 3406 3174 skip("zero or one file found - skipping multi-file test.\n"); 3407 3175 3408 3176 for(i = 0; i < count; i++) 3409 - pILFree(apidl[i]); 3177 + ILFree(apidl[i]); 3410 3178 3411 3179 IEnumIDList_Release(peidl); 3412 3180 } ··· 3415 3183 } 3416 3184 3417 3185 IShellFolder_Release(psfdesktop); 3418 - pILFree(pidl_desktop); 3186 + ILFree(pidl_desktop); 3419 3187 } 3420 3188 3421 3189 static void test_SHGetItemFromObject(void) ··· 3453 3221 hres = pSHGetItemFromObject(NULL, &IID_IUnknown, (void**)&punk); 3454 3222 ok(hres == E_NOINTERFACE, "Got 0x%08x\n", hres); 3455 3223 3456 - punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl)); 3224 + punkimpl = heap_alloc(sizeof(*punkimpl)); 3457 3225 punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown; 3458 3226 punkimpl->ifaces = ifaces; 3459 3227 punkimpl->unknown = 0; ··· 3471 3239 "interface not requested.\n"); 3472 3240 3473 3241 ok(!punkimpl->unknown, "Got %d unknown.\n", punkimpl->unknown); 3474 - HeapFree(GetProcessHeap(), 0, punkimpl); 3242 + heap_free(punkimpl); 3475 3243 3476 3244 /* Test IShellItem */ 3477 3245 hres = pSHGetItemFromObject((IUnknown*)psfdesktop, &IID_IShellItem, (void**)&psi); ··· 3507 3275 skip("No pSHCreateShellItemArray!\n"); 3508 3276 return; 3509 3277 } 3510 - 3511 - ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n"); 3512 3278 3513 3279 if(0) 3514 3280 { ··· 3529 3295 hr = pSHCreateShellItemArray(NULL, pdesktopsf, 1, NULL, &psia); 3530 3296 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); 3531 3297 3532 - pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl); 3298 + SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl); 3533 3299 hr = pSHCreateShellItemArray(pidl, NULL, 0, NULL, &psia); 3534 3300 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); 3535 - pILFree(pidl); 3301 + ILFree(pidl); 3536 3302 3537 3303 GetCurrentDirectoryW(MAX_PATH, cTestDirW); 3538 3304 myPathAddBackslashW(cTestDirW); ··· 3553 3319 if(FAILED(hr)) 3554 3320 { 3555 3321 skip("Failed to set up environment for SHCreateShellItemArray tests.\n"); 3556 - pILFree(pidl_testdir); 3322 + ILFree(pidl_testdir); 3557 3323 Cleanup(); 3558 3324 return; 3559 3325 } ··· 3605 3371 if(SUCCEEDED(hr)) 3606 3372 { 3607 3373 ok(ILIsEqual(pidl_abs, pidl), "Pidl not equal.\n"); 3608 - pILFree(pidl); 3374 + ILFree(pidl); 3609 3375 } 3610 3376 IShellItem_Release(psi); 3611 3377 } 3612 - pILFree(pidl_abs); 3378 + ILFree(pidl_abs); 3613 3379 } 3614 3380 for(i = 0; i < done; i++) 3615 - pILFree(apidl[i]); 3381 + ILFree(apidl[i]); 3616 3382 IShellItemArray_Release(psia); 3617 3383 } 3618 3384 } ··· 3657 3423 ok(hr == S_OK, "Got 0x%08x\n", hr); 3658 3424 ok(pidl2 != NULL, "pidl2 was null.\n"); 3659 3425 ok(ILIsEqual(pidl1, pidl2), "pidls not equal.\n"); 3660 - pILFree(pidl1); 3661 - pILFree(pidl2); 3426 + ILFree(pidl1); 3427 + ILFree(pidl2); 3662 3428 IShellItem_Release(psi2); 3663 3429 } 3664 3430 hr = IShellItemArray_GetItemAt(psia, 1, &psi2); ··· 3733 3499 ok(hr == S_OK, "Got 0x%08x\n", hr); 3734 3500 ok(pidl != NULL, "pidl as NULL.\n"); 3735 3501 ok(ILIsEqual(pidl, pidl_abs), "pidls differ.\n"); 3736 - pILFree(pidl); 3502 + ILFree(pidl); 3737 3503 IShellItem_Release(psi); 3738 3504 } 3739 - pILFree(pidl_abs); 3505 + ILFree(pidl_abs); 3740 3506 } 3741 3507 3742 3508 IShellItemArray_Release(psia); ··· 3745 3511 IDataObject_Release(pdo); 3746 3512 } 3747 3513 for(i = 0; i < count; i++) 3748 - pILFree(apidl[i]); 3514 + ILFree(apidl[i]); 3749 3515 } 3750 3516 else 3751 3517 skip("No files found - skipping test.\n"); ··· 3824 3590 WCHAR desktoppath[MAX_PATH]; 3825 3591 BOOL result; 3826 3592 3827 - result = pSHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE); 3593 + result = SHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE); 3828 3594 ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u\n", GetLastError()); 3829 3595 3830 3596 hr = IShellItem_GetDisplayName(psi, SIGDN_DESKTOPABSOLUTEPARSING, &path); ··· 3929 3695 IShellItemArray_Release(psia); 3930 3696 } 3931 3697 3932 - pILFree(pidltest1); 3698 + ILFree(pidltest1); 3933 3699 } 3934 3700 3935 3701 IShellFolder_Release(pdesktopsf); ··· 3938 3704 skip("No SHCreateShellItemArrayFromIDLists.\n"); 3939 3705 3940 3706 IShellFolder_Release(psf); 3941 - pILFree(pidl_testdir); 3707 + ILFree(pidl_testdir); 3942 3708 Cleanup(); 3943 3709 } 3944 3710 ··· 3972 3738 hr = IShellFolder_BindToObject(pdesktopsf, pidl_testdir, NULL, (REFIID)&IID_IShellFolder, 3973 3739 (void**)&psf); 3974 3740 ok(hr == S_OK, "Got 0x%08x\n", hr); 3975 - pILFree(pidl_testdir); 3741 + ILFree(pidl_testdir); 3976 3742 } 3977 3743 IShellFolder_Release(pdesktopsf); 3978 3744 if (FAILED(hr)) return; ··· 4091 3857 } 4092 3858 4093 3859 for(i = 0; i < done; i++) 4094 - pILFree(apidl[i]); 3860 + ILFree(apidl[i]); 4095 3861 } 4096 3862 } 4097 3863 ··· 4108 3874 return; 4109 3875 } 4110 3876 4111 - hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 3877 + hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 4112 3878 ok(hr == S_OK, "Got 0x%08x\n", hr); 4113 3879 if(SUCCEEDED(hr)) 4114 3880 { ··· 4143 3909 if(SUCCEEDED(hr)) 4144 3910 { 4145 3911 ok(ILIsEqual(pidl_desktop, pidl_tmp), "Pidl not equal (%p, %p)\n", pidl_desktop, pidl_tmp); 4146 - pILFree(pidl_tmp); 3912 + ILFree(pidl_tmp); 4147 3913 } 4148 3914 IPersistFolder2_Release(ppf2); 4149 3915 } ··· 4257 4023 else 4258 4024 skip("Failed to create ShellItem.\n"); 4259 4025 4260 - pILFree(pidl_desktop); 4026 + ILFree(pidl_desktop); 4261 4027 } 4262 4028 4263 4029 static void test_ShellItemGetAttributes(void) ··· 4278 4044 return; 4279 4045 } 4280 4046 4281 - hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 4047 + hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop); 4282 4048 ok(hr == S_OK, "Got 0x%08x\n", hr); 4283 4049 if(SUCCEEDED(hr)) 4284 4050 { 4285 4051 hr = pSHCreateShellItem(NULL, NULL, pidl_desktop, &psi); 4286 4052 ok(hr == S_OK, "Got 0x%08x\n", hr); 4287 - pILFree(pidl_desktop); 4053 + ILFree(pidl_desktop); 4288 4054 } 4289 4055 if(FAILED(hr)) 4290 4056 { ··· 4319 4085 ok(hr == S_OK, "got 0x%08x\n", hr); 4320 4086 hr = pSHCreateShellItem(NULL, NULL, pidl, &psi_folder1); 4321 4087 ok(hr == S_OK, "Got 0x%08x\n", sfgao); 4322 - pILFree(pidl); 4088 + ILFree(pidl); 4323 4089 4324 4090 lstrcpyW(buf, curdirW); 4325 4091 lstrcatW(buf, testfile1W); ··· 4327 4093 ok(hr == S_OK, "got 0x%08x\n", hr); 4328 4094 hr = pSHCreateShellItem(NULL, NULL, pidl, &psi_file1); 4329 4095 ok(hr == S_OK, "Got 0x%08x\n", sfgao); 4330 - pILFree(pidl); 4096 + ILFree(pidl); 4331 4097 4332 4098 IShellFolder_Release(pdesktopsf); 4333 4099 ··· 4402 4168 ok(hr == S_OK, "got 0x%08x\n", hr); 4403 4169 4404 4170 for(i = 0; i < 5; i++) 4405 - pILFree((LPITEMIDLIST)pidl_array[i]); 4171 + ILFree((LPITEMIDLIST)pidl_array[i]); 4406 4172 4407 4173 /* [testfolder/, testfolder/testfolder2] seems to break in Vista */ 4408 4174 attr = 0xdeadbeef; ··· 4480 4246 HRESULT hr; 4481 4247 BOOL ret, is_wow64; 4482 4248 4483 - if (!pSHParseDisplayName) 4484 - { 4485 - win_skip("SHParseDisplayName isn't available\n"); 4486 - return; 4487 - } 4488 - 4489 4249 if (0) 4490 4250 { 4491 4251 /* crashes on native */ 4492 - pSHParseDisplayName(NULL, NULL, NULL, 0, NULL); 4252 + SHParseDisplayName(NULL, NULL, NULL, 0, NULL); 4493 4253 nameW[0] = 0; 4494 - pSHParseDisplayName(nameW, NULL, NULL, 0, NULL); 4254 + SHParseDisplayName(nameW, NULL, NULL, 0, NULL); 4495 4255 } 4496 4256 4497 4257 pidl1 = (LPITEMIDLIST)0xdeadbeef; 4498 - hr = pSHParseDisplayName(NULL, NULL, &pidl1, 0, NULL); 4258 + hr = SHParseDisplayName(NULL, NULL, &pidl1, 0, NULL); 4499 4259 ok(broken(hr == E_OUTOFMEMORY) /* < Vista */ || 4500 4260 hr == E_INVALIDARG, "failed %08x\n", hr); 4501 4261 ok(pidl1 == 0, "expected null ptr, got %p\n", pidl1); 4502 4262 4503 4263 /* dummy name */ 4504 4264 nameW[0] = 0; 4505 - hr = pSHParseDisplayName(nameW, NULL, &pidl1, 0, NULL); 4265 + hr = SHParseDisplayName(nameW, NULL, &pidl1, 0, NULL); 4506 4266 ok(hr == S_OK, "failed %08x\n", hr); 4507 4267 hr = SHGetDesktopFolder(&desktop); 4508 4268 ok(hr == S_OK, "failed %08x\n", hr); 4509 4269 hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, nameW, NULL, &pidl2, NULL); 4510 4270 ok(hr == S_OK, "failed %08x\n", hr); 4511 - ret = pILIsEqual(pidl1, pidl2); 4271 + ret = ILIsEqual(pidl1, pidl2); 4512 4272 ok(ret == TRUE, "expected equal idls\n"); 4513 - pILFree(pidl1); 4514 - pILFree(pidl2); 4273 + ILFree(pidl1); 4274 + ILFree(pidl2); 4515 4275 4516 4276 /* with path */ 4517 4277 GetWindowsDirectoryW( dirW, MAX_PATH ); 4518 4278 4519 - hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL); 4279 + hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL); 4520 4280 ok(hr == S_OK, "failed %08x\n", hr); 4521 4281 hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, dirW, NULL, &pidl2, NULL); 4522 4282 ok(hr == S_OK, "failed %08x\n", hr); 4523 4283 4524 - ret = pILIsEqual(pidl1, pidl2); 4284 + ret = ILIsEqual(pidl1, pidl2); 4525 4285 ok(ret == TRUE, "expected equal idls\n"); 4526 - pILFree(pidl1); 4527 - pILFree(pidl2); 4286 + ILFree(pidl1); 4287 + ILFree(pidl2); 4528 4288 4529 4289 /* system32 is not redirected to syswow64 on WOW64 */ 4530 4290 if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; 4531 - if (is_wow64 && pGetSystemWow64DirectoryW) 4291 + if (is_wow64) 4532 4292 { 4533 4293 UINT len; 4534 4294 *dirW = 0; 4535 4295 len = GetSystemDirectoryW(dirW, MAX_PATH); 4536 4296 ok(len > 0, "GetSystemDirectoryW failed: %u\n", GetLastError()); 4537 - hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL); 4297 + hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL); 4538 4298 ok(hr == S_OK, "failed %08x\n", hr); 4539 4299 *dirW = 0; 4540 - len = pGetSystemWow64DirectoryW(dirW, MAX_PATH); 4300 + len = GetSystemWow64DirectoryW(dirW, MAX_PATH); 4541 4301 ok(len > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError()); 4542 - hr = pSHParseDisplayName(dirW, NULL, &pidl2, 0, NULL); 4302 + hr = SHParseDisplayName(dirW, NULL, &pidl2, 0, NULL); 4543 4303 ok(hr == S_OK, "failed %08x\n", hr); 4544 - ret = pILIsEqual(pidl1, pidl2); 4304 + ret = ILIsEqual(pidl1, pidl2); 4545 4305 ok(ret == FALSE, "expected different idls\n"); 4546 - pILFree(pidl1); 4547 - pILFree(pidl2); 4306 + ILFree(pidl1); 4307 + ILFree(pidl2); 4548 4308 } 4549 4309 4550 4310 IShellFolder_Release(desktop); ··· 4554 4314 skip("No empty cdrom drive found, skipping test\n"); 4555 4315 else 4556 4316 { 4557 - hr = pSHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL); 4317 + hr = SHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL); 4558 4318 ok(hr == S_OK, "failed %08x\n", hr); 4559 - if (SUCCEEDED(hr)) pILFree(pidl1); 4319 + if (SUCCEEDED(hr)) ILFree(pidl1); 4560 4320 } 4561 4321 } 4562 4322 ··· 4572 4332 ok(hr == S_OK, "failed %08x\n", hr); 4573 4333 4574 4334 hr = IShellFolder_QueryInterface(desktop, &IID_IPersist, (void**)&persist); 4575 - ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* NT4, W9X */, "failed %08x\n", hr); 4335 + ok(hr == S_OK, "failed %08x\n", hr); 4576 4336 4577 4337 if (hr == S_OK) 4578 4338 { ··· 4608 4368 hr = IPersistFolder2_GetCurFolder(ppf2, &pidl); 4609 4369 ok(hr == S_OK, "got %08x\n", hr); 4610 4370 ok(pidl != NULL, "pidl was NULL.\n"); 4611 - if(SUCCEEDED(hr)) pILFree(pidl); 4371 + if(SUCCEEDED(hr)) ILFree(pidl); 4612 4372 4613 4373 IPersistFolder2_Release(ppf2); 4614 4374 } ··· 4616 4376 IShellFolder_Release(desktop); 4617 4377 } 4618 4378 4379 + static void test_contextmenu_qi(IContextMenu *menu, BOOL todo) 4380 + { 4381 + IUnknown *unk; 4382 + HRESULT hr; 4383 + 4384 + hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk); 4385 + todo_wine_if(todo) 4386 + ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); 4387 + if (hr == S_OK) 4388 + IUnknown_Release(unk); 4389 + 4390 + hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk); 4391 + todo_wine_if(todo) 4392 + ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); 4393 + if (hr == S_OK) 4394 + IUnknown_Release(unk); 4395 + } 4396 + 4397 + static void test_contextmenu(IContextMenu *menu, BOOL background) 4398 + { 4399 + HMENU hmenu = CreatePopupMenu(); 4400 + const int id_upper_limit = 32767; 4401 + const int baseItem = 0x40; 4402 + INT max_id, max_id_check; 4403 + UINT count, i; 4404 + HRESULT hr; 4405 + 4406 + test_contextmenu_qi(menu, FALSE); 4407 + 4408 + hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL); 4409 + ok(SUCCEEDED(hr), "Failed to query the menu, hr %#x.\n", hr); 4410 + 4411 + max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */ 4412 + ok(max_id <= id_upper_limit, "Got %d\n", max_id); 4413 + count = GetMenuItemCount(hmenu); 4414 + ok(count, "Got %d\n", count); 4415 + 4416 + max_id_check = 0; 4417 + for (i = 0; i < count; i++) 4418 + { 4419 + MENUITEMINFOA mii; 4420 + INT res; 4421 + char buf[255], buf2[255]; 4422 + ZeroMemory(&mii, sizeof(MENUITEMINFOA)); 4423 + mii.cbSize = sizeof(MENUITEMINFOA); 4424 + mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING; 4425 + mii.dwTypeData = buf2; 4426 + mii.cch = sizeof(buf2); 4427 + 4428 + res = GetMenuItemInfoA(hmenu, i, TRUE, &mii); 4429 + ok(res, "Failed to get menu item info, error %d.\n", GetLastError()); 4430 + 4431 + ok((mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR), 4432 + "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType); 4433 + if (!(mii.fType & MFT_SEPARATOR)) 4434 + { 4435 + max_id_check = (mii.wID > max_id_check) ? mii.wID : max_id_check; 4436 + hr = IContextMenu_GetCommandString(menu, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf)); 4437 + todo_wine_if(background) 4438 + ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData); 4439 + if (SUCCEEDED(hr)) 4440 + trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData); 4441 + else if (hr == E_NOTIMPL) 4442 + trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData); 4443 + } 4444 + } 4445 + max_id_check -= baseItem; 4446 + ok((max_id_check == max_id) || 4447 + (max_id_check == max_id-1) || /* Win 7 */ 4448 + (max_id_check == max_id-2) || /* Win 8 */ 4449 + (max_id_check == max_id-3), 4450 + "Not equal (or near equal), got %d and %d\n", max_id_check, max_id); 4451 + 4452 + if (count) 4453 + { 4454 + CMINVOKECOMMANDINFO cmi; 4455 + 4456 + memset(&cmi, 0, sizeof(CMINVOKECOMMANDINFO)); 4457 + cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); 4458 + 4459 + /* Attempt to execute a nonexistent command */ 4460 + cmi.lpVerb = MAKEINTRESOURCEA(9999); 4461 + hr = IContextMenu_InvokeCommand(menu, &cmi); 4462 + todo_wine_if(background) 4463 + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); 4464 + 4465 + cmi.lpVerb = "foobar_wine_test"; 4466 + hr = IContextMenu_InvokeCommand(menu, &cmi); 4467 + todo_wine_if(background) 4468 + ok((hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) || 4469 + (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */), 4470 + "Unexpected hr %#x.\n", hr); 4471 + } 4472 + 4473 + DestroyMenu(hmenu); 4474 + } 4475 + 4619 4476 static void test_GetUIObject(void) 4620 4477 { 4621 4478 IShellFolder *psf_desktop; ··· 4625 4482 WCHAR path[MAX_PATH]; 4626 4483 const WCHAR filename[] = 4627 4484 {'\\','t','e','s','t','d','i','r','\\','t','e','s','t','1','.','t','x','t',0}; 4628 - 4629 - if(!pSHBindToParent) 4630 - { 4631 - win_skip("SHBindToParent missing.\n"); 4632 - return; 4633 - } 4485 + LPCITEMIDLIST pidl_child; 4486 + IShellFolder *psf; 4634 4487 4635 4488 GetCurrentDirectoryW(MAX_PATH, path); 4636 4489 if (!path[0]) ··· 4644 4497 CreateFilesFolders(); 4645 4498 4646 4499 hr = IShellFolder_ParseDisplayName(psf_desktop, NULL, NULL, path, NULL, &pidl, 0); 4647 - ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr); 4648 - if(SUCCEEDED(hr)) 4649 - { 4650 - IShellFolder *psf; 4651 - LPCITEMIDLIST pidl_child; 4652 - hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&psf, &pidl_child); 4653 - ok(hr == S_OK, "Got 0x%08x\n", hr); 4654 - if(SUCCEEDED(hr)) 4655 - { 4656 - hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, 4657 - (void**)&pcm); 4658 - ok(hr == S_OK, "Got 0x%08x\n", hr); 4659 - if(SUCCEEDED(hr)) 4660 - { 4661 - const int baseItem = 0x40; 4662 - HMENU hmenu = CreatePopupMenu(); 4663 - INT max_id, max_id_check; 4664 - UINT count, i; 4665 - const int id_upper_limit = 32767; 4666 - hr = IContextMenu_QueryContextMenu(pcm, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL); 4667 - ok(SUCCEEDED(hr), "Got 0x%08x\n", hr); 4668 - max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */ 4669 - ok(max_id <= id_upper_limit, "Got %d\n", max_id); 4670 - count = GetMenuItemCount(hmenu); 4671 - ok(count, "Got %d\n", count); 4500 + ok(hr == S_OK, "Got 0x%08x\n", hr); 4672 4501 4673 - max_id_check = 0; 4674 - for(i = 0; i < count; i++) 4675 - { 4676 - MENUITEMINFOA mii; 4677 - INT res; 4678 - char buf[255], buf2[255]; 4679 - ZeroMemory(&mii, sizeof(MENUITEMINFOA)); 4680 - mii.cbSize = sizeof(MENUITEMINFOA); 4681 - mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING; 4682 - mii.dwTypeData = buf2; 4683 - mii.cch = sizeof(buf2); 4502 + hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&psf, &pidl_child); 4503 + ok(hr == S_OK, "Failed to bind to folder, hr %#x.\n", hr); 4684 4504 4685 - SetLastError(0); 4686 - res = GetMenuItemInfoA(hmenu, i, TRUE, &mii); 4687 - ok(res, "Failed (last error: %d).\n", GetLastError()); 4505 + /* Item menu */ 4506 + hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, (void **)&pcm); 4507 + ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr); 4508 + test_contextmenu(pcm, FALSE); 4509 + IContextMenu_Release(pcm); 4688 4510 4689 - ok( (mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR), 4690 - "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType); 4691 - if(!(mii.fType & MFT_SEPARATOR)) 4692 - { 4693 - max_id_check = (mii.wID>max_id_check)?mii.wID:max_id_check; 4694 - hr = IContextMenu_GetCommandString(pcm, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf)); 4695 - ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData); 4696 - if (SUCCEEDED(hr)) 4697 - trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData); 4698 - else if (hr == E_NOTIMPL) 4699 - trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData); 4700 - } 4701 - } 4702 - max_id_check -= baseItem; 4703 - ok((max_id_check == max_id) || 4704 - (max_id_check == max_id-1) || /* Win 7 */ 4705 - (max_id_check == max_id-2), /* Win 8 */ 4706 - "Not equal (or near equal), got %d and %d\n", max_id_check, max_id); 4511 + /* Background menu */ 4512 + hr = IShellFolder_GetUIObjectOf(psf_desktop, NULL, 0, NULL, &IID_IContextMenu, NULL, (void **)&pcm); 4513 + ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr); 4514 + test_contextmenu(pcm, TRUE); 4515 + IContextMenu_Release(pcm); 4707 4516 4708 - #define is_win2k() (pSHGetFolderPathA && !pSHGetFolderPathAndSubDirA) 4709 - 4710 - if(count && !is_win2k()) /* Test is interactive on w2k, so skip */ 4711 - { 4712 - CMINVOKECOMMANDINFO cmi; 4713 - ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO)); 4714 - cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); 4715 - 4716 - /* Attempt to execute a nonexistent command */ 4717 - cmi.lpVerb = MAKEINTRESOURCEA(9999); 4718 - hr = IContextMenu_InvokeCommand(pcm, &cmi); 4719 - ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); 4720 - 4721 - cmi.lpVerb = "foobar_wine_test"; 4722 - hr = IContextMenu_InvokeCommand(pcm, &cmi); 4723 - ok( (hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) || 4724 - (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */), 4725 - "Got 0x%08x\n", hr); 4726 - } 4727 - #undef is_win2k 4728 - 4729 - DestroyMenu(hmenu); 4730 - IContextMenu_Release(pcm); 4731 - } 4732 - IShellFolder_Release(psf); 4733 - } 4734 - if(pILFree) pILFree(pidl); 4735 - } 4517 + IShellFolder_Release(psf); 4518 + ILFree(pidl); 4736 4519 4737 4520 IShellFolder_Release(psf_desktop); 4738 4521 Cleanup(); ··· 4746 4529 STRRET filename; 4747 4530 HRESULT hr; 4748 4531 4749 - if(!pSHBindToParent){ 4750 - win_skip("SHBindToParent is not available, not performing full PIDL verification\n"); 4751 - if(path) 4752 - ok_(__FILE__,l)(pidl != NULL, "Expected PIDL to be non-NULL\n"); 4753 - else 4754 - ok_(__FILE__,l)(pidl == NULL, "Expected PIDL to be NULL\n"); 4755 - return; 4756 - } 4757 - 4758 4532 if(path){ 4759 4533 if(!pidl){ 4760 4534 ok_(__FILE__,l)(0, "didn't get expected path (%s), instead: NULL\n", wine_dbgstr_w(path)); 4761 4535 return; 4762 4536 } 4763 4537 4764 - hr = pSHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&parent, &child); 4538 + hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&parent, &child); 4765 4539 ok_(__FILE__,l)(hr == S_OK, "SHBindToParent failed: 0x%08x\n", hr); 4766 4540 if(FAILED(hr)) 4767 4541 return; ··· 4799 4573 4800 4574 LPITEMIDLIST pidl = NULL; 4801 4575 4802 - if(!pSHSimpleIDListFromPathAW){ 4803 - win_skip("SHSimpleIDListFromPathAW not available\n"); 4804 - return; 4805 - } 4806 - 4807 4576 br = CreateDirectoryA(adirA, NULL); 4808 4577 ok(br == TRUE, "CreateDirectory failed: %d\n", GetLastError()); 4809 4578 4810 4579 if(is_unicode) 4811 - pidl = pSHSimpleIDListFromPathAW(adirW); 4580 + pidl = SHSimpleIDListFromPath(adirW); 4812 4581 else 4813 - pidl = pSHSimpleIDListFromPathAW(adirA); 4582 + pidl = SHSimpleIDListFromPath((const WCHAR *)adirA); 4814 4583 verify_pidl(pidl, adirW); 4815 - pILFree(pidl); 4584 + ILFree(pidl); 4816 4585 4817 4586 br = RemoveDirectoryA(adirA); 4818 4587 ok(br == TRUE, "RemoveDirectory failed: %d\n", GetLastError()); 4819 4588 4820 4589 if(is_unicode) 4821 - pidl = pSHSimpleIDListFromPathAW(adirW); 4590 + pidl = SHSimpleIDListFromPath(adirW); 4822 4591 else 4823 - pidl = pSHSimpleIDListFromPathAW(adirA); 4592 + pidl = SHSimpleIDListFromPath((const WCHAR *)adirA); 4824 4593 verify_pidl(pidl, adirW); 4825 - pILFree(pidl); 4594 + ILFree(pidl); 4826 4595 } 4827 4596 4828 4597 /* IFileSystemBindData impl */ ··· 4933 4702 4934 4703 /* fails on unknown dir with no IBindCtx */ 4935 4704 hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, adirW, NULL, &pidl, NULL); 4936 - ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */, 4937 - "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4705 + ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4938 4706 hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, afileW, NULL, &pidl, NULL); 4939 - ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */, 4940 - "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4707 + ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4941 4708 hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, afile2W, NULL, &pidl, NULL); 4942 - ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */, 4943 - "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4709 + ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4944 4710 4945 4711 /* fails on unknown dir with IBindCtx with no IFileSystemBindData */ 4946 4712 hres = CreateBindCtx(0, &pbc); 4947 4713 ok(hres == S_OK, "CreateBindCtx failed: 0x%08x\n", hres); 4948 4714 4949 4715 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL); 4950 - ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */, 4951 - "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4716 + ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4952 4717 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL); 4953 - ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */, 4954 - "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4718 + ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4955 4719 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL); 4956 - ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */, 4957 - "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4720 + ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres); 4958 4721 4959 4722 /* unknown dir with IBindCtx with IFileSystemBindData */ 4960 4723 hres = IBindCtx_RegisterObjectParam(pbc, wFileSystemBindData, (IUnknown*)&fsbd); ··· 4964 4727 pidl = (ITEMIDLIST*)0xdeadbeef; 4965 4728 fsbdVtbl.GetFindData = fsbd_GetFindData_fail; 4966 4729 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL); 4967 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 4968 - "ParseDisplayName failed: 0x%08x\n", hres); 4730 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 4969 4731 if(SUCCEEDED(hres)){ 4970 4732 verify_pidl(pidl, adirW); 4971 4733 ILFree(pidl); 4972 4734 } 4973 4735 4974 4736 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL); 4975 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 4976 - "ParseDisplayName failed: 0x%08x\n", hres); 4737 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 4977 4738 if(SUCCEEDED(hres)){ 4978 4739 verify_pidl(pidl, afileW); 4979 4740 ILFree(pidl); 4980 4741 } 4981 4742 4982 4743 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL); 4983 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 4984 - "ParseDisplayName failed: 0x%08x\n", hres); 4744 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 4985 4745 if(SUCCEEDED(hres)){ 4986 4746 verify_pidl(pidl, afile2W); 4987 4747 ILFree(pidl); ··· 4991 4751 pidl = (ITEMIDLIST*)0xdeadbeef; 4992 4752 fsbdVtbl.GetFindData = fsbd_GetFindData_nul; 4993 4753 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL); 4994 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 4995 - "ParseDisplayName failed: 0x%08x\n", hres); 4754 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 4996 4755 if(SUCCEEDED(hres)){ 4997 4756 verify_pidl(pidl, adirW); 4998 4757 ILFree(pidl); 4999 4758 } 5000 4759 5001 4760 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL); 5002 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5003 - "ParseDisplayName failed: 0x%08x\n", hres); 4761 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5004 4762 if(SUCCEEDED(hres)){ 5005 4763 verify_pidl(pidl, afileW); 5006 4764 ILFree(pidl); 5007 4765 } 5008 4766 5009 4767 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL); 5010 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5011 - "ParseDisplayName failed: 0x%08x\n", hres); 4768 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5012 4769 if(SUCCEEDED(hres)){ 5013 4770 verify_pidl(pidl, afile2W); 5014 4771 ILFree(pidl); ··· 5018 4775 pidl = (ITEMIDLIST*)0xdeadbeef; 5019 4776 fsbdVtbl.GetFindData = fsbd_GetFindData_junk; 5020 4777 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL); 5021 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5022 - "ParseDisplayName failed: 0x%08x\n", hres); 4778 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5023 4779 if(SUCCEEDED(hres)){ 5024 4780 verify_pidl(pidl, adirW); 5025 4781 ILFree(pidl); 5026 4782 } 5027 4783 5028 4784 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL); 5029 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5030 - "ParseDisplayName failed: 0x%08x\n", hres); 4785 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5031 4786 if(SUCCEEDED(hres)){ 5032 4787 verify_pidl(pidl, afileW); 5033 4788 ILFree(pidl); 5034 4789 } 5035 4790 5036 4791 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL); 5037 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5038 - "ParseDisplayName failed: 0x%08x\n", hres); 4792 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5039 4793 if(SUCCEEDED(hres)){ 5040 4794 verify_pidl(pidl, afile2W); 5041 4795 ILFree(pidl); ··· 5045 4799 pidl = (ITEMIDLIST*)0xdeadbeef; 5046 4800 fsbdVtbl.GetFindData = fsbd_GetFindData_invalid; 5047 4801 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL); 5048 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5049 - "ParseDisplayName failed: 0x%08x\n", hres); 4802 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5050 4803 if(SUCCEEDED(hres)){ 5051 4804 verify_pidl(pidl, adirW); 5052 4805 ILFree(pidl); 5053 4806 } 5054 4807 5055 4808 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL); 5056 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5057 - "ParseDisplayName failed: 0x%08x\n", hres); 4809 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5058 4810 if(SUCCEEDED(hres)){ 5059 4811 verify_pidl(pidl, afileW); 5060 4812 ILFree(pidl); 5061 4813 } 5062 4814 5063 4815 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL); 5064 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5065 - "ParseDisplayName failed: 0x%08x\n", hres); 4816 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5066 4817 if(SUCCEEDED(hres)){ 5067 4818 verify_pidl(pidl, afile2W); 5068 4819 ILFree(pidl); ··· 5072 4823 pidl = (ITEMIDLIST*)0xdeadbeef; 5073 4824 fsbdVtbl.GetFindData = fsbd_GetFindData_valid; 5074 4825 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL); 5075 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5076 - "ParseDisplayName failed: 0x%08x\n", hres); 4826 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5077 4827 if(SUCCEEDED(hres)){ 5078 4828 verify_pidl(pidl, adirW); 5079 4829 ILFree(pidl); 5080 4830 } 5081 4831 5082 4832 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL); 5083 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5084 - "ParseDisplayName failed: 0x%08x\n", hres); 4833 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5085 4834 if(SUCCEEDED(hres)){ 5086 4835 verify_pidl(pidl, afileW); 5087 4836 ILFree(pidl); 5088 4837 } 5089 4838 5090 4839 hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL); 5091 - ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */, 5092 - "ParseDisplayName failed: 0x%08x\n", hres); 4840 + ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres); 5093 4841 if(SUCCEEDED(hres)){ 5094 4842 verify_pidl(pidl, afile2W); 5095 4843 ILFree(pidl); ··· 5143 4891 path2 = make_wstr(exp_data->path_2); 5144 4892 verify_pidl(pidls[0], path1); 5145 4893 verify_pidl(pidls[1], path2); 5146 - HeapFree(GetProcessHeap(), 0, path1); 5147 - HeapFree(GetProcessHeap(), 0, path2); 4894 + heap_free(path1); 4895 + heap_free(path2); 5148 4896 5149 4897 exp_data->missing_events--; 5150 4898 ··· 5220 4968 5221 4969 entries[0].pidl = NULL; 5222 4970 if(has_unicode) 5223 - hr = pSHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0); 4971 + hr = SHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0); 5224 4972 else 5225 - hr = pSHILCreateFromPath((LPCVOID)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0); 4973 + hr = SHILCreateFromPath((const void *)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0); 5226 4974 ok(hr == S_OK, "SHILCreateFromPath failed: 0x%08x\n", hr); 5227 4975 entries[0].fRecursive = TRUE; 5228 4976 ··· 5251 4999 do_events(); 5252 5000 ok(exp_data->missing_events == 0, "%s: Expected wndproc to be called\n", exp_data->id); 5253 5001 5254 - HeapFree(GetProcessHeap(), 0, path1); 5255 - HeapFree(GetProcessHeap(), 0, path2); 5002 + heap_free(path1); 5003 + heap_free(path2); 5256 5004 } 5257 5005 } 5258 5006 ··· 5284 5032 return; 5285 5033 } 5286 5034 5287 - if(!pSHBindToParent) 5288 - { 5289 - skip("SHBindToParent missing.\n"); 5290 - return; 5291 - } 5292 - 5293 5035 GetCurrentDirectoryW(MAX_PATH, path); 5294 5036 if (!path[0]) 5295 5037 { ··· 5302 5044 CreateFilesFolders(); 5303 5045 5304 5046 hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, path, NULL, &pidl, 0); 5305 - ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr); 5047 + ok(hr == S_OK, "Got 0x%08x\n", hr); 5306 5048 if(SUCCEEDED(hr)) 5307 5049 { 5308 - 5309 - hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&folder, (LPCITEMIDLIST*)&pidl_child); 5050 + hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&folder, (const ITEMIDLIST **)&pidl_child); 5310 5051 ok(hr == S_OK, "Got 0x%08x\n", hr); 5311 5052 5312 5053 IShellFolder_QueryInterface(folder,&IID_IPersistFolder2,(void**)&persist); ··· 5314 5055 IPersistFolder2_Release(persist); 5315 5056 if(SUCCEEDED(hr)) 5316 5057 { 5317 - 5318 5058 cminfo.hwnd=NULL; 5319 5059 cminfo.pcmcb=NULL; 5320 5060 cminfo.psf=folder; ··· 5324 5064 cminfo.aKeys=NULL; 5325 5065 cminfo.cKeys=0; 5326 5066 cminfo.punkAssociationInfo=NULL; 5067 + 5327 5068 hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu); 5328 5069 ok(hr==S_OK,"Got 0x%08x\n", hr); 5070 + test_contextmenu_qi(cmenu, TRUE); 5329 5071 IContextMenu_Release(cmenu); 5072 + 5330 5073 cminfo.pidlFolder=pidlFolder; 5331 5074 hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu); 5332 5075 ok(hr==S_OK,"Got 0x%08x\n", hr); 5076 + test_contextmenu_qi(cmenu, TRUE); 5333 5077 IContextMenu_Release(cmenu); 5078 + 5334 5079 status = RegOpenKeyExA(HKEY_CLASSES_ROOT,"*",0,KEY_READ,keys); 5335 5080 if(status==ERROR_SUCCESS){ 5336 5081 for(i=1;i<16;i++) ··· 5379 5124 hres = IShellFolder_GetUIObjectOf(desktop, NULL, 1, (LPCITEMIDLIST*)&apidl, 5380 5125 &IID_IDataObject, NULL, (void**)&data_obj); 5381 5126 ok(hres == S_OK, "got %x\n", hres); 5382 - pILFree(apidl); 5127 + ILFree(apidl); 5383 5128 IShellFolder_Release(desktop); 5384 5129 5385 5130 cf_shellidlist = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW); ··· 5408 5153 IDataObject_Release(data_obj); 5409 5154 } 5410 5155 5156 + static void test_GetDefaultColumn(void) 5157 + { 5158 + static const CLSID *folders[] = 5159 + { 5160 + &CLSID_MyComputer, 5161 + &CLSID_MyDocuments, 5162 + &CLSID_ControlPanel, 5163 + &CLSID_NetworkPlaces, 5164 + &CLSID_Printers, 5165 + &CLSID_RecycleBin, 5166 + &CLSID_ShellDesktop, 5167 + }; 5168 + HRESULT hr; 5169 + int i; 5170 + 5171 + CoInitialize(NULL); 5172 + 5173 + for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++) 5174 + { 5175 + IShellFolder2 *folder; 5176 + ULONG sort, display; 5177 + 5178 + hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder); 5179 + if (hr != S_OK) 5180 + { 5181 + win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr); 5182 + continue; 5183 + } 5184 + 5185 + hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, NULL); 5186 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 5187 + 5188 + sort = display = 123; 5189 + hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, &display); 5190 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 5191 + ok(sort == 123 && display == 123, "Unexpected default column.\n"); 5192 + 5193 + display = 123; 5194 + hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, &display); 5195 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 5196 + ok(display == 123, "Unexpected default column.\n"); 5197 + 5198 + sort = 123; 5199 + hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, NULL); 5200 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 5201 + ok(sort == 123, "Unexpected default column.\n"); 5202 + } 5203 + 5204 + CoUninitialize(); 5205 + } 5206 + 5207 + static void test_GetDefaultSearchGUID(void) 5208 + { 5209 + static const CLSID *folders[] = 5210 + { 5211 + &CLSID_MyComputer, 5212 + &CLSID_MyDocuments, 5213 + &CLSID_ControlPanel, 5214 + &CLSID_NetworkPlaces, 5215 + &CLSID_Printers, 5216 + &CLSID_RecycleBin, 5217 + &CLSID_ShellDesktop, 5218 + }; 5219 + HRESULT hr; 5220 + int i; 5221 + 5222 + CoInitialize(NULL); 5223 + 5224 + for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++) 5225 + { 5226 + IShellFolder2 *folder; 5227 + GUID guid; 5228 + 5229 + hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder); 5230 + if (hr != S_OK) 5231 + { 5232 + win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr); 5233 + continue; 5234 + } 5235 + 5236 + if (0) 5237 + { 5238 + /* crashes on XP */ 5239 + hr = IShellFolder2_GetDefaultSearchGUID(folder, NULL); 5240 + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); 5241 + } 5242 + 5243 + memcpy(&guid, &CLSID_MyComputer, sizeof(guid)); 5244 + hr = IShellFolder2_GetDefaultSearchGUID(folder, &guid); 5245 + ok(hr == E_NOTIMPL || broken(hr == S_OK) /* Method was last supported on XP */, "Unexpected hr %#x.\n", hr); 5246 + if (hr == E_NOTIMPL) 5247 + ok(IsEqualGUID(&guid, &CLSID_MyComputer), "Unexpected guid %s.\n", wine_dbgstr_guid(&guid)); 5248 + 5249 + IShellFolder2_Release(folder); 5250 + } 5251 + 5252 + CoUninitialize(); 5253 + } 5254 + 5411 5255 START_TEST(shlfolder) 5412 5256 { 5413 5257 init_function_pointers(); 5414 5258 /* if OleInitialize doesn't get called, ParseDisplayName returns 5415 - CO_E_NOTINITIALIZED for malformed directory names on win2k. */ 5259 + CO_E_NOTINITIALIZED for malformed directory names */ 5416 5260 OleInitialize(NULL); 5417 5261 5418 5262 test_ParseDisplayName(); ··· 5447 5291 test_ShellItemArrayGetAttributes(); 5448 5292 test_SHCreateDefaultContextMenu(); 5449 5293 test_DataObject(); 5294 + test_GetDefaultColumn(); 5295 + test_GetDefaultSearchGUID(); 5450 5296 5451 5297 OleUninitialize(); 5452 5298 }
+64 -13
modules/rostests/winetests/shell32/shlview.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #include <stdarg.h> 22 + #include <stdio.h> 23 + 24 + #define COBJMACROS 25 + #define CONST_VTABLE 26 + 27 + #include "windef.h" 28 + #include "winbase.h" 29 + #include "wtypes.h" 30 + #include "shellapi.h" 31 + 32 + #include "shlguid.h" 33 + #include "shlobj.h" 34 + #include "shobjidl.h" 35 + #include "shlwapi.h" 36 + #include "ocidl.h" 37 + #include "oleauto.h" 38 + 39 + #include "initguid.h" 40 + 41 + #include "wine/heap.h" 42 + #include "wine/test.h" 22 43 23 44 #include "msg.h" 24 45 46 + #ifdef __REACTOS__ 47 + #include <reactos/undocshell.h> 48 + #endif 49 + 25 50 #define LISTVIEW_SEQ_INDEX 0 26 51 #define NUM_MSG_SEQUENCES 1 27 52 ··· 129 154 { 130 155 IDataObjectImpl *obj; 131 156 132 - obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj)); 157 + obj = heap_alloc(sizeof(*obj)); 133 158 obj->IDataObject_iface.lpVtbl = &IDataObjectImpl_Vtbl; 134 159 obj->ref = 1; 135 160 ··· 143 168 if (IsEqualIID(riid, &IID_IUnknown) || 144 169 IsEqualIID(riid, &IID_IDataObject)) 145 170 { 146 - *ppvObj = This; 171 + *ppvObj = &This->IDataObject_iface; 147 172 } 148 173 149 174 if(*ppvObj) ··· 167 192 ULONG ref = InterlockedDecrement(&This->ref); 168 193 169 194 if (!ref) 170 - { 171 - HeapFree(GetProcessHeap(), 0, This); 172 - return 0; 173 - } 195 + heap_free(This); 196 + 174 197 return ref; 175 198 } 176 199 ··· 256 279 { 257 280 IShellBrowserImpl *browser; 258 281 259 - browser = HeapAlloc(GetProcessHeap(), 0, sizeof(*browser)); 282 + browser = heap_alloc(sizeof(*browser)); 260 283 browser->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl; 261 284 browser->ref = 1; 262 285 ··· 275 298 IsEqualIID(riid, &IID_IOleWindow) || 276 299 IsEqualIID(riid, &IID_IShellBrowser)) 277 300 { 278 - *ppvObj = This; 301 + *ppvObj = &This->IShellBrowser_iface; 279 302 } 280 303 281 304 if(*ppvObj) ··· 299 322 ULONG ref = InterlockedDecrement(&This->ref); 300 323 301 324 if (!ref) 302 - { 303 - HeapFree(GetProcessHeap(), 0, This); 304 - return 0; 305 - } 325 + heap_free(This); 326 + 306 327 return ref; 307 328 } 308 329 ··· 1456 1477 IShellFolder_Release(desktop); 1457 1478 } 1458 1479 1480 + static void test_newmenu(void) 1481 + { 1482 + IUnknown *unk, *unk2; 1483 + HRESULT hr; 1484 + 1485 + hr = CoCreateInstance(&CLSID_NewMenu, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk); 1486 + todo_wine 1487 + ok(hr == S_OK, "Failed to create NewMenu object, hr %#x.\n", hr); 1488 + if (hr != S_OK) 1489 + { 1490 + skip("NewMenu is not supported.\n"); 1491 + return; 1492 + } 1493 + 1494 + hr = IUnknown_QueryInterface(unk, &IID_IShellExtInit, (void **)&unk2); 1495 + ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); 1496 + IUnknown_Release(unk2); 1497 + 1498 + hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2); 1499 + ok(hr == S_OK, "Failed to get IContextMenu3, hr %#x.\n", hr); 1500 + IUnknown_Release(unk2); 1501 + 1502 + hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&unk2); 1503 + ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#x.\n", hr); 1504 + IUnknown_Release(unk2); 1505 + 1506 + IUnknown_Release(unk); 1507 + } 1508 + 1459 1509 START_TEST(shlview) 1460 1510 { 1461 1511 OleInitialize(NULL); ··· 1471 1521 test_IOleCommandTarget(); 1472 1522 test_SHCreateShellFolderView(); 1473 1523 test_SHCreateShellFolderViewEx(); 1524 + test_newmenu(); 1474 1525 1475 1526 OleUninitialize(); 1476 1527 }
+12 -1
modules/rostests/winetests/shell32/string.c
··· 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 19 */ 20 20 21 - #include "precomp.h" 21 + #include <stdarg.h> 22 + #include <stdio.h> 23 + 24 + #define WINE_NOWINSOCK 25 + #include "windef.h" 26 + #include "winbase.h" 27 + #include "wtypes.h" 28 + #include "shellapi.h" 29 + #include "shtypes.h" 30 + #include "objbase.h" 31 + 32 + #include "wine/test.h" 22 33 23 34 static HMODULE hShell32; 24 35 static BOOL (WINAPI *pStrRetToStrNAW)(LPVOID,DWORD,LPSTRRET,const ITEMIDLIST *);
+10 -1
modules/rostests/winetests/shell32/systray.c
··· 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 18 */ 19 19 20 - #include "precomp.h" 20 + #ifndef __REACTOS__ 21 + #define _WIN32_IE 0x600 22 + #endif 23 + #include <stdarg.h> 24 + 25 + #include <windows.h> 26 + #include "shellapi.h" 27 + 28 + #include "wine/test.h" 29 + 21 30 22 31 static HWND hMainWnd; 23 32 static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);