tangled
alpha
login
or
join now
huwcampbell.com
/
reactos
0
fork
atom
Reactos
0
fork
atom
overview
issues
pulls
pipelines
[SHELL32_WINETEST] Sync with Wine Staging 3.3. CORE-14434
Amine Khaldi
8 years ago
0be033fe
cdd41ac6
+1858
-1480
22 changed files
expand all
collapse all
unified
split
modules
rostests
winetests
shell32
CMakeLists.txt
appbar.c
assoc.c
autocomplete.c
brsfolder.c
ebrowser.c
generated.c
msg.h
precomp.h
progman_dde.c
recyclebin.c
shelldispatch.c
shelllink.c
shellole.c
shellpath.c
shfldr_special.c
shlexec.c
shlfileop.c
shlfolder.c
shlview.c
string.c
systray.c
+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
35
-
add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 gdi32 advapi32 msvcrt kernel32)
35
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
20
-
#include "precomp.h"
20
20
+
#include <stdarg.h>
21
21
+
22
22
+
#include <windows.h>
23
23
+
#include "shellapi.h"
24
24
+
25
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
20
-
#include "precomp.h"
20
20
+
#define COBJMACROS
21
21
22
22
-
#include <shobjidl.h>
22
22
+
#include <stdarg.h>
23
23
+
24
24
+
#include "shlwapi.h"
25
25
+
#include "shlguid.h"
26
26
+
#include "shobjidl.h"
27
27
+
28
28
+
#include "wine/heap.h"
29
29
+
#include "wine/test.h"
30
30
+
23
31
24
32
static void test_IQueryAssociations_QueryInterface(void)
25
33
{
···
114
122
return;
115
123
}
116
124
117
117
-
buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
125
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
129
-
HeapFree(GetProcessHeap(), 0, buffer);
137
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
21
-
#include "precomp.h"
21
21
+
#define COBJMACROS
22
22
+
23
23
+
#include <stdarg.h>
24
24
+
25
25
+
#include "windows.h"
26
26
+
#include "shobjidl.h"
27
27
+
#include "shlguid.h"
28
28
+
#include "initguid.h"
29
29
+
#include "shldisp.h"
30
30
+
31
31
+
#include "wine/heap.h"
32
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
230
+
struct string_enumerator
231
231
+
{
232
232
+
IEnumString IEnumString_iface;
233
233
+
LONG ref;
234
234
+
WCHAR **data;
235
235
+
int data_len;
236
236
+
int cur;
237
237
+
};
238
238
+
239
239
+
static struct string_enumerator *impl_from_IEnumString(IEnumString *iface)
240
240
+
{
241
241
+
return CONTAINING_RECORD(iface, struct string_enumerator, IEnumString_iface);
242
242
+
}
243
243
+
244
244
+
static HRESULT WINAPI string_enumerator_QueryInterface(IEnumString *iface, REFIID riid, void **ppv)
245
245
+
{
246
246
+
if (IsEqualGUID(riid, &IID_IEnumString) || IsEqualGUID(riid, &IID_IUnknown))
247
247
+
{
248
248
+
IUnknown_AddRef(iface);
249
249
+
*ppv = iface;
250
250
+
return S_OK;
251
251
+
}
252
252
+
253
253
+
*ppv = NULL;
254
254
+
return E_NOINTERFACE;
255
255
+
}
256
256
+
257
257
+
static ULONG WINAPI string_enumerator_AddRef(IEnumString *iface)
258
258
+
{
259
259
+
struct string_enumerator *this = impl_from_IEnumString(iface);
260
260
+
261
261
+
ULONG ref = InterlockedIncrement(&this->ref);
262
262
+
263
263
+
return ref;
264
264
+
}
265
265
+
266
266
+
static ULONG WINAPI string_enumerator_Release(IEnumString *iface)
267
267
+
{
268
268
+
struct string_enumerator *this = impl_from_IEnumString(iface);
269
269
+
270
270
+
ULONG ref = InterlockedDecrement(&this->ref);
271
271
+
272
272
+
if (!ref)
273
273
+
heap_free(this);
274
274
+
275
275
+
return ref;
276
276
+
}
277
277
+
278
278
+
static HRESULT WINAPI string_enumerator_Next(IEnumString *iface, ULONG num, LPOLESTR *strings, ULONG *num_returned)
279
279
+
{
280
280
+
struct string_enumerator *this = impl_from_IEnumString(iface);
281
281
+
int i, len;
282
282
+
283
283
+
*num_returned = 0;
284
284
+
for (i = 0; i < num; i++)
285
285
+
{
286
286
+
if (this->cur >= this->data_len)
287
287
+
return S_FALSE;
288
288
+
289
289
+
len = lstrlenW(this->data[this->cur]) + 1;
290
290
+
291
291
+
strings[i] = CoTaskMemAlloc(len * sizeof(WCHAR));
292
292
+
memcpy(strings[i], this->data[this->cur], len * sizeof(WCHAR));
293
293
+
294
294
+
(*num_returned)++;
295
295
+
this->cur++;
296
296
+
}
297
297
+
298
298
+
return S_OK;
299
299
+
}
300
300
+
301
301
+
static HRESULT WINAPI string_enumerator_Reset(IEnumString *iface)
302
302
+
{
303
303
+
struct string_enumerator *this = impl_from_IEnumString(iface);
304
304
+
305
305
+
this->cur = 0;
306
306
+
307
307
+
return S_OK;
308
308
+
}
309
309
+
310
310
+
static HRESULT WINAPI string_enumerator_Skip(IEnumString *iface, ULONG num)
311
311
+
{
312
312
+
struct string_enumerator *this = impl_from_IEnumString(iface);
313
313
+
314
314
+
this->cur += num;
315
315
+
316
316
+
return S_OK;
317
317
+
}
318
318
+
319
319
+
static HRESULT WINAPI string_enumerator_Clone(IEnumString *iface, IEnumString **out)
320
320
+
{
321
321
+
*out = NULL;
322
322
+
return E_NOTIMPL;
323
323
+
}
324
324
+
325
325
+
static IEnumStringVtbl string_enumerator_vtlb =
326
326
+
{
327
327
+
string_enumerator_QueryInterface,
328
328
+
string_enumerator_AddRef,
329
329
+
string_enumerator_Release,
330
330
+
string_enumerator_Next,
331
331
+
string_enumerator_Skip,
332
332
+
string_enumerator_Reset,
333
333
+
string_enumerator_Clone
334
334
+
};
335
335
+
336
336
+
static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int count)
337
337
+
{
338
338
+
struct string_enumerator *object;
339
339
+
340
340
+
object = heap_alloc_zero(sizeof(*object));
341
341
+
object->IEnumString_iface.lpVtbl = &string_enumerator_vtlb;
342
342
+
object->ref = 1;
343
343
+
object->data = suggestions;
344
344
+
object->data_len = count;
345
345
+
object->cur = 0;
346
346
+
347
347
+
*ppv = &object->IEnumString_iface;
348
348
+
349
349
+
return S_OK;
350
350
+
}
351
351
+
352
352
+
static void test_custom_source(void)
353
353
+
{
354
354
+
static WCHAR str_alpha[] = {'t','e','s','t','1',0};
355
355
+
static WCHAR str_alpha2[] = {'t','e','s','t','2',0};
356
356
+
static WCHAR str_beta[] = {'a','u','t','o',' ','c','o','m','p','l','e','t','e',0};
357
357
+
static WCHAR *suggestions[] = { str_alpha, str_alpha2, str_beta };
358
358
+
IUnknown *enumerator;
359
359
+
IAutoComplete2 *autocomplete;
360
360
+
HWND hwnd_edit;
361
361
+
WCHAR buffer[20];
362
362
+
HRESULT hr;
363
363
+
MSG msg;
364
364
+
365
365
+
ShowWindow(hMainWnd, SW_SHOW);
366
366
+
367
367
+
hwnd_edit = CreateWindowA("Edit", "", WS_OVERLAPPED | WS_VISIBLE | WS_CHILD | WS_BORDER, 50, 5, 200, 20, hMainWnd, 0, NULL, 0);
368
368
+
369
369
+
hr = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (void**)&autocomplete);
370
370
+
ok(hr == S_OK, "CoCreateInstance failed: %x\n", hr);
371
371
+
372
372
+
string_enumerator_create((void**)&enumerator, suggestions, sizeof(suggestions) / sizeof(*suggestions));
373
373
+
374
374
+
hr = IAutoComplete2_SetOptions(autocomplete, ACO_AUTOSUGGEST | ACO_AUTOAPPEND);
375
375
+
ok(hr == S_OK, "IAutoComplete2_SetOptions failed: %x\n", hr);
376
376
+
hr = IAutoComplete2_Init(autocomplete, hwnd_edit, enumerator, NULL, NULL);
377
377
+
ok(hr == S_OK, "IAutoComplete_Init failed: %x\n", hr);
378
378
+
379
379
+
SendMessageW(hwnd_edit, WM_CHAR, 'a', 1);
380
380
+
/* Send a keyup message since wine doesn't handle WM_CHAR yet */
381
381
+
SendMessageW(hwnd_edit, WM_KEYUP, 'u', 1);
382
382
+
Sleep(100);
383
383
+
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
384
384
+
{
385
385
+
TranslateMessage(&msg);
386
386
+
DispatchMessageA(&msg);
387
387
+
}
388
388
+
SendMessageW(hwnd_edit, WM_GETTEXT, sizeof(buffer) / sizeof(*buffer), (LPARAM)buffer);
389
389
+
ok(lstrcmpW(str_beta, buffer) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str_beta), wine_dbgstr_w(buffer));
390
390
+
391
391
+
ShowWindow(hMainWnd, SW_HIDE);
392
392
+
DestroyWindow(hwnd_edit);
393
393
+
}
394
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
415
+
416
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
22
-
#include "precomp.h"
22
22
+
#define COBJMACROS
23
23
+
24
24
+
#include <windows.h>
25
25
+
#include <shlobj.h>
26
26
+
#include <shobjidl.h>
27
27
+
#include <string.h>
28
28
+
#include "shellapi.h"
23
29
30
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
21
-
#include "precomp.h"
21
21
+
#include <stdio.h>
22
22
+
23
23
+
#define COBJMACROS
24
24
+
#define CONST_VTABLE
22
25
23
23
-
#include <initguid.h>
24
24
-
#include <mshtml.h>
26
26
+
#include "shlobj.h"
27
27
+
#include "shlwapi.h"
28
28
+
29
29
+
#include "wine/heap.h"
30
30
+
#include "wine/test.h"
31
31
+
32
32
+
#include "initguid.h"
33
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
234
-
HeapFree(GetProcessHeap(), 0, This);
243
243
+
heap_free(This);
235
244
236
245
return ref;
237
246
}
···
277
286
{
278
287
IExplorerPaneVisibilityImpl *epv;
279
288
280
280
-
epv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IExplorerPaneVisibilityImpl));
289
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
323
-
HeapFree(GetProcessHeap(), 0, This);
332
332
+
heap_free(This);
324
333
325
334
return ref;
326
335
}
···
431
440
{
432
441
ICommDlgBrowser3Impl *cdb;
433
442
434
434
-
cdb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICommDlgBrowser3Impl));
443
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
492
-
HeapFree(GetProcessHeap(), 0, This);
501
501
+
heap_free(This);
493
502
494
503
return ref;
495
504
}
···
540
549
541
550
static IServiceProviderImpl *create_serviceprovider(void)
542
551
{
543
543
-
IServiceProviderImpl *sp = HeapAlloc(GetProcessHeap(), 0, sizeof(IServiceProviderImpl));
552
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
8
-
#include "precomp.h"
8
8
+
#ifndef __REACTOS__
9
9
+
#define WINVER 0x0501
10
10
+
#define _WIN32_IE 0x0501
11
11
+
#define _WIN32_WINNT 0x0501
12
12
+
#endif
13
13
+
14
14
+
#define WINE_NOWINSOCK
15
15
+
16
16
+
#include <stdarg.h>
17
17
+
#include "windef.h"
18
18
+
#include "winbase.h"
19
19
+
#include "wtypes.h"
20
20
+
#include "shellapi.h"
21
21
+
#include "winuser.h"
22
22
+
#include "wingdi.h"
23
23
+
#include "shlobj.h"
24
24
+
25
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
23
+
#include <assert.h>
24
24
+
#include <windows.h>
25
25
+
26
26
+
#include "wine/heap.h"
27
27
+
#include "wine/test.h"
28
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
67
-
msg_seq->sequence = HeapAlloc(GetProcessHeap(), 0,
68
68
-
msg_seq->size * sizeof (struct message));
73
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
74
-
msg_seq->sequence = HeapReAlloc(GetProcessHeap(), 0,
75
75
-
msg_seq->sequence,
76
76
-
msg_seq->size * sizeof (struct message));
79
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
93
-
HeapFree(GetProcessHeap(), 0, msg_seq->sequence);
96
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
291
-
seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct msg_sequence));
294
294
+
seq[i] = heap_alloc_zero(sizeof(struct msg_sequence));
292
295
}
+4
-7
modules/rostests/winetests/shell32/precomp.h
···
1
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
8
-
#define _INC_WINDOWS
9
9
-
#define COM_NO_WINDOWS_H
10
9
11
10
#define COBJMACROS
12
11
#define CONST_VTABLE
13
12
13
13
+
#include <windows.h>
14
14
+
15
15
+
#include <wine/heap.h>
14
16
#include <wine/test.h>
15
17
16
16
-
#include <winreg.h>
17
17
-
#include <winnls.h>
18
18
-
#include <winuser.h>
19
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
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
29
-
#include "precomp.h"
30
30
-
31
31
-
/* Timeout on DdeClientTransaction Call */
32
32
-
#define MS_TIMEOUT_VAL 1000
33
33
-
/* # of times to poll for window creation */
34
34
-
#define PDDE_POLL_NUM 150
35
35
-
/* time to sleep between polls */
36
36
-
#define PDDE_POLL_TIME 300
37
37
-
38
38
-
/* Call Info */
39
39
-
#define DDE_TEST_MISC 0x00010000
40
40
-
#define DDE_TEST_CREATEGROUP 0x00020000
41
41
-
#define DDE_TEST_DELETEGROUP 0x00030000
42
42
-
#define DDE_TEST_SHOWGROUP 0x00040000
43
43
-
#define DDE_TEST_ADDITEM 0x00050000
44
44
-
#define DDE_TEST_DELETEITEM 0x00060000
45
45
-
#define DDE_TEST_COMPOUND 0x00070000
46
46
-
#define DDE_TEST_CALLMASK 0x00ff0000
47
47
-
48
48
-
#define DDE_TEST_NUMMASK 0x0000ffff
29
29
+
#include <stdio.h>
30
30
+
#include <wine/test.h>
31
31
+
#include <winbase.h>
32
32
+
#include "dde.h"
33
33
+
#include "ddeml.h"
34
34
+
#include "winuser.h"
35
35
+
#include "shlobj.h"
49
36
50
37
static HRESULT (WINAPI *pSHGetLocalizedName)(LPCWSTR, LPWSTR, UINT, int *);
51
51
-
static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
52
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
60
-
pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA");
61
61
-
pReadCabinetState = (void*)GetProcAddress(hmod, "ReadCabinetState");
62
62
-
if (!pReadCabinetState)
63
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
104
-
if (pReadCabinetState)
105
105
-
{
106
106
-
pReadCabinetState(&cs, sizeof(cs));
107
107
-
}
108
108
-
else
109
109
-
{
110
110
-
HKEY key;
111
111
-
DWORD size;
112
112
-
113
113
-
win_skip("ReadCabinetState is not available, reading registry directly\n");
114
114
-
RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &key);
115
115
-
size = sizeof(cs);
116
116
-
RegQueryValueExA(key, "Settings", NULL, NULL, (LPBYTE)&cs, &size);
117
117
-
RegCloseKey(key);
118
118
-
}
85
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
125
-
static char Group1Title[MAX_PATH] = "Group1";
126
126
-
static char Group2Title[MAX_PATH] = "Group2";
127
127
-
static char Group3Title[MAX_PATH] = "Group3";
128
128
-
static char StartupTitle[MAX_PATH] = "Startup";
129
129
-
130
92
static void init_strings(void)
131
93
{
132
132
-
char startup[MAX_PATH];
133
94
char commonprograms[MAX_PATH];
134
95
char programs[MAX_PATH];
135
96
136
136
-
if (pSHGetSpecialFolderPathA)
137
137
-
{
138
138
-
pSHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE);
139
139
-
pSHGetSpecialFolderPathA(NULL, commonprograms, CSIDL_COMMON_PROGRAMS, FALSE);
140
140
-
pSHGetSpecialFolderPathA(NULL, startup, CSIDL_STARTUP, FALSE);
141
141
-
}
142
142
-
else
143
143
-
{
144
144
-
HKEY key;
145
145
-
DWORD size;
146
146
-
147
147
-
/* Older Win9x and NT4 */
148
148
-
149
149
-
RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
150
150
-
size = sizeof(programs);
151
151
-
RegQueryValueExA(key, "Programs", NULL, NULL, (LPBYTE)&programs, &size);
152
152
-
size = sizeof(startup);
153
153
-
RegQueryValueExA(key, "Startup", NULL, NULL, (LPBYTE)&startup, &size);
154
154
-
RegCloseKey(key);
155
155
-
156
156
-
RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
157
157
-
size = sizeof(commonprograms);
158
158
-
RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&commonprograms, &size);
159
159
-
RegCloseKey(key);
160
160
-
}
97
97
+
SHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE);
98
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
170
-
171
171
-
if (full_title())
172
172
-
{
173
173
-
lstrcpyA(Group1Title, ProgramsDir);
174
174
-
lstrcatA(Group1Title, "\\Group1");
175
175
-
lstrcpyA(Group2Title, ProgramsDir);
176
176
-
lstrcatA(Group2Title, "\\Group2");
177
177
-
lstrcpyA(Group3Title, ProgramsDir);
178
178
-
lstrcatA(Group3Title, "\\Group3");
179
179
-
180
180
-
lstrcpyA(StartupTitle, startup);
181
181
-
}
182
182
-
else
183
183
-
{
184
184
-
/* Vista has the nice habit of displaying the full path in English
185
185
-
* and the short one localized. CSIDL_STARTUP on Vista gives us the
186
186
-
* English version so we have to 'translate' this one.
187
187
-
*
188
188
-
* MSDN claims it should be used for files not folders but this one
189
189
-
* suits our purposes just fine.
190
190
-
*/
191
191
-
if (pSHGetLocalizedName)
192
192
-
{
193
193
-
WCHAR startupW[MAX_PATH];
194
194
-
WCHAR module[MAX_PATH];
195
195
-
WCHAR module_expanded[MAX_PATH];
196
196
-
WCHAR localized[MAX_PATH];
197
197
-
HRESULT hr;
198
198
-
int id;
199
199
-
200
200
-
MultiByteToWideChar(CP_ACP, 0, startup, -1, startupW, sizeof(startupW)/sizeof(WCHAR));
201
201
-
hr = pSHGetLocalizedName(startupW, module, MAX_PATH, &id);
202
202
-
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
203
203
-
/* check to be removed when SHGetLocalizedName is implemented */
204
204
-
if (hr == S_OK)
205
205
-
{
206
206
-
ExpandEnvironmentStringsW(module, module_expanded, MAX_PATH);
207
207
-
LoadStringW(GetModuleHandleW(module_expanded), id, localized, MAX_PATH);
208
208
-
209
209
-
WideCharToMultiByte(CP_ACP, 0, localized, -1, StartupTitle, sizeof(StartupTitle), NULL, NULL);
210
210
-
}
211
211
-
else
212
212
-
lstrcpyA(StartupTitle, (strrchr(startup, '\\') + 1));
213
213
-
}
214
214
-
else
215
215
-
{
216
216
-
lstrcpyA(StartupTitle, (strrchr(startup, '\\') + 1));
217
217
-
}
218
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
228
-
/*
229
229
-
* Encoded String for Error Messages so that inner failures can determine
230
230
-
* what test is failing. Format is: [Code:TestNum]
231
231
-
*/
232
232
-
static const char * GetStringFromTestParams(int testParams)
117
117
+
static UINT dde_execute(DWORD instance, HCONV hconv, const char *command_str)
233
118
{
234
234
-
int testNum;
235
235
-
static char testParamString[64];
236
236
-
const char *callId;
119
119
+
HDDEDATA command, hdata;
120
120
+
DWORD result;
121
121
+
UINT ret;
237
122
238
238
-
testNum = testParams & DDE_TEST_NUMMASK;
239
239
-
switch (testParams & DDE_TEST_CALLMASK)
240
240
-
{
241
241
-
default:
242
242
-
case DDE_TEST_MISC:
243
243
-
callId = "MISC";
244
244
-
break;
245
245
-
case DDE_TEST_CREATEGROUP:
246
246
-
callId = "C_G";
247
247
-
break;
248
248
-
case DDE_TEST_DELETEGROUP:
249
249
-
callId = "D_G";
250
250
-
break;
251
251
-
case DDE_TEST_SHOWGROUP:
252
252
-
callId = "S_G";
253
253
-
break;
254
254
-
case DDE_TEST_ADDITEM:
255
255
-
callId = "A_I";
256
256
-
break;
257
257
-
case DDE_TEST_DELETEITEM:
258
258
-
callId = "D_I";
259
259
-
break;
260
260
-
case DDE_TEST_COMPOUND:
261
261
-
callId = "CPD";
262
262
-
break;
263
263
-
}
123
123
+
command = DdeCreateDataHandle(instance, (BYTE *)command_str, strlen(command_str)+1, 0, 0, 0, 0);
124
124
+
ok(command != NULL, "DdeCreateDataHandle() failed: %u\n", DdeGetLastError(instance));
264
125
265
265
-
sprintf(testParamString, " [%s:%i]", callId, testNum);
266
266
-
return testParamString;
267
267
-
}
126
126
+
hdata = DdeClientTransaction((BYTE *)command, -1, hconv, 0, 0, XTYP_EXECUTE, 2000, &result);
127
127
+
ret = DdeGetLastError(instance);
128
128
+
/* PROGMAN always returns 1 on success */
129
129
+
ok((UINT_PTR)hdata == !ret, "expected %u, got %p\n", !ret, hdata);
268
130
269
269
-
/* Transfer DMLERR's into text readable strings for Error Messages */
270
270
-
#define DMLERR_TO_STR(x) case x: return#x;
271
271
-
static const char * GetStringFromError(UINT err)
272
272
-
{
273
273
-
switch (err)
274
274
-
{
275
275
-
DMLERR_TO_STR(DMLERR_NO_ERROR);
276
276
-
DMLERR_TO_STR(DMLERR_ADVACKTIMEOUT);
277
277
-
DMLERR_TO_STR(DMLERR_BUSY);
278
278
-
DMLERR_TO_STR(DMLERR_DATAACKTIMEOUT);
279
279
-
DMLERR_TO_STR(DMLERR_DLL_NOT_INITIALIZED);
280
280
-
DMLERR_TO_STR(DMLERR_DLL_USAGE);
281
281
-
DMLERR_TO_STR(DMLERR_EXECACKTIMEOUT);
282
282
-
DMLERR_TO_STR(DMLERR_INVALIDPARAMETER);
283
283
-
DMLERR_TO_STR(DMLERR_LOW_MEMORY);
284
284
-
DMLERR_TO_STR(DMLERR_MEMORY_ERROR);
285
285
-
DMLERR_TO_STR(DMLERR_NOTPROCESSED);
286
286
-
DMLERR_TO_STR(DMLERR_NO_CONV_ESTABLISHED);
287
287
-
DMLERR_TO_STR(DMLERR_POKEACKTIMEOUT);
288
288
-
DMLERR_TO_STR(DMLERR_POSTMSG_FAILED);
289
289
-
DMLERR_TO_STR(DMLERR_REENTRANCY);
290
290
-
DMLERR_TO_STR(DMLERR_SERVER_DIED);
291
291
-
DMLERR_TO_STR(DMLERR_SYS_ERROR);
292
292
-
DMLERR_TO_STR(DMLERR_UNADVACKTIMEOUT);
293
293
-
DMLERR_TO_STR(DMLERR_UNFOUND_QUEUE_ID);
294
294
-
default:
295
295
-
return "Unknown DML Error";
296
296
-
}
131
131
+
return ret;
297
132
}
298
133
299
299
-
/* Helper Function to Transfer DdeGetLastError into a String */
300
300
-
static const char * GetDdeLastErrorStr(DWORD instance)
134
134
+
static char *dde_request(DWORD instance, HCONV hconv, const char *request_str)
301
135
{
302
302
-
UINT err = DdeGetLastError(instance);
136
136
+
static char data[2000];
137
137
+
HDDEDATA hdata;
138
138
+
HSZ item;
139
139
+
DWORD result;
303
140
304
304
-
return GetStringFromError(err);
305
305
-
}
141
141
+
item = DdeCreateStringHandleA(instance, request_str, CP_WINANSI);
142
142
+
ok(item != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
306
143
307
307
-
/* Execute a Dde Command and return the error & result */
308
308
-
/* Note: Progman DDE always returns a pointer to 0x00000001 on a successful result */
309
309
-
static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, HDDEDATA *hData, UINT *err, int testParams)
310
310
-
{
311
311
-
HDDEDATA command;
144
144
+
hdata = DdeClientTransaction(NULL, -1, hconv, item, CF_TEXT, XTYP_REQUEST, 2000, &result);
145
145
+
if (hdata == NULL) return NULL;
312
146
313
313
-
command = DdeCreateDataHandle(instance, (LPBYTE) strCmd, strlen(strCmd)+1, 0, 0L, 0, 0);
314
314
-
ok (command != NULL, "DdeCreateDataHandle Error %s.%s\n",
315
315
-
GetDdeLastErrorStr(instance), GetStringFromTestParams(testParams));
316
316
-
*hData = DdeClientTransaction((void *) command,
317
317
-
-1,
318
318
-
hConv,
319
319
-
0,
320
320
-
0,
321
321
-
XTYP_EXECUTE,
322
322
-
MS_TIMEOUT_VAL,
323
323
-
NULL);
147
147
+
DdeGetData(hdata, (BYTE *)data, 2000, 0);
324
148
325
325
-
/* hData is technically a pointer, but for Program Manager,
326
326
-
* it is NULL (error) or 1 (success)
327
327
-
* TODO: Check other versions of Windows to verify 1 is returned.
328
328
-
* While it is unlikely that anyone is actually testing that the result is 1
329
329
-
* if all versions of windows return 1, Wine should also.
330
330
-
*/
331
331
-
if (*hData == NULL)
332
332
-
{
333
333
-
*err = DdeGetLastError(instance);
334
334
-
}
335
335
-
else
336
336
-
{
337
337
-
*err = DMLERR_NO_ERROR;
338
338
-
todo_wine
339
339
-
{
340
340
-
ok(*hData == (HDDEDATA) 1, "Expected HDDEDATA Handle == 1, actually %p.%s\n",
341
341
-
*hData, GetStringFromTestParams(testParams));
342
342
-
}
343
343
-
}
344
344
-
DdeFreeDataHandle(command);
149
149
+
return data;
345
150
}
346
151
347
347
-
/*
348
348
-
* Check if Window is onscreen with the appropriate name.
349
349
-
*
350
350
-
* Windows are not created synchronously. So we do not know
351
351
-
* when and if the window will be created/shown on screen.
352
352
-
* This function implements a polling mechanism to determine
353
353
-
* creation.
354
354
-
* A more complicated method would be to use SetWindowsHookEx.
355
355
-
* Since polling worked fine in my testing, no reason to implement
356
356
-
* the other. Comments about other methods of determining when
357
357
-
* window creation happened were not encouraging (not including
358
358
-
* SetWindowsHookEx).
359
359
-
*/
360
360
-
static HWND CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams)
152
152
+
static BOOL check_window_exists(const char *name)
361
153
{
154
154
+
char title[MAX_PATH];
362
155
HWND window = NULL;
363
156
int i;
364
157
365
365
-
/* Poll for Window Creation */
366
366
-
for (i = 0; window == NULL && i < PDDE_POLL_NUM; i++)
158
158
+
if (full_title())
367
159
{
368
368
-
Sleep(PDDE_POLL_TIME);
369
369
-
/* Specify the window class name to make sure what we find is really an
370
370
-
* Explorer window. Explorer used two different window classes so try
371
371
-
* both.
372
372
-
*/
373
373
-
window = FindWindowA("ExplorerWClass", winName);
374
374
-
if (!window)
375
375
-
window = FindWindowA("CabinetWClass", winName);
160
160
+
strcpy(title, ProgramsDir);
161
161
+
strcat(title, "\\");
162
162
+
strcat(title, name);
376
163
}
377
377
-
ok (window != NULL, "Window \"%s\" was not created in %i seconds - assumed failure.%s\n",
378
378
-
winName, PDDE_POLL_NUM*PDDE_POLL_TIME/1000, GetStringFromTestParams(testParams));
164
164
+
else
165
165
+
strcpy(title, name);
379
166
380
380
-
/* Close Window as desired. */
381
381
-
if (window != NULL && closeWindow)
167
167
+
for (i = 0; i < 20; i++)
382
168
{
383
383
-
SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
384
384
-
window = NULL;
169
169
+
Sleep(100);
170
170
+
if ((window = FindWindowA("ExplorerWClass", title)) ||
171
171
+
(window = FindWindowA("CabinetWClass", title)))
172
172
+
{
173
173
+
SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
174
174
+
break;
175
175
+
}
385
176
}
386
386
-
return window;
177
177
+
178
178
+
return (window != NULL);
387
179
}
388
180
389
389
-
/* Check for Existence (or non-existence) of a file or group
390
390
-
* When testing for existence of a group, groupName is not needed
391
391
-
*/
392
392
-
static void CheckFileExistsInProgramGroups(const char *nameToCheck, BOOL shouldExist, BOOL isGroup,
393
393
-
const char *groupName, int testParams)
181
181
+
static BOOL check_exists(const char *name)
394
182
{
395
183
char path[MAX_PATH];
396
396
-
DWORD attributes;
397
397
-
int len;
398
184
399
399
-
lstrcpyA(path, ProgramsDir);
400
400
-
401
401
-
len = strlen(path) + strlen(nameToCheck)+1;
402
402
-
if (groupName != NULL)
403
403
-
{
404
404
-
len += strlen(groupName)+1;
405
405
-
}
406
406
-
ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams));
407
407
-
if (len <= MAX_PATH)
408
408
-
{
409
409
-
if (groupName != NULL)
410
410
-
{
411
411
-
strcat(path, "\\");
412
412
-
strcat(path, groupName);
413
413
-
}
414
414
-
strcat(path, "\\");
415
415
-
strcat(path, nameToCheck);
416
416
-
attributes = GetFileAttributesA(path);
417
417
-
if (!shouldExist)
418
418
-
{
419
419
-
ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
420
420
-
path, GetStringFromTestParams(testParams));
421
421
-
} else {
422
422
-
if (attributes == INVALID_FILE_ATTRIBUTES)
423
423
-
{
424
424
-
ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams));
425
425
-
} else if (isGroup) {
426
426
-
ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n",
427
427
-
path, attributes, GetStringFromTestParams(testParams));
428
428
-
} else {
429
429
-
ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n",
430
430
-
path, attributes, GetStringFromTestParams(testParams));
431
431
-
}
432
432
-
}
433
433
-
}
185
185
+
strcpy(path, ProgramsDir);
186
186
+
strcat(path, "\\");
187
187
+
strcat(path, name);
188
188
+
return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
434
189
}
435
190
436
436
-
/* Create Group Test.
437
437
-
* command and expected_result.
438
438
-
* if expected_result is DMLERR_NO_ERROR, test
439
439
-
* 1. group was created
440
440
-
* 2. window is open
441
441
-
*/
442
442
-
static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
443
443
-
const char *groupName, const char *windowTitle, int testParams)
191
191
+
static void test_parser(DWORD instance, HCONV hConv)
444
192
{
445
445
-
HDDEDATA hData;
446
193
UINT error;
447
194
448
448
-
/* Execute Command & Check Result */
449
449
-
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
450
450
-
todo_wine
451
451
-
{
452
452
-
ok (expected_result == error, "CreateGroup %s: Expected Error %s, received %s.%s\n",
453
453
-
groupName, GetStringFromError(expected_result), GetStringFromError(error),
454
454
-
GetStringFromTestParams(testParams));
455
455
-
}
195
195
+
/* Invalid Command */
196
196
+
error = dde_execute(instance, hConv, "[InvalidCommand()]");
197
197
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
198
198
+
199
199
+
/* test parsing */
200
200
+
error = dde_execute(instance, hConv, "");
201
201
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
202
202
+
203
203
+
error = dde_execute(instance, hConv, "CreateGroup");
204
204
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
205
205
+
206
206
+
error = dde_execute(instance, hConv, "[CreateGroup");
207
207
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
208
208
+
209
209
+
error = dde_execute(instance, hConv, "[CreateGroup]");
210
210
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
211
211
+
212
212
+
error = dde_execute(instance, hConv, "[CreateGroup()]");
213
213
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
214
214
+
215
215
+
error = dde_execute(instance, hConv, "[cREATEgROUP(test)]");
216
216
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
217
217
+
ok(check_exists("test"), "directory not created\n");
218
218
+
ok(check_window_exists("test"), "window not created\n");
219
219
+
220
220
+
error = dde_execute(instance, hConv, "[AddItem(notepad,foobar)]");
221
221
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
222
222
+
ok(check_exists("test/foobar.lnk"), "link not created\n");
223
223
+
224
224
+
error = dde_execute(instance, hConv, "[AddItem(notepad,foo bar)]");
225
225
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
226
226
+
ok(check_exists("test/foo bar.lnk"), "link not created\n");
227
227
+
228
228
+
error = dde_execute(instance, hConv, "[AddItem(notepad,a[b,c]d)]");
229
229
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
456
230
457
457
-
/* No Error */
458
458
-
if (error == DMLERR_NO_ERROR)
459
459
-
{
231
231
+
error = dde_execute(instance, hConv, "[AddItem(notepad,\"a[b,c]d\")]");
232
232
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
233
233
+
ok(check_exists("test/a[b,c]d.lnk"), "link not created\n");
460
234
461
461
-
/* Check if Group Now Exists */
462
462
-
CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
463
463
-
/* Check if Window is Open (polling) */
464
464
-
CheckWindowCreated(windowTitle, TRUE, testParams);
465
465
-
}
466
466
-
}
235
235
+
error = dde_execute(instance, hConv, " [ AddItem ( notepad , test ) ] ");
236
236
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
237
237
+
ok(check_exists("test/test.lnk"), "link not created\n");
467
238
468
468
-
/* Show Group Test.
469
469
-
* DDE command, expected_result, and the group name to check for existence
470
470
-
* if expected_result is DMLERR_NO_ERROR, test
471
471
-
* 1. window is open
472
472
-
*/
473
473
-
static HWND ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
474
474
-
const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams)
475
475
-
{
476
476
-
HDDEDATA hData;
477
477
-
UINT error;
478
478
-
HWND hwnd = 0;
239
239
+
error = dde_execute(instance, hConv, "[AddItem(notepad,one)][AddItem(notepad,two)]");
240
240
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
241
241
+
ok(check_exists("test/one.lnk"), "link not created\n");
242
242
+
ok(check_exists("test/two.lnk"), "link not created\n");
479
243
480
480
-
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
481
481
-
/* todo_wine... Is expected to fail, wine stubbed functions DO fail */
482
482
-
/* TODO REMOVE THIS CODE!!! */
483
483
-
todo_wine_if (expected_result != DMLERR_NOTPROCESSED)
484
484
-
ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n",
485
485
-
groupName, GetStringFromError(expected_result), GetStringFromError(error),
486
486
-
GetStringFromTestParams(testParams));
244
244
+
error = dde_execute(instance, hConv, "[FakeCommand(test)][DeleteGroup(test)]");
245
245
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
246
246
+
ok(check_exists("test"), "directory should exist\n");
487
247
488
488
-
if (error == DMLERR_NO_ERROR)
489
489
-
{
490
490
-
/* Check if Window is Open (polling) */
491
491
-
hwnd = CheckWindowCreated(windowTitle, closeAfterShowing, testParams);
492
492
-
}
493
493
-
return hwnd;
248
248
+
error = dde_execute(instance, hConv, "[DeleteGroup(test)]");
249
249
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
250
250
+
ok(!check_exists("test"), "directory should not exist\n");
251
251
+
252
252
+
error = dde_execute(instance, hConv, "[ExitProgman()]");
253
253
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
254
254
+
255
255
+
error = dde_execute(instance, hConv, "[ExitProgman]");
256
256
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
494
257
}
495
258
496
496
-
/* Delete Group Test.
497
497
-
* DDE command, expected_result, and the group name to check for existence
498
498
-
* if expected_result is DMLERR_NO_ERROR, test
499
499
-
* 1. group does not exist
500
500
-
*/
501
501
-
static void DeleteGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
502
502
-
const char *groupName, int testParams)
259
259
+
/* 1st set of tests */
260
260
+
static void test_progman_dde(DWORD instance, HCONV hConv)
503
261
{
504
504
-
HDDEDATA hData;
505
262
UINT error;
506
263
507
507
-
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
508
508
-
todo_wine
509
509
-
{
510
510
-
ok (expected_result == error, "DeleteGroup %s: Expected Error %s, received %s.%s\n",
511
511
-
groupName, GetStringFromError(expected_result), GetStringFromError(error),
512
512
-
GetStringFromTestParams(testParams));
513
513
-
}
264
264
+
/* test creating and deleting groups and items */
265
265
+
error = dde_execute(instance, hConv, "[CreateGroup(Group1)]");
266
266
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
267
267
+
ok(check_exists("Group1"), "directory not created\n");
268
268
+
ok(check_window_exists("Group1"), "window not created\n");
514
269
515
515
-
if (error == DMLERR_NO_ERROR)
516
516
-
{
517
517
-
/* Check that Group does not exist */
518
518
-
CheckFileExistsInProgramGroups(groupName, FALSE, TRUE, NULL, testParams);
519
519
-
}
520
520
-
}
270
270
+
error = dde_execute(instance, hConv, "[AddItem]");
271
271
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
521
272
522
522
-
/* Add Item Test
523
523
-
* DDE command, expected result, and group and file name where it should exist.
524
524
-
* checks to make sure error code matches expected error code
525
525
-
* checks to make sure item exists if successful
526
526
-
*/
527
527
-
static void AddItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
528
528
-
const char *fileName, const char *groupName, int testParams)
529
529
-
{
530
530
-
HDDEDATA hData;
531
531
-
UINT error;
273
273
+
error = dde_execute(instance, hConv, "[AddItem(test)]");
274
274
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
532
275
533
533
-
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
534
534
-
todo_wine
535
535
-
{
536
536
-
ok (expected_result == error, "AddItem %s: Expected Error %s, received %s.%s\n",
537
537
-
fileName, GetStringFromError(expected_result), GetStringFromError(error),
538
538
-
GetStringFromTestParams(testParams));
539
539
-
}
276
276
+
error = dde_execute(instance, hConv, "[AddItem(notepad.exe)]");
277
277
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
278
278
+
ok(check_exists("Group1/notepad.lnk"), "link not created\n");
540
279
541
541
-
if (error == DMLERR_NO_ERROR)
542
542
-
{
543
543
-
/* Check that File exists */
544
544
-
CheckFileExistsInProgramGroups(fileName, TRUE, FALSE, groupName, testParams);
545
545
-
}
546
546
-
}
280
280
+
error = dde_execute(instance, hConv, "[DeleteItem(notepad.exe)]");
281
281
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
547
282
548
548
-
/* Delete Item Test.
549
549
-
* DDE command, expected result, and group and file name where it should exist.
550
550
-
* checks to make sure error code matches expected error code
551
551
-
* checks to make sure item does not exist if successful
552
552
-
*/
553
553
-
static void DeleteItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
554
554
-
const char *fileName, const char *groupName, int testParams)
555
555
-
{
556
556
-
HDDEDATA hData;
557
557
-
UINT error;
283
283
+
error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
284
284
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
285
285
+
ok(!check_exists("Group1/notepad.lnk"), "link should not exist\n");
558
286
559
559
-
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
560
560
-
todo_wine
561
561
-
{
562
562
-
ok (expected_result == error, "DeleteItem %s: Expected Error %s, received %s.%s\n",
563
563
-
fileName, GetStringFromError(expected_result), GetStringFromError(error),
564
564
-
GetStringFromTestParams(testParams));
565
565
-
}
287
287
+
error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
288
288
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
566
289
567
567
-
if (error == DMLERR_NO_ERROR)
568
568
-
{
569
569
-
/* Check that File does not exist */
570
570
-
CheckFileExistsInProgramGroups(fileName, FALSE, FALSE, groupName, testParams);
571
571
-
}
572
572
-
}
290
290
+
error = dde_execute(instance, hConv, "[AddItem(notepad)]");
291
291
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
292
292
+
ok(check_exists("Group1/notepad.lnk"), "link not created\n");
573
293
574
574
-
/* Compound Command Test.
575
575
-
* not really generic, assumes command of the form:
576
576
-
* [CreateGroup ...][AddItem ...][AddItem ...]
577
577
-
* All samples I've seen using Compound were of this form (CreateGroup,
578
578
-
* AddItems) so this covers minimum expected functionality.
579
579
-
*/
580
580
-
static HWND CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
581
581
-
const char *groupName, const char *windowTitle, const char *fileName1,
582
582
-
const char *fileName2, int testParams)
583
583
-
{
584
584
-
HDDEDATA hData;
585
585
-
UINT error;
586
586
-
HWND hwnd = 0;
294
294
+
error = dde_execute(instance, hConv, "[AddItem(notepad)]");
295
295
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
587
296
588
588
-
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
589
589
-
todo_wine
590
590
-
{
591
591
-
ok (expected_result == error, "Compound String %s: Expected Error %s, received %s.%s\n",
592
592
-
command, GetStringFromError(expected_result), GetStringFromError(error),
593
593
-
GetStringFromTestParams(testParams));
594
594
-
}
297
297
+
/* XP allows any valid path even if it does not exist; Vista+ requires that
298
298
+
* the path both exist and be a file (directories are invalid). */
595
299
596
596
-
if (error == DMLERR_NO_ERROR)
597
597
-
{
598
598
-
/* Check that File exists */
599
599
-
CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
600
600
-
hwnd = CheckWindowCreated(windowTitle, FALSE, testParams);
601
601
-
CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams);
602
602
-
CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams);
603
603
-
}
604
604
-
return hwnd;
605
605
-
}
300
300
+
error = dde_execute(instance, hConv, "[AddItem(C:\\windows\\system.ini)]");
301
301
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
302
302
+
ok(check_exists("Group1/system.lnk"), "link not created\n");
606
303
607
607
-
static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name)
608
608
-
{
609
609
-
lstrcpyA(itemtext, "[AddItem(");
610
610
-
lstrcatA(itemtext, cmdline);
611
611
-
lstrcatA(itemtext, ",");
612
612
-
lstrcatA(itemtext, name);
613
613
-
lstrcatA(itemtext, ")]");
614
614
-
}
304
304
+
error = dde_execute(instance, hConv, "[AddItem(notepad,test1)]");
305
305
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
306
306
+
ok(check_exists("Group1/test1.lnk"), "link not created\n");
615
307
616
616
-
/* 1st set of tests */
617
617
-
static int DdeTestProgman(DWORD instance, HCONV hConv)
618
618
-
{
619
619
-
HDDEDATA hData;
620
620
-
UINT error;
621
621
-
int testnum;
622
622
-
char temppath[MAX_PATH];
623
623
-
char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH];
624
624
-
char itemtext[MAX_PATH + 20];
625
625
-
char comptext[2 * (MAX_PATH + 20) + 21];
626
626
-
HWND hwnd;
308
308
+
error = dde_execute(instance, hConv, "[DeleteItem(test1)]");
309
309
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
310
310
+
ok(!check_exists("Group1/test1.lnk"), "link should not exist\n");
627
311
628
628
-
testnum = 1;
629
629
-
/* Invalid Command */
630
630
-
DdeExecuteCommand(instance, hConv, "[InvalidCommand()]", &hData, &error, DDE_TEST_MISC|testnum++);
631
631
-
ok (error == DMLERR_NOTPROCESSED, "InvalidCommand(), expected error %s, received %s.\n",
632
632
-
GetStringFromError(DMLERR_NOTPROCESSED), GetStringFromError(error));
312
312
+
error = dde_execute(instance, hConv, "[AddItem(notepad,test1)]");
313
313
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
314
314
+
ok(check_exists("Group1/test1.lnk"), "link not created\n");
633
315
634
634
-
/* On Vista+ the files have to exist when adding a link */
635
635
-
GetTempPathA(MAX_PATH, temppath);
636
636
-
GetTempFileNameA(temppath, "dde", 0, f1g1);
637
637
-
GetTempFileNameA(temppath, "dde", 0, f2g1);
638
638
-
GetTempFileNameA(temppath, "dde", 0, f3g1);
639
639
-
GetTempFileNameA(temppath, "dde", 0, f1g3);
640
640
-
GetTempFileNameA(temppath, "dde", 0, f2g3);
316
316
+
error = dde_execute(instance, hConv, "[ReplaceItem(test1)]");
317
317
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
318
318
+
ok(!check_exists("Group1/test1.lnk"), "link should not exist\n");
641
319
642
642
-
/* CreateGroup Tests (including AddItem, DeleteItem) */
643
643
-
CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++);
644
644
-
CreateAddItemText(itemtext, f1g1, "f1g1Name");
645
645
-
AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f1g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
646
646
-
CreateAddItemText(itemtext, f2g1, "f2g1Name");
647
647
-
AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
648
648
-
DeleteItemTest(instance, hConv, "[DeleteItem(f2g1Name)]", DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
649
649
-
CreateAddItemText(itemtext, f3g1, "f3g1Name");
650
650
-
AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
651
651
-
CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++);
652
652
-
/* Create Group that already exists - same instance */
653
653
-
CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++);
320
320
+
error = dde_execute(instance, hConv, "[AddItem(regedit)]");
321
321
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
322
322
+
ok(check_exists("Group1/regedit.lnk"), "link not created\n");
654
323
655
655
-
/* ShowGroup Tests */
656
656
-
ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, "Group1", Group1Title, TRUE, DDE_TEST_SHOWGROUP|testnum++);
657
657
-
DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
658
658
-
ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, "Startup", StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++);
659
659
-
hwnd = ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++);
324
324
+
/* test ShowGroup() and test which group an item gets added to */
325
325
+
error = dde_execute(instance, hConv, "[ShowGroup(Group1)]");
326
326
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
660
327
661
661
-
/* DeleteGroup Test - Note that Window is Open for this test */
662
662
-
DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++);
663
663
-
if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
328
328
+
error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
329
329
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
330
330
+
ok(check_window_exists("Group1"), "window not created\n");
664
331
665
665
-
/* Compound Execute String Command */
666
666
-
lstrcpyA(comptext, "[CreateGroup(Group3)]");
667
667
-
CreateAddItemText(itemtext, f1g3, "f1g3Name");
668
668
-
lstrcatA(comptext, itemtext);
669
669
-
CreateAddItemText(itemtext, f2g3, "f2g3Name");
670
670
-
lstrcatA(comptext, itemtext);
671
671
-
hwnd = CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMPOUND|testnum++);
332
332
+
error = dde_execute(instance, hConv, "[CreateGroup(Group2)]");
333
333
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
334
334
+
ok(check_exists("Group2"), "directory not created\n");
335
335
+
ok(check_window_exists("Group2"), "window not created\n");
336
336
+
337
337
+
error = dde_execute(instance, hConv, "[AddItem(notepad,test2)]");
338
338
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
339
339
+
ok(check_exists("Group2/test2.lnk"), "link not created\n");
340
340
+
341
341
+
error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
342
342
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
343
343
+
ok(check_window_exists("Group1"), "window not created\n");
344
344
+
345
345
+
error = dde_execute(instance, hConv, "[AddItem(notepad,test3)]");
346
346
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
347
347
+
ok(check_exists("Group1/test3.lnk"), "link not created\n");
672
348
673
673
-
DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++);
674
674
-
if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
349
349
+
error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
350
350
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
351
351
+
ok(!check_exists("Group1"), "directory should not exist\n");
675
352
676
676
-
/* Full Parameters of Add Item */
677
677
-
/* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */
353
353
+
error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
354
354
+
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
355
355
+
356
356
+
error = dde_execute(instance, hConv, "[ShowGroup(Group2, 0)]");
357
357
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
358
358
+
ok(check_window_exists("Group2"), "window not created\n");
678
359
679
679
-
DeleteFileA(f1g1);
680
680
-
DeleteFileA(f2g1);
681
681
-
DeleteFileA(f3g1);
682
682
-
DeleteFileA(f1g3);
683
683
-
DeleteFileA(f2g3);
360
360
+
error = dde_execute(instance, hConv, "[ExitProgman(1)]");
361
361
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
684
362
685
685
-
return testnum;
363
363
+
error = dde_execute(instance, hConv, "[AddItem(notepad,test4)]");
364
364
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
365
365
+
ok(check_exists("Group2/test4.lnk"), "link not created\n");
686
366
}
687
367
688
368
/* 2nd set of tests - 2nd connection */
689
689
-
static void DdeTestProgman2(DWORD instance, HCONV hConv, int testnum)
369
369
+
static void test_progman_dde2(DWORD instance, HCONV hConv)
690
370
{
691
691
-
/* Create Group that already exists on a separate connection */
692
692
-
CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++);
693
693
-
DeleteGroupTest(instance, hConv, "[DeleteGroup(Group2)]", DMLERR_NO_ERROR, "Group2", DDE_TEST_DELETEGROUP|testnum++);
371
371
+
UINT error;
372
372
+
373
373
+
/* last open group is retained across connections */
374
374
+
error = dde_execute(instance, hConv, "[AddItem(notepad)]");
375
375
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
376
376
+
ok(check_exists("Group2/notepad.lnk"), "link not created\n");
377
377
+
378
378
+
error = dde_execute(instance, hConv, "[DeleteGroup(Group2)]");
379
379
+
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
380
380
+
ok(!check_exists("Group2"), "directory should not exist\n");
381
381
+
}
382
382
+
383
383
+
static BOOL check_in_programs_list(const char *list, const char *group)
384
384
+
{
385
385
+
while (1)
386
386
+
{
387
387
+
if (!strncmp(list, group, strlen(group)) && list[strlen(group)] == '\r')
388
388
+
return TRUE;
389
389
+
if (!(list = strchr(list, '\r'))) break;
390
390
+
list += 2;
391
391
+
}
392
392
+
return FALSE;
393
393
+
}
394
394
+
395
395
+
static void test_request_groups(DWORD instance, HCONV hconv)
396
396
+
{
397
397
+
char *list;
398
398
+
char programs[MAX_PATH];
399
399
+
WIN32_FIND_DATAA finddata;
400
400
+
HANDLE hfind;
401
401
+
402
402
+
list = dde_request(instance, hconv, "Groups");
403
403
+
ok(list != NULL, "request failed: %u\n", DdeGetLastError(instance));
404
404
+
strcpy(programs, ProgramsDir);
405
405
+
strcat(programs, "/*");
406
406
+
hfind = FindFirstFileA(programs, &finddata);
407
407
+
do
408
408
+
{
409
409
+
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && finddata.cFileName[0] != '.')
410
410
+
{
411
411
+
ok(check_in_programs_list(list, finddata.cFileName),
412
412
+
"directory '%s' missing from group list\n", finddata.cFileName);
413
413
+
}
414
414
+
} while (FindNextFileA(hfind, &finddata));
415
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
702
-
int testnum;
424
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
709
-
ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
431
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
713
-
ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
435
435
+
ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
714
436
hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
715
715
-
ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
437
437
+
ret = DdeFreeStringHandle(instance, hszProgman);
438
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
723
-
/* Run Tests */
724
724
-
testnum = DdeTestProgman(instance, hConv);
446
446
+
test_parser(instance, hConv);
447
447
+
test_progman_dde(instance, hConv);
448
448
+
test_request_groups(instance, hConv);
725
449
726
450
/* Cleanup & Exit */
727
727
-
ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
728
728
-
ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
451
451
+
ret = DdeDisconnect(hConv);
452
452
+
ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
453
453
+
ret = DdeUninitialize(instance);
454
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
734
-
ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
460
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
738
-
ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
464
464
+
ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
739
465
hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
740
740
-
ok (hConv != NULL, "DdeConnect Error %s\n", GetDdeLastErrorStr(instance));
741
741
-
ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
466
466
+
ok(hConv != NULL, "DdeConnect() failed: %u\n", DdeGetLastError(instance));
467
467
+
ret = DdeFreeStringHandle(instance, hszProgman);
468
468
+
ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
742
469
743
470
/* Run Tests */
744
744
-
DdeTestProgman2(instance, hConv, testnum);
471
471
+
test_progman_dde2(instance, hConv);
745
472
746
473
/* Cleanup & Exit */
747
747
-
ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
748
748
-
ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
474
474
+
ret = DdeDisconnect(hConv);
475
475
+
ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
476
476
+
ret = DdeUninitialize(instance);
477
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
21
-
#include "precomp.h"
21
21
+
#define WIN32_LEAN_AND_MEAN
22
22
+
#include <windows.h>
23
23
+
#include "shellapi.h"
24
24
+
25
25
+
#include <stdio.h>
26
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
21
-
#include "precomp.h"
21
21
+
#define COBJMACROS
22
22
+
#define NONAMELESSUNION
23
23
+
#define NONAMELESSSTRUCT
22
24
23
23
-
#include <winsvc.h>
24
24
-
#include <initguid.h>
25
25
+
#include "shldisp.h"
26
26
+
#include "shlobj.h"
27
27
+
#include "shlwapi.h"
28
28
+
#include "winsvc.h"
29
29
+
30
30
+
#include "wine/heap.h"
31
31
+
#include "wine/test.h"
32
32
+
33
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
38
+
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
39
39
+
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
40
40
+
{
41
41
+
ULONG rc;
42
42
+
IUnknown_AddRef(obj);
43
43
+
rc = IUnknown_Release(obj);
44
44
+
ok_(__FILE__,line)(rc == ref, "Unexpected refcount %d, expected %d\n", rc, ref);
45
45
+
}
46
46
+
29
47
static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
30
48
31
31
-
static HRESULT (WINAPI *pSHGetFolderPathW)(HWND, int, HANDLE, DWORD, LPWSTR);
32
49
static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
33
33
-
static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
34
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
54
+
static BSTR a2bstr(const char *str)
55
55
+
{
56
56
+
BSTR ret;
57
57
+
int len;
58
58
+
59
59
+
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
60
60
+
ret = SysAllocStringLen(NULL, len);
61
61
+
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
62
62
+
63
63
+
return ret;
64
64
+
}
65
65
+
66
66
+
static void variant_set_string(VARIANT *v, const char *s)
67
67
+
{
68
68
+
V_VT(v) = VT_BSTR;
69
69
+
V_BSTR(v) = a2bstr(s);
70
70
+
}
71
71
+
39
72
static void init_function_pointers(void)
40
73
{
41
41
-
HMODULE hshell32, hkernel32;
74
74
+
HMODULE hshell32;
42
75
43
76
hshell32 = GetModuleHandleA("shell32.dll");
44
44
-
hkernel32 = GetModuleHandleA("kernel32.dll");
45
45
-
pSHGetFolderPathW = (void*)GetProcAddress(hshell32, "SHGetFolderPathW");
46
77
pSHGetNameFromIDList = (void*)GetProcAddress(hshell32, "SHGetNameFromIDList");
47
47
-
pSHGetSpecialFolderLocation = (void*)GetProcAddress(hshell32,
48
48
-
"SHGetSpecialFolderLocation");
49
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
139
+
IDispatch *disp;
111
140
int len, i;
112
141
113
113
-
r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
114
114
-
&IID_IShellDispatch, (LPVOID*)&sd);
115
115
-
if (r == REGDB_E_CLASSNOTREG) /* NT4 */
116
116
-
{
117
117
-
win_skip("skipping IShellDispatch tests\n");
118
118
-
return;
119
119
-
}
120
120
-
ok(SUCCEEDED(r), "CoCreateInstance failed: %08x\n", r);
121
121
-
if (FAILED(r))
122
122
-
return;
142
142
+
r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void **)&sd);
143
143
+
ok(SUCCEEDED(r), "Failed to create ShellDispatch object: %#x.\n", r);
144
144
+
145
145
+
disp = NULL;
146
146
+
r = IShellDispatch_get_Application(sd, &disp);
147
147
+
ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r);
148
148
+
ok(disp == (IDispatch *)sd, "Unexpected application pointer %p.\n", disp);
149
149
+
IDispatch_Release(disp);
150
150
+
151
151
+
disp = NULL;
152
152
+
r = IShellDispatch_get_Parent(sd, &disp);
153
153
+
ok(r == S_OK, "Failed to get Shell object parent, hr %#x.\n", r);
154
154
+
ok(disp == (IDispatch *)sd, "Unexpected parent pointer %p.\n", disp);
155
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
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
147
-
folder = (void*)0xdeadbeef;
181
181
+
folder = (void *)0xdeadbeef;
148
182
r = IShellDispatch_NameSpace(sd, var, &folder);
149
149
-
todo_wine {
150
150
-
ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
151
151
-
ok(folder == NULL, "got %p\n", folder);
152
152
-
if (r == S_OK)
153
153
-
Folder_Release(folder);
154
154
-
}
183
183
+
ok(r == S_FALSE, "Unexpected hr %#x.\n", r);
184
184
+
ok(folder == NULL, "Unexpected folder instance %p\n", folder);
185
185
+
155
186
V_VT(&var) = VT_I4;
156
187
V_I4(&var) = ssfPROGRAMFILES;
157
188
r = IShellDispatch_NameSpace(sd, var, &folder);
158
158
-
ok(r == S_OK ||
159
159
-
broken(r == S_FALSE), /* NT4 */
160
160
-
"IShellDispatch::NameSpace failed: %08x\n", r);
189
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
165
-
if (pSHGetFolderPathW)
166
166
-
{
167
167
-
r = pSHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL,
168
168
-
SHGFP_TYPE_CURRENT, path);
169
169
-
ok(r == S_OK, "SHGetFolderPath failed: %08x\n", r);
170
170
-
}
194
194
+
r = SHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, path);
195
195
+
ok(r == S_OK, "Failed to get folder path: %#x.\n", r);
196
196
+
171
197
r = Folder_get_Title(folder, &title);
172
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
180
-
if (pSHGetSpecialFolderLocation && pSHGetNameFromIDList)
205
205
+
if (pSHGetNameFromIDList)
181
206
{
182
207
LPITEMIDLIST pidl;
183
208
PWSTR name;
184
209
185
185
-
r = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl);
210
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
189
-
todo_wine
190
190
-
ok(!lstrcmpW(title, name), "expected %s, got %s\n",
191
191
-
wine_dbgstr_w(name), wine_dbgstr_w(title));
214
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
195
-
else if (pSHGetFolderPathW)
218
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
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
218
-
if (pSHGetFolderPathW)
219
219
-
ok(!lstrcmpiW(item_path, path), "expected %s, got %s\n",
220
220
-
wine_dbgstr_w(path), wine_dbgstr_w(item_path));
240
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
232
-
ok(r == S_OK ||
233
233
-
broken(r == S_FALSE), /* NT4 */
234
234
-
"IShellDispatch::NameSpace failed: %08x\n", r);
235
235
-
if (r == S_OK)
236
236
-
{
237
237
-
r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2);
238
238
-
ok(r == S_OK ||
239
239
-
broken(r == E_NOINTERFACE), /* NT4 */
240
240
-
"Folder::QueryInterface failed: %08x\n", r);
241
241
-
if (r == S_OK)
242
242
-
{
243
243
-
r = Folder2_get_Self(folder2, &item);
244
244
-
ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
245
245
-
if (r == S_OK)
246
246
-
{
247
247
-
r = FolderItem_get_Path(item, &item_path);
248
248
-
todo_wine
249
249
-
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
250
250
-
todo_wine
251
251
-
ok(!lstrcmpW(item_path, clsidW), "expected %s, got %s\n",
252
252
-
wine_dbgstr_w(clsidW), wine_dbgstr_w(item_path));
253
253
-
SysFreeString(item_path);
254
254
-
FolderItem_Release(item);
255
255
-
}
256
256
-
Folder2_Release(folder2);
257
257
-
}
258
258
-
Folder_Release(folder);
259
259
-
}
252
252
+
ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r);
253
253
+
254
254
+
r = Folder_QueryInterface(folder, &IID_Folder2, (void **)&folder2);
255
255
+
ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r);
256
256
+
r = Folder2_get_Self(folder2, &item);
257
257
+
ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
258
258
+
r = FolderItem_get_Path(item, &item_path);
259
259
+
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
260
260
+
/* TODO: we return lowercase GUID here */
261
261
+
ok(!lstrcmpiW(item_path, clsidW), "expected %s, got %s\n", wine_dbgstr_w(clsidW), wine_dbgstr_w(item_path));
262
262
+
263
263
+
SysFreeString(item_path);
264
264
+
FolderItem_Release(item);
265
265
+
Folder2_Release(folder2);
266
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
272
-
if (pGetLongPathNameW)
273
273
-
{
274
274
-
len = pGetLongPathNameW(tempW, NULL, 0);
275
275
-
long_pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
276
276
-
if (long_pathW)
277
277
-
pGetLongPathNameW(tempW, long_pathW, len);
278
278
-
}
279
279
+
280
280
+
len = GetLongPathNameW(tempW, NULL, 0);
281
281
+
long_pathW = heap_alloc(len * sizeof(WCHAR));
282
282
+
GetLongPathNameW(tempW, long_pathW, len);
283
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
283
-
if (r == S_OK)
284
284
-
{
285
285
-
r = Folder_get_Title(folder, &title);
286
286
-
ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
287
287
-
if (r == S_OK)
288
288
-
{
289
289
-
ok(!lstrcmpW(title, winetestW), "bad title: %s\n",
290
290
-
wine_dbgstr_w(title));
291
291
-
SysFreeString(title);
292
292
-
}
293
293
-
r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2);
294
294
-
ok(r == S_OK ||
295
295
-
broken(r == E_NOINTERFACE), /* NT4 */
296
296
-
"Folder::QueryInterface failed: %08x\n", r);
297
297
-
if (r == S_OK)
298
298
-
{
299
299
-
r = Folder2_get_Self(folder2, &item);
300
300
-
ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
301
301
-
if (r == S_OK)
302
302
-
{
303
303
-
r = FolderItem_get_Path(item, &item_path);
304
304
-
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
305
305
-
if (long_pathW)
306
306
-
ok(!lstrcmpW(item_path, long_pathW),
307
307
-
"expected %s, got %s\n", wine_dbgstr_w(long_pathW),
308
308
-
wine_dbgstr_w(item_path));
309
309
-
SysFreeString(item_path);
310
310
-
FolderItem_Release(item);
311
311
-
}
312
312
-
Folder2_Release(folder2);
313
313
-
}
314
314
-
Folder_Release(folder);
315
315
-
}
316
316
-
SysFreeString(V_BSTR(&var));
288
288
+
289
289
+
disp = (void *)0xdeadbeef;
290
290
+
r = Folder_get_Parent(folder, &disp);
291
291
+
ok(r == E_NOTIMPL, "Unexpected hr %#x.\n", r);
292
292
+
ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
293
293
+
294
294
+
r = Folder_get_Title(folder, &title);
295
295
+
ok(r == S_OK, "Failed to get folder title: %#x.\n", r);
296
296
+
ok(!lstrcmpW(title, winetestW), "Unexpected title: %s\n", wine_dbgstr_w(title));
297
297
+
SysFreeString(title);
298
298
+
299
299
+
r = Folder_QueryInterface(folder, &IID_Folder2, (void **)&folder2);
300
300
+
ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r);
301
301
+
r = Folder2_get_Self(folder2, &item);
302
302
+
ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
303
303
+
r = FolderItem_get_Path(item, &item_path);
304
304
+
ok(r == S_OK, "Failed to get item path: %#x.\n", r);
305
305
+
ok(!lstrcmpW(item_path, long_pathW), "Unexpected path %s, got %s\n", wine_dbgstr_w(item_path), wine_dbgstr_w(long_pathW));
306
306
+
SysFreeString(item_path);
307
307
+
FolderItem_Release(item);
308
308
+
Folder2_Release(folder2);
309
309
+
310
310
+
Folder_Release(folder);
311
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
337
-
ok(r == S_OK ||
338
338
-
broken(r == E_NOINTERFACE), /* NT4 */
339
339
-
"Folder::QueryInterface failed: %08x\n", r);
332
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
348
-
if (long_pathW)
349
349
-
ok(!lstrcmpW(item_path, long_pathW),
350
350
-
"expected %s, got %s\n", wine_dbgstr_w(long_pathW),
351
351
-
wine_dbgstr_w(item_path));
341
341
+
ok(!lstrcmpW(item_path, long_pathW), "Unexpected path %s, got %s\n", wine_dbgstr_w(item_path),
342
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
362
-
HeapFree(GetProcessHeap(), 0, long_pathW);
353
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
370
-
WCHAR wstr[MAX_PATH], orig_dir[MAX_PATH];
361
361
+
static const struct
362
362
+
{
363
363
+
char name[32];
364
364
+
enum
365
365
+
{
366
366
+
DIRECTORY,
367
367
+
EMPTY_FILE,
368
368
+
}
369
369
+
type;
370
370
+
}
371
371
+
file_defs[] =
372
372
+
{
373
373
+
{ "00-Myfolder", DIRECTORY },
374
374
+
{ "01-empty.bin", EMPTY_FILE },
375
375
+
};
376
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
374
-
FolderItems *items = NULL;
380
380
+
FolderItems *items;
375
381
FolderItems2 *items2 = NULL;
376
382
FolderItems3 *items3 = NULL;
377
377
-
FolderItem *item = (FolderItem*)0xdeadbeef;
378
378
-
IDispatch *disp = NULL;
379
379
-
IUnknown *unk = NULL;
383
383
+
FolderItem *item = (FolderItem*)0xdeadbeef, *item2;
380
384
FolderItemVerbs *verbs = (FolderItemVerbs*)0xdeadbeef;
381
381
-
VARIANT var;
382
382
-
LONG lcount = -1;
385
385
+
VARIANT var, int_index, str_index, str_index2;
386
386
+
IDispatch *disp, *disp2;
387
387
+
LONG count = -1;
388
388
+
IUnknown *unk;
389
389
+
HANDLE file;
390
390
+
BSTR bstr;
391
391
+
char cstr[64];
392
392
+
BOOL ret;
393
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
388
-
GetTempPathW(MAX_PATH, wstr);
399
399
+
/* create and enter a temporary directory and a folder object for it */
400
400
+
GetTempPathW(MAX_PATH, path);
389
401
GetCurrentDirectoryW(MAX_PATH, orig_dir);
390
390
-
SetCurrentDirectoryW(wstr);
391
391
-
CreateDirectoryW(winetestW, NULL);
392
392
-
GetFullPathNameW(winetestW, MAX_PATH, wstr, NULL);
402
402
+
SetCurrentDirectoryW(path);
403
403
+
ret = CreateDirectoryW(winetestW, NULL);
404
404
+
ok(ret, "CreateDirectory failed: %08x\n", GetLastError());
405
405
+
GetFullPathNameW(winetestW, MAX_PATH, path, NULL);
393
406
V_VT(&var) = VT_BSTR;
394
394
-
V_BSTR(&var) = SysAllocString(wstr);
407
407
+
V_BSTR(&var) = SysAllocString(path);
408
408
+
409
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
398
-
SysFreeString(V_BSTR(&var));
399
399
-
IShellDispatch_Release(sd);
413
413
+
EXPECT_REF(folder, 1);
414
414
+
EXPECT_REF(sd, 1);
415
415
+
416
416
+
VariantClear(&var);
400
417
SetCurrentDirectoryW(winetestW);
418
418
+
GetCurrentDirectoryW(MAX_PATH, path);
419
419
+
GetLongPathNameW(path, cur_dir, MAX_PATH);
401
420
421
421
+
/* FolderItems grabs its Folder reference */
422
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
405
-
r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2);
406
406
-
ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r);
407
407
-
ok(!!items2 || broken(!items2) /* xp and later */, "items2 is null\n");
408
408
-
r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3);
409
409
-
ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r);
410
410
-
ok(!!items3, "items3 is null\n");
411
411
-
Folder_Release(folder);
426
426
+
EXPECT_REF(folder, 2);
427
427
+
EXPECT_REF(items, 1);
428
428
+
429
429
+
unk = NULL;
430
430
+
r = Folder_Items(folder, (FolderItems **)&unk);
431
431
+
ok(r == S_OK, "Folder::Items failed: %08x\n", r);
432
432
+
EXPECT_REF(folder, 3);
433
433
+
IUnknown_Release(unk);
434
434
+
EXPECT_REF(folder, 2);
435
435
+
436
436
+
FolderItems_AddRef(items);
437
437
+
EXPECT_REF(folder, 2);
438
438
+
FolderItems_Release(items);
439
439
+
440
440
+
/* Application property */
441
441
+
disp = NULL;
442
442
+
EXPECT_REF(sd, 1);
443
443
+
r = Folder_get_Application(folder, &disp);
444
444
+
ok(r == S_OK, "Failed to get application %#x.\n", r);
445
445
+
ok(disp != (IDispatch *)sd, "Unexpected application pointer\n");
446
446
+
EXPECT_REF(sd, 1);
447
447
+
448
448
+
disp2 = NULL;
449
449
+
r = Folder_get_Application(folder, &disp2);
450
450
+
ok(r == S_OK, "Failed to get application %#x.\n", r);
451
451
+
ok(disp2 == disp, "Unexpected application pointer\n");
452
452
+
IDispatch_Release(disp2);
453
453
+
454
454
+
r = IDispatch_QueryInterface(disp, &IID_IShellDispatch, (void **)&disp2);
455
455
+
ok(r == S_OK, "Wrong instance, hr %#x.\n", r);
456
456
+
IDispatch_Release(disp2);
457
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
416
-
r = FolderItems_get_Count(items, &lcount);
462
462
+
r = FolderItems_get_Count(items, &count);
417
463
ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
418
418
-
ok(!lcount, "expected 0 files, got %d\n", lcount);
464
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
427
-
todo_wine
473
473
+
ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
474
474
+
ok(!item, "item is not null\n");
475
475
+
476
476
+
/* create test files */
477
477
+
for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++)
478
478
+
{
479
479
+
switch (file_defs[i].type)
480
480
+
{
481
481
+
case DIRECTORY:
482
482
+
r = CreateDirectoryA(file_defs[i].name, NULL);
483
483
+
ok(r, "CreateDirectory failed: %08x\n", GetLastError());
484
484
+
PathCombineA(cstr, file_defs[i].name, "foo.txt");
485
485
+
file = CreateFileA(cstr, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
486
486
+
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %08x\n", GetLastError());
487
487
+
CloseHandle(file);
488
488
+
break;
489
489
+
490
490
+
case EMPTY_FILE:
491
491
+
file = CreateFileA(file_defs[i].name, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
492
492
+
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %08x\n", GetLastError());
493
493
+
CloseHandle(file);
494
494
+
break;
495
495
+
}
496
496
+
}
497
497
+
498
498
+
/* test that get_Count is not aware of the newly created files */
499
499
+
count = -1;
500
500
+
r = FolderItems_get_Count(items, &count);
501
501
+
ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
502
502
+
ok(!count, "expected 0 files, got %d\n", count);
503
503
+
504
504
+
/* test that the newly created files CAN be retrieved by string index */
505
505
+
variant_set_string(&var, file_defs[0].name);
506
506
+
item = NULL;
507
507
+
r = FolderItems_Item(items, var, &item);
508
508
+
ok(r == S_OK, "FolderItems::Item failed: %08x\n", r);
509
509
+
ok(!!item, "item is null\n");
510
510
+
511
511
+
disp = (void *)0xdeadbeef;
512
512
+
r = FolderItems_get_Parent(items, &disp);
513
513
+
ok(r == E_NOTIMPL, "Unexpected hr %#x.\n", r);
514
514
+
ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
515
515
+
516
516
+
r = FolderItem_get_Parent(item, &disp);
517
517
+
ok(r == S_OK, "Failed to get parent pointer, hr %#x.\n", r);
518
518
+
ok(disp == (IDispatch *)folder, "Unexpected parent pointer %p.\n", disp);
519
519
+
IDispatch_Release(disp);
520
520
+
521
521
+
if (item) FolderItem_Release(item);
522
522
+
VariantClear(&var);
523
523
+
524
524
+
/* recreate the items object */
525
525
+
FolderItems_Release(items);
526
526
+
items = NULL;
527
527
+
r = Folder_Items(folder, &items);
528
528
+
ok(r == S_OK, "Folder::Items failed: %08x\n", r);
529
529
+
ok(!!items, "items is null\n");
530
530
+
r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2);
531
531
+
ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r);
532
532
+
if (r == S_OK)
533
533
+
{
534
534
+
ok(!!items2, "items2 is null\n");
535
535
+
FolderItems2_Release(items2);
536
536
+
}
537
537
+
r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3);
538
538
+
ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r);
539
539
+
ok(!!items3, "items3 is null\n");
540
540
+
541
541
+
count = -1;
542
542
+
r = FolderItems_get_Count(items, &count);
543
543
+
ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
544
544
+
ok(count == sizeof(file_defs)/sizeof(file_defs[0]),
545
545
+
"expected %d files, got %d\n", (LONG)(sizeof(file_defs)/sizeof(file_defs[0])), count);
546
546
+
547
547
+
V_VT(&var) = VT_EMPTY;
548
548
+
item = (FolderItem*)0xdeadbeef;
549
549
+
r = FolderItems_Item(items, var, &item);
550
550
+
ok(r == E_NOTIMPL, "expected E_NOTIMPL, got %08x\n", r);
551
551
+
ok(!item, "item is not null\n");
552
552
+
553
553
+
V_VT(&var) = VT_I2;
554
554
+
V_I2(&var) = 0;
555
555
+
556
556
+
EXPECT_REF(folder, 2);
557
557
+
EXPECT_REF(items, 2);
558
558
+
item = NULL;
559
559
+
r = FolderItems_Item(items, var, &item);
560
560
+
ok(r == S_OK, "FolderItems::Item failed: %08x\n", r);
561
561
+
ok(!!item, "item is null\n");
562
562
+
EXPECT_REF(folder, 3);
563
563
+
EXPECT_REF(items, 2);
564
564
+
565
565
+
r = Folder_get_Application(folder, &disp);
566
566
+
ok(r == S_OK, "Failed to get application pointer %#x.\n", r);
567
567
+
r = FolderItem_get_Application(item, &disp2);
568
568
+
ok(r == S_OK, "Failed to get application pointer %#x.\n", r);
569
569
+
ok(disp == disp2, "Unexpected application pointer.\n");
570
570
+
IDispatch_Release(disp2);
571
571
+
IDispatch_Release(disp);
572
572
+
573
573
+
FolderItem_Release(item);
574
574
+
575
575
+
V_VT(&var) = VT_I4;
576
576
+
V_I4(&var) = 0;
577
577
+
item = NULL;
578
578
+
r = FolderItems_Item(items, var, &item);
579
579
+
ok(r == S_OK, "FolderItems::Item failed: %08x\n", r);
580
580
+
ok(!!item, "item is null\n");
581
581
+
if (item) FolderItem_Release(item);
582
582
+
583
583
+
V_I4(&var) = -1;
584
584
+
item = (FolderItem*)0xdeadbeef;
585
585
+
r = FolderItems_Item(items, var, &item);
586
586
+
ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
587
587
+
ok(!item, "item is not null\n");
588
588
+
589
589
+
V_VT(&var) = VT_ERROR;
590
590
+
V_ERROR(&var) = 0;
591
591
+
item = NULL;
592
592
+
r = FolderItems_Item(items, var, &item);
593
593
+
ok(r == S_OK, "expected S_OK, got %08x\n", r);
594
594
+
ok(!!item, "item is null\n");
595
595
+
if (item)
596
596
+
{
597
597
+
bstr = NULL;
598
598
+
r = FolderItem_get_Path(item, &bstr);
599
599
+
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
600
600
+
ok(!lstrcmpW(bstr, cur_dir),
601
601
+
"expected %s, got %s\n", wine_dbgstr_w(cur_dir), wine_dbgstr_w(bstr));
602
602
+
SysFreeString(bstr);
603
603
+
FolderItem_Release(item);
604
604
+
}
605
605
+
606
606
+
V_VT(&int_index) = VT_I4;
607
607
+
608
608
+
/* test the folder item corresponding to each file */
609
609
+
for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++)
610
610
+
{
611
611
+
VARIANT_BOOL b;
612
612
+
BSTR name;
613
613
+
614
614
+
V_I4(&int_index) = i;
615
615
+
variant_set_string(&str_index, file_defs[i].name);
616
616
+
617
617
+
item = NULL;
618
618
+
r = FolderItems_Item(items, int_index, &item);
619
619
+
ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
620
620
+
ok(!!item, "file_defs[%d]: item is null\n", i);
621
621
+
622
622
+
item2 = NULL;
623
623
+
r = FolderItems_Item(items, int_index, &item2);
624
624
+
ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
625
625
+
ok(item2 != item, "file_defs[%d]: item and item2 are the same\n", i);
626
626
+
FolderItem_Release(item2);
627
627
+
628
628
+
bstr = NULL;
629
629
+
r = FolderItem_get_Path(item, &bstr);
630
630
+
ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r);
631
631
+
PathCombineW(path, cur_dir, V_BSTR(&str_index));
632
632
+
ok(!lstrcmpW(bstr, path),
633
633
+
"file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr));
634
634
+
SysFreeString(bstr);
635
635
+
636
636
+
bstr = a2bstr(file_defs[i].name);
637
637
+
r = FolderItem_get_Name(item, &name);
638
638
+
ok(r == S_OK, "Failed to get item name, hr %#x.\n", r);
639
639
+
/* Returned display name does not have to strictly match file name, e.g. extension could be omitted. */
640
640
+
ok(lstrlenW(name) <= lstrlenW(bstr), "file_defs[%d]: unexpected name length.\n", i);
641
641
+
ok(!memcmp(bstr, name, lstrlenW(name) * sizeof(WCHAR)), "file_defs[%d]: unexpected name %s.\n", i, wine_dbgstr_w(name));
642
642
+
SysFreeString(name);
643
643
+
SysFreeString(bstr);
644
644
+
645
645
+
FolderItem_Release(item);
646
646
+
647
647
+
item = NULL;
648
648
+
r = FolderItems_Item(items, str_index, &item);
649
649
+
ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
650
650
+
ok(!!item, "file_defs[%d]: item is null\n", i);
651
651
+
652
652
+
bstr = NULL;
653
653
+
r = FolderItem_get_Path(item, &bstr);
654
654
+
ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r);
655
655
+
PathCombineW(path, cur_dir, V_BSTR(&str_index));
656
656
+
ok(!lstrcmpW(bstr, path),
657
657
+
"file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr));
658
658
+
SysFreeString(bstr);
659
659
+
660
660
+
b = 0xdead;
661
661
+
r = FolderItem_get_IsFolder(item, &b);
662
662
+
ok(r == S_OK, "Failed to get IsFolder property, %#x.\n", r);
663
663
+
ok(file_defs[i].type == DIRECTORY ? b == VARIANT_TRUE : b == VARIANT_FALSE, "Unexpected prop value %#x.\n", b);
664
664
+
665
665
+
FolderItem_Release(item);
666
666
+
667
667
+
if (file_defs[i].type == DIRECTORY)
668
668
+
{
669
669
+
/* test that getting an item object for a file in a subdirectory succeeds */
670
670
+
PathCombineA(cstr, file_defs[i].name, "foo.txt");
671
671
+
variant_set_string(&str_index2, cstr);
672
672
+
item2 = NULL;
673
673
+
r = FolderItems_Item(items, str_index2, &item2);
674
674
+
ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
675
675
+
ok(!!item2, "file_defs[%d]: item is null\n", i);
676
676
+
if (item2) FolderItem_Release(item2);
677
677
+
VariantClear(&str_index2);
678
678
+
679
679
+
/* delete the file in the subdirectory */
680
680
+
ret = DeleteFileA(cstr);
681
681
+
ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
682
682
+
683
683
+
/* test that getting an item object via a relative path fails */
684
684
+
strcpy(cstr, file_defs[i].name);
685
685
+
strcat(cstr, "\\..\\");
686
686
+
strcat(cstr, file_defs[i].name);
687
687
+
variant_set_string(&str_index2, cstr);
688
688
+
item2 = (FolderItem*)0xdeadbeef;
689
689
+
r = FolderItems_Item(items, str_index2, &item2);
690
690
+
todo_wine {
691
691
+
ok(r == S_FALSE, "file_defs[%d]: expected S_FALSE, got %08x\n", i, r);
692
692
+
ok(!item2, "file_defs[%d]: item is not null\n", i);
693
693
+
}
694
694
+
if (item2) FolderItem_Release(item2);
695
695
+
VariantClear(&str_index2);
696
696
+
697
697
+
/* remove the directory */
698
698
+
ret = RemoveDirectoryA(file_defs[i].name);
699
699
+
ok(ret, "file_defs[%d]: RemoveDirectory failed: %08x\n", i, GetLastError());
700
700
+
}
701
701
+
else
702
702
+
{
703
703
+
ret = DeleteFileA(file_defs[i].name);
704
704
+
ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
705
705
+
}
706
706
+
707
707
+
/* test that the folder item is still accessible by integer index */
708
708
+
item = NULL;
709
709
+
r = FolderItems_Item(items, int_index, &item);
710
710
+
ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
711
711
+
ok(!!item, "file_defs[%d]: item is null\n", i);
712
712
+
713
713
+
bstr = NULL;
714
714
+
r = FolderItem_get_Path(item, &bstr);
715
715
+
ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r);
716
716
+
PathCombineW(path, cur_dir, V_BSTR(&str_index));
717
717
+
ok(!lstrcmpW(bstr, path),
718
718
+
"file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr));
719
719
+
SysFreeString(bstr);
720
720
+
721
721
+
FolderItem_Release(item);
722
722
+
723
723
+
/* test that the folder item is no longer accessible by string index */
724
724
+
item = (FolderItem*)0xdeadbeef;
725
725
+
r = FolderItems_Item(items, str_index, &item);
726
726
+
ok(r == S_FALSE, "file_defs[%d]: expected S_FALSE, got %08x\n", i, r);
727
727
+
ok(!item, "file_defs[%d]: item is not null\n", i);
728
728
+
729
729
+
VariantClear(&str_index);
730
730
+
}
731
731
+
732
732
+
/* test that there are only as many folder items as there were files */
733
733
+
V_I4(&int_index) = sizeof(file_defs)/sizeof(file_defs[0]);
734
734
+
item = (FolderItem*)0xdeadbeef;
735
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
438
-
todo_wine
439
746
ok(r == S_OK, "FolderItems::get_Application failed: %08x\n", r);
440
440
-
todo_wine
441
441
-
ok(!!disp, "disp is null\n");
442
442
-
if (disp) IDispatch_Release(disp);
747
747
+
748
748
+
r = Folder_get_Application(folder, &disp2);
749
749
+
ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r);
750
750
+
ok(disp == disp2, "Unexpected application pointer.\n");
751
751
+
IDispatch_Release(disp2);
752
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
486
-
GetTempPathW(MAX_PATH, wstr);
487
487
-
SetCurrentDirectoryW(wstr);
488
488
-
RemoveDirectoryW(winetestW);
796
796
+
/* remove the temporary directory and restore the original working directory */
797
797
+
GetTempPathW(MAX_PATH, path);
798
798
+
SetCurrentDirectoryW(path);
799
799
+
ret = RemoveDirectoryW(winetestW);
800
800
+
ok(ret, "RemoveDirectory failed: %08x\n", GetLastError());
489
801
SetCurrentDirectoryW(orig_dir);
490
802
803
803
+
/* test that everything stops working after the directory has been removed */
804
804
+
count = -1;
805
805
+
r = FolderItems_get_Count(items, &count);
806
806
+
ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
807
807
+
ok(!count, "expected 0 files, got %d\n", count);
808
808
+
809
809
+
item = NULL;
810
810
+
V_I4(&int_index) = 0;
811
811
+
item = (FolderItem*)0xdeadbeef;
812
812
+
r = FolderItems_Item(items, int_index, &item);
813
813
+
ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
814
814
+
ok(!item, "item is not null\n");
815
815
+
816
816
+
variant_set_string(&str_index, file_defs[0].name);
817
817
+
item = (FolderItem*)0xdeadbeef;
818
818
+
r = FolderItems_Item(items, str_index, &item);
819
819
+
ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
820
820
+
ok(!item, "item is not null\n");
821
821
+
VariantClear(&str_index);
822
822
+
491
823
FolderItems_Release(items);
492
492
-
if (items2) FolderItems2_Release(items2);
824
824
+
Folder_Release(folder);
493
825
if (items3) FolderItems3_Release(items3);
826
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
742
-
/* older versions allowed to regiser SWC_DESKTOP and access it with FindWindowSW */
1075
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
1099
+
1100
1100
+
if (disp == NULL) goto skip_disp_tests;
1101
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
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
937
-
FolderItemVerbs *verbs;
1274
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
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
1313
+
hr = FolderItem_Verbs(item, &verbs2);
1314
1314
+
ok(hr == S_OK, "got 0x%08x\n", hr);
1315
1315
+
ok(verbs2 != verbs, "Unexpected verbs pointer.\n");
1316
1316
+
FolderItemVerbs_Release(verbs2);
1317
1317
+
1318
1318
+
disp = (void *)0xdeadbeef;
1319
1319
+
hr = FolderItemVerbs_get_Application(verbs, &disp);
1320
1320
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
1321
1321
+
ok(disp == NULL, "Unexpected application pointer.\n");
1322
1322
+
1323
1323
+
disp = (void *)0xdeadbeef;
1324
1324
+
hr = FolderItemVerbs_get_Parent(verbs, &disp);
1325
1325
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
1326
1326
+
ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
1327
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
1001
-
ok(str[0] == 0, "%d: got teminating item %s\n", i, wine_dbgstr_w(str));
1354
1354
+
ok(str[0] == 0, "%d: got terminating item %s\n", i, wine_dbgstr_w(str));
1355
1355
+
1356
1356
+
disp = (void *)0xdeadbeef;
1357
1357
+
hr = FolderItemVerb_get_Parent(verb, &disp);
1358
1358
+
ok(hr == E_NOTIMPL, "got %#x.\n", hr);
1359
1359
+
ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
1360
1360
+
1361
1361
+
disp = (void *)0xdeadbeef;
1362
1362
+
hr = FolderItemVerb_get_Application(verb, &disp);
1363
1363
+
ok(hr == E_NOTIMPL, "got %#x.\n", hr);
1364
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
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
22
-
#include "precomp.h"
22
22
+
#define COBJMACROS
23
23
+
24
24
+
#include "initguid.h"
25
25
+
#include "windows.h"
26
26
+
#include "shlguid.h"
27
27
+
#include "shobjidl.h"
28
28
+
#include "shlobj.h"
29
29
+
#include "shellapi.h"
30
30
+
#include "commoncontrols.h"
31
31
+
32
32
+
#include "wine/heap.h"
33
33
+
#include "wine/test.h"
34
34
+
35
35
+
#include "shell32_test.h"
36
36
+
37
37
+
#ifdef __REACTOS__
38
38
+
#include <reactos/undocshell.h>
39
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
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
74
-
pathW=HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
92
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
79
-
HeapFree(GetProcessHeap(), 0, pathW);
97
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
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
148
-
todo_wine ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
167
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
151
-
CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
152
152
-
&IID_IShellLinkW, (LPVOID*)&slW);
170
170
+
strcpy(buffer,"garbage");
171
171
+
memset(&finddata, 0xaa, sizeof(finddata));
172
172
+
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
173
173
+
ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
174
174
+
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
175
175
+
ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
176
176
+
ok(finddata.cFileName[0] == 0, "unexpected filename '%s'\n", finddata.cFileName);
177
177
+
178
178
+
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
179
179
+
&IID_IShellLinkW, (LPVOID*)&slW);
180
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
169
-
todo_wine ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
197
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
210
+
strcpy(buffer,"garbage");
211
211
+
memset(&finddata, 0xaa, sizeof(finddata));
212
212
+
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
213
213
+
ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
214
214
+
ok(lstrcmpiA(buffer,str)==0, "GetPath returned '%s'\n", buffer);
215
215
+
ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
216
216
+
ok(lstrcmpiA(finddata.cFileName, "file") == 0, "unexpected filename '%s'\n", finddata.cFileName);
217
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
231
-
todo_wine
267
267
+
ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
268
268
+
269
269
+
strcpy(buffer,"garbage");
270
270
+
memset(&finddata, 0xaa, sizeof(finddata));
271
271
+
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
272
272
+
ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
232
273
ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
274
274
+
ok(finddata.dwFileAttributes != 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
275
275
+
ok(lstrcmpiA(finddata.cFileName, "regedit.exe") == 0, "unexpected filename '%s'\n", finddata.cFileName);
276
276
+
}
277
277
+
278
278
+
if (pSHGetFolderLocation)
279
279
+
{
280
280
+
LPITEMIDLIST pidl_controls;
281
281
+
282
282
+
r = pSHGetFolderLocation(NULL, CSIDL_CONTROLS, NULL, 0, &pidl_controls);
283
283
+
ok(r == S_OK, "SHGetFolderLocation failed (0x%08x)\n", r);
284
284
+
285
285
+
r = IShellLinkA_SetIDList(sl, pidl_controls);
286
286
+
ok(r == S_OK, "SetIDList failed (0x%08x)\n", r);
287
287
+
288
288
+
strcpy(buffer,"garbage");
289
289
+
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
290
290
+
ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
291
291
+
ok(buffer[0] == 0, "GetPath returned '%s'\n", buffer);
292
292
+
293
293
+
strcpy(buffer,"garbage");
294
294
+
memset(&finddata, 0xaa, sizeof(finddata));
295
295
+
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
296
296
+
ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
297
297
+
ok(buffer[0] == 0, "GetPath returned '%s'\n", buffer);
298
298
+
ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
299
299
+
ok(finddata.cFileName[0] == 0, "unexpected filename '%s'\n", finddata.cFileName);
300
300
+
301
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
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
19
-
#include "precomp.h"
19
19
+
#define COBJMACROS
20
20
+
#define CONST_VTABLE
21
21
+
#ifndef __REACTOS__
22
22
+
#define NONAMELESSUNION
23
23
+
#endif
20
24
21
21
-
#include <initguid.h>
25
25
+
#include <stdio.h>
26
26
+
#include <wine/test.h>
27
27
+
28
28
+
#include "winbase.h"
29
29
+
#include "shlobj.h"
30
30
+
#include "shellapi.h"
31
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
24
-
#include "precomp.h"
24
24
+
#define COBJMACROS
25
25
+
26
26
+
#include <stdarg.h>
27
27
+
#include <stdio.h>
28
28
+
#include "windef.h"
29
29
+
#include "winbase.h"
30
30
+
#include "shlguid.h"
31
31
+
#include "shlobj.h"
32
32
+
#include "shlwapi.h"
33
33
+
#include "knownfolders.h"
34
34
+
#include "shellapi.h"
35
35
+
#include "wine/test.h"
25
36
26
26
-
#include <initguid.h>
37
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
1890
-
BOOL known_folder_found[sizeof(known_folders)/sizeof(known_folders[0])-1];
1901
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
1906
-
ret = MultiByteToWideChar(CP_ACP, 0, hay, -1, wstr, sizeof(wstr)/sizeof(wstr[0]));
1917
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
1959
-
ret = MultiByteToWideChar(CP_ACP, 0, known_folder->sName, -1, sName, sizeof(sName)/sizeof(sName[0]));
1970
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
2055
-
GetTempPathW(sizeof(sExamplePath)/sizeof(sExamplePath[0]), sExamplePath);
2066
2066
+
GetTempPathW(ARRAY_SIZE(sExamplePath), sExamplePath);
2056
2067
lstrcatW(sExamplePath, sExample);
2057
2068
2058
2058
-
GetTempPathW(sizeof(sExample2Path)/sizeof(sExample2Path[0]), sExample2Path);
2069
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
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
2165
-
for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i)
2175
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
2173
-
for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i)
2183
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
2547
-
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
2557
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
2578
-
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
2588
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
2599
-
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
2609
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
2622
-
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
2632
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
2643
-
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
2653
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
2694
-
GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW);
2704
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
22
-
#include "precomp.h"
22
22
+
#include <stdarg.h>
23
23
+
#include <stdio.h>
24
24
+
25
25
+
#define COBJMACROS
26
26
+
#ifndef __REACTOS__
27
27
+
#define NONAMELESSUNION
28
28
+
#define NONAMELESSSTRUCT
29
29
+
#endif
30
30
+
31
31
+
#define WIN32_LEAN_AND_MEAN
32
32
+
#include <windows.h>
33
33
+
#include "shellapi.h"
34
34
+
#include "shlobj.h"
35
35
+
36
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
33
-
#include "precomp.h"
33
33
+
/* Needed to get SEE_MASK_NOZONECHECKS with the PSDK */
34
34
+
#ifndef __REACTOS__
35
35
+
#define NTDDI_WINXPSP1 0x05010100
36
36
+
#define NTDDI_VERSION NTDDI_WINXPSP1
37
37
+
#define _WIN32_WINNT 0x0501
38
38
+
#endif
39
39
+
40
40
+
#include <stdio.h>
41
41
+
#include <assert.h>
42
42
+
43
43
+
#include "wtypes.h"
44
44
+
#include "winbase.h"
45
45
+
#include "windef.h"
46
46
+
#include "shellapi.h"
47
47
+
#include "shlwapi.h"
48
48
+
#include "ddeml.h"
49
49
+
50
50
+
#include "wine/heap.h"
51
51
+
#include "wine/test.h"
52
52
+
53
53
+
#include "shell32_test.h"
54
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
745
-
if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(CHAR))))
766
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
780
-
HeapFree( GetProcessHeap(), 0, lpszName);
801
801
+
heap_free(lpszName);
781
802
if(lpszSubKey)
782
803
RegCloseKey(hSubKey);
783
804
return ret;
···
837
858
}
838
859
else
839
860
{
840
840
-
cmd=HeapAlloc(GetProcessHeap(), 0, strlen(argv0)+10+strlen(child_file)+2+strlen(cmdtail)+1);
861
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
844
-
HeapFree(GetProcessHeap(), 0, cmd);
865
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
21
-
#include "precomp.h"
21
21
+
#include <stdarg.h>
22
22
+
#include <stdio.h>
23
23
+
24
24
+
#define COBJMACROS
25
25
+
#define WINE_NOWINSOCK
26
26
+
#include <windows.h>
27
27
+
#include "shellapi.h"
28
28
+
#include "shlobj.h"
29
29
+
#include "commoncontrols.h"
30
30
+
31
31
+
#include "wine/test.h"
32
32
+
33
33
+
#ifdef __REACTOS__
34
34
+
#include <reactos/undocshell.h>
35
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
21
-
#include "precomp.h"
21
21
+
#include <stdarg.h>
22
22
+
#include <stdio.h>
23
23
+
24
24
+
#define COBJMACROS
25
25
+
#define CONST_VTABLE
26
26
+
27
27
+
#include "windef.h"
28
28
+
#include "winbase.h"
29
29
+
#include "wtypes.h"
30
30
+
#include "shellapi.h"
31
31
+
32
32
+
33
33
+
#include "shlguid.h"
34
34
+
#include "shlobj.h"
35
35
+
#include "shobjidl.h"
36
36
+
#include "shlwapi.h"
37
37
+
#include "ocidl.h"
38
38
+
#include "oleauto.h"
39
39
+
40
40
+
#include "wine/heap.h"
41
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
29
-
static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*);
30
30
-
static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
31
31
-
static HRESULT (WINAPI *pSHGetFolderPathAndSubDirA)(HWND, int, HANDLE, DWORD, LPCSTR, LPSTR);
32
32
-
static BOOL (WINAPI *pSHGetPathFromIDListW)(LPCITEMIDLIST,LPWSTR);
33
33
-
static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
34
34
-
static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
35
35
-
static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
36
36
-
static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
37
37
-
static LPITEMIDLIST (WINAPI *pILFindLastID)(LPCITEMIDLIST);
38
38
-
static void (WINAPI *pILFree)(LPITEMIDLIST);
39
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
49
-
static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
50
50
-
static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*);
51
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
58
-
static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
59
64
static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**);
60
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
75
-
ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
79
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
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
109
-
MAKEFUNC(SHGetFolderPathA);
110
110
-
MAKEFUNC(SHGetFolderPathAndSubDirA);
111
111
-
MAKEFUNC(SHGetPathFromIDListW);
112
112
-
MAKEFUNC(SHGetSpecialFolderPathA);
113
113
-
MAKEFUNC(SHGetSpecialFolderPathW);
114
114
-
MAKEFUNC(SHGetSpecialFolderLocation);
115
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
125
-
#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
126
126
-
MAKEFUNC_ORD(ILFindLastID, 16);
127
127
-
MAKEFUNC_ORD(ILIsEqual, 21);
128
128
-
MAKEFUNC_ORD(ILCombine, 25);
129
129
-
MAKEFUNC_ORD(SHILCreateFromPath, 28);
130
130
-
MAKEFUNC_ORD(ILFree, 155);
131
131
-
MAKEFUNC_ORD(SHSimpleIDListFromPathAW, 162);
132
132
-
#undef MAKEFUNC_ORD
133
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
160
-
161
161
-
hmod = GetModuleHandleA("shlwapi.dll");
162
162
-
pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
163
147
164
148
hmod = GetModuleHandleA("kernel32.dll");
165
149
pIsWow64Process = (void*)GetProcAddress(hmod, "IsWow64Process");
166
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
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
214
-
/* null name and pidl, also crashes on Windows 8 */
196
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
228
-
win_skip("Tests would crash on W2K and below\n");
210
210
+
win_skip("SHCreateShellItem requires XP SP1 or later\n");
229
211
230
212
MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH);
231
231
-
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
232
232
-
NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
233
233
-
todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
234
234
-
"ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
213
213
+
hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
214
214
+
todo_wine ok(hr == S_OK, "ParseDisplayName returned %08x, expected SUCCESS\n", hr);
235
215
if (hr == S_OK)
236
216
{
237
237
-
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
238
238
-
"PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
217
217
+
ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
218
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
245
-
todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
246
246
-
"ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
225
225
+
todo_wine ok(hr == S_OK, "ParseDisplayName returned %08x, expected SUCCESS\n", hr);
247
226
if (hr == S_OK)
248
227
{
249
249
-
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
250
250
-
"PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
228
228
+
ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
229
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
262
-
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
241
241
+
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
263
242
NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
264
264
-
ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL),
265
265
-
"ParseDisplayName returned %08x, expected 80070002 or E_FAIL\n", hr);
243
243
+
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
244
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
275
-
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
254
254
+
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
276
255
NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
277
277
-
ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL) || (hr == E_INVALIDARG),
278
278
-
"ParseDisplayName returned %08x, expected 80070002, E_FAIL or E_INVALIDARG\n", hr);
256
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
283
-
if (!pSHGetSpecialFolderPathW || !pILFindLastID)
284
284
-
{
285
285
-
win_skip("SHGetSpecialFolderPathW and/or ILFindLastID are not available\n");
286
286
-
goto finished;
287
287
-
}
288
261
289
289
-
bRes = pSHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE);
262
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
297
-
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 ||
298
298
-
pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */
299
299
-
"Last pidl should be of type PT_FOLDER or PT_IESPECIAL2, but is: %02x\n",
300
300
-
pILFindLastID(newPIDL)->mkid.abID[0]);
270
270
+
ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x31,
271
271
+
"Last pidl should be of type PT_FOLDER, but is: %02x\n",
272
272
+
ILFindLastID(newPIDL)->mkid.abID[0]);
301
273
IMalloc_Free(ppM, newPIDL);
302
302
-
274
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
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
433
-
ok(flags == attrs[i] ||
434
434
-
flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR), /* Win9x, NT4 */
435
435
-
"GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
404
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
496
-
if (0)
497
497
-
{
498
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
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
528
-
if (0)
529
529
-
{
530
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
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
570
-
ok(hr == S_OK ||
571
571
-
broken(hr == E_NOINTERFACE), /* Win9x, NT4, W2K */
572
572
-
"Got 0x%08x\n", hr);
531
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
578
-
/* CLSID_ShellFSFolder on some w2k systems */
579
579
-
ok(IsEqualIID(&id, &CLSID_ShellDocObjView) || broken(IsEqualIID(&id, &CLSID_ShellFSFolder)),
580
580
-
"Unexpected classid %s\n", wine_dbgstr_guid(&id));
537
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
586
-
pILFree(pidl);
543
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
607
-
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
608
608
-
hr == E_INVALIDARG || /* W2K item in top dir */
609
609
-
broken(hr == S_OK), /* Win9x, NT4, W2K */
564
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
612
-
pILFree(pidl);
567
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
633
-
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
634
634
-
hr == E_INVALIDARG || /* W2K item in top dir */
635
635
-
broken(hr == S_OK), /* Win9x, NT4, W2K */
588
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
638
-
pILFree(pidl);
591
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
646
-
if(pSHGetSpecialFolderPathA)
647
647
-
{
648
648
-
pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
649
649
-
lstrcatA(pathA, "\\");
650
650
-
lstrcatA(pathA, filename_html);
651
651
-
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
652
652
-
if(hfile != INVALID_HANDLE_VALUE)
653
653
-
{
654
654
-
CloseHandle(hfile);
655
655
-
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
656
656
-
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
657
657
-
ok(hr == S_OK, "Got 0x%08x\n", hr);
658
658
-
if(SUCCEEDED(hr))
659
659
-
{
660
660
-
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
661
661
-
ok(hr == S_OK ||
662
662
-
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
663
663
-
"Got 0x%08x\n", hr);
664
664
-
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
665
665
-
pILFree(pidl);
666
666
-
}
667
667
-
if(!DeleteFileA(pathA))
668
668
-
trace("Failed to delete: %d\n", GetLastError());
599
599
+
SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
600
600
+
lstrcatA(pathA, "\\");
601
601
+
lstrcatA(pathA, filename_html);
602
602
+
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
669
603
670
670
-
}
671
671
-
else
672
672
-
win_skip("Failed to create .html testfile.\n");
604
604
+
CloseHandle(hfile);
605
605
+
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
606
606
+
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
607
607
+
ok(hr == S_OK, "Got 0x%08x\n", hr);
608
608
+
609
609
+
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild);
610
610
+
ok(hr == S_OK ||
611
611
+
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
612
612
+
"Got 0x%08x\n", hr);
613
613
+
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
614
614
+
ILFree(pidl);
615
615
+
if(!DeleteFileA(pathA))
616
616
+
trace("Failed to delete: %d\n", GetLastError());
617
617
+
618
618
+
SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
619
619
+
lstrcatA(pathA, "\\");
620
620
+
lstrcatA(pathA, filename_foo);
621
621
+
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
622
622
+
623
623
+
CloseHandle(hfile);
624
624
+
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
625
625
+
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
626
626
+
ok(hr == S_OK, "Got 0x%08x\n", hr);
673
627
674
674
-
pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
675
675
-
lstrcatA(pathA, "\\");
676
676
-
lstrcatA(pathA, filename_foo);
677
677
-
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
678
678
-
if(hfile != INVALID_HANDLE_VALUE)
679
679
-
{
680
680
-
CloseHandle(hfile);
681
681
-
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
682
682
-
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
683
683
-
ok(hr == S_OK, "Got 0x%08x\n", hr);
684
684
-
if(SUCCEEDED(hr))
685
685
-
{
686
686
-
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
687
687
-
ok(hr == E_FAIL || /* Vista+ */
688
688
-
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
689
689
-
broken(hr == S_OK), /* Win9x, NT4, W2K */
690
690
-
"Got 0x%08x\n", hr);
691
691
-
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
692
692
-
pILFree(pidl);
693
693
-
}
694
694
-
DeleteFileA(pathA);
695
695
-
}
696
696
-
else
697
697
-
win_skip("Failed to create .foo testfile.\n");
698
698
-
}
628
628
+
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild);
629
629
+
ok(hr == E_FAIL || /* Vista+ */
630
630
+
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
631
631
+
"Got 0x%08x\n", hr);
632
632
+
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
633
633
+
ILFree(pidl);
634
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
657
+
/* It's ok to use this fixed path. Call will fail anyway. */
658
658
+
WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
659
659
+
LPITEMIDLIST pidlNew;
660
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
729
-
if(!pSHGetSpecialFolderPathA) {
730
730
-
win_skip("SHGetSpecialFolderPathA is not available\n");
731
731
-
return;
732
732
-
}
733
733
-
734
669
/* First creating a directory in MyDocuments and a file in this directory. */
735
735
-
result = pSHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE);
670
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
771
-
pidlLast = pILFindLastID(pidlTestFile);
772
772
-
ok(pidlLast->mkid.cb >=76 ||
773
773
-
broken(pidlLast->mkid.cb == 28) || /* W2K */
774
774
-
broken(pidlLast->mkid.cb == 40), /* Win9x, WinME */
775
775
-
"Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb);
706
706
+
pidlLast = ILFindLastID(pidlTestFile);
707
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
793
-
hr == E_NOTIMPL || /* Vista */
794
794
-
broken(hr == S_OK), /* Win9x, W2K */
725
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
800
-
if (!pSHBindToParent)
801
801
-
{
802
802
-
win_skip("SHBindToParent is missing\n");
803
803
-
DeleteFileA(szTestFile);
804
804
-
RemoveDirectoryA(szTestDir);
805
805
-
return;
806
806
-
}
807
807
-
808
731
/* Some tests for IShellFolder::SetNameOf */
809
809
-
if (pSHGetFolderPathAndSubDirA)
810
810
-
{
811
811
-
hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
812
812
-
ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
813
813
-
if (hr == S_OK) {
814
814
-
/* It's ok to use this fixed path. Call will fail anyway. */
815
815
-
WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
816
816
-
LPITEMIDLIST pidlNew;
732
732
+
hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
733
733
+
ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
817
734
818
818
-
/* The pidl returned through the last parameter of SetNameOf is a simple one. */
819
819
-
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
820
820
-
ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
821
821
-
if (hr == S_OK)
822
822
-
{
823
823
-
ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
824
824
-
"pidl returned from SetNameOf should be simple!\n");
735
735
+
/* The pidl returned through the last parameter of SetNameOf is a simple one. */
736
736
+
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
737
737
+
ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
825
738
826
826
-
/* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
827
827
-
* is implemented on top of SHFileOperation in WinXP. */
828
828
-
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
829
829
-
SHGDN_FORPARSING, NULL);
830
830
-
ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
739
739
+
ok (((ITEMIDLIST *)((BYTE *)pidlNew + pidlNew->mkid.cb))->mkid.cb == 0,
740
740
+
"pidl returned from SetNameOf should be simple!\n");
831
741
832
832
-
/* Rename the file back to its original name. SetNameOf ignores the fact, that the
833
833
-
* SHGDN flags specify an absolute path. */
834
834
-
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
835
835
-
ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
742
742
+
/* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
743
743
+
* is implemented on top of SHFileOperation in WinXP. */
744
744
+
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename, SHGDN_FORPARSING, NULL);
745
745
+
ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
836
746
837
837
-
pILFree(pidlNew);
838
838
-
}
747
747
+
/* Rename the file back to its original name. SetNameOf ignores the fact, that the
748
748
+
* SHGDN flags specify an absolute path. */
749
749
+
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
750
750
+
ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
839
751
840
840
-
IShellFolder_Release(psfPersonal);
841
841
-
}
842
842
-
}
843
843
-
else
844
844
-
win_skip("Avoid needs of interaction on Win2k\n");
752
752
+
ILFree(pidlNew);
753
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
851
-
if (pSHGetPathFromIDListW)
852
852
-
{
853
853
-
result = pSHGetPathFromIDListW(pidlTestFile, wszTestFile2);
854
854
-
ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
855
855
-
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
856
856
-
}
760
760
+
result = SHGetPathFromIDListW(pidlTestFile, wszTestFile2);
761
761
+
ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
762
762
+
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
857
763
858
764
/* SHBindToParent fails, if called with a NULL PIDL. */
859
859
-
hr = pSHBindToParent(NULL, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
860
860
-
ok (hr != S_OK, "SHBindToParent(NULL) should fail!\n");
765
765
+
hr = SHBindToParent(NULL, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
766
766
+
ok (hr == E_INVALIDARG || broken(hr == E_OUTOFMEMORY) /* XP */,
767
767
+
"SHBindToParent(NULL) should fail! hr = %08x\n", hr);
861
768
862
769
/* But it succeeds with an empty PIDL. */
863
863
-
hr = pSHBindToParent(pidlEmpty, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
770
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
868
-
775
775
+
869
776
/* Binding to the folder and querying the display name of the file also works. */
870
870
-
hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
777
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
877
-
/* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into
784
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
879
-
ok (pILFindLastID(pidlTestFile) == pidlLast,
786
786
+
ok (ILFindLastID(pidlTestFile) == pidlLast,
880
787
"SHBindToParent doesn't return the last id of the pidl param!\n");
881
881
-
788
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
890
-
if (pStrRetToBufW)
891
891
-
{
892
892
-
hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
893
893
-
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
894
894
-
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
895
895
-
}
896
896
-
797
797
+
hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
798
798
+
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
799
799
+
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
800
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
934
-
935
935
-
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
838
838
+
839
839
+
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
936
840
&pidlMyDocuments, NULL);
937
937
-
ok (hr == S_OK ||
938
938
-
broken(hr == E_INVALIDARG), /* Win95, NT4 */
841
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
1033
-
static const DWORD desktopFlags[] = {
1034
1034
-
/* WinXP */
1035
1035
-
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR |
1036
1036
-
SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER,
1037
1037
-
/* Win2k */
1038
1038
-
SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_STREAM | SFGAO_FILESYSANCESTOR |
1039
1039
-
SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER,
1040
1040
-
/* WinMe, Win9x, WinNT*/
1041
1041
-
SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSANCESTOR |
1042
1042
-
SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER
1043
1043
-
};
1044
1044
-
static const DWORD myComputerFlags[] = {
1045
1045
-
/* WinXP */
1046
1046
-
SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET |
1047
1047
-
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
1048
1048
-
/* Win2k */
1049
1049
-
SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_STREAM |
1050
1050
-
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
1051
1051
-
/* WinMe, Win9x, WinNT */
1052
1052
-
SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR |
1053
1053
-
SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
1054
1054
-
/* Win95, WinNT when queried directly */
1055
1055
-
SFGAO_CANLINK | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR |
1056
1056
-
SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER
1057
1057
-
};
1058
1058
-
WCHAR wszMyComputer[] = {
936
936
+
static const DWORD desktopFlags = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
937
937
+
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
938
938
+
static const DWORD myComputerFlags = SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
939
939
+
SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
940
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
1066
-
int len, i;
1067
1067
-
BOOL foundFlagsMatch;
948
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
1077
-
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
1078
1078
-
i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
1079
1079
-
{
1080
1080
-
if (desktopFlags[i] == dwFlags)
1081
1081
-
foundFlagsMatch = TRUE;
1082
1082
-
}
1083
1083
-
ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags);
958
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
1089
-
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
1090
1090
-
i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
1091
1091
-
{
1092
1092
-
if (desktopFlags[i] == dwFlags)
1093
1093
-
foundFlagsMatch = TRUE;
1094
1094
-
}
1095
1095
-
ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags);
1096
1096
-
964
964
+
ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags);
965
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
1111
-
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
1112
1112
-
i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
1113
1113
-
{
1114
1114
-
if ((myComputerFlags[i] | SFGAO_CANLINK) == dwFlags)
1115
1115
-
foundFlagsMatch = TRUE;
1116
1116
-
}
1117
980
todo_wine
1118
1118
-
ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
981
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
1128
-
ok (hr == E_INVALIDARG ||
1129
1129
-
broken(hr == S_OK), /* W2K and earlier */
1130
1130
-
"MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr);
991
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
1135
-
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
1136
1136
-
i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
1137
1137
-
{
1138
1138
-
if (myComputerFlags[i] == dwFlags)
1139
1139
-
foundFlagsMatch = TRUE;
1140
1140
-
}
1141
996
todo_wine
1142
1142
-
ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
997
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
1230
-
if(!pSHGetPathFromIDListW || !pSHGetSpecialFolderPathW)
1231
1231
-
{
1232
1232
-
win_skip("SHGetPathFromIDListW() or SHGetSpecialFolderPathW() is missing\n");
1233
1233
-
return;
1234
1234
-
}
1235
1235
-
1236
1085
/* Calling SHGetPathFromIDListW with no pidl should return the empty string */
1237
1086
wszPath[0] = 'a';
1238
1087
wszPath[1] = '\0';
1239
1239
-
result = pSHGetPathFromIDListW(NULL, wszPath);
1088
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
1244
-
result = pSHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
1093
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
1248
-
/* Check if we are on Win9x */
1249
1249
-
SetLastError(0xdeadbeef);
1250
1250
-
lstrcmpiW(wszDesktop, wszDesktop);
1251
1251
-
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
1252
1252
-
{
1253
1253
-
win_skip("Most W-calls are not implemented\n");
1254
1254
-
return;
1255
1255
-
}
1256
1256
-
1257
1257
-
result = pSHGetPathFromIDListW(pidlEmpty, wszPath);
1097
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
1277
-
result = pSHGetPathFromIDListW(pidlMyComputer, wszPath);
1117
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
1290
-
result = pSHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE);
1130
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
1325
-
if (pStrRetToBufW)
1326
1326
-
{
1327
1327
-
pStrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
1328
1328
-
ok(0 == lstrcmpW(wszFileName, wszPath),
1329
1329
-
"Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
1330
1330
-
"returned incorrect path for file placed on desktop\n");
1331
1331
-
}
1165
1165
+
StrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
1166
1166
+
ok(0 == lstrcmpW(wszFileName, wszPath),
1167
1167
+
"Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
1168
1168
+
"returned incorrect path for file placed on desktop\n");
1332
1169
1333
1333
-
result = pSHGetPathFromIDListW(pidlTestFile, wszPath);
1170
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
1365
-
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
1202
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
1369
-
result = pSHGetPathFromIDListW(pidlPrograms, wszPath);
1206
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
1462
-
1299
1299
+
1463
1300
if (!lstrcmpW(pszPropName, wszTargetSpecialFolder)) {
1464
1464
-
ok(V_VT(pVar) == VT_I4 ||
1465
1465
-
broken(V_VT(pVar) == VT_BSTR), /* Win2k */
1466
1466
-
"Wrong variant type for 'TargetSpecialFolder' property!\n");
1301
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
1479
-
1480
1480
-
ok(V_VT(pVar) == VT_BSTR ||
1481
1481
-
broken(V_VT(pVar) == VT_EMPTY), /* Win2k */
1482
1482
-
"Wrong variant type for 'Target' property!\n");
1314
1314
+
1315
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
1485
-
result = pSHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE);
1318
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
1562
-
if (!pSHGetSpecialFolderPathW || !pStrRetToBufW) {
1563
1563
-
win_skip("SHGetSpecialFolderPathW and/or StrRetToBufW are not available\n");
1564
1564
-
return;
1565
1565
-
}
1566
1566
-
1567
1567
-
if (!pSHGetFolderPathAndSubDirA)
1568
1568
-
{
1569
1569
-
win_skip("FolderShortcut test doesn't work on Win2k\n");
1570
1570
-
return;
1571
1571
-
}
1572
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
1607
-
result = pSHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);
1429
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
1611
-
pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
1433
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
1652
-
pILFree(pidlWineTestFolder);
1474
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
1658
-
ok(pILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
1480
1480
+
ok(ILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
1659
1481
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n");
1660
1660
-
pILFree(pidlCurrentFolder);
1661
1661
-
pILFree(pidlWineTestFolder);
1482
1482
+
ILFree(pidlCurrentFolder);
1483
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
1675
-
pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
1497
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
1699
-
pILFree(pidlSubFolder);
1521
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
1751
-
if (!pSHGetSpecialFolderPathW) return;
1752
1752
-
1753
1753
-
bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
1573
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
1780
-
pILFree(pidlPersonal);
1600
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
1821
-
ok(pidlFile->mkid.abID[18] == '~' ||
1822
1822
-
broken(pidlFile->mkid.abID[34] == '~'), /* Win2k */
1823
1823
-
"Should be derived 8.3 name!\n");
1641
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
1826
-
ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0' ||
1827
1827
-
broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1), /* Win2k */
1644
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
1837
-
cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)) ||
1838
1838
-
broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1) || /* Win2k on short names */
1839
1839
-
broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 12 + 1), /* Win2k on long names */
1654
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
1891
-
pILFree(pidlFile);
1706
1706
+
ILFree(pidlFile);
1892
1707
}
1893
1708
1894
1709
IShellFolder_Release(psfPersonal);
···
1904
1719
HRESULT hr;
1905
1720
HKEY key;
1906
1721
1907
1907
-
if (!pSHGetFolderPathA)
1908
1908
-
{
1909
1909
-
win_skip("SHGetFolderPathA not present\n");
1910
1910
-
return;
1911
1911
-
}
1912
1722
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
1913
1723
1914
1914
-
hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path );
1724
1724
+
hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path );
1915
1725
ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr );
1916
1916
-
hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
1726
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
1949
-
hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path );
1759
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
1951
-
hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
1761
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
1996
-
if(!pSHGetFolderPathAndSubDirA)
1997
1997
-
{
1998
1998
-
win_skip("SHGetFolderPathAndSubDirA not present!\n");
1999
1999
-
return;
2000
2000
-
}
2001
2001
-
2002
2002
-
if(!pSHGetFolderPathA) {
2003
2003
-
win_skip("SHGetFolderPathA not present!\n");
2004
2004
-
return;
2005
2005
-
}
2006
2006
-
if(FAILED(pSHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata)))
1806
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
2027
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath);
1827
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
2031
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath);
1831
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
2047
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath);
1847
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
2052
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath);
1852
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
2057
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath);
1857
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
2064
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath);
1864
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
2069
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL);
1869
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
2074
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
1874
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
2080
-
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
1880
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
2165
-
if (hr == S_OK && pStrRetToBufW)
2166
2166
-
{
2167
2167
-
hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
2168
2168
-
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
2169
2169
-
todo_wine
2170
2170
-
ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
2171
2171
-
broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
2172
2172
-
"GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
2173
2173
-
}
1965
1965
+
hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
1966
1966
+
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
1967
1967
+
todo_wine
1968
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
2179
-
if (hr == S_OK && pStrRetToBufW)
2180
2180
-
{
2181
2181
-
hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
2182
2182
-
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
2183
2183
-
todo_wine
2184
2184
-
ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
2185
2185
-
broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
2186
2186
-
"GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
2187
2187
-
}
1974
1974
+
hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
1975
1975
+
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
1976
1976
+
todo_wine
1977
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
2193
-
if (hr == S_OK && pStrRetToBufW)
2194
2194
-
{
2195
2195
-
hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
2196
2196
-
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
2197
2197
-
ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
2198
2198
-
}
1983
1983
+
hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
1984
1984
+
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
1985
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
2237
-
if(pSHGetSpecialFolderLocation)
2238
2238
-
{
2239
2239
-
ret = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
2240
2240
-
ok(ret == S_OK, "Got 0x%08x\n", ret);
2241
2241
-
}
2242
2242
-
else
2243
2243
-
{
2244
2244
-
win_skip("pSHGetSpecialFolderLocation missing.\n");
2245
2245
-
pidl_desktop = NULL;
2246
2246
-
}
2024
2024
+
ret = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
2025
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
2264
-
pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile);
2043
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
2292
-
pILFree(pidl_test);
2071
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
2312
-
pILFree(pidl_test);
2091
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
2330
-
pILFree(pidl_test);
2109
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
2353
-
pILFree(pidl_test);
2132
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
2374
-
pILFree(pidl_test);
2153
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
2394
-
pILFree(pidl_test);
2173
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
2479
-
pILFree(pidl_test);
2258
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
2499
-
pILFree(pidl_test);
2278
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
2576
-
pILFree(pidl_desktop_testfile);
2355
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
2667
-
pILFree(pidl_desktop_testfile);
2446
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
2699
-
pILFree(pidl_abstestfile);
2700
2700
-
pILFree(pidl_testfile);
2701
2701
-
pILFree(pidl_desktop);
2702
2702
-
pILFree(pidl_cwd);
2478
2478
+
ILFree(pidl_abstestfile);
2479
2479
+
ILFree(pidl_testfile);
2480
2480
+
ILFree(pidl_desktop);
2481
2481
+
ILFree(pidl_cwd);
2703
2482
IShellFolder_Release(currentfolder);
2704
2483
IShellFolder_Release(desktopfolder);
2705
2484
}
···
2723
2502
return;
2724
2503
}
2725
2504
2726
2726
-
/* These should be available on any platform that passed the above test. */
2505
2505
+
/* This should be available on any platform that passed the above test. */
2727
2506
ok(pSHCreateShellItem != NULL, "SHCreateShellItem missing.\n");
2728
2728
-
ok(pSHBindToParent != NULL, "SHBindToParent missing.\n");
2729
2729
-
ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
2730
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
2742
-
hres = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
2518
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
2770
-
pStrRetToBufW(&strret, NULL, buf, MAX_PATH);
2546
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
2781
-
if(pSHGetPathFromIDListW){
2782
2782
-
hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
2783
2783
-
ok(hrSI == S_OK, "Got 0x%08x\n", hrSI);
2784
2784
-
res = pSHGetPathFromIDListW(pidl, buf);
2785
2785
-
ok(res == TRUE, "Got %d\n", res);
2786
2786
-
if(SUCCEEDED(hrSI) && res)
2787
2787
-
ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
2788
2788
-
if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
2789
2789
-
}else
2790
2790
-
win_skip("pSHGetPathFromIDListW not available\n");
2557
2557
+
hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
2558
2558
+
ok(hrSI == S_OK, "Got 0x%08x\n", hrSI);
2559
2559
+
res = SHGetPathFromIDListW(pidl, buf);
2560
2560
+
ok(res == TRUE, "Got %d\n", res);
2561
2561
+
if(SUCCEEDED(hrSI) && res)
2562
2562
+
ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
2563
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
2798
-
pILFree(pidl);
2571
2571
+
ILFree(pidl);
2799
2572
2800
2573
/* Test the control panel */
2801
2801
-
hres = pSHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl);
2574
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
2829
-
pStrRetToBufW(&strret, NULL, buf, MAX_PATH);
2602
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
2840
-
if(pSHGetPathFromIDListW){
2841
2841
-
hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
2842
2842
-
ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI);
2843
2843
-
res = pSHGetPathFromIDListW(pidl, buf);
2844
2844
-
ok(res == FALSE, "Got %d\n", res);
2845
2845
-
if(SUCCEEDED(hrSI) && res)
2846
2846
-
ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
2847
2847
-
if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
2848
2848
-
}else
2849
2849
-
win_skip("pSHGetPathFromIDListW not available\n");
2613
2613
+
hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
2614
2614
+
ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI);
2615
2615
+
res = SHGetPathFromIDListW(pidl, buf);
2616
2616
+
ok(res == FALSE, "Got %d\n", res);
2617
2617
+
if(SUCCEEDED(hrSI) && res)
2618
2618
+
ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
2619
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
2858
-
pILFree(pidl);
2628
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
2963
-
pILFree(apidl[i]);
2733
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
3038
-
pILFree(pidl_testfile);
2808
2808
+
ILFree(pidl_testfile);
3039
2809
}
3040
2810
if(FAILED(hr)) failed = TRUE;
3041
2811
}
···
3270
3040
return;
3271
3041
}
3272
3042
3273
3273
-
ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
3274
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
3285
-
punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl));
3053
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
3302
-
HeapFree(GetProcessHeap(), 0, punkimpl);
3070
3070
+
heap_free(punkimpl);
3303
3071
3304
3072
pidl_desktop = NULL;
3305
3305
-
pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
3073
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
3323
-
pILFree(pidl);
3091
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
3337
-
pILFree(pidl);
3105
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
3354
-
pILFree(pidl);
3122
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
3381
-
pILFree(pidl);
3149
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
3409
-
pILFree(apidl[i]);
3177
3177
+
ILFree(apidl[i]);
3410
3178
3411
3179
IEnumIDList_Release(peidl);
3412
3180
}
···
3415
3183
}
3416
3184
3417
3185
IShellFolder_Release(psfdesktop);
3418
3418
-
pILFree(pidl_desktop);
3186
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
3456
-
punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl));
3224
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
3474
-
HeapFree(GetProcessHeap(), 0, punkimpl);
3242
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
3510
-
3511
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
3532
-
pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
3298
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
3535
-
pILFree(pidl);
3301
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
3556
-
pILFree(pidl_testdir);
3322
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
3608
-
pILFree(pidl);
3374
3374
+
ILFree(pidl);
3609
3375
}
3610
3376
IShellItem_Release(psi);
3611
3377
}
3612
3612
-
pILFree(pidl_abs);
3378
3378
+
ILFree(pidl_abs);
3613
3379
}
3614
3380
for(i = 0; i < done; i++)
3615
3615
-
pILFree(apidl[i]);
3381
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
3660
-
pILFree(pidl1);
3661
3661
-
pILFree(pidl2);
3426
3426
+
ILFree(pidl1);
3427
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
3736
-
pILFree(pidl);
3502
3502
+
ILFree(pidl);
3737
3503
IShellItem_Release(psi);
3738
3504
}
3739
3739
-
pILFree(pidl_abs);
3505
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
3748
-
pILFree(apidl[i]);
3514
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
3827
-
result = pSHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE);
3593
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
3932
-
pILFree(pidltest1);
3698
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
3941
-
pILFree(pidl_testdir);
3707
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
3975
-
pILFree(pidl_testdir);
3741
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
4094
-
pILFree(apidl[i]);
3860
3860
+
ILFree(apidl[i]);
4095
3861
}
4096
3862
}
4097
3863
···
4108
3874
return;
4109
3875
}
4110
3876
4111
4111
-
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
3877
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
4146
-
pILFree(pidl_tmp);
3912
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
4260
-
pILFree(pidl_desktop);
4026
4026
+
ILFree(pidl_desktop);
4261
4027
}
4262
4028
4263
4029
static void test_ShellItemGetAttributes(void)
···
4278
4044
return;
4279
4045
}
4280
4046
4281
4281
-
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
4047
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
4287
-
pILFree(pidl_desktop);
4053
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
4322
-
pILFree(pidl);
4088
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
4330
-
pILFree(pidl);
4096
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
4405
-
pILFree((LPITEMIDLIST)pidl_array[i]);
4171
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
4483
-
if (!pSHParseDisplayName)
4484
4484
-
{
4485
4485
-
win_skip("SHParseDisplayName isn't available\n");
4486
4486
-
return;
4487
4487
-
}
4488
4488
-
4489
4249
if (0)
4490
4250
{
4491
4251
/* crashes on native */
4492
4492
-
pSHParseDisplayName(NULL, NULL, NULL, 0, NULL);
4252
4252
+
SHParseDisplayName(NULL, NULL, NULL, 0, NULL);
4493
4253
nameW[0] = 0;
4494
4494
-
pSHParseDisplayName(nameW, NULL, NULL, 0, NULL);
4254
4254
+
SHParseDisplayName(nameW, NULL, NULL, 0, NULL);
4495
4255
}
4496
4256
4497
4257
pidl1 = (LPITEMIDLIST)0xdeadbeef;
4498
4498
-
hr = pSHParseDisplayName(NULL, NULL, &pidl1, 0, NULL);
4258
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
4505
-
hr = pSHParseDisplayName(nameW, NULL, &pidl1, 0, NULL);
4265
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
4511
-
ret = pILIsEqual(pidl1, pidl2);
4271
4271
+
ret = ILIsEqual(pidl1, pidl2);
4512
4272
ok(ret == TRUE, "expected equal idls\n");
4513
4513
-
pILFree(pidl1);
4514
4514
-
pILFree(pidl2);
4273
4273
+
ILFree(pidl1);
4274
4274
+
ILFree(pidl2);
4515
4275
4516
4276
/* with path */
4517
4277
GetWindowsDirectoryW( dirW, MAX_PATH );
4518
4278
4519
4519
-
hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
4279
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
4524
-
ret = pILIsEqual(pidl1, pidl2);
4284
4284
+
ret = ILIsEqual(pidl1, pidl2);
4525
4285
ok(ret == TRUE, "expected equal idls\n");
4526
4526
-
pILFree(pidl1);
4527
4527
-
pILFree(pidl2);
4286
4286
+
ILFree(pidl1);
4287
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
4531
-
if (is_wow64 && pGetSystemWow64DirectoryW)
4291
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
4537
-
hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
4297
4297
+
hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
4538
4298
ok(hr == S_OK, "failed %08x\n", hr);
4539
4299
*dirW = 0;
4540
4540
-
len = pGetSystemWow64DirectoryW(dirW, MAX_PATH);
4300
4300
+
len = GetSystemWow64DirectoryW(dirW, MAX_PATH);
4541
4301
ok(len > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError());
4542
4542
-
hr = pSHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
4302
4302
+
hr = SHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
4543
4303
ok(hr == S_OK, "failed %08x\n", hr);
4544
4544
-
ret = pILIsEqual(pidl1, pidl2);
4304
4304
+
ret = ILIsEqual(pidl1, pidl2);
4545
4305
ok(ret == FALSE, "expected different idls\n");
4546
4546
-
pILFree(pidl1);
4547
4547
-
pILFree(pidl2);
4306
4306
+
ILFree(pidl1);
4307
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
4557
-
hr = pSHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
4317
4317
+
hr = SHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
4558
4318
ok(hr == S_OK, "failed %08x\n", hr);
4559
4559
-
if (SUCCEEDED(hr)) pILFree(pidl1);
4319
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
4575
-
ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* NT4, W9X */, "failed %08x\n", hr);
4335
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
4611
-
if(SUCCEEDED(hr)) pILFree(pidl);
4371
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
4379
+
static void test_contextmenu_qi(IContextMenu *menu, BOOL todo)
4380
4380
+
{
4381
4381
+
IUnknown *unk;
4382
4382
+
HRESULT hr;
4383
4383
+
4384
4384
+
hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk);
4385
4385
+
todo_wine_if(todo)
4386
4386
+
ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
4387
4387
+
if (hr == S_OK)
4388
4388
+
IUnknown_Release(unk);
4389
4389
+
4390
4390
+
hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk);
4391
4391
+
todo_wine_if(todo)
4392
4392
+
ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
4393
4393
+
if (hr == S_OK)
4394
4394
+
IUnknown_Release(unk);
4395
4395
+
}
4396
4396
+
4397
4397
+
static void test_contextmenu(IContextMenu *menu, BOOL background)
4398
4398
+
{
4399
4399
+
HMENU hmenu = CreatePopupMenu();
4400
4400
+
const int id_upper_limit = 32767;
4401
4401
+
const int baseItem = 0x40;
4402
4402
+
INT max_id, max_id_check;
4403
4403
+
UINT count, i;
4404
4404
+
HRESULT hr;
4405
4405
+
4406
4406
+
test_contextmenu_qi(menu, FALSE);
4407
4407
+
4408
4408
+
hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
4409
4409
+
ok(SUCCEEDED(hr), "Failed to query the menu, hr %#x.\n", hr);
4410
4410
+
4411
4411
+
max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */
4412
4412
+
ok(max_id <= id_upper_limit, "Got %d\n", max_id);
4413
4413
+
count = GetMenuItemCount(hmenu);
4414
4414
+
ok(count, "Got %d\n", count);
4415
4415
+
4416
4416
+
max_id_check = 0;
4417
4417
+
for (i = 0; i < count; i++)
4418
4418
+
{
4419
4419
+
MENUITEMINFOA mii;
4420
4420
+
INT res;
4421
4421
+
char buf[255], buf2[255];
4422
4422
+
ZeroMemory(&mii, sizeof(MENUITEMINFOA));
4423
4423
+
mii.cbSize = sizeof(MENUITEMINFOA);
4424
4424
+
mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
4425
4425
+
mii.dwTypeData = buf2;
4426
4426
+
mii.cch = sizeof(buf2);
4427
4427
+
4428
4428
+
res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
4429
4429
+
ok(res, "Failed to get menu item info, error %d.\n", GetLastError());
4430
4430
+
4431
4431
+
ok((mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR),
4432
4432
+
"Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType);
4433
4433
+
if (!(mii.fType & MFT_SEPARATOR))
4434
4434
+
{
4435
4435
+
max_id_check = (mii.wID > max_id_check) ? mii.wID : max_id_check;
4436
4436
+
hr = IContextMenu_GetCommandString(menu, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf));
4437
4437
+
todo_wine_if(background)
4438
4438
+
ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData);
4439
4439
+
if (SUCCEEDED(hr))
4440
4440
+
trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData);
4441
4441
+
else if (hr == E_NOTIMPL)
4442
4442
+
trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData);
4443
4443
+
}
4444
4444
+
}
4445
4445
+
max_id_check -= baseItem;
4446
4446
+
ok((max_id_check == max_id) ||
4447
4447
+
(max_id_check == max_id-1) || /* Win 7 */
4448
4448
+
(max_id_check == max_id-2) || /* Win 8 */
4449
4449
+
(max_id_check == max_id-3),
4450
4450
+
"Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
4451
4451
+
4452
4452
+
if (count)
4453
4453
+
{
4454
4454
+
CMINVOKECOMMANDINFO cmi;
4455
4455
+
4456
4456
+
memset(&cmi, 0, sizeof(CMINVOKECOMMANDINFO));
4457
4457
+
cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
4458
4458
+
4459
4459
+
/* Attempt to execute a nonexistent command */
4460
4460
+
cmi.lpVerb = MAKEINTRESOURCEA(9999);
4461
4461
+
hr = IContextMenu_InvokeCommand(menu, &cmi);
4462
4462
+
todo_wine_if(background)
4463
4463
+
ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
4464
4464
+
4465
4465
+
cmi.lpVerb = "foobar_wine_test";
4466
4466
+
hr = IContextMenu_InvokeCommand(menu, &cmi);
4467
4467
+
todo_wine_if(background)
4468
4468
+
ok((hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) ||
4469
4469
+
(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */),
4470
4470
+
"Unexpected hr %#x.\n", hr);
4471
4471
+
}
4472
4472
+
4473
4473
+
DestroyMenu(hmenu);
4474
4474
+
}
4475
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
4628
-
4629
4629
-
if(!pSHBindToParent)
4630
4630
-
{
4631
4631
-
win_skip("SHBindToParent missing.\n");
4632
4632
-
return;
4633
4633
-
}
4485
4485
+
LPCITEMIDLIST pidl_child;
4486
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
4647
-
ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr);
4648
4648
-
if(SUCCEEDED(hr))
4649
4649
-
{
4650
4650
-
IShellFolder *psf;
4651
4651
-
LPCITEMIDLIST pidl_child;
4652
4652
-
hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&psf, &pidl_child);
4653
4653
-
ok(hr == S_OK, "Got 0x%08x\n", hr);
4654
4654
-
if(SUCCEEDED(hr))
4655
4655
-
{
4656
4656
-
hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL,
4657
4657
-
(void**)&pcm);
4658
4658
-
ok(hr == S_OK, "Got 0x%08x\n", hr);
4659
4659
-
if(SUCCEEDED(hr))
4660
4660
-
{
4661
4661
-
const int baseItem = 0x40;
4662
4662
-
HMENU hmenu = CreatePopupMenu();
4663
4663
-
INT max_id, max_id_check;
4664
4664
-
UINT count, i;
4665
4665
-
const int id_upper_limit = 32767;
4666
4666
-
hr = IContextMenu_QueryContextMenu(pcm, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
4667
4667
-
ok(SUCCEEDED(hr), "Got 0x%08x\n", hr);
4668
4668
-
max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */
4669
4669
-
ok(max_id <= id_upper_limit, "Got %d\n", max_id);
4670
4670
-
count = GetMenuItemCount(hmenu);
4671
4671
-
ok(count, "Got %d\n", count);
4500
4500
+
ok(hr == S_OK, "Got 0x%08x\n", hr);
4672
4501
4673
4673
-
max_id_check = 0;
4674
4674
-
for(i = 0; i < count; i++)
4675
4675
-
{
4676
4676
-
MENUITEMINFOA mii;
4677
4677
-
INT res;
4678
4678
-
char buf[255], buf2[255];
4679
4679
-
ZeroMemory(&mii, sizeof(MENUITEMINFOA));
4680
4680
-
mii.cbSize = sizeof(MENUITEMINFOA);
4681
4681
-
mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
4682
4682
-
mii.dwTypeData = buf2;
4683
4683
-
mii.cch = sizeof(buf2);
4502
4502
+
hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&psf, &pidl_child);
4503
4503
+
ok(hr == S_OK, "Failed to bind to folder, hr %#x.\n", hr);
4684
4504
4685
4685
-
SetLastError(0);
4686
4686
-
res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
4687
4687
-
ok(res, "Failed (last error: %d).\n", GetLastError());
4505
4505
+
/* Item menu */
4506
4506
+
hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, (void **)&pcm);
4507
4507
+
ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr);
4508
4508
+
test_contextmenu(pcm, FALSE);
4509
4509
+
IContextMenu_Release(pcm);
4688
4510
4689
4689
-
ok( (mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR),
4690
4690
-
"Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType);
4691
4691
-
if(!(mii.fType & MFT_SEPARATOR))
4692
4692
-
{
4693
4693
-
max_id_check = (mii.wID>max_id_check)?mii.wID:max_id_check;
4694
4694
-
hr = IContextMenu_GetCommandString(pcm, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf));
4695
4695
-
ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData);
4696
4696
-
if (SUCCEEDED(hr))
4697
4697
-
trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData);
4698
4698
-
else if (hr == E_NOTIMPL)
4699
4699
-
trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData);
4700
4700
-
}
4701
4701
-
}
4702
4702
-
max_id_check -= baseItem;
4703
4703
-
ok((max_id_check == max_id) ||
4704
4704
-
(max_id_check == max_id-1) || /* Win 7 */
4705
4705
-
(max_id_check == max_id-2), /* Win 8 */
4706
4706
-
"Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
4511
4511
+
/* Background menu */
4512
4512
+
hr = IShellFolder_GetUIObjectOf(psf_desktop, NULL, 0, NULL, &IID_IContextMenu, NULL, (void **)&pcm);
4513
4513
+
ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr);
4514
4514
+
test_contextmenu(pcm, TRUE);
4515
4515
+
IContextMenu_Release(pcm);
4707
4516
4708
4708
-
#define is_win2k() (pSHGetFolderPathA && !pSHGetFolderPathAndSubDirA)
4709
4709
-
4710
4710
-
if(count && !is_win2k()) /* Test is interactive on w2k, so skip */
4711
4711
-
{
4712
4712
-
CMINVOKECOMMANDINFO cmi;
4713
4713
-
ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO));
4714
4714
-
cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
4715
4715
-
4716
4716
-
/* Attempt to execute a nonexistent command */
4717
4717
-
cmi.lpVerb = MAKEINTRESOURCEA(9999);
4718
4718
-
hr = IContextMenu_InvokeCommand(pcm, &cmi);
4719
4719
-
ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
4720
4720
-
4721
4721
-
cmi.lpVerb = "foobar_wine_test";
4722
4722
-
hr = IContextMenu_InvokeCommand(pcm, &cmi);
4723
4723
-
ok( (hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) ||
4724
4724
-
(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */),
4725
4725
-
"Got 0x%08x\n", hr);
4726
4726
-
}
4727
4727
-
#undef is_win2k
4728
4728
-
4729
4729
-
DestroyMenu(hmenu);
4730
4730
-
IContextMenu_Release(pcm);
4731
4731
-
}
4732
4732
-
IShellFolder_Release(psf);
4733
4733
-
}
4734
4734
-
if(pILFree) pILFree(pidl);
4735
4735
-
}
4517
4517
+
IShellFolder_Release(psf);
4518
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
4749
-
if(!pSHBindToParent){
4750
4750
-
win_skip("SHBindToParent is not available, not performing full PIDL verification\n");
4751
4751
-
if(path)
4752
4752
-
ok_(__FILE__,l)(pidl != NULL, "Expected PIDL to be non-NULL\n");
4753
4753
-
else
4754
4754
-
ok_(__FILE__,l)(pidl == NULL, "Expected PIDL to be NULL\n");
4755
4755
-
return;
4756
4756
-
}
4757
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
4764
-
hr = pSHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&parent, &child);
4538
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
4802
-
if(!pSHSimpleIDListFromPathAW){
4803
4803
-
win_skip("SHSimpleIDListFromPathAW not available\n");
4804
4804
-
return;
4805
4805
-
}
4806
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
4811
-
pidl = pSHSimpleIDListFromPathAW(adirW);
4580
4580
+
pidl = SHSimpleIDListFromPath(adirW);
4812
4581
else
4813
4813
-
pidl = pSHSimpleIDListFromPathAW(adirA);
4582
4582
+
pidl = SHSimpleIDListFromPath((const WCHAR *)adirA);
4814
4583
verify_pidl(pidl, adirW);
4815
4815
-
pILFree(pidl);
4584
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
4821
-
pidl = pSHSimpleIDListFromPathAW(adirW);
4590
4590
+
pidl = SHSimpleIDListFromPath(adirW);
4822
4591
else
4823
4823
-
pidl = pSHSimpleIDListFromPathAW(adirA);
4592
4592
+
pidl = SHSimpleIDListFromPath((const WCHAR *)adirA);
4824
4593
verify_pidl(pidl, adirW);
4825
4825
-
pILFree(pidl);
4594
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
4936
-
ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
4937
4937
-
"ParseDisplayName failed with wrong error: 0x%08x\n", hres);
4705
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
4939
-
ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
4940
4940
-
"ParseDisplayName failed with wrong error: 0x%08x\n", hres);
4707
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
4942
-
ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
4943
4943
-
"ParseDisplayName failed with wrong error: 0x%08x\n", hres);
4709
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
4950
-
ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
4951
4951
-
"ParseDisplayName failed with wrong error: 0x%08x\n", hres);
4716
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
4953
-
ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
4954
4954
-
"ParseDisplayName failed with wrong error: 0x%08x\n", hres);
4718
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
4956
-
ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
4957
4957
-
"ParseDisplayName failed with wrong error: 0x%08x\n", hres);
4720
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
4967
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
4968
4968
-
"ParseDisplayName failed: 0x%08x\n", hres);
4730
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
4975
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
4976
4976
-
"ParseDisplayName failed: 0x%08x\n", hres);
4737
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
4983
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
4984
4984
-
"ParseDisplayName failed: 0x%08x\n", hres);
4744
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
4994
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
4995
4995
-
"ParseDisplayName failed: 0x%08x\n", hres);
4754
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
5002
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5003
5003
-
"ParseDisplayName failed: 0x%08x\n", hres);
4761
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
5010
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5011
5011
-
"ParseDisplayName failed: 0x%08x\n", hres);
4768
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
5021
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5022
5022
-
"ParseDisplayName failed: 0x%08x\n", hres);
4778
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
5029
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5030
5030
-
"ParseDisplayName failed: 0x%08x\n", hres);
4785
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
5037
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5038
5038
-
"ParseDisplayName failed: 0x%08x\n", hres);
4792
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
5048
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5049
5049
-
"ParseDisplayName failed: 0x%08x\n", hres);
4802
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
5056
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5057
5057
-
"ParseDisplayName failed: 0x%08x\n", hres);
4809
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
5064
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5065
5065
-
"ParseDisplayName failed: 0x%08x\n", hres);
4816
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
5075
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5076
5076
-
"ParseDisplayName failed: 0x%08x\n", hres);
4826
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
5083
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5084
5084
-
"ParseDisplayName failed: 0x%08x\n", hres);
4833
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
5091
-
ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
5092
5092
-
"ParseDisplayName failed: 0x%08x\n", hres);
4840
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
5146
-
HeapFree(GetProcessHeap(), 0, path1);
5147
5147
-
HeapFree(GetProcessHeap(), 0, path2);
4894
4894
+
heap_free(path1);
4895
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
5223
-
hr = pSHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
4971
4971
+
hr = SHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
5224
4972
else
5225
5225
-
hr = pSHILCreateFromPath((LPCVOID)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0);
4973
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
5254
-
HeapFree(GetProcessHeap(), 0, path1);
5255
5255
-
HeapFree(GetProcessHeap(), 0, path2);
5002
5002
+
heap_free(path1);
5003
5003
+
heap_free(path2);
5256
5004
}
5257
5005
}
5258
5006
···
5284
5032
return;
5285
5033
}
5286
5034
5287
5287
-
if(!pSHBindToParent)
5288
5288
-
{
5289
5289
-
skip("SHBindToParent missing.\n");
5290
5290
-
return;
5291
5291
-
}
5292
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
5305
-
ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr);
5047
5047
+
ok(hr == S_OK, "Got 0x%08x\n", hr);
5306
5048
if(SUCCEEDED(hr))
5307
5049
{
5308
5308
-
5309
5309
-
hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&folder, (LPCITEMIDLIST*)&pidl_child);
5050
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
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
5067
+
5327
5068
hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu);
5328
5069
ok(hr==S_OK,"Got 0x%08x\n", hr);
5070
5070
+
test_contextmenu_qi(cmenu, TRUE);
5329
5071
IContextMenu_Release(cmenu);
5072
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
5076
+
test_contextmenu_qi(cmenu, TRUE);
5333
5077
IContextMenu_Release(cmenu);
5078
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
5382
-
pILFree(apidl);
5127
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
5156
+
static void test_GetDefaultColumn(void)
5157
5157
+
{
5158
5158
+
static const CLSID *folders[] =
5159
5159
+
{
5160
5160
+
&CLSID_MyComputer,
5161
5161
+
&CLSID_MyDocuments,
5162
5162
+
&CLSID_ControlPanel,
5163
5163
+
&CLSID_NetworkPlaces,
5164
5164
+
&CLSID_Printers,
5165
5165
+
&CLSID_RecycleBin,
5166
5166
+
&CLSID_ShellDesktop,
5167
5167
+
};
5168
5168
+
HRESULT hr;
5169
5169
+
int i;
5170
5170
+
5171
5171
+
CoInitialize(NULL);
5172
5172
+
5173
5173
+
for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++)
5174
5174
+
{
5175
5175
+
IShellFolder2 *folder;
5176
5176
+
ULONG sort, display;
5177
5177
+
5178
5178
+
hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder);
5179
5179
+
if (hr != S_OK)
5180
5180
+
{
5181
5181
+
win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr);
5182
5182
+
continue;
5183
5183
+
}
5184
5184
+
5185
5185
+
hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, NULL);
5186
5186
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
5187
5187
+
5188
5188
+
sort = display = 123;
5189
5189
+
hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, &display);
5190
5190
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
5191
5191
+
ok(sort == 123 && display == 123, "Unexpected default column.\n");
5192
5192
+
5193
5193
+
display = 123;
5194
5194
+
hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, &display);
5195
5195
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
5196
5196
+
ok(display == 123, "Unexpected default column.\n");
5197
5197
+
5198
5198
+
sort = 123;
5199
5199
+
hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, NULL);
5200
5200
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
5201
5201
+
ok(sort == 123, "Unexpected default column.\n");
5202
5202
+
}
5203
5203
+
5204
5204
+
CoUninitialize();
5205
5205
+
}
5206
5206
+
5207
5207
+
static void test_GetDefaultSearchGUID(void)
5208
5208
+
{
5209
5209
+
static const CLSID *folders[] =
5210
5210
+
{
5211
5211
+
&CLSID_MyComputer,
5212
5212
+
&CLSID_MyDocuments,
5213
5213
+
&CLSID_ControlPanel,
5214
5214
+
&CLSID_NetworkPlaces,
5215
5215
+
&CLSID_Printers,
5216
5216
+
&CLSID_RecycleBin,
5217
5217
+
&CLSID_ShellDesktop,
5218
5218
+
};
5219
5219
+
HRESULT hr;
5220
5220
+
int i;
5221
5221
+
5222
5222
+
CoInitialize(NULL);
5223
5223
+
5224
5224
+
for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++)
5225
5225
+
{
5226
5226
+
IShellFolder2 *folder;
5227
5227
+
GUID guid;
5228
5228
+
5229
5229
+
hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder);
5230
5230
+
if (hr != S_OK)
5231
5231
+
{
5232
5232
+
win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr);
5233
5233
+
continue;
5234
5234
+
}
5235
5235
+
5236
5236
+
if (0)
5237
5237
+
{
5238
5238
+
/* crashes on XP */
5239
5239
+
hr = IShellFolder2_GetDefaultSearchGUID(folder, NULL);
5240
5240
+
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
5241
5241
+
}
5242
5242
+
5243
5243
+
memcpy(&guid, &CLSID_MyComputer, sizeof(guid));
5244
5244
+
hr = IShellFolder2_GetDefaultSearchGUID(folder, &guid);
5245
5245
+
ok(hr == E_NOTIMPL || broken(hr == S_OK) /* Method was last supported on XP */, "Unexpected hr %#x.\n", hr);
5246
5246
+
if (hr == E_NOTIMPL)
5247
5247
+
ok(IsEqualGUID(&guid, &CLSID_MyComputer), "Unexpected guid %s.\n", wine_dbgstr_guid(&guid));
5248
5248
+
5249
5249
+
IShellFolder2_Release(folder);
5250
5250
+
}
5251
5251
+
5252
5252
+
CoUninitialize();
5253
5253
+
}
5254
5254
+
5411
5255
START_TEST(shlfolder)
5412
5256
{
5413
5257
init_function_pointers();
5414
5258
/* if OleInitialize doesn't get called, ParseDisplayName returns
5415
5415
-
CO_E_NOTINITIALIZED for malformed directory names on win2k. */
5259
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
5294
+
test_GetDefaultColumn();
5295
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
21
-
#include "precomp.h"
21
21
+
#include <stdarg.h>
22
22
+
#include <stdio.h>
23
23
+
24
24
+
#define COBJMACROS
25
25
+
#define CONST_VTABLE
26
26
+
27
27
+
#include "windef.h"
28
28
+
#include "winbase.h"
29
29
+
#include "wtypes.h"
30
30
+
#include "shellapi.h"
31
31
+
32
32
+
#include "shlguid.h"
33
33
+
#include "shlobj.h"
34
34
+
#include "shobjidl.h"
35
35
+
#include "shlwapi.h"
36
36
+
#include "ocidl.h"
37
37
+
#include "oleauto.h"
38
38
+
39
39
+
#include "initguid.h"
40
40
+
41
41
+
#include "wine/heap.h"
42
42
+
#include "wine/test.h"
22
43
23
44
#include "msg.h"
24
45
46
46
+
#ifdef __REACTOS__
47
47
+
#include <reactos/undocshell.h>
48
48
+
#endif
49
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
132
-
obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj));
157
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
146
-
*ppvObj = This;
171
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
170
-
{
171
171
-
HeapFree(GetProcessHeap(), 0, This);
172
172
-
return 0;
173
173
-
}
195
195
+
heap_free(This);
196
196
+
174
197
return ref;
175
198
}
176
199
···
256
279
{
257
280
IShellBrowserImpl *browser;
258
281
259
259
-
browser = HeapAlloc(GetProcessHeap(), 0, sizeof(*browser));
282
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
278
-
*ppvObj = This;
301
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
302
-
{
303
303
-
HeapFree(GetProcessHeap(), 0, This);
304
304
-
return 0;
305
305
-
}
325
325
+
heap_free(This);
326
326
+
306
327
return ref;
307
328
}
308
329
···
1456
1477
IShellFolder_Release(desktop);
1457
1478
}
1458
1479
1480
1480
+
static void test_newmenu(void)
1481
1481
+
{
1482
1482
+
IUnknown *unk, *unk2;
1483
1483
+
HRESULT hr;
1484
1484
+
1485
1485
+
hr = CoCreateInstance(&CLSID_NewMenu, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
1486
1486
+
todo_wine
1487
1487
+
ok(hr == S_OK, "Failed to create NewMenu object, hr %#x.\n", hr);
1488
1488
+
if (hr != S_OK)
1489
1489
+
{
1490
1490
+
skip("NewMenu is not supported.\n");
1491
1491
+
return;
1492
1492
+
}
1493
1493
+
1494
1494
+
hr = IUnknown_QueryInterface(unk, &IID_IShellExtInit, (void **)&unk2);
1495
1495
+
ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
1496
1496
+
IUnknown_Release(unk2);
1497
1497
+
1498
1498
+
hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2);
1499
1499
+
ok(hr == S_OK, "Failed to get IContextMenu3, hr %#x.\n", hr);
1500
1500
+
IUnknown_Release(unk2);
1501
1501
+
1502
1502
+
hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&unk2);
1503
1503
+
ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#x.\n", hr);
1504
1504
+
IUnknown_Release(unk2);
1505
1505
+
1506
1506
+
IUnknown_Release(unk);
1507
1507
+
}
1508
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
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
21
-
#include "precomp.h"
21
21
+
#include <stdarg.h>
22
22
+
#include <stdio.h>
23
23
+
24
24
+
#define WINE_NOWINSOCK
25
25
+
#include "windef.h"
26
26
+
#include "winbase.h"
27
27
+
#include "wtypes.h"
28
28
+
#include "shellapi.h"
29
29
+
#include "shtypes.h"
30
30
+
#include "objbase.h"
31
31
+
32
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
20
-
#include "precomp.h"
20
20
+
#ifndef __REACTOS__
21
21
+
#define _WIN32_IE 0x600
22
22
+
#endif
23
23
+
#include <stdarg.h>
24
24
+
25
25
+
#include <windows.h>
26
26
+
#include "shellapi.h"
27
27
+
28
28
+
#include "wine/test.h"
29
29
+
21
30
22
31
static HWND hMainWnd;
23
32
static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);