-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinMain.c
More file actions
31 lines (27 loc) · 1.28 KB
/
Copy pathWinMain.c
File metadata and controls
31 lines (27 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <initguid.h>
#include <windows.h>
#include <setupapi.h>
#include <devguid.h>
int WinMainCRTStartup()
{
HDEVINFO DeviceInfoSet = SetupDiGetClassDevsW(&GUID_DEVCLASS_DISPLAY, NULL, NULL, DIGCF_PRESENT);
SP_DEVINFO_DATA DeviceInfoData = {.cbSize = sizeof(SP_DEVINFO_DATA)};
SP_PROPCHANGE_PARAMS PropChangeParams = {
.ClassInstallHeader = {.cbSize = sizeof(SP_CLASSINSTALL_HEADER), .InstallFunction = DIF_PROPERTYCHANGE},
.Scope = DICS_FLAG_GLOBAL,
.HwProfile = 0};
for (DWORD MemberIndex = 0; SetupDiEnumDeviceInfo(DeviceInfoSet, MemberIndex, &DeviceInfoData); MemberIndex++)
{
PropChangeParams.StateChange = DICS_DISABLE;
SetupDiSetClassInstallParamsW(DeviceInfoSet, &DeviceInfoData, &PropChangeParams.ClassInstallHeader,
sizeof(SP_PROPCHANGE_PARAMS));
SetupDiChangeState(DeviceInfoSet, &DeviceInfoData);
PropChangeParams.StateChange = DICS_ENABLE;
SetupDiSetClassInstallParamsW(DeviceInfoSet, &DeviceInfoData, &PropChangeParams.ClassInstallHeader,
sizeof(SP_PROPCHANGE_PARAMS));
SetupDiChangeState(DeviceInfoSet, &DeviceInfoData);
}
SetupDiDestroyDeviceInfoList(DeviceInfoSet);
ExitProcess(0);
return 0;
}