ReactOS 0.4.15-dev-7704-gc07eb9f
precomp.h File Reference
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <atlbase.h>
#include <atlcom.h>
#include <shellapi.h>
#include <shlwapi.h>
#include <strsafe.h>
#include <shellutils.h>
#include <apitest.h>
#include "resource.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define InitializeShellFolder(Filename, pFolder)   InitializeShellFolder_(__FILE__, __LINE__, Filename, pFolder)
 
#define IsFormatAdvertised(pDataObj, cfFormat, tymed)   IsFormatAdvertised_(__FILE__, __LINE__, pDataObj, cfFormat, tymed)
 
#define ok_displayname(pFolder, pidl, Flags, Name)   ok_displayname_(__FILE__, __LINE__, pFolder, pidl, Flags, Name)
 

Functions

BOOL extract_resource (WCHAR *Filename, LPCWSTR ResourceName, WCHAR *ParentFolder)
 
bool InitializeShellFolder_ (const char *file, int line, const WCHAR *Filename, CComPtr< IShellFolder > &spFolder)
 
bool IsFormatAdvertised_ (const char *file, int line, IDataObject *pDataObj, CLIPFORMAT cfFormat, TYMED tymed)
 
void ok_displayname_ (const char *file, int line, IShellFolder *pFolder, PCUITEMID_CHILD pidl, SHGDNF Flags, LPCWSTR Name)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 5 of file precomp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 6 of file precomp.h.

◆ InitializeShellFolder

#define InitializeShellFolder (   Filename,
  pFolder 
)    InitializeShellFolder_(__FILE__, __LINE__, Filename, pFolder)

Definition at line 25 of file precomp.h.

◆ IsFormatAdvertised

#define IsFormatAdvertised (   pDataObj,
  cfFormat,
  tymed 
)    IsFormatAdvertised_(__FILE__, __LINE__, pDataObj, cfFormat, tymed)

Definition at line 28 of file precomp.h.

◆ ok_displayname

#define ok_displayname (   pFolder,
  pidl,
  Flags,
  Name 
)    ok_displayname_(__FILE__, __LINE__, pFolder, pidl, Flags, Name)

Definition at line 31 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 4 of file precomp.h.

Function Documentation

◆ 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
71 return Written;
72}
static BOOL write_raw_file(const WCHAR *FileName, const void *Data, DWORD Size)
Definition: IDataObject.cpp:21
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
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
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
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
#define wine_dbgstr_w
Definition: kernel32.h:34
static char workdir[MAX_PATH]
Definition: batch.c:26
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define RT_RCDATA
Definition: pedump.c:372
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define UnlockResource(handle)
Definition: winbase.h:3307
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ 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;
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}
#define ok_hr_(file, line, status, expected)
Definition: apitest.h:55
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1396
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1352
HRESULT hr
Definition: shlfolder.c:183
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
Definition: fci.c:127
Definition: parser.c:49
#define IID_PPV_ARG(Itype, ppType)

◆ 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 }
135 return false;
136}
#define ok_hex_(expression, result)
HRESULT EnumFormatEtc([in] DWORD dwDirection, [out] IEnumFORMATETC **ppenumFormatEtc)
static DWORD tymed
Definition: url.c:174
Definition: dsound.c:943
#define S_FALSE
Definition: winerror.h:2357

◆ ok_displayname_()

void ok_displayname_ ( const char file,
int  line,
IShellFolder pFolder,
PCUITEMID_CHILD  pidl,
SHGDNF  Flags,
LPCWSTR  Name 
)

Definition at line 12 of file EnumObjects.cpp.

13{
14 STRRET NameRet;
15 HRESULT hr;
16
17 hr = pFolder->GetDisplayNameOf(pidl, Flags, &NameRet);
19 if (!SUCCEEDED(hr))
20 return;
21
22 WCHAR DisplayName[MAX_PATH];
23 hr = StrRetToBufW(&NameRet, pidl, DisplayName, RTL_NUMBER_OF(DisplayName));
25 if (!SUCCEEDED(hr))
26 return;
27
28 ok_wstr_(file, line, DisplayName, Name);
29}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
#define ok_wstr_(file, line, x, y)
Definition: test.h:986
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170