ReactOS
0.4.17-dev-1266-g5d5a280
shelltest.h
Go to the documentation of this file.
1
#ifndef _SHELLTEST_H_
2
#define _SHELLTEST_H_
3
4
//#define _INC_WINDOWS
5
#define COM_NO_WINDOWS_H
6
7
#include <
ntstatus.h
>
8
#define WIN32_NO_STATUS
9
#include <
apitest.h
>
10
#include <
winreg.h
>
11
#include <
shlobj.h
>
12
#include <
shellapi.h
>
13
#include <shlwapi.h>
14
#include <atlbase.h>
15
#include <atlcom.h>
16
17
// Vista's shell32 is buggy so we need to skip some tests there.
18
static
const
BOOL
g_bVista
= (
GetNTVersion
() ==
_WIN32_WINNT_VISTA
);
19
20
HRESULT
PathToIDList
(
LPCWSTR
pszPath,
ITEMIDLIST
** ppidl);
21
22
static
inline
LPITEMIDLIST
SHELL_SimpleIDListFromPath
(
LPCWSTR
pszPath)
23
{
24
ITEMIDLIST
*pidl =
NULL
;
25
HRESULT
hr
=
PathToIDList
(pszPath, &pidl);
26
return
SUCCEEDED
(
hr
) ? pidl :
NULL
;
27
}
28
29
static
inline
LPCWSTR
RegNameDisp
(
LPCWSTR
s
)
30
{
31
return
(
s
&& *
s
) ?
s
:
L
"(Default)"
;
32
}
33
34
static
inline
UINT
RegSetStringEx
(
HKEY
hKey
,
LPCWSTR
Path
,
LPCWSTR
Name
,
LPCWSTR
Str
,
DWORD
Type
)
35
{
36
return
SHSetValueW
(
hKey
,
Path
,
Name
,
Type
, (
LPCVOID
)
Str
, (
lstrlenW
(
Str
) + 1) *
sizeof
(
WCHAR
));
37
}
38
39
static
inline
UINT
RegSetString
(
HKEY
hKey
,
LPCWSTR
Path
,
LPCWSTR
Name
,
LPCWSTR
Str
)
40
{
41
return
RegSetStringEx
(
hKey
,
Path
,
Name
,
Str
,
REG_SZ
);
42
}
43
44
#ifdef __cplusplus
45
template
<
class
R>
46
HRESULT
SHELL_BindToObject(
IShellFolder
*pSF,
LPCITEMIDLIST
pidl,
IBindCtx
*pBC,
R
riid
,
void
**
ppv
)
47
{
48
CComPtr<IShellFolder> psfDesktop;
49
HRESULT
hr
;
50
if
(!pSF)
51
{
52
if
(
FAILED
(
hr
=
SHGetDesktopFolder
(&psfDesktop)))
53
return
hr
;
54
pSF = psfDesktop;
55
}
56
hr
=
ILIsEmpty
(pidl) ? pSF->
QueryInterface
(
riid
,
ppv
) : pSF->
BindToObject
(pidl, pBC,
riid
,
ppv
);
57
if
(
SUCCEEDED
(
hr
) && !*
ppv
)
58
hr
=
E_FAIL
;
59
return
hr
;
60
}
61
#endif
62
63
#endif
/* !_SHELLTEST_H_ */
SHGetDesktopFolder
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
Definition:
CDesktopFolder.cpp:1107
Path
PRTL_UNICODE_STRING_BUFFER Path
Definition:
RtlNtPathNameToDosPathName.c:10
Str
PCWSTR Str
Definition:
RtlxUnicodeStringToAnsiSize.c:14
Type
Type
Definition:
Type.h:7
apitest.h
GetNTVersion
#define GetNTVersion()
Definition:
apitest.h:17
REG_SZ
#define REG_SZ
Definition:
layer.c:22
E_FAIL
#define E_FAIL
Definition:
ddrawi.h:102
hr
HRESULT hr
Definition:
delayimp.cpp:582
Name
LPWSTR Name
Definition:
desk.c:124
R
@ R
Definition:
bidi.c:79
NULL
#define NULL
Definition:
types.h:112
lstrlenW
#define lstrlenW
Definition:
compat.h:750
SHSetValueW
DWORD WINAPI SHSetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type, const void *data, DWORD data_len)
Definition:
main.c:2292
L
#define L(x)
Definition:
resources.c:13
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
hKey
FxAutoRegKey hKey
Definition:
fxdriverapikm.cpp:59
s
GLdouble s
Definition:
gl.h:2039
UINT
unsigned int UINT
Definition:
sysinfo.c:13
riid
REFIID riid
Definition:
atlbase.h:39
ppv
REFIID LPVOID * ppv
Definition:
atlbase.h:39
HRESULT
Definition:
metahost.idl:58
IBindCtx
Definition:
objidl.idl:96
IShellFolder
Definition:
shobjidl.idl:156
IShellFolder::BindToObject
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
IUnknown::QueryInterface
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
void
Definition:
nsiface.idl:2307
SUCCEEDED
#define SUCCEEDED(hr)
Definition:
intsafe.h:50
FAILED
#define FAILED(hr)
Definition:
intsafe.h:51
LPCVOID
CONST void * LPCVOID
Definition:
minwindef.h:164
ntstatus.h
WCHAR
short WCHAR
Definition:
pedump.c:58
_WIN32_WINNT_VISTA
#define _WIN32_WINNT_VISTA
Definition:
sdkddkver.h:25
shellapi.h
PathToIDList
HRESULT PathToIDList(LPCWSTR pszPath, ITEMIDLIST **ppidl)
Definition:
shelltest.cpp:83
RegSetStringEx
static UINT RegSetStringEx(HKEY hKey, LPCWSTR Path, LPCWSTR Name, LPCWSTR Str, DWORD Type)
Definition:
shelltest.h:34
RegNameDisp
static LPCWSTR RegNameDisp(LPCWSTR s)
Definition:
shelltest.h:29
RegSetString
static UINT RegSetString(HKEY hKey, LPCWSTR Path, LPCWSTR Name, LPCWSTR Str)
Definition:
shelltest.h:39
g_bVista
static const BOOL g_bVista
Definition:
shelltest.h:18
SHELL_SimpleIDListFromPath
static LPITEMIDLIST SHELL_SimpleIDListFromPath(LPCWSTR pszPath)
Definition:
shelltest.h:22
shlobj.h
ILIsEmpty
static BOOL ILIsEmpty(_In_opt_ PCUIDLIST_RELATIVE pidl)
Definition:
shlobj.h:2566
LPITEMIDLIST
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition:
shtypes.idl:41
LPCITEMIDLIST
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition:
shtypes.idl:42
_ITEMIDLIST
Definition:
shtypes.idl:33
LPCWSTR
const uint16_t * LPCWSTR
Definition:
typedefs.h:57
winreg.h
modules
rostests
apitests
shell32
shelltest.h
Generated on Tue Nov 3 2026 06:12:11 for ReactOS by
1.9.6