ReactOS 0.4.15-dev-7113-g9ea2222
shellreg.c
Go to the documentation of this file.
1/*
2 * Shell Registry Access
3 *
4 * Copyright 2000 Juergen Schmied
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <wine/config.h>
22
23#include <stdio.h>
24
25#define WIN32_NO_STATUS
26#define _INC_WINDOWS
27
28#include <windef.h>
29#include <winbase.h>
30#include <shlobj.h>
31#include <shlwapi.h>
32
33#include <wine/debug.h>
34
36
37/*************************************************************************
38 * SHRegOpenKeyA [SHELL32.506]
39 *
40 */
42 HKEY hKey,
43 LPSTR lpSubKey,
44 PHKEY phkResult)
45{
46 TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
47 return RegOpenKeyA(hKey, lpSubKey, phkResult);
48}
49
50/*************************************************************************
51 * SHRegOpenKeyW [SHELL32.507] NT 4.0
52 *
53 */
55 HKEY hkey,
56 LPCWSTR lpszSubKey,
57 PHKEY retkey)
58{
59 WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
60 return RegOpenKeyW( hkey, lpszSubKey, retkey );
61}
62
63/*************************************************************************
64 * SHRegQueryValueA [SHELL32.508]
65 *
66 */
67HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
68{
69 TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue);
70 return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue);
71}
72
73/*************************************************************************
74 * SHRegQueryValueExA [SHELL32.509]
75 *
76 */
78 HKEY hkey,
79 LPCSTR lpValueName,
80 LPDWORD lpReserved,
81 LPDWORD lpType,
82 LPBYTE lpData,
83 LPDWORD lpcbData)
84{
85 TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
86 return SHQueryValueExA(hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
87}
88
89/*************************************************************************
90 * SHRegQueryValueW [SHELL32.510] NT4.0
91 *
92 */
94 HKEY hkey,
95 LPWSTR lpszSubKey,
96 LPWSTR lpszData,
97 LPDWORD lpcbData )
98{
99 WARN("%p %s %p %p semi-stub\n",
100 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
101 return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData );
102}
103
104/*************************************************************************
105 * SHRegQueryValueExW [SHELL32.511] NT4.0
106 */
108 HKEY hkey,
109 LPCWSTR pszValue,
111 LPDWORD pdwType,
114{
115 TRACE("%p %s %p %p %p %p\n",
116 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
117 return SHQueryValueExW(hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
118}
119
120/*************************************************************************
121 * SHRegDeleteKeyW [SHELL32.512]
122 */
124 HKEY hkey,
125 LPCWSTR pszSubKey)
126{
127 FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey));
128 return 0;
129}
130
131/*************************************************************************
132 * SHRegCloseKey [SHELL32.505] NT 4.0
133 *
134 */
136{
137 TRACE("%p\n",hkey);
138 return RegCloseKey( hkey );
139}
140
141/*************************************************************************
142 * SHCreateSessionKey [SHELL32.723]
143 */
145WINAPI
147{
148 HRESULT hr = S_OK;
149 static WCHAR wszSessionKey[256];
150 LONG Error;
151
152 if (!wszSessionKey[0]) // FIXME: Critical Section
153 {
154 HANDLE hToken;
155
157 {
158 TOKEN_STATISTICS Stats;
160
161 if (GetTokenInformation(hToken, TokenStatistics, &Stats, sizeof(Stats), &ReturnLength))
162 {
163 swprintf(wszSessionKey,
164 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%08x%08x",
166 }
167 else
169
170 CloseHandle(hToken);
171 }
172 else
174 }
175
176 if(SUCCEEDED(hr))
177 {
178 Error = RegCreateKeyExW(HKEY_LOCAL_MACHINE, wszSessionKey, 0, NULL,
179 REG_OPTION_VOLATILE, samDesired, NULL, phKey, NULL);
180 if (Error != ERROR_SUCCESS)
182 }
183
184 return hr;
185}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
BOOL Error
Definition: chkdsk.c:66
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3254
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3288
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4232
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4261
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define GetCurrentProcess()
Definition: compat.h:759
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
DWORD WINAPI SHQueryValueExA(HKEY hKey, LPCSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1402
#define swprintf
Definition: precomp.h:40
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
LONG WINAPI SHRegQueryValueExW(HKEY hkey, LPCWSTR pszValue, LPDWORD pdwReserved, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
Definition: shellreg.c:107
HRESULT WINAPI SHRegOpenKeyW(HKEY hkey, LPCWSTR lpszSubKey, PHKEY retkey)
Definition: shellreg.c:54
HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, PHKEY phkResult)
Definition: shellreg.c:41
HRESULT WINAPI SHRegDeleteKeyW(HKEY hkey, LPCWSTR pszSubKey)
Definition: shellreg.c:123
LONG WINAPI SHRegQueryValueExA(HKEY hkey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
Definition: shellreg.c:77
HRESULT WINAPI SHRegQueryValueW(HKEY hkey, LPWSTR lpszSubKey, LPWSTR lpszData, LPDWORD lpcbData)
Definition: shellreg.c:93
HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
Definition: shellreg.c:67
HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey)
Definition: shellreg.c:146
HRESULT WINAPI SHRegCloseKey(HKEY hkey)
Definition: shellreg.c:135
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HighPart
DWORD LowPart
LUID AuthenticationId
Definition: setypes.h:1087
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t * LPDWORD
Definition: typedefs.h:59
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_Reserved_ DWORD * pdwReserved
Definition: wincrypt.h:4254
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4950
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749
#define WINAPI
Definition: msvc.h:6
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
ACCESS_MASK REGSAM
Definition: winreg.h:69
@ TokenStatistics
Definition: setypes.h:975
#define TOKEN_READ
Definition: setypes.h:951
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185