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

Function cmdRestart

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

Source from the content-addressed store, hash-verified

1005}
1006
1007int cmdRestart(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
1008/*++
1009
1010Routine Description:
1011
1012 RESTART <id> ...
1013 use EnumerateDevices to do hardwareID matching
1014 for each match, attempt to restart by issueing a PROPCHANGE
1015
1016Arguments:
1017
1018 BaseName - name of executable
1019 Machine - must be NULL (local machine only)
1020 argc/argv - remaining parameters - passed into EnumerateDevices
1021
1022Return Value:
1023
1024 EXIT_xxxx (EXIT_REBOOT if reboot is required)
1025
1026--*/
1027{
1028 GenericContext context;
1029 TCHAR strRestarted[80];
1030 TCHAR strReboot[80];
1031 TCHAR strFail[80];
1032 int failcode = EXIT_FAIL;
1033
1034 UNREFERENCED_PARAMETER(Flags);
1035
1036 if(!argc) {
1037 //
1038 // arguments required
1039 //
1040 return EXIT_USAGE;
1041 }
1042 if(Machine) {
1043 //
1044 // must be local machine as we need to involve class/co installers
1045 //
1046 return EXIT_USAGE;
1047 }
1048 if(!LoadString(NULL,IDS_RESTARTED,strRestarted,ARRAYSIZE(strRestarted))) {
1049 return EXIT_FAIL;
1050 }
1051 if(!LoadString(NULL,IDS_REQUIRES_REBOOT,strReboot,ARRAYSIZE(strReboot))) {
1052 return EXIT_FAIL;
1053 }
1054 if(!LoadString(NULL,IDS_RESTART_FAILED,strFail,ARRAYSIZE(strFail))) {
1055 return EXIT_FAIL;
1056 }
1057
1058 context.control = DICS_PROPCHANGE;
1059 context.reboot = FALSE;
1060 context.count = 0;
1061 context.strReboot = strReboot;
1062 context.strSuccess = strRestarted;
1063 context.strFail = strFail;
1064 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