/* * MainWindowOnRefresh * * Purpose: * * Main Window Refresh handler. * */ VOID MainWindowOnRefresh( _In_ HWND hwnd ) { LPWSTR CurrentObject; SIZE_T len; UNREFERENCED_PARAMETER(hwnd); supSetWaitCursor(TRUE); if (g_kdctx.hDevice != NULL) { ObListDestroy(&g_kdctx.ObjectList); if (g_kdctx.hThreadWorker) { WaitForSingleObject(g_kdctx.hThreadWorker, INFINITE); CloseHandle(g_kdctx.hThreadWorker); g_kdctx.hThreadWorker = NULL; } //query object list info g_kdctx.hThreadWorker = CreateThread(NULL, 0, kdQueryProc, &g_kdctx, 0, NULL); } supFreeSCMSnapshot(g_enumParams.scmSnapshot); sapiFreeSnapshot(g_enumParams.sapiDB); RtlSecureZeroMemory(&g_enumParams, sizeof(g_enumParams)); g_enumParams.scmSnapshot = supCreateSCMSnapshot(&g_enumParams.scmNumberOfEntries); g_enumParams.sapiDB = sapiCreateSetupDBSnapshot(); g_enumParams.lpSubDirName = CurrentObjectPath; len = _strlen(CurrentObjectPath); CurrentObject = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len + 1)*sizeof(WCHAR)); if (CurrentObject) _strcpy(CurrentObject, CurrentObjectPath); TreeView_DeleteAllItems(ObjectTree); ListObjectDirectoryTree(L"\\", NULL, NULL); TreeView_SelectItem(ObjectTree, TreeView_GetRoot(ObjectTree)); if (CurrentObject) { ListToObject(CurrentObject); HeapFree(GetProcessHeap(), 0, CurrentObject); } supSetWaitCursor(FALSE); }
/* * MainWindowOnRefresh * * Purpose: * * Main Window Refresh handler. * */ VOID MainWindowOnRefresh( _In_ HWND hwnd ) { LPWSTR CurrentPath = NULL; SIZE_T len; UNREFERENCED_PARAMETER(hwnd); supSetWaitCursor(TRUE); if (g_kdctx.hDevice != NULL) { ObListDestroy(&g_kdctx.ObjectList); if (g_kdctx.hThreadWorker) { WaitForSingleObject(g_kdctx.hThreadWorker, INFINITE); CloseHandle(g_kdctx.hThreadWorker); g_kdctx.hThreadWorker = NULL; } //query object list info g_kdctx.hThreadWorker = CreateThread(NULL, 0, kdQueryProc, &g_kdctx, 0, NULL); } supFreeSCMSnapshot(); sapiFreeSnapshot(); supCreateSCMSnapshot(); sapiCreateSetupDBSnapshot(); len = _strlen(g_WinObj.CurrentObjectPath); CurrentPath = supHeapAlloc((len + 1) * sizeof(WCHAR)); if (CurrentPath) _strcpy(CurrentPath, g_WinObj.CurrentObjectPath); TreeView_DeleteAllItems(g_hwndObjectTree); ListObjectDirectoryTree(L"\\", NULL, NULL); TreeView_SelectItem(g_hwndObjectTree, TreeView_GetRoot(g_hwndObjectTree)); if (CurrentPath) { ListToObject(CurrentPath); supHeapFree(CurrentPath); } supSetWaitCursor(FALSE); }
/* * supShutdown * * Purpose: * * Free support subset related resources. * * Must be called once in the end of program execution. * */ VOID supShutdown( VOID ) { kdShutdown(); supFreeSCMSnapshot(g_enumParams.scmSnapshot); sapiFreeSnapshot(g_enumParams.sapiDB); if (g_pObjectTypesInfo) HeapFree(GetProcessHeap(), 0, g_pObjectTypesInfo); if (TreeViewImages) ImageList_Destroy(TreeViewImages); if (ListViewImages) ImageList_Destroy(ListViewImages); if (ToolBarMenuImages) ImageList_Destroy(ToolBarMenuImages); if (g_lpKnownDlls32) HeapFree(GetProcessHeap(), 0, g_lpKnownDlls32); if (g_lpKnownDlls64) HeapFree(GetProcessHeap(), 0, g_lpKnownDlls64); }