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

Function cmdEnable

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

Source from the content-addressed store, hash-verified

859}
860
861int cmdEnable(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
862/*++
863
864Routine Description:
865
866 ENABLE <id> ...
867 use EnumerateDevices to do hardwareID matching
868 for each match, attempt to enable global, and if needed, config specific
869
870Arguments:
871
872 BaseName - name of executable
873 Machine - must be NULL (local machine only)
874 argc/argv - remaining parameters - passed into EnumerateDevices
875
876Return Value:
877
878 EXIT_xxxx (EXIT_REBOOT if reboot is required)
879
880--*/
881{
882 GenericContext context;
883 TCHAR strEnable[80];
884 TCHAR strReboot[80];
885 TCHAR strFail[80];
886 int failcode = EXIT_FAIL;
887
888 UNREFERENCED_PARAMETER(Flags);
889
890 if(!argc) {
891 //
892 // arguments required
893 //
894 return EXIT_USAGE;
895 }
896 if(Machine) {
897 //
898 // must be local machine as we need to involve class/co installers
899 //
900 return EXIT_USAGE;
901 }
902 if(!LoadString(NULL,IDS_ENABLED,strEnable,ARRAYSIZE(strEnable))) {
903 return EXIT_FAIL;
904 }
905 if(!LoadString(NULL,IDS_ENABLED_REBOOT,strReboot,ARRAYSIZE(strReboot))) {
906 return EXIT_FAIL;
907 }
908 if(!LoadString(NULL,IDS_ENABLE_FAILED,strFail,ARRAYSIZE(strFail))) {
909 return EXIT_FAIL;
910 }
911
912 context.control = DICS_ENABLE; // DICS_PROPCHANGE DICS_ENABLE DICS_DISABLE
913 context.reboot = FALSE;
914 context.count = 0;
915 context.strReboot = strReboot;
916 context.strSuccess = strEnable;
917 context.strFail = strFail;
918 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