mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Implement StringTableDuplicate.
svn path=/trunk/; revision=16383
This commit is contained in:
parent
396b274742
commit
d23d39a743
4 changed files with 77 additions and 4 deletions
|
@ -838,6 +838,7 @@ DWORD WINAPI StampFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR);
|
|||
|
||||
DWORD WINAPI StringTableAddString(HSTRING_TABLE, LPWSTR, DWORD);
|
||||
VOID WINAPI StringTableDestroy(HSTRING_TABLE);
|
||||
HSTRING_TABLE WINAPI StringTableDuplicate(HSTRING_TABLE);
|
||||
HSTRING_TABLE WINAPI StringTableInitialize(VOID);
|
||||
DWORD WINAPI StringTableLookUpString(HSTRING_TABLE, LPWSTR, DWORD);
|
||||
LPWSTR WINAPI StringTableStringFromId(HSTRING_TABLE, DWORD);
|
||||
|
|
|
@ -516,7 +516,7 @@
|
|||
@ stdcall StringTableAddString(ptr wstr long)
|
||||
@ stub StringTableAddStringEx
|
||||
@ stdcall StringTableDestroy(ptr)
|
||||
@ stub StringTableDuplicate
|
||||
@ stdcall StringTableDuplicate(ptr)
|
||||
@ stub StringTableEnum
|
||||
@ stub StringTableGetExtraData
|
||||
@ stdcall StringTableInitialize()
|
||||
|
|
|
@ -36,9 +36,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
|||
|
||||
typedef struct _STRING_TABLE
|
||||
{
|
||||
LPWSTR *pSlots; /* 0x00 */
|
||||
DWORD dwUsedSlots; /* 0x04 */
|
||||
DWORD dwMaxSlots; /* 0x08 */
|
||||
LPWSTR *pSlots;
|
||||
DWORD dwUsedSlots;
|
||||
DWORD dwMaxSlots;
|
||||
} STRING_TABLE, *PSTRING_TABLE;
|
||||
|
||||
|
||||
|
@ -221,6 +221,77 @@ StringTableAddString(HSTRING_TABLE hStringTable,
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* StringTableDuplicate [SETUPAPI.@]
|
||||
*
|
||||
* Duplicates a given string table.
|
||||
*
|
||||
* PARAMS
|
||||
* hStringTable [I] Handle to the string table
|
||||
*
|
||||
* RETURNS
|
||||
* Success: Handle to the duplicated string table
|
||||
* Failure: NULL
|
||||
*
|
||||
*/
|
||||
HSTRING_TABLE WINAPI
|
||||
StringTableDuplicate(HSTRING_TABLE hStringTable)
|
||||
{
|
||||
PSTRING_TABLE pSourceTable;
|
||||
PSTRING_TABLE pDestinationTable;
|
||||
DWORD i;
|
||||
DWORD length;
|
||||
|
||||
TRACE("%p\n", (PVOID)hStringTable);
|
||||
|
||||
pSourceTable = (PSTRING_TABLE)hStringTable;
|
||||
if (pSourceTable == NULL)
|
||||
{
|
||||
ERR("Invalid hStringTable!\n");
|
||||
return (HSTRING_TABLE)NULL;
|
||||
}
|
||||
|
||||
pDestinationTable = MyMalloc(sizeof(STRING_TABLE));
|
||||
if (pDestinationTable == NULL)
|
||||
{
|
||||
ERR("Cound not allocate a new string table!\n");
|
||||
return (HSTRING_TABLE)NULL;
|
||||
}
|
||||
|
||||
memset(pDestinationTable, 0, sizeof(STRING_TABLE));
|
||||
|
||||
pDestinationTable->pSlots = MyMalloc(sizeof(LPWSTR) * pSourceTable->dwMaxSlots);
|
||||
if (pDestinationTable->pSlots == NULL)
|
||||
{
|
||||
MyFree(pDestinationTable);
|
||||
return (HSTRING_TABLE)NULL;
|
||||
}
|
||||
|
||||
memset(pDestinationTable->pSlots, 0, sizeof(LPWSTR) * pSourceTable->dwMaxSlots);
|
||||
|
||||
pDestinationTable->dwUsedSlots = 0;
|
||||
pDestinationTable->dwMaxSlots = pSourceTable->dwMaxSlots;
|
||||
|
||||
for (i = 0; i < pSourceTable->dwMaxSlots; i++)
|
||||
{
|
||||
if (pSourceTable->pSlots[i] != NULL)
|
||||
{
|
||||
length = lstrlenW(pSourceTable->pSlots[i]) + sizeof(WCHAR);
|
||||
pDestinationTable->pSlots[i] = MyMalloc(length);
|
||||
if (pDestinationTable->pSlots[i] != NULL)
|
||||
{
|
||||
memcpy(pDestinationTable->pSlots[i],
|
||||
pSourceTable->pSlots[i],
|
||||
length);
|
||||
pDestinationTable->dwUsedSlots++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (HSTRING_TABLE)pDestinationTable;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* StringTableLookUpString [SETUPAPI.@]
|
||||
*
|
||||
|
|
|
@ -1350,6 +1350,7 @@ WINSETUPAPI DWORD WINAPI StampFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR);
|
|||
|
||||
WINSETUPAPI DWORD WINAPI StringTableAddString(HSTRING_TABLE, LPWSTR, DWORD);
|
||||
WINSETUPAPI VOID WINAPI StringTableDestroy(HSTRING_TABLE);
|
||||
WINSETUPAPI HSTRING_TABLE WINAPI StringTableDuplicate(HSTRING_TABLE);
|
||||
WINSETUPAPI HSTRING_TABLE WINAPI StringTableInitialize(VOID);
|
||||
WINSETUPAPI DWORD WINAPI StringTableLookUpString(HSTRING_TABLE, LPWSTR, DWORD);
|
||||
WINSETUPAPI LPWSTR WINAPI StringTableStringFromId(HSTRING_TABLE, DWORD);
|
||||
|
|
Loading…
Reference in a new issue