43#define FLG_ADDREG_BINVALUETYPE 0x00000001
44#define FLG_ADDREG_NOCLOBBER 0x00000002
45#define FLG_ADDREG_DELVAL 0x00000004
46#define FLG_ADDREG_APPEND 0x00000008
47#define FLG_ADDREG_KEYONLY 0x00000010
48#define FLG_ADDREG_OVERWRITEONLY 0x00000020
49#define FLG_ADDREG_TYPE_SZ 0x00000000
50#define FLG_ADDREG_TYPE_MULTI_SZ 0x00010000
51#define FLG_ADDREG_TYPE_EXPAND_SZ 0x00020000
52#define FLG_ADDREG_TYPE_BINARY (0x00000000 | FLG_ADDREG_BINVALUETYPE)
53#define FLG_ADDREG_TYPE_DWORD (0x00010000 | FLG_ADDREG_BINVALUETYPE)
54#define FLG_ADDREG_TYPE_NONE (0x00020000 | FLG_ADDREG_BINVALUETYPE)
55#define FLG_ADDREG_TYPE_MASK (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE)
60#define REGISTRY_SETUP_MACHINE L"\\Registry\\Machine\\SYSTEM\\USetup_Machine\\"
61#define REGISTRY_SETUP_USER L"\\Registry\\Machine\\SYSTEM\\USetup_User\\"
83#define IsPredefKey(HKey) \
84 (((ULONG_PTR)(HKey) & 0xF0000000) == 0x80000000)
86#define GetPredefKeyIndex(HKey) \
87 ((ULONG_PTR)(HKey) & 0x0FFFFFFF)
101 if (RootKeyMountPoint)
117 if (RootKeyMountPoint)
529 DPRINT1(
"SpInfOpenInfFile() failed\n");
536 DPRINT1(
"registry_callback() failed\n");
544 DPRINT1(
"registry_callback() failed\n");
551 DPRINT1(
"registry_callback() failed\n");
579#define NUMBER_OF_STANDARD_REGISTRY_HIVES 3
591#define NUMBER_OF_SECURITY_REGISTRY_HIVES 2
612 *ShouldRepairRegistry =
FALSE;
618 DPRINT1(
"RtlAdjustPrivilege(SE_RESTORE_PRIVILEGE) failed (Status 0x%08lx)\n",
Status);
627 DPRINT1(
"RtlAdjustPrivilege(SE_BACKUP_PRIVILEGE) failed (Status 0x%08lx)\n",
Status);
640 *ShouldRepairRegistry =
TRUE;
694 DPRINT1(
"RtlAdjustPrivilege(SE_RESTORE_PRIVILEGE) failed (Status 0x%08lx)\n",
Status);
703 DPRINT1(
"RtlAdjustPrivilege(SE_BACKUP_PRIVILEGE) failed (Status 0x%08lx)\n",
Status);
733 DPRINT1(
"NtCreateKey() failed to create the proto-hive (Status %lx)\n",
Status);
835 DPRINT1(
"ConnectRegistry(%S) failed, Status 0x%08lx\n",
845 DPRINT1(
"CreateSymLinkKey(%S) failed, Status 0x%08lx\n",
937 DPRINT(
"NtCreateKey() succeeded to %s the %wZ key (Status %lx)\n",
964 DPRINT1(
"NtCreateKey() failed to create the ControlSet001 key (Status %lx)\n",
Status);
969 DPRINT(
"NtCreateKey() succeeded to %s the ControlSet001 key (Status %lx)\n",
977 L"SYSTEM\\CurrentControlSet",
981 DPRINT1(
"CreateSymLinkKey(CurrentControlSet) failed, Status 0x%08lx\n",
Status);
1013 DPRINT1(
"RtlAdjustPrivilege(SE_RESTORE_PRIVILEGE) failed (Status 0x%08lx)\n",
Status);
1022 DPRINT1(
"RtlAdjustPrivilege(SE_BACKUP_PRIVILEGE) failed (Status 0x%08lx)\n",
Status);
1043 DPRINT1(
"DeleteSymLinkKey(%S) failed, Status 0x%08lx\n",
WCHAR FileNameBuffer[MAX_PATH]
BOOL Delete(LPCTSTR ServiceName)
BOOLEAN ImportRegistryFile(IN PCWSTR SourcePath, IN PCWSTR FileName, IN PCWSTR Section, IN LCID LocaleId, IN BOOLEAN Delete)
#define FLG_ADDREG_OVERWRITEONLY
static BOOLEAN registry_callback(HINF hInf, PCWSTR Section, BOOLEAN Delete)
#define FLG_ADDREG_TYPE_MASK
VOID RegCleanupRegistry(IN PUNICODE_STRING NtSystemRoot)
enum _HIVE_UPDATE_STATE HIVE_UPDATE_STATE
struct _ROOT_KEY * PROOT_KEY
#define FLG_ADDREG_TYPE_BINARY
struct _ROOT_KEY ROOT_KEY
#define FLG_ADDREG_TYPE_SZ
HANDLE GetRootKeyByName(IN PCWSTR RootKeyName, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
#define FLG_ADDREG_BINVALUETYPE
HIVE_LIST_ENTRY SecurityRegistryHives[]
HIVE_LIST_ENTRY RegistryHives[]
#define FLG_ADDREG_APPEND
#define REGISTRY_SETUP_USER
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
#define FLG_ADDREG_TYPE_EXPAND_SZ
#define FLG_ADDREG_DELVAL
#define REGISTRY_SETUP_MACHINE
#define IsPredefKey(HKey)
struct _HIVE_LIST_ENTRY * PHIVE_LIST_ENTRY
#define FLG_ADDREG_TYPE_MULTI_SZ
#define GetPredefKeyIndex(HKey)
static BOOLEAN do_reg_operation(HANDLE KeyHandle, PUNICODE_STRING ValueName, PINFCONTEXT Context, ULONG Flags)
#define NUMBER_OF_STANDARD_REGISTRY_HIVES
#define FLG_ADDREG_TYPE_NONE
NTSTATUS RegInitializeRegistry(IN PUNICODE_STRING NtSystemRoot)
#define FLG_ADDREG_KEYONLY
#define FLG_ADDREG_NOCLOBBER
#define FLG_ADDREG_TYPE_DWORD
NTSTATUS VerifyRegistryHives(IN PUNICODE_STRING NtSystemRoot, OUT PBOOLEAN ShouldRepairRegistry)
#define NUMBER_OF_SECURITY_REGISTRY_HIVES
struct _HIVE_LIST_ENTRY HIVE_LIST_ENTRY
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)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
static void append_multi_sz_value(HKEY hkey, const WCHAR *value, const WCHAR *strings, DWORD str_size)
static void delete_multi_sz_value(HKEY hkey, const WCHAR *value, const WCHAR *string)
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
NTSTATUS SetupCopyFile(IN PCWSTR SourceFileName, IN PCWSTR DestinationFileName, IN BOOLEAN FailIfExists)
GLuint GLuint GLsizei GLenum type
GLsizei const GLchar *const * strings
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define OBJ_CASE_INSENSITIVE
REFIID LPVOID DWORD_PTR dw
#define SpInfGetMultiSzField
#define SpInfGetFieldCount
#define SpInfFindNextLine
#define MAX_INF_STRING_LENGTH
#define SpInfGetStringField
#define SpInfGetBinaryField
#define SpInfCloseInfFile
#define SpInfFindFirstLine
#define memcpy(s1, s2, n)
#define SE_BACKUP_PRIVILEGE
#define SE_RESTORE_PRIVILEGE
#define InitializeObjectAttributes(p, n, a, r, s)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_OPTION_NON_VOLATILE
#define REG_CREATED_NEW_KEY
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
UNICODE_STRING NtSystemRoot
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
NTSTRSAFEAPI RtlStringCchCatW(_Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
NTSTATUS DisconnectRegistry(IN HANDLE RootKey OPTIONAL, IN PCWSTR RegMountPoint, IN ULONG Flags)
NTSTATUS VerifyRegistryHive(IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey)
NTSTATUS CreateNestedKey(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, ULONG CreateOptions)
NTSTATUS CreateRegistryFile(IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey, IN BOOLEAN IsHiveNew, IN HANDLE ProtoKeyHandle)
NTSTATUS CreateSymLinkKey(IN HANDLE RootKey OPTIONAL, IN PCWSTR LinkKeyName, IN PCWSTR TargetKeyName)
NTSTATUS DeleteSymLinkKey(IN HANDLE RootKey OPTIONAL, IN PCWSTR LinkKeyName)
NTSTATUS ConnectRegistry(IN HANDLE RootKey OPTIONAL, IN PCWSTR RegMountPoint, IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
PULONG MinorVersion OPTIONAL
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
#define HKEY_CLASSES_ROOT
_Must_inspect_result_ _In_ ULONG Flags