Author: hbelusca
Date: Mon Aug 14 16:33:55 2017
New Revision: 75540
URL:
http://svn.reactos.org/svn/reactos?rev=75540&view=rev
Log:
[USETUP]: Sync with hpoussin's r75532, and add the corresponding INF_FreeData().
Modified:
branches/setup_improvements/base/setup/usetup/devinst.c
Modified: branches/setup_improvements/base/setup/usetup/devinst.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/devinst.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/devinst.c [iso-8859-1] Mon Aug 14
16:33:55 2017
@@ -50,39 +50,43 @@
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE hService;
INFCONTEXT Context;
- PWSTR Driver, ImagePath, FullImagePath;
+ PWSTR Driver, ClassGuid, ImagePath, FullImagePath;
ULONG dwValue;
ULONG Disposition;
NTSTATUS Status;
BOOLEAN deviceInstalled = FALSE;
UNICODE_STRING UpperFiltersU = RTL_CONSTANT_STRING(L"UpperFilters");
PWSTR keyboardClass = L"kbdclass\0";
- BOOLEAN keyboardDevice = FALSE;
/* Check if we know the hardware */
if (!SetupFindFirstLineW(hInf, L"HardwareIdsDatabase", HardwareId,
&Context))
return FALSE;
if (!INF_GetDataField(&Context, 1, &Driver))
return FALSE;
+
+ /* Get associated class GUID (if any) */
+ if (!INF_GetDataField(&Context, 2, &ClassGuid))
+ ClassGuid = NULL;
/* Find associated driver name */
/* FIXME: check in other sections too! */
if (!SetupFindFirstLineW(hInf, L"BootBusExtenders.Load", Driver,
&Context)
&& !SetupFindFirstLineW(hInf, L"BusExtenders.Load", Driver,
&Context)
&& !SetupFindFirstLineW(hInf, L"SCSI.Load", Driver, &Context)
- && !SetupFindFirstLineW(hInf, L"InputDevicesSupport.Load", Driver,
&Context))
- {
- if (!SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver,
&Context))
- {
- INF_FreeData(Driver);
- return FALSE;
- }
-
- keyboardDevice = TRUE;
+ && !SetupFindFirstLineW(hInf, L"InputDevicesSupport.Load", Driver,
&Context)
+ && !SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver,
&Context))
+ {
+ INF_FreeData(ClassGuid);
+ INF_FreeData(Driver);
+ return FALSE;
}
if (!INF_GetDataField(&Context, 1, &ImagePath))
- return FALSE;
+ {
+ INF_FreeData(ClassGuid);
+ INF_FreeData(Driver);
+ return FALSE;
+ }
/* Prepare full driver path */
dwValue = PathPrefix.MaximumLength + wcslen(ImagePath) * sizeof(WCHAR);
@@ -91,6 +95,7 @@
{
DPRINT1("RtlAllocateHeap() failed\n");
INF_FreeData(ImagePath);
+ INF_FreeData(ClassGuid);
INF_FreeData(Driver);
return FALSE;
}
@@ -108,6 +113,7 @@
DPRINT1("NtCreateKey('%wZ') failed with status 0x%08x\n",
&StringU, Status);
RtlFreeHeap(ProcessHeap, 0, FullImagePath);
INF_FreeData(ImagePath);
+ INF_FreeData(ClassGuid);
INF_FreeData(Driver);
return FALSE;
}
@@ -149,7 +155,7 @@
INF_FreeData(ImagePath);
- if (keyboardDevice)
+ if (ClassGuid &&_wcsicmp(ClassGuid,
L"{4D36E96B-E325-11CE-BFC1-08002BE10318}") == 0)
{
DPRINT1("Installing keyboard class driver for '%S'\n",
DeviceId);
NtSetValueKey(hDeviceKey,
@@ -159,6 +165,8 @@
keyboardClass,
(wcslen(keyboardClass) + 2) * sizeof(WCHAR));
}
+
+ INF_FreeData(ClassGuid);
/* Associate device with the service we just filled */
Status = NtSetValueKey(hDeviceKey,