| 1 | /* $Id: reg.c,v 1.5 2003-04-08 12:47:07 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 5 | * Win32 NT Runtime / NTDLL for OS/2
|
|---|
| 6 | *
|
|---|
| 7 | * Copyright 1998 original WINE Author
|
|---|
| 8 | * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
|
|---|
| 9 | *
|
|---|
| 10 | * registry functions
|
|---|
| 11 | */
|
|---|
| 12 | #include <windows.h>
|
|---|
| 13 | #include <ntddk.h>
|
|---|
| 14 | #include <winnt.h>
|
|---|
| 15 | #include <ntdef.h>
|
|---|
| 16 | #include <winreg.h>
|
|---|
| 17 |
|
|---|
| 18 | #include <heapstring.h>
|
|---|
| 19 | #include "debugtools.h"
|
|---|
| 20 |
|
|---|
| 21 | /*RLW - this isn't used & generates a gcc warning */
|
|---|
| 22 | #if 0
|
|---|
| 23 |
|
|---|
| 24 | /* translates predefined paths to HKEY_ constants */
|
|---|
| 25 | static BOOLEAN _NtKeyToWinKey(
|
|---|
| 26 | IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|---|
| 27 | OUT UINT * Offset,/* offset within ObjectName */
|
|---|
| 28 | OUT HKEY * KeyHandle)/* translated handle */
|
|---|
| 29 | {
|
|---|
| 30 | static const WCHAR KeyPath_HKLM[] = {
|
|---|
| 31 | '\\','R','E','G','I','S','T','R','Y',
|
|---|
| 32 | '\\','M','A','C','H','I','N','E',0};
|
|---|
| 33 | static const WCHAR KeyPath_HKU [] = {
|
|---|
| 34 | '\\','R','E','G','I','S','T','R','Y',
|
|---|
| 35 | '\\','U','S','E','R',0};
|
|---|
| 36 | static const WCHAR KeyPath_HCC [] = {
|
|---|
| 37 | '\\','R','E','G','I','S','T','R','Y',
|
|---|
| 38 | '\\','M','A','C','H','I','N','E',
|
|---|
| 39 | '\\','S','Y','S','T','E','M',
|
|---|
| 40 | '\\','C','U','R','R','E','N','T','C','O','N','T','R','O','L','S','E','T',
|
|---|
| 41 | '\\','H','A','R','D','W','A','R','E','P','R','O','F','I','L','E','S',
|
|---|
| 42 | '\\','C','U','R','R','E','N','T',0};
|
|---|
| 43 | static const WCHAR KeyPath_HCR [] = {
|
|---|
| 44 | '\\','R','E','G','I','S','T','R','Y',
|
|---|
| 45 | '\\','M','A','C','H','I','N','E',
|
|---|
| 46 | '\\','S','O','F','T','W','A','R','E',
|
|---|
| 47 | '\\','C','L','A','S','S','E','S',0};
|
|---|
| 48 | int len;
|
|---|
| 49 | PUNICODE_STRING ObjectName = ObjectAttributes->ObjectName;
|
|---|
| 50 |
|
|---|
| 51 | if(ObjectAttributes->RootDirectory)
|
|---|
| 52 | {
|
|---|
| 53 | len = 0;
|
|---|
| 54 | *KeyHandle = ObjectAttributes->RootDirectory;
|
|---|
| 55 | }
|
|---|
| 56 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM)))
|
|---|
| 57 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HKLM,len)))
|
|---|
| 58 | { *KeyHandle = HKEY_LOCAL_MACHINE;
|
|---|
| 59 | }
|
|---|
| 60 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU)))
|
|---|
| 61 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HKU,len)))
|
|---|
| 62 | { *KeyHandle = HKEY_USERS;
|
|---|
| 63 | }
|
|---|
| 64 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR)))
|
|---|
| 65 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HCR,len)))
|
|---|
| 66 | { *KeyHandle = HKEY_CLASSES_ROOT;
|
|---|
| 67 | }
|
|---|
| 68 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC)))
|
|---|
| 69 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HCC,len)))
|
|---|
| 70 | { *KeyHandle = HKEY_CURRENT_CONFIG;
|
|---|
| 71 | }
|
|---|
| 72 | else
|
|---|
| 73 | {
|
|---|
| 74 | *KeyHandle = 0;
|
|---|
| 75 | *Offset = 0;
|
|---|
| 76 | return FALSE;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | if (len > 0 && ObjectName->Buffer[len] == (WCHAR)'\\') len++;
|
|---|
| 80 | *Offset = len;
|
|---|
| 81 |
|
|---|
| 82 | TRACE("off=%u hkey=0x%08x\n", *Offset, *KeyHandle);
|
|---|
| 83 | return TRUE;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | #endif
|
|---|
| 87 |
|
|---|
| 88 | /******************************************************************************
|
|---|
| 89 | * NtCreateKey [NTDLL]
|
|---|
| 90 | * ZwCreateKey
|
|---|
| 91 | */
|
|---|
| 92 | NTSTATUS WINAPI NtCreateKey(PHANDLE KeyHandle,
|
|---|
| 93 | ACCESS_MASK DesiredAccess,
|
|---|
| 94 | const OBJECT_ATTRIBUTES* ObjectAttributes,
|
|---|
| 95 | ULONG TitleIndex,
|
|---|
| 96 | const UNICODE_STRING* Class,
|
|---|
| 97 | ULONG CreateOptions,
|
|---|
| 98 | PULONG Disposition)
|
|---|
| 99 | {
|
|---|
| 100 | dprintf (("NTDLL: NtCreateKey(%08xh, %08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 101 | KeyHandle,
|
|---|
| 102 | DesiredAccess,
|
|---|
| 103 | ObjectAttributes,
|
|---|
| 104 | TitleIndex,
|
|---|
| 105 | Class,
|
|---|
| 106 | CreateOptions,
|
|---|
| 107 | Disposition));
|
|---|
| 108 |
|
|---|
| 109 | return (0);
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | /******************************************************************************
|
|---|
| 113 | * NtDeleteKey [NTDLL]
|
|---|
| 114 | * ZwDeleteKey
|
|---|
| 115 | */
|
|---|
| 116 | NTSTATUS WINAPI NtDeleteKey(HANDLE KeyHandle)
|
|---|
| 117 | {
|
|---|
| 118 | dprintf(("NTDLL: NtDeleteKey(%08xh) not implemented\n",
|
|---|
| 119 | KeyHandle));
|
|---|
| 120 |
|
|---|
| 121 | return (0);
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 | /******************************************************************************
|
|---|
| 126 | * NtDeleteValueKey [NTDLL]
|
|---|
| 127 | * ZwDeleteValueKey
|
|---|
| 128 | */
|
|---|
| 129 | NTSTATUS WINAPI NtDeleteValueKey(HANDLE KeyHandle,
|
|---|
| 130 | const UNICODE_STRING* ValueName)
|
|---|
| 131 | {
|
|---|
| 132 | dprintf(("NTDLL: NtDeleteValueKey(%08xh, %08xh) not implemented\n",
|
|---|
| 133 | KeyHandle,
|
|---|
| 134 | ValueName));
|
|---|
| 135 |
|
|---|
| 136 | return(0);
|
|---|
| 137 | }
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 | /******************************************************************************
|
|---|
| 141 | * NtEnumerateKey [NTDLL]
|
|---|
| 142 | * ZwEnumerateKey
|
|---|
| 143 | */
|
|---|
| 144 | NTSTATUS WINAPI NtEnumerateKey(HANDLE KeyHandle,
|
|---|
| 145 | ULONG Index,
|
|---|
| 146 | KEY_INFORMATION_CLASS KeyInformationClass,
|
|---|
| 147 | PVOID KeyInformation,
|
|---|
| 148 | ULONG Length,
|
|---|
| 149 | PULONG ResultLength)
|
|---|
| 150 | {
|
|---|
| 151 | dprintf(("NTDLL: NtEnumerateKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 152 | KeyHandle,
|
|---|
| 153 | Index,
|
|---|
| 154 | KeyInformationClass,
|
|---|
| 155 | KeyInformation,
|
|---|
| 156 | Length,
|
|---|
| 157 | ResultLength));
|
|---|
| 158 |
|
|---|
| 159 | return 0;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 | /******************************************************************************
|
|---|
| 164 | * NtEnumerateValueKey [NTDLL]
|
|---|
| 165 | * ZwEnumerateValueKey
|
|---|
| 166 | */
|
|---|
| 167 | NTSTATUS WINAPI NtEnumerateValueKey(HANDLE KeyHandle,
|
|---|
| 168 | ULONG Index,
|
|---|
| 169 | KEY_VALUE_INFORMATION_CLASS KeyInformationClass,
|
|---|
| 170 | PVOID KeyInformation,
|
|---|
| 171 | ULONG Length,
|
|---|
| 172 | PULONG ResultLength)
|
|---|
| 173 | {
|
|---|
| 174 | dprintf(("NTDLL: NtEnumerateValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 175 | KeyHandle,
|
|---|
| 176 | Index,
|
|---|
| 177 | KeyInformationClass,
|
|---|
| 178 | KeyInformation,
|
|---|
| 179 | Length,
|
|---|
| 180 | ResultLength));
|
|---|
| 181 |
|
|---|
| 182 | return 0;
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 | /******************************************************************************
|
|---|
| 187 | * NtFlushKey [NTDLL]
|
|---|
| 188 | * ZwFlushKey
|
|---|
| 189 | */
|
|---|
| 190 | NTSTATUS WINAPI NtFlushKey(HANDLE KeyHandle)
|
|---|
| 191 | {
|
|---|
| 192 | dprintf(("NTDLL: NtFlushKey(%08xh)\n",
|
|---|
| 193 | KeyHandle));
|
|---|
| 194 |
|
|---|
| 195 | return ERROR_SUCCESS;
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 | /******************************************************************************
|
|---|
| 200 | * NtLoadKey [NTDLL]
|
|---|
| 201 | * ZwLoadKey
|
|---|
| 202 | */
|
|---|
| 203 | NTSTATUS WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *KeyHandle,
|
|---|
| 204 | const OBJECT_ATTRIBUTES *ObjectAttributes)
|
|---|
| 205 | {
|
|---|
| 206 | dprintf(("NTDLL: NtLoadKey(%08xh,%08xh) not implemented.\n",
|
|---|
| 207 | KeyHandle,
|
|---|
| 208 | ObjectAttributes));
|
|---|
| 209 |
|
|---|
| 210 | return 0;
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 | /******************************************************************************
|
|---|
| 215 | * NtNotifyChangeKey [NTDLL]
|
|---|
| 216 | * ZwNotifyChangeKey
|
|---|
| 217 | */
|
|---|
| 218 | NTSTATUS WINAPI NtNotifyChangeKey(HANDLE KeyHandle,
|
|---|
| 219 | HANDLE Event,
|
|---|
| 220 | PIO_APC_ROUTINE ApcRoutine,
|
|---|
| 221 | PVOID ApcContext,
|
|---|
| 222 | PIO_STATUS_BLOCK IoStatusBlock,
|
|---|
| 223 | ULONG CompletionFilter,
|
|---|
| 224 | BOOLEAN Asynchronous,
|
|---|
| 225 | PVOID ChangeBuffer,
|
|---|
| 226 | ULONG Length,
|
|---|
| 227 | BOOLEAN WatchSubTree)
|
|---|
| 228 | {
|
|---|
| 229 | dprintf(("NTDLL: NtNotifyChangeKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 230 | KeyHandle,
|
|---|
| 231 | Event,
|
|---|
| 232 | ApcRoutine,
|
|---|
| 233 | ApcContext,
|
|---|
| 234 | IoStatusBlock,
|
|---|
| 235 | CompletionFilter,
|
|---|
| 236 | Asynchronous,
|
|---|
| 237 | ChangeBuffer,
|
|---|
| 238 | Length,
|
|---|
| 239 | WatchSubTree));
|
|---|
| 240 |
|
|---|
| 241 | return 0;
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 | /******************************************************************************
|
|---|
| 246 | * NtOpenKey [NTDLL.129]
|
|---|
| 247 | * ZwOpenKey
|
|---|
| 248 | * OUT PHANDLE KeyHandle,
|
|---|
| 249 | * IN ACCESS_MASK DesiredAccess,
|
|---|
| 250 | * IN POBJECT_ATTRIBUTES ObjectAttributes
|
|---|
| 251 | */
|
|---|
| 252 | NTSTATUS WINAPI NtOpenKey(PHANDLE KeyHandle,
|
|---|
| 253 | ACCESS_MASK DesiredAccess,
|
|---|
| 254 | const OBJECT_ATTRIBUTES *ObjectAttributes)
|
|---|
| 255 | {
|
|---|
| 256 | dprintf(("NTDLL: NtOpenKey(%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 257 | KeyHandle,
|
|---|
| 258 | DesiredAccess,
|
|---|
| 259 | ObjectAttributes));
|
|---|
| 260 | return 0;
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 | /******************************************************************************
|
|---|
| 265 | * NtQueryKey [NTDLL]
|
|---|
| 266 | * ZwQueryKey
|
|---|
| 267 | */
|
|---|
| 268 | NTSTATUS WINAPI NtQueryKey(HANDLE KeyHandle,
|
|---|
| 269 | KEY_INFORMATION_CLASS KeyInformationClass,
|
|---|
| 270 | PVOID KeyInformation,
|
|---|
| 271 | ULONG Length,
|
|---|
| 272 | PULONG ResultLength)
|
|---|
| 273 | {
|
|---|
| 274 | dprintf(("NTDLL: NtQueryKey(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 275 | KeyHandle,
|
|---|
| 276 | KeyInformationClass,
|
|---|
| 277 | KeyInformation,
|
|---|
| 278 | Length,
|
|---|
| 279 | ResultLength));
|
|---|
| 280 |
|
|---|
| 281 | return 0;
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 | /******************************************************************************
|
|---|
| 286 | * NtQueryMultipleValueKey [NTDLL]
|
|---|
| 287 | * ZwQueryMultipleValueKey
|
|---|
| 288 | */
|
|---|
| 289 |
|
|---|
| 290 | NTSTATUS WINAPI NtQueryMultipleValueKey(HANDLE KeyHandle,
|
|---|
| 291 | PVALENTW ListOfValuesToQuery,
|
|---|
| 292 | ULONG NumberOfItems,
|
|---|
| 293 | PVOID MultipleValueInformation,
|
|---|
| 294 | ULONG Length,
|
|---|
| 295 | PULONG ReturnLength)
|
|---|
| 296 | {
|
|---|
| 297 | dprintf(("NTDLL: NtQueryMultipleValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 298 | KeyHandle,
|
|---|
| 299 | ListOfValuesToQuery,
|
|---|
| 300 | NumberOfItems,
|
|---|
| 301 | MultipleValueInformation,
|
|---|
| 302 | Length,
|
|---|
| 303 | ReturnLength));
|
|---|
| 304 |
|
|---|
| 305 | return 0;
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 | /******************************************************************************
|
|---|
| 310 | * NtQueryValueKey [NTDLL]
|
|---|
| 311 | * ZwQueryValueKey
|
|---|
| 312 | */
|
|---|
| 313 | NTSTATUS WINAPI NtQueryValueKey(HANDLE KeyHandle,
|
|---|
| 314 | const UNICODE_STRING *ValueName,
|
|---|
| 315 | KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
|---|
| 316 | PVOID KeyValueInformation,
|
|---|
| 317 | ULONG Length,
|
|---|
| 318 | PULONG ResultLength)
|
|---|
| 319 | {
|
|---|
| 320 | dprintf(("NTDLL: NtQueryValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 321 | KeyHandle,
|
|---|
| 322 | ValueName,
|
|---|
| 323 | KeyValueInformationClass,
|
|---|
| 324 | KeyValueInformation,
|
|---|
| 325 | Length,
|
|---|
| 326 | ResultLength));
|
|---|
| 327 |
|
|---|
| 328 | return 0;
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 | /******************************************************************************
|
|---|
| 333 | * NtReplaceKey [NTDLL]
|
|---|
| 334 | * ZwReplaceKey
|
|---|
| 335 | */
|
|---|
| 336 | NTSTATUS WINAPI NtReplaceKey(POBJECT_ATTRIBUTES ObjectAttributes,
|
|---|
| 337 | HANDLE Key,
|
|---|
| 338 | POBJECT_ATTRIBUTES ReplacedObjectAttributes)
|
|---|
| 339 | {
|
|---|
| 340 | dprintf(("NTDLL: NtReplaceKey(%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 341 | ObjectAttributes,
|
|---|
| 342 | Key,
|
|---|
| 343 | ReplacedObjectAttributes));
|
|---|
| 344 |
|
|---|
| 345 | return 0;
|
|---|
| 346 | }
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 | /******************************************************************************
|
|---|
| 350 | * NtRestoreKey [NTDLL]
|
|---|
| 351 | * ZwRestoreKey
|
|---|
| 352 | */
|
|---|
| 353 | NTSTATUS WINAPI NtRestoreKey(HANDLE KeyHandle,
|
|---|
| 354 | HANDLE FileHandle,
|
|---|
| 355 | ULONG RestoreFlags)
|
|---|
| 356 | {
|
|---|
| 357 | dprintf(("NTDLL: NtRestoreKey(%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 358 | KeyHandle,
|
|---|
| 359 | FileHandle,
|
|---|
| 360 | RestoreFlags));
|
|---|
| 361 |
|
|---|
| 362 | return 0;
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 | /******************************************************************************
|
|---|
| 367 | * NtSaveKey [NTDLL]
|
|---|
| 368 | * ZwSaveKey
|
|---|
| 369 | */
|
|---|
| 370 | NTSTATUS WINAPI NtSaveKey(HANDLE KeyHandle,
|
|---|
| 371 | HANDLE FileHandle)
|
|---|
| 372 | {
|
|---|
| 373 | dprintf(("NTDLL NtSaveKey(%08xh,%08xh) not implemented.\n",
|
|---|
| 374 | KeyHandle,
|
|---|
| 375 | FileHandle));
|
|---|
| 376 |
|
|---|
| 377 | return 0;
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 | /******************************************************************************
|
|---|
| 382 | * NtSetInformationKey [NTDLL]
|
|---|
| 383 | * ZwSetInformationKey
|
|---|
| 384 | */
|
|---|
| 385 | NTSTATUS WINAPI NtSetInformationKey(HANDLE KeyHandle,
|
|---|
| 386 | const int KeyInformationClass,
|
|---|
| 387 | PVOID KeyInformation,
|
|---|
| 388 | ULONG KeyInformationLength)
|
|---|
| 389 | {
|
|---|
| 390 | dprintf(("NTDLL: NtSetInformationKey(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 391 | KeyHandle,
|
|---|
| 392 | KeyInformationClass,
|
|---|
| 393 | KeyInformation,
|
|---|
| 394 | KeyInformationLength));
|
|---|
| 395 |
|
|---|
| 396 | return 0;
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 | /******************************************************************************
|
|---|
| 401 | * NtSetValueKey [NTDLL]
|
|---|
| 402 | * ZwSetValueKey
|
|---|
| 403 | */
|
|---|
| 404 | NTSTATUS WINAPI NtSetValueKey(HANDLE KeyHandle,
|
|---|
| 405 | const UNICODE_STRING *ValueName,
|
|---|
| 406 | ULONG TitleIndex,
|
|---|
| 407 | ULONG Type,
|
|---|
| 408 | const VOID *Data,
|
|---|
| 409 | ULONG DataSize)
|
|---|
| 410 | {
|
|---|
| 411 | dprintf(("NTDLL: NtSetValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 412 | KeyHandle,
|
|---|
| 413 | ValueName,
|
|---|
| 414 | TitleIndex,
|
|---|
| 415 | Type,
|
|---|
| 416 | Data,
|
|---|
| 417 | DataSize));
|
|---|
| 418 |
|
|---|
| 419 | return (0);
|
|---|
| 420 | }
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 | /******************************************************************************
|
|---|
| 424 | * NtUnloadKey [NTDLL]
|
|---|
| 425 | * ZwUnloadKey
|
|---|
| 426 | */
|
|---|
| 427 | NTSTATUS WINAPI NtUnloadKey(HANDLE KeyHandle)
|
|---|
| 428 | {
|
|---|
| 429 | dprintf(("NTDLL: NtUnloadKey(%08xh) not implemented.\n",
|
|---|
| 430 | KeyHandle));
|
|---|
| 431 |
|
|---|
| 432 | return 0;
|
|---|
| 433 | }
|
|---|
| 434 |
|
|---|