34 ERR(
"NtQueryKey returned unexpected Status: 0x%08x\n",
Status);
40 if (NameInformation ==
NULL)
42 ERR(
"Failed to allocate %lu bytes\n", InfoLength);
49 RtlFreeHeap(RtlGetProcessHeap(), 0, NameInformation);
50 ERR(
"NtQueryKey failed: 0x%08x\n",
Status);
62 RtlFreeHeap(RtlGetProcessHeap(), 0, NameInformation);
63 ERR(
"RtlDuplicateUnicodeString failed: 0x%08x\n",
Status);
67 RtlFreeHeap(RtlGetProcessHeap(), 0, NameInformation);
84 ERR(
"NtQueryObject failed, Status %x08x\n",
Status);
126 ERR(
"Key name %S is invalid!\n",
KeyName.Buffer);
189 *PreferredKey =
hKey;
232 HKEY QueriedKey, TestKey;
251 lpSecurityAttributes,
280 lpSecurityAttributes,
286 if (QueriedKey !=
hKey)
292 if (QueriedKey !=
hKey)
308 lpSecurityAttributes,
312 if (QueriedKey !=
hKey)
362 if (QueriedKey !=
hKey)
384 if (QueriedKey !=
hKey)
426 if (QueriedKey !=
hKey)
447 if (QueriedKey !=
hKey)
491 if (QueriedKey !=
hKey)
512 if (QueriedKey !=
hKey)
562 if (QueriedKey !=
hKey)
566 if (QueriedKey !=
hKey)
583 if (QueriedKey !=
hKey)
602 HKEY PreferredKey, FallbackKey;
603 DWORD NumPreferredSubKeys;
604 DWORD MaxFallbackSubKeyLen;
638 if (PreferredKey !=
hKey)
662 &NumPreferredSubKeys,
673 if (dwIndex < NumPreferredSubKeys)
692 dwIndex -= NumPreferredSubKeys;
701 &MaxFallbackSubKeyLen,
710 ERR(
"Could not query info of key %p (Err: %d)\n", FallbackKey,
ErrorCode);
714 MaxFallbackSubKeyLen++;
715 TRACE(
"Maxfallbacksubkeylen: %d\n", MaxFallbackSubKeyLen);
719 RtlGetProcessHeap(), 0, MaxFallbackSubKeyLen *
sizeof(
WCHAR));
720 if (!FallbackSubKeyName)
734 HKEY PreferredSubKey;
735 DWORD FallbackSubkeyLen = MaxFallbackSubKeyLen;
753 FallbackSubKeyName[FallbackSubkeyLen] =
L'\0';
771 ERR(
"Got error %d while querying for %s on HKCU side.\n",
ErrorCode, FallbackSubKeyName);
776 if (FallbackIndex == dwIndex)
794 if (PreferredKey !=
hKey)
796 if (FallbackKey !=
hKey)
798 if (FallbackSubKeyName)
799 RtlFreeHeap(RtlGetProcessHeap(), 0, FallbackSubKeyName);
817 HKEY PreferredKey, FallbackKey;
818 DWORD NumPreferredValues;
819 DWORD MaxFallbackValueNameLen;
853 if (PreferredKey !=
hKey)
888 if (dwIndex < NumPreferredValues)
907 dwIndex -= NumPreferredValues;
919 &MaxFallbackValueNameLen,
925 ERR(
"Could not query info of key %p (Err: %d)\n", FallbackKey,
ErrorCode);
929 MaxFallbackValueNameLen++;
930 TRACE(
"Maxfallbacksubkeylen: %d\n", MaxFallbackValueNameLen);
934 RtlGetProcessHeap(), 0, MaxFallbackValueNameLen *
sizeof(
WCHAR));
935 if (!FallbackValueName)
949 DWORD FallbackValueNameLen = MaxFallbackValueNameLen;
956 &FallbackValueNameLen,
967 FallbackValueName[FallbackValueNameLen] =
L'\0';
985 ERR(
"Got error %d while querying for %s on HKCU side.\n",
ErrorCode, FallbackValueName);
990 if (FallbackIndex == dwIndex)
1008 if (PreferredKey !=
hKey)
1010 if (FallbackKey !=
hKey)
1012 if (FallbackValueName)
1013 RtlFreeHeap(RtlGetProcessHeap(), 0, FallbackValueName);
NTSTATUS NtQueryObject(IN HANDLE Handle, IN OBJECT_INFO_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG ObjectInformationLength, OUT PULONG ReturnLength)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define RegCloseKey(hKey)
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
FORCEINLINE void MakeHKCRKey(_Inout_ HKEY *hKey)
#define ERROR_NO_MORE_ITEMS
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
LONG WINAPI CreateHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
static LONG GetFallbackHKCRKey(_In_ HKEY hKey, _Out_ HKEY *MachineKey, _In_ BOOL MustCreate)
LONG WINAPI QueryHKCRValue(_In_ HKEY hKey, _In_ LPCWSTR Name, _In_ LPDWORD Reserved, _In_ LPDWORD Type, _In_ LPBYTE Data, _In_ LPDWORD Count)
LONG WINAPI EnumHKCRValue(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ PDWORD lpcbName, _Reserved_ PDWORD lpReserved, _Out_opt_ PDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ PDWORD lpcbData)
static LONG GetKeySam(_In_ HKEY hKey, _Out_ REGSAM *RegSam)
LONG WINAPI SetHKCRValue(_In_ HKEY hKey, _In_ LPCWSTR Name, _In_ DWORD Reserved, _In_ DWORD Type, _In_ CONST BYTE *Data, _In_ DWORD DataSize)
static const UNICODE_STRING HKLM_ClassesPath
LONG WINAPI OpenHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _In_ PHKEY phkResult)
static LONG GetPreferredHKCRKey(_In_ HKEY hKey, _Out_ HKEY *PreferredKey)
LONG WINAPI DeleteHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM RegSam, _In_ DWORD Reserved)
static LONG GetKeyName(HKEY hKey, PUNICODE_STRING KeyName)
LONG WINAPI EnumHKCRKey(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int, const UNICODE_STRING *, UNICODE_STRING *)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERROR_FILE_NOT_FOUND
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
_In_ NDIS_ERROR_CODE ErrorCode
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
#define STATUS_BUFFER_TOO_SMALL
#define RTL_CONSTANT_STRING(s)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Reserved_ PVOID Reserved
#define ERROR_INTERNAL_ERROR
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER