From e12233daf62010f940135c397c17300999cd9ae3 Mon Sep 17 00:00:00 2001 From: Victor Perevertkin Date: Tue, 22 Dec 2020 21:00:38 +0300 Subject: [PATCH] [USETUP] Do not put ImagePath to the service registry entry It is supposed to be there already --- base/setup/usetup/devinst.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/base/setup/usetup/devinst.c b/base/setup/usetup/devinst.c index 5e5f4404f05..81eb382f5fb 100644 --- a/base/setup/usetup/devinst.c +++ b/base/setup/usetup/devinst.c @@ -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; }