[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 2/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> --- src/xenvbd/driver.c | 96 ++++++++++++++++-- src/xenvbd/driver.h | 31 ++++++ src/xenvbd/frontend.c | 269 ++++++++++++++++++++++++++++++++------------------ src/xenvbd/registry.c | 26 +++++ src/xenvbd/registry.h | 25 ++++- 5 files changed, 342 insertions(+), 105 deletions(-) diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c index 62c3cbb..f8d5e82 100644 --- a/src/xenvbd/driver.c +++ b/src/xenvbd/driver.c @@ -47,12 +47,21 @@ #include "debug.h" #include "assert.h" +// Feature Overrides From Registry Values +typedef struct _XENVBD_FEATURE_OVERRIDE { + PCHAR Name; + ULONG Value; + BOOLEAN Present; +} XENVBD_FEATURE_OVERRIDE, *PXENVBD_FEATURE_OVERRIDE; + typedef struct _XENVBD_DRIVER { - PXENVBD_ADAPTER Adapter; - HANDLE ParametersKey; - PDRIVER_DISPATCH StorPortDispatchPnp; - PDRIVER_DISPATCH StorPortDispatchPower; - PDRIVER_UNLOAD StorPortDriverUnload; + PXENVBD_ADAPTER Adapter; + HANDLE ParametersKey; + PDRIVER_DISPATCH StorPortDispatchPnp; + PDRIVER_DISPATCH StorPortDispatchPower; + PDRIVER_UNLOAD StorPortDriverUnload; + const CHAR *FeatureName[NumberOfFeatures]; + XENVBD_FEATURE_OVERRIDE FeatureOverride[NumberOfFeatures]; } XENVBD_DRIVER; static XENVBD_DRIVER Driver; @@ -240,7 +249,80 @@ DriverUnload( RegistryTeardown(); } -DRIVER_INITIALIZE DriverEntry; +__drv_requiresIRQL(PASSIVE_LEVEL) +static FORCEINLINE VOID +__DriverInitializeOverrides( + VOID + ) +{ + ULONG Index; + struct { + PCHAR 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; + PCHAR Name = Mapping[Index].Name; + ULONG Value; + NTSTATUS status; + + Driver.FeatureOverride[Feature].Name = Name; + + status = RegistryQueryDwordValue(__DriverGetParametersKey(), + 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 +PCHAR +DriverGetFeatureName( + IN XENVBD_FEATURE Feature + ) +{ + return (Feature < ARRAYSIZE(Driver.FeatureOverride)) ? + Driver.FeatureOverride[Feature].Name : + NULL; +} + +DRIVER_INITIALIZE DriverEntry; NTSTATUS DriverEntry( @@ -287,6 +369,8 @@ DriverEntry( Driver.Adapter = NULL; BufferInitialize(); + __DriverInitializeOverrides(); + status = AdapterDriverEntry(RegistryPath, DriverObject); if (!NT_SUCCESS(status)) diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h index 386cd84..042c8b6 100644 --- a/src/xenvbd/driver.h +++ b/src/xenvbd/driver.h @@ -67,4 +67,35 @@ DriverRequestReboot( VOID ); +// 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 PCHAR +DriverGetFeatureName( + IN XENVBD_FEATURE Feature + ); + #endif // _XENVBD_DRIVER_H diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c index 13ab9b4..1477417 100644 --- a/src/xenvbd/frontend.c +++ b/src/xenvbd/frontend.c @@ -620,15 +620,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; + PCHAR 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->StoreInterface, + NULL, + Frontend->BackendPath, + Name, + &Buffer); + if (!NT_SUCCESS(status)) + return FALSE; // no value, unchanged + + *Value = !!(strtoul(Buffer, NULL, 10)); + + XENBUS_STORE(Free, + &Frontend->StoreInterface, + 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->StoreInterface, @@ -640,34 +680,67 @@ FrontendReadFeature( return FALSE; // no value, unchanged *Value = !!(strtoul(Buffer, NULL, 10)); + XENBUS_STORE(Free, - &Frontend->StoreInterface, - Buffer); + &Frontend->StoreInterface, + 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; + PSTR 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->StoreInterface, + NULL, + Frontend->BackendPath, + Name, + &Buffer); + if (!NT_SUCCESS(status)) + return FALSE; // no value, unchanged + + *Value = strtoul(Buffer, NULL, 10); + + XENBUS_STORE(Free, + &Frontend->StoreInterface, + 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->StoreInterface, @@ -679,33 +752,24 @@ FrontendReadValue32( return FALSE; // no value, unchanged *Value = strtoul(Buffer, NULL, 10); - XENBUS_STORE(Free, - &Frontend->StoreInterface, - Buffer); - // check registry for disable-override - if (AllowOverride) { - status = RegistryQueryDwordValue(DriverGetParametersKey(), - Name, - &Override); - if (NT_SUCCESS(status)) { - *Value = Override; - } - } + XENBUS_STORE(Free, + &Frontend->StoreInterface, + Buffer); 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->StoreInterface, @@ -717,57 +781,59 @@ FrontendReadValue64( return FALSE; // no value, unchanged *Value = _strtoui64(Buffer, NULL, 10); + XENBUS_STORE(Free, - &Frontend->StoreInterface, - Buffer); + &Frontend->StoreInterface, + Buffer); return Old != *Value; } 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; @@ -791,40 +857,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, @@ -834,40 +901,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); @@ -879,6 +950,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, @@ -1240,6 +1312,8 @@ FrontendDisable( //============================================================================= // Init/Term +_IRQL_requires_(DISPATCH_LEVEL) +_Requires_lock_held_(Frontend->StateLock) static DECLSPEC_NOINLINE NTSTATUS __FrontendSetState( __in PXENVBD_FRONTEND Frontend, @@ -1413,6 +1487,7 @@ FrontendSuspendLateCallback( State = Frontend->State; // 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); diff --git a/src/xenvbd/registry.c b/src/xenvbd/registry.c index 40c77f1..bb105b9 100644 --- a/src/xenvbd/registry.c +++ b/src/xenvbd/registry.c @@ -86,6 +86,7 @@ RegistryTeardown( RegistryPath.MaximumLength = RegistryPath.Length = 0; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenKey( IN HANDLE Parent, @@ -115,6 +116,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) static NTSTATUS RegistryOpenRoot( IN PWCHAR Path, @@ -148,6 +150,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryCreateKey( IN HANDLE Root, @@ -247,6 +250,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenServiceKey( IN ACCESS_MASK DesiredAccess, @@ -256,6 +260,7 @@ RegistryOpenServiceKey( return RegistryOpenKey(NULL, &RegistryPath, DesiredAccess, Key); } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryCreateServiceKey( OUT PHANDLE Key @@ -264,6 +269,7 @@ RegistryCreateServiceKey( return RegistryCreateKey(NULL, &RegistryPath, REG_OPTION_NON_VOLATILE, Key); } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenSoftwareKey( IN PDEVICE_OBJECT DeviceObject, @@ -286,6 +292,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenHardwareKey( IN PDEVICE_OBJECT DeviceObject, @@ -363,6 +370,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryOpenSubKey( IN PHANDLE Key, @@ -396,6 +404,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryCreateSubKey( IN PHANDLE Key, @@ -429,6 +438,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryDeleteSubKey( IN PHANDLE Key, @@ -472,6 +482,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryEnumerateSubKeys( IN HANDLE Key, @@ -576,6 +587,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryEnumerateValues( IN HANDLE Key, @@ -674,6 +686,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryDeleteValue( IN PHANDLE Key, @@ -707,6 +720,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQueryDwordValue( IN HANDLE Key, @@ -777,6 +791,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryUpdateDwordValue( IN HANDLE Key, @@ -835,6 +850,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PANSI_STRING RegistrySzToAnsi( IN PWCHAR Buffer @@ -874,6 +890,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PANSI_STRING RegistryMultiSzToAnsi( IN PWCHAR Buffer @@ -936,6 +953,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQuerySzValue( IN HANDLE Key, @@ -1023,6 +1041,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQueryBinaryValue( IN HANDLE Key, @@ -1108,6 +1127,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryUpdateBinaryValue( IN HANDLE Key, @@ -1167,6 +1187,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQueryKeyName( IN HANDLE Key, @@ -1222,6 +1243,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryQuerySystemStartOption( IN const CHAR *Prefix, @@ -1300,6 +1322,7 @@ fail1: return status; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PKEY_VALUE_PARTIAL_INFORMATION RegistryAnsiToSz( PANSI_STRING Ansi @@ -1339,6 +1362,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) static PKEY_VALUE_PARTIAL_INFORMATION RegistryAnsiToMultiSz( PANSI_STRING Ansi @@ -1392,6 +1416,7 @@ fail1: return NULL; } +__drv_requiresIRQL(PASSIVE_LEVEL) NTSTATUS RegistryUpdateSzValue( IN HANDLE Key, @@ -1482,6 +1507,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.5.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 |