]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Create SettingsKey SubKeys if needed
authorOwen Smith <owen.smith@citrix.com>
Mon, 24 Oct 2022 10:25:50 +0000 (11:25 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 31 Oct 2022 08:11:59 +0000 (08:11 +0000)
Use RegistryCreateSubKey to create the settings key, if it does not exist,
when attempting to save the current settings. The SettingsKey's sub keys do
not exist when first installing drivers from emulated devices. This is only
an issue when the emulated devices have had network settings applied before
installing the PV drivers.

Also adds NTSTATUS values to error path logging.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
src/xenvif/settings.c

index 7483ff36b277d291d578c534880c4eaccff23cea..876dc13b136e6435ad4d8b1255bf4fdc7eb6f099 100644 (file)
@@ -550,10 +550,10 @@ SettingsSave(
 
     SettingsKey = DriverGetSettingsKey();
 
-    status = RegistryOpenSubKey(SettingsKey,
-                                SubKeyName,
-                                KEY_ALL_ACCESS,
-                                &SubKey);
+    status = RegistryCreateSubKey(SettingsKey,
+                                  SubKeyName,
+                                  REG_OPTION_NON_VOLATILE,
+                                  &SubKey);
     if (!NT_SUCCESS(status))
         goto fail2;
 
@@ -593,7 +593,7 @@ fail2:
     RtlFreeAnsiString(&Ansi);
 
 fail1:
-    Error("fail1\n", status);
+    Error("fail1 (%08x)\n", status);
 
     return status;
 }
@@ -688,7 +688,7 @@ fail2:
     RegistryCloseKey(SubKey);
 
 fail1:
-    Error("fail1\n", status);
+    Error("fail1 (%08x)\n", status);
 
     return status;
 }