CopyAcceleratorTableA: dont access lpAccelDst it its NULL (w3seek)
Modified: trunk/reactos/lib/user32/windows/accel.c
_____
Modified: trunk/reactos/lib/user32/windows/accel.c
--- trunk/reactos/lib/user32/windows/accel.c 2005-03-21 17:09:06 UTC
(rev 14253)
+++ trunk/reactos/lib/user32/windows/accel.c 2005-03-21 17:11:48 UTC
(rev 14254)
@@ -285,38 +285,34 @@
}
-/*
- * @implemented
- */
int WINAPI CopyAcceleratorTableA
(
HACCEL hAccelSrc,
- LPACCEL lpAccelDst,
+ LPACCEL lpAccelDst, /* can be NULL */
int cAccelEntries
)
{
- int i;
-
- cAccelEntries = CopyAcceleratorTableW(hAccelSrc, lpAccelDst,
cAccelEntries);
+ int i;
- if(cAccelEntries == 0) return 0;
+ cAccelEntries = CopyAcceleratorTableW(hAccelSrc, lpAccelDst,
cAccelEntries);
+
+ if (lpAccelDst == NULL) return cAccelEntries;
- for(i = 0; i < cAccelEntries; ++ i)
- if(!(lpAccelDst[i].fVirt & FVIRTKEY))
- {
- NTSTATUS nErrCode = RtlUnicodeToMultiByteN
- (
- (PCHAR)&lpAccelDst[i].key,
- sizeof(lpAccelDst[i].key),
- NULL,
- (PWCHAR)&lpAccelDst[i].key,
- sizeof(lpAccelDst[i].key)
- );
-
- if(!NT_SUCCESS(nErrCode)) lpAccelDst[i].key = 0;
- }
-
- return cAccelEntries;
+ for(i = 0; i < cAccelEntries; ++ i)
+ if(!(lpAccelDst[i].fVirt & FVIRTKEY))
+ {
+ NTSTATUS nErrCode = RtlUnicodeToMultiByteN(
+ (PCHAR)&lpAccelDst[i].key,
+ sizeof(lpAccelDst[i].key),
+ NULL,
+ (PWCHAR)&lpAccelDst[i].key,
+ sizeof(lpAccelDst[i].key)
+ );
+
+ if(!NT_SUCCESS(nErrCode)) lpAccelDst[i].key = 0;
+ }
+
+ return cAccelEntries;
}
Show replies by date