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