Commit 18b5366c authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

setupapi: Implement StringTableLookUpStringEx.

parent 8a976a7d
...@@ -446,35 +446,40 @@ StringTableGetExtraData(HSTRING_TABLE hStringTable, ...@@ -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 * PARAMS
* hStringTable [I] Handle to the string table * hStringTable [I] Handle to the string table
* lpString [I] String to be searched for * lpString [I] String to be searched for
* dwFlags [I] Flags * dwFlags [I] Flags
* 1: case sensitive compare * 1: case sensitive compare
* lpExtraData [O] Pointer to the buffer that receives the extra data
* lpReserved [I/O] Unused
* *
* RETURNS * RETURNS
* Success: String ID * Success: String ID
* Failure: -1 * Failure: -1
*/ */
DWORD WINAPI DWORD WINAPI
StringTableLookUpString(HSTRING_TABLE hStringTable, StringTableLookUpStringEx(HSTRING_TABLE hStringTable,
LPWSTR lpString, LPWSTR lpString,
DWORD dwFlags) DWORD dwFlags,
LPVOID lpExtraData,
LPDWORD lpReserved)
{ {
PSTRING_TABLE pStringTable; PSTRING_TABLE pStringTable;
DWORD i; 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; pStringTable = (PSTRING_TABLE)hStringTable;
if (pStringTable == NULL) if (pStringTable == NULL)
{ {
ERR("Invalid hStringTable!\n"); ERR("Invalid hStringTable!\n");
return (DWORD)-1; return ~0u;
} }
/* Search for existing string in the string table */ /* Search for existing string in the string table */
...@@ -485,46 +490,48 @@ StringTableLookUpString(HSTRING_TABLE hStringTable, ...@@ -485,46 +490,48 @@ StringTableLookUpString(HSTRING_TABLE hStringTable,
if (dwFlags & 1) if (dwFlags & 1)
{ {
if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString)) if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
{
if (lpExtraData)
memcpy(lpExtraData, pStringTable->pSlots[i].pData, pStringTable->pSlots[i].dwSize);
return i + 1; return i + 1;
}
} }
else else
{ {
if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString)) if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
{
if (lpExtraData)
memcpy(lpExtraData, pStringTable->pSlots[i].pData, pStringTable->pSlots[i].dwSize);
return i + 1; return i + 1;
}
} }
} }
} }
return ~0u;
return (DWORD)-1;
} }
/************************************************************************** /**************************************************************************
* StringTableLookUpStringEx [SETUPAPI.@] * StringTableLookUpString [SETUPAPI.@]
* *
* Searches a string table and extra data for a given string. * Searches a string table for a given string.
* *
* PARAMS * PARAMS
* hStringTable [I] Handle to the string table * hStringTable [I] Handle to the string table
* lpString [I] String to be searched for * lpString [I] String to be searched for
* dwFlags [I] Flags * dwFlags [I] Flags
* 1: case sensitive compare * 1: case sensitive compare
* lpExtraData [O] Pointer to the buffer that receives the extra data
* lpReserved [I/O] Unused
* *
* RETURNS * RETURNS
* Success: String ID * Success: String ID
* Failure: -1 * Failure: ~0u
*/ */
DWORD WINAPI DWORD WINAPI
StringTableLookUpStringEx(HSTRING_TABLE hStringTable, StringTableLookUpString(HSTRING_TABLE hStringTable,
LPWSTR lpString, LPWSTR lpString,
DWORD dwFlags, DWORD dwFlags)
LPVOID lpExtraData,
LPDWORD lpReserved)
{ {
FIXME("\n"); return StringTableLookUpStringEx(hStringTable, lpString, dwFlags, NULL, NULL);
return (DWORD)-1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment