Author: cwittich
Date: Fri Apr 17 23:37:13 2009
New Revision: 40561
URL:
http://svn.reactos.org/svn/reactos?rev=40561&view=rev
Log:
don't crash on setupapi stringtable winetest
Modified:
trunk/reactos/dll/win32/setupapi/stringtable.c
Modified: trunk/reactos/dll/win32/setupapi/stringtable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/stringt…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/stringtable.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/stringtable.c [iso-8859-1] Fri Apr 17 23:37:13 2009
@@ -607,13 +607,14 @@
PSTRING_TABLE pStringTable;
DWORD i;
- TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
+ TRACE("%p %s %x %p, %x\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 */
@@ -625,10 +626,12 @@
{
if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
{
- memcpy(lpExtraData,
- pStringTable->pSlots[i].pData,
- pStringTable->pSlots[i].dwSize);
- *lpReserved = 0;
+ if (lpExtraData)
+ {
+ memcpy(lpExtraData,
+ pStringTable->pSlots[i].pData,
+ pStringTable->pSlots[i].dwSize);
+ }
return i + 1;
}
}
@@ -636,10 +639,12 @@
{
if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
{
- memcpy(lpExtraData,
- pStringTable->pSlots[i].pData,
- pStringTable->pSlots[i].dwSize);
- *lpReserved = 0;
+ if (lpExtraData)
+ {
+ memcpy(lpExtraData,
+ pStringTable->pSlots[i].pData,
+ pStringTable->pSlots[i].dwSize);
+ }
return i + 1;
}
}