]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
monitor: Create RequestKey in code rather then in the INF
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 17 Aug 2016 11:38:37 +0000 (12:38 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 17 Aug 2016 11:54:18 +0000 (12:54 +0100)
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@citrix.com>
src/monitor/monitor.c
src/xenbus.inf
src/xenbus/driver.c

index 0bfdaafdab6e382a9e51ae54ed485f3c7fb42ddd..69d446ce38c4d20bfa3aaa98b5f31abda1f9cfd0 100644 (file)
@@ -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;
 
index 35343b21682dfbf79ad5e1ec2e9df2d2e02b1f2b..3340573a8706f483d2fcf950461daef9b6357232 100644 (file)
@@ -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
 
index 4360edcf4047212ca249b56d1bb8dd8ba25c4981..e9cb6f4d7cd16bff205f340fdc6b5eea7a98143b 100644 (file)
@@ -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;