mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 05:52:57 +00:00
[WIN32SS:ENG] Do not allocate 0 bytes if no monitor is reported
Addendum to 2f00ca4663
This commit is contained in:
parent
4534537036
commit
9f21cc3e98
1 changed files with 19 additions and 14 deletions
|
@ -616,23 +616,28 @@ EngpUpdateMonitorDevices(
|
|||
pGraphicsDevice->pvMonDev = NULL;
|
||||
pGraphicsDevice->dwMonCnt = 0;
|
||||
}
|
||||
pGraphicsDevice->pvMonDev = ExAllocatePoolZero(PagedPool,
|
||||
monitorCount * sizeof(VIDEO_MONITOR_DEVICE),
|
||||
GDITAG_GDEVICE);
|
||||
if (!pGraphicsDevice->pvMonDev)
|
||||
|
||||
if (monitorCount > 0)
|
||||
{
|
||||
for (i = 0; pMonitorDevices[i].pdo; ++i)
|
||||
ObDereferenceObject(pMonitorDevices[i].pdo);
|
||||
ExFreePool(pMonitorDevices);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
pGraphicsDevice->pvMonDev = ExAllocatePoolZero(PagedPool,
|
||||
monitorCount * sizeof(VIDEO_MONITOR_DEVICE),
|
||||
GDITAG_GDEVICE);
|
||||
if (!pGraphicsDevice->pvMonDev)
|
||||
{
|
||||
for (i = 0; pMonitorDevices[i].pdo; ++i)
|
||||
ObDereferenceObject(pMonitorDevices[i].pdo);
|
||||
ExFreePool(pMonitorDevices);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Copy data */
|
||||
for (i = 0; i < monitorCount; i++)
|
||||
{
|
||||
TRACE("%S\\Monitor%u: PDO %p HwID %u\n", pGraphicsDevice->szWinDeviceName, i, pMonitorDevices[i].pdo, pMonitorDevices[i].HwID);
|
||||
pGraphicsDevice->pvMonDev[pGraphicsDevice->dwMonCnt++] = pMonitorDevices[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy data */
|
||||
for (i = 0; i < monitorCount; i++)
|
||||
{
|
||||
TRACE("%S\\Monitor%u: PDO %p HwID %u\n", pGraphicsDevice->szWinDeviceName, i, pMonitorDevices[i].pdo, pMonitorDevices[i].HwID);
|
||||
pGraphicsDevice->pvMonDev[pGraphicsDevice->dwMonCnt++] = pMonitorDevices[i];
|
||||
}
|
||||
ExFreePool(pMonitorDevices);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue