]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Remove redundant function from the co-installer
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 22 Jul 2015 16:53:56 +0000 (17:53 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 22 Jul 2015 16:53:56 +0000 (17:53 +0100)
GetDeviceInstanceID() is not used by anything any more, so it can go.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/coinst/coinst.c

index 755eb063e75e53c2cd51b8100ffe4fab22cce701..68e32654332b97bbd0eb5f738eea111c629a2284 100644 (file)
@@ -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