CopyAcceleratorTableA: dont access lpAccelDst it its NULL (w3seek)

svn path=/trunk/; revision=14254
This commit is contained in:
Gunnar Dalsnes 2005-03-21 17:11:48 +00:00
parent 0ac49e9d42
commit 4dcc066ed7

View file

@ -285,38 +285,34 @@ HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccl, int cEntries)
} }
/*
* @implemented
*/
int WINAPI CopyAcceleratorTableA int WINAPI CopyAcceleratorTableA
( (
HACCEL hAccelSrc, HACCEL hAccelSrc,
LPACCEL lpAccelDst, LPACCEL lpAccelDst, /* can be NULL */
int cAccelEntries int cAccelEntries
) )
{ {
int i; int i;
cAccelEntries = CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries); cAccelEntries = CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries);
if(cAccelEntries == 0) return 0; if (lpAccelDst == NULL) return cAccelEntries;
for(i = 0; i < cAccelEntries; ++ i) for(i = 0; i < cAccelEntries; ++ i)
if(!(lpAccelDst[i].fVirt & FVIRTKEY)) if(!(lpAccelDst[i].fVirt & FVIRTKEY))
{ {
NTSTATUS nErrCode = RtlUnicodeToMultiByteN NTSTATUS nErrCode = RtlUnicodeToMultiByteN(
( (PCHAR)&lpAccelDst[i].key,
(PCHAR)&lpAccelDst[i].key, sizeof(lpAccelDst[i].key),
sizeof(lpAccelDst[i].key), NULL,
NULL, (PWCHAR)&lpAccelDst[i].key,
(PWCHAR)&lpAccelDst[i].key, sizeof(lpAccelDst[i].key)
sizeof(lpAccelDst[i].key) );
);
if(!NT_SUCCESS(nErrCode)) lpAccelDst[i].key = 0; if(!NT_SUCCESS(nErrCode)) lpAccelDst[i].key = 0;
} }
return cAccelEntries; return cAccelEntries;
} }