Compare commits

...

18 Commits

Author SHA1 Message Date
winesync
28e8839533 [WINESYNC]: setupapi/stringtable_wine.c is now in sync with wine-staging wine-8.15 2023-09-22 13:14:55 +02:00
winesync
3e8e6ea939 [WINESYNC] setupapi: Use CRT functions for memory allocation where possible.
The big win here is getting rid of the reimplementation of wcsdup.

wine commit id c293cd781fb4b330b7d93171501134f86a5138b8 by Alex Henrie <alexhenrie24@gmail.com>
2023-09-22 13:14:54 +02:00
winesync
9668f09b8d [WINESYNC] setupapi: Move prototypes not in Windows's setupapi.h to setupapi_private.h.
And delete the ones we don't need.

wine commit id 1172e66e5b7fa96decf89f8866e71b77e5773ec7 by Alex Henrie <alexhenrie24@gmail.com>

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-09-22 13:14:53 +02:00
winesync
c1c6d3c0af [WINESYNC] setupapi: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id e498e0ec9bf5a3f9cdb965f8668888697ac642ae by Eric Pouech <eric.pouech@gmail.com>
2023-09-22 13:14:53 +02:00
winesync
5302298e6a [WINESYNC] setupapi: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 72d6759f3a86c24e2db0b6190f4d2fae642e487f by Alexandre Julliard <julliard@winehq.org>
2023-09-22 13:14:52 +02:00
Hermès Bélusca-Maïto
b5effae6c5 Now compile wine's stringtable.c for testing purposes 2023-09-22 13:14:51 +02:00
Hermès Bélusca-Maïto
25cdc2b7f1 [WINESYNC] setupapi: Implement a binary compatible string table.
wine commit id 8802f84c8cc473d5617c134c16973b1cb2c4b53e by Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 13:14:50 +02:00
Hermès Bélusca-Maïto
156ffcd20e [SETUPAPI][WINESYNC] Continue Wine-syncing stringtable.c to a separate file.
Past Wine 1.7.18, the string table internal structure changed to one
claimed to be "binary compatible" (with Windows' one), see wine commit
8802f84c8cc473d5617c134c16973b1cb2c4b53e , with a "weak" justification
that may be found in
https://bugs.winehq.org/show_bug.cgi?id=26016
and
https://bugs.winehq.org/show_bug.cgi?id=32554

Until we hit actual problems with our stringtable implementation, keep
it in its original file, while this new Wine implementation goes into
a separate file, that could be tested manually by changing which one is
compiled in the CMakeLists.txt file.
2023-09-22 13:14:49 +02:00
Hermès Bélusca-Maïto
ad1cff5925 [SETUPAPI] stringtable.c: Code simplification and bugfix.
- Reimplement StringTableInitialize around StringTableInitializeEx
- Fix buffer over-read in StringTableGetExtraData in case the user-specified
  dwExtraDataSize is larger than the dwSize of the pStringTable pData buffer.
2023-09-22 13:14:49 +02:00
winesync
12384ee60c [WINESYNC]: setupapi/stringtable.c is now in sync with wine-staging wine-1.7.18 2023-09-22 13:14:48 +02:00
winesync
c7915227d3 [WINESYNC] setupapi: Implement StringTableLookUpStringEx.
wine commit id 18b5366c35f95eb6e7fc6e19c50c371a81d5a980 by Hans Leidekker <hans@codeweavers.com>

[WINESYNC] setupapi: Add some tests for StringTableLookUpStringEx. Make them pass.

wine commit id 601870a4351753555bfa351a23328b2e1109c7b0 by Hans Leidekker <hans@codeweavers.com>

[WINESYNC] setupapi: Fix the StringTableLookUpStringEx() prototype.

wine commit id 916d6a44500735b3fecf0e7c485c2aa7e8025644 by Francois Gouget <fgouget@free.fr>

These commits have been grouped together, since all of these were
partially already present in the forked stringtable.c code.
2023-09-22 13:14:47 +02:00
winesync
55cbd14f25 [WINESYNC] setupapi: Fix typo in StringTableGetExtraData.
wine commit id d8dad22c9783e1868ec4bb72d8051dd0a5f4f0a7 by Hans Leidekker <hans@codeweavers.com>
2023-09-22 13:14:46 +02:00
winesync
38a7d21adb [WINESYNC] setupapi: Implement StringTableAddStringEx.
wine commit id c2f99f30143e1180620980f3d5713456392c8ecf by Hans Leidekker <hans@codeweavers.com>

+ Re-integrate existing ReactOS bug fixes
+ Add missing dwExtraDataSize && lpExtraData zero/NULL checks in StringTableAddStringEx

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-09-22 13:14:45 +02:00
winesync
65d0db3da7 [WINESYNC] setupapi: Do not cast NULL.
wine commit id d62b48df2acece81b533a92fbca566cc4023be43 by Michael Stefaniuc <mstefani@redhat.de>
2023-09-22 13:14:44 +02:00
winesync
408165bc85 [WINESYNC] setupapi: setupapi.h must not define HSTRING_TABLE and the StringTable* prototypes.
wine commit id 7ab6d8522b614f6e9d9773fa86151ab05fb05a19 by Francois Gouget <fgouget@free.fr>

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-09-22 13:14:43 +02:00
Hermès Bélusca-Maïto
7a1f611ea8 [WINESYNC] Initial bootstrap for setupapi stringtable.c partial sync.
Start syncing at wine-0.9.24
2023-09-22 13:14:43 +02:00
Hermès Bélusca-Maïto
14f7a7688b Partially revert commit 30810893ad.
[SETUPAPI]
- Add 'pSetup'-Prefix to the string table functions according to the new naming convention.
- Remove the obsolete function StringTableTrim.
2023-09-22 13:14:42 +02:00
Hermès Bélusca-Maïto
d5255afce9 [SETUPAPI] Use the CRT oldnames library.
Remove the '-Dwcsnicmp=_wcsnicmp' and use the alias in the oldnames lib.
This will also fix wcslwr() usage in next commits.
2023-09-22 13:14:27 +02:00
9 changed files with 877 additions and 343 deletions

View File

@@ -4,10 +4,7 @@ include_directories(
${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl
${CMAKE_CURRENT_BINARY_DIR})
add_definitions(
-D_SETUPAPI_
-D_CFGMGR32_
-Dwcsnicmp=_wcsnicmp)
add_definitions(-D_SETUPAPI_ -D_CFGMGR32_)
add_rpc_files(client ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/pnp.idl)
spec2def(setupapi.dll setupapi.spec ADD_IMPORTLIB)
@@ -27,7 +24,7 @@ list(APPEND SOURCE
query.c
queue.c
setupcab.c
stringtable.c
stringtable_wine.c
stubs.c
rpc.c)
@@ -42,7 +39,7 @@ add_library(setupapi MODULE
${CMAKE_CURRENT_BINARY_DIR}/setupapi.def)
set_module_type(setupapi win32dll UNICODE)
target_link_libraries(setupapi uuid wine ${PSEH_LIB})
target_link_libraries(setupapi uuid wine ${PSEH_LIB} oldnames)
add_delay_importlibs(setupapi comdlg32 shell32 winspool.drv wintrust)
add_importlibs(setupapi gdi32 comctl32 advapi32 user32 rpcrt4 version msvcrt kernel32 ntdll)
add_pch(setupapi setupapi_private.h "${PCH_SKIP_SOURCE}")

View File

@@ -58,6 +58,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
#undef __WINESRC__
#endif
#include <setupapi_undoc.h>
#include "resource.h"
#define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057

View File

@@ -20,6 +20,24 @@
#include "setupapi_private.h"
#define _PSETUP(func) pSetup ## func
#define StringTableInitialize _PSETUP(StringTableInitialize)
#define StringTableInitializeEx _PSETUP(StringTableInitializeEx)
#define StringTableDestroy _PSETUP(StringTableDestroy)
#define StringTableAddString _PSETUP(StringTableAddString)
#define StringTableAddStringEx _PSETUP(StringTableAddStringEx)
#define StringTableDuplicate _PSETUP(StringTableDuplicate)
#define StringTableGetExtraData _PSETUP(StringTableGetExtraData)
#define StringTableLookUpString _PSETUP(StringTableLookUpString)
#define StringTableLookUpStringEx _PSETUP(StringTableLookUpStringEx)
#define StringTableSetExtraData _PSETUP(StringTableSetExtraData)
#define StringTableStringFromId _PSETUP(StringTableStringFromId)
#define StringTableStringFromIdEx _PSETUP(StringTableStringFromIdEx)
#define StringTableTrim _PSETUP(StringTableTrim)
#define TABLE_DEFAULT_SIZE 256
typedef struct _TABLE_SLOT
@@ -39,19 +57,21 @@ typedef struct _STRING_TABLE
/**************************************************************************
* pSetupStringTableInitialize [SETUPAPI.@]
* StringTableInitializeEx [SETUPAPI.@]
*
* Creates a new string table and initializes it.
*
* PARAMS
* None
* dwMaxExtraDataSize [I] Maximum extra data size
* dwReserved [I] Unused
*
* RETURNS
* Success: Handle to the string table
* Failure: NULL
*/
HSTRING_TABLE WINAPI
pSetupStringTableInitialize(VOID)
StringTableInitializeEx(DWORD dwMaxExtraDataSize,
DWORD dwReserved)
{
PSTRING_TABLE pStringTable;
@@ -75,51 +95,6 @@ pSetupStringTableInitialize(VOID)
memset(pStringTable->pSlots, 0, sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
pStringTable->dwUsedSlots = 0;
pStringTable->dwMaxSlots = TABLE_DEFAULT_SIZE;
pStringTable->dwMaxDataSize = 0;
TRACE("Done\n");
return (HSTRING_TABLE)pStringTable;
}
/**************************************************************************
* pSetupStringTableInitializeEx [SETUPAPI.@]
*
* Creates a new string table and initializes it.
*
* PARAMS
* dwMaxExtraDataSize [I] Maximum extra data size
* dwReserved [I] Unused
*
* RETURNS
* Success: Handle to the string table
* Failure: NULL
*/
HSTRING_TABLE WINAPI
pSetupStringTableInitializeEx(DWORD dwMaxExtraDataSize,
DWORD dwReserved)
{
PSTRING_TABLE pStringTable;
TRACE("\n");
pStringTable = MyMalloc(sizeof(STRING_TABLE));
if (pStringTable == NULL) return NULL;
memset(pStringTable, 0, sizeof(STRING_TABLE));
pStringTable->pSlots = MyMalloc(sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
if (pStringTable->pSlots == NULL)
{
MyFree(pStringTable);
return NULL;
}
memset(pStringTable->pSlots, 0, sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
pStringTable->dwUsedSlots = 0;
pStringTable->dwMaxSlots = TABLE_DEFAULT_SIZE;
pStringTable->dwMaxDataSize = dwMaxExtraDataSize;
@@ -129,9 +104,26 @@ pSetupStringTableInitializeEx(DWORD dwMaxExtraDataSize,
return (HSTRING_TABLE)pStringTable;
}
/**************************************************************************
* StringTableInitialize [SETUPAPI.@]
*
* Creates a new string table and initializes it.
*
* PARAMS
* None
*
* RETURNS
* Success: Handle to the string table
* Failure: NULL
*/
HSTRING_TABLE WINAPI
StringTableInitialize(VOID)
{
return StringTableInitializeEx(0, 0);
}
/**************************************************************************
* pSetupStringTableDestroy [SETUPAPI.@]
* StringTableDestroy [SETUPAPI.@]
*
* Destroys a string table.
*
@@ -142,7 +134,7 @@ pSetupStringTableInitializeEx(DWORD dwMaxExtraDataSize,
* None
*/
VOID WINAPI
pSetupStringTableDestroy(HSTRING_TABLE hStringTable)
StringTableDestroy(HSTRING_TABLE hStringTable)
{
PSTRING_TABLE pStringTable;
DWORD i;
@@ -171,114 +163,8 @@ pSetupStringTableDestroy(HSTRING_TABLE hStringTable)
MyFree(pStringTable);
}
/**************************************************************************
* pSetupStringTableAddString [SETUPAPI.@]
*
* Adds a new string to the string table.
*
* PARAMS
* hStringTable [I] Handle to the string table
* lpString [I] String to be added to the string table
* dwFlags [I] Flags
* 1: case sensitive compare
*
* RETURNS
* Success: String ID
* Failure: -1
*
* NOTES
* If the given string already exists in the string table it will not
* be added again. The ID of the existing string will be returned in
* this case.
*/
DWORD WINAPI
pSetupStringTableAddString(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags)
{
PSTRING_TABLE pStringTable;
DWORD i;
TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags);
pStringTable = (PSTRING_TABLE)hStringTable;
if (pStringTable == NULL)
{
ERR("Invalid hStringTable!\n");
return (DWORD)-1;
}
/* Search for existing string in the string table */
for (i = 0; i < pStringTable->dwMaxSlots; i++)
{
if (pStringTable->pSlots[i].pString != NULL)
{
if (dwFlags & 1)
{
if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
{
return i + 1;
}
}
else
{
if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
{
return i + 1;
}
}
}
}
/* Check for filled slot table */
if (pStringTable->dwUsedSlots == pStringTable->dwMaxSlots)
{
PTABLE_SLOT pNewSlots;
DWORD dwNewMaxSlots;
/* FIXME: not thread safe */
dwNewMaxSlots = pStringTable->dwMaxSlots * 2;
pNewSlots = MyMalloc(sizeof(TABLE_SLOT) * dwNewMaxSlots);
if (pNewSlots == NULL)
return (DWORD)-1;
memset(&pNewSlots[pStringTable->dwMaxSlots], 0, sizeof(TABLE_SLOT) * (dwNewMaxSlots - pStringTable->dwMaxSlots));
memcpy(pNewSlots, pStringTable->pSlots, sizeof(TABLE_SLOT) * pStringTable->dwMaxSlots);
pNewSlots = InterlockedExchangePointer((PVOID*)&pStringTable->pSlots, pNewSlots);
MyFree(pNewSlots);
pStringTable->dwMaxSlots = dwNewMaxSlots;
return pSetupStringTableAddString(hStringTable, lpString, dwFlags);
}
/* Search for an empty slot */
for (i = 0; i < pStringTable->dwMaxSlots; i++)
{
if (pStringTable->pSlots[i].pString == NULL)
{
pStringTable->pSlots[i].pString = MyMalloc((lstrlenW(lpString) + 1) * sizeof(WCHAR));
if (pStringTable->pSlots[i].pString == NULL)
{
TRACE("Couldn't allocate memory for a new string!\n");
return (DWORD)-1;
}
lstrcpyW(pStringTable->pSlots[i].pString, lpString);
pStringTable->dwUsedSlots++;
return i + 1;
}
}
TRACE("Couldn't find an empty slot!\n");
return (DWORD)-1;
}
/**************************************************************************
* pSetupStringTableAddStringEx [SETUPAPI.@]
* StringTableAddStringEx [SETUPAPI.@]
*
* Adds a new string plus extra data to the string table.
*
@@ -300,42 +186,39 @@ pSetupStringTableAddString(HSTRING_TABLE hStringTable,
* this case.
*/
DWORD WINAPI
pSetupStringTableAddStringEx(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags,
LPVOID lpExtraData,
DWORD dwExtraDataSize)
StringTableAddStringEx(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags,
LPVOID lpExtraData,
DWORD dwExtraDataSize)
{
PSTRING_TABLE pStringTable;
DWORD i;
TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
TRACE("%p %s %x %p, %u\n", hStringTable, debugstr_w(lpString), dwFlags,
lpExtraData, dwExtraDataSize);
pStringTable = (PSTRING_TABLE)hStringTable;
if (pStringTable == NULL)
if (!pStringTable)
{
ERR("Invalid hStringTable!\n");
return (DWORD)-1;
return ~0u;
}
/* Search for existing string in the string table */
for (i = 0; i < pStringTable->dwMaxSlots; i++)
{
if (pStringTable->pSlots[i].pString != NULL)
if (pStringTable->pSlots[i].pString)
{
if (dwFlags & 1)
{
if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
{
return i + 1;
}
}
else
{
if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
{
return i + 1;
}
}
}
}
@@ -343,37 +226,53 @@ pSetupStringTableAddStringEx(HSTRING_TABLE hStringTable,
/* Check for filled slot table */
if (pStringTable->dwUsedSlots == pStringTable->dwMaxSlots)
{
FIXME("Resize the string table!\n");
return (DWORD)-1;
PTABLE_SLOT pNewSlots;
DWORD dwNewMaxSlots;
/* FIXME: not thread safe */
dwNewMaxSlots = pStringTable->dwMaxSlots * 2;
pNewSlots = MyMalloc(sizeof(TABLE_SLOT) * dwNewMaxSlots);
if (!pNewSlots)
return ~0u;
memset(&pNewSlots[pStringTable->dwMaxSlots], 0, sizeof(TABLE_SLOT) * (dwNewMaxSlots - pStringTable->dwMaxSlots));
memcpy(pNewSlots, pStringTable->pSlots, sizeof(TABLE_SLOT) * pStringTable->dwMaxSlots);
pNewSlots = InterlockedExchangePointer((PVOID*)&pStringTable->pSlots, pNewSlots);
MyFree(pNewSlots);
pStringTable->dwMaxSlots = dwNewMaxSlots;
return StringTableAddStringEx(hStringTable, lpString, dwFlags, lpExtraData, dwExtraDataSize);
}
/* Search for an empty slot */
for (i = 0; i < pStringTable->dwMaxSlots; i++)
{
if (pStringTable->pSlots[i].pString == NULL)
if (!pStringTable->pSlots[i].pString)
{
pStringTable->pSlots[i].pString = MyMalloc((lstrlenW(lpString) + 1) * sizeof(WCHAR));
if (pStringTable->pSlots[i].pString == NULL)
if (!pStringTable->pSlots[i].pString)
{
TRACE("Couldn't allocate memory for a new string!\n");
return (DWORD)-1;
WARN("Couldn't allocate memory for a new string!\n");
return ~0u;
}
lstrcpyW(pStringTable->pSlots[i].pString, lpString);
pStringTable->pSlots[i].pData = MyMalloc(dwExtraDataSize);
if (pStringTable->pSlots[i].pData == NULL)
if (dwExtraDataSize && lpExtraData)
{
TRACE("Couldn't allocate memory for a new extra data!\n");
MyFree(pStringTable->pSlots[i].pString);
pStringTable->pSlots[i].pString = NULL;
return (DWORD)-1;
}
pStringTable->pSlots[i].pData = MyMalloc(dwExtraDataSize);
if (!pStringTable->pSlots[i].pData)
{
TRACE("Couldn't allocate memory for data!\n");
MyFree(pStringTable->pSlots[i].pString);
pStringTable->pSlots[i].pString = NULL;
return ~0u;
}
memcpy(pStringTable->pSlots[i].pData,
lpExtraData,
dwExtraDataSize);
pStringTable->pSlots[i].dwSize = dwExtraDataSize;
memcpy(pStringTable->pSlots[i].pData,
lpExtraData,
dwExtraDataSize);
pStringTable->pSlots[i].dwSize = dwExtraDataSize;
}
pStringTable->dwUsedSlots++;
@@ -382,13 +281,39 @@ pSetupStringTableAddStringEx(HSTRING_TABLE hStringTable,
}
TRACE("Couldn't find an empty slot!\n");
return (DWORD)-1;
return ~0u;
}
/**************************************************************************
* StringTableAddString [SETUPAPI.@]
*
* Adds a new string to the string table.
*
* PARAMS
* hStringTable [I] Handle to the string table
* lpString [I] String to be added to the string table
* dwFlags [I] Flags
* 1: case sensitive compare
*
* RETURNS
* Success: String ID
* Failure: -1
*
* NOTES
* If the given string already exists in the string table it will not
* be added again. The ID of the existing string will be returned in
* this case.
*/
DWORD WINAPI
StringTableAddString(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags)
{
return StringTableAddStringEx(hStringTable, lpString, dwFlags, NULL, 0);
}
/**************************************************************************
* pSetupStringTableDuplicate [SETUPAPI.@]
* StringTableDuplicate [SETUPAPI.@]
*
* Duplicates a given string table.
*
@@ -401,7 +326,7 @@ pSetupStringTableAddStringEx(HSTRING_TABLE hStringTable,
*
*/
HSTRING_TABLE WINAPI
pSetupStringTableDuplicate(HSTRING_TABLE hStringTable)
StringTableDuplicate(HSTRING_TABLE hStringTable)
{
PSTRING_TABLE pSourceTable;
PSTRING_TABLE pDestinationTable;
@@ -414,14 +339,14 @@ pSetupStringTableDuplicate(HSTRING_TABLE hStringTable)
if (pSourceTable == NULL)
{
ERR("Invalid hStringTable!\n");
return (HSTRING_TABLE)NULL;
return NULL;
}
pDestinationTable = MyMalloc(sizeof(STRING_TABLE));
if (pDestinationTable == NULL)
{
ERR("Could not allocate a new string table!\n");
return (HSTRING_TABLE)NULL;
return NULL;
}
memset(pDestinationTable, 0, sizeof(STRING_TABLE));
@@ -430,7 +355,7 @@ pSetupStringTableDuplicate(HSTRING_TABLE hStringTable)
if (pDestinationTable->pSlots == NULL)
{
MyFree(pDestinationTable);
return (HSTRING_TABLE)NULL;
return NULL;
}
memset(pDestinationTable->pSlots, 0, sizeof(TABLE_SLOT) * pSourceTable->dwMaxSlots);
@@ -470,9 +395,8 @@ pSetupStringTableDuplicate(HSTRING_TABLE hStringTable)
return (HSTRING_TABLE)pDestinationTable;
}
/**************************************************************************
* pSetupStringTableGetExtraData [SETUPAPI.@]
* StringTableGetExtraData [SETUPAPI.@]
*
* Retrieves extra data from a given string table entry.
*
@@ -487,10 +411,10 @@ pSetupStringTableDuplicate(HSTRING_TABLE hStringTable)
* Failure: FALSE
*/
BOOL WINAPI
pSetupStringTableGetExtraData(HSTRING_TABLE hStringTable,
DWORD dwId,
LPVOID lpExtraData,
DWORD dwExtraDataSize)
StringTableGetExtraData(HSTRING_TABLE hStringTable,
DWORD dwId,
LPVOID lpExtraData,
DWORD dwExtraDataSize)
{
PSTRING_TABLE pStringTable;
@@ -510,7 +434,7 @@ pSetupStringTableGetExtraData(HSTRING_TABLE hStringTable,
return FALSE;
}
if (pStringTable->pSlots[dwId - 1].dwSize < dwExtraDataSize)
if (pStringTable->pSlots[dwId - 1].dwSize > dwExtraDataSize)
{
ERR("Data size is too large!\n");
return FALSE;
@@ -518,68 +442,13 @@ pSetupStringTableGetExtraData(HSTRING_TABLE hStringTable,
memcpy(lpExtraData,
pStringTable->pSlots[dwId - 1].pData,
dwExtraDataSize);
pStringTable->pSlots[dwId - 1].dwSize);
return TRUE;
}
/**************************************************************************
* pSetupStringTableLookUpString [SETUPAPI.@]
*
* 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
*
* RETURNS
* Success: String ID
* Failure: -1
*/
DWORD WINAPI
pSetupStringTableLookUpString(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags)
{
PSTRING_TABLE pStringTable;
DWORD i;
TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags);
pStringTable = (PSTRING_TABLE)hStringTable;
if (pStringTable == NULL)
{
ERR("Invalid hStringTable!\n");
return (DWORD)-1;
}
/* Search for existing string in the string table */
for (i = 0; i < pStringTable->dwMaxSlots; i++)
{
if (pStringTable->pSlots[i].pString != NULL)
{
if (dwFlags & 1)
{
if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
return i + 1;
}
else
{
if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
return i + 1;
}
}
}
return (DWORD)-1;
}
/**************************************************************************
* pSetupStringTableLookUpStringEx [SETUPAPI.@]
* StringTableLookUpStringEx [SETUPAPI.@]
*
* Searches a string table and extra data for a given string.
*
@@ -589,18 +458,18 @@ pSetupStringTableLookUpString(HSTRING_TABLE hStringTable,
* dwFlags [I] Flags
* 1: case sensitive compare
* lpExtraData [O] Pointer to the buffer that receives the extra data
* lpReserved [I/O] Unused
* dwReserved [I/O] Unused
*
* RETURNS
* Success: String ID
* Failure: -1
*/
DWORD WINAPI
pSetupStringTableLookUpStringEx(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags,
LPVOID lpExtraData,
DWORD dwReserved)
StringTableLookUpStringEx(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags,
LPVOID lpExtraData,
DWORD dwReserved)
{
PSTRING_TABLE pStringTable;
DWORD i;
@@ -643,9 +512,31 @@ pSetupStringTableLookUpStringEx(HSTRING_TABLE hStringTable,
return ~0u;
}
/**************************************************************************
* StringTableLookUpString [SETUPAPI.@]
*
* 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
*
* RETURNS
* Success: String ID
* Failure: -1
*/
DWORD WINAPI
StringTableLookUpString(HSTRING_TABLE hStringTable,
LPWSTR lpString,
DWORD dwFlags)
{
return StringTableLookUpStringEx(hStringTable, lpString, dwFlags, NULL, 0);
}
/**************************************************************************
* pSetupStringTableSetExtraData [SETUPAPI.@]
* StringTableSetExtraData [SETUPAPI.@]
*
* Sets extra data for a given string table entry.
*
@@ -660,10 +551,10 @@ pSetupStringTableLookUpStringEx(HSTRING_TABLE hStringTable,
* Failure: FALSE
*/
BOOL WINAPI
pSetupStringTableSetExtraData(HSTRING_TABLE hStringTable,
DWORD dwId,
LPVOID lpExtraData,
DWORD dwExtraDataSize)
StringTableSetExtraData(HSTRING_TABLE hStringTable,
DWORD dwId,
LPVOID lpExtraData,
DWORD dwExtraDataSize)
{
PSTRING_TABLE pStringTable;
@@ -704,9 +595,8 @@ pSetupStringTableSetExtraData(HSTRING_TABLE hStringTable,
return TRUE;
}
/**************************************************************************
* pSetupStringTableStringFromId [SETUPAPI.@]
* StringTableStringFromId [SETUPAPI.@]
*
* Returns a pointer to a string for the given string ID.
*
@@ -719,8 +609,8 @@ pSetupStringTableSetExtraData(HSTRING_TABLE hStringTable,
* Failure: NULL
*/
LPWSTR WINAPI
pSetupStringTableStringFromId(HSTRING_TABLE hStringTable,
DWORD dwId)
StringTableStringFromId(HSTRING_TABLE hStringTable,
DWORD dwId)
{
PSTRING_TABLE pStringTable;
static WCHAR empty[] = {0};
@@ -740,9 +630,8 @@ pSetupStringTableStringFromId(HSTRING_TABLE hStringTable,
return pStringTable->pSlots[dwId - 1].pString;
}
/**************************************************************************
* pSetupStringTableStringFromIdEx [SETUPAPI.@]
* StringTableStringFromIdEx [SETUPAPI.@]
*
* Returns a string for the given string ID.
*
@@ -757,10 +646,10 @@ pSetupStringTableStringFromId(HSTRING_TABLE hStringTable,
* Failure: FALSE
*/
BOOL WINAPI
pSetupStringTableStringFromIdEx(HSTRING_TABLE hStringTable,
DWORD dwId,
LPWSTR lpBuffer,
LPDWORD lpBufferLength)
StringTableStringFromIdEx(HSTRING_TABLE hStringTable,
DWORD dwId,
LPWSTR lpBuffer,
LPDWORD lpBufferLength)
{
PSTRING_TABLE pStringTable;
DWORD dwLength;
@@ -795,3 +684,20 @@ pSetupStringTableStringFromIdEx(HSTRING_TABLE hStringTable,
return bResult;
}
/**************************************************************************
* StringTableTrim [SETUPAPI.@]
*
* ...
*
* PARAMS
* hStringTable [I] Handle to the string table
*
* RETURNS
* None
*/
VOID WINAPI
StringTableTrim(HSTRING_TABLE hStringTable)
{
FIXME("%p\n", hStringTable);
}

View File

@@ -0,0 +1,595 @@
/*
* Setupapi string table functions
*
* Copyright 2005 Eric Kohl
* Copyright 2014 Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "setupapi_private.h"
#include <winnls.h>
#define _PSETUP(func) pSetup ## func
#define StringTableInitialize _PSETUP(StringTableInitialize)
#define StringTableInitializeEx _PSETUP(StringTableInitializeEx)
#define StringTableDestroy _PSETUP(StringTableDestroy)
#define StringTableAddString _PSETUP(StringTableAddString)
#define StringTableAddStringEx _PSETUP(StringTableAddStringEx)
#define StringTableDuplicate _PSETUP(StringTableDuplicate)
#define StringTableGetExtraData _PSETUP(StringTableGetExtraData)
#define StringTableLookUpString _PSETUP(StringTableLookUpString)
#define StringTableLookUpStringEx _PSETUP(StringTableLookUpStringEx)
#define StringTableSetExtraData _PSETUP(StringTableSetExtraData)
#define StringTableStringFromId _PSETUP(StringTableStringFromId)
#define StringTableStringFromIdEx _PSETUP(StringTableStringFromIdEx)
#define StringTableTrim _PSETUP(StringTableTrim)
struct stringtable {
char *data;
ULONG nextoffset;
ULONG allocated;
DWORD_PTR unk[2];
ULONG max_extra_size;
LCID lcid;
};
struct stringentry {
DWORD nextoffset;
WCHAR data[1];
};
#define BUCKET_COUNT 509
#define DEFAULT_ALLOC_SIZE 4096
/*
String table details
Returned string table 'handle' is a pointer to 'struct stringtable' structure.
Data itself is allocated separately, pointer is stored in 'data' field.
Data starts with array of 509 DWORDs - lookup table. Initially all offsets in that
array are set to -1. Right after lookup table goes data itself, stored in linked lists.
Lookup table offset points to first record of 'struct stringentry' type. When more
than one record is present in a bucket, first record links to next one with 'nextoffset'
field. Last record has nextoffset == -1, same when there's only one record. String data
is placed right after offset, and is followed by extra data. Each record has reserved
'max_extra_size' bytes to store extra data, it's not compacted in any way.
A simple hash function is used to determine which bucket a given string belongs to (see below).
All offsets including returned string ids are relative to 'data' pointer. When table
needs to grow 'allocated' size is doubled, but offsets are always valid and preserved.
*/
static inline DWORD get_string_hash(const WCHAR *str, BOOL case_sensitive)
{
DWORD hash = 0;
while (*str) {
WCHAR ch = case_sensitive ? *str : towlower(*str);
hash += ch;
if (ch & ~0xff)
hash |= 1;
str++;
}
return hash % BUCKET_COUNT;
}
static inline DWORD *get_bucket_ptr(struct stringtable *table, const WCHAR *string, BOOL case_sensitive)
{
DWORD hash = get_string_hash(string, case_sensitive);
return (DWORD*)(table->data + hash*sizeof(DWORD));
}
static inline WCHAR *get_string_ptr(struct stringtable *table, DWORD id)
{
return (WCHAR*)(table->data + id + sizeof(DWORD));
}
static inline char *get_extradata_ptr(struct stringtable *table, DWORD id)
{
WCHAR *ptrW = get_string_ptr(table, id);
/* skip string itself */
return (char*)(ptrW + lstrlenW(ptrW) + 1);
}
static inline BOOL is_valid_string_id(struct stringtable *table, DWORD id)
{
return (id >= BUCKET_COUNT*sizeof(DWORD)) && (id < table->allocated);
}
static inline int get_aligned16_size(int size)
{
return (size + 15) & ~15;
}
/**************************************************************************
* StringTableInitializeEx [SETUPAPI.@]
*
* Creates a new string table and initializes it.
*
* PARAMS
* max_extra_size [I] Maximum extra data size
* reserved [I] Unused
*
* RETURNS
* Success: Handle to the string table
* Failure: NULL
*/
HSTRING_TABLE WINAPI StringTableInitializeEx(ULONG max_extra_size, DWORD reserved)
{
struct stringtable *table;
TRACE("(%ld %lx)\n", max_extra_size, reserved);
table = MyMalloc(sizeof(*table));
if (!table) return NULL;
table->allocated = get_aligned16_size(BUCKET_COUNT*sizeof(DWORD) + DEFAULT_ALLOC_SIZE);
table->data = MyMalloc(table->allocated);
if (!table->data) {
MyFree(table);
return NULL;
}
table->nextoffset = BUCKET_COUNT*sizeof(DWORD);
/* FIXME: actually these two are not zero */
table->unk[0] = table->unk[1] = 0;
table->max_extra_size = max_extra_size;
table->lcid = GetThreadLocale();
/* bucket area is filled with 0xff, actual string data area is zeroed */
memset(table->data, 0xff, table->nextoffset);
memset(table->data + table->nextoffset, 0, table->allocated - table->nextoffset);
return (HSTRING_TABLE)table;
}
/**************************************************************************
* StringTableInitialize [SETUPAPI.@]
*
* Creates a new string table and initializes it.
*
* PARAMS
* None
*
* RETURNS
* Success: Handle to the string table
* Failure: NULL
*/
HSTRING_TABLE WINAPI StringTableInitialize(void)
{
return StringTableInitializeEx(0, 0);
}
/**************************************************************************
* StringTableDestroy [SETUPAPI.@]
*
* Destroys a string table.
*
* PARAMS
* hTable [I] Handle to the string table to be destroyed
*
* RETURNS
* None
*/
void WINAPI StringTableDestroy(HSTRING_TABLE hTable)
{
struct stringtable *table = (struct stringtable*)hTable;
TRACE("%p\n", table);
if (!table)
return;
MyFree(table->data);
MyFree(table);
}
/**************************************************************************
* StringTableDuplicate [SETUPAPI.@]
*
* Duplicates a given string table.
*
* PARAMS
* hTable [I] Handle to the string table
*
* RETURNS
* Success: Handle to the duplicated string table
* Failure: NULL
*
*/
HSTRING_TABLE WINAPI StringTableDuplicate(HSTRING_TABLE hTable)
{
struct stringtable *src = (struct stringtable*)hTable, *dest;
TRACE("%p\n", src);
if (!src)
return NULL;
dest = MyMalloc(sizeof(*dest));
if (!dest)
return NULL;
*dest = *src;
dest->data = MyMalloc(src->allocated);
if (!dest->data) {
MyFree(dest);
return NULL;
}
memcpy(dest->data, src->data, src->allocated);
return (HSTRING_TABLE)dest;
}
/**************************************************************************
* StringTableGetExtraData [SETUPAPI.@]
*
* Retrieves extra data from a given string table entry.
*
* PARAMS
* hTable [I] Handle to the string table
* id [I] String ID
* extra [I] Pointer a buffer that receives the extra data
* extra_size [I] Size of the buffer
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI StringTableGetExtraData(HSTRING_TABLE hTable, ULONG id, void *extra, ULONG extra_size)
{
struct stringtable *table = (struct stringtable*)hTable;
char *extraptr;
TRACE("%p %lu %p %lu\n", table, id, extra, extra_size);
if (!table)
return FALSE;
if (!is_valid_string_id(table, id))
return FALSE;
if (table->max_extra_size > extra_size)
{
ERR("data size is too large\n");
return FALSE;
}
extraptr = get_extradata_ptr(table, id);
memcpy(extra, extraptr, extra_size);
return TRUE;
}
/**************************************************************************
* StringTableLookUpStringEx [SETUPAPI.@]
*
* Searches a string table and extra data for a given string.
*
* PARAMS
* hTable [I] Handle to the string table
* string [I] String to be searched for
* flags [I] Flags
* 1: case sensitive compare
* extra [O] Pointer to the buffer that receives the extra data
* extra_size [I/O] Unused
*
* RETURNS
* Success: String ID
* Failure: -1
*/
DWORD WINAPI StringTableLookUpStringEx(HSTRING_TABLE hTable, LPWSTR string, DWORD flags,
void *extra, ULONG extra_size)
{
struct stringtable *table = (struct stringtable*)hTable;
BOOL case_sensitive = flags & 1;
struct stringentry *entry;
DWORD offset;
int cmp;
TRACE("%p->%p %s %lx %p, %lx\n", table, table->data, debugstr_w(string), flags, extra, extra_size);
if (!table)
return -1;
/* get corresponding offset */
offset = *get_bucket_ptr(table, string, case_sensitive);
if (offset == -1)
return -1;
/* now we're at correct bucket, do linear search for string */
while (1) {
entry = (struct stringentry*)(table->data + offset);
if (case_sensitive)
cmp = wcscmp(entry->data, string);
else
cmp = lstrcmpiW(entry->data, string);
if (!cmp) {
if (extra)
memcpy(extra, get_extradata_ptr(table, offset), extra_size);
return offset;
}
/* last entry */
if (entry->nextoffset == -1)
return -1;
offset = entry->nextoffset;
if (offset > table->allocated)
return -1;
}
}
/**************************************************************************
* StringTableLookUpString [SETUPAPI.@]
*
* Searches a string table for a given string.
*
* PARAMS
* hTable [I] Handle to the string table
* string [I] String to be searched for
* flags [I] Flags
* 1: case sensitive compare
*
* RETURNS
* Success: String ID
* Failure: -1
*/
DWORD WINAPI StringTableLookUpString(HSTRING_TABLE hTable, LPWSTR string, DWORD flags)
{
return StringTableLookUpStringEx(hTable, string, flags, NULL, 0);
}
/**************************************************************************
* StringTableAddStringEx [SETUPAPI.@]
*
* Adds a new string plus extra data to the string table.
*
* PARAMS
* hTable [I] Handle to the string table
* string [I] String to be added to the string table
* flags [I] Flags
* 1: case sensitive compare
* extra [I] Pointer to the extra data
* extra_size [I] Size of the extra data
*
* RETURNS
* Success: String ID
* Failure: -1
*
* NOTES
* If the given string already exists in the string table it will not
* be added again. The ID of the existing string will be returned in
* this case.
*/
DWORD WINAPI StringTableAddStringEx(HSTRING_TABLE hTable, LPWSTR string,
DWORD flags, void *extra, DWORD extra_size)
{
struct stringtable *table = (struct stringtable*)hTable;
BOOL case_sensitive = flags & 1;
struct stringentry *entry;
DWORD id, *offset;
WCHAR *ptrW;
int len;
TRACE("%p %s %lx %p, %lu\n", hTable, debugstr_w(string), flags, extra, extra_size);
if (!table)
return -1;
id = StringTableLookUpStringEx(hTable, string, flags, NULL, 0);
if (id != -1)
return id;
/* needed space for new record */
len = sizeof(DWORD) + (lstrlenW(string)+1)*sizeof(WCHAR) + table->max_extra_size;
if (table->nextoffset + len >= table->allocated) {
table->allocated <<= 1;
table->data = _recalloc(table->data, 1, table->allocated);
}
/* hash string */
offset = get_bucket_ptr(table, string, case_sensitive);
if (*offset == -1)
/* bucket used for a very first time */
*offset = table->nextoffset;
else {
entry = (struct stringentry*)(table->data + *offset);
/* link existing last entry to newly added */
while (entry->nextoffset != -1)
entry = (struct stringentry*)(table->data + entry->nextoffset);
entry->nextoffset = table->nextoffset;
}
entry = (struct stringentry*)(table->data + table->nextoffset);
entry->nextoffset = -1;
id = table->nextoffset;
/* copy string */
ptrW = get_string_ptr(table, id);
lstrcpyW(ptrW, string);
if (!case_sensitive)
wcslwr(ptrW);
/* copy extra data */
if (extra)
memcpy(get_extradata_ptr(table, id), extra, extra_size);
table->nextoffset += len;
return id;
}
/**************************************************************************
* StringTableAddString [SETUPAPI.@]
*
* Adds a new string to the string table.
*
* PARAMS
* hTable [I] Handle to the string table
* string [I] String to be added to the string table
* flags [I] Flags
* 1: case sensitive compare
*
* RETURNS
* Success: String ID
* Failure: -1
*
* NOTES
* If the given string already exists in the string table it will not
* be added again. The ID of the existing string will be returned in
* this case.
*/
DWORD WINAPI StringTableAddString(HSTRING_TABLE hTable, LPWSTR string, DWORD flags)
{
return StringTableAddStringEx(hTable, string, flags, NULL, 0);
}
/**************************************************************************
* StringTableSetExtraData [SETUPAPI.@]
*
* Sets extra data for a given string table entry.
*
* PARAMS
* hTable [I] Handle to the string table
* id [I] String ID
* extra [I] Pointer to the extra data
* extra_size [I] Size of the extra data
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI StringTableSetExtraData(HSTRING_TABLE hTable, DWORD id, void *extra, ULONG extra_size)
{
struct stringtable *table = (struct stringtable*)hTable;
char *extraptr;
TRACE("%p %ld %p %lu\n", hTable, id, extra, extra_size);
if (!table)
return FALSE;
if (!is_valid_string_id(table, id))
return FALSE;
if (table->max_extra_size < extra_size)
{
ERR("data size is too large\n");
return FALSE;
}
extraptr = get_extradata_ptr(table, id);
memset(extraptr, 0, table->max_extra_size);
memcpy(extraptr, extra, extra_size);
return TRUE;
}
/**************************************************************************
* StringTableStringFromId [SETUPAPI.@]
*
* Returns a pointer to a string for the given string ID.
*
* PARAMS
* hTable [I] Handle to the string table.
* id [I] String ID
*
* RETURNS
* Success: Pointer to the string
* Failure: NULL
*/
LPWSTR WINAPI StringTableStringFromId(HSTRING_TABLE hTable, ULONG id)
{
struct stringtable *table = (struct stringtable*)hTable;
static WCHAR empty[] = {0};
TRACE("%p %ld\n", table, id);
if (!table)
return NULL;
if (!is_valid_string_id(table, id))
return empty;
return get_string_ptr(table, id);
}
/**************************************************************************
* StringTableStringFromIdEx [SETUPAPI.@]
*
* Returns a string for the given string ID.
*
* PARAMS
* hTable [I] Handle to the string table
* id [I] String ID
* buff [I] Pointer to string buffer
* buflen [I/O] Pointer to the size of the string buffer
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI StringTableStringFromIdEx(HSTRING_TABLE hTable, ULONG id, LPWSTR buff, DWORD *buflen)
{
struct stringtable *table = (struct stringtable*)hTable;
BOOL ret = TRUE;
WCHAR *ptrW;
int len;
TRACE("%p %lx %p %p\n", table, id, buff, buflen);
if (!table) {
*buflen = 0;
return FALSE;
}
if (!is_valid_string_id(table, id)) {
WARN("invalid string id\n");
*buflen = 0;
return FALSE;
}
ptrW = get_string_ptr(table, id);
len = (lstrlenW(ptrW) + 1)*sizeof(WCHAR);
if (len <= *buflen)
lstrcpyW(buff, ptrW);
else
ret = FALSE;
*buflen = len;
return ret;
}
/**************************************************************************
* StringTableTrim [SETUPAPI.@]
*
* ...
*
* PARAMS
* hTable [I] Handle to the string table
*
* RETURNS
* None
*/
void WINAPI StringTableTrim(HSTRING_TABLE hTable)
{
FIXME("%p\n", hTable);
}

View File

@@ -365,6 +365,8 @@ setupapi -
dll/win32/setupapi/dialog.c # Synced to WineStaging-1.9.15
dll/win32/setupapi/query.c # Partially synced to Wine-4.8
dll/win32/setupapi/setupcab.c # Synced to WineStaging-1.9.4
dll/win32/setupapi/stringtable.c # Forked at Wine-1.7.18
dll/win32/setupapi/stringtable_wine.c # Synced to WineStaging-8.15
win32k -
win32ss/gdi/ntgdi/bezier.c # Synced to WineStaging-1.9.4 (gdi32/painting.c)

View File

@@ -35,7 +35,7 @@
#include "wine/test.h"
//DECLARE_HANDLE(HSTRING_TABLE);
DECLARE_HANDLE(HSTRING_TABLE);
/* Flags for StringTableAddString and StringTableLookUpString */
#define ST_CASE_SENSITIVE_COMPARE 0x00000001

View File

@@ -657,9 +657,6 @@ extern "C" {
#define SPREG_TIMEOUT 0x00000005
#define SPREG_UNKNOWN 0xFFFFFFFF
/* Flags for StringTableAddString and StringTableLookUpString */
#define ST_CASE_SENSITIVE_COMPARE 0x00000001
/* SetupUninstallOEMInf Flags values */
#define SUOI_FORCEDELETE 0x00000001
@@ -671,8 +668,6 @@ typedef PVOID HSPFILEQ;
typedef PVOID HSPFILELOG;
typedef UINT DI_FUNCTION;
typedef PVOID HSTRING_TABLE;
typedef enum {
SetupFileLogSourceFilename,
SetupFileLogChecksum,
@@ -1167,21 +1162,8 @@ typedef SP_REGISTER_CONTROL_STATUSA SP_REGISTER_CONTROL_STATUS, *PSP_REGISTER_CO
#endif /* UNICODE */
WINSETUPAPI LONG WINAPI AddTagToGroupOrderList(PCWSTR, DWORD, DWORD);
WINSETUPAPI VOID WINAPI AssertFail(LPSTR, UINT, LPSTR);
WINSETUPAPI DWORD WINAPI CaptureStringArg(PCWSTR, PWSTR*);
WINSETUPAPI BOOL WINAPI DelayedMove(PCWSTR, PCWSTR);
WINSETUPAPI BOOL WINAPI DoesUserHavePrivilege(PCWSTR);
WINSETUPAPI BOOL WINAPI FileExists(PCWSTR, PWIN32_FIND_DATAW);
WINSETUPAPI DWORD WINAPI GetSetFileTimestamp(PCWSTR, PFILETIME, PFILETIME, PFILETIME, BOOLEAN);
WINSETUPAPI VOID WINAPI InstallHinfSectionA(_In_ HWND, _In_ HINSTANCE, _In_ PCSTR, _In_ INT);
WINSETUPAPI VOID WINAPI InstallHinfSectionW(_In_ HWND, _In_ HINSTANCE, _In_ PCWSTR, _In_ INT);
WINSETUPAPI BOOL WINAPI IsUserAdmin(VOID);
WINSETUPAPI VOID WINAPI MyFree(PVOID);
WINSETUPAPI PVOID WINAPI MyMalloc(DWORD);
WINSETUPAPI PVOID WINAPI MyRealloc(PVOID, DWORD);
WINSETUPAPI LONG WINAPI QueryRegistryValue(HKEY, PCWSTR, PBYTE*, PDWORD, PDWORD);
WINSETUPAPI DWORD WINAPI RetreiveFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR*);
WINSETUPAPI BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(_In_ HDSKSPC, _In_ HINF, _In_opt_ HINF, _In_ PCSTR, _Reserved_ PVOID, _Reserved_ UINT);
WINSETUPAPI BOOL WINAPI SetupAddInstallSectionToDiskSpaceListW(_In_ HDSKSPC, _In_ HINF, _In_opt_ HINF, _In_ PCWSTR, _Reserved_ PVOID, _Reserved_ UINT);
@@ -2383,44 +2365,6 @@ SetupUninstallOEMInfW(
_In_ DWORD Flags,
_In_ PVOID Reserved);
WINSETUPAPI DWORD WINAPI StampFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR);
WINSETUPAPI DWORD WINAPI pSetupCaptureAndConvertAnsiArg(PCSTR, PWSTR*);
WINSETUPAPI VOID WINAPI pSetupCenterWindowRelativeToParent(HWND);
WINSETUPAPI BOOL WINAPI pSetupConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
WINSETUPAPI PWSTR WINAPI pSetupDuplicateString(PCWSTR);
WINSETUPAPI BOOL WINAPI pSetupEnablePrivilege(PCWSTR, BOOL);
WINSETUPAPI PWSTR WINAPI pSetupGetFileTitle(PCWSTR);
WINSETUPAPI BOOL WINAPI pSetupGetVersionInfoFromImage(LPWSTR, PULARGE_INTEGER, LPWORD);
WINSETUPAPI DWORD WINAPI pSetupGuidFromString(PCWSTR, LPGUID);
WINSETUPAPI BOOL WINAPI pSetupIsGuidNull(LPGUID);
WINSETUPAPI BOOL WINAPI pSetupIsUserAdmin(VOID);
WINSETUPAPI PWSTR WINAPI pSetupMultiByteToUnicode(PCSTR, UINT);
WINSETUPAPI DWORD WINAPI pSetupOpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID*);
WINSETUPAPI DWORD WINAPI pSetupStringFromGuid(LPGUID, PWSTR, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableAddString(HSTRING_TABLE, LPWSTR, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableAddStringEx(HSTRING_TABLE, LPWSTR, DWORD, LPVOID, DWORD);
WINSETUPAPI VOID WINAPI pSetupStringTableDestroy(HSTRING_TABLE);
WINSETUPAPI HSTRING_TABLE WINAPI pSetupStringTableDuplicate(HSTRING_TABLE);
WINSETUPAPI BOOL WINAPI pSetupStringTableGetExtraData(HSTRING_TABLE, DWORD, LPVOID, DWORD);
WINSETUPAPI HSTRING_TABLE WINAPI pSetupStringTableInitialize(VOID);
WINSETUPAPI HSTRING_TABLE WINAPI pSetupStringTableInitializeEx(DWORD, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableLookUpString(HSTRING_TABLE, LPWSTR, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableLookUpStringEx(HSTRING_TABLE, LPWSTR, DWORD, LPVOID, DWORD);
WINSETUPAPI BOOL WINAPI pSetupStringTableSetExtraData(HSTRING_TABLE, DWORD, LPVOID, DWORD);
WINSETUPAPI LPWSTR WINAPI pSetupStringTableStringFromId(HSTRING_TABLE, DWORD);
WINSETUPAPI BOOL WINAPI pSetupStringTableStringFromIdEx(HSTRING_TABLE, DWORD, LPWSTR, LPDWORD);
WINSETUPAPI PSTR WINAPI pSetupUnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage);
WINSETUPAPI BOOL WINAPI pSetupUnmapAndCloseFile(HANDLE, HANDLE, PVOID);
WINSETUPAPI DWORD WINAPI TakeOwnershipOfFile(PCWSTR);
WINSETUPAPI PSTR WINAPI UnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage);
/* for backward compatability */
#define SetupDiCreateInterfaceDeviceW SetupDiCreateDeviceInterfaceW
@@ -2689,4 +2633,3 @@ WINSETUPAPI PSTR WINAPI UnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage);
#include <poppack.h>
#endif /* _SETUPAPI_H_ */

View File

@@ -0,0 +1,84 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Private header for setupapi.dll
* COPYRIGHT: Copyright 2023 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
*/
#ifndef __SETUPAPI_UNDOC_H
#define __SETUPAPI_UNDOC_H
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
// typedef PVOID HSTRING_TABLE;
DECLARE_HANDLE(HSTRING_TABLE);
/* Flags for StringTableAddString and StringTableLookUpString */
#define ST_CASE_SENSITIVE_COMPARE 0x00000001
WINSETUPAPI DWORD WINAPI pSetupStringTableAddString(HSTRING_TABLE, LPWSTR, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableAddStringEx(HSTRING_TABLE, LPWSTR, DWORD, LPVOID, DWORD);
WINSETUPAPI VOID WINAPI pSetupStringTableDestroy(HSTRING_TABLE);
WINSETUPAPI HSTRING_TABLE WINAPI pSetupStringTableDuplicate(HSTRING_TABLE);
WINSETUPAPI BOOL WINAPI pSetupStringTableGetExtraData(HSTRING_TABLE, DWORD, LPVOID, DWORD);
WINSETUPAPI HSTRING_TABLE WINAPI pSetupStringTableInitialize(VOID);
WINSETUPAPI HSTRING_TABLE WINAPI pSetupStringTableInitializeEx(DWORD, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableLookUpString(HSTRING_TABLE, LPWSTR, DWORD);
WINSETUPAPI DWORD WINAPI pSetupStringTableLookUpStringEx(HSTRING_TABLE, LPWSTR, DWORD, LPVOID, DWORD);
WINSETUPAPI BOOL WINAPI pSetupStringTableSetExtraData(HSTRING_TABLE, DWORD, LPVOID, DWORD);
WINSETUPAPI LPWSTR WINAPI pSetupStringTableStringFromId(HSTRING_TABLE, DWORD);
WINSETUPAPI BOOL WINAPI pSetupStringTableStringFromIdEx(HSTRING_TABLE, DWORD, LPWSTR, LPDWORD);
WINSETUPAPI LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3); // Not exported
WINSETUPAPI VOID WINAPI AssertFail(LPSTR, UINT, LPSTR); // Not exported
WINSETUPAPI DWORD WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR* lpDst); // Not exported
WINSETUPAPI BOOL WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName); // Not exported
WINSETUPAPI BOOL WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName);
WINSETUPAPI PWSTR WINAPI DuplicateString(PCWSTR lpSrc); // Not exported
WINSETUPAPI BOOL WINAPI EnablePrivilege(PCWSTR lpPrivilegeName, BOOL bEnable); // Not exported
WINSETUPAPI BOOL WINAPI FileExists(PCWSTR lpFileName, PWIN32_FIND_DATAW lpFileFindData); // Not exported
WINSETUPAPI DWORD WINAPI GetSetFileTimestamp(PCWSTR, PFILETIME, PFILETIME, PFILETIME, BOOLEAN); // Not exported
WINSETUPAPI BOOL WINAPI IsUserAdmin(VOID);
WINSETUPAPI PWSTR WINAPI MultiByteToUnicode(PCSTR lpMultiByteStr, UINT uCodePage); // Not exported
WINSETUPAPI VOID WINAPI MyFree(PVOID lpMem);
WINSETUPAPI PVOID WINAPI MyMalloc(DWORD dwSize);
WINSETUPAPI PVOID WINAPI MyRealloc(PVOID lpSrc, DWORD dwSize);
WINSETUPAPI DWORD WINAPI OpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID*); // Not exported
WINSETUPAPI LONG WINAPI QueryRegistryValue(HKEY, PCWSTR, PBYTE*, PDWORD, PDWORD); // Not exported
/* RetreiveFileSecurity is not a typo, as per Microsoft's dlls */
WINSETUPAPI DWORD WINAPI RetreiveFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR*); // Not exported
WINSETUPAPI DWORD WINAPI StampFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR); // Not exported
WINSETUPAPI DWORD WINAPI TakeOwnershipOfFile(PCWSTR); // Not exported
WINSETUPAPI PSTR WINAPI UnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage);
WINSETUPAPI BOOL WINAPI UnmapAndCloseFile(HANDLE, HANDLE, PVOID); // Not exported
WINSETUPAPI DWORD WINAPI pSetupCaptureAndConvertAnsiArg(PCSTR, PWSTR*);
WINSETUPAPI VOID WINAPI pSetupCenterWindowRelativeToParent(HWND);
WINSETUPAPI BOOL WINAPI pSetupConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
WINSETUPAPI PWSTR WINAPI pSetupDuplicateString(PCWSTR);
WINSETUPAPI BOOL WINAPI pSetupEnablePrivilege(PCWSTR, BOOL);
WINSETUPAPI PWSTR WINAPI pSetupGetFileTitle(PCWSTR);
WINSETUPAPI BOOL WINAPI pSetupGetVersionInfoFromImage(LPWSTR, PULARGE_INTEGER, LPWORD);
WINSETUPAPI DWORD WINAPI pSetupGuidFromString(PCWSTR, LPGUID);
WINSETUPAPI BOOL WINAPI pSetupIsGuidNull(LPGUID);
WINSETUPAPI BOOL WINAPI pSetupIsUserAdmin(VOID);
WINSETUPAPI PWSTR WINAPI pSetupMultiByteToUnicode(PCSTR, UINT);
WINSETUPAPI DWORD WINAPI pSetupOpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID*);
WINSETUPAPI DWORD WINAPI pSetupStringFromGuid(LPGUID, PWSTR, DWORD);
WINSETUPAPI PSTR WINAPI pSetupUnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage);
WINSETUPAPI BOOL WINAPI pSetupUnmapAndCloseFile(HANDLE, HANDLE, PVOID);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __SETUPAPI_UNDOC_H

View File

@@ -0,0 +1,5 @@
directories: null
files:
dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable_wine.c
tags:
wine: wine-8.15