/*++ Copyright (c) 1992 Microsoft Corporation Module Name: regqmval.c Abstract: This module contains the client side wrappers for the Win32 Registry query multiple values APIs: - RegQueryMultipleValuesA - RegQueryMultipleValuesW Author: John Vert (jvert) 15-Jun-1995 Revision History: --*/ #include #include "regrpc.h" #include "client.h" WINADVAPI LONG APIENTRY RegQueryMultipleValuesA ( HKEY hKey, PVALENTA val_list, DWORD num_vals, LPSTR lpValueBuf, LPDWORD ldwTotsize ) /*++ Routine Description: The RegQueryMultipleValues function retrieves a list of data type/data pairs for a list of value names associated with an open registry key. Parameters: hKey Identifies a currently open key or any of the pre-defined reserved handle values: HKEY_CLASSES_ROOT HEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS valList Points to an array of structures describing one or more value entries. This contains the value names of the values to be queried. Refer to Appendix A for a description of VALUE_ENTRY structure. num_vals Size of valList in bytes. If valListLength is not a multiple of the sizeof pvalue, the fractional extra space pointed to by valList is ignored. lpValueBuf The output buffer for returning value information (value names and value data). Data is DWORD aligned with pads inserted as necessary. ldwTotsize The total size of the output buffer pointed to by lpvalueBuf. On output ldwTotsize contains the number of bytes used including pads. If lpValueBuf was too short, then on output ldwTotsize will be the size needed, and caller should assume that lpValueBuf was filled up to the size specified by ldwTotsize on input. Return value: If the function succeeds, the return value is ERROR_SUCCESS; otherwise it is one of the error value which can be returned by RegQueryValueEx. In addition, if either valList or lpValueBuf is too small then ERROR_INSUFFICIENT_BUFFER is returned If the function is unable to instantiate/access the provider of the dynamic key, it will return ERROR_CANTREAD. If the total length of the requested data (valListLength + ldwTotSize) is more than the system limit of one megabytes, then the function returns ERROR_TRANSFER_TOO_LONG and only the first megabyte of data is returned. --*/ { NTSTATUS Status; PRVALENT Values; PUNICODE_STRING Names; LONG Error; ULONG i; ULONG DataLength; ULONG InputLength; LPDWORD pTotalSize; DWORD TotalSize; ANSI_STRING AnsiString; LPSTR NewValueBuf = NULL; DWORD DataOffset; ULONG AnsiLength; HKEY TempHandle = NULL; DWORD RequiredSize; hKey = MapPredefinedHandle(hKey, &TempHandle); if (hKey == NULL) { Error = ERROR_INVALID_HANDLE; goto ExitCleanup; } // // Allocate an array of RVALENTs to describe the input value names // Values = RtlAllocateHeap(RtlProcessHeap(),0,num_vals * sizeof(RVALENT)); if (Values == NULL) { Error = ERROR_OUTOFMEMORY; goto ExitCleanup; } ZeroMemory(Values, sizeof(RVALENT)*num_vals); // // Allocate an array of UNICODE_STRINGs to contain the input names // Names = RtlAllocateHeap(RtlProcessHeap(),0,num_vals * sizeof(UNICODE_STRING)); if (Names == NULL) { Error = ERROR_OUTOFMEMORY; RtlFreeHeap(RtlProcessHeap(),0,Values); goto ExitCleanup; } ZeroMemory(Names, num_vals*sizeof(UNICODE_STRING)); // // Convert the value names to UNICODE_STRINGs // for (i=0; i