| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008-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 #include "omaha/tools/goopdump/data_dumper_network.h" | |
| 17 #include "omaha/common/vistautil.h" | |
| 18 #include "omaha/goopdate/goopdate_utils.h" | |
| 19 #include "omaha/net/network_config.h" | |
| 20 #include "omaha/tools/goopdump/data_dumper.h" | |
| 21 #include "omaha/tools/goopdump/dump_log.h" | |
| 22 #include "omaha/tools/goopdump/goopdump_cmd_line_parser.h" | |
| 23 | |
| 24 namespace omaha { | |
| 25 | |
| 26 DataDumperNetwork::DataDumperNetwork() { | |
| 27 } | |
| 28 | |
| 29 DataDumperNetwork::~DataDumperNetwork() { | |
| 30 } | |
| 31 | |
| 32 void DataDumperNetwork::DumpNetworkConfig(const DumpLog& dump_log) { | |
| 33 NetworkConfig& network_config(NetworkConfig::Instance()); | |
| 34 HRESULT hr = network_config.Detect(); | |
| 35 if (FAILED(hr)) { | |
| 36 dump_log.WriteLine(_T("Can't detect the network configuration.")); | |
| 37 } | |
| 38 std::vector<Config> configs(network_config.GetConfigurations()); | |
| 39 dump_log.WriteLine(_T("Detected configurations:\r\n")); | |
| 40 dump_log.WriteLine(NetworkConfig::ToString(configs)); | |
| 41 } | |
| 42 | |
| 43 HRESULT DataDumperNetwork::Process(const DumpLog& dump_log, | |
| 44 const GoopdumpCmdLineArgs& args) { | |
| 45 UNREFERENCED_PARAMETER(args); | |
| 46 DumpHeader header(dump_log, _T("Network")); | |
| 47 | |
| 48 const bool is_machine = vista_util::IsUserAdmin(); | |
| 49 HRESULT hr = omaha::goopdate_utils::ConfigureNetwork(is_machine, false); | |
| 50 if (FAILED(hr)) { | |
| 51 dump_log.WriteLine(_T("Can't configure the network.")); | |
| 52 } | |
| 53 | |
| 54 DumpNetworkConfig(dump_log); | |
| 55 return S_OK; | |
| 56 } | |
| 57 | |
| 58 } // namespace omaha | |
| 59 | |
| 60 // Register the WinHttp client with the class factory for http clients. | |
| 61 #pragma comment(linker, "/INCLUDE:_kRegisterWinHttp") | |
| 62 | |
| OLD | NEW |