ReactOS 0.4.16-dev-178-g8ba6102
utils.h
Go to the documentation of this file.
1/*
2 * PROJECT: shell32
3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4 * PURPOSE: Utility functions
5 * COPYRIGHT: ReactOS Team
6 */
7
8#pragma once
9
10inline BOOL
12{
14}
15
16inline BOOL
18{
20 if (ret)
22 return ret;
23}
24
25inline DWORD
27{
28 if (Data)
29 return RegSetValueExW(hKey, Name, 0, Type, LPBYTE(Data), Size);
30 else
31 return RegDeleteValueW(hKey, Name);
32}
33
34inline DWORD
36{
37 return RegSetValueExW(hKey, Name, 0, Type, LPBYTE(Str), (lstrlenW(Str) + 1) * sizeof(WCHAR));
38}
39
40// SHExtractIconsW is a forward, use this function instead inside shell32
41inline HICON
43{
44 HICON hIco;
45 int r = PrivateExtractIconsW(File, Index, cx, cy, &hIco, NULL, 1, 0);
46 return r > 0 ? hIco : NULL;
47}
PRTL_UNICODE_STRING_BUFFER Path
Type
Definition: Type.h:7
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: File.h:16
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define lstrlenW
Definition: compat.h:750
HICON SHELL32_SHExtractIcon(LPCWSTR File, int Index, int cx, int cy)
Definition: utils.h:42
BOOL RegKeyExists(HKEY hKey, LPCWSTR Path)
Definition: utils.h:17
DWORD RegSetString(HKEY hKey, LPCWSTR Name, LPCWSTR Str, DWORD Type=REG_SZ)
Definition: utils.h:35
BOOL RegValueExists(HKEY hKey, LPCWSTR Name)
Definition: utils.h:11
DWORD RegSetOrDelete(HKEY hKey, LPCWSTR Name, DWORD Type, LPCVOID Data, DWORD Size)
Definition: utils.h:26
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define REG_SZ
Definition: layer.c:22
static HICON
Definition: imagelist.c:80
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
unsigned char * LPBYTE
Definition: typedefs.h:53
int ret
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
CONST void * LPCVOID
Definition: windef.h:191
UINT WINAPI PrivateExtractIconsW(_In_reads_(MAX_PATH) LPCWSTR szFileName, _In_ int nIconIndex, _In_ int cxIcon, _In_ int cyIcon, _Out_writes_opt_(nIcons) HICON *phicon, _Out_writes_opt_(nIcons) UINT *piconid, _In_ UINT nIcons, _In_ UINT flags)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185