+ if (SetUpBoot == TRUE)
+ {
+ RtlInitUnicodeStringFromLiteral(&KeyName,
+ L"\\Registry\\Machine\\HARDWARE");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+ Status = NtOpenKey(&KeyHandle,
+ KEY_ALL_ACCESS,
+ &ObjectAttributes);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
+ return(Status);
+ }
+
+ RtlInitUnicodeStringFromLiteral(&ValueName,
+ L"InstallPath");
+
+ BufferSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 4096;
+ ValueInfo = ExAllocatePool(PagedPool,
+ BufferSize);
+ if (ValueInfo == NULL)
+ {
+ NtClose(KeyHandle);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ Status = NtQueryValueKey(KeyHandle,
+ &ValueName,
+ KeyValuePartialInformation,
+ ValueInfo,
+ BufferSize,
+ &ResultSize);
+ NtClose(KeyHandle);
+ if (ValueInfo == NULL)
+ {
+ ExFreePool(ValueInfo);
+ return(Status);
+ }
+
+ RtlCopyMemory(ConfigPath,
+ ValueInfo->Data,
+ ValueInfo->DataLength);
+ ConfigPath[ValueInfo->DataLength / sizeof(WCHAR)] = (WCHAR)0;
+ ExFreePool(ValueInfo);
+ }
+ else
+ {
+ wcscpy(ConfigPath, L"\\SystemRoot\\system32\\config");
+ }
+ DPRINT1("ConfigPath: %S\n", ConfigPath);
+
+ EndPtr = ConfigPath + wcslen(ConfigPath);
+