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

[win-pv-devel] [PATCH] monitor: Create RequestKey in code rather then in the INF



Also do the name in the XENBUS DriverRequestReboot() function so that it
is not at the mercy of service start ordering.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/monitor/monitor.c | 14 +++++++++-----
 src/xenbus.inf        |  5 +----
 src/xenbus/driver.c   |  8 ++++----
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 0bfdaaf..69d446c 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -1022,11 +1022,15 @@ MonitorMain(
     if (!Success)
         goto fail7;
 
-    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                         RequestKeyName,
-                         0,
-                         KEY_ALL_ACCESS,
-                         &Context->RequestKey);
+    Error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
+                           RequestKeyName,
+                           0,
+                           NULL,
+                           REG_OPTION_NON_VOLATILE,
+                           KEY_ALL_ACCESS,
+                           NULL,
+                           &Context->RequestKey,
+                           NULL);
     if (Error != ERROR_SUCCESS)
         goto fail8;
 
diff --git a/src/xenbus.inf b/src/xenbus.inf
index 35343b2..3340573 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -127,7 +127,7 @@ ServiceType=%SERVICE_WIN32_OWN_PROCESS%
 StartType=%SERVICE_AUTO_START%
 ErrorControl=%SERVICE_ERROR_NORMAL%
 
ServiceBinary=%11%\xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.exe
-AddReg = Monitor_Parameters, Monitor_Request
+AddReg = Monitor_Parameters
 
 [Monitor_Parameters]
 HKR,"Parameters",,0x00000010
@@ -135,9 +135,6 @@ HKR,"Parameters","RequestKey",0x00000000,%RequestKey%
 HKR,"Parameters","DialogTitle",0x00000000,%DialogTitle%
 HKR,"Parameters","DialogMessage",0x00000000,%DialogMessage%
 
-[Monitor_Request]
-HKLM,%RequestKey% ,,0x00000010
-
 [Monitor_EventLog]
 AddReg=Monitor_EventLog_AddReg
 
diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c
index 4360edc..e9cb6f4 100644
--- a/src/xenbus/driver.c
+++ b/src/xenbus/driver.c
@@ -152,10 +152,10 @@ __DriverRequestReboot(
                                 &Ansi[0]);
     ASSERT(NT_SUCCESS(status));
 
-    status = RegistryOpenSubKey(NULL,
-                                RequestKeyName,
-                                KEY_ALL_ACCESS,
-                                &RequestKey);
+    status = RegistryCreateSubKey(NULL,
+                                  RequestKeyName,
+                                  REG_OPTION_NON_VOLATILE,
+                                  &RequestKey);
     if (!NT_SUCCESS(status))
         goto fail2;
 
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

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