| 1 | /* $Id: registry.cpp,v 1.18 2002-06-25 10:27:00 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Win32 registry API functions for OS/2 | 
|---|
| 5 | * | 
|---|
| 6 | * 1998/06/12 | 
|---|
| 7 | * | 
|---|
| 8 | * Copyright 1998 Sander van Leeuwen | 
|---|
| 9 | * Copyright 1998 Patrick Haller | 
|---|
| 10 | * | 
|---|
| 11 | * | 
|---|
| 12 | * TODO: Many unicode apis are still wrong (missing unicode conversions and wrong sizes)!!!!! | 
|---|
| 13 | * | 
|---|
| 14 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 15 | * | 
|---|
| 16 | */ | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | /***************************************************************************** | 
|---|
| 20 | * Includes                                                                  * | 
|---|
| 21 | *****************************************************************************/ | 
|---|
| 22 |  | 
|---|
| 23 | #include <odin.h> | 
|---|
| 24 | #include <odinwrap.h> | 
|---|
| 25 | #include <os2sel.h> | 
|---|
| 26 |  | 
|---|
| 27 | #include <os2win.h> | 
|---|
| 28 | #include <stdlib.h> | 
|---|
| 29 | #include <stdarg.h> | 
|---|
| 30 | #include <string.h> | 
|---|
| 31 | #include <odinwrap.h> | 
|---|
| 32 | #include <misc.h> | 
|---|
| 33 | #include "unicode.h" | 
|---|
| 34 | #include <winreg.h> | 
|---|
| 35 | #include <heapstring.h> | 
|---|
| 36 |  | 
|---|
| 37 | #define DBG_LOCALLOG    DBG_registry | 
|---|
| 38 | #include "dbglocal.h" | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 | ODINDEBUGCHANNEL(ADVAPI32-REGISTRY) | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 | /***************************************************************************** | 
|---|
| 45 | * Defines                                                                   * | 
|---|
| 46 | *****************************************************************************/ | 
|---|
| 47 |  | 
|---|
| 48 | /* this define enables certain less important debug messages */ | 
|---|
| 49 | //#define DEBUG_LOCAL 1 | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | static HKEY hKeyClassesRoot  = HKEY_CLASSES_ROOT_O32; | 
|---|
| 53 | static HKEY hKeyCurrentUser  = HKEY_CURRENT_USER_O32; | 
|---|
| 54 | static HKEY hKeyLocalMachine = HKEY_LOCAL_MACHINE_O32; | 
|---|
| 55 | static HKEY hKeyUsers        = HKEY_USERS_O32; | 
|---|
| 56 |  | 
|---|
| 57 | /***************************************************************************** | 
|---|
| 58 | * Name      : Convert Key | 
|---|
| 59 | * Purpose   : convert key handle values between win32 and os/2 | 
|---|
| 60 | * Parameters: HKEY winkey - the win32 key handle value | 
|---|
| 61 | * Variables : | 
|---|
| 62 | * Result    : the os/2 warp registry key handle value | 
|---|
| 63 | * Remark    : | 
|---|
| 64 | * Status    : UNTESTED STUB | 
|---|
| 65 | * | 
|---|
| 66 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 67 | *****************************************************************************/ | 
|---|
| 68 |  | 
|---|
| 69 | static HKEY ConvertKey(HKEY winkey) | 
|---|
| 70 | { | 
|---|
| 71 | switch((DWORD)winkey) | 
|---|
| 72 | { | 
|---|
| 73 | case HKEY_CLASSES_ROOT:   return hKeyClassesRoot; | 
|---|
| 74 | case HKEY_CURRENT_USER:   return hKeyCurrentUser; | 
|---|
| 75 | case HKEY_LOCAL_MACHINE:  return hKeyLocalMachine; | 
|---|
| 76 | case HKEY_USERS:          return hKeyUsers; | 
|---|
| 77 | } | 
|---|
| 78 | return(winkey); | 
|---|
| 79 | } | 
|---|
| 80 |  | 
|---|
| 81 | void WIN32API SetRegistryRootKey(HKEY hRootkey, HKEY hKey) | 
|---|
| 82 | { | 
|---|
| 83 | switch((DWORD)hRootkey) | 
|---|
| 84 | { | 
|---|
| 85 | case HKEY_CLASSES_ROOT: | 
|---|
| 86 | hKeyClassesRoot = hKey; | 
|---|
| 87 | break; | 
|---|
| 88 | case HKEY_CURRENT_USER: | 
|---|
| 89 | hKeyCurrentUser = hKey; | 
|---|
| 90 | break; | 
|---|
| 91 | case HKEY_LOCAL_MACHINE: | 
|---|
| 92 | hKeyLocalMachine = hKey; | 
|---|
| 93 | break; | 
|---|
| 94 | case HKEY_USERS: | 
|---|
| 95 | hKeyUsers = hKey; | 
|---|
| 96 | break; | 
|---|
| 97 | } | 
|---|
| 98 | } | 
|---|
| 99 |  | 
|---|
| 100 | /***************************************************************************** | 
|---|
| 101 | * Name      : | 
|---|
| 102 | * Purpose   : | 
|---|
| 103 | * Parameters: | 
|---|
| 104 | * Variables : | 
|---|
| 105 | * Result    : | 
|---|
| 106 | * Remark    : | 
|---|
| 107 | * Status    : CORRECTED UNTESTED | 
|---|
| 108 | * | 
|---|
| 109 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 110 | *****************************************************************************/ | 
|---|
| 111 |  | 
|---|
| 112 | LONG WIN32API RegCloseKey(HKEY hKey) | 
|---|
| 113 | { | 
|---|
| 114 | return O32_RegCloseKey(ConvertKey(hKey)); | 
|---|
| 115 | } | 
|---|
| 116 |  | 
|---|
| 117 |  | 
|---|
| 118 | /***************************************************************************** | 
|---|
| 119 | * Name      : | 
|---|
| 120 | * Purpose   : | 
|---|
| 121 | * Parameters: | 
|---|
| 122 | * Variables : | 
|---|
| 123 | * Result    : | 
|---|
| 124 | * Remark    : | 
|---|
| 125 | * Status    : CORRECTED UNTESTED | 
|---|
| 126 | * | 
|---|
| 127 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 128 | *****************************************************************************/ | 
|---|
| 129 |  | 
|---|
| 130 | LONG WIN32API RegCreateKeyA(HKEY hKey, LPCSTR lpszSubKey, PHKEY phkResult) | 
|---|
| 131 | { | 
|---|
| 132 | dprintf(("RegCreateKeyA %x %s", hKey, lpszSubKey)); | 
|---|
| 133 | return O32_RegCreateKey(ConvertKey(hKey), | 
|---|
| 134 | lpszSubKey, | 
|---|
| 135 | phkResult); | 
|---|
| 136 | } | 
|---|
| 137 |  | 
|---|
| 138 |  | 
|---|
| 139 | /***************************************************************************** | 
|---|
| 140 | * Name      : | 
|---|
| 141 | * Purpose   : | 
|---|
| 142 | * Parameters: | 
|---|
| 143 | * Variables : | 
|---|
| 144 | * Result    : | 
|---|
| 145 | * Remark    : | 
|---|
| 146 | * Status    : CORRECTED UNTESTED | 
|---|
| 147 | * | 
|---|
| 148 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 149 | *****************************************************************************/ | 
|---|
| 150 |  | 
|---|
| 151 | LONG WIN32API RegCreateKeyW(HKEY hKey, LPCWSTR lpszSubKey, PHKEY phkResult) | 
|---|
| 152 | { | 
|---|
| 153 | char *astring = UnicodeToAsciiString((LPWSTR)lpszSubKey); | 
|---|
| 154 | LONG  rc; | 
|---|
| 155 |  | 
|---|
| 156 | dprintf(("RegCreateKeyW %x %s", hKey, astring)); | 
|---|
| 157 | rc = O32_RegCreateKey(ConvertKey(hKey), | 
|---|
| 158 | astring, | 
|---|
| 159 | phkResult); | 
|---|
| 160 |  | 
|---|
| 161 | if (NULL != astring) | 
|---|
| 162 | FreeAsciiString(astring); | 
|---|
| 163 |  | 
|---|
| 164 | return(rc); | 
|---|
| 165 | } | 
|---|
| 166 |  | 
|---|
| 167 |  | 
|---|
| 168 | /***************************************************************************** | 
|---|
| 169 | * Name      : | 
|---|
| 170 | * Purpose   : | 
|---|
| 171 | * Parameters: | 
|---|
| 172 | * Variables : | 
|---|
| 173 | * Result    : | 
|---|
| 174 | * Remark    : | 
|---|
| 175 | * Status    : CORRECTED UNTESTED | 
|---|
| 176 | * | 
|---|
| 177 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 178 | *****************************************************************************/ | 
|---|
| 179 |  | 
|---|
| 180 | LONG WIN32API RegCreateKeyExA(HKEY                  hKey, | 
|---|
| 181 | LPCSTR                lpszSubKey, | 
|---|
| 182 | DWORD                 dwReserved, | 
|---|
| 183 | LPSTR                 lpszClass, | 
|---|
| 184 | DWORD                 fdwOptions, | 
|---|
| 185 | REGSAM                samDesired, | 
|---|
| 186 | LPSECURITY_ATTRIBUTES lpSecurityAttributes, | 
|---|
| 187 | PHKEY                 phkResult, | 
|---|
| 188 | LPDWORD               lpdwDisposition) | 
|---|
| 189 | { | 
|---|
| 190 | dprintf(("RegCreateKeyExA %x %s", hKey, lpszSubKey)); | 
|---|
| 191 |  | 
|---|
| 192 | return O32_RegCreateKeyEx(ConvertKey(hKey), | 
|---|
| 193 | lpszSubKey, | 
|---|
| 194 | dwReserved, | 
|---|
| 195 | lpszClass, | 
|---|
| 196 | fdwOptions, | 
|---|
| 197 | samDesired, //  | KEY_READ | 
|---|
| 198 | lpSecurityAttributes, | 
|---|
| 199 | phkResult, | 
|---|
| 200 | lpdwDisposition); | 
|---|
| 201 | } | 
|---|
| 202 |  | 
|---|
| 203 |  | 
|---|
| 204 | /***************************************************************************** | 
|---|
| 205 | * Name      : | 
|---|
| 206 | * Purpose   : | 
|---|
| 207 | * Parameters: | 
|---|
| 208 | * Variables : | 
|---|
| 209 | * Result    : | 
|---|
| 210 | * Remark    : | 
|---|
| 211 | * Status    : CORRECTED UNTESTED | 
|---|
| 212 | * | 
|---|
| 213 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 214 | *****************************************************************************/ | 
|---|
| 215 |  | 
|---|
| 216 | LONG WIN32API RegCreateKeyExW(HKEY                  hKey, | 
|---|
| 217 | LPCWSTR               lpszSubKey, | 
|---|
| 218 | DWORD                 dwReserved, | 
|---|
| 219 | LPWSTR                lpszClass, | 
|---|
| 220 | DWORD                 fdwOptions, | 
|---|
| 221 | REGSAM                samDesired, | 
|---|
| 222 | LPSECURITY_ATTRIBUTES lpSecurityAttributes, | 
|---|
| 223 | PHKEY                 phkResult, | 
|---|
| 224 | LPDWORD               lpdwDisposition) | 
|---|
| 225 | { | 
|---|
| 226 | char *astring1 = UnicodeToAsciiString((LPWSTR)lpszSubKey); | 
|---|
| 227 | char *astring2 = UnicodeToAsciiString(lpszClass); | 
|---|
| 228 | LONG  rc; | 
|---|
| 229 |  | 
|---|
| 230 | dprintf(("RegCreateKeyExW %x %s", hKey, astring1)); | 
|---|
| 231 |  | 
|---|
| 232 | rc = O32_RegCreateKeyEx(ConvertKey(hKey), | 
|---|
| 233 | astring1, | 
|---|
| 234 | dwReserved, | 
|---|
| 235 | astring2, | 
|---|
| 236 | fdwOptions, | 
|---|
| 237 | samDesired, //  | KEY_READ | 
|---|
| 238 | lpSecurityAttributes, | 
|---|
| 239 | phkResult, | 
|---|
| 240 | lpdwDisposition); | 
|---|
| 241 |  | 
|---|
| 242 | if (NULL != astring1) | 
|---|
| 243 | FreeAsciiString(astring1); | 
|---|
| 244 |  | 
|---|
| 245 | if (NULL != astring2) | 
|---|
| 246 | FreeAsciiString(astring2); | 
|---|
| 247 |  | 
|---|
| 248 | return(rc); | 
|---|
| 249 | } | 
|---|
| 250 |  | 
|---|
| 251 |  | 
|---|
| 252 | /***************************************************************************** | 
|---|
| 253 | * Name      : | 
|---|
| 254 | * Purpose   : | 
|---|
| 255 | * Parameters: | 
|---|
| 256 | * Variables : | 
|---|
| 257 | * Result    : | 
|---|
| 258 | * Remark    : | 
|---|
| 259 | * Status    : CORRECTED UNTESTED | 
|---|
| 260 | * | 
|---|
| 261 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 262 | *****************************************************************************/ | 
|---|
| 263 |  | 
|---|
| 264 | LONG WIN32API RegDeleteKeyW(HKEY hKey, LPWSTR lpszSubKey) | 
|---|
| 265 | { | 
|---|
| 266 | char *astring = UnicodeToAsciiString(lpszSubKey); | 
|---|
| 267 | LONG  rc; | 
|---|
| 268 |  | 
|---|
| 269 | dprintf(("RegDeleteKeyW %s", astring)); | 
|---|
| 270 | rc = O32_RegDeleteKey(ConvertKey(hKey), | 
|---|
| 271 | astring); | 
|---|
| 272 |  | 
|---|
| 273 | if (NULL != astring) | 
|---|
| 274 | FreeAsciiString(astring); | 
|---|
| 275 |  | 
|---|
| 276 | return(rc); | 
|---|
| 277 | } | 
|---|
| 278 |  | 
|---|
| 279 |  | 
|---|
| 280 | /***************************************************************************** | 
|---|
| 281 | * Name      : | 
|---|
| 282 | * Purpose   : | 
|---|
| 283 | * Parameters: | 
|---|
| 284 | * Variables : | 
|---|
| 285 | * Result    : | 
|---|
| 286 | * Remark    : | 
|---|
| 287 | * Status    : CORRECTED UNTESTED | 
|---|
| 288 | * | 
|---|
| 289 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 290 | *****************************************************************************/ | 
|---|
| 291 |  | 
|---|
| 292 | LONG WIN32API RegDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey) | 
|---|
| 293 | { | 
|---|
| 294 | dprintf(("RegDeleteKeyW %s", lpszSubKey)); | 
|---|
| 295 | return O32_RegDeleteKey(ConvertKey(hKey), lpszSubKey); | 
|---|
| 296 | } | 
|---|
| 297 |  | 
|---|
| 298 |  | 
|---|
| 299 | /***************************************************************************** | 
|---|
| 300 | * Name      : | 
|---|
| 301 | * Purpose   : | 
|---|
| 302 | * Parameters: | 
|---|
| 303 | * Variables : | 
|---|
| 304 | * Result    : | 
|---|
| 305 | * Remark    : | 
|---|
| 306 | * Status    : CORRECTED UNTESTED | 
|---|
| 307 | * | 
|---|
| 308 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 309 | *****************************************************************************/ | 
|---|
| 310 |  | 
|---|
| 311 | LONG WIN32API RegDeleteValueA(HKEY hKey, LPSTR lpszValue) | 
|---|
| 312 | { | 
|---|
| 313 | return O32_RegDeleteValue(ConvertKey(hKey), | 
|---|
| 314 | lpszValue); | 
|---|
| 315 | } | 
|---|
| 316 |  | 
|---|
| 317 |  | 
|---|
| 318 | /***************************************************************************** | 
|---|
| 319 | * Name      : | 
|---|
| 320 | * Purpose   : | 
|---|
| 321 | * Parameters: | 
|---|
| 322 | * Variables : | 
|---|
| 323 | * Result    : | 
|---|
| 324 | * Remark    : | 
|---|
| 325 | * Status    : CORRECTED UNTESTED | 
|---|
| 326 | * | 
|---|
| 327 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 328 | *****************************************************************************/ | 
|---|
| 329 |  | 
|---|
| 330 | LONG WIN32API RegDeleteValueW(HKEY hKey, LPWSTR lpszValue) | 
|---|
| 331 | { | 
|---|
| 332 | char *astring = UnicodeToAsciiString(lpszValue); | 
|---|
| 333 | LONG  rc; | 
|---|
| 334 |  | 
|---|
| 335 | rc = O32_RegDeleteValue(ConvertKey(hKey), | 
|---|
| 336 | astring); | 
|---|
| 337 |  | 
|---|
| 338 | if (NULL != astring) | 
|---|
| 339 | FreeAsciiString(astring); | 
|---|
| 340 |  | 
|---|
| 341 | return(rc); | 
|---|
| 342 | } | 
|---|
| 343 |  | 
|---|
| 344 |  | 
|---|
| 345 | /***************************************************************************** | 
|---|
| 346 | * Name      : | 
|---|
| 347 | * Purpose   : | 
|---|
| 348 | * Parameters: | 
|---|
| 349 | * Variables : | 
|---|
| 350 | * Result    : | 
|---|
| 351 | * Remark    : | 
|---|
| 352 | * Status    : UNTESTED STUB | 
|---|
| 353 | * | 
|---|
| 354 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 355 | *****************************************************************************/ | 
|---|
| 356 |  | 
|---|
| 357 | LONG WIN32API RegEnumKeyA(HKEY hKey, DWORD iSubKey, LPSTR lpszName, | 
|---|
| 358 | DWORD cchName) | 
|---|
| 359 | { | 
|---|
| 360 | return O32_RegEnumKey(ConvertKey(hKey), | 
|---|
| 361 | iSubKey, | 
|---|
| 362 | lpszName, | 
|---|
| 363 | cchName); | 
|---|
| 364 | } | 
|---|
| 365 |  | 
|---|
| 366 |  | 
|---|
| 367 | /***************************************************************************** | 
|---|
| 368 | * Name      : | 
|---|
| 369 | * Purpose   : | 
|---|
| 370 | * Parameters: | 
|---|
| 371 | * Variables : | 
|---|
| 372 | * Result    : | 
|---|
| 373 | * Remark    : | 
|---|
| 374 | * Status    : UNTESTED STUB | 
|---|
| 375 | * | 
|---|
| 376 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 377 | *****************************************************************************/ | 
|---|
| 378 |  | 
|---|
| 379 | LONG WIN32API RegEnumKeyW(HKEY  hKey, DWORD  iSubKey, LPWSTR lpszName, | 
|---|
| 380 | DWORD cchName) | 
|---|
| 381 | { | 
|---|
| 382 | char *astring; | 
|---|
| 383 | LONG  rc; | 
|---|
| 384 |  | 
|---|
| 385 | rc = O32_RegEnumKey(ConvertKey(hKey), | 
|---|
| 386 | iSubKey, | 
|---|
| 387 | (char *)lpszName, | 
|---|
| 388 | cchName); | 
|---|
| 389 | if(rc == ERROR_SUCCESS) | 
|---|
| 390 | { | 
|---|
| 391 | astring = (char *)malloc(cchName); | 
|---|
| 392 | strcpy(astring, (char *)lpszName); | 
|---|
| 393 | AsciiToUnicode(astring, lpszName); | 
|---|
| 394 | free(astring); | 
|---|
| 395 | } | 
|---|
| 396 | return(rc); | 
|---|
| 397 | } | 
|---|
| 398 |  | 
|---|
| 399 |  | 
|---|
| 400 | /***************************************************************************** | 
|---|
| 401 | * Name      : | 
|---|
| 402 | * Purpose   : | 
|---|
| 403 | * Parameters: | 
|---|
| 404 | * Variables : | 
|---|
| 405 | * Result    : | 
|---|
| 406 | * Remark    : | 
|---|
| 407 | * Status    : UNTESTED STUB | 
|---|
| 408 | * | 
|---|
| 409 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 410 | *****************************************************************************/ | 
|---|
| 411 |  | 
|---|
| 412 | LONG WIN32API RegEnumKeyExA(HKEY       arg1, | 
|---|
| 413 | DWORD      arg2, | 
|---|
| 414 | LPSTR      arg3, | 
|---|
| 415 | LPDWORD    arg4, | 
|---|
| 416 | LPDWORD    arg5, | 
|---|
| 417 | LPSTR      arg6, | 
|---|
| 418 | LPDWORD    arg7, | 
|---|
| 419 | LPFILETIME arg8) | 
|---|
| 420 | { | 
|---|
| 421 | return O32_RegEnumKeyEx(ConvertKey(arg1), | 
|---|
| 422 | arg2, | 
|---|
| 423 | arg3, | 
|---|
| 424 | arg4, | 
|---|
| 425 | arg5, | 
|---|
| 426 | arg6, | 
|---|
| 427 | arg7, | 
|---|
| 428 | arg8); | 
|---|
| 429 | } | 
|---|
| 430 |  | 
|---|
| 431 |  | 
|---|
| 432 | /***************************************************************************** | 
|---|
| 433 | * Name      : | 
|---|
| 434 | * Purpose   : | 
|---|
| 435 | * Parameters: | 
|---|
| 436 | * Variables : | 
|---|
| 437 | * Result    : | 
|---|
| 438 | * Remark    : | 
|---|
| 439 | * Status    : UNTESTED STUB | 
|---|
| 440 | * | 
|---|
| 441 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 442 | *****************************************************************************/ | 
|---|
| 443 |  | 
|---|
| 444 | LONG WIN32API RegEnumKeyExW(HKEY       hKey, | 
|---|
| 445 | DWORD      iSubkey, | 
|---|
| 446 | LPWSTR     lpszName, | 
|---|
| 447 | LPDWORD    lpcchName, | 
|---|
| 448 | LPDWORD    lpdwReserved, | 
|---|
| 449 | LPWSTR     lpszClass, | 
|---|
| 450 | LPDWORD    lpcchClass, | 
|---|
| 451 | LPFILETIME lpffLastWrite) | 
|---|
| 452 | { | 
|---|
| 453 | char *astring; | 
|---|
| 454 | LONG  rc; | 
|---|
| 455 |  | 
|---|
| 456 | rc = O32_RegEnumKeyEx(ConvertKey(hKey), | 
|---|
| 457 | iSubkey, | 
|---|
| 458 | (char *)lpszName, | 
|---|
| 459 | lpcchName, | 
|---|
| 460 | lpdwReserved, | 
|---|
| 461 | (char *)lpszClass, | 
|---|
| 462 | lpcchClass, | 
|---|
| 463 | lpffLastWrite); | 
|---|
| 464 | if(rc == ERROR_SUCCESS) | 
|---|
| 465 | { | 
|---|
| 466 | astring = (char *)malloc(max(*lpcchName+1, (lpcchClass) ? (*lpcchClass+1) : 0));   //class & keyname | 
|---|
| 467 | strcpy(astring, (char *)lpszName); | 
|---|
| 468 | AsciiToUnicode(astring, lpszName); | 
|---|
| 469 | if(lpszClass != NULL) | 
|---|
| 470 | { | 
|---|
| 471 | strcpy(astring, (char *)lpszClass); | 
|---|
| 472 | AsciiToUnicode(astring, lpszClass); | 
|---|
| 473 | } | 
|---|
| 474 | free(astring); | 
|---|
| 475 | } | 
|---|
| 476 | return(rc); | 
|---|
| 477 | } | 
|---|
| 478 |  | 
|---|
| 479 |  | 
|---|
| 480 | /***************************************************************************** | 
|---|
| 481 | * Name      : | 
|---|
| 482 | * Purpose   : | 
|---|
| 483 | * Parameters: | 
|---|
| 484 | * Variables : | 
|---|
| 485 | * Result    : | 
|---|
| 486 | * Remark    : | 
|---|
| 487 | * Status    : UNTESTED STUB | 
|---|
| 488 | * | 
|---|
| 489 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 490 | *****************************************************************************/ | 
|---|
| 491 |  | 
|---|
| 492 | LONG WIN32API RegEnumValueA(HKEY    arg1, | 
|---|
| 493 | DWORD   arg2, | 
|---|
| 494 | LPSTR   arg3, | 
|---|
| 495 | LPDWORD arg4, | 
|---|
| 496 | LPDWORD arg5, | 
|---|
| 497 | LPDWORD arg6, | 
|---|
| 498 | LPBYTE  arg7, | 
|---|
| 499 | LPDWORD arg8) | 
|---|
| 500 | { | 
|---|
| 501 | return O32_RegEnumValue(ConvertKey(arg1), | 
|---|
| 502 | arg2, | 
|---|
| 503 | arg3, | 
|---|
| 504 | arg4, | 
|---|
| 505 | arg5, | 
|---|
| 506 | arg6, | 
|---|
| 507 | arg7, | 
|---|
| 508 | arg8); | 
|---|
| 509 | } | 
|---|
| 510 |  | 
|---|
| 511 |  | 
|---|
| 512 | /***************************************************************************** | 
|---|
| 513 | * Name      : | 
|---|
| 514 | * Purpose   : | 
|---|
| 515 | * Parameters: | 
|---|
| 516 | * Variables : | 
|---|
| 517 | * Result    : | 
|---|
| 518 | * Remark    : | 
|---|
| 519 | * Status    : UNTESTED STUB | 
|---|
| 520 | * | 
|---|
| 521 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 522 | *****************************************************************************/ | 
|---|
| 523 |  | 
|---|
| 524 | LONG WIN32API RegEnumValueW(HKEY    hkey, | 
|---|
| 525 | DWORD   iValue, | 
|---|
| 526 | LPWSTR  lpszValue, | 
|---|
| 527 | LPDWORD lpcchValue, | 
|---|
| 528 | LPDWORD lpdwReserved, | 
|---|
| 529 | LPDWORD lpdwType, | 
|---|
| 530 | LPBYTE  lpbData, | 
|---|
| 531 | LPDWORD lpcbData) | 
|---|
| 532 | { | 
|---|
| 533 | char *astring; | 
|---|
| 534 | LONG  rc, oldsize = 0; | 
|---|
| 535 |  | 
|---|
| 536 | if(lpcbData) { | 
|---|
| 537 | oldsize = *lpcbData; | 
|---|
| 538 | } | 
|---|
| 539 | rc = O32_RegEnumValue(ConvertKey(hkey), | 
|---|
| 540 | iValue, | 
|---|
| 541 | (char *)lpszValue, | 
|---|
| 542 | lpcchValue, | 
|---|
| 543 | lpdwReserved, | 
|---|
| 544 | lpdwType, | 
|---|
| 545 | lpbData, | 
|---|
| 546 | lpcbData); | 
|---|
| 547 | if(rc == ERROR_SUCCESS) | 
|---|
| 548 | { | 
|---|
| 549 | astring = (char *)malloc(*lpcchValue+1); //+ 0 terminator | 
|---|
| 550 | strcpy(astring, (char *)lpszValue); | 
|---|
| 551 | AsciiToUnicode(astring, lpszValue); | 
|---|
| 552 | free(astring); | 
|---|
| 553 |  | 
|---|
| 554 | if(lpcbData && lpbData) | 
|---|
| 555 | { | 
|---|
| 556 | switch(*lpdwType) { | 
|---|
| 557 | case REG_SZ: | 
|---|
| 558 | case REG_EXPAND_SZ: | 
|---|
| 559 | if(oldsize < *lpcbData*sizeof(WCHAR)) { | 
|---|
| 560 | *lpcbData = *lpcbData*sizeof(WCHAR); | 
|---|
| 561 | return ERROR_MORE_DATA; | 
|---|
| 562 | } | 
|---|
| 563 | astring = (char *)malloc(*lpcbData); | 
|---|
| 564 | strcpy(astring, (char *)lpbData); | 
|---|
| 565 | lstrcpyAtoW((LPWSTR)lpbData, astring); | 
|---|
| 566 | free(astring); | 
|---|
| 567 | break; | 
|---|
| 568 | case REG_MULTI_SZ: | 
|---|
| 569 | case REG_LINK: //??? | 
|---|
| 570 | dprintf(("ERROR: key data must be translated from Unicode to Ascii!!")); | 
|---|
| 571 | break; | 
|---|
| 572 | default: | 
|---|
| 573 | break; | 
|---|
| 574 | } | 
|---|
| 575 | } | 
|---|
| 576 |  | 
|---|
| 577 | } | 
|---|
| 578 | return(rc); | 
|---|
| 579 | } | 
|---|
| 580 |  | 
|---|
| 581 |  | 
|---|
| 582 | /***************************************************************************** | 
|---|
| 583 | * Name      : | 
|---|
| 584 | * Purpose   : | 
|---|
| 585 | * Parameters: | 
|---|
| 586 | * Variables : | 
|---|
| 587 | * Result    : | 
|---|
| 588 | * Remark    : | 
|---|
| 589 | * Status    : UNTESTED STUB | 
|---|
| 590 | * | 
|---|
| 591 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 592 | *****************************************************************************/ | 
|---|
| 593 |  | 
|---|
| 594 | LONG WIN32API RegOpenKeyA(HKEY hKey, LPCSTR arg2, PHKEY arg3) | 
|---|
| 595 | { | 
|---|
| 596 | LONG rc; | 
|---|
| 597 |  | 
|---|
| 598 | dprintf(("RegOpenKey %s", arg2)); | 
|---|
| 599 |  | 
|---|
| 600 | rc = O32_RegOpenKey(ConvertKey(hKey), | 
|---|
| 601 | arg2, | 
|---|
| 602 | arg3); | 
|---|
| 603 | if(rc) | 
|---|
| 604 | *arg3 = 0; | 
|---|
| 605 |  | 
|---|
| 606 | return(rc); | 
|---|
| 607 | } | 
|---|
| 608 |  | 
|---|
| 609 |  | 
|---|
| 610 | /***************************************************************************** | 
|---|
| 611 | * Name      : | 
|---|
| 612 | * Purpose   : | 
|---|
| 613 | * Parameters: | 
|---|
| 614 | * Variables : | 
|---|
| 615 | * Result    : | 
|---|
| 616 | * Remark    : | 
|---|
| 617 | * Status    : UNTESTED STUB | 
|---|
| 618 | * | 
|---|
| 619 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 620 | *****************************************************************************/ | 
|---|
| 621 |  | 
|---|
| 622 | LONG WIN32API RegOpenKeyW(HKEY hKey, LPCWSTR arg2, PHKEY arg3) | 
|---|
| 623 | { | 
|---|
| 624 | char *astring = UnicodeToAsciiString((LPWSTR)arg2); | 
|---|
| 625 | LONG  rc; | 
|---|
| 626 |  | 
|---|
| 627 | rc = O32_RegOpenKey(ConvertKey(hKey), | 
|---|
| 628 | astring, | 
|---|
| 629 | arg3); | 
|---|
| 630 | if(rc) | 
|---|
| 631 | *arg3 = 0; | 
|---|
| 632 |  | 
|---|
| 633 | if (NULL != astring) | 
|---|
| 634 | FreeAsciiString(astring); | 
|---|
| 635 |  | 
|---|
| 636 | return(rc); | 
|---|
| 637 | } | 
|---|
| 638 |  | 
|---|
| 639 |  | 
|---|
| 640 | /***************************************************************************** | 
|---|
| 641 | * Name      : | 
|---|
| 642 | * Purpose   : | 
|---|
| 643 | * Parameters: | 
|---|
| 644 | * Variables : | 
|---|
| 645 | * Result    : | 
|---|
| 646 | * Remark    : | 
|---|
| 647 | * Status    : UNTESTED STUB | 
|---|
| 648 | * | 
|---|
| 649 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 650 | *****************************************************************************/ | 
|---|
| 651 |  | 
|---|
| 652 | LONG WIN32API RegOpenKeyExA(HKEY hKey, LPCSTR arg2, DWORD arg3, | 
|---|
| 653 | REGSAM arg4, PHKEY arg5) | 
|---|
| 654 | { | 
|---|
| 655 | LONG rc; | 
|---|
| 656 |  | 
|---|
| 657 | dprintf(("RegOpenKeyEx %s", arg2)); | 
|---|
| 658 | rc = O32_RegOpenKeyEx(ConvertKey(hKey), | 
|---|
| 659 | arg2, | 
|---|
| 660 | arg3, | 
|---|
| 661 | arg4, | 
|---|
| 662 | arg5); | 
|---|
| 663 |  | 
|---|
| 664 | //SvL: This fixes crashes in pmwinx.dll. (if an app doesn't check the | 
|---|
| 665 | //     return value and uses the whatever *arg5 contains) | 
|---|
| 666 | if(rc) | 
|---|
| 667 | *arg5 = 0; | 
|---|
| 668 |  | 
|---|
| 669 | return(rc); | 
|---|
| 670 | } | 
|---|
| 671 |  | 
|---|
| 672 |  | 
|---|
| 673 | /***************************************************************************** | 
|---|
| 674 | * Name      : | 
|---|
| 675 | * Purpose   : | 
|---|
| 676 | * Parameters: | 
|---|
| 677 | * Variables : | 
|---|
| 678 | * Result    : | 
|---|
| 679 | * Remark    : | 
|---|
| 680 | * Status    : UNTESTED STUB | 
|---|
| 681 | * | 
|---|
| 682 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 683 | *****************************************************************************/ | 
|---|
| 684 |  | 
|---|
| 685 | LONG WIN32API RegOpenKeyExW(HKEY    arg1, | 
|---|
| 686 | LPCWSTR arg2, | 
|---|
| 687 | DWORD   arg3, | 
|---|
| 688 | REGSAM  arg4, | 
|---|
| 689 | PHKEY   arg5) | 
|---|
| 690 | { | 
|---|
| 691 | char *astring = UnicodeToAsciiString((LPWSTR)arg2); | 
|---|
| 692 | LONG  rc; | 
|---|
| 693 |  | 
|---|
| 694 | rc = RegOpenKeyExA(arg1, astring, arg3, arg4, arg5); | 
|---|
| 695 | //SvL: This fixes crashes in pmwinx.dll. (if an app doesn't check the | 
|---|
| 696 | //     return value and uses the whatever *arg5 contains) | 
|---|
| 697 | if(rc) | 
|---|
| 698 | *arg5 = 0; | 
|---|
| 699 |  | 
|---|
| 700 | if (NULL != astring) | 
|---|
| 701 | FreeAsciiString(astring); | 
|---|
| 702 |  | 
|---|
| 703 | return(rc); | 
|---|
| 704 | } | 
|---|
| 705 |  | 
|---|
| 706 |  | 
|---|
| 707 | /***************************************************************************** | 
|---|
| 708 | * Name      : | 
|---|
| 709 | * Purpose   : | 
|---|
| 710 | * Parameters: | 
|---|
| 711 | * Variables : | 
|---|
| 712 | * Result    : | 
|---|
| 713 | * Remark    : | 
|---|
| 714 | * Status    : UNTESTED STUB | 
|---|
| 715 | * | 
|---|
| 716 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 717 | *****************************************************************************/ | 
|---|
| 718 |  | 
|---|
| 719 | LONG WIN32API RegQueryInfoKeyA(HKEY        hkey, | 
|---|
| 720 | LPSTR       lpszClass, | 
|---|
| 721 | LPDWORD     lpcchClass, | 
|---|
| 722 | LPDWORD     lpdwReserved, | 
|---|
| 723 | LPDWORD     lpcSubKeys, | 
|---|
| 724 | LPDWORD     lpcchMaxSubKey, | 
|---|
| 725 | LPDWORD     lpcchMaxClass, | 
|---|
| 726 | LPDWORD     lpcValues, | 
|---|
| 727 | LPDWORD     lpcchMaxValueName, | 
|---|
| 728 | LPDWORD     lpcbMaxValueData, | 
|---|
| 729 | LPDWORD     lpcbSecurityDescriptor, | 
|---|
| 730 | LPFILETIME  lpftLastWriteTime) | 
|---|
| 731 | { | 
|---|
| 732 | return O32_RegQueryInfoKey(ConvertKey(hkey), lpszClass, | 
|---|
| 733 | lpcchClass, lpdwReserved, lpcSubKeys, | 
|---|
| 734 | lpcchMaxSubKey, lpcchMaxClass, lpcValues, | 
|---|
| 735 | lpcchMaxValueName, lpcbMaxValueData, | 
|---|
| 736 | lpcbSecurityDescriptor,lpftLastWriteTime); | 
|---|
| 737 | } | 
|---|
| 738 |  | 
|---|
| 739 |  | 
|---|
| 740 | /***************************************************************************** | 
|---|
| 741 | * Name      : | 
|---|
| 742 | * Purpose   : | 
|---|
| 743 | * Parameters: | 
|---|
| 744 | * Variables : | 
|---|
| 745 | * Result    : | 
|---|
| 746 | * Remark    : | 
|---|
| 747 | * Status    : UNTESTED STUB | 
|---|
| 748 | * | 
|---|
| 749 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 750 | *****************************************************************************/ | 
|---|
| 751 |  | 
|---|
| 752 | LONG WIN32API RegQueryInfoKeyW(HKEY        hkey, | 
|---|
| 753 | LPWSTR      lpszClass, | 
|---|
| 754 | LPDWORD     lpcchClass, | 
|---|
| 755 | LPDWORD     lpdwReserved, | 
|---|
| 756 | LPDWORD     lpcSubKeys, | 
|---|
| 757 | LPDWORD     lpcchMaxSubKey, | 
|---|
| 758 | LPDWORD     lpcchMaxClass, | 
|---|
| 759 | LPDWORD     lpcValues, | 
|---|
| 760 | LPDWORD     lpcchMaxValueName, | 
|---|
| 761 | LPDWORD     lpcbMaxValueData, | 
|---|
| 762 | LPDWORD     lpcbSecurityDescriptor, | 
|---|
| 763 | LPFILETIME  lpftLastWriteTime) | 
|---|
| 764 | { | 
|---|
| 765 | LONG  rc; | 
|---|
| 766 |  | 
|---|
| 767 | rc = O32_RegQueryInfoKey(ConvertKey(hkey), (char *)lpszClass, | 
|---|
| 768 | lpcchClass, lpdwReserved, lpcSubKeys, | 
|---|
| 769 | lpcchMaxSubKey, lpcchMaxClass, lpcValues, | 
|---|
| 770 | lpcchMaxValueName, lpcbMaxValueData, | 
|---|
| 771 | lpcbSecurityDescriptor,lpftLastWriteTime); | 
|---|
| 772 | if(rc == ERROR_SUCCESS) | 
|---|
| 773 | { | 
|---|
| 774 | if(lpcchClass && *lpcchClass) { | 
|---|
| 775 | char *astring = (char *)malloc(*lpcchClass+1); //returned length does NOT include 0 terminator | 
|---|
| 776 | strcpy(astring, (char *)lpszClass); | 
|---|
| 777 | AsciiToUnicode(astring, lpszClass); | 
|---|
| 778 | free(astring); | 
|---|
| 779 | } | 
|---|
| 780 | else | 
|---|
| 781 | if(lpszClass) *lpszClass = 0; | 
|---|
| 782 | } | 
|---|
| 783 | //TODO: lpcbMaxValueData could be wrong for string key values!!! (as it's in bytes) | 
|---|
| 784 | return(rc); | 
|---|
| 785 | } | 
|---|
| 786 |  | 
|---|
| 787 |  | 
|---|
| 788 | /***************************************************************************** | 
|---|
| 789 | * Name      : | 
|---|
| 790 | * Purpose   : | 
|---|
| 791 | * Parameters: | 
|---|
| 792 | * Variables : | 
|---|
| 793 | * Result    : | 
|---|
| 794 | * Remark    : | 
|---|
| 795 | * Status    : UNTESTED STUB | 
|---|
| 796 | * | 
|---|
| 797 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 798 | *****************************************************************************/ | 
|---|
| 799 |  | 
|---|
| 800 | LONG WIN32API RegQueryValueA(HKEY  arg1, | 
|---|
| 801 | LPCSTR arg2, | 
|---|
| 802 | LPSTR  arg3, | 
|---|
| 803 | PLONG  arg4) | 
|---|
| 804 | { | 
|---|
| 805 | dprintf(("ADVAPI32:Registry key=%s\n", | 
|---|
| 806 | arg2)); | 
|---|
| 807 | return O32_RegQueryValue(ConvertKey(arg1), | 
|---|
| 808 | arg2, | 
|---|
| 809 | arg3, | 
|---|
| 810 | arg4); | 
|---|
| 811 | } | 
|---|
| 812 |  | 
|---|
| 813 |  | 
|---|
| 814 | /***************************************************************************** | 
|---|
| 815 | * Name      : | 
|---|
| 816 | * Purpose   : | 
|---|
| 817 | * Parameters: | 
|---|
| 818 | * Variables : | 
|---|
| 819 | * Result    : | 
|---|
| 820 | * Remark    : | 
|---|
| 821 | * Status    : UNTESTED STUB | 
|---|
| 822 | * | 
|---|
| 823 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 824 | *****************************************************************************/ | 
|---|
| 825 |  | 
|---|
| 826 | LONG WIN32API RegQueryValueW(HKEY    hkey, | 
|---|
| 827 | LPCWSTR lpszSubKey, | 
|---|
| 828 | LPWSTR  lpszValue, | 
|---|
| 829 | PLONG   pcbValue) | 
|---|
| 830 | { | 
|---|
| 831 | char *astring1 = UnicodeToAsciiString((LPWSTR)lpszSubKey); | 
|---|
| 832 | char *astring2; | 
|---|
| 833 | LONG  rc; | 
|---|
| 834 |  | 
|---|
| 835 | rc = RegQueryValueA(hkey, astring1, (char *)lpszValue, pcbValue); | 
|---|
| 836 | if(rc == ERROR_SUCCESS) | 
|---|
| 837 | { | 
|---|
| 838 | if(pcbValue) { | 
|---|
| 839 | astring2 = (char *)malloc(*pcbValue);   //includes 0 terminator | 
|---|
| 840 | strcpy(astring2, (char *)lpszValue); | 
|---|
| 841 | AsciiToUnicode(astring2, lpszValue); | 
|---|
| 842 | free(astring2); | 
|---|
| 843 | } | 
|---|
| 844 | } | 
|---|
| 845 |  | 
|---|
| 846 | if (NULL != astring1) | 
|---|
| 847 | FreeAsciiString(astring1); | 
|---|
| 848 |  | 
|---|
| 849 | return(rc); | 
|---|
| 850 | } | 
|---|
| 851 |  | 
|---|
| 852 |  | 
|---|
| 853 | /***************************************************************************** | 
|---|
| 854 | * Name      : | 
|---|
| 855 | * Purpose   : | 
|---|
| 856 | * Parameters: | 
|---|
| 857 | * Variables : | 
|---|
| 858 | * Result    : | 
|---|
| 859 | * Remark    : | 
|---|
| 860 | * Status    : UNTESTED STUB | 
|---|
| 861 | * | 
|---|
| 862 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 863 | *****************************************************************************/ | 
|---|
| 864 |  | 
|---|
| 865 | LONG WIN32API RegQueryValueExA(HKEY   hkey, | 
|---|
| 866 | LPSTR   lpszValueName, | 
|---|
| 867 | LPDWORD lpdwReserved, | 
|---|
| 868 | LPDWORD lpdwType, | 
|---|
| 869 | LPBYTE  lpbData, | 
|---|
| 870 | LPDWORD lpcbData) | 
|---|
| 871 | { | 
|---|
| 872 | LONG ret; | 
|---|
| 873 | DWORD dwType = 0; | 
|---|
| 874 |  | 
|---|
| 875 | dprintf(("ADVAPI32:Registry key=%s", lpszValueName)); | 
|---|
| 876 |  | 
|---|
| 877 | if(lpdwType == NULL) { | 
|---|
| 878 | lpdwType = &dwType; | 
|---|
| 879 | } | 
|---|
| 880 | ret = O32_RegQueryValueEx(ConvertKey(hkey), | 
|---|
| 881 | lpszValueName, | 
|---|
| 882 | lpdwReserved, | 
|---|
| 883 | lpdwType, | 
|---|
| 884 | lpbData, | 
|---|
| 885 | lpcbData); | 
|---|
| 886 |  | 
|---|
| 887 | if(ret == 0) { | 
|---|
| 888 | if(lpdwType)  dprintf(("key type:   %x", *lpdwType)); | 
|---|
| 889 | if(lpcbData)  dprintf(("key length: %d", *lpcbData)); | 
|---|
| 890 | } | 
|---|
| 891 | if(ret == 0 || ret == ERROR_MORE_DATA) { | 
|---|
| 892 | //TODO:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
|---|
| 893 | // Probably the same bug for some other key types (binary, multi_sz, REG_EXPAND_SZ) | 
|---|
| 894 | if(*lpdwType == REG_SZ && (lpbData == NULL || ret == ERROR_MORE_DATA) && lpcbData) { | 
|---|
| 895 | dprintf(("Get the real size of the string key data")); | 
|---|
| 896 | //Get the real size of the string key data | 
|---|
| 897 | //not a nice fix; hope this is enough (there is no clear connection | 
|---|
| 898 | //between returned length and real string length (not linear for different | 
|---|
| 899 | //string sizes)) | 
|---|
| 900 | *lpcbData = 4096; | 
|---|
| 901 | lpbData   = (LPBYTE)malloc(*lpcbData); | 
|---|
| 902 | if(lpcbData) { | 
|---|
| 903 | //don't overwrite return value (in case it was ERROR_MODE_DATA) | 
|---|
| 904 | O32_RegQueryValueEx(ConvertKey(hkey), | 
|---|
| 905 | lpszValueName, | 
|---|
| 906 | lpdwReserved, | 
|---|
| 907 | lpdwType, | 
|---|
| 908 | lpbData, | 
|---|
| 909 | lpcbData); | 
|---|
| 910 | if(lpcbData)  dprintf(("real key length: %d", *lpcbData)); | 
|---|
| 911 | free(lpbData); | 
|---|
| 912 | } | 
|---|
| 913 | } | 
|---|
| 914 | } | 
|---|
| 915 | return ret; | 
|---|
| 916 | } | 
|---|
| 917 |  | 
|---|
| 918 |  | 
|---|
| 919 | /***************************************************************************** | 
|---|
| 920 | * Name      : | 
|---|
| 921 | * Purpose   : | 
|---|
| 922 | * Parameters: | 
|---|
| 923 | * Variables : | 
|---|
| 924 | * Result    : | 
|---|
| 925 | * Remark    : TODO: DOESN'T WORK FOR STRING DATA!! | 
|---|
| 926 | * Status    : UNTESTED STUB | 
|---|
| 927 | * | 
|---|
| 928 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 929 | *****************************************************************************/ | 
|---|
| 930 |  | 
|---|
| 931 | LONG WIN32API RegQueryValueExW(HKEY   hkey, | 
|---|
| 932 | LPWSTR  lpszValueName, | 
|---|
| 933 | LPDWORD lpdwReserved, | 
|---|
| 934 | LPDWORD lpdwType, | 
|---|
| 935 | LPBYTE  lpbData, | 
|---|
| 936 | LPDWORD lpcbData) | 
|---|
| 937 | { | 
|---|
| 938 | char *astring = UnicodeToAsciiString(lpszValueName); | 
|---|
| 939 | char *akeydata = NULL; | 
|---|
| 940 | LONG  rc; | 
|---|
| 941 | DWORD dwType; | 
|---|
| 942 |  | 
|---|
| 943 | if(lpbData && lpcbData) | 
|---|
| 944 | { | 
|---|
| 945 | akeydata = (char *)malloc(*lpcbData+1); | 
|---|
| 946 | akeydata[*lpcbData] = 0; | 
|---|
| 947 | } | 
|---|
| 948 |  | 
|---|
| 949 | if(lpdwType == NULL) { | 
|---|
| 950 | lpdwType = &dwType; | 
|---|
| 951 | } | 
|---|
| 952 |  | 
|---|
| 953 | rc = RegQueryValueExA(hkey, astring, lpdwReserved, lpdwType, | 
|---|
| 954 | (LPBYTE)akeydata, lpcbData); | 
|---|
| 955 | //could also query key type (without returning data), call it again and only allocate translation | 
|---|
| 956 | //buffer if string type | 
|---|
| 957 | if(rc == ERROR_SUCCESS && lpbData && lpcbData) | 
|---|
| 958 | { | 
|---|
| 959 | switch(*lpdwType) { | 
|---|
| 960 | case REG_SZ: | 
|---|
| 961 | case REG_EXPAND_SZ: | 
|---|
| 962 | lstrcpyAtoW((LPWSTR)lpbData, akeydata); | 
|---|
| 963 | break; | 
|---|
| 964 | case REG_MULTI_SZ: | 
|---|
| 965 | case REG_LINK: //??? | 
|---|
| 966 | dprintf(("ERROR: key data must be translated from Unicode to Ascii!!")); | 
|---|
| 967 | break; | 
|---|
| 968 | default: | 
|---|
| 969 | memcpy(lpbData, akeydata, *lpcbData); | 
|---|
| 970 | break; | 
|---|
| 971 | } | 
|---|
| 972 | } | 
|---|
| 973 |  | 
|---|
| 974 | if (NULL != astring) | 
|---|
| 975 | FreeAsciiString(astring); | 
|---|
| 976 |  | 
|---|
| 977 | if(akeydata) | 
|---|
| 978 | free(akeydata); | 
|---|
| 979 |  | 
|---|
| 980 | return(rc); | 
|---|
| 981 | } | 
|---|
| 982 |  | 
|---|
| 983 |  | 
|---|
| 984 | /***************************************************************************** | 
|---|
| 985 | * Name      : | 
|---|
| 986 | * Purpose   : | 
|---|
| 987 | * Parameters: | 
|---|
| 988 | * Variables : | 
|---|
| 989 | * Result    : | 
|---|
| 990 | * Remark    : | 
|---|
| 991 | * Status    : UNTESTED STUB | 
|---|
| 992 | * | 
|---|
| 993 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 994 | *****************************************************************************/ | 
|---|
| 995 |  | 
|---|
| 996 | LONG WIN32API RegSetValueA(HKEY  hkey, | 
|---|
| 997 | LPCSTR lpSubKey, | 
|---|
| 998 | DWORD  dwType, | 
|---|
| 999 | LPCSTR lpData, | 
|---|
| 1000 | DWORD  cbData) | 
|---|
| 1001 | { | 
|---|
| 1002 | LONG rc; | 
|---|
| 1003 |  | 
|---|
| 1004 | //SvL: 8-11-'97: Bugfix: crash in pmwinx if size == 0 and string is large | 
|---|
| 1005 | if(cbData == 0) | 
|---|
| 1006 | cbData = strlen(lpData); | 
|---|
| 1007 |  | 
|---|
| 1008 | rc = O32_RegSetValue(ConvertKey(hkey), lpSubKey, | 
|---|
| 1009 | dwType, lpData, cbData); | 
|---|
| 1010 |  | 
|---|
| 1011 | if(rc == ERROR_NOT_ENOUGH_MEMORY && cbData == 0 && dwType == REG_SZ) | 
|---|
| 1012 | { | 
|---|
| 1013 | char regdata = 0; | 
|---|
| 1014 | //SvL: Netscape sets an empty string key this way; Open32 doesn't like it | 
|---|
| 1015 | rc = O32_RegSetValue(ConvertKey(hkey), | 
|---|
| 1016 | lpSubKey, | 
|---|
| 1017 | dwType, | 
|---|
| 1018 | ®data, | 
|---|
| 1019 | 1); | 
|---|
| 1020 | } | 
|---|
| 1021 | return rc; | 
|---|
| 1022 | } | 
|---|
| 1023 |  | 
|---|
| 1024 |  | 
|---|
| 1025 | /***************************************************************************** | 
|---|
| 1026 | * Name      : | 
|---|
| 1027 | * Purpose   : | 
|---|
| 1028 | * Parameters: | 
|---|
| 1029 | * Variables : | 
|---|
| 1030 | * Result    : | 
|---|
| 1031 | * Remark    : | 
|---|
| 1032 | * Status    : UNTESTED STUB | 
|---|
| 1033 | * | 
|---|
| 1034 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1035 | *****************************************************************************/ | 
|---|
| 1036 |  | 
|---|
| 1037 | LONG WIN32API RegSetValueW(HKEY   hkey, | 
|---|
| 1038 | LPCWSTR lpSubKey, | 
|---|
| 1039 | DWORD   dwType, | 
|---|
| 1040 | LPCWSTR lpData, | 
|---|
| 1041 | DWORD   cbData) | 
|---|
| 1042 | { | 
|---|
| 1043 | char *astring1 = UnicodeToAsciiString((LPWSTR)lpSubKey); | 
|---|
| 1044 | char *astring2 = UnicodeToAsciiString((LPWSTR)lpData); | 
|---|
| 1045 | LONG  rc; | 
|---|
| 1046 |  | 
|---|
| 1047 | rc = RegSetValueA(hkey, astring1, dwType, astring2, cbData); | 
|---|
| 1048 |  | 
|---|
| 1049 | if (NULL != astring1) | 
|---|
| 1050 | FreeAsciiString(astring1); | 
|---|
| 1051 |  | 
|---|
| 1052 | if (NULL != astring2) | 
|---|
| 1053 | FreeAsciiString(astring2); | 
|---|
| 1054 |  | 
|---|
| 1055 | return(rc); | 
|---|
| 1056 | } | 
|---|
| 1057 |  | 
|---|
| 1058 |  | 
|---|
| 1059 | /***************************************************************************** | 
|---|
| 1060 | * Name      : | 
|---|
| 1061 | * Purpose   : | 
|---|
| 1062 | * Parameters: | 
|---|
| 1063 | * Variables : | 
|---|
| 1064 | * Result    : | 
|---|
| 1065 | * Remark    : TODO:Check for string length here too? | 
|---|
| 1066 | * Status    : UNTESTED STUB | 
|---|
| 1067 | * | 
|---|
| 1068 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1069 | *****************************************************************************/ | 
|---|
| 1070 |  | 
|---|
| 1071 | LONG WIN32API RegSetValueExA(HKEY   hkey, | 
|---|
| 1072 | LPCSTR lpszValueName, | 
|---|
| 1073 | DWORD  dwReserved, | 
|---|
| 1074 | DWORD  fdwType, | 
|---|
| 1075 | BYTE*  lpbData, | 
|---|
| 1076 | DWORD  cbData) | 
|---|
| 1077 | { | 
|---|
| 1078 | LPSTR lpszExpandedString = NULL; | 
|---|
| 1079 | LONG  ret; | 
|---|
| 1080 |  | 
|---|
| 1081 | if(fdwType == REG_SZ || fdwType == REG_EXPAND_SZ) { | 
|---|
| 1082 | dprintf(("ADVAPI32: RegSetValueExA)%08xh,%s,%08xh,%08xh,%s,%08xh)", | 
|---|
| 1083 | hkey, | 
|---|
| 1084 | lpszValueName, | 
|---|
| 1085 | dwReserved, | 
|---|
| 1086 | fdwType, | 
|---|
| 1087 | lpbData, | 
|---|
| 1088 | cbData)); | 
|---|
| 1089 | } | 
|---|
| 1090 | else { | 
|---|
| 1091 | dprintf(("ADVAPI32: RegSetValueExA)%08xh,%s,%08xh,%08xh,%08xh,%08xh)", | 
|---|
| 1092 | hkey, | 
|---|
| 1093 | lpszValueName, | 
|---|
| 1094 | dwReserved, | 
|---|
| 1095 | fdwType, | 
|---|
| 1096 | lpbData, | 
|---|
| 1097 | cbData)); | 
|---|
| 1098 | } | 
|---|
| 1099 |  | 
|---|
| 1100 | if(fdwType == REG_EXPAND_SZ) { | 
|---|
| 1101 | dprintf(("!WARNING!: REG_EXPAND_SZ converted to REG_SZ")); | 
|---|
| 1102 | fdwType = REG_SZ; //registry.dll doesn't like this type | 
|---|
| 1103 |  | 
|---|
| 1104 | //Expand string | 
|---|
| 1105 | lpszExpandedString = (LPSTR)malloc(cbData); | 
|---|
| 1106 | if(lpszExpandedString == NULL) { | 
|---|
| 1107 | DebugInt3(); | 
|---|
| 1108 | return ERROR_NOT_ENOUGH_MEMORY; | 
|---|
| 1109 | } | 
|---|
| 1110 | ExpandEnvironmentStringsA((LPSTR)lpbData, lpszExpandedString, cbData); | 
|---|
| 1111 | lpbData = (BYTE *)lpszExpandedString; | 
|---|
| 1112 | cbData  = strlen(lpszExpandedString)+1; | 
|---|
| 1113 | dprintf(("Expanded to: %s", lpszExpandedString)); | 
|---|
| 1114 | } | 
|---|
| 1115 | ret = O32_RegSetValueEx(ConvertKey(hkey), lpszValueName, dwReserved, | 
|---|
| 1116 | fdwType, lpbData, cbData); | 
|---|
| 1117 |  | 
|---|
| 1118 | if(lpszExpandedString) free(lpszExpandedString); | 
|---|
| 1119 |  | 
|---|
| 1120 | return ret; | 
|---|
| 1121 | } | 
|---|
| 1122 |  | 
|---|
| 1123 |  | 
|---|
| 1124 | /***************************************************************************** | 
|---|
| 1125 | * Name      : | 
|---|
| 1126 | * Purpose   : | 
|---|
| 1127 | * Parameters: | 
|---|
| 1128 | * Variables : | 
|---|
| 1129 | * Result    : | 
|---|
| 1130 | * Remark    : TODO:Check for string length here too? | 
|---|
| 1131 | * Status    : UNTESTED STUB | 
|---|
| 1132 | * | 
|---|
| 1133 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1134 | *****************************************************************************/ | 
|---|
| 1135 |  | 
|---|
| 1136 | LONG WIN32API RegSetValueExW(HKEY  hkey, | 
|---|
| 1137 | LPCWSTR lpszValueName, | 
|---|
| 1138 | DWORD  dwReserved, | 
|---|
| 1139 | DWORD  fdwType, | 
|---|
| 1140 | BYTE*  lpbData, | 
|---|
| 1141 | DWORD  cbData) | 
|---|
| 1142 | { | 
|---|
| 1143 | char *astring = UnicodeToAsciiString(lpszValueName); | 
|---|
| 1144 | char *akeydata = NULL; | 
|---|
| 1145 | LONG  rc; | 
|---|
| 1146 |  | 
|---|
| 1147 | switch(fdwType) { | 
|---|
| 1148 | case REG_SZ: | 
|---|
| 1149 | case REG_EXPAND_SZ: | 
|---|
| 1150 | akeydata = UnicodeToAsciiString((LPWSTR)lpbData); | 
|---|
| 1151 | lpbData = (BYTE *)akeydata; | 
|---|
| 1152 | break; | 
|---|
| 1153 | case REG_MULTI_SZ: | 
|---|
| 1154 | case REG_LINK: //??? | 
|---|
| 1155 | dprintf(("ERROR: key data must be translated from Unicode to Ascii!!")); | 
|---|
| 1156 | break; | 
|---|
| 1157 | } | 
|---|
| 1158 | rc = RegSetValueExA(hkey, astring, dwReserved, fdwType, lpbData, cbData); | 
|---|
| 1159 |  | 
|---|
| 1160 | if(akeydata) | 
|---|
| 1161 | FreeAsciiString(akeydata); | 
|---|
| 1162 |  | 
|---|
| 1163 | if (NULL != astring) | 
|---|
| 1164 | FreeAsciiString(astring); | 
|---|
| 1165 |  | 
|---|
| 1166 | return(rc); | 
|---|
| 1167 | } | 
|---|
| 1168 |  | 
|---|
| 1169 |  | 
|---|
| 1170 | /***************************************************************************** | 
|---|
| 1171 | * Name      : | 
|---|
| 1172 | * Purpose   : | 
|---|
| 1173 | * Parameters: | 
|---|
| 1174 | * Variables : | 
|---|
| 1175 | * Result    : | 
|---|
| 1176 | * Remark    : | 
|---|
| 1177 | * Status    : UNTESTED STUB | 
|---|
| 1178 | * | 
|---|
| 1179 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1180 | *****************************************************************************/ | 
|---|
| 1181 |  | 
|---|
| 1182 | LONG WIN32API RegFlushKey(HKEY hkey) | 
|---|
| 1183 | { | 
|---|
| 1184 | dprintf(("ADVAPI32: RegFlushKey not implemented yet.")); | 
|---|
| 1185 |  | 
|---|
| 1186 | return(ERROR_SUCCESS); | 
|---|
| 1187 | } | 
|---|
| 1188 |  | 
|---|
| 1189 |  | 
|---|
| 1190 | /***************************************************************************** | 
|---|
| 1191 | * Name      : RegConnectRegistryA | 
|---|
| 1192 | * Purpose   : The RegConnectRegistry function establishes a connection to a | 
|---|
| 1193 | *             predefined registry handle on another computer. | 
|---|
| 1194 | * Parameters: LPTSTR lpszComputerName address of name of remote computer | 
|---|
| 1195 | *             HKEY   hKey             predefined registry handle | 
|---|
| 1196 | *             PHKEY  phkResult        address of buffer for remote registry handle | 
|---|
| 1197 | * Variables : | 
|---|
| 1198 | * Result    : | 
|---|
| 1199 | * Remark    : | 
|---|
| 1200 | * Status    : UNTESTED STUB | 
|---|
| 1201 | * | 
|---|
| 1202 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1203 | *****************************************************************************/ | 
|---|
| 1204 |  | 
|---|
| 1205 | LONG WIN32API RegConnectRegistryA(LPCSTR lpszComputerName, | 
|---|
| 1206 | HKEY   hKey, | 
|---|
| 1207 | PHKEY  phkResult) | 
|---|
| 1208 | { | 
|---|
| 1209 | char szLocalName[256]; | 
|---|
| 1210 | DWORD dwNameLength = sizeof(szLocalName)-2; | 
|---|
| 1211 |  | 
|---|
| 1212 | szLocalName[0] = '\\'; | 
|---|
| 1213 | szLocalName[1] = '\\'; | 
|---|
| 1214 | GetComputerNameA(szLocalName+2, &dwNameLength); | 
|---|
| 1215 |  | 
|---|
| 1216 | dprintf(("ADVAPI32: RegConnectRegistryA(%s,local %s) not implemented yet.\n", | 
|---|
| 1217 | lpszComputerName, | 
|---|
| 1218 | szLocalName)); | 
|---|
| 1219 |  | 
|---|
| 1220 | /* local registry ? */ | 
|---|
| 1221 | if ( (                    lpszComputerName  == NULL) || | 
|---|
| 1222 | (strcmp(szLocalName, lpszComputerName) == 0   ) ) | 
|---|
| 1223 | { | 
|---|
| 1224 | /* @@@PH experimental !!! */ | 
|---|
| 1225 | *phkResult = hKey; | 
|---|
| 1226 |  | 
|---|
| 1227 | return (NO_ERROR); | 
|---|
| 1228 | } | 
|---|
| 1229 |  | 
|---|
| 1230 | return (ERROR_ACCESS_DENIED); | 
|---|
| 1231 | } | 
|---|
| 1232 |  | 
|---|
| 1233 |  | 
|---|
| 1234 | /***************************************************************************** | 
|---|
| 1235 | * Name      : RegConnectRegistryW | 
|---|
| 1236 | * Purpose   : The RegConnectRegistry function establishes a connection to a | 
|---|
| 1237 | *             predefined registry handle on another computer. | 
|---|
| 1238 | * Parameters: LPWSTR lpszComputerName address of name of remote computer | 
|---|
| 1239 | *             HKEY   hKey             predefined registry handle | 
|---|
| 1240 | *             PHKEY  phkResult        address of buffer for remote registry handle | 
|---|
| 1241 | * Variables : | 
|---|
| 1242 | * Result    : | 
|---|
| 1243 | * Remark    : | 
|---|
| 1244 | * Status    : UNTESTED STUB | 
|---|
| 1245 | * | 
|---|
| 1246 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1247 | *****************************************************************************/ | 
|---|
| 1248 |  | 
|---|
| 1249 | LONG WIN32API RegConnectRegistryW(LPCWSTR lpszComputerName, | 
|---|
| 1250 | HKEY   hKey, | 
|---|
| 1251 | PHKEY  phkResult) | 
|---|
| 1252 | { | 
|---|
| 1253 | /* corresponding ascii string */ | 
|---|
| 1254 | LPSTR pszAscii; | 
|---|
| 1255 | LONG rc;         /* returncode from call to ascii version of this function */ | 
|---|
| 1256 |  | 
|---|
| 1257 | dprintf(("ADVAPI32: RegConnectRegistryW not implemented yet.")); | 
|---|
| 1258 |  | 
|---|
| 1259 | if (lpszComputerName != NULL) | 
|---|
| 1260 | pszAscii = UnicodeToAsciiString((LPWSTR)lpszComputerName); | 
|---|
| 1261 | else | 
|---|
| 1262 | pszAscii = NULL; | 
|---|
| 1263 |  | 
|---|
| 1264 | rc = RegConnectRegistryA(pszAscii, | 
|---|
| 1265 | hKey, | 
|---|
| 1266 | phkResult); | 
|---|
| 1267 |  | 
|---|
| 1268 | if (pszAscii != NULL) | 
|---|
| 1269 | FreeAsciiString(pszAscii); | 
|---|
| 1270 |  | 
|---|
| 1271 | return (rc);                                                         /* OK */ | 
|---|
| 1272 | } | 
|---|
| 1273 |  | 
|---|
| 1274 |  | 
|---|
| 1275 | /***************************************************************************** | 
|---|
| 1276 | * Name      : RegGetKeySecurity | 
|---|
| 1277 | * Purpose   : The RegGetKeySecurity function retrieves a copy of the security | 
|---|
| 1278 | *             descriptor protecting the specified open registry key. | 
|---|
| 1279 | * Parameters: HKEY                 hKey        open handle of key to set | 
|---|
| 1280 | *             SECURITY_INFORMATION SecInf      descriptor contents | 
|---|
| 1281 | *             PSECURITY_DESCRIPTOR pSecDesc    address of descriptor for key | 
|---|
| 1282 | *             LPDWORD              lpcbSecDesc address of size of buffer and descriptor | 
|---|
| 1283 | * Variables : | 
|---|
| 1284 | * Result    : | 
|---|
| 1285 | * Remark    : | 
|---|
| 1286 | * Status    : UNTESTED STUB | 
|---|
| 1287 | * | 
|---|
| 1288 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1289 | *****************************************************************************/ | 
|---|
| 1290 |  | 
|---|
| 1291 | LONG WIN32API RegGetKeySecurity(HKEY                 hKey, | 
|---|
| 1292 | SECURITY_INFORMATION SecInf, | 
|---|
| 1293 | PSECURITY_DESCRIPTOR pSecDesc, | 
|---|
| 1294 | LPDWORD              lpcbSecDesc) | 
|---|
| 1295 | { | 
|---|
| 1296 | dprintf(("ADVAPI32: RegGetKeySecurity not implemented.\n")); | 
|---|
| 1297 |  | 
|---|
| 1298 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1299 | } | 
|---|
| 1300 |  | 
|---|
| 1301 |  | 
|---|
| 1302 | /***************************************************************************** | 
|---|
| 1303 | * Name      : RegLoadKeyA | 
|---|
| 1304 | * Purpose   : The RegLoadKey function creates a subkey under HKEY_USER or | 
|---|
| 1305 | *             HKEY_LOCAL_MACHINE and stores registration information from a | 
|---|
| 1306 | *             specified file into that subkey. This registration information | 
|---|
| 1307 | *             is in the form of a hive. A hive is a discrete body of keys, | 
|---|
| 1308 | *             subkeys, and values that is rooted at the top of the registry | 
|---|
| 1309 | *             hierarchy. A hive is backed by a single file and .LOG file. | 
|---|
| 1310 | * Parameters: HKEY    hKey       handle of open key | 
|---|
| 1311 | *             LPCSTR lpszSubKey address of name of subkey | 
|---|
| 1312 | *             LPCSTR lpszFile   address of filename for registry information | 
|---|
| 1313 | * Variables : | 
|---|
| 1314 | * Result    : | 
|---|
| 1315 | * Remark    : | 
|---|
| 1316 | * Status    : UNTESTED STUB | 
|---|
| 1317 | * | 
|---|
| 1318 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1319 | *****************************************************************************/ | 
|---|
| 1320 |  | 
|---|
| 1321 | LONG WIN32API RegLoadKeyA(HKEY  hKey, | 
|---|
| 1322 | LPCSTR lpszSubKey, | 
|---|
| 1323 | LPCSTR lpszFile) | 
|---|
| 1324 | { | 
|---|
| 1325 | dprintf(("ADVAPI32: RegLoadKeyA not implemented.\n")); | 
|---|
| 1326 |  | 
|---|
| 1327 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1328 | } | 
|---|
| 1329 |  | 
|---|
| 1330 |  | 
|---|
| 1331 | /***************************************************************************** | 
|---|
| 1332 | * Name      : RegLoadKeyW | 
|---|
| 1333 | * Purpose   : The RegLoadKey function creates a subkey under HKEY_USER or | 
|---|
| 1334 | *             HKEY_LOCAL_MACHINE and stores registration information from a | 
|---|
| 1335 | *             specified file into that subkey. This registration information | 
|---|
| 1336 | *             is in the form of a hive. A hive is a discrete body of keys, | 
|---|
| 1337 | *             subkeys, and values that is rooted at the top of the registry | 
|---|
| 1338 | *             hierarchy. A hive is backed by a single file and .LOG file. | 
|---|
| 1339 | * Parameters: HKEY    hKey       handle of open key | 
|---|
| 1340 | *             LPCWSTR lpszSubKey address of name of subkey | 
|---|
| 1341 | *             LPCWSTR lpszFile   address of filename for registry information | 
|---|
| 1342 | * Variables : | 
|---|
| 1343 | * Result    : | 
|---|
| 1344 | * Remark    : | 
|---|
| 1345 | * Status    : UNTESTED STUB | 
|---|
| 1346 | * | 
|---|
| 1347 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1348 | *****************************************************************************/ | 
|---|
| 1349 |  | 
|---|
| 1350 | LONG WIN32API RegLoadKeyW(HKEY   hKey, | 
|---|
| 1351 | LPCWSTR lpszSubKey, | 
|---|
| 1352 | LPCWSTR lpszFile) | 
|---|
| 1353 | { | 
|---|
| 1354 | dprintf(("ADVAPI32: RegLoadKeyW not implemented.\n")); | 
|---|
| 1355 |  | 
|---|
| 1356 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1357 | } | 
|---|
| 1358 |  | 
|---|
| 1359 |  | 
|---|
| 1360 | /***************************************************************************** | 
|---|
| 1361 | * Name      : RegQueryMultipleValuesA | 
|---|
| 1362 | * Purpose   : The RegQueryMultipleValues function retrieves the type and data | 
|---|
| 1363 | *             for a list of value names associated with an open registry key. | 
|---|
| 1364 | * Parameters: HKEY    hKey        handle of key to query | 
|---|
| 1365 | *             PVALENT val_list    address of array of value entry structures | 
|---|
| 1366 | *             DWORD   num_vals    size of array of value entry structures | 
|---|
| 1367 | *             LPTSTR  lpValueBuf  address of buffer for value information | 
|---|
| 1368 | *             LPDWORD ldwTotsize  address of size of value buffer | 
|---|
| 1369 | * Variables : | 
|---|
| 1370 | * Result    : | 
|---|
| 1371 | * Remark    : | 
|---|
| 1372 | * Status    : UNTESTED STUB | 
|---|
| 1373 | * | 
|---|
| 1374 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1375 | *****************************************************************************/ | 
|---|
| 1376 |  | 
|---|
| 1377 | LONG WIN32API RegQueryMultipleValuesA(HKEY     hKey, | 
|---|
| 1378 | PVALENTA val_list, | 
|---|
| 1379 | DWORD    num_vals, | 
|---|
| 1380 | LPTSTR   lpValueBuf, | 
|---|
| 1381 | LPDWORD  ldwTotsize) | 
|---|
| 1382 | { | 
|---|
| 1383 | dprintf(("ADVAPI32: RegQueryMultipleValuesA not implemented.\n")); | 
|---|
| 1384 |  | 
|---|
| 1385 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1386 | } | 
|---|
| 1387 |  | 
|---|
| 1388 |  | 
|---|
| 1389 | /***************************************************************************** | 
|---|
| 1390 | * Name      : RegQueryMultipleValuesW | 
|---|
| 1391 | * Purpose   : The RegQueryMultipleValues function retrieves the type and data | 
|---|
| 1392 | *             for a list of value names associated with an open registry key. | 
|---|
| 1393 | * Parameters: HKEY    hKey        handle of key to query | 
|---|
| 1394 | *             PVALENT val_list    address of array of value entry structures | 
|---|
| 1395 | *             DWORD   num_vals    size of array of value entry structures | 
|---|
| 1396 | *             LPWSTR  lpValueBuf  address of buffer for value information | 
|---|
| 1397 | *             LPDWORD ldwTotsize  address of size of value buffer | 
|---|
| 1398 | * Variables : | 
|---|
| 1399 | * Result    : | 
|---|
| 1400 | * Remark    : | 
|---|
| 1401 | * Status    : UNTESTED STUB | 
|---|
| 1402 | * | 
|---|
| 1403 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1404 | *****************************************************************************/ | 
|---|
| 1405 |  | 
|---|
| 1406 | LONG WIN32API RegQueryMultipleValuesW(HKEY     hKey, | 
|---|
| 1407 | PVALENTW val_list, | 
|---|
| 1408 | DWORD    num_vals, | 
|---|
| 1409 | LPWSTR   lpValueBuf, | 
|---|
| 1410 | LPDWORD  ldwTotsize) | 
|---|
| 1411 | { | 
|---|
| 1412 | dprintf(("ADVAPI32: RegQueryMultipleValuesW not implemented.\n")); | 
|---|
| 1413 |  | 
|---|
| 1414 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1415 | } | 
|---|
| 1416 |  | 
|---|
| 1417 |  | 
|---|
| 1418 | /***************************************************************************** | 
|---|
| 1419 | * Name      : RegRemapPreDefKey | 
|---|
| 1420 | * Purpose   : | 
|---|
| 1421 | * Parameters: | 
|---|
| 1422 | * Variables : | 
|---|
| 1423 | * Result    : | 
|---|
| 1424 | * Remark    : | 
|---|
| 1425 | * Status    : UNTESTED STUB | 
|---|
| 1426 | * | 
|---|
| 1427 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1428 | *****************************************************************************/ | 
|---|
| 1429 |  | 
|---|
| 1430 | #if 0 | 
|---|
| 1431 | LONG WIN32API RegRemapPreDefKey(HKEY hKey) | 
|---|
| 1432 | { | 
|---|
| 1433 | dprintf(("ADVAPI32: RegRemapPreDefKey not implemented.\n")); | 
|---|
| 1434 |  | 
|---|
| 1435 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1436 | } | 
|---|
| 1437 | #endif | 
|---|
| 1438 |  | 
|---|
| 1439 |  | 
|---|
| 1440 | /***************************************************************************** | 
|---|
| 1441 | * Name      : RegReplaceKeyA | 
|---|
| 1442 | * Purpose   : The RegReplaceKey function replaces the file backing a key and | 
|---|
| 1443 | *             all its subkeys with another file, so that when the system is | 
|---|
| 1444 | *             next started, the key and subkeys will have the values stored in the new file. | 
|---|
| 1445 | * Parameters: HKEY    hKey      handle of open key | 
|---|
| 1446 | *             LPCSTR lpSubKey  address of name of subkey | 
|---|
| 1447 | *             LPCSTR lpNewFile address of filename for file with new data | 
|---|
| 1448 | *             LPCSTR lpOldFile address of filename for backup file | 
|---|
| 1449 | * Variables : | 
|---|
| 1450 | * Result    : | 
|---|
| 1451 | * Remark    : | 
|---|
| 1452 | * Status    : UNTESTED STUB | 
|---|
| 1453 | * | 
|---|
| 1454 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1455 | *****************************************************************************/ | 
|---|
| 1456 |  | 
|---|
| 1457 | LONG WIN32API RegReplaceKeyA(HKEY hKey, LPCSTR lpSubKey, LPCSTR lpNewFile, | 
|---|
| 1458 | LPCSTR lpOldFile) | 
|---|
| 1459 | { | 
|---|
| 1460 | dprintf(("ADVAPI32: RegReplaceKeyA not implemented.\n")); | 
|---|
| 1461 |  | 
|---|
| 1462 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1463 | } | 
|---|
| 1464 |  | 
|---|
| 1465 |  | 
|---|
| 1466 | /***************************************************************************** | 
|---|
| 1467 | * Name      : RegReplaceKeyW | 
|---|
| 1468 | * Purpose   : The RegReplaceKey function replaces the file backing a key and | 
|---|
| 1469 | *             all its subkeys with another file, so that when the system is | 
|---|
| 1470 | *             next started, the key and subkeys will have the values stored in the new file. | 
|---|
| 1471 | * Parameters: HKEY    hKey      handle of open key | 
|---|
| 1472 | *             LPCWSTR lpSubKey  address of name of subkey | 
|---|
| 1473 | *             LPCWSTR lpNewFile address of filename for file with new data | 
|---|
| 1474 | *             LPCWSTR lpOldFile address of filename for backup file | 
|---|
| 1475 | * Variables : | 
|---|
| 1476 | * Result    : | 
|---|
| 1477 | * Remark    : | 
|---|
| 1478 | * Status    : UNTESTED STUB | 
|---|
| 1479 | * | 
|---|
| 1480 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1481 | *****************************************************************************/ | 
|---|
| 1482 |  | 
|---|
| 1483 | LONG WIN32API RegReplaceKeyW(HKEY   hKey, | 
|---|
| 1484 | LPCWSTR lpSubKey, | 
|---|
| 1485 | LPCWSTR lpNewFile, | 
|---|
| 1486 | LPCWSTR lpOldFile) | 
|---|
| 1487 | { | 
|---|
| 1488 | dprintf(("ADVAPI32: RegReplaceKeyW not implemented.\n")); | 
|---|
| 1489 |  | 
|---|
| 1490 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1491 | } | 
|---|
| 1492 |  | 
|---|
| 1493 |  | 
|---|
| 1494 | /***************************************************************************** | 
|---|
| 1495 | * Name      : RegRestoreKeyA | 
|---|
| 1496 | * Purpose   : The RegRestoreKey function reads the registry information in a | 
|---|
| 1497 | *             specified file and copies it over the specified key. This | 
|---|
| 1498 | *             registry information may be in the form of a key and multiple | 
|---|
| 1499 | *             levels of subkeys. | 
|---|
| 1500 | * Parameters: HKEY    hKey      handle of key where restore begins | 
|---|
| 1501 | *             LPCSTR lpszFile  address of filename containing saved tree | 
|---|
| 1502 | *             DWORD   fdw       optional flags | 
|---|
| 1503 | * Variables : | 
|---|
| 1504 | * Result    : | 
|---|
| 1505 | * Remark    : | 
|---|
| 1506 | * Status    : UNTESTED STUB | 
|---|
| 1507 | * | 
|---|
| 1508 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1509 | *****************************************************************************/ | 
|---|
| 1510 |  | 
|---|
| 1511 | LONG WIN32API RegRestoreKeyA(HKEY   hKey, | 
|---|
| 1512 | LPCSTR lpszFile, | 
|---|
| 1513 | DWORD   fdw) | 
|---|
| 1514 | { | 
|---|
| 1515 | dprintf(("ADVAPI32: RegRestoreKeyA not implemented.\n")); | 
|---|
| 1516 |  | 
|---|
| 1517 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1518 | } | 
|---|
| 1519 |  | 
|---|
| 1520 |  | 
|---|
| 1521 | /***************************************************************************** | 
|---|
| 1522 | * Name      : RegRestoreKeyW | 
|---|
| 1523 | * Purpose   : The RegRestoreKey function reads the registry information in a | 
|---|
| 1524 | *             specified file and copies it over the specified key. This | 
|---|
| 1525 | *             registry information may be in the form of a key and multiple | 
|---|
| 1526 | *             levels of subkeys. | 
|---|
| 1527 | * Parameters: HKEY    hKey      handle of key where restore begins | 
|---|
| 1528 | *             LPCWSTR lpszFile  address of filename containing saved tree | 
|---|
| 1529 | *             DWORD   fdw       optional flags | 
|---|
| 1530 | * Variables : | 
|---|
| 1531 | * Result    : | 
|---|
| 1532 | * Remark    : | 
|---|
| 1533 | * Status    : UNTESTED STUB | 
|---|
| 1534 | * | 
|---|
| 1535 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1536 | *****************************************************************************/ | 
|---|
| 1537 |  | 
|---|
| 1538 | LONG WIN32API RegRestoreKeyW(HKEY    hKey, | 
|---|
| 1539 | LPCWSTR  lpszFile, | 
|---|
| 1540 | DWORD    fdw) | 
|---|
| 1541 | { | 
|---|
| 1542 | dprintf(("ADVAPI32: RegRestoreKeyW not implemented.\n")); | 
|---|
| 1543 |  | 
|---|
| 1544 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1545 | } | 
|---|
| 1546 |  | 
|---|
| 1547 |  | 
|---|
| 1548 | /***************************************************************************** | 
|---|
| 1549 | * Name      : RegSaveKeyA | 
|---|
| 1550 | * Purpose   : The RegSaveKey function saves the specified key and all of its | 
|---|
| 1551 | *             subkeys and values to a new file. | 
|---|
| 1552 | * Parameters: HKEY                  hKey      handle of key where save begins | 
|---|
| 1553 | *             LPCSTR               lpszFile  address of filename to save to | 
|---|
| 1554 | *             LPSECURITY_ATTRIBUTES lpsa      address of security structure | 
|---|
| 1555 | * Variables : | 
|---|
| 1556 | * Result    : | 
|---|
| 1557 | * Remark    : | 
|---|
| 1558 | * Status    : UNTESTED STUB | 
|---|
| 1559 | * | 
|---|
| 1560 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1561 | *****************************************************************************/ | 
|---|
| 1562 |  | 
|---|
| 1563 | LONG WIN32API RegSaveKeyA(HKEY                  hKey, | 
|---|
| 1564 | LPCSTR                lpszFile, | 
|---|
| 1565 | LPSECURITY_ATTRIBUTES lpsa) | 
|---|
| 1566 | { | 
|---|
| 1567 | dprintf(("ADVAPI32: RegSaveKeyA not implemented.\n")); | 
|---|
| 1568 |  | 
|---|
| 1569 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1570 | } | 
|---|
| 1571 |  | 
|---|
| 1572 |  | 
|---|
| 1573 | /***************************************************************************** | 
|---|
| 1574 | * Name      : RegSaveKeyW | 
|---|
| 1575 | * Purpose   : The RegSaveKey function saves the specified key and all of its | 
|---|
| 1576 | *             subkeys and values to a new file. | 
|---|
| 1577 | * Parameters: HKEY                  hKey      handle of key where save begins | 
|---|
| 1578 | *             LPCWSTR               lpszFile  address of filename to save to | 
|---|
| 1579 | *             LPSECURITY_ATTRIBUTES lpsa      address of security structure | 
|---|
| 1580 | * Variables : | 
|---|
| 1581 | * Result    : | 
|---|
| 1582 | * Remark    : | 
|---|
| 1583 | * Status    : UNTESTED STUB | 
|---|
| 1584 | * | 
|---|
| 1585 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1586 | *****************************************************************************/ | 
|---|
| 1587 |  | 
|---|
| 1588 | LONG WIN32API RegSaveKeyW(HKEY                  hKey, | 
|---|
| 1589 | LPCWSTR               lpszFile, | 
|---|
| 1590 | LPSECURITY_ATTRIBUTES lpsa) | 
|---|
| 1591 | { | 
|---|
| 1592 | dprintf(("ADVAPI32: RegSaveKeyW not implemented.\n")); | 
|---|
| 1593 |  | 
|---|
| 1594 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1595 | } | 
|---|
| 1596 |  | 
|---|
| 1597 |  | 
|---|
| 1598 | /***************************************************************************** | 
|---|
| 1599 | * Name      : RegSetKeySecurity | 
|---|
| 1600 | * Purpose   : The RegSetKeySecurity function sets the security of an open registry key. | 
|---|
| 1601 | * Parameters: HKEY                 hKey open handle of key to set | 
|---|
| 1602 | *             SECURITY_INFORMATION si   descriptor contents | 
|---|
| 1603 | *             PSECURITY_DESCRIPTOR psd  address of descriptor for key | 
|---|
| 1604 | * Variables : | 
|---|
| 1605 | * Result    : | 
|---|
| 1606 | * Remark    : | 
|---|
| 1607 | * Status    : UNTESTED STUB | 
|---|
| 1608 | * | 
|---|
| 1609 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1610 | *****************************************************************************/ | 
|---|
| 1611 |  | 
|---|
| 1612 | LONG WIN32API RegSetKeySecurity(HKEY                 hKey, | 
|---|
| 1613 | SECURITY_INFORMATION si, | 
|---|
| 1614 | PSECURITY_DESCRIPTOR psd) | 
|---|
| 1615 | { | 
|---|
| 1616 | dprintf(("ADVAPI32: RegSetKeySecurity not implemented.\n")); | 
|---|
| 1617 |  | 
|---|
| 1618 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1619 | } | 
|---|
| 1620 |  | 
|---|
| 1621 |  | 
|---|
| 1622 | /***************************************************************************** | 
|---|
| 1623 | * Name      : RegUnLoadKeyA | 
|---|
| 1624 | * Purpose   : The RegUnLoadKey function unloads the specified key and subkeys from the registry. | 
|---|
| 1625 | * Parameters: HKEY    hKey       handle of open key | 
|---|
| 1626 | *             LPCSTR lpszSubKey address of name of subkey to unload | 
|---|
| 1627 | * Variables : | 
|---|
| 1628 | * Result    : | 
|---|
| 1629 | * Remark    : | 
|---|
| 1630 | * Status    : UNTESTED STUB | 
|---|
| 1631 | * | 
|---|
| 1632 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1633 | *****************************************************************************/ | 
|---|
| 1634 |  | 
|---|
| 1635 | LONG WIN32API RegUnLoadKeyA(HKEY    hKey, | 
|---|
| 1636 | LPCSTR  lpszSubKey) | 
|---|
| 1637 | { | 
|---|
| 1638 | dprintf(("ADVAPI32: RegUnLoadKeyA not implemented.\n")); | 
|---|
| 1639 |  | 
|---|
| 1640 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1641 | } | 
|---|
| 1642 |  | 
|---|
| 1643 |  | 
|---|
| 1644 | /***************************************************************************** | 
|---|
| 1645 | * Name      : RegUnLoadKeyW | 
|---|
| 1646 | * Purpose   : The RegUnLoadKey function unloads the specified key and subkeys from the registry. | 
|---|
| 1647 | * Parameters: HKEY    hKey       handle of open key | 
|---|
| 1648 | *             LPCWSTR lpszSubKey address of name of subkey to unload | 
|---|
| 1649 | * Variables : | 
|---|
| 1650 | * Result    : | 
|---|
| 1651 | * Remark    : | 
|---|
| 1652 | * Status    : UNTESTED STUB | 
|---|
| 1653 | * | 
|---|
| 1654 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1655 | *****************************************************************************/ | 
|---|
| 1656 |  | 
|---|
| 1657 | LONG WIN32API RegUnLoadKeyW(HKEY    hKey, | 
|---|
| 1658 | LPCWSTR  lpszSubKey) | 
|---|
| 1659 | { | 
|---|
| 1660 | dprintf(("ADVAPI32: RegUnLoadKeyW not implemented.\n")); | 
|---|
| 1661 |  | 
|---|
| 1662 | return (ERROR_ACCESS_DENIED); /* signal failure */ | 
|---|
| 1663 | } | 
|---|
| 1664 |  | 
|---|
| 1665 |  | 
|---|
| 1666 | /***************************************************************************** | 
|---|
| 1667 | * Name      : RegNotifyChangeKeyValue | 
|---|
| 1668 | * Purpose   : | 
|---|
| 1669 | * Parameters: HKEY    hKey       handle of open key | 
|---|
| 1670 | *             LPCWSTR lpszSubKey address of name of subkey to unload | 
|---|
| 1671 | * Variables : | 
|---|
| 1672 | * Result    : | 
|---|
| 1673 | * Remark    : | 
|---|
| 1674 | * Status    : UNTESTED STUB | 
|---|
| 1675 | * | 
|---|
| 1676 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 1677 | *****************************************************************************/ | 
|---|
| 1678 |  | 
|---|
| 1679 | LONG WIN32API RegNotifyChangeKeyValue(HKEY   hKey, | 
|---|
| 1680 | BOOL   bWatchSubtree, | 
|---|
| 1681 | DWORD  dwNotifyFilter, | 
|---|
| 1682 | HANDLE hEvent, | 
|---|
| 1683 | BOOL   fAsynchronus) | 
|---|
| 1684 | { | 
|---|
| 1685 | dprintf(("ADVAPI32: RegNotifyChangeKeyValue() not implemented.\n")); | 
|---|
| 1686 |  | 
|---|
| 1687 | return ERROR_ACCESS_DENIED; | 
|---|
| 1688 | } | 
|---|
| 1689 |  | 
|---|