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

[win-pv-devel] [PATCH v2 3/3] Registry string value types cannot be inferred



For instance, the UpperFilters key needs to be a REG_MULTI_SZ
even if it contains only one string. Thus the type needs to be
passed explicitly to RegistryUpdateSzValue.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/common/registry.c  |  4 +---
 src/common/registry.h  |  1 +
 src/xenbus/fdo.c       |  1 +
 src/xenbus/filters.c   | 10 ++++++++--
 src/xenfilt/pvdevice.c |  2 ++
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/common/registry.c b/src/common/registry.c
index 2785020..2389c33 100644
--- a/src/common/registry.c
+++ b/src/common/registry.c
@@ -1300,12 +1300,12 @@ NTSTATUS
 RegistryUpdateSzValue(
     IN  HANDLE                      Key,
     IN  PCHAR                       Name,
+    IN  ULONG                       Type,
     IN  PANSI_STRING                Array
     )
 {
     ANSI_STRING                     Ansi;
     UNICODE_STRING                  Unicode;
-    ULONG                           Type;
     PKEY_VALUE_PARTIAL_INFORMATION  Partial;
     NTSTATUS                        status;
 
@@ -1315,8 +1315,6 @@ RegistryUpdateSzValue(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    Type = (Array[1].Buffer != NULL) ? REG_MULTI_SZ : REG_SZ;
-
     switch (Type) {
     case REG_SZ:
         status = STATUS_NO_MEMORY;
diff --git a/src/common/registry.h b/src/common/registry.h
index 06e9bd6..ef0cf91 100644
--- a/src/common/registry.h
+++ b/src/common/registry.h
@@ -190,6 +190,7 @@ extern NTSTATUS
 RegistryUpdateSzValue(
     IN  HANDLE          Key,
     IN  PCHAR           Name,
+    IN  ULONG           Type,
     IN  PANSI_STRING    Array
     );
 
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 9eb20e7..92634cc 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -750,6 +750,7 @@ FdoSetFriendlyName(
 
     status = RegistryUpdateSzValue(HardwareKey,
                                    "FriendlyName",
+                                   REG_SZ,
                                    FriendlyName);
     if (!NT_SUCCESS(status))
         goto fail5;
diff --git a/src/xenbus/filters.c b/src/xenbus/filters.c
index fe0ceba..651fcc2 100644
--- a/src/xenbus/filters.c
+++ b/src/xenbus/filters.c
@@ -126,7 +126,10 @@ FiltersInstallClass(
 
     RtlInitAnsiString(&New[Index], DriverName);
 
-    status = RegistryUpdateSzValue(Key, "UpperFilters", New);
+    status = RegistryUpdateSzValue(Key,
+                                   "UpperFilters",
+                                   REG_MULTI_SZ,
+                                   New);
     if (!NT_SUCCESS(status))
         goto fail5;
 
@@ -246,7 +249,10 @@ found:
         Count++;
     }
 
-    status = RegistryUpdateSzValue(Key, "UpperFilters", New);
+    status = RegistryUpdateSzValue(Key,
+                                   "UpperFilters",
+                                   REG_MULTI_SZ,
+                                   New);
     if (!NT_SUCCESS(status))
         goto fail5;
 
diff --git a/src/xenfilt/pvdevice.c b/src/xenfilt/pvdevice.c
index 5f9345d..296608c 100644
--- a/src/xenfilt/pvdevice.c
+++ b/src/xenfilt/pvdevice.c
@@ -210,6 +210,7 @@ PvdeviceSetActive(
 
     status = RegistryUpdateSzValue(ParametersKey,
                                    "ActiveDeviceID",
+                                   REG_SZ,
                                    Ansi);
     if (!NT_SUCCESS(status))
         goto fail2;
@@ -218,6 +219,7 @@ PvdeviceSetActive(
 
     status = RegistryUpdateSzValue(ParametersKey,
                                    "ActiveInstanceID",
+                                   REG_SZ,
                                    Ansi);
     if (!NT_SUCCESS(status))
         goto fail3;
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://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®.