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 "chrome_frame/test_utils.h" | 5 #include "chrome_frame/test_utils.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlwin.h> | 8 #include <atlwin.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 // Registers or unregisters the DLL at |path| by calling out to the current | 66 // Registers or unregisters the DLL at |path| by calling out to the current |
67 // executable with --call-registration-entrypoint. Loading the DLL into the | 67 // executable with --call-registration-entrypoint. Loading the DLL into the |
68 // test process is problematic for component=shared_library builds since | 68 // test process is problematic for component=shared_library builds since |
69 // singletons in base.dll aren't designed to handle multiple initialization. | 69 // singletons in base.dll aren't designed to handle multiple initialization. |
70 // Use of rundll32.exe is problematic since it does not return useful error | 70 // Use of rundll32.exe is problematic since it does not return useful error |
71 // information. | 71 // information. |
72 // static | 72 // static |
73 void ScopedChromeFrameRegistrar::DoRegistration( | 73 void ScopedChromeFrameRegistrar::DoRegistration( |
74 const string16& path, | 74 const base::string16& path, |
75 RegistrationType registration_type, | 75 RegistrationType registration_type, |
76 RegistrationOperation registration_operation) { | 76 RegistrationOperation registration_operation) { |
77 static const char* const kEntrypoints[] = { | 77 static const char* const kEntrypoints[] = { |
78 "DllRegisterServer", | 78 "DllRegisterServer", |
79 "DllUnregisterServer", | 79 "DllUnregisterServer", |
80 "DllRegisterUserServer", | 80 "DllRegisterUserServer", |
81 "DllUnregisterUserServer", | 81 "DllUnregisterUserServer", |
82 }; | 82 }; |
83 | 83 |
84 DCHECK(!path.empty()); | 84 DCHECK(!path.empty()); |
85 DCHECK(registration_type == PER_USER || registration_type == SYSTEM_LEVEL); | 85 DCHECK(registration_type == PER_USER || registration_type == SYSTEM_LEVEL); |
86 DCHECK(registration_operation == REGISTER || | 86 DCHECK(registration_operation == REGISTER || |
87 registration_operation == UNREGISTER); | 87 registration_operation == UNREGISTER); |
88 | 88 |
89 int entrypoint_index = 0; | 89 int entrypoint_index = 0; |
90 base::LaunchOptions launch_options; | 90 base::LaunchOptions launch_options; |
91 base::win::ScopedHandle process_handle; | 91 base::win::ScopedHandle process_handle; |
92 int exit_code = -1; | 92 int exit_code = -1; |
93 | 93 |
94 if (registration_type == PER_USER) | 94 if (registration_type == PER_USER) |
95 entrypoint_index += 2; | 95 entrypoint_index += 2; |
96 if (registration_operation == UNREGISTER) | 96 if (registration_operation == UNREGISTER) |
97 entrypoint_index += 1; | 97 entrypoint_index += 1; |
98 string16 registration_command(ASCIIToUTF16("\"")); | 98 base::string16 registration_command(ASCIIToUTF16("\"")); |
99 registration_command += | 99 registration_command += |
100 CommandLine::ForCurrentProcess()->GetProgram().value(); | 100 CommandLine::ForCurrentProcess()->GetProgram().value(); |
101 registration_command += ASCIIToUTF16("\" "); | 101 registration_command += ASCIIToUTF16("\" "); |
102 registration_command += kCallRegistrationEntrypointSwitch; | 102 registration_command += kCallRegistrationEntrypointSwitch; |
103 registration_command += ASCIIToUTF16(" \""); | 103 registration_command += ASCIIToUTF16(" \""); |
104 registration_command += path; | 104 registration_command += path; |
105 registration_command += ASCIIToUTF16("\" "); | 105 registration_command += ASCIIToUTF16("\" "); |
106 registration_command += ASCIIToUTF16(kEntrypoints[entrypoint_index]); | 106 registration_command += ASCIIToUTF16(kEntrypoints[entrypoint_index]); |
107 launch_options.wait = true; | 107 launch_options.wait = true; |
108 if (!base::LaunchProcess(registration_command, launch_options, | 108 if (!base::LaunchProcess(registration_command, launch_options, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 UOI_NAME, | 277 UOI_NAME, |
278 name, | 278 name, |
279 sizeof(name), | 279 sizeof(name), |
280 &needed)) { | 280 &needed)) { |
281 is_locked = lstrcmpi(name, L"default") != 0; | 281 is_locked = lstrcmpi(name, L"default") != 0; |
282 } | 282 } |
283 ::CloseDesktop(input_desk); | 283 ::CloseDesktop(input_desk); |
284 } | 284 } |
285 return is_locked; | 285 return is_locked; |
286 } | 286 } |
OLD | NEW |