|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 4/4] Registry string value types cannot be inferred
Following a similar fix in XENBUS this patch adds an explicit Type parameter
to RegistryUpdateSzValue(). It also adds a similar parameter to
RegistryQuerySzValue() so that code querying a string value can find out
what type it is.
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
src/xenvif/fdo.c | 1 +
src/xenvif/pdo.c | 4 ++++
src/xenvif/registry.c | 10 ++++++----
src/xenvif/registry.h | 2 ++
src/xenvif/settings.c | 3 +++
5 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/xenvif/fdo.c b/src/xenvif/fdo.c
index 91d66dc..c4c8052 100644
--- a/src/xenvif/fdo.c
+++ b/src/xenvif/fdo.c
@@ -976,6 +976,7 @@ FdoScan(
if (ParametersKey != NULL) {
status = RegistryQuerySzValue(ParametersKey,
"UnsupportedDevices",
+ NULL,
&UnsupportedDevices);
if (!NT_SUCCESS(status))
UnsupportedDevices = NULL;
diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index e8264e2..77fee31 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -749,6 +749,7 @@ PdoSetFriendlyName(
status = RegistryQuerySzValue(SoftwareKey,
"DriverDesc",
+ NULL,
&DriverDesc);
if (!NT_SUCCESS(status))
goto fail1;
@@ -767,6 +768,7 @@ PdoSetFriendlyName(
status = RegistryUpdateSzValue(HardwareKey,
"FriendlyName",
+ REG_SZ,
FriendlyName);
if (!NT_SUCCESS(status))
goto fail3;
@@ -802,6 +804,7 @@ __PdoSetCurrentAddress(
status = RegistryQuerySzValue(Key,
"NetworkAddress",
+ NULL,
&Ansi);
if (!NT_SUCCESS(status))
goto done;
@@ -1106,6 +1109,7 @@ PdoGetInterfaceGuid(
status = RegistryQuerySzValue(Key,
"NetCfgInstanceId",
+ NULL,
&Ansi);
if (!NT_SUCCESS(status))
goto fail1;
diff --git a/src/xenvif/registry.c b/src/xenvif/registry.c
index affaacd..f903922 100644
--- a/src/xenvif/registry.c
+++ b/src/xenvif/registry.c
@@ -808,6 +808,7 @@ NTSTATUS
RegistryQuerySzValue(
IN HANDLE Key,
IN PCHAR Name,
+ OUT PULONG Type OPTIONAL,
OUT PANSI_STRING *Array
)
{
@@ -869,6 +870,9 @@ RegistryQuerySzValue(
if (*Array == NULL)
goto fail5;
+ if (Type != NULL)
+ *Type = Value->Type;
+
__RegistryFree(Value);
RtlFreeUnicodeString(&Unicode);
@@ -1104,7 +1108,7 @@ RegistryQuerySystemStartOption(
if (!NT_SUCCESS(status))
goto fail1;
- status = RegistryQuerySzValue(Key, "SystemStartOptions", &Ansi);
+ status = RegistryQuerySzValue(Key, "SystemStartOptions", NULL, &Ansi);
if (!NT_SUCCESS(status))
goto fail2;
@@ -1258,12 +1262,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;
@@ -1273,8 +1277,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/xenvif/registry.h b/src/xenvif/registry.h
index 71ce18b..e39ccb5 100644
--- a/src/xenvif/registry.h
+++ b/src/xenvif/registry.h
@@ -132,6 +132,7 @@ extern NTSTATUS
RegistryQuerySzValue(
IN HANDLE Key,
IN PCHAR Name,
+ OUT PULONG Type OPTIONAL,
OUT PANSI_STRING *Array
);
@@ -177,6 +178,7 @@ extern NTSTATUS
RegistryUpdateSzValue(
IN HANDLE Key,
IN PCHAR Name,
+ IN ULONG Type,
IN PANSI_STRING Array
);
diff --git a/src/xenvif/settings.c b/src/xenvif/settings.c
index 73a02fb..34af953 100644
--- a/src/xenvif/settings.c
+++ b/src/xenvif/settings.c
@@ -90,14 +90,17 @@ SettingsCopyInterfaceValue(
}
case REG_SZ:
case REG_MULTI_SZ: {
+ ULONG Type;
PANSI_STRING Value;
status = RegistryQuerySzValue(SourceKey,
ValueName->Buffer,
+ &Type,
&Value);
if (NT_SUCCESS(status)) {
(VOID) RegistryUpdateSzValue(Parameters->DestinationKey,
ValueName->Buffer,
+ Type,
Value);
RegistryFreeSzValue(Value);
}
--
2.1.1
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |