bool DisableDevices( PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, Stack *pDevPropertiesStack) { EnumParams enumParams; int res; enumParams.pRebootRequired = pRebootRequired; enumParams.pDevProperties = pDevProperties; enumParams.pStack = pDevPropertiesStack; do { res = EnumDevices(pFilter, DIGCF_PRESENT, DisableDevice, &enumParams); } while (res == IDTRYAGAIN); if (res != IDCONTINUE) return FALSE; if (!WaitNoPendingInstallEvents(10)) Sleep(1000); return TRUE; }
BOOLEAN DisableUserModePnpManager(VOID) { /* Wait until all pending installations are done, then freeze the threads */ if (WaitNoPendingInstallEvents(NULL) != STATUS_WAIT_0) DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n"); // TODO: use signalling events NtSuspendThread(hPnpThread, NULL); NtSuspendThread(hDeviceInstallThread, NULL); return TRUE; }