mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
fix memmory coruption in EnumDisplaySettingsExA
do not alloc memmory with heap. svn path=/trunk/; revision=15542
This commit is contained in:
parent
68f4fc41bc
commit
b73c53c40c
1 changed files with 7 additions and 15 deletions
|
@ -200,15 +200,7 @@ EnumDisplaySettingsExA(
|
|||
{
|
||||
BOOL rc;
|
||||
UNICODE_STRING DeviceName;
|
||||
LPDEVMODEW lpDevModeW;
|
||||
|
||||
lpDevModeW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DEVMODEW) + lpDevMode->dmDriverExtra);
|
||||
if ( lpDevModeW == NULL )
|
||||
{
|
||||
SetLastError ( ERROR_OUTOFMEMORY );
|
||||
return FALSE;
|
||||
}
|
||||
DEVMODEW lpDevModeW;
|
||||
|
||||
if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName, (PCSZ)lpszDeviceName ) )
|
||||
{
|
||||
|
@ -216,16 +208,16 @@ EnumDisplaySettingsExA(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
lpDevModeW->dmSize = sizeof(DEVMODEW);
|
||||
lpDevModeW->dmDriverExtra = 0;
|
||||
|
||||
rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, lpDevModeW,
|
||||
memset(&lpDevModeW,0,sizeof(DEVMODEW));
|
||||
lpDevModeW.dmSize = sizeof(DEVMODEW);
|
||||
|
||||
rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, &lpDevModeW,
|
||||
dwFlags );
|
||||
|
||||
RosRtlDevModeW2A ( lpDevMode, lpDevModeW );
|
||||
RosRtlDevModeW2A ( lpDevMode, &lpDevModeW );
|
||||
|
||||
RtlFreeUnicodeString ( &DeviceName );
|
||||
HeapFree ( GetProcessHeap(), 0, lpDevModeW );
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue