MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / cmdDisable

Function cmdDisable

Drivers/Driver-SRC/setup/devcon/cmds.cpp:934–1005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932}
933
934int cmdDisable(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
935/*++
936
937Routine Description:
938
939 DISABLE <id> ...
940 use EnumerateDevices to do hardwareID matching
941 for each match, attempt to disable global
942
943Arguments:
944
945 BaseName - name of executable
946 Machine - must be NULL (local machine only)
947 argc/argv - remaining parameters - passed into EnumerateDevices
948
949Return Value:
950
951 EXIT_xxxx (EXIT_REBOOT if reboot is required)
952
953--*/
954{
955 GenericContext context;
956 TCHAR strDisable[80];
957 TCHAR strReboot[80];
958 TCHAR strFail[80];
959 int failcode = EXIT_FAIL;
960
961 UNREFERENCED_PARAMETER(Flags);
962
963 if(!argc) {
964 //
965 // arguments required
966 //
967 return EXIT_USAGE;
968 }
969 if(Machine) {
970 //
971 // must be local machine as we need to involve class/co installers
972 //
973 return EXIT_USAGE;
974 }
975 if(!LoadString(NULL,IDS_DISABLED,strDisable,ARRAYSIZE(strDisable))) {
976 return EXIT_FAIL;
977 }
978 if(!LoadString(NULL,IDS_DISABLED_REBOOT,strReboot,ARRAYSIZE(strReboot))) {
979 return EXIT_FAIL;
980 }
981 if(!LoadString(NULL,IDS_DISABLE_FAILED,strFail,ARRAYSIZE(strFail))) {
982 return EXIT_FAIL;
983 }
984
985 context.control = DICS_DISABLE; // DICS_PROPCHANGE DICS_ENABLE DICS_DISABLE
986 context.reboot = FALSE;
987 context.count = 0;
988 context.strReboot = strReboot;
989 context.strSuccess = strDisable;
990 context.strFail = strFail;
991 failcode = EnumerateDevices(BaseName,Machine,DIGCF_PRESENT,argc,argv,ControlCallback,&context);

Callers

nothing calls this directly

Calls 2

EnumerateDevicesFunction · 0.85
FormatToStreamFunction · 0.85

Tested by

no test coverage detected