[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 1/2] Add registry setting for removable capability of PDOs
Setting "Removable" to 0 under the key HKLM/System/CurrentControlSet/services/XENBUS/Parameters/<PDO-Name> will disable the PDOs removable and surprise removable capability. Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xenbus/pdo.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/xenbus/pdo.c b/src/xenbus/pdo.c index ad0d4de..9e84ccd 100644 --- a/src/xenbus/pdo.c +++ b/src/xenbus/pdo.c @@ -45,6 +45,7 @@ #include "bus.h" #include "driver.h" #include "thread.h" +#include "registry.h" #include "dbg_print.h" #include "assert.h" @@ -61,6 +62,7 @@ struct _XENBUS_PDO { PIRP DevicePowerIrp; PXENBUS_FDO Fdo; + BOOLEAN Removable; BOOLEAN Missing; const CHAR *Reason; @@ -1119,12 +1121,12 @@ PdoQueryCapabilities( Capabilities->DeviceD2 = 0; Capabilities->LockSupported = 0; Capabilities->EjectSupported = 0; - Capabilities->Removable = 1; + Capabilities->Removable = !!Pdo->Removable; Capabilities->DockDevice = 0; Capabilities->UniqueID = 1; Capabilities->SilentInstall = 1; Capabilities->RawDeviceOK = 0; - Capabilities->SurpriseRemovalOK = 1; + Capabilities->SurpriseRemovalOK = !!Pdo->Removable; Capabilities->HardwareDisabled = 0; Capabilities->NoDisplayInUI = 0; @@ -2041,6 +2043,43 @@ PdoSuspend( UNREFERENCED_PARAMETER(Pdo); } +static FORCEINLINE VOID +__PdoReadRegistryFlags( + IN PXENBUS_PDO Pdo + ) +{ + HANDLE ParametersKey; + HANDLE Key; + ULONG Value; + NTSTATUS status; + + ParametersKey = DriverGetParametersKey(); + if (ParametersKey == NULL) + goto fail1; + + status = RegistryOpenSubKey(ParametersKey, + __PdoGetName(Pdo), + KEY_READ, + &Key); + if (!NT_SUCCESS(status)) + goto fail2; + + status = RegistryQueryDwordValue(Key, + "Removable", + &Value); + if (!NT_SUCCESS(status)) + Value = 1; + + Pdo->Removable = !!Value; + + RegistryCloseKey(Key); + return; + +fail2: +fail1: + Pdo->Removable = TRUE; +} + NTSTATUS PdoCreate( IN PXENBUS_FDO Fdo, @@ -2092,6 +2131,7 @@ PdoCreate( goto fail4; __PdoSetName(Pdo, Name); + __PdoReadRegistryFlags(Pdo); status = PdoSetRevisions(Pdo); if (!NT_SUCCESS(status)) @@ -2132,6 +2172,8 @@ fail6: fail5: Error("fail5\n"); + Pdo->Removable = FALSE; + ThreadAlert(Pdo->DevicePowerThread); ThreadJoin(Pdo->DevicePowerThread); Pdo->DevicePowerThread = NULL; @@ -2195,6 +2237,7 @@ PdoDestroy( __PdoFree(Pdo->Revision); Pdo->Revision = NULL; Pdo->Count = 0; + Pdo->Removable = FALSE; ThreadAlert(Pdo->DevicePowerThread); ThreadJoin(Pdo->DevicePowerThread); -- 1.9.4.msysgit.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |