mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Implement DuplicateString and QueryRegistryValue.
svn path=/trunk/; revision=13248
This commit is contained in:
parent
0c3b08d721
commit
0523b42582
3 changed files with 86 additions and 6 deletions
|
@ -613,11 +613,12 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PFILEPATHS)
|
||||||
#define SPDRP_MAXIMUM_PROPERTY 0x00000023
|
#define SPDRP_MAXIMUM_PROPERTY 0x00000023
|
||||||
|
|
||||||
|
|
||||||
VOID WINAPI MyFree( LPVOID lpMem );
|
LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc);
|
||||||
LPVOID WINAPI MyMalloc( DWORD dwSize );
|
VOID WINAPI MyFree(LPVOID lpMem);
|
||||||
LPVOID WINAPI MyRealloc( LPVOID lpSrc, DWORD dwSize );
|
LPVOID WINAPI MyMalloc(DWORD dwSize);
|
||||||
|
LPVOID WINAPI MyRealloc(LPVOID lpSrc, DWORD dwSize);
|
||||||
|
|
||||||
LONG WINAPI QueryRegistryValue( HKEY, LPCWSTR, LPBYTE *, LPDWORD, LPDWORD );
|
LONG WINAPI QueryRegistryValue(HKEY, LPCWSTR, LPBYTE *, LPDWORD, LPDWORD);
|
||||||
|
|
||||||
void WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show );
|
void WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show );
|
||||||
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show );
|
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show );
|
||||||
|
|
|
@ -91,3 +91,82 @@ LPVOID WINAPI MyRealloc(LPVOID lpSrc, DWORD dwSize)
|
||||||
|
|
||||||
return HeapReAlloc(GetProcessHeap(), 0, lpSrc, dwSize);
|
return HeapReAlloc(GetProcessHeap(), 0, lpSrc, dwSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* DuplicateString [SETUPAPI.@]
|
||||||
|
*
|
||||||
|
* Duplicates a unicode string.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* lpSrc [I] pointer to the unicode string that will be duplicated
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: pointer to the duplicated unicode string
|
||||||
|
* Failure: NULL
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* Call MyFree() to release the duplicated string.
|
||||||
|
*/
|
||||||
|
|
||||||
|
LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc)
|
||||||
|
{
|
||||||
|
LPWSTR lpDst;
|
||||||
|
|
||||||
|
lpDst = MyMalloc((lstrlenW(lpSrc) + 1) * sizeof(WCHAR));
|
||||||
|
if (lpDst == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
wcscpy(lpDst, lpSrc);
|
||||||
|
|
||||||
|
return lpDst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* QueryRegistryValue [SETUPAPI.@]
|
||||||
|
*
|
||||||
|
* Retrieves value data from the registry and allocates memory for the
|
||||||
|
* value data.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* hKey [I] Handle of the key to query
|
||||||
|
* lpValueName [I] Name of value under hkey to query
|
||||||
|
* lpData [O] Destination for the values contents,
|
||||||
|
* lpType [O] Destination for the value type
|
||||||
|
* lpcbData [O] Destination for the size of data
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: ERROR_SUCCESS
|
||||||
|
* Failure: Otherwise
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* Use MyFree to release the lpData buffer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
LONG WINAPI QueryRegistryValue(HKEY hKey,
|
||||||
|
LPCWSTR lpValueName,
|
||||||
|
LPBYTE *lpData,
|
||||||
|
LPDWORD lpType,
|
||||||
|
LPDWORD lpcbData)
|
||||||
|
{
|
||||||
|
LONG lError;
|
||||||
|
|
||||||
|
/* Get required buffer size */
|
||||||
|
*lpcbData = 0;
|
||||||
|
lError = RegQueryValueExW(hKey, lpValueName, 0, lpType, NULL, lpcbData);
|
||||||
|
if (lError != ERROR_SUCCESS)
|
||||||
|
return lError;
|
||||||
|
|
||||||
|
/* Allocate buffer */
|
||||||
|
*lpData = MyMalloc(*lpcbData);
|
||||||
|
if (*lpData == NULL)
|
||||||
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
|
||||||
|
/* Query registry value */
|
||||||
|
lError = RegQueryValueExW(hKey, lpValueName, 0, lpType, *lpData, lpcbData);
|
||||||
|
if (lError != ERROR_SUCCESS)
|
||||||
|
MyFree(*lpData);
|
||||||
|
|
||||||
|
return lError;
|
||||||
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
@ stub DelimStringToMultiSz
|
@ stub DelimStringToMultiSz
|
||||||
@ stub DestroyTextFileReadBuffer
|
@ stub DestroyTextFileReadBuffer
|
||||||
@ stub DoesUserHavePrivilege
|
@ stub DoesUserHavePrivilege
|
||||||
@ stub DuplicateString
|
@ stdcall DuplicateString(wstr)
|
||||||
@ stub EnablePrivilege
|
@ stub EnablePrivilege
|
||||||
@ stub ExtensionPropSheetPageProc
|
@ stub ExtensionPropSheetPageProc
|
||||||
@ stub FileExists
|
@ stub FileExists
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
@ stub OpenAndMapFileForRead
|
@ stub OpenAndMapFileForRead
|
||||||
@ stub OutOfMemory
|
@ stub OutOfMemory
|
||||||
@ stub QueryMultiSzValueToArray
|
@ stub QueryMultiSzValueToArray
|
||||||
@ stub QueryRegistryValue
|
@ stdcall QueryRegistryValue(long wstr ptr ptr ptr)
|
||||||
@ stub ReadAsciiOrUnicodeTextFile
|
@ stub ReadAsciiOrUnicodeTextFile
|
||||||
@ stub RegistryDelnode
|
@ stub RegistryDelnode
|
||||||
@ stub RetreiveFileSecurity
|
@ stub RetreiveFileSecurity
|
||||||
|
|
Loading…
Reference in a new issue