[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 3/5] Remove FdoSetFriendlyName



RegistryOpenHardwareKey uses an absolute path to open the parent key
of IoOpenDeviceRegistryKey. Since this is a violation of the registry
isolation rules in Driver Verifier, its not possible to open the correct
registry key to set the device instance's friendly name.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
---
 src/xenbus/fdo.c | 87 ------------------------------------------------
 1 file changed, 87 deletions(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index a5ebd19..429933c 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -819,91 +819,6 @@ __FdoIsActive(
     return Fdo->Active;
 }
 
-static NTSTATUS
-FdoSetFriendlyName(
-    IN  PXENBUS_FDO Fdo,
-    IN  USHORT      DeviceID
-    )
-{
-    HANDLE          SoftwareKey;
-    HANDLE          HardwareKey;
-    PANSI_STRING    DriverDesc;
-    CHAR            Buffer[MAXNAMELEN];
-    ANSI_STRING     FriendlyName[2];
-    NTSTATUS        status;
-
-    status = RegistryOpenSoftwareKey(__FdoGetPhysicalDeviceObject(Fdo),
-                                     KEY_READ,
-                                     &SoftwareKey);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
-    status = RegistryOpenHardwareKey(__FdoGetPhysicalDeviceObject(Fdo),
-                                     KEY_ALL_ACCESS,
-                                     &HardwareKey);
-    if (!NT_SUCCESS(status))
-        goto fail2;
-
-    status = RegistryQuerySzValue(SoftwareKey,
-                                  "DriverDesc",
-                                  NULL,
-                                  &DriverDesc);
-    if (!NT_SUCCESS(status))
-        goto fail3;
-
-    status = RtlStringCbPrintfA(Buffer,
-                                MAXNAMELEN,
-                                "%Z (%04X)",
-                                &DriverDesc[0],
-                                DeviceID
-                                );
-    if (!NT_SUCCESS(status))
-        goto fail4;
-
-    RtlZeroMemory(FriendlyName, sizeof (ANSI_STRING) * 2);
-    RtlInitAnsiString(&FriendlyName[0], Buffer);
-
-    status = RegistryUpdateSzValue(HardwareKey,
-                                   "FriendlyName",
-                                   REG_SZ,
-                                   FriendlyName);
-    if (!NT_SUCCESS(status))
-        goto fail5;
-
-    Info("%Z\n", &FriendlyName[0]);
-
-    RegistryFreeSzValue(DriverDesc);
-
-    RegistryCloseKey(HardwareKey);
-
-    RegistryCloseKey(SoftwareKey);
-
-    return STATUS_SUCCESS;
-
-fail5:
-    Error("fail5\n");
-
-fail4:
-    Error("fail4\n");
-
-    RegistryFreeSzValue(DriverDesc);
-
-fail3:
-    Error("fail3\n");
-
-    RegistryCloseKey(HardwareKey);
-
-fail2:
-    Error("fail2\n");
-
-    RegistryCloseKey(SoftwareKey);
-
-fail1:
-    Error("fail1 (%08x)\n", status);
-
-    return status;
-}
-
 #define DEFINE_FDO_GET_CONTEXT(_Interface, _Type)               \
 static FORCEINLINE _Type                                        \
 __FdoGet ## _Interface ## Context(                              \
@@ -5958,8 +5873,6 @@ done:
     InitializeListHead(&Fdo->List);
     Fdo->References = 1;
 
-    (VOID) FdoSetFriendlyName(Fdo, Header.DeviceID);
-
     FdoSetWatchdog(Fdo);
 
     Info("%p (%s) %s\n",
-- 
2.44.0.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.