ReactOS 0.4.15-dev-8131-g4988de4
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#include <wine/debug.h>
33
34#include "shell32_main.h"
35
37
38/*************************************************************************
39 * SHRegOpenKeyA [SHELL32.506]
40 *
41 */
43 HKEY hKey,
44 LPSTR lpSubKey,
45 PHKEY phkResult)
46{
47 TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
48 return RegOpenKeyA(hKey, lpSubKey, phkResult);
49}
50
51/*************************************************************************
52 * SHRegOpenKeyW [SHELL32.507] NT 4.0
53 *
54 */
56 HKEY hkey,
57 LPCWSTR lpszSubKey,
58 PHKEY retkey)
59{
60 WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
61 return RegOpenKeyW( hkey, lpszSubKey, retkey );
62}
63
64/*************************************************************************
65 * SHRegQueryValueA [SHELL32.508]
66 *
67 */
68HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
69{
70 TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue);
71 return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue);
72}
73
74/*************************************************************************
75 * SHRegQueryValueExA [SHELL32.509]
76 *
77 */
79 HKEY hkey,
80 LPCSTR lpValueName,
81 LPDWORD lpReserved,
82 LPDWORD lpType,
83 LPBYTE lpData,
84 LPDWORD lpcbData)
85{
86 TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
87 return SHQueryValueExA(hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
88}
89
90/*************************************************************************
91 * SHRegQueryValueW [SHELL32.510] NT4.0
92 *
93 */
95 HKEY hkey,
96 LPWSTR lpszSubKey,
97 LPWSTR lpszData,
98 LPDWORD lpcbData )
99{
100 WARN("%p %s %p %p semi-stub\n",
101 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
102 return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData );
103}
104
105/*************************************************************************
106 * SHRegQueryValueExW [SHELL32.511] NT4.0
107 */
109 HKEY hkey,
110 LPCWSTR pszValue,
112 LPDWORD pdwType,
115{
116 TRACE("%p %s %p %p %p %p\n",
117 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
118 return SHQueryValueExW(hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
119}
120
121/*************************************************************************
122 * SHRegDeleteKeyW [SHELL32.512]
123 */
125 HKEY hkey,
126 LPCWSTR pszSubKey)
127{
128 FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey));
129 return 0;
130}
131
132/*************************************************************************
133 * SHRegCloseKey [SHELL32.505] NT 4.0
134 *
135 */
137{
138 TRACE("%p\n",hkey);
139 return RegCloseKey( hkey );
140}
141
142/*************************************************************************
143 * SHCreateSessionKey [SHELL32.723]
144 */
146WINAPI
148{
149 HRESULT hr = S_OK;
150 static WCHAR wszSessionKey[256];
151 LONG Error;
152
153 if (!wszSessionKey[0]) // FIXME: Critical Section
154 {
155 HANDLE hToken;
156
158 {
159 TOKEN_STATISTICS Stats;
161
162 if (GetTokenInformation(hToken, TokenStatistics, &Stats, sizeof(Stats), &ReturnLength))
163 {
164 swprintf(wszSessionKey,
165 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%08x%08x",
167 }
168 else
170
171 CloseHandle(hToken);
172 }
173 else
175 }
176
177 if(SUCCEEDED(hr))
178 {
179 Error = RegCreateKeyExW(HKEY_LOCAL_MACHINE, wszSessionKey, 0, NULL,
180 REG_OPTION_VOLATILE, samDesired, NULL, phKey, NULL);
181 if (Error != ERROR_SUCCESS)
183 }
184
185 return hr;
186}
#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:114
#define WARN(fmt,...)
Definition: debug.h:115
#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:1096
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4212
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
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:108
HRESULT WINAPI SHRegOpenKeyW(HKEY hkey, LPCWSTR lpszSubKey, PHKEY retkey)
Definition: shellreg.c:55
HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, PHKEY phkResult)
Definition: shellreg.c:42
HRESULT WINAPI SHRegDeleteKeyW(HKEY hkey, LPCWSTR pszSubKey)
Definition: shellreg.c:124
LONG WINAPI SHRegQueryValueExA(HKEY hkey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
Definition: shellreg.c:78
HRESULT WINAPI SHRegQueryValueW(HKEY hkey, LPWSTR lpszSubKey, LPWSTR lpszData, LPDWORD lpcbData)
Definition: shellreg.c:94
HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
Definition: shellreg.c:68
HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey)
Definition: shellreg.c:147
HRESULT WINAPI SHRegCloseKey(HKEY hkey)
Definition: shellreg.c:136
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