Patch by Christoph v.W.:
- speed-up adding items to ListView
- fix resource leak (GetDC without ReleaseDC)
(Bug #870)
Modified: trunk/reactos/subsys/system/devmgr/devmgr.c
_____
Modified: trunk/reactos/subsys/system/devmgr/devmgr.c
--- trunk/reactos/subsys/system/devmgr/devmgr.c 2005-10-06 14:31:18 UTC
(rev 18295)
+++ trunk/reactos/subsys/system/devmgr/devmgr.c 2005-10-06 15:02:50 UTC
(rev 18296)
@@ -93,6 +93,8 @@
long Size;
long rc;
+ SendMessage(hwndListView, WM_SETREDRAW, FALSE, 0);
+
ListView_DeleteAllItems(hwndListView);
while (1)
{
@@ -187,6 +189,7 @@
}
SetupDiDestroyDeviceInfoList(hDevInfo);
}
+ SendMessage(hwndListView, WM_SETREDRAW, TRUE, 0);
}
CONFIGRET GetDeviceName(DEVINST DevInst, LPTSTR Buffer, DWORD
BufferLength)
@@ -271,8 +274,9 @@
_tprintf(_T("CM_Locate_DevNode() failed, cr= 0x%lx\n"),
cr);
return 1;
}
-
+ SendMessage(hwndListView, WM_SETREDRAW, FALSE, 0);
cr = ListSubNodes(root, 0);
+ SendMessage(hwndListView, WM_SETREDRAW, TRUE, 0);
if (cr != CR_SUCCESS)
return 2;
return 0;
@@ -304,6 +308,7 @@
i = 0;
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
+ SendMessage(hwndListView, WM_SETREDRAW, FALSE, 0);
while (TRUE)
{
if (!SetupDiEnumDeviceInterfaces(
@@ -332,6 +337,7 @@
}
}
+ SendMessage(hwndListView, WM_SETREDRAW, TRUE, 0);
SetupDiDestroyDeviceInfoList(hDevInfo);
return 0;
}
@@ -484,6 +490,7 @@
ResizeListView(hWnd);
break;
case WM_DESTROY:
+ ReleaseDC(hWnd, hDC);
PostQuitMessage(0);
break;
case WM_COMMAND:
Show replies by date