[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Use new monitor request key
The monitor service now uses a request key in registry under HKLM/SOFTWARE. This patch modifies __DriverRequestReboot() to use the new key, which is now set as a parameter by the INF file. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif.inf | 11 ++++----- src/xenvif/driver.c | 68 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/xenvif.inf b/src/xenvif.inf index f230eea..5e5cbba 100644 --- a/src/xenvif.inf +++ b/src/xenvif.inf @@ -73,22 +73,20 @@ xenvif.sys AddService=xenvif,0x02,XenVif_Service, [XenVif_Service] -DisplayName=%XenVifDesc% +DisplayName=%XenVifName% ServiceType=%SERVICE_KERNEL_DRIVER% StartType=%SERVICE_DEMAND_START% ErrorControl=%SERVICE_ERROR_NORMAL% ServiceBinary=%12%\xenvif.sys LoadOrderGroup="NDIS" -AddReg = XenVif_BootFlags, XenVif_Parameters, XenVif_Interfaces +AddReg = XenVif_BootFlags, XenVif_Parameters [XenVif_BootFlags] HKR,,"BootFlags",0x00010003,0x81 [XenVif_Parameters] HKR,"Parameters",,0x00000010 - -[XenVif_Interfaces] -HKR,"Interfaces",,0x00000010 +HKR,"Parameters","RequestKey",0x00000000,%RequestKey% [XenVif_Inst.CoInstallers] CopyFiles=CoInst_CopyFiles @@ -101,7 +99,8 @@ HKR,,CoInstallers32,0x00010000,"xenvif_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@M Vendor="@VENDOR_NAME@" DiskDesc="@PRODUCT_NAME@ PV Network Class Package" -XenVifDesc="@PRODUCT_NAME@ PV Network Class" +XenVifName="@PRODUCT_NAME@ PV Network Class" +RequestKey="SOFTWARE\@VENDOR_NAME@\@PRODUCT_NAME@\PV Driver Monitor\Request" SERVICE_BOOT_START=0x0 SERVICE_SYSTEM_START=0x1 diff --git a/src/xenvif/driver.c b/src/xenvif/driver.c index 27d4911..66962e0 100644 --- a/src/xenvif/driver.c +++ b/src/xenvif/driver.c @@ -31,6 +31,7 @@ #include <ntddk.h> #include <procgrp.h> +#include <ntstrsafe.h> #include <version.h> #include "registry.h" @@ -116,55 +117,78 @@ DriverGetParametersKey( return __DriverGetParametersKey(); } -#define SERVICES_PATH "\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services" - -#define SERVICE_KEY(_Name) \ - SERVICES_PATH ## "\\" ## #_Name - -#define REQUEST_KEY \ - SERVICE_KEY(XENBUS_MONITOR) ## "\\Request" +#define MAXNAMELEN 128 static FORCEINLINE VOID __DriverRequestReboot( VOID ) { - HANDLE RequestKey; - ANSI_STRING Ansi[2]; - NTSTATUS status; + PANSI_STRING Ansi; + CHAR RequestKeyName[MAXNAMELEN]; + HANDLE RequestKey; + HANDLE SubKey; + NTSTATUS status; Info("====>\n"); ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL); + status = RegistryQuerySzValue(__DriverGetParametersKey(), + "RequestKey", + NULL, + &Ansi); + if (!NT_SUCCESS(status)) + goto fail1; + + status = RtlStringCbPrintfA(RequestKeyName, + MAXNAMELEN, + "\\Registry\\Machine\\%Z", + &Ansi[0]); + ASSERT(NT_SUCCESS(status)); + status = RegistryOpenSubKey(NULL, - REQUEST_KEY, + RequestKeyName, KEY_ALL_ACCESS, &RequestKey); if (!NT_SUCCESS(status)) - goto fail1; - - RtlZeroMemory(Ansi, sizeof (Ansi)); + goto fail2; - RtlInitAnsiString(&Ansi[0], "XENVIF"); + status = RegistryCreateSubKey(RequestKey, + __MODULE__, + REG_OPTION_NON_VOLATILE, + &SubKey); + if (!NT_SUCCESS(status)) + goto fail3; - status = RegistryUpdateSzValue(RequestKey, - "Reboot", - REG_SZ, - Ansi); + status = RegistryUpdateDwordValue(SubKey, + "Reboot", + 1); if (!NT_SUCCESS(status)) - goto fail2; + goto fail4; - RegistryCloseKey(RequestKey); + RegistryCloseKey(SubKey); + + RegistryFreeSzValue(Ansi); Info("<====\n"); return; +fail4: + Error("fail4\n"); + + RegistryCloseKey(SubKey); + +fail3: + Error("fail3\n"); + + RegistryCloseKey(RequestKey); + fail2: Error("fail2\n"); - RegistryCloseKey(RequestKey); + RegistryFreeSzValue(Ansi); fail1: Error("fail1 (%08x)\n", status); -- 2.1.1 _______________________________________________ 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 |