mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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;
|
BOOL rc;
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
LPDEVMODEW lpDevModeW;
|
DEVMODEW lpDevModeW;
|
||||||
|
|
||||||
lpDevModeW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
||||||
sizeof(DEVMODEW) + lpDevMode->dmDriverExtra);
|
|
||||||
if ( lpDevModeW == NULL )
|
|
||||||
{
|
|
||||||
SetLastError ( ERROR_OUTOFMEMORY );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName, (PCSZ)lpszDeviceName ) )
|
if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName, (PCSZ)lpszDeviceName ) )
|
||||||
{
|
{
|
||||||
|
@ -216,16 +208,16 @@ EnumDisplaySettingsExA(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
lpDevModeW->dmSize = sizeof(DEVMODEW);
|
memset(&lpDevModeW,0,sizeof(DEVMODEW));
|
||||||
lpDevModeW->dmDriverExtra = 0;
|
lpDevModeW.dmSize = sizeof(DEVMODEW);
|
||||||
|
|
||||||
rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, lpDevModeW,
|
rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, &lpDevModeW,
|
||||||
dwFlags );
|
dwFlags );
|
||||||
|
|
||||||
RosRtlDevModeW2A ( lpDevMode, lpDevModeW );
|
RosRtlDevModeW2A ( lpDevMode, &lpDevModeW );
|
||||||
|
|
||||||
RtlFreeUnicodeString ( &DeviceName );
|
RtlFreeUnicodeString ( &DeviceName );
|
||||||
HeapFree ( GetProcessHeap(), 0, lpDevModeW );
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue