OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/win/elevated_controller.h" | 5 #include "remoting/host/win/elevated_controller.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 FILE_FLAG_SEQUENTIAL_SCAN, | 105 FILE_FLAG_SEQUENTIAL_SCAN, |
106 NULL)); | 106 NULL)); |
107 | 107 |
108 if (!file.IsValid()) { | 108 if (!file.IsValid()) { |
109 DWORD error = GetLastError(); | 109 DWORD error = GetLastError(); |
110 LOG_GETLASTERROR(ERROR) | 110 LOG_GETLASTERROR(ERROR) |
111 << "Failed to open '" << filename.value() << "'"; | 111 << "Failed to open '" << filename.value() << "'"; |
112 return HRESULT_FROM_WIN32(error); | 112 return HRESULT_FROM_WIN32(error); |
113 } | 113 } |
114 | 114 |
115 scoped_array<char> buffer(new char[kMaxConfigFileSize]); | 115 scoped_ptr<char[]> buffer(new char[kMaxConfigFileSize]); |
116 DWORD size = kMaxConfigFileSize; | 116 DWORD size = kMaxConfigFileSize; |
117 if (!::ReadFile(file, &buffer[0], size, &size, NULL)) { | 117 if (!::ReadFile(file, &buffer[0], size, &size, NULL)) { |
118 DWORD error = GetLastError(); | 118 DWORD error = GetLastError(); |
119 LOG_GETLASTERROR(ERROR) | 119 LOG_GETLASTERROR(ERROR) |
120 << "Failed to read '" << filename.value() << "'"; | 120 << "Failed to read '" << filename.value() << "'"; |
121 return HRESULT_FROM_WIN32(error); | 121 return HRESULT_FROM_WIN32(error); |
122 } | 122 } |
123 | 123 |
124 // Parse the JSON configuration, expecting it to contain a dictionary. | 124 // Parse the JSON configuration, expecting it to contain a dictionary. |
125 std::string file_content(buffer.get(), size); | 125 std::string file_content(buffer.get(), size); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 << "Failed to open to the '" << kWindowsServiceName << "' service"; | 522 << "Failed to open to the '" << kWindowsServiceName << "' service"; |
523 | 523 |
524 return HRESULT_FROM_WIN32(error); | 524 return HRESULT_FROM_WIN32(error); |
525 } | 525 } |
526 | 526 |
527 service_out->Set(service.Take()); | 527 service_out->Set(service.Take()); |
528 return S_OK; | 528 return S_OK; |
529 } | 529 } |
530 | 530 |
531 } // namespace remoting | 531 } // namespace remoting |
OLD | NEW |