| OLD | NEW |
| (Empty) |
| 1 // Copyright 2007-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 // | |
| 16 // TODO(omaha): consider making all what can be passed on the command line | |
| 17 // "arguments". Our terminology to separate them in commands and options is not | |
| 18 // consistent. | |
| 19 | |
| 20 #ifndef OMAHA_COMMON_COMMAND_LINE_H_ | |
| 21 #define OMAHA_COMMON_COMMAND_LINE_H_ | |
| 22 | |
| 23 #include <tchar.h> | |
| 24 #include <atlstr.h> | |
| 25 #include <vector> | |
| 26 #include "omaha/base/constants.h" | |
| 27 #include "omaha/base/browser_utils.h" | |
| 28 #include "omaha/common/const_goopdate.h" | |
| 29 | |
| 30 namespace omaha { | |
| 31 | |
| 32 // Replacement for the C runtime function to process the command line. | |
| 33 // The first token of the command line in Windows is the process name. | |
| 34 // What gets passed to WinMain by the C runtime must not include the first | |
| 35 // token. Since our tiny shell does not use the C runtime we must handle | |
| 36 // the command line by ourselves. | |
| 37 TCHAR* GetCmdLineTail(const TCHAR* cmd_line); | |
| 38 | |
| 39 struct CommandLineAppArgs { | |
| 40 CommandLineAppArgs() | |
| 41 : app_guid(GUID_NULL), | |
| 42 needs_admin(NEEDS_ADMIN_NO) {} | |
| 43 | |
| 44 GUID app_guid; | |
| 45 CString app_name; | |
| 46 NeedsAdmin needs_admin; | |
| 47 CString ap; | |
| 48 CString tt_token; | |
| 49 CString encoded_installer_data; | |
| 50 CString install_data_index; | |
| 51 CString experiment_labels; | |
| 52 }; | |
| 53 | |
| 54 // Values may be sent in pings or stats. Do not remove or reuse existing values. | |
| 55 typedef enum CommandLineMode { | |
| 56 COMMANDLINE_MODE_UNKNOWN = 0, | |
| 57 COMMANDLINE_MODE_NOARGS = 1, | |
| 58 COMMANDLINE_MODE_CORE = 2, | |
| 59 COMMANDLINE_MODE_SERVICE = 3, | |
| 60 COMMANDLINE_MODE_REGSERVER = 4, | |
| 61 COMMANDLINE_MODE_UNREGSERVER = 5, | |
| 62 COMMANDLINE_MODE_NETDIAGS = 6, | |
| 63 COMMANDLINE_MODE_CRASH = 7, | |
| 64 COMMANDLINE_MODE_REPORTCRASH = 8, | |
| 65 COMMANDLINE_MODE_INSTALL = 9, | |
| 66 COMMANDLINE_MODE_UPDATE = 10, | |
| 67 // Obsolete: COMMANDLINE_MODE_IG = 11, | |
| 68 COMMANDLINE_MODE_HANDOFF_INSTALL = 12, | |
| 69 // Obsolete: COMMANDLINE_MODE_UG = 13, | |
| 70 COMMANDLINE_MODE_UA = 14, | |
| 71 COMMANDLINE_MODE_RECOVER = 15, | |
| 72 COMMANDLINE_MODE_WEBPLUGIN = 16, | |
| 73 COMMANDLINE_MODE_CODE_RED_CHECK = 17, | |
| 74 COMMANDLINE_MODE_COMSERVER = 18, | |
| 75 // Obsolete: COMMANDLINE_MODE_LEGACYUI = 19, | |
| 76 // Obsolete: COMMANDLINE_MODE_LEGACY_MANIFEST_HANDOFF = 20, | |
| 77 COMMANDLINE_MODE_REGISTER_PRODUCT = 21, | |
| 78 COMMANDLINE_MODE_UNREGISTER_PRODUCT = 22, | |
| 79 COMMANDLINE_MODE_SERVICE_REGISTER = 23, | |
| 80 COMMANDLINE_MODE_SERVICE_UNREGISTER = 24, | |
| 81 COMMANDLINE_MODE_CRASH_HANDLER = 25, | |
| 82 COMMANDLINE_MODE_COMBROKER = 26, | |
| 83 COMMANDLINE_MODE_ONDEMAND = 27, | |
| 84 COMMANDLINE_MODE_MEDIUM_SERVICE = 28, | |
| 85 COMMANDLINE_MODE_UNINSTALL = 29, | |
| 86 COMMANDLINE_MODE_PING = 30, | |
| 87 }; | |
| 88 | |
| 89 struct CommandLineExtraArgs { | |
| 90 CommandLineExtraArgs() | |
| 91 : installation_id(GUID_NULL), | |
| 92 browser_type(BROWSER_UNKNOWN), | |
| 93 usage_stats_enable(TRISTATE_NONE), | |
| 94 runtime_only(false) {} | |
| 95 | |
| 96 CString bundle_name; | |
| 97 GUID installation_id; | |
| 98 CString brand_code; | |
| 99 CString client_id; | |
| 100 CString experiment_labels; | |
| 101 CString referral_id; | |
| 102 CString language; | |
| 103 BrowserType browser_type; | |
| 104 Tristate usage_stats_enable; | |
| 105 bool runtime_only; | |
| 106 | |
| 107 std::vector<CommandLineAppArgs> apps; | |
| 108 }; | |
| 109 | |
| 110 struct CommandLineArgs { | |
| 111 CommandLineArgs() | |
| 112 : mode(COMMANDLINE_MODE_UNKNOWN), | |
| 113 is_interactive_set(false), | |
| 114 is_machine_set(false), | |
| 115 is_crash_handler_disabled(false), | |
| 116 is_install_elevated(false), | |
| 117 is_silent_set(false), | |
| 118 is_eula_required_set(false), | |
| 119 is_offline_set(false), | |
| 120 is_oem_set(false) {} | |
| 121 | |
| 122 CommandLineMode mode; | |
| 123 bool is_interactive_set; | |
| 124 bool is_machine_set; | |
| 125 bool is_crash_handler_disabled; | |
| 126 bool is_install_elevated; | |
| 127 bool is_silent_set; | |
| 128 bool is_eula_required_set; | |
| 129 bool is_offline_set; | |
| 130 bool is_oem_set; | |
| 131 CString extra_args_str; | |
| 132 CString app_args_str; | |
| 133 CString install_source; | |
| 134 CString crash_filename; | |
| 135 CString custom_info_filename; | |
| 136 CString legacy_manifest_path; | |
| 137 CString webplugin_urldomain; | |
| 138 CString webplugin_args; | |
| 139 CString code_red_metainstaller_path; | |
| 140 CString ping_string; | |
| 141 CString offline_dir; | |
| 142 CString session_id; | |
| 143 CommandLineExtraArgs extra; | |
| 144 }; | |
| 145 | |
| 146 // Parses the goopdate command line. | |
| 147 HRESULT ParseCommandLine(const TCHAR* cmd_line, CommandLineArgs* args); | |
| 148 | |
| 149 } // namespace omaha | |
| 150 | |
| 151 #endif // OMAHA_COMMON_COMMAND_LINE_H_ | |
| OLD | NEW |