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

Function _tmain

Drivers/Driver-SRC/setup/devcon/devcon.cpp:1037–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035}
1036
1037int
1038__cdecl
1039_tmain(_In_ int argc, _In_reads_(argc) PWSTR* argv)
1040/*++
1041
1042Routine Description:
1043
1044 Main entry point
1045 interpret -m:<machine>
1046 and hand off execution to command
1047
1048Arguments:
1049
1050 argc/argv - parameters passed to executable
1051
1052Return Value:
1053
1054 EXIT_xxxx
1055
1056--*/
1057{
1058 LPCTSTR cmd;
1059 LPCTSTR baseName;
1060 LPCTSTR machine = NULL;
1061 int dispIndex;
1062 int firstArg = 1;
1063 int retval = EXIT_USAGE;
1064 BOOL autoReboot = FALSE;
1065 DWORD flags = 0;
1066
1067 //
1068 // syntax:
1069 //
1070 // [options] [-]command [<arg> [<arg>]]
1071 //
1072 // options:
1073 // -m:<machine> - remote
1074 // -r - auto reboot
1075 // -f - force operation
1076 // -u - unicode output
1077 //
1078
1079 baseName = _tcsrchr(argv[0],TEXT('\\'));
1080 if(!baseName) {
1081 baseName = argv[0];
1082 } else {
1083 baseName = CharNext(baseName);
1084 }
1085 while((argc > firstArg) && ((argv[firstArg][0] == TEXT('-')) || (argv[firstArg][0] == TEXT('/')))) {
1086 if((argv[firstArg][1]==TEXT('m')) || (argv[firstArg][1]==TEXT('M'))) {
1087 if((argv[firstArg][2]!=TEXT(':')) || (argv[firstArg][3]==TEXT('\0'))) {
1088 //
1089 // don't recognize this switch
1090 //
1091 break;
1092 }
1093 machine = argv[firstArg]+3;
1094 } else if((argv[firstArg][1]==TEXT('r')) || (argv[firstArg][1]==TEXT('R'))) {

Callers

nothing calls this directly

Calls 4

UsageFunction · 0.85
CommandUsageFunction · 0.85
RebootFunction · 0.85
FailureFunction · 0.85

Tested by

no test coverage detected