[USETUP] Do not put ImagePath to the service registry entry

It is supposed to be there already
This commit is contained in:
Victor Perevertkin 2020-12-22 21:00:38 +03:00
parent e5254974d2
commit e12233daf6
No known key found for this signature in database
GPG key ID: C750B7222E9C7830

View file

@ -63,10 +63,8 @@ InstallDriver(
IN LPCWSTR DeviceId,
IN LPCWSTR HardwareId)
{
UNICODE_STRING PathPrefix = RTL_CONSTANT_STRING(L"System32\\DRIVERS\\");
UNICODE_STRING ServiceU = RTL_CONSTANT_STRING(L"Service");
UNICODE_STRING ErrorControlU = RTL_CONSTANT_STRING(L"ErrorControl");
UNICODE_STRING ImagePathU = RTL_CONSTANT_STRING(L"ImagePath");
UNICODE_STRING StartU = RTL_CONSTANT_STRING(L"Start");
UNICODE_STRING TypeU = RTL_CONSTANT_STRING(L"Type");
UNICODE_STRING UpperFiltersU = RTL_CONSTANT_STRING(L"UpperFilters");
@ -78,7 +76,6 @@ InstallDriver(
HANDLE hService;
INFCONTEXT Context;
PCWSTR Driver, ClassGuid, ImagePath;
PWSTR FullImagePath;
ULONG dwValue;
ULONG Disposition;
NTSTATUS Status;
@ -114,20 +111,6 @@ InstallDriver(
return FALSE;
}
/* Prepare full driver path */
dwValue = PathPrefix.MaximumLength + wcslen(ImagePath) * sizeof(WCHAR);
FullImagePath = (PWSTR)RtlAllocateHeap(ProcessHeap, 0, dwValue);
if (!FullImagePath)
{
DPRINT1("RtlAllocateHeap() failed\n");
INF_FreeData(ImagePath);
INF_FreeData(ClassGuid);
INF_FreeData(Driver);
return FALSE;
}
RtlCopyMemory(FullImagePath, PathPrefix.Buffer, PathPrefix.MaximumLength);
ConcatPaths(FullImagePath, dwValue / sizeof(WCHAR), 1, ImagePath);
DPRINT1("Using driver '%S' for device '%S'\n", ImagePath, DeviceId);
/* Create service key */
@ -137,7 +120,6 @@ InstallDriver(
if (!NT_SUCCESS(Status))
{
DPRINT1("NtCreateKey('%wZ') failed with status 0x%08x\n", &StringU, Status);
RtlFreeHeap(ProcessHeap, 0, FullImagePath);
INF_FreeData(ImagePath);
INF_FreeData(ClassGuid);
INF_FreeData(Driver);
@ -171,15 +153,9 @@ InstallDriver(
&dwValue,
sizeof(dwValue));
}
/* HACK: don't put any path in registry */
NtSetValueKey(hService,
&ImagePathU,
0,
REG_SZ,
(PVOID)ImagePath,
(wcslen(ImagePath) + 1) * sizeof(WCHAR));
INF_FreeData(ImagePath);
NtClose(hService);
/* Add kbdclass and partmgr upper filters */
if (ClassGuid &&_wcsicmp(ClassGuid, L"{4D36E96B-E325-11CE-BFC1-08002BE10318}") == 0)
@ -220,17 +196,6 @@ InstallDriver(
INF_FreeData(Driver);
/* HACK: Update driver path */
NtSetValueKey(hService,
&ImagePathU,
0,
REG_SZ,
FullImagePath,
(wcslen(FullImagePath) + 1) * sizeof(WCHAR));
RtlFreeHeap(ProcessHeap, 0, FullImagePath);
NtClose(hService);
return deviceInstalled;
}