ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

shellreg.cpp
Go to the documentation of this file.
00001 /*
00002  * Shell Registry Access
00003  *
00004  * Copyright 2000 Juergen Schmied
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include <precomp.h>
00022 
00023 WINE_DEFAULT_DEBUG_CHANNEL(shell);
00024 
00025 /*************************************************************************
00026  * SHRegOpenKeyA                [SHELL32.506]
00027  *
00028  */
00029 EXTERN_C HRESULT WINAPI SHRegOpenKeyA(
00030     HKEY hKey,
00031     LPSTR lpSubKey,
00032     PHKEY phkResult)
00033 {
00034     TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
00035     return RegOpenKeyA(hKey, lpSubKey, phkResult);
00036 }
00037 
00038 /*************************************************************************
00039  * SHRegOpenKeyW                [SHELL32.507] NT 4.0
00040  *
00041  */
00042 EXTERN_C HRESULT WINAPI SHRegOpenKeyW (
00043     HKEY hkey,
00044     LPCWSTR lpszSubKey,
00045     PHKEY retkey)
00046 {
00047     WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
00048     return RegOpenKeyW( hkey, lpszSubKey, retkey );
00049 }
00050 
00051 /*************************************************************************
00052  * SHRegQueryValueA   [SHELL32.508]
00053  *
00054  */
00055 EXTERN_C HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
00056 {
00057     TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue);
00058     return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue);
00059 }
00060 
00061 /*************************************************************************
00062  * SHRegQueryValueExA   [SHELL32.509]
00063  *
00064  */
00065 EXTERN_C HRESULT WINAPI SHRegQueryValueExA(
00066     HKEY hkey,
00067     LPSTR lpValueName,
00068     LPDWORD lpReserved,
00069     LPDWORD lpType,
00070     LPBYTE lpData,
00071     LPDWORD lpcbData)
00072 {
00073     TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
00074     return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
00075 }
00076 
00077 /*************************************************************************
00078  * SHRegQueryValueW                [SHELL32.510] NT4.0
00079  *
00080  */
00081 EXTERN_C HRESULT WINAPI SHRegQueryValueW(
00082     HKEY hkey,
00083     LPWSTR lpszSubKey,
00084     LPWSTR lpszData,
00085     LPDWORD lpcbData )
00086 {
00087     WARN("%p %s %p %p semi-stub\n",
00088         hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
00089     return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData );
00090 }
00091 
00092 /*************************************************************************
00093  * SHRegQueryValueExW    [SHELL32.511] NT4.0
00094  *
00095  * FIXME
00096  *  if the datatype REG_EXPAND_SZ then expand the string and change
00097  *  *pdwType to REG_SZ.
00098  */
00099 EXTERN_C HRESULT WINAPI SHRegQueryValueExW (
00100     HKEY hkey,
00101     LPWSTR pszValue,
00102     LPDWORD pdwReserved,
00103     LPDWORD pdwType,
00104     LPVOID pvData,
00105     LPDWORD pcbData)
00106 {
00107     DWORD ret;
00108     WARN("%p %s %p %p %p %p semi-stub\n",
00109         hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
00110     ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, (LPBYTE)pvData, pcbData);
00111     return ret;
00112 }
00113 
00114 /*************************************************************************
00115  * SHRegDeleteKeyA   [SHELL32.?]
00116  */
00117 HRESULT WINAPI SHRegDeleteKeyA(
00118     HKEY hkey,
00119     LPCSTR pszSubKey)
00120 {
00121     FIXME("hkey=%p, %s\n", hkey, debugstr_a(pszSubKey));
00122     return 0;
00123 }
00124 
00125 /*************************************************************************
00126  * SHRegDeleteKeyW   [SHELL32.512]
00127  */
00128 EXTERN_C HRESULT WINAPI SHRegDeleteKeyW(
00129     HKEY hkey,
00130     LPCWSTR pszSubKey)
00131 {
00132     FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey));
00133     return 0;
00134 }
00135 
00136 /*************************************************************************
00137  * SHRegCloseKey            [SHELL32.505] NT 4.0
00138  */
00139 EXTERN_C HRESULT WINAPI SHRegCloseKey (HKEY hkey)
00140 {
00141     TRACE("%p\n",hkey);
00142     return RegCloseKey( hkey );
00143 }
00144 
00145 /*************************************************************************
00146  * SHCreateSessionKey            [SHELL32.723]
00147  */
00148 EXTERN_C HRESULT
00149 WINAPI
00150 SHCreateSessionKey(REGSAM samDesired, PHKEY phKey)
00151 {
00152     HRESULT hr = S_OK;
00153     static WCHAR wszSessionKey[256];
00154     LONG Error;
00155 
00156     if (!wszSessionKey[0]) // FIXME: Critical Section
00157     {
00158         HANDLE hToken;
00159 
00160         if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken))
00161         {
00162             TOKEN_STATISTICS Stats;
00163             DWORD ReturnLength;
00164 
00165             if (GetTokenInformation(hToken, TokenStatistics, &Stats, sizeof(Stats), &ReturnLength))
00166             {
00167                 swprintf(wszSessionKey,
00168                          L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%08x%08x",
00169                          Stats.AuthenticationId.HighPart, Stats.AuthenticationId.LowPart);
00170             }
00171             else
00172                 hr = HRESULT_FROM_WIN32(GetLastError());
00173 
00174             CloseHandle(hToken);
00175         }
00176         else
00177             hr = HRESULT_FROM_WIN32(GetLastError());
00178     }
00179 
00180     if(SUCCEEDED(hr))
00181     {
00182         Error = RegCreateKeyExW(HKEY_LOCAL_MACHINE, wszSessionKey, 0, NULL,
00183                                 REG_OPTION_VOLATILE, samDesired, NULL, phKey, NULL);
00184         if (Error != ERROR_SUCCESS)
00185             hr = HRESULT_FROM_WIN32(Error);
00186     }
00187 
00188     return hr;
00189 }

Generated on Sun May 27 2012 04:26:26 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.