From: Paul Durrant Date: Wed, 17 Aug 2016 11:38:37 +0000 (+0100) Subject: monitor: Create RequestKey in code rather then in the INF X-Git-Tag: 8.2.0-rc1~14 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a499b7b2dce8f465c0ef8793cb047d76e51d21a1;p=pvdrivers%2Fwin%2Fxenbus.git 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 --- 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;