ReactOS 0.4.15-dev-7961-gdcf9eb0
IDataObject.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Test for zipfldr
5 * COPYRIGHT: Copyright 2020 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9
10#ifndef FILE_ATTRIBUTE_VIRTUAL
11#define FILE_ATTRIBUTE_VIRTUAL 0x10000
12#endif
13
14DEFINE_GUID(CLSID_ZipFolderContextMenu, 0xb8cdcb65, 0xb1bf, 0x4b42, 0x94, 0x28, 0x1d, 0xfd, 0xb7, 0xee, 0x92, 0xaf);
15
16
17static bool g_bOldZipfldr;
18const char test_file_1_contents[] = "Some generic text in the root file.\r\nMore text on a new line.";
19const char test_file_2_contents[] = "Some generic text in the file in folder_1.\r\nMore text on a new line.";
20
21static BOOL write_raw_file(const WCHAR* FileName, const void* Data, DWORD Size)
22{
24 DWORD dwWritten;
26
28 {
29 skip("Failed to create temp file %ls, error %lu\n", FileName, GetLastError());
30 return FALSE;
31 }
32 Success = WriteFile(Handle, Data, Size, &dwWritten, NULL);
33 ok(Success == TRUE, "WriteFile failed with %lu\n", GetLastError());
34 ok(dwWritten == Size, "WriteFile wrote %lu bytes instead of %lu\n", dwWritten, Size);
36 return Success && (dwWritten == Size);
37}
38
39BOOL extract_resource(WCHAR* Filename, LPCWSTR ResourceName, WCHAR* ParentFolder)
40{
42 UINT TickMask = 0xffff;
43 if (!ParentFolder)
44 {
46 ParentFolder = workdir;
47 }
48 else
49 {
50 // Fixed filename
51 TickMask = 0;
52 }
53 StringCchPrintfW(Filename, MAX_PATH, L"%sTMP%u.zip", ParentFolder, GetTickCount() & TickMask);
54
56 HRSRC hRsrc = FindResourceW(hMod, ResourceName, MAKEINTRESOURCEW(RT_RCDATA));
57 ok(!!hRsrc, "Unable to find %s\n", wine_dbgstr_w(ResourceName));
58 if (!hRsrc)
59 return FALSE;
60
61 HGLOBAL hGlobal = LoadResource(hMod, hRsrc);
62 DWORD Size = SizeofResource(hMod, hRsrc);
63 LPVOID pData = LockResource(hGlobal);
64
65 ok(Size && !!pData, "Unable to load %s\n", wine_dbgstr_w(ResourceName));
66 if (!Size || !pData)
67 return FALSE;
68
71 return Written;
72}
73
74bool InitializeShellFolder_(const char* file, int line, const WCHAR* Filename, CComPtr<IShellFolder>& spFolder)
75{
76 CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidl;
77 HRESULT hr;
79 if (!SUCCEEDED(hr))
80 return false;
81
82 CComPtr<IShellFolder> spParent;
83 PCUIDLIST_RELATIVE pidlLast;
84 ok_hr_(file, line, (hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &spParent), &pidlLast)), S_OK);
85 if (!SUCCEEDED(hr))
86 return false;
87
88 ok_hr_(file, line, (hr = spParent->BindToObject(pidlLast, 0, IID_PPV_ARG(IShellFolder, &spFolder))), S_OK);
89
90 return SUCCEEDED(hr);
91}
92
93#define GetFirstDataObject(spFolder, grfFlags, spData) GetFirstDataObject_(__FILE__, __LINE__, spFolder, grfFlags, spData)
94static bool GetFirstDataObject_(const char* file, int line, IShellFolder* spFolder, SHCONTF grfFlags, CComPtr<IDataObject>& spData)
95{
96 CComPtr<IEnumIDList> spEnum;
97 HRESULT hr;
98 ok_hr_(file, line, (hr = spFolder->EnumObjects(NULL, grfFlags, &spEnum)), S_OK);
99 if (!SUCCEEDED(hr))
100 return false;
101
102 CComHeapPtr<ITEMID_CHILD> child;
103 ULONG celtFetched = 0;
104 ok_hr_(file, line, (hr = spEnum->Next(1, &child, &celtFetched)), S_OK);
105 ok_int_(file, line, celtFetched, 1);
106 if (!SUCCEEDED(hr))
107 return false;
108
109 // This call fails without the extension being '.zip'
110 ok_hr_(file, line, (hr = spFolder->GetUIObjectOf(NULL, 1, &child, IID_IDataObject, NULL, reinterpret_cast<LPVOID*>(&spData))), S_OK);
111 return SUCCEEDED(hr);
112}
113
114bool IsFormatAdvertised_(const char* file, int line, IDataObject* pDataObj, CLIPFORMAT cfFormat, TYMED tymed)
115{
116 CComPtr<IEnumFORMATETC> pEnumFmt;
117 HRESULT hr = pDataObj->EnumFormatEtc(DATADIR_GET, &pEnumFmt);
118
119 ok_hex_(file, line, hr, S_OK);
120 if (!SUCCEEDED(hr))
121 return false;
122
123 FORMATETC fmt;
124 while (S_OK == (hr = pEnumFmt->Next(1, &fmt, NULL)))
125 {
126 if (fmt.cfFormat == cfFormat)
127 {
128 ok_hex_(file, line, fmt.lindex, -1);
129 if (tymed)
130 ok_hex_(file, line, fmt.tymed, tymed);
131 return true;
132 }
133 }
135 return false;
136}
137
138#if 0
139#define DumpDataObjectFormats(pDataObj) DumpDataObjectFormats_(__FILE__, __LINE__, pDataObj)
140static inline void DumpDataObjectFormats_(const char* file, int line, IDataObject* pDataObj)
141{
142 CComPtr<IEnumFORMATETC> pEnumFmt;
143 HRESULT hr = pDataObj->EnumFormatEtc(DATADIR_GET, &pEnumFmt);
144
146 return;
147
148 FORMATETC fmt;
149 while (S_OK == pEnumFmt->Next(1, &fmt, NULL))
150 {
151 char szBuf[512];
152 GetClipboardFormatNameA(fmt.cfFormat, szBuf, sizeof(szBuf));
153 trace_(file, line)("Format: %s\n", szBuf);
154 trace_(file, line)(" Tymed: %u\n", fmt.tymed);
155 if (fmt.tymed & TYMED_HGLOBAL)
156 {
157 trace_(file, line)(" TYMED_HGLOBAL supported\n");
158 }
159 }
160}
161#endif
162
164{
165 ok_int(Descriptor->cItems, 1u);
166 if (Descriptor->cItems > 0)
167 {
168 FILETIME LocalFileTime, FileTime;
169 WORD Mask = g_bOldZipfldr ? 0xffe0 : (0xffff); // bits 0-4 are the seconds
170 DosDateTimeToFileTime(0x5024, (0xa5f2 & Mask), &LocalFileTime);
171 LocalFileTimeToFileTime(&LocalFileTime, &FileTime);
172
173 FILEDESCRIPTORW* FileDescriptor = Descriptor->fgd;
176 ok_hex(FileDescriptor->ftLastWriteTime.dwHighDateTime, FileTime.dwHighDateTime);
177 ok_hex(FileDescriptor->ftLastWriteTime.dwLowDateTime, FileTime.dwLowDateTime);
178 ok_hex(FileDescriptor->nFileSizeHigh, 0);
180 ok_wstr(FileDescriptor->cFileName, L"test_file_for_zip.txt");
181 }
182}
183
185{
186 ok_int(Descriptor->cItems, 2u);
187 if (Descriptor->cItems > 0)
188 {
189 FILETIME LocalFileTime, FileTime;
190 WORD Mask = g_bOldZipfldr ? 0xffe0 : (0xffff); // bits 0-4 are the seconds
191 DosDateTimeToFileTime(0x5024, (0xa5fc & Mask), &LocalFileTime);
192 LocalFileTimeToFileTime(&LocalFileTime, &FileTime);
193
194 FILEDESCRIPTORW* FileDescriptor = Descriptor->fgd;
196 ok(FileDescriptor->dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY ||
197 FileDescriptor->dwFileAttributes == (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_VIRTUAL), "Got attr: 0x%lx\n", FileDescriptor->dwFileAttributes);
198 //ok_hex(FileDescriptor->dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY);
199 ok_hex(FileDescriptor->ftLastWriteTime.dwHighDateTime, FileTime.dwHighDateTime);
200 ok_hex(FileDescriptor->ftLastWriteTime.dwLowDateTime, FileTime.dwLowDateTime);
201 ok_hex(FileDescriptor->nFileSizeHigh, 0);
202 ok_hex(FileDescriptor->nFileSizeLow, 0);
203 ok_wstr(FileDescriptor->cFileName, L"folder_1");
204
205 if (Descriptor->cItems > 1)
206 {
207 DosDateTimeToFileTime(0x5024, (0xa60d & Mask), &LocalFileTime);
208 LocalFileTimeToFileTime(&LocalFileTime, &FileTime);
209
210 FileDescriptor = Descriptor->fgd + 1;
213 ok_hex(FileDescriptor->ftLastWriteTime.dwHighDateTime, FileTime.dwHighDateTime);
214 ok_hex(FileDescriptor->ftLastWriteTime.dwLowDateTime, FileTime.dwLowDateTime);
215 ok_hex(FileDescriptor->nFileSizeHigh, 0);
217 ok_wstr(FileDescriptor->cFileName, L"folder_1\\test_file_for_zip.txt");
218 }
219 }
220}
221
224{
225 STATSTG statstg = {0};
226 HRESULT hr = Stream->Stat(&statstg, STATFLAG_DEFAULT);
228 if (SUCCEEDED(hr))
229 {
230 FILETIME LocalFileTime, FileTime;
231 WORD Mask = g_bOldZipfldr ? 0xffe0 : (0xffff); // bits 0-4 are the seconds
232 DosDateTimeToFileTime(0x5024, (0xa5f2 & Mask), &LocalFileTime);
233 LocalFileTimeToFileTime(&LocalFileTime, &FileTime);
234
235 ok_wstr(statstg.pwcsName, L"test_file_for_zip.txt");
236 ok_hex(statstg.type, STGTY_STREAM);
237 ok_int(statstg.cbSize.LowPart, strlen(test_file_1_contents));
238 ok_hex(statstg.cbSize.HighPart, 0);
239 ok_hex(statstg.mtime.dwHighDateTime, FileTime.dwHighDateTime);
240 ok_hex(statstg.mtime.dwLowDateTime, FileTime.dwLowDateTime);
241 ok_hex(statstg.ctime.dwHighDateTime, FileTime.dwHighDateTime);
242 ok_hex(statstg.ctime.dwLowDateTime, FileTime.dwLowDateTime);
243 ok_hex(statstg.atime.dwHighDateTime, FileTime.dwHighDateTime);
244 ok_hex(statstg.atime.dwLowDateTime, FileTime.dwLowDateTime);
245 ok_hex(statstg.grfMode, STGM_SHARE_DENY_WRITE);
246 ok_hex(statstg.grfLocksSupported, 0);
247 ok(!memcmp(&statstg.clsid, &GUID_NULL_, sizeof(GUID_NULL_)), "Expected GUID_NULL, got %s\n", wine_dbgstr_guid(&statstg.clsid));
248 ok_hex(statstg.grfStateBits, 0);
249 CoTaskMemFree(statstg.pwcsName);
250 }
251
252 LARGE_INTEGER Offset = { {0} };
253 ULARGE_INTEGER NewPosition = { {0} };
254 hr = Stream->Seek(Offset, STREAM_SEEK_CUR, &NewPosition);
256 ok_int(NewPosition.HighPart, 0);
257 ok_int(NewPosition.LowPart, 0);
258
259 char buf[100] = { 0 };
260 ULONG cbRead;
261 hr = Stream->Read(buf, sizeof(buf)-1, &cbRead);
262 ok_hex(hr, S_FALSE);
265
266 hr = Stream->Seek(Offset, STREAM_SEEK_CUR, &NewPosition);
268 ok_int(NewPosition.HighPart, 0);
269 if (SUCCEEDED(hr))
271
272 ULONG cbWritten;
273 hr = Stream->Write("DUMMY", 5, &cbWritten);
274 if (!g_bOldZipfldr)
275 {
277 }
278 else
279 {
280 // Write succeeds, but is not reflected in the file on disk
281 ok_hex(hr, S_OK);
282 }
283
284 // Can increase the size...
285 NewPosition.LowPart = statstg.cbSize.LowPart + 1;
286 hr = Stream->SetSize(NewPosition);
288
289 // But is not reflected in the Stat result
290 hr = Stream->Stat(&statstg, STATFLAG_DEFAULT);
292 if (SUCCEEDED(hr))
293 {
294 ok_int(statstg.cbSize.LowPart, strlen(test_file_1_contents));
295 CoTaskMemFree(statstg.pwcsName);
296 }
297
298 // Old zipfldr does not support seek, so we can not read it again
299 if (!g_bOldZipfldr)
300 {
301 Offset.QuadPart = 0;
302 hr = Stream->Seek(Offset, STREAM_SEEK_SET, &NewPosition);
303 ok_hex(hr, S_OK);
304
305 memset(buf, 0, sizeof(buf));
306 hr = Stream->Read(buf, sizeof(buf)-1, &cbRead);
307 ok_hex(hr, S_FALSE);
309 }
310}
311
312
314{
315 STATSTG statstg = {0};
316 HRESULT hr = Stream->Stat(&statstg, STATFLAG_DEFAULT);
318 if (SUCCEEDED(hr))
319 {
320 FILETIME LocalFileTime, FileTime;
321 WORD Mask = g_bOldZipfldr ? 0xffe0 : (0xffff); // bits 0-4 are the seconds
322 DosDateTimeToFileTime(0x5024, (0xa60d & Mask), &LocalFileTime);
323 LocalFileTimeToFileTime(&LocalFileTime, &FileTime);
324
325 ok_wstr(statstg.pwcsName, L"test_file_for_zip.txt");
326 ok_hex(statstg.type, STGTY_STREAM);
327 ok_int(statstg.cbSize.LowPart, strlen(test_file_2_contents));
328 ok_hex(statstg.cbSize.HighPart, 0);
329 ok_hex(statstg.mtime.dwHighDateTime, FileTime.dwHighDateTime);
330 ok_hex(statstg.mtime.dwLowDateTime, FileTime.dwLowDateTime);
331 ok_hex(statstg.ctime.dwHighDateTime, FileTime.dwHighDateTime);
332 ok_hex(statstg.ctime.dwLowDateTime, FileTime.dwLowDateTime);
333 ok_hex(statstg.atime.dwHighDateTime, FileTime.dwHighDateTime);
334 ok_hex(statstg.atime.dwLowDateTime, FileTime.dwLowDateTime);
335 ok_hex(statstg.grfMode, STGM_SHARE_DENY_WRITE);
336 ok_hex(statstg.grfLocksSupported, 0);
337 ok(!memcmp(&statstg.clsid, &GUID_NULL_, sizeof(GUID_NULL_)), "Expected GUID_NULL, got %s\n", wine_dbgstr_guid(&statstg.clsid));
338 ok_hex(statstg.grfStateBits, 0);
339 CoTaskMemFree(statstg.pwcsName);
340 }
341
342 LARGE_INTEGER Offset = { {0} };
343 ULARGE_INTEGER NewPosition = { {0} };
344 hr = Stream->Seek(Offset, STREAM_SEEK_CUR, &NewPosition);
346 ok_int(NewPosition.HighPart, 0);
347 ok_int(NewPosition.LowPart, 0);
348
349 char buf[100] = { 0 };
350 ULONG cbRead;
351 hr = Stream->Read(buf, sizeof(buf)-1, &cbRead);
352 ok_hex(hr, S_FALSE);
355
356 hr = Stream->Seek(Offset, STREAM_SEEK_CUR, &NewPosition);
358 ok_int(NewPosition.HighPart, 0);
359 if (SUCCEEDED(hr))
361
362 ULONG cbWritten;
363 hr = Stream->Write("DUMMY", 5, &cbWritten);
364 if (!g_bOldZipfldr)
365 {
367 }
368 else
369 {
370 // Write succeeds, but is not reflected in the file on disk
371 ok_hex(hr, S_OK);
372 }
373
374 // Can increase the size...
375 NewPosition.LowPart = statstg.cbSize.LowPart + 1;
376 hr = Stream->SetSize(NewPosition);
378
379 // But is not reflected in the Stat result
380 hr = Stream->Stat(&statstg, STATFLAG_DEFAULT);
382 if (SUCCEEDED(hr))
383 {
384 ok_int(statstg.cbSize.LowPart, strlen(test_file_2_contents));
385 CoTaskMemFree(statstg.pwcsName);
386 }
387
388 // Old zipfldr does not support seek, so we can not read it again
389 if (!g_bOldZipfldr)
390 {
391 Offset.QuadPart = 0;
392 hr = Stream->Seek(Offset, STREAM_SEEK_SET, &NewPosition);
393 ok_hex(hr, S_OK);
394
395 memset(buf, 0, sizeof(buf));
396 hr = Stream->Read(buf, sizeof(buf)-1, &cbRead);
397 ok_hex(hr, S_FALSE);
400 }
401}
402
403
404
408
410{
411 CComPtr<IDataObject> spDataObj;
412 if (!GetFirstDataObject(pFolder, SHCONTF_NONFOLDERS, spDataObj))
413 return;
414
415 if (!IsFormatAdvertised(spDataObj, cfHIDA, TYMED_HGLOBAL))
416 {
417 trace("Pre-Vista zipfldr\n");
418 // No seconds in filetimes, less functional IStream* implementation
419 g_bOldZipfldr = true;
420 }
421
422 ok(!IsFormatAdvertised(spDataObj, CF_HDROP, TYMED_NULL), "Expected CF_HDROP to be absent\n");
423 ok(IsFormatAdvertised(spDataObj, cfFileDescriptor, TYMED_HGLOBAL), "Expected FileDescriptorW to be supported\n");
424 ok(IsFormatAdvertised(spDataObj, cfFileContents, TYMED_ISTREAM), "Expected FileContents to be supported\n");
425
426 STGMEDIUM medium = {0};
427 FORMATETC etc = { cfFileDescriptor, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
428 HRESULT hr = spDataObj->GetData(&etc, &medium);
429 ok_hex(hr, S_OK);
430 if (!SUCCEEDED(hr))
431 return;
432
433 ok_hex(medium.tymed, TYMED_HGLOBAL);
434 PVOID pData = GlobalLock(medium.hGlobal);
436 GlobalUnlock(medium.hGlobal);
437 ReleaseStgMedium(&medium);
438
439 // Invalid index
440 etc.cfFormat = cfFileContents;
441 etc.ptd = NULL;
442 etc.dwAspect = DVASPECT_CONTENT;
443 etc.lindex = -1;
444 etc.tymed = TYMED_ISTREAM;
445 memset(&medium, 0xcc, sizeof(medium));
446 hr = spDataObj->GetData(&etc, &medium);
448 ok_hex(medium.tymed, TYMED_NULL);
449 ok_ptr(medium.hGlobal, NULL);
450 ok_ptr(medium.pUnkForRelease, NULL);
451 if (SUCCEEDED(hr))
452 ReleaseStgMedium(&medium);
453
454 // Correct index
455 etc.cfFormat = cfFileContents;
456 etc.ptd = NULL;
457 etc.dwAspect = DVASPECT_CONTENT;
458 etc.lindex = 0;
459 etc.tymed = TYMED_ISTREAM;
460 memset(&medium, 0xcc, sizeof(medium));
461 // During this call a temp file is created: %TMP%\Temp%u_%s\test_file_for_zip.txt
462 // Or for the 2k3 version: %TMP%\Temporary Directory %u for %s\test_file_for_zip.txt
463 hr = spDataObj->GetData(&etc, &medium);
464 ok_hex(hr, S_OK);
465 ok_hex(medium.tymed, TYMED_ISTREAM);
466 if (SUCCEEDED(hr))
467 {
468 test_FileContents1(medium.pstm);
469 ReleaseStgMedium(&medium);
470 }
471
472 //if (winetest_get_failures())
473 // DumpDataObjectFormats(spDataObj);
474}
475
477{
478 CComPtr<IDataObject> spDataObj;
479 if (!GetFirstDataObject(pFolder, SHCONTF_FOLDERS, spDataObj))
480 return;
481
482 ok(!IsFormatAdvertised(spDataObj, CF_HDROP, TYMED_NULL), "Expected CF_HDROP to be absent\n");
483 ok(IsFormatAdvertised(spDataObj, cfFileDescriptor, TYMED_HGLOBAL), "Expected FileDescriptorW to be supported\n");
484 ok(IsFormatAdvertised(spDataObj, cfFileContents, TYMED_ISTREAM), "Expected FileContents to be supported\n");
485 // 7+
486 ok(!!IsFormatAdvertised(spDataObj, cfHIDA, TYMED_HGLOBAL) != g_bOldZipfldr, "Expected HIDA to be %s\n", g_bOldZipfldr ? "absent" : "supported");
487
488 STGMEDIUM medium = {0};
489 FORMATETC etc = { cfFileDescriptor, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
490 HRESULT hr = spDataObj->GetData(&etc, &medium);
491 ok_hex(hr, S_OK);
492 if (!SUCCEEDED(hr))
493 return;
494
495 ok_hex(medium.tymed, TYMED_HGLOBAL);
496 PVOID pData = GlobalLock(medium.hGlobal);
498 GlobalUnlock(medium.hGlobal);
499 ReleaseStgMedium(&medium);
500
501 // Invalid index
502 etc.cfFormat = cfFileContents;
503 etc.ptd = NULL;
504 etc.dwAspect = DVASPECT_CONTENT;
505 etc.lindex = -1;
506 etc.tymed = TYMED_ISTREAM;
507 memset(&medium, 0xcc, sizeof(medium));
508 hr = spDataObj->GetData(&etc, &medium);
510 ok_hex(medium.tymed, TYMED_NULL);
511 ok_ptr(medium.hGlobal, NULL);
512 ok_ptr(medium.pUnkForRelease, NULL);
513 if (SUCCEEDED(hr))
514 ReleaseStgMedium(&medium);
515
516 // Not a file (first index is the folder)
517 etc.cfFormat = cfFileContents;
518 etc.ptd = NULL;
519 etc.dwAspect = DVASPECT_CONTENT;
520 etc.lindex = 0;
521 etc.tymed = TYMED_ISTREAM;
522 memset(&medium, 0xcc, sizeof(medium));
523 hr = spDataObj->GetData(&etc, &medium);
524 ok_hex(hr, E_FAIL);
525 ok_hex(medium.tymed, TYMED_NULL);
526 ok_ptr(medium.hGlobal, NULL);
527 ok_ptr(medium.pUnkForRelease, NULL);
528 if (SUCCEEDED(hr))
529 ReleaseStgMedium(&medium);
530
531 // The file (content of the folder)
532 etc.cfFormat = cfFileContents;
533 etc.ptd = NULL;
534 etc.dwAspect = DVASPECT_CONTENT;
535 etc.lindex = 1;
536 etc.tymed = TYMED_ISTREAM;
537 memset(&medium, 0xcc, sizeof(medium));
538 // During this call a temp file is created: %TMP%\Temp%u_%s\folder1\test_file_for_zip.txt
539 // Or for the 2k3 version: %TMP%\Temporary Directory %u for %s\folder1\test_file_for_zip.txt
540 hr = spDataObj->GetData(&etc, &medium);
541 ok_hex(hr, S_OK);
542 ok_hex(medium.tymed, TYMED_ISTREAM);
543 if (SUCCEEDED(hr))
544 {
545 test_FileContents2(medium.pstm);
546 ReleaseStgMedium(&medium);
547 }
548
549 //if (winetest_get_failures())
550 // DumpDataObjectFormats(spDataObj);
551}
552
553
554static void test_DataObject(const WCHAR* Filename)
555{
556 CComPtr<IShellFolder> spFolder;
557 if (!InitializeShellFolder(Filename, spFolder))
558 return;
559
562}
563
564
566{
567 skip("Code in zipfldr not implemented yet\n");
568 return;
569
571
572 ok_hr(hr, S_OK);
573 if (!SUCCEEDED(hr))
574 return;
575
576 WCHAR ZipTestFile[MAX_PATH];
578 return;
579 test_DataObject(ZipTestFile);
580 DeleteFileW(ZipTestFile);
582}
#define ok_hr(status, expected)
Definition: ACListISF.cpp:31
#define ok_hex_(expression, result)
static CLIPFORMAT cfFileDescriptor
static void test_DataObject_FirstFolder(IShellFolder *pFolder)
const char test_file_1_contents[]
Definition: IDataObject.cpp:18
static void test_DataObject_FirstFile(IShellFolder *pFolder)
const char test_file_2_contents[]
Definition: IDataObject.cpp:19
static void test_FileContents2(IStream *Stream)
static void test_FileDescriptor(FILEGROUPDESCRIPTORW *Descriptor)
static void test_FileDescriptor_Folder(FILEGROUPDESCRIPTORW *Descriptor)
BOOL extract_resource(WCHAR *Filename, LPCWSTR ResourceName, WCHAR *ParentFolder)
Definition: IDataObject.cpp:39
bool InitializeShellFolder_(const char *file, int line, const WCHAR *Filename, CComPtr< IShellFolder > &spFolder)
Definition: IDataObject.cpp:74
static CLIPFORMAT cfFileContents
static GUID GUID_NULL_
#define FILE_ATTRIBUTE_VIRTUAL
Definition: IDataObject.cpp:11
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
static bool GetFirstDataObject_(const char *file, int line, IShellFolder *spFolder, SHCONTF grfFlags, CComPtr< IDataObject > &spData)
Definition: IDataObject.cpp:94
static void test_FileContents1(IStream *Stream)
#define GetFirstDataObject(spFolder, grfFlags, spData)
Definition: IDataObject.cpp:93
static BOOL write_raw_file(const WCHAR *FileName, const void *Data, DWORD Size)
Definition: IDataObject.cpp:21
static CLIPFORMAT cfHIDA
bool IsFormatAdvertised_(const char *file, int line, IDataObject *pDataObj, CLIPFORMAT cfFormat, TYMED tymed)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ok_hr_(file, line, status, expected)
Definition: apitest.h:55
#define ok_hex(expression, result)
Definition: atltest.h:94
#define trace
Definition: atltest.h:70
#define ok_str(x, y)
Definition: atltest.h:127
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define ok_wstr(x, y)
Definition: atltest.h:130
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
#define ok_ptr(expression, result)
Definition: atltest.h:108
#define CF_HDROP
Definition: constants.h:410
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
EXTERN_C const GUID CLSID_ZipFolderContextMenu
Definition: precomp.h:30
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
@ Success
Definition: eventcreate.c:712
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:939
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int Mask
Definition: fpcontrol.c:82
ULONG Handle
Definition: gdb_input.c:15
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT EnumFormatEtc([in] DWORD dwDirection, [out] IEnumFORMATETC **ppenumFormatEtc)
HRESULT Write([in, size_is(cb)] const void *pv, [in] ULONG cb, [out] ULONG *pcbWritten)
HRESULT Read([out, size_is(cb), length_is(*pcbRead)] void *pv, [in] ULONG cb, [out] ULONG *pcbRead)
HRESULT GetUIObjectOf([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
HRESULT EnumObjects([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
HRESULT SetSize([in] ULARGE_INTEGER libNewSize)
HRESULT Stat([out] STATSTG *pstatstg, [in] DWORD grfStatFlag)
HRESULT Seek([in] LARGE_INTEGER dlibMove, [in] DWORD dwOrigin, [out] ULARGE_INTEGER *plibNewPosition)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define wine_dbgstr_w
Definition: kernel32.h:34
#define trace_(file, line,...)
Definition: kmt_test.h:223
#define CREATE_ALWAYS
Definition: disk.h:72
#define InitializeShellFolder(Filename, pFolder)
Definition: precomp.h:25
#define IsFormatAdvertised(pDataObj, cfFormat, tymed)
Definition: precomp.h:28
#define IDR_ZIP_TEST_FILE
Definition: resource.h:2
static char workdir[MAX_PATH]
Definition: batch.c:26
static IStream Stream
Definition: htmldoc.c:1115
static SHCONTF
Definition: ordinal.c:64
static DWORD tymed
Definition: url.c:174
static HWND child
Definition: cursoricon.c:298
unsigned int UINT
Definition: ndis.h:50
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define GENERIC_WRITE
Definition: nt_native.h:90
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define L(x)
Definition: ntvdm.h:50
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:922
const GUID IID_IDataObject
#define RT_RCDATA
Definition: pedump.c:372
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1405
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1361
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define ok_int_(file, line, expression, result)
Definition: test.h:992
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
static void test_DataObject(void)
Definition: shlfolder.c:5102
static const WCHAR CFSTR_FILECONTENTSW[]
Definition: shlobj.h:507
#define CFSTR_SHELLIDLISTA
Definition: shlobj.h:411
#define FD_WRITESTIME
Definition: shlobj.h:2307
#define FD_FILESIZE
Definition: shlobj.h:2308
#define FD_PROGRESSUI
Definition: shlobj.h:2309
#define FD_ATTRIBUTES
Definition: shlobj.h:2304
static const WCHAR CFSTR_FILEDESCRIPTORW[]
Definition: shlobj.h:505
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
FILETIME ftLastWriteTime
Definition: shlobj.h:2340
DWORD dwFileAttributes
Definition: shlobj.h:2337
WCHAR cFileName[MAX_PATH]
Definition: shlobj.h:2343
DWORD nFileSizeLow
Definition: shlobj.h:2342
DWORD nFileSizeHigh
Definition: shlobj.h:2341
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
$ULONG LowPart
Definition: ntbasedef.h:569
$ULONG HighPart
Definition: ntbasedef.h:570
Definition: fci.c:127
Definition: dsound.c:943
Definition: parser.c:49
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define UnlockResource(handle)
Definition: winbase.h:3372
#define S_FALSE
Definition: winerror.h:2357
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
int WINAPI GetClipboardFormatNameA(_In_ UINT format, _Out_writes_(cchMaxCount) LPSTR lpszFormatName, _In_ int cchMaxCount)
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
UINT WINAPI RegisterClipboardFormatA(_In_ LPCSTR)
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185