Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome_frame/dll_redirector.cc

Issue 10683005: Remove two deprecated methods from base::Version (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome_frame/dll_redirector.h" 5 #include "chrome_frame/dll_redirector.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlsecurity.h> 9 #include <atlsecurity.h>
10 #include <sddl.h> 10 #include <sddl.h>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (created_beacon) { 180 if (created_beacon) {
181 dll_version_.swap(our_version); 181 dll_version_.swap(our_version);
182 182
183 lstrcpynA(reinterpret_cast<char*>(shared_memory_->memory()), 183 lstrcpynA(reinterpret_cast<char*>(shared_memory_->memory()),
184 dll_version_->GetString().c_str(), 184 dll_version_->GetString().c_str(),
185 std::min(kSharedMemorySize, 185 std::min(kSharedMemorySize,
186 dll_version_->GetString().length() + 1)); 186 dll_version_->GetString().length() + 1));
187 } else { 187 } else {
188 char buffer[kSharedMemorySize] = {0}; 188 char buffer[kSharedMemorySize] = {0};
189 memcpy(buffer, shared_memory_->memory(), kSharedMemorySize - 1); 189 memcpy(buffer, shared_memory_->memory(), kSharedMemorySize - 1);
190 dll_version_.reset(Version::GetVersionFromString(buffer)); 190 dll_version_.reset(new Version(buffer));
191 191
192 if (!dll_version_.get() || dll_version_->Equals(*our_version.get())) { 192 if (!dll_version_->IsValid() ||
193 dll_version_->Equals(*our_version.get())) {
193 // If we either couldn't parse a valid version out of the shared 194 // If we either couldn't parse a valid version out of the shared
194 // memory or we did parse a version and it is the same as our own, 195 // memory or we did parse a version and it is the same as our own,
195 // then pretend we're first in to avoid trying to load any other DLLs. 196 // then pretend we're first in to avoid trying to load any other DLLs.
196 dll_version_.reset(our_version.release()); 197 dll_version_.reset(our_version.release());
197 created_beacon = true; 198 created_beacon = true;
198 } 199 }
199 } 200 }
200 } else { 201 } else {
201 NOTREACHED() << "Failed to map in version beacon."; 202 NOTREACHED() << "Failed to map in version beacon.";
202 } 203 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 236 }
236 237
237 return proc_ptr; 238 return proc_ptr;
238 } 239 }
239 240
240 Version* DllRedirector::GetCurrentModuleVersion() { 241 Version* DllRedirector::GetCurrentModuleVersion() {
241 scoped_ptr<FileVersionInfo> file_version_info( 242 scoped_ptr<FileVersionInfo> file_version_info(
242 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); 243 FileVersionInfo::CreateFileVersionInfoForCurrentModule());
243 DCHECK(file_version_info.get()); 244 DCHECK(file_version_info.get());
244 245
245 Version* current_version = NULL; 246 scoped_ptr<Version> current_version;
246 if (file_version_info.get()) { 247 if (file_version_info.get()) {
247 current_version = Version::GetVersionFromString( 248 current_version.reset(
248 WideToASCII(file_version_info->file_version())); 249 new Version(WideToASCII(file_version_info->file_version())));
249 DCHECK(current_version); 250 DCHECK(current_version->IsValid());
250 } 251 }
251 252
252 return current_version; 253 return current_version.release();
253 } 254 }
254 255
255 HMODULE DllRedirector::GetFirstModule() { 256 HMODULE DllRedirector::GetFirstModule() {
256 DCHECK(dll_version_.get()) 257 DCHECK(dll_version_.get())
257 << "Error: Did you call RegisterAsFirstCFModule() first?"; 258 << "Error: Did you call RegisterAsFirstCFModule() first?";
258 259
259 if (first_module_handle_ == NULL) { 260 if (first_module_handle_ == NULL) {
260 first_module_handle_ = LoadVersionedModule(dll_version_.get()); 261 first_module_handle_ = LoadVersionedModule(dll_version_.get());
261 } 262 }
262 263
(...skipping 28 matching lines...) Expand all
291 hmodule = LoadLibrary(module_path.value().c_str()); 292 hmodule = LoadLibrary(module_path.value().c_str());
292 if (hmodule == NULL) { 293 if (hmodule == NULL) {
293 DPLOG(ERROR) << "Could not load reported module version " 294 DPLOG(ERROR) << "Could not load reported module version "
294 << version->GetString(); 295 << version->GetString();
295 } 296 }
296 } else { 297 } else {
297 DPLOG(FATAL) << "Failed to get module file name"; 298 DPLOG(FATAL) << "Failed to get module file name";
298 } 299 }
299 return hmodule; 300 return hmodule;
300 } 301 }
OLDNEW
« no previous file with comments | « chrome/test/mini_installer_test/installer_test_util.cc ('k') | chrome_frame/test/dll_redirector_loading_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698