[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 4/8] Infer REG_SZ or REG_MULTI_SZ type in RegistryUpdateSzValue()
The argument is a pointer to an array of ANSI_STRINGs in both cases so the type can easily be inferred from the length of the array. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif/registry.c | 27 +++++++++------------------ src/xenvif/registry.h | 3 +-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/xenvif/registry.c b/src/xenvif/registry.c index 32755f3..85c924c 100644 --- a/src/xenvif/registry.c +++ b/src/xenvif/registry.c @@ -1258,13 +1258,12 @@ NTSTATUS RegistryUpdateSzValue( IN HANDLE Key, IN PCHAR Name, - IN ULONG Type, - ... + IN PANSI_STRING Array ) { ANSI_STRING Ansi; UNICODE_STRING Unicode; - va_list Arguments; + ULONG Type; PKEY_VALUE_PARTIAL_INFORMATION Partial; NTSTATUS status; @@ -1273,33 +1272,25 @@ RegistryUpdateSzValue( status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE); if (!NT_SUCCESS(status)) goto fail1; - - va_start(Arguments, Type); - switch (Type) { - case REG_SZ: { - PANSI_STRING Argument; - Argument = va_arg(Arguments, PANSI_STRING); + Type = (Array[1].Buffer != NULL) ? REG_MULTI_SZ : REG_SZ; + switch (Type) { + case REG_SZ: status = STATUS_NO_MEMORY; - Partial = RegistryAnsiToSz(Argument); + Partial = RegistryAnsiToSz(Array); break; - } - case REG_MULTI_SZ: { - PANSI_STRING Argument; - - Argument = va_arg(Arguments, PANSI_STRING); + case REG_MULTI_SZ: status = STATUS_NO_MEMORY; - Partial = RegistryAnsiToMultiSz(Argument); + Partial = RegistryAnsiToMultiSz(Array); break; - } + default: status = STATUS_INVALID_PARAMETER; Partial = NULL; break; } - va_end(Arguments); if (Partial == NULL) goto fail2; diff --git a/src/xenvif/registry.h b/src/xenvif/registry.h index 1d3c885..71ce18b 100644 --- a/src/xenvif/registry.h +++ b/src/xenvif/registry.h @@ -177,8 +177,7 @@ extern NTSTATUS RegistryUpdateSzValue( IN HANDLE Key, IN PCHAR Name, - IN ULONG Type, - ... + IN PANSI_STRING Array ); extern VOID -- 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 |