From: Paul Durrant Date: Wed, 22 Jul 2015 16:53:56 +0000 (+0100) Subject: Remove redundant function from the co-installer X-Git-Tag: 8.1.0-rc1~16 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f7327d6f4b4bf94859ddebb9988eedaccfbddfa8;p=pvdrivers%2Fwin%2Fxenbus.git Remove redundant function from the co-installer GetDeviceInstanceID() is not used by anything any more, so it can go. Signed-off-by: Paul Durrant --- diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c index 755eb06..68e3265 100644 --- a/src/coinst/coinst.c +++ b/src/coinst/coinst.c @@ -648,110 +648,6 @@ fail1: return FALSE; } -static BOOLEAN -GetDeviceInstanceID( - IN HDEVINFO DeviceInfoSet, - IN PSP_DEVINFO_DATA DeviceInfoData, - OUT PTCHAR *DeviceID, - OUT PTCHAR *InstanceID - ) -{ - DWORD DeviceInstanceIDLength; - PTCHAR DeviceInstanceID; - DWORD Index; - PTCHAR Prefix; - DWORD InstanceIDLength; - HRESULT Result; - HRESULT Error; - - if (!SetupDiGetDeviceInstanceId(DeviceInfoSet, - DeviceInfoData, - NULL, - 0, - &DeviceInstanceIDLength)) { - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - goto fail1; - } - - DeviceInstanceIDLength += sizeof (TCHAR); - - DeviceInstanceID = calloc(1, DeviceInstanceIDLength); - if (DeviceInstanceID == NULL) - goto fail2; - - if (!SetupDiGetDeviceInstanceId(DeviceInfoSet, - DeviceInfoData, - DeviceInstanceID, - DeviceInstanceIDLength, - NULL)) - goto fail3; - - for (Index = 0; Index < strlen(DeviceInstanceID); Index++) - DeviceInstanceID[Index] = (CHAR)toupper(DeviceInstanceID[Index]); - - *DeviceID = DeviceInstanceID; - - Prefix = strrchr(DeviceInstanceID, '\\'); - assert(Prefix != NULL); - *Prefix++ = '\0'; - - DeviceInstanceID = strrchr(Prefix, '&'); - if (DeviceInstanceID != NULL) { - *DeviceInstanceID++ = '\0'; - } else { - DeviceInstanceID = Prefix; - Prefix = NULL; - } - - if (Prefix != NULL) - Log("Parent Prefix = %s", Prefix); - - InstanceIDLength = (ULONG)((strlen(DeviceInstanceID) + - 1) * sizeof (TCHAR)); - - *InstanceID = calloc(1, InstanceIDLength); - if (*InstanceID == NULL) - goto fail4; - - Result = StringCbPrintf(*InstanceID, - InstanceIDLength, - "%s", - DeviceInstanceID); - assert(SUCCEEDED(Result)); - - Log("DeviceID = %s", *DeviceID); - Log("InstanceID = %s", *InstanceID); - - return TRUE; - -fail4: - Log("fail4"); - - DeviceInstanceID = *DeviceID; - *DeviceID = NULL; - -fail3: - Log("fail3"); - - free(DeviceInstanceID); - -fail2: - Log("fail2"); - -fail1: - Error = GetLastError(); - - { - PTCHAR Message; - - Message = GetErrorMessage(Error); - Log("fail1 (%s)", Message); - LocalFree(Message); - } - - return FALSE; -} - static BOOLEAN MatchExistingDriver( VOID @@ -1423,21 +1319,12 @@ DifInstallPostProcess( IN PCOINSTALLER_CONTEXT_DATA Context ) { - BOOLEAN Success; - PTCHAR DeviceID; - PTCHAR InstanceID; BOOLEAN NeedReboot; - HRESULT Error; UNREFERENCED_PARAMETER(Context); Log("====>"); - Success = GetDeviceInstanceID(DeviceInfoSet, DeviceInfoData, - &DeviceID, &InstanceID); - if (!Success) - goto fail1; - NeedReboot = FALSE; (VOID) CheckStatus("XEN", &NeedReboot); @@ -1447,25 +1334,9 @@ DifInstallPostProcess( if (NeedReboot) (VOID) RequestReboot(DeviceInfoSet, DeviceInfoData); - free(DeviceID); - free(InstanceID); - Log("<===="); return NO_ERROR; - -fail1: - Error = GetLastError(); - - { - PTCHAR Message; - - Message = GetErrorMessage(Error); - Log("fail1 (%s)", Message); - LocalFree(Message); - } - - return Error; } static HRESULT