Rolled in various changes from others
[reactos.git] / reactos / lib / advapi32 / reg / reg.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/advapi32/sec/rtlsec.c
5 * PURPOSE: Registry functions
6 * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
7 * UPDATE HISTORY:
8 * Created 01/11/98
9 */
10 #include <windows.h>
11 #include <wstring.h>
12 #undef WIN32_LEAN_AND_MEAN
13
14 LONG
15 STDCALL
16 RegOpenKeyW (
17 HKEY hKey,
18 LPCWSTR lpSubKey,
19 PHKEY phkResult
20 )
21 {
22 NTSTATUS errCode;
23 UNICODE_STRING SubKeyString;
24
25 SubKeyString.Buffer = lpSubKey;
26 SubKeyString.Length = wcslen(lpSubKey);
27 SubKeyString.MaximumLength = SubKeyString.Length;
28
29 ObjectAttributes.RootDirectory = hKey;
30 ObjectAttributes.ObjectName = &SubKeyString;
31 ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
32 errCode = NtOpenKey(
33 phkResult,
34 GENERIC_ALL,
35 &ObjectAttributes
36 );
37 if ( !NT_SUCCESS(errCode) ) {
38 SetLastError(RtlNtStatusToDosError(errCode));
39 return FALSE;
40 }
41 return TRUE;
42 }