Implement the StorageCoInstaller and configure it for CD-ROM and Disk devices

This sets the friendly name for CD-ROM and Disk devices.
This commit is contained in:
Eric Kohl 2020-12-07 23:16:39 +01:00
parent 3d980c4a2c
commit d9e20ae3fe
4 changed files with 75 additions and 9 deletions

View file

@ -402,8 +402,8 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{9D6D66A6-0B0C-4563-9077-A0E9A7955A
; Class Co-Installers
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers",,0x00000012
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E965-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,CriticalDeviceCoInstaller"
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E967-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,CriticalDeviceCoInstaller"
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E965-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,StorageCoInstaller","syssetup.dll,CriticalDeviceCoInstaller"
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E967-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,StorageCoInstaller","syssetup.dll,CriticalDeviceCoInstaller"
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E96A-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,CriticalDeviceCoInstaller"
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E96B-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,CriticalDeviceCoInstaller"
HKLM,"SYSTEM\CurrentControlSet\Control\CoDeviceInstallers","{4D36E96F-E325-11CE-BFC1-08002BE10318}",0x00010000,"syssetup.dll,CriticalDeviceCoInstaller"

View file

@ -377,7 +377,7 @@ ScsiClassInstaller(
/*
* @unimplemented
* @implemented
*/
DWORD
WINAPI
@ -387,12 +387,77 @@ StorageCoInstaller(
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL,
IN OUT PCOINSTALLER_CONTEXT_DATA Context)
{
switch (InstallFunction)
ULONG ulStatus, ulProblem;
DWORD dwBufferSize = 0;
PWSTR pszDeviceDescription;
CONFIGRET ret;
DPRINT("StorageCoInstaller(%u %p %p %p)\n",
InstallFunction, DeviceInfoSet, DeviceInfoData, Context);
if (InstallFunction != DIF_INSTALLDEVICE)
return ERROR_SUCCESS;
if (Context->PostProcessing)
{
default:
DPRINT1("Install function %u ignored\n", InstallFunction);
return ERROR_SUCCESS;
if (Context->PrivateData != NULL)
{
pszDeviceDescription = (PWSTR)Context->PrivateData;
/* Store the device description as the friendly name */
SetupDiSetDeviceRegistryPropertyW(DeviceInfoSet,
DeviceInfoData,
SPDRP_FRIENDLYNAME,
(PBYTE)pszDeviceDescription,
(wcslen(pszDeviceDescription) + 1) * sizeof(WCHAR));
/* Free the device description */
HeapFree(GetProcessHeap(), 0, Context->PrivateData);
Context->PrivateData = NULL;
}
}
else
{
if (DeviceInfoData == NULL)
return ERROR_SUCCESS;
ret = CM_Get_DevNode_Status(&ulStatus, &ulProblem, DeviceInfoData->DevInst, 0);
if (ret != CR_SUCCESS)
return ERROR_SUCCESS;
if (ulStatus & DN_ROOT_ENUMERATED)
return ERROR_SUCCESS;
/* Get the device description size */
SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet,
DeviceInfoData,
SPDRP_DEVICEDESC,
NULL,
NULL,
0,
&dwBufferSize);
if (dwBufferSize == 0)
return ERROR_SUCCESS;
/* Allocate the device description buffer */
pszDeviceDescription = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBufferSize);
if (pszDeviceDescription == NULL)
return ERROR_SUCCESS;
/* Get the device description */
SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet,
DeviceInfoData,
SPDRP_DEVICEDESC,
NULL,
(PBYTE)pszDeviceDescription,
dwBufferSize,
&dwBufferSize);
Context->PrivateData = (PVOID)pszDeviceDescription;
return ERROR_DI_POSTPROCESSING_REQUIRED;
}
return ERROR_SUCCESS;
}

View file

@ -26,8 +26,8 @@
#define NDEBUG
#include <debug.h>
DWORD WINAPI
CMP_WaitNoPendingInstallEvents(DWORD dwTimeout);
//DWORD WINAPI
//CMP_WaitNoPendingInstallEvents(DWORD dwTimeout);
DWORD WINAPI
SetupStartService(LPCWSTR lpServiceName, BOOL bWait);

View file

@ -17,6 +17,7 @@
#include <setupapi.h>
#include <syssetup/syssetup.h>
#include <pseh/pseh2.h>
#include <cfgmgr32.h>
#include "globals.h"
#include "resource.h"