Implement RegQueryMultipleValuesA().

svn path=/trunk/; revision=11254
This commit is contained in:
Eric Kohl 2004-10-10 10:43:23 +00:00
parent 6fada73411
commit 009d1a6a71

View file

@ -1,4 +1,4 @@
/* $Id: reg.c,v 1.60 2004/10/10 10:10:52 hbirr Exp $ /* $Id: reg.c,v 1.61 2004/10/10 10:43:23 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -456,24 +456,26 @@ RegCreateKeyExA (HKEY hKey,
RtlCreateUnicodeStringFromAsciiz (&ClassString, RtlCreateUnicodeStringFromAsciiz (&ClassString,
lpClass); lpClass);
} }
RtlCreateUnicodeStringFromAsciiz (&SubKeyString,
(LPSTR)lpSubKey); RtlCreateUnicodeStringFromAsciiz(&SubKeyString,
(LPSTR)lpSubKey);
InitializeObjectAttributes (&Attributes, InitializeObjectAttributes (&Attributes,
&SubKeyString, &SubKeyString,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
(HANDLE)ParentKey, (HANDLE)ParentKey,
(PSECURITY_DESCRIPTOR)lpSecurityAttributes); (PSECURITY_DESCRIPTOR)lpSecurityAttributes);
Status = CreateNestedKey(phkResult, Status = CreateNestedKey(phkResult,
&Attributes, &Attributes,
(lpClass == NULL)? NULL : &ClassString, (lpClass == NULL)? NULL : &ClassString,
dwOptions, dwOptions,
samDesired, samDesired,
lpdwDisposition); lpdwDisposition);
RtlFreeUnicodeString (&SubKeyString); RtlFreeUnicodeString (&SubKeyString);
if (lpClass != NULL) if (lpClass != NULL)
{ {
RtlFreeUnicodeString (&ClassString); RtlFreeUnicodeString (&ClassString);
} }
DPRINT("Status %x\n", Status); DPRINT("Status %x\n", Status);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -2166,7 +2168,7 @@ RegQueryInfoKeyW (HKEY hKey,
/************************************************************************ /************************************************************************
* RegQueryMultipleValuesA * RegQueryMultipleValuesA
* *
* @unimplemented * @implemented
*/ */
LONG STDCALL LONG STDCALL
RegQueryMultipleValuesA (HKEY hKey, RegQueryMultipleValuesA (HKEY hKey,
@ -2175,9 +2177,55 @@ RegQueryMultipleValuesA (HKEY hKey,
LPSTR lpValueBuf, LPSTR lpValueBuf,
LPDWORD ldwTotsize) LPDWORD ldwTotsize)
{ {
UNIMPLEMENTED; ULONG i;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); DWORD maxBytes = *ldwTotsize;
return ERROR_CALL_NOT_IMPLEMENTED; LPSTR bufptr = (LPSTR)lpValueBuf;
LONG ErrorCode;
if (maxBytes >= (1024*1024))
return ERROR_TRANSFER_TOO_LONG;
*ldwTotsize = 0;
DPRINT ("RegQueryMultipleValuesA(%p,%p,%ld,%p,%p=%ld)\n",
hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize);
for (i = 0; i < num_vals; i++)
{
val_list[i].ve_valuelen = 0;
ErrorCode = RegQueryValueExA (hKey,
val_list[i].ve_valuename,
NULL,
NULL,
NULL,
&val_list[i].ve_valuelen);
if (ErrorCode != ERROR_SUCCESS)
{
return ErrorCode;
}
if (lpValueBuf != NULL && *ldwTotsize + val_list[i].ve_valuelen <= maxBytes)
{
ErrorCode = RegQueryValueExA (hKey,
val_list[i].ve_valuename,
NULL,
&val_list[i].ve_type,
bufptr,
&val_list[i].ve_valuelen);
if (ErrorCode != ERROR_SUCCESS)
{
return ErrorCode;
}
val_list[i].ve_valueptr = (DWORD_PTR)bufptr;
bufptr += val_list[i].ve_valuelen;
}
*ldwTotsize += val_list[i].ve_valuelen;
}
return (lpValueBuf != NULL && *ldwTotsize <= maxBytes) ? ERROR_SUCCESS : ERROR_MORE_DATA;
} }
@ -2206,7 +2254,7 @@ RegQueryMultipleValuesW (HKEY hKey,
DPRINT ("RegQueryMultipleValuesW(%p,%p,%ld,%p,%p=%ld)\n", DPRINT ("RegQueryMultipleValuesW(%p,%p,%ld,%p,%p=%ld)\n",
hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize); hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize);
for (i = 0; i < num_vals; ++i) for (i = 0; i < num_vals; i++)
{ {
val_list[i].ve_valuelen = 0; val_list[i].ve_valuelen = 0;
ErrorCode = RegQueryValueExW (hKey, ErrorCode = RegQueryValueExW (hKey,