Module: wine Branch: master Commit: 18b5366c35f95eb6e7fc6e19c50c371a81d5a980 URL: http://source.winehq.org/git/wine.git/?a=commit;h=18b5366c35f95eb6e7fc6e19c5...
Author: Hans Leidekker hans@codeweavers.com Date: Tue Jan 6 10:38:49 2009 +0100
setupapi: Implement StringTableLookUpStringEx.
---
dlls/setupapi/stringtable.c | 49 ++++++++++++++++++++++++------------------ 1 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/dlls/setupapi/stringtable.c b/dlls/setupapi/stringtable.c index 2f43c5c..1907fbb 100644 --- a/dlls/setupapi/stringtable.c +++ b/dlls/setupapi/stringtable.c @@ -446,35 +446,40 @@ StringTableGetExtraData(HSTRING_TABLE hStringTable,
/************************************************************************** - * StringTableLookUpString [SETUPAPI.@] + * StringTableLookUpStringEx [SETUPAPI.@] * - * Searches a string table for a given string. + * Searches a string table and extra data for a given string. * * PARAMS * hStringTable [I] Handle to the string table * lpString [I] String to be searched for * dwFlags [I] Flags * 1: case sensitive compare + * lpExtraData [O] Pointer to the buffer that receives the extra data + * lpReserved [I/O] Unused * * RETURNS * Success: String ID * Failure: -1 */ DWORD WINAPI -StringTableLookUpString(HSTRING_TABLE hStringTable, - LPWSTR lpString, - DWORD dwFlags) +StringTableLookUpStringEx(HSTRING_TABLE hStringTable, + LPWSTR lpString, + DWORD dwFlags, + LPVOID lpExtraData, + LPDWORD lpReserved) { PSTRING_TABLE pStringTable; DWORD i;
- TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags); + TRACE("%p %s %x %p, %p\n", hStringTable, debugstr_w(lpString), dwFlags, + lpExtraData, lpReserved);
pStringTable = (PSTRING_TABLE)hStringTable; if (pStringTable == NULL) { ERR("Invalid hStringTable!\n"); - return (DWORD)-1; + return ~0u; }
/* Search for existing string in the string table */ @@ -485,46 +490,48 @@ StringTableLookUpString(HSTRING_TABLE hStringTable, if (dwFlags & 1) { if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString)) + { + if (lpExtraData) + memcpy(lpExtraData, pStringTable->pSlots[i].pData, pStringTable->pSlots[i].dwSize); return i + 1; + } } else { if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString)) + { + if (lpExtraData) + memcpy(lpExtraData, pStringTable->pSlots[i].pData, pStringTable->pSlots[i].dwSize); return i + 1; + } } } } - - return (DWORD)-1; + return ~0u; }
/************************************************************************** - * StringTableLookUpStringEx [SETUPAPI.@] + * StringTableLookUpString [SETUPAPI.@] * - * Searches a string table and extra data for a given string. + * Searches a string table for a given string. * * PARAMS * hStringTable [I] Handle to the string table * lpString [I] String to be searched for * dwFlags [I] Flags * 1: case sensitive compare - * lpExtraData [O] Pointer to the buffer that receives the extra data - * lpReserved [I/O] Unused * * RETURNS * Success: String ID - * Failure: -1 + * Failure: ~0u */ DWORD WINAPI -StringTableLookUpStringEx(HSTRING_TABLE hStringTable, - LPWSTR lpString, - DWORD dwFlags, - LPVOID lpExtraData, - LPDWORD lpReserved) +StringTableLookUpString(HSTRING_TABLE hStringTable, + LPWSTR lpString, + DWORD dwFlags) { - FIXME("\n"); - return (DWORD)-1; + return StringTableLookUpStringEx(hStringTable, lpString, dwFlags, NULL, NULL); }