ReactOS  0.4.15-dev-2972-gda2a567
IDataObject.cpp File Reference
#include "precomp.h"
Include dependency graph for IDataObject.cpp:

Go to the source code of this file.

Macros

#define FILE_ATTRIBUTE_VIRTUAL   0x10000
 
#define GetFirstDataObject(spFolder, grfFlags, spData)   GetFirstDataObject_(__FILE__, __LINE__, spFolder, grfFlags, spData)
 

Functions

 DEFINE_GUID (CLSID_ZipFolderContextMenu, 0xb8cdcb65, 0xb1bf, 0x4b42, 0x94, 0x28, 0x1d, 0xfd, 0xb7, 0xee, 0x92, 0xaf)
 
static BOOL write_raw_file (const WCHAR *FileName, const void *Data, DWORD Size)
 
BOOL extract_resource (WCHAR *Filename, LPCWSTR ResourceName, WCHAR *ParentFolder)
 
bool InitializeShellFolder_ (const char *file, int line, const WCHAR *Filename, CComPtr< IShellFolder > &spFolder)
 
static bool GetFirstDataObject_ (const char *file, int line, IShellFolder *spFolder, SHCONTF grfFlags, CComPtr< IDataObject > &spData)
 
bool IsFormatAdvertised_ (const char *file, int line, IDataObject *pDataObj, CLIPFORMAT cfFormat, TYMED tymed)
 
static void test_FileDescriptor (FILEGROUPDESCRIPTORW *Descriptor)
 
static void test_FileDescriptor_Folder (FILEGROUPDESCRIPTORW *Descriptor)
 
static void test_FileContents1 (IStream *Stream)
 
static void test_FileContents2 (IStream *Stream)
 
static void test_DataObject_FirstFile (IShellFolder *pFolder)
 
static void test_DataObject_FirstFolder (IShellFolder *pFolder)
 
static void test_DataObject (const WCHAR *Filename)
 
 START_TEST (IDataObject)
 

Variables

static bool g_bOldZipfldr
 
const char test_file_1_contents [] = "Some generic text in the root file.\r\nMore text on a new line."
 
const char test_file_2_contents [] = "Some generic text in the file in folder_1.\r\nMore text on a new line."
 
static GUID GUID_NULL_
 
static CLIPFORMAT cfHIDA = RegisterClipboardFormatA(CFSTR_SHELLIDLISTA)
 
static CLIPFORMAT cfFileDescriptor = RegisterClipboardFormatW(CFSTR_FILEDESCRIPTORW)
 
static CLIPFORMAT cfFileContents = RegisterClipboardFormatW(CFSTR_FILECONTENTSW)
 

Macro Definition Documentation

◆ FILE_ATTRIBUTE_VIRTUAL

#define FILE_ATTRIBUTE_VIRTUAL   0x10000

Definition at line 11 of file IDataObject.cpp.

◆ GetFirstDataObject

#define GetFirstDataObject (   spFolder,
  grfFlags,
  spData 
)    GetFirstDataObject_(__FILE__, __LINE__, spFolder, grfFlags, spData)

Definition at line 93 of file IDataObject.cpp.

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( CLSID_ZipFolderContextMenu  ,
0xb8cdcb65  ,
0xb1bf  ,
0x4b42  ,
0x94  ,
0x28  ,
0x1d  ,
0xfd  ,
0xb7  ,
0xee  ,
0x92  ,
0xaf   
)

◆ extract_resource()

BOOL extract_resource ( WCHAR Filename,
LPCWSTR  ResourceName,
WCHAR ParentFolder 
)

Definition at line 39 of file IDataObject.cpp.

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 
69  BOOL Written = write_raw_file(Filename, pData, Size);
71  return Written;
72 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
#define UnlockResource(handle)
Definition: winbase.h:3228
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
static BOOL write_raw_file(const WCHAR *FileName, const void *Data, DWORD Size)
Definition: IDataObject.cpp:21
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static char workdir[MAX_PATH]
Definition: batch.c:26
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RT_RCDATA
Definition: pedump.c:372
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

Referenced by START_TEST().

◆ GetFirstDataObject_()

static bool GetFirstDataObject_ ( const char file,
int  line,
IShellFolder spFolder,
SHCONTF  grfFlags,
CComPtr< IDataObject > &  spData 
)
static

Definition at line 94 of file IDataObject.cpp.

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 }
HRESULT hr
Definition: shlfolder.c:183
const GUID IID_IDataObject
static HWND child
Definition: cursoricon.c:298
if SUCCEEDED(hr)
HRESULT EnumObjects([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
Definition: parser.c:48
#define ok_hr_(file, line, status, expected)
Definition: apitest.h:55
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define ok_int_(file, line, expression, result)
Definition: test.h:933
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)
Definition: fci.c:126

◆ InitializeShellFolder_()

bool InitializeShellFolder_ ( const char file,
int  line,
const WCHAR Filename,
CComPtr< IShellFolder > &  spFolder 
)

Definition at line 74 of file IDataObject.cpp.

75 {
76  CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidl;
77  HRESULT hr;
78  ok_hr_(file, line, (hr = SHParseDisplayName(Filename, NULL, &pidl, 0, NULL)), S_OK);
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 }
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
if SUCCEEDED(hr)
Definition: parser.c:48
#define ok_hr_(file, line, status, expected)
Definition: apitest.h:55
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1381
#define NULL
Definition: types.h:112
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
Definition: fci.c:126

◆ IsFormatAdvertised_()

bool IsFormatAdvertised_ ( const char file,
int  line,
IDataObject pDataObj,
CLIPFORMAT  cfFormat,
TYMED  tymed 
)

Definition at line 114 of file IDataObject.cpp.

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  }
134  ok_hex_(file, line, hr, S_FALSE);
135  return false;
136 }
HRESULT hr
Definition: shlfolder.c:183
#define ok_hex_(expression, result)
const char * fmt
Definition: wsprintf.c:30
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
Definition: parser.c:48
HRESULT EnumFormatEtc([in] DWORD dwDirection, [out] IEnumFORMATETC **ppenumFormatEtc)
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
static DWORD tymed
Definition: url.c:174
#define NULL
Definition: types.h:112
Definition: dsound.c:943
Definition: fci.c:126

◆ START_TEST()

START_TEST ( IDataObject  )

Definition at line 565 of file IDataObject.cpp.

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);
581  CoUninitialize();
582 }
#define ok_hr(status, expected)
Definition: ACListISF.cpp:31
HRESULT hr
Definition: shlfolder.c:183
static void test_DataObject(const WCHAR *Filename)
if SUCCEEDED(hr)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
#define S_OK
Definition: intsafe.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL extract_resource(WCHAR *Filename, LPCWSTR ResourceName, WCHAR *ParentFolder)
Definition: IDataObject.cpp:39
#define IDR_ZIP_TEST_FILE
Definition: resource.h:2

◆ test_DataObject()

static void test_DataObject ( const WCHAR Filename)
static

Definition at line 554 of file IDataObject.cpp.

555 {
556  CComPtr<IShellFolder> spFolder;
557  if (!InitializeShellFolder(Filename, spFolder))
558  return;
559 
560  test_DataObject_FirstFile(spFolder);
561  test_DataObject_FirstFolder(spFolder);
562 }
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
static void test_DataObject_FirstFolder(IShellFolder *pFolder)
static void test_DataObject_FirstFile(IShellFolder *pFolder)
#define InitializeShellFolder(Filename, pFolder)
Definition: precomp.h:25

Referenced by START_TEST().

◆ test_DataObject_FirstFile()

static void test_DataObject_FirstFile ( IShellFolder pFolder)
static

Definition at line 409 of file IDataObject.cpp.

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);
435  test_FileDescriptor(static_cast<FILEGROUPDESCRIPTORW*>(pData));
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 }
static CLIPFORMAT cfFileDescriptor
HRESULT hr
Definition: shlfolder.c:183
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define IsFormatAdvertised(pDataObj, cfFormat, tymed)
Definition: precomp.h:28
static CLIPFORMAT cfHIDA
#define ok_ptr(expression, result)
Definition: atltest.h:108
static CLIPFORMAT cfFileContents
#define ok_hex(expression, result)
Definition: atltest.h:94
if SUCCEEDED(hr)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define CF_HDROP
Definition: constants.h:410
#define trace
Definition: atltest.h:70
LONG HRESULT
Definition: typedefs.h:79
static void test_FileDescriptor(FILEGROUPDESCRIPTORW *Descriptor)
static void test_FileContents1(IStream *Stream)
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GetFirstDataObject(spFolder, grfFlags, spData)
Definition: IDataObject.cpp:93
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_DataObject().

◆ test_DataObject_FirstFolder()

static void test_DataObject_FirstFolder ( IShellFolder pFolder)
static

Definition at line 476 of file IDataObject.cpp.

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);
497  test_FileDescriptor_Folder(static_cast<FILEGROUPDESCRIPTORW*>(pData));
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 }
static CLIPFORMAT cfFileDescriptor
HRESULT hr
Definition: shlfolder.c:183
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define IsFormatAdvertised(pDataObj, cfFormat, tymed)
Definition: precomp.h:28
static CLIPFORMAT cfHIDA
#define ok_ptr(expression, result)
Definition: atltest.h:108
static CLIPFORMAT cfFileContents
#define E_FAIL
Definition: ddrawi.h:102
#define ok_hex(expression, result)
Definition: atltest.h:94
static void test_FileContents2(IStream *Stream)
if SUCCEEDED(hr)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define CF_HDROP
Definition: constants.h:410
static void test_FileDescriptor_Folder(FILEGROUPDESCRIPTORW *Descriptor)
LONG HRESULT
Definition: typedefs.h:79
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GetFirstDataObject(spFolder, grfFlags, spData)
Definition: IDataObject.cpp:93
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_DataObject().

◆ test_FileContents1()

static void test_FileContents1 ( IStream Stream)
static

Definition at line 223 of file IDataObject.cpp.

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))
270  ok_int(NewPosition.LowPart, strlen(test_file_1_contents));
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 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ok_str(x, y)
Definition: atltest.h:127
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const char * wine_dbgstr_guid(const GUID *guid)
$ULONG LowPart
Definition: ntbasedef.h:569
#define ok_hex(expression, result)
Definition: atltest.h:94
const char test_file_1_contents[]
Definition: IDataObject.cpp:18
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
#define ok_int(expression, result)
Definition: atltest.h:134
$ULONG HighPart
Definition: ntbasedef.h:570
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
static GUID GUID_NULL_
static const WCHAR L[]
Definition: oid.c:1250
#define ok_wstr(x, y)
Definition: atltest.h:130
processorSet Mask
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int ULONG
Definition: retypes.h:1
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:921
#define memset(x, y, z)
Definition: compat.h:39
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
DWORD dwLowDateTime
Definition: mapidefs.h:65

Referenced by test_DataObject_FirstFile().

◆ test_FileContents2()

static void test_FileContents2 ( IStream Stream)
static

Definition at line 313 of file IDataObject.cpp.

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))
360  ok_int(NewPosition.LowPart, strlen(test_file_2_contents));
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 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ok_str(x, y)
Definition: atltest.h:127
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const char * wine_dbgstr_guid(const GUID *guid)
$ULONG LowPart
Definition: ntbasedef.h:569
#define ok_hex(expression, result)
Definition: atltest.h:94
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
#define ok_int(expression, result)
Definition: atltest.h:134
const char test_file_2_contents[]
Definition: IDataObject.cpp:19
$ULONG HighPart
Definition: ntbasedef.h:570
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
static GUID GUID_NULL_
static const WCHAR L[]
Definition: oid.c:1250
#define ok_wstr(x, y)
Definition: atltest.h:130
processorSet Mask
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int ULONG
Definition: retypes.h:1
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:921
#define memset(x, y, z)
Definition: compat.h:39
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
DWORD dwLowDateTime
Definition: mapidefs.h:65

Referenced by test_DataObject_FirstFolder().

◆ test_FileDescriptor()

static void test_FileDescriptor ( FILEGROUPDESCRIPTORW Descriptor)
static

Definition at line 163 of file IDataObject.cpp.

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);
179  ok_hex(FileDescriptor->nFileSizeLow, strlen(test_file_1_contents));
180  ok_wstr(FileDescriptor->cFileName, L"test_file_for_zip.txt");
181  }
182 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
DWORD nFileSizeLow
Definition: shlobj.h:2174
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
#define FD_PROGRESSUI
Definition: shlobj.h:2141
DWORD nFileSizeHigh
Definition: shlobj.h:2173
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FD_ATTRIBUTES
Definition: shlobj.h:2136
#define ok_hex(expression, result)
Definition: atltest.h:94
const char test_file_1_contents[]
Definition: IDataObject.cpp:18
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define FD_FILESIZE
Definition: shlobj.h:2140
#define ok_int(expression, result)
Definition: atltest.h:134
DWORD dwFileAttributes
Definition: shlobj.h:2169
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
FILETIME ftLastWriteTime
Definition: shlobj.h:2172
unsigned short WORD
Definition: ntddk_ex.h:93
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
static const WCHAR L[]
Definition: oid.c:1250
#define ok_wstr(x, y)
Definition: atltest.h:130
processorSet Mask
#define FILE_ATTRIBUTE_VIRTUAL
Definition: IDataObject.cpp:11
#define FD_WRITESTIME
Definition: shlobj.h:2139
WCHAR cFileName[MAX_PATH]
Definition: shlobj.h:2175
DWORD dwLowDateTime
Definition: mapidefs.h:65

Referenced by test_DataObject_FirstFile().

◆ test_FileDescriptor_Folder()

static void test_FileDescriptor_Folder ( FILEGROUPDESCRIPTORW Descriptor)
static

Definition at line 184 of file IDataObject.cpp.

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);
216  ok_hex(FileDescriptor->nFileSizeLow, strlen(test_file_2_contents));
217  ok_wstr(FileDescriptor->cFileName, L"folder_1\\test_file_for_zip.txt");
218  }
219  }
220 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
DWORD nFileSizeLow
Definition: shlobj.h:2174
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
#define FD_PROGRESSUI
Definition: shlobj.h:2141
DWORD nFileSizeHigh
Definition: shlobj.h:2173
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FD_ATTRIBUTES
Definition: shlobj.h:2136
#define ok_hex(expression, result)
Definition: atltest.h:94
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define FD_FILESIZE
Definition: shlobj.h:2140
#define ok_int(expression, result)
Definition: atltest.h:134
const char test_file_2_contents[]
Definition: IDataObject.cpp:19
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
DWORD dwFileAttributes
Definition: shlobj.h:2169
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
FILETIME ftLastWriteTime
Definition: shlobj.h:2172
unsigned short WORD
Definition: ntddk_ex.h:93
static bool g_bOldZipfldr
Definition: IDataObject.cpp:17
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
static const WCHAR L[]
Definition: oid.c:1250
#define ok_wstr(x, y)
Definition: atltest.h:130
processorSet Mask
#define FILE_ATTRIBUTE_VIRTUAL
Definition: IDataObject.cpp:11
#define FD_WRITESTIME
Definition: shlobj.h:2139
#define ok(value,...)
Definition: atltest.h:57
WCHAR cFileName[MAX_PATH]
Definition: shlobj.h:2175
DWORD dwLowDateTime
Definition: mapidefs.h:65

Referenced by test_DataObject_FirstFolder().

◆ write_raw_file()

static BOOL write_raw_file ( const WCHAR FileName,
const void Data,
DWORD  Size 
)
static

Definition at line 21 of file IDataObject.cpp.

22 {
23  BOOL Success;
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 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:598
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
#define skip(...)
Definition: atltest.h:64
_In_ HANDLE Handle
Definition: extypes.h:390

Referenced by extract_resource().

Variable Documentation

◆ cfFileContents

CLIPFORMAT cfFileContents = RegisterClipboardFormatW(CFSTR_FILECONTENTSW)
static

Definition at line 407 of file IDataObject.cpp.

Referenced by test_DataObject_FirstFile(), and test_DataObject_FirstFolder().

◆ cfFileDescriptor

CLIPFORMAT cfFileDescriptor = RegisterClipboardFormatW(CFSTR_FILEDESCRIPTORW)
static

Definition at line 406 of file IDataObject.cpp.

Referenced by test_DataObject_FirstFile(), and test_DataObject_FirstFolder().

◆ cfHIDA

CLIPFORMAT cfHIDA = RegisterClipboardFormatA(CFSTR_SHELLIDLISTA)
static

Definition at line 405 of file IDataObject.cpp.

Referenced by test_DataObject_FirstFile(), and test_DataObject_FirstFolder().

◆ g_bOldZipfldr

◆ GUID_NULL_

GUID GUID_NULL_
static

Definition at line 222 of file IDataObject.cpp.

Referenced by test_FileContents1(), and test_FileContents2().

◆ test_file_1_contents

const char test_file_1_contents[] = "Some generic text in the root file.\r\nMore text on a new line."

Definition at line 18 of file IDataObject.cpp.

Referenced by test_FileContents1(), and test_FileDescriptor().

◆ test_file_2_contents

const char test_file_2_contents[] = "Some generic text in the file in folder_1.\r\nMore text on a new line."

Definition at line 19 of file IDataObject.cpp.

Referenced by test_FileContents2(), and test_FileDescriptor_Folder().