[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [BACKPORT:staging-8.2] Added a function called from DriverEntry where...
From: Eric Mackay <mackayem@xxxxxxxxxx> we can safely read registry keys and convert strings at PASSIVE_LEVEL The MSDN documentation for various registry key access and string conversion functions requires the caller to be at PASSIVE_LEVEL. One of the reasons for this is that the string conversion tables used by functions such as RtlAnsiStringToUnicodeString are stored in paged pool memory. Both the page fault handler and the process scheduler run at DISPATCH_LEVEL, therefore you must not touch memory at DISPATCH_LEVEL that could be paged out. A process running at DISPATCH_LEVEL cannot be preempted for the page fault handler to run. To aid Static Driver Verifier code analysis and inform developers, I have added SAL annotations that indicate PASSIVE_LEVEL is required on certain registry access functions. Signed-off-by: Eric Mackay <mackayem@xxxxxxxxxx> Re-based onto master and adjusted for style. Note this involved fixing whitespace issues in frontend.c. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- v2: - Remove unused FeatureName array - Make more use of const qualifier for override name Fixed git cherry-pick conflicts for backport to staging-8.2 Backported-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xenvbd/driver.c | 97 +++++++++++++++++-- src/xenvbd/driver.h | 33 ++++++- src/xenvbd/frontend.c | 257 ++++++++++++++++++++++++++++++++------------------ src/xenvbd/registry.c | 26 +++++ src/xenvbd/registry.h | 25 ++++- 5 files changed, 337 insertions(+), 101 deletions(-) diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c index 4438023..8ce98f6 100644 --- a/src/xenvbd/driver.c +++ b/src/xenvbd/driver.c @@ -43,13 +43,21 @@ #include <xencrsh_interface.h> #include <xenvbd-ntstrsafe.h> +// Feature Overrides From Registry Values +typedef struct _XENVBD_FEATURE_OVERRIDE { + const CHAR *Name; + ULONG Value; + BOOLEAN Present; +} XENVBD_FEATURE_OVERRIDE, *PXENVBD_FEATURE_OVERRIDE; + typedef struct _XENVBD_DRIVER { - HANDLE ParametersKey; - PDRIVER_DISPATCH StorPortDispatchPnp; - PDRIVER_DISPATCH StorPortDispatchPower; - PDRIVER_UNLOAD StorPortDriverUnload; - PXENVBD_FDO Fdo; - KSPIN_LOCK Lock; + HANDLE ParametersKey; + PDRIVER_DISPATCH StorPortDispatchPnp; + PDRIVER_DISPATCH StorPortDispatchPower; + PDRIVER_UNLOAD StorPortDriverUnload; + PXENVBD_FDO Fdo; + KSPIN_LOCK Lock; + XENVBD_FEATURE_OVERRIDE FeatureOverride[NumberOfFeatures]; } XENVBD_DRIVER; static XENVBD_DRIVER Driver; @@ -493,7 +501,80 @@ DriverUnload( Trace("<=== (Irql=%d)\n", KeGetCurrentIrql()); } -DRIVER_INITIALIZE DriverEntry; +__drv_requiresIRQL(PASSIVE_LEVEL) +static FORCEINLINE VOID +__DriverInitializeOverrides( + VOID + ) +{ + ULONG Index; + struct { + const CHAR *Name; + XENVBD_FEATURE Feature; + } Mapping[] = + { + { "removable" , FeatureRemovable }, + { "feature-persistent", FeaturePersistent }, + { "feature-max-indirect-segments", FeatureMaxIndirectSegments }, + { "feature-barrier", FeatureBarrier }, + { "feature-flush-cache", FeatureFlushCache }, + { "feature-discard", FeatureDiscard }, + { "discard-enable", FeatureDiscardEnable }, + { "discard-secure", FeatureDiscardSecure }, + { "discard-alignment", FeatureDiscardAlignment }, + { "discard-granularity", FeatureDiscardGranularity } + }; + + for (Index = 0; Index < ARRAYSIZE(Mapping); Index++) { + XENVBD_FEATURE Feature = Mapping[Index].Feature; + const CHAR *Name = Mapping[Index].Name; + ULONG Value; + NTSTATUS status; + + Driver.FeatureOverride[Feature].Name = Name; + + status = RegistryQueryDwordValue(__DriverGetParametersKey(), + (PCHAR)Name, + &Value); + + if (!NT_SUCCESS(status)) + continue; + + Driver.FeatureOverride[Feature].Present = TRUE; + Driver.FeatureOverride[Feature].Value = Value; + } +} + +__checkReturn +_Success_(return) +BOOLEAN +DriverGetFeatureOverride( + IN XENVBD_FEATURE Feature, + OUT PULONG Value + ) +{ + BOOLEAN Present = FALSE; + + if (Feature < ARRAYSIZE(Driver.FeatureOverride)) { + Present = Driver.FeatureOverride[Feature].Present; + *Value = Driver.FeatureOverride[Feature].Value; + } + + return Present; +} + +__checkReturn +const CHAR * +DriverGetFeatureName( + IN XENVBD_FEATURE Feature + ) +{ + return (Feature < ARRAYSIZE(Driver.FeatureOverride)) ? + Driver.FeatureOverride[Feature].Name : + NULL; +} + +DRIVER_INITIALIZE DriverEntry; NTSTATUS DriverEntry( @@ -547,6 +628,8 @@ DriverEntry( __DriverParseOption("XENVBD:PVCDROM=", &DriverParameters.PVCDRom); + __DriverInitializeOverrides(); + RtlZeroMemory(&InitData, sizeof(InitData)); InitData.HwInitializationDataSize = sizeof(InitData); diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h index e7730a9..8b8095b 100644 --- a/src/xenvbd/driver.h +++ b/src/xenvbd/driver.h @@ -103,4 +103,35 @@ DriverFormatFree( __in __drv_freesMem(mem) PCHAR Buffer ); -#endif // _XENVBD_XENVBD_H +// Registry overrides for driver features +typedef enum _XENVBD_FEATURE { + FeatureRemovable = 0, + FeaturePersistent, + FeatureMaxIndirectSegments, + FeatureBarrier, + FeatureFlushCache, + FeatureDiscard, + FeatureDiscardEnable, + FeatureDiscardSecure, + FeatureDiscardAlignment, + FeatureDiscardGranularity, + + // Add any new features before this enum + NumberOfFeatures +} XENVBD_FEATURE, *PXENVBD_FEATURE; + +__checkReturn +_Success_(return) +extern BOOLEAN +DriverGetFeatureOverride( + IN XENVBD_FEATURE Feature, + OUT PULONG Value + ); + +__checkReturn +extern const CHAR * +DriverGetFeatureName( + IN XENVBD_FEATURE Feature + ); + +#endif // _XENVBD_DRIVER_H diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c index 227b93b..4ec159b 100644 --- a/src/xenvbd/frontend.c +++ b/src/xenvbd/frontend.c @@ -618,15 +618,55 @@ abort: static FORCEINLINE BOOLEAN FrontendReadFeature( - IN PXENVBD_FRONTEND Frontend, - IN PCHAR Name, - IN PBOOLEAN Value + IN PXENVBD_FRONTEND Frontend, + IN XENVBD_FEATURE Feature, + IN PBOOLEAN Value +) +{ + NTSTATUS status; + PCHAR Buffer; + ULONG Override; + BOOLEAN Old = *Value; + const CHAR *Name; + + Name = DriverGetFeatureName(Feature); + if (Name == NULL) { + Trace("Target[%d] : Could not find Feature %u.\n", Frontend->TargetId, Feature); + return FALSE; + } + + if (DriverGetFeatureOverride(Feature, &Override)) { + *Value = !!Override; + } else { + status = XENBUS_STORE(Read, + Frontend->Store, + NULL, + Frontend->BackendPath, + (PCHAR)Name, + &Buffer); + if (!NT_SUCCESS(status)) + return FALSE; // no value, unchanged + + *Value = !!(strtoul(Buffer, NULL, 10)); + + XENBUS_STORE(Free, + Frontend->Store, + Buffer); + } + + return Old != *Value; +} + +static FORCEINLINE BOOLEAN +FrontendReadDiskFeature( + IN PXENVBD_FRONTEND Frontend, + IN PCHAR Name, + IN PBOOLEAN Value ) { - NTSTATUS status; - PCHAR Buffer; - ULONG Override; - BOOLEAN Old = *Value; + NTSTATUS status; + PCHAR Buffer; + BOOLEAN Old = *Value; status = XENBUS_STORE(Read, Frontend->Store, @@ -638,34 +678,67 @@ FrontendReadFeature( return FALSE; // no value, unchanged *Value = !!(strtoul(Buffer, NULL, 10)); + XENBUS_STORE(Free, Frontend->Store, Buffer); + return Old != *Value; +} + +static FORCEINLINE BOOLEAN +FrontendReadValue32( + IN PXENVBD_FRONTEND Frontend, + IN XENVBD_FEATURE Feature, + IN BOOLEAN AllowOverride, + IN PULONG Value +) +{ + NTSTATUS status; + PCHAR Buffer; + ULONG Override; + ULONG Old = *Value; + const CHAR *Name; + + Name = DriverGetFeatureName(Feature); + if (Name == NULL) { + Trace("Target[%d] : Could not find Feature %u.\n", Frontend->TargetId, Feature); + return FALSE; + } + // check registry for disable-override - status = RegistryQueryDwordValue(DriverGetParametersKey(), - Name, - &Override); - if (NT_SUCCESS(status)) { - if (Override == 0) - *Value = FALSE; + if (AllowOverride && DriverGetFeatureOverride(Feature, &Override)) { + *Value = Override; + } else { + status = XENBUS_STORE(Read, + Frontend->Store, + NULL, + Frontend->BackendPath, + (PCHAR)Name, + &Buffer); + if (!NT_SUCCESS(status)) + return FALSE; // no value, unchanged + + *Value = strtoul(Buffer, NULL, 10); + + XENBUS_STORE(Free, + Frontend->Store, + Buffer); } return Old != *Value; } static FORCEINLINE BOOLEAN -FrontendReadValue32( - IN PXENVBD_FRONTEND Frontend, - IN PCHAR Name, - IN BOOLEAN AllowOverride, - IN PULONG Value - ) +FrontendReadDiskValue32( + IN PXENVBD_FRONTEND Frontend, + IN PCHAR Name, + IN PULONG Value +) { - NTSTATUS status; - PCHAR Buffer; - ULONG Override; - ULONG Old = *Value; + NTSTATUS status; + PCHAR Buffer; + ULONG Old = *Value; status = XENBUS_STORE(Read, Frontend->Store, @@ -681,29 +754,19 @@ FrontendReadValue32( Frontend->Store, Buffer); - // check registry for disable-override - if (AllowOverride) { - status = RegistryQueryDwordValue(DriverGetParametersKey(), - Name, - &Override); - if (NT_SUCCESS(status)) { - *Value = Override; - } - } - return Old != *Value; } static FORCEINLINE BOOLEAN FrontendReadValue64( - IN PXENVBD_FRONTEND Frontend, - IN PCHAR Name, - IN OUT PULONG64 Value + IN PXENVBD_FRONTEND Frontend, + IN PCHAR Name, + IN OUT PULONG64 Value ) { - NTSTATUS status; - PCHAR Buffer; - ULONG64 Old = *Value; + NTSTATUS status; + PCHAR Buffer; + ULONG64 Old = *Value; status = XENBUS_STORE(Read, Frontend->Store, @@ -715,6 +778,7 @@ FrontendReadValue64( return FALSE; // no value, unchanged *Value = _strtoui64(Buffer, NULL, 10); + XENBUS_STORE(Free, Frontend->Store, Buffer); @@ -724,48 +788,49 @@ FrontendReadValue64( static FORCEINLINE ULONG __Size( - __in PXENVBD_DISKINFO Info + __in PXENVBD_DISKINFO Info ) { - ULONG64 MBytes = (Info->SectorSize * Info->SectorCount) >> 20; // / (1024 * 1024); + ULONG64 MBytes = (Info->SectorSize * Info->SectorCount) >> 20; // / (1024 * 1024); + if (MBytes < 10240) return (ULONG)MBytes; + return (ULONG)(MBytes >> 10); // / 1024 } static FORCEINLINE PCHAR __Units( - __in PXENVBD_DISKINFO Info + __in PXENVBD_DISKINFO Info ) { - ULONG64 MBytes = (Info->SectorSize * Info->SectorCount) >> 20; // / (1024 * 1024); + ULONG64 MBytes = (Info->SectorSize * Info->SectorCount) >> 20; // / (1024 * 1024); + if (MBytes < 10240) return "MB"; + return "GB"; } __drv_requiresIRQL(DISPATCH_LEVEL) static VOID __ReadDiskInfo( - __in PXENVBD_FRONTEND Frontend + __in PXENVBD_FRONTEND Frontend ) { - BOOLEAN Changed = FALSE; - - Changed |= FrontendReadValue32(Frontend, - "info", - FALSE, - &Frontend->DiskInfo.DiskInfo); - Changed |= FrontendReadValue32(Frontend, - "sector-size", - FALSE, - &Frontend->DiskInfo.SectorSize); - Changed |= FrontendReadValue32(Frontend, - "physical-sector-size", - FALSE, - &Frontend->DiskInfo.PhysSectorSize); + BOOLEAN Changed; + + Changed = FrontendReadDiskValue32(Frontend, + "info", + &Frontend->DiskInfo.DiskInfo); + Changed |= FrontendReadDiskValue32(Frontend, + "sector-size", + &Frontend->DiskInfo.SectorSize); + Changed |= FrontendReadDiskValue32(Frontend, + "physical-sector-size", + &Frontend->DiskInfo.PhysSectorSize); Changed |= FrontendReadValue64(Frontend, - "sectors", - &Frontend->DiskInfo.SectorCount); + "sectors", + &Frontend->DiskInfo.SectorCount); if (!Changed) return; @@ -789,40 +854,41 @@ __ReadDiskInfo( // dump actual values Verbose("Target[%d] : %lld sectors of %d bytes (%d)\n", Frontend->TargetId, - Frontend->DiskInfo.SectorCount, Frontend->DiskInfo.SectorSize, - Frontend->DiskInfo.PhysSectorSize); + Frontend->DiskInfo.SectorCount, Frontend->DiskInfo.SectorSize, + Frontend->DiskInfo.PhysSectorSize); Verbose("Target[%d] : %d %s (%08x) %s\n", Frontend->TargetId, - __Size(&Frontend->DiskInfo), __Units(&Frontend->DiskInfo), - Frontend->DiskInfo.DiskInfo, - Frontend->Caps.SurpriseRemovable ? "SURPRISE_REMOVABLE" : ""); + __Size(&Frontend->DiskInfo), __Units(&Frontend->DiskInfo), + Frontend->DiskInfo.DiskInfo, + Frontend->Caps.SurpriseRemovable ? "SURPRISE_REMOVABLE" : ""); } static FORCEINLINE VOID FrontendReadFeatures( - IN PXENVBD_FRONTEND Frontend + IN PXENVBD_FRONTEND Frontend ) { - BOOLEAN Changed = FALSE; + BOOLEAN Changed; - Changed |= FrontendReadFeature(Frontend, - "removable", - &Frontend->Caps.Removable); + Changed = FrontendReadFeature(Frontend, + FeatureRemovable, + &Frontend->Caps.Removable); Changed |= FrontendReadValue32(Frontend, - "feature-max-indirect-segments", + FeatureMaxIndirectSegments, TRUE, &Frontend->Features.Indirect); Changed |= FrontendReadFeature(Frontend, - "feature-persistent", + FeaturePersistent, &Frontend->Features.Persistent); if (!Changed) return; Verbose("Target[%d] : Features: %s%s%s\n", - Frontend->TargetId, - Frontend->Features.Persistent ? "PERSISTENT " : "", - Frontend->Features.Indirect ? "INDIRECT " : "", - Frontend->Caps.Removable ? "REMOVABLE" : ""); + Frontend->TargetId, + Frontend->Features.Persistent ? "PERSISTENT " : "", + Frontend->Features.Indirect ? "INDIRECT " : "", + Frontend->Caps.Removable ? "REMOVABLE" : ""); + if (Frontend->Features.Indirect) { Verbose("Target[%d] : INDIRECT %x\n", Frontend->TargetId, @@ -832,40 +898,44 @@ FrontendReadFeatures( static FORCEINLINE VOID FrontendReadDiskInfo( - IN PXENVBD_FRONTEND Frontend + IN PXENVBD_FRONTEND Frontend ) { - BOOLEAN Changed = FALSE; - BOOLEAN Discard; - BOOLEAN DiscardFeature = FALSE; - BOOLEAN DiscardEnable = TRUE; - + BOOLEAN Changed; + BOOLEAN Discard; + BOOLEAN DiscardFeature = FALSE; + BOOLEAN DiscardEnable = TRUE; + + Changed = FrontendReadFeature(Frontend, + FeatureBarrier, + &Frontend->DiskInfo.Barrier); Changed |= FrontendReadFeature(Frontend, - "feature-barrier", - &Frontend->DiskInfo.Barrier); - Changed |= FrontendReadFeature(Frontend, - "feature-flush-cache", + FeatureFlushCache, &Frontend->DiskInfo.FlushCache); // discard related FrontendReadFeature(Frontend, - "feature-discard", + FeatureDiscard, &DiscardFeature); FrontendReadFeature(Frontend, - "discard-enable", + FeatureDiscardEnable, &DiscardEnable); + Discard = DiscardFeature && DiscardEnable; + Changed |= (Discard != Frontend->DiskInfo.Discard); + Frontend->DiskInfo.Discard = Discard; + Changed |= FrontendReadFeature(Frontend, - "discard-secure", + FeatureDiscardSecure, &Frontend->DiskInfo.DiscardSecure); Changed |= FrontendReadValue32(Frontend, - "discard-alignment", + FeatureDiscardAlignment, TRUE, &Frontend->DiskInfo.DiscardAlignment); Changed |= FrontendReadValue32(Frontend, - "discard-granularity", + FeatureDiscardGranularity, TRUE, &Frontend->DiskInfo.DiscardGranularity); @@ -877,6 +947,7 @@ FrontendReadDiskInfo( Frontend->DiskInfo.Barrier ? "BARRIER " : "", Frontend->DiskInfo.FlushCache ? "FLUSH " : "", Frontend->DiskInfo.Discard ? "DISCARD " : ""); + if (Frontend->DiskInfo.Discard) { Verbose("Target[%d] : DISCARD %s%x/%x\n", Frontend->TargetId, @@ -1238,6 +1309,8 @@ FrontendDisable( //============================================================================= // Init/Term +_IRQL_requires_(DISPATCH_LEVEL) +_Requires_lock_held_(Frontend->StateLock) static DECLSPEC_NOINLINE NTSTATUS __FrontendSetState( __in PXENVBD_FRONTEND Frontend, @@ -1413,6 +1486,7 @@ FrontendSuspendLateCallback( PdoPreResume(Frontend->Pdo); // dont acquire state lock - called at DISPATCH on 1 vCPU with interrupts enabled +#pragma warning(suppress: 26110) // warning C26110: Caller failing to hold lock <lock> before calling function <func>. Status = __FrontendSetState(Frontend, XENVBD_CLOSED); if (!NT_SUCCESS(Status)) { Error("Target[%d] : SetState CLOSED (%08x)\n", Frontend->TargetId, Status); @@ -1420,6 +1494,7 @@ FrontendSuspendLateCallback( } // dont acquire state lock - called at DISPATCH on 1 vCPU with interrupts enabled +#pragma warning(suppress: 26110) // warning C26110: Caller failing to hold lock <lock> before calling function <func>. Status = __FrontendSetState(Frontend, State); if (!NT_SUCCESS(Status)) { Error("Target[%d] : SetState %s (%08x)\n", Frontend->TargetId, __XenvbdStateName(State), Status); diff --git a/src/xenvbd/registry.c b/src/xenvbd/registry.c index 9ceffa5..885ab6d 100644 --- a/src/xenvbd/registry.c +++ b/src/xenvbd/registry.c @@ -89,6 +89,7 @@ RegistryTeardown( RegistryPath.MaximumLength = RegistryPath.Length = 0; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenKey( IN HANDLE Parent, @@ -118,6 +119,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) static NTSTATUS RegistryOpenRoot( IN PWCHAR Path, @@ -151,6 +153,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryCreateKey( IN HANDLE Root, @@ -250,6 +253,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenServiceKey( IN ACCESS_MASK DesiredAccess, @@ -259,6 +263,7 @@ RegistryOpenServiceKey( return RegistryOpenKey(NULL, &RegistryPath, DesiredAccess, Key); } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryCreateServiceKey( OUT PHANDLE Key @@ -267,6 +272,7 @@ RegistryCreateServiceKey( return RegistryCreateKey(NULL, &RegistryPath, REG_OPTION_NON_VOLATILE, Key); } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenSoftwareKey( IN PDEVICE_OBJECT DeviceObject, @@ -289,6 +295,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenHardwareKey( IN PDEVICE_OBJECT DeviceObject, @@ -366,6 +373,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenSubKey( IN PHANDLE Key, @@ -399,6 +407,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryCreateSubKey( IN PHANDLE Key, @@ -432,6 +441,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryDeleteSubKey( IN PHANDLE Key, @@ -475,6 +485,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryEnumerateSubKeys( IN HANDLE Key, @@ -579,6 +590,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryEnumerateValues( IN HANDLE Key, @@ -677,6 +689,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryDeleteValue( IN PHANDLE Key, @@ -710,6 +723,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQueryDwordValue( IN HANDLE Key, @@ -780,6 +794,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryUpdateDwordValue( IN HANDLE Key, @@ -838,6 +853,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PANSI_STRING RegistrySzToAnsi( IN PWCHAR Buffer @@ -877,6 +893,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PANSI_STRING RegistryMultiSzToAnsi( IN PWCHAR Buffer @@ -939,6 +956,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQuerySzValue( IN HANDLE Key, @@ -1026,6 +1044,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQueryBinaryValue( IN HANDLE Key, @@ -1111,6 +1130,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryUpdateBinaryValue( IN HANDLE Key, @@ -1170,6 +1190,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQueryKeyName( IN HANDLE Key, @@ -1225,6 +1246,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQuerySystemStartOption( IN const CHAR *Prefix, @@ -1303,6 +1325,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PKEY_VALUE_PARTIAL_INFORMATION RegistryAnsiToSz( PANSI_STRING Ansi @@ -1342,6 +1365,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PKEY_VALUE_PARTIAL_INFORMATION RegistryAnsiToMultiSz( PANSI_STRING Ansi @@ -1395,6 +1419,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryUpdateSzValue( IN HANDLE Key, @@ -1485,6 +1510,7 @@ RegistryFreeBinaryValue( __RegistryFree(Buffer); } +__drv_requiresIRQL(PASSIVE_LEVEL) VOID RegistryCloseKey( IN HANDLE Key diff --git a/src/xenvbd/registry.h b/src/xenvbd/registry.h index d39f016..9bf492e 100644 --- a/src/xenvbd/registry.h +++ b/src/xenvbd/registry.h @@ -44,6 +44,7 @@ RegistryTeardown( VOID ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryOpenKey( IN HANDLE Parent, @@ -52,6 +53,7 @@ RegistryOpenKey( OUT PHANDLE Key ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryCreateKey( IN HANDLE Parent, @@ -60,17 +62,20 @@ RegistryCreateKey( OUT PHANDLE Key ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryOpenServiceKey( IN ACCESS_MASK DesiredAccess, OUT PHANDLE Key ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryCreateServiceKey( OUT PHANDLE Key ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryOpenSoftwareKey( IN PDEVICE_OBJECT DeviceObject, @@ -78,6 +83,7 @@ RegistryOpenSoftwareKey( OUT PHANDLE Key ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryOpenHardwareKey( IN PDEVICE_OBJECT DeviceObject, @@ -85,6 +91,7 @@ RegistryOpenHardwareKey( OUT PHANDLE Key ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryOpenSubKey( IN HANDLE Key, @@ -93,6 +100,7 @@ RegistryOpenSubKey( OUT PHANDLE SubKey ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryCreateSubKey( IN HANDLE Key, @@ -101,12 +109,14 @@ RegistryCreateSubKey( OUT PHANDLE SubKey ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryDeleteSubKey( IN HANDLE Key, IN PCHAR Name ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryEnumerateSubKeys( IN HANDLE Key, @@ -114,6 +124,7 @@ RegistryEnumerateSubKeys( IN PVOID Context ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryEnumerateValues( IN HANDLE Key, @@ -121,26 +132,30 @@ RegistryEnumerateValues( IN PVOID Context ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryDeleteValue( IN HANDLE Key, IN PCHAR Name ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryQueryDwordValue( IN HANDLE Key, IN PCHAR Name, OUT PULONG Value ); - + +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryUpdateDwordValue( IN HANDLE Key, IN PCHAR Name, IN ULONG Value ); - + +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryQuerySzValue( IN HANDLE Key, @@ -149,6 +164,7 @@ RegistryQuerySzValue( OUT PANSI_STRING *Array ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryQueryBinaryValue( IN HANDLE Key, @@ -157,6 +173,7 @@ RegistryQueryBinaryValue( OUT PULONG Length ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryUpdateBinaryValue( IN HANDLE Key, @@ -165,12 +182,14 @@ RegistryUpdateBinaryValue( IN ULONG Length ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryQueryKeyName( IN HANDLE Key, OUT PANSI_STRING *Array ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryQuerySystemStartOption( IN const CHAR *Prefix, @@ -187,6 +206,7 @@ RegistryFreeBinaryValue( IN PVOID Buffer ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern NTSTATUS RegistryUpdateSzValue( IN HANDLE Key, @@ -195,6 +215,7 @@ RegistryUpdateSzValue( IN PANSI_STRING Array ); +__drv_requiresIRQL(PASSIVE_LEVEL) extern VOID RegistryCloseKey( IN HANDLE Key -- 2.8.3 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |