Commit f47d25b9 authored by Yusuf Sengul's avatar Yusuf Sengul Committed by Commit Bot

Start GCPW extension at Windows login

Bug: 1133940
Change-Id: I814be90c998fbfae5f9456c00f62f82c5f518af2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441297
Commit-Queue: Yusuf Sengul <yusufsn@google.com>
Reviewed-by: default avatarRakesh Soma <rakeshsoma@google.com>
Cr-Commit-Position: refs/heads/master@{#814107}
parent 6cb7c14c
...@@ -34,11 +34,16 @@ source_set("common") { ...@@ -34,11 +34,16 @@ source_set("common") {
sources = [ sources = [
"extension_strings.cc", "extension_strings.cc",
"extension_strings.h", "extension_strings.h",
"extension_utils.cc",
"extension_utils.h",
"os_service_manager.cc", "os_service_manager.cc",
"os_service_manager.h", "os_service_manager.h",
"scoped_handle.h", "scoped_handle.h",
] ]
deps = [ "//base:base" ] deps = [
"../gaiacp:util",
"//base:base",
]
configs += [ "//build/config/win:windowed" ] configs += [ "//build/config/win:windowed" ]
} }
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "windows.h"
#include "base/at_exit.h" #include "base/at_exit.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
...@@ -11,6 +9,7 @@ ...@@ -11,6 +9,7 @@
#include "base/process/memory.h" #include "base/process/memory.h"
#include "base/task/thread_pool/thread_pool_instance.h" #include "base/task/thread_pool/thread_pool_instance.h"
#include "base/win/process_startup_helper.h" #include "base/win/process_startup_helper.h"
#include "base/win/windows_types.h"
#include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h" #include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h"
#include "chrome/credential_provider/extension/os_service_manager.h" #include "chrome/credential_provider/extension/os_service_manager.h"
#include "chrome/credential_provider/extension/service.h" #include "chrome/credential_provider/extension/service.h"
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/credential_provider/extension/extension_utils.h"
#include "chrome/credential_provider/extension/extension_strings.h"
#include "chrome/credential_provider/extension/os_service_manager.h"
#include "chrome/credential_provider/extension/scoped_handle.h"
#include "chrome/credential_provider/gaiacp/logging.h"
#include "chrome/credential_provider/gaiacp/reg_utils.h"
namespace credential_provider {
namespace extension {
DWORD GetGCPWExtensionServiceStatus(SERVICE_STATUS* service_status) {
DCHECK(service_status);
credential_provider::extension::OSServiceManager* service_manager =
credential_provider::extension::OSServiceManager::Get();
SERVICE_STATUS internal_service_status;
DWORD error_code =
service_manager->GetServiceStatus(&internal_service_status);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->GetServiceStatus failed win32="
<< error_code;
return error_code;
}
*service_status = internal_service_status;
return ERROR_SUCCESS;
}
bool IsGCPWExtensionRunning() {
SERVICE_STATUS service_status;
DWORD error_code = GetGCPWExtensionServiceStatus(&service_status);
if (error_code == ERROR_SUCCESS) {
return service_status.dwCurrentState == SERVICE_RUNNING;
}
return false;
}
DWORD InstallGCPWExtension(const base::FilePath& extension_exe_path) {
SERVICE_STATUS service_status;
DWORD error_code = GetGCPWExtensionServiceStatus(&service_status);
if (error_code != ERROR && error_code != ERROR_SERVICE_DOES_NOT_EXIST) {
LOGFN(ERROR)
<< "service_manager->GetGCPWExtensionServiceStatus failed win32="
<< error_code;
return error_code;
}
credential_provider::extension::OSServiceManager* service_manager =
credential_provider::extension::OSServiceManager::Get();
if (error_code == ERROR_SUCCESS) {
if (service_status.dwCurrentState != SERVICE_STOPPED) {
error_code = service_manager->ControlService(SERVICE_CONTROL_STOP,
&service_status);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->ControlService failed win32="
<< error_code;
return error_code;
}
}
error_code = service_manager->DeleteService();
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->DeleteService failed win32="
<< error_code;
return error_code;
}
}
credential_provider::extension::ScopedScHandle sc_handle;
error_code = service_manager->InstallService(extension_exe_path, &sc_handle);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->InstallService failed win32="
<< error_code;
return error_code;
}
return ERROR_SUCCESS;
}
DWORD UninstallGCPWExtension() {
credential_provider::extension::OSServiceManager* service_manager =
credential_provider::extension::OSServiceManager::Get();
SERVICE_STATUS service_status;
DWORD error_code = service_manager->GetServiceStatus(&service_status);
if (error_code != ERROR_SUCCESS &&
error_code != ERROR_SERVICE_DOES_NOT_EXIST) {
LOGFN(ERROR) << "service_manager->GetServiceStatus failed win32="
<< error_code;
return error_code;
}
if (error_code == ERROR_SUCCESS) {
if (service_status.dwCurrentState != SERVICE_STOPPED) {
error_code = service_manager->ControlService(SERVICE_CONTROL_STOP,
&service_status);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->ControlService failed win32="
<< error_code;
return error_code;
}
}
error_code = service_manager->DeleteService();
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->DeleteService failed win32="
<< error_code;
return error_code;
}
}
return ERROR_SUCCESS;
}
bool IsGCPWExtensionEnabled() {
return GetGlobalFlagOrDefault(extension::kEnableGCPWExtension, 1);
}
} // namespace extension
} // namespace credential_provider
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_EXTENSION_UTILS_H_
#define CHROME_CREDENTIAL_PROVIDER_EXTENSION_EXTENSION_UTILS_H_
#include <windows.h>
#include "base/files/file.h"
namespace credential_provider {
namespace extension {
// Updates the provided |service_status| parameter with the SERVICE_STATUS for
// GCPW extension. If retrieving SERVICE_STATUS fails, returns an error code
// other than ERROR_SUCCESS.
DWORD GetGCPWExtensionServiceStatus(SERVICE_STATUS* service_status);
// Returns true if GCPW extension is running.
bool IsGCPWExtensionRunning();
// Installs GCPW Extension service. If there is an already GCPW extension, it is
// stopped and deleted initially.
DWORD InstallGCPWExtension(const base::FilePath& extension_exe_path);
// Uninstalls GCPW Extension service by stopping and deleting the service.
DWORD UninstallGCPWExtension();
// Returns true if installation of GCPW extension is enabled.
bool IsGCPWExtensionEnabled();
} // namespace extension
} // namespace credential_provider
#endif // CHROME_CREDENTIAL_PROVIDER_EXTENSION_EXTENSION_UTILS_H_
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/credential_provider/extension/os_service_manager.h" #include "chrome/credential_provider/extension/os_service_manager.h"
#include "chrome/credential_provider/extension/extension_strings.h" #include "chrome/credential_provider/extension/extension_strings.h"
#include "chrome/credential_provider/gaiacp/logging.h"
namespace credential_provider { namespace credential_provider {
namespace extension { namespace extension {
...@@ -92,6 +93,25 @@ DWORD OSServiceManager::DeleteService() { ...@@ -92,6 +93,25 @@ DWORD OSServiceManager::DeleteService() {
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
DWORD OSServiceManager::StartGCPWService() {
ScopedScHandle scm_handle(
::OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS));
if (!scm_handle.IsValid())
return ::GetLastError();
ScopedScHandle sc_handle(::OpenService(
scm_handle.Get(), kGCPWExtensionServiceName, SERVICE_START));
if (!sc_handle.IsValid())
return ::GetLastError();
if (!::StartService(sc_handle.Get(), 0, nullptr))
return ::GetLastError();
LOGFN(INFO) << "GCPW extension started successfully.";
return ERROR_SUCCESS;
}
DWORD OSServiceManager::ControlService(DWORD control, DWORD OSServiceManager::ControlService(DWORD control,
SERVICE_STATUS* service_status) { SERVICE_STATUS* service_status) {
DCHECK(service_status); DCHECK(service_status);
......
...@@ -38,6 +38,9 @@ class OSServiceManager { ...@@ -38,6 +38,9 @@ class OSServiceManager {
// function, and the service is not running. // function, and the service is not running.
virtual DWORD DeleteService(); virtual DWORD DeleteService();
// Starts the GCPW extension using StartService Windows API.
virtual DWORD StartGCPWService();
// Calls the ControlService API to change the state of the service. |control| // Calls the ControlService API to change the state of the service. |control|
// needs to be one of the service controls as specified in documentation [1]. // needs to be one of the service controls as specified in documentation [1].
// As a result |service_status| is returned that has the latest state of the // As a result |service_status| is returned that has the latest state of the
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_SCOPED_HANDLE_H_ #ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_SCOPED_HANDLE_H_
#define CHROME_CREDENTIAL_PROVIDER_EXTENSION_SCOPED_HANDLE_H_ #define CHROME_CREDENTIAL_PROVIDER_EXTENSION_SCOPED_HANDLE_H_
#include <windows.h>
#include "base/macros.h" #include "base/macros.h"
#include "base/win/scoped_handle.h" #include "base/win/scoped_handle.h"
#include "base/win/windows_types.h"
namespace credential_provider { namespace credential_provider {
namespace extension { namespace extension {
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
#ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_TASK_H_ #ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_TASK_H_
#define CHROME_CREDENTIAL_PROVIDER_EXTENSION_TASK_H_ #define CHROME_CREDENTIAL_PROVIDER_EXTENSION_TASK_H_
#include <windows.h> #include "base/win/windows_types.h"
#include "chrome/credential_provider/extension/user_device_context.h" #include "chrome/credential_provider/extension/user_device_context.h"
namespace credential_provider { namespace credential_provider {
......
...@@ -160,6 +160,7 @@ source_set("gaiacp_lib") { ...@@ -160,6 +160,7 @@ source_set("gaiacp_lib") {
":string_resources", ":string_resources",
":util", ":util",
"../eventlog:gcp_eventlog_messages", "../eventlog:gcp_eventlog_messages",
"../extension:common",
"//build:branding_buildflags", "//build:branding_buildflags",
"//chrome/common:non_code_constants", "//chrome/common:non_code_constants",
"//chrome/common:version_header", "//chrome/common:version_header",
......
...@@ -81,12 +81,15 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { ...@@ -81,12 +81,15 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) {
HRESULT hr = _AtlModule.DllGetClassObject(rclsid, riid, ppv); HRESULT hr = _AtlModule.DllGetClassObject(rclsid, riid, ppv);
// Start refreshing token handle validity as soon as possible so that when if (SUCCEEDED(hr)) {
// their validity is requested later on by the credential providers they may // Start refreshing token handle validity as soon as possible so that when
// already be available and no wait is needed. // their validity is requested later on by the credential providers they may
if (SUCCEEDED(hr)) // already be available and no wait is needed.
_AtlModule.RefreshTokenHandleValidity(); _AtlModule.RefreshTokenHandleValidity();
_AtlModule.CheckGCPWExtension();
}
return hr; return hr;
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/credential_provider/gaiacp/gaia_credential_provider_module.h" #include "chrome/credential_provider/gaiacp/gaia_credential_provider_module.h"
#include <process.h>
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
...@@ -13,6 +15,8 @@ ...@@ -13,6 +15,8 @@
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "chrome/common/chrome_version.h" #include "chrome/common/chrome_version.h"
#include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h" #include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h"
#include "chrome/credential_provider/extension/extension_utils.h"
#include "chrome/credential_provider/extension/os_service_manager.h"
#include "chrome/credential_provider/gaiacp/associated_user_validator.h" #include "chrome/credential_provider/gaiacp/associated_user_validator.h"
#include "chrome/credential_provider/gaiacp/gaia_credential_base.h" #include "chrome/credential_provider/gaiacp/gaia_credential_base.h"
#include "chrome/credential_provider/gaiacp/gaia_credential_provider_filter.h" #include "chrome/credential_provider/gaiacp/gaia_credential_provider_filter.h"
...@@ -39,11 +43,27 @@ void InvalidParameterHandler(const wchar_t* expression, ...@@ -39,11 +43,27 @@ void InvalidParameterHandler(const wchar_t* expression,
<< " file=" << (file ? file : L"-") << " line=" << line; << " file=" << (file ? file : L"-") << " line=" << line;
} }
unsigned __stdcall CheckGCPWExtensionStatus(void* param) {
LOGFN(VERBOSE);
if (!credential_provider::extension::IsGCPWExtensionRunning()) {
credential_provider::extension::OSServiceManager* service_manager =
credential_provider::extension::OSServiceManager::Get();
DWORD error_code = service_manager->StartGCPWService();
if (error_code != ERROR_SUCCESS) {
LOGFN(WARNING) << "Unable to start GCPW extension win32=" << error_code;
}
}
return 0;
}
} // namespace } // namespace
CGaiaCredentialProviderModule::CGaiaCredentialProviderModule() CGaiaCredentialProviderModule::CGaiaCredentialProviderModule()
: ATL::CAtlDllModuleT<CGaiaCredentialProviderModule>(), : ATL::CAtlDllModuleT<CGaiaCredentialProviderModule>(),
exit_manager_(nullptr) {} exit_manager_(nullptr),
gcpw_extension_check_performed_(0),
crashpad_initialized_(0) {}
CGaiaCredentialProviderModule::~CGaiaCredentialProviderModule() {} CGaiaCredentialProviderModule::~CGaiaCredentialProviderModule() {}
...@@ -85,6 +105,17 @@ void CGaiaCredentialProviderModule::RefreshTokenHandleValidity() { ...@@ -85,6 +105,17 @@ void CGaiaCredentialProviderModule::RefreshTokenHandleValidity() {
} }
} }
void CGaiaCredentialProviderModule::CheckGCPWExtension() {
LOGFN(VERBOSE);
if (extension::IsGCPWExtensionEnabled() &&
::InterlockedCompareExchange(&gcpw_extension_check_performed_, 1, 0) ==
0) {
gcpw_extension_checker_thread_handle_ =
reinterpret_cast<HANDLE>(_beginthreadex(
nullptr, 0, CheckGCPWExtensionStatus, nullptr, 0, nullptr));
}
}
void CGaiaCredentialProviderModule::InitializeCrashReporting() { void CGaiaCredentialProviderModule::InitializeCrashReporting() {
// Perform a thread unsafe check to see whether crash reporting is // Perform a thread unsafe check to see whether crash reporting is
// initialized. Thread safe check is performed right before initializing crash // initialized. Thread safe check is performed right before initializing crash
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/credential_provider/gaiacp/stdafx.h" #include "chrome/credential_provider/gaiacp/stdafx.h"
#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" #include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h"
#include "chrome/credential_provider/gaiacp/scoped_handle.h"
#include "base/at_exit.h" #include "base/at_exit.h"
...@@ -43,6 +44,10 @@ class CGaiaCredentialProviderModule ...@@ -43,6 +44,10 @@ class CGaiaCredentialProviderModule
// validity is up to date. // validity is up to date.
void RefreshTokenHandleValidity(); void RefreshTokenHandleValidity();
// Fires a thread and checks the status of GCPW extensioon and runs it if not
// running.
void CheckGCPWExtension();
// Initializes the crash reporting for the module. Initialization happens only // Initializes the crash reporting for the module. Initialization happens only
// once even if the function is called multiple times. // once even if the function is called multiple times.
void InitializeCrashReporting(); void InitializeCrashReporting();
...@@ -54,6 +59,8 @@ class CGaiaCredentialProviderModule ...@@ -54,6 +59,8 @@ class CGaiaCredentialProviderModule
std::unique_ptr<base::AtExitManager> exit_manager_; std::unique_ptr<base::AtExitManager> exit_manager_;
bool is_testing_ = false; bool is_testing_ = false;
bool token_handle_validity_refreshed_ = false; bool token_handle_validity_refreshed_ = false;
base::win::ScopedHandle::Handle gcpw_extension_checker_thread_handle_;
volatile long gcpw_extension_check_performed_;
volatile long crashpad_initialized_ = 0; volatile long crashpad_initialized_ = 0;
}; };
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "chrome/credential_provider/gaiacp/reg_utils.h" #include "chrome/credential_provider/gaiacp/reg_utils.h"
#include <Windows.h>
#include <atlbase.h> #include <atlbase.h>
#include "base/base64.h" #include "base/base64.h"
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
#include "chrome/credential_provider/setup/gcpw_files.h" #include "chrome/credential_provider/setup/gcpw_files.h"
#include "chrome/credential_provider/extension/extension_strings.h" #include "chrome/credential_provider/extension/extension_utils.h"
#include "chrome/credential_provider/gaiacp/reg_utils.h"
namespace credential_provider { namespace credential_provider {
...@@ -40,7 +39,7 @@ std::vector<base::FilePath::StringType> GCPWFiles::GetEffectiveInstallFiles() { ...@@ -40,7 +39,7 @@ std::vector<base::FilePath::StringType> GCPWFiles::GetEffectiveInstallFiles() {
std::vector<base::FilePath::StringType> files; std::vector<base::FilePath::StringType> files;
for (auto& file : kFileNames) { for (auto& file : kFileNames) {
if (file.compare(kCredentialProviderExtensionExe) == 0 && if (file.compare(kCredentialProviderExtensionExe) == 0 &&
!GetGlobalFlagOrDefault(extension::kEnableGCPWExtension, 0)) !extension::IsGCPWExtensionEnabled())
continue; continue;
files.push_back(file); files.push_back(file);
} }
......
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "chrome/credential_provider/common/gcp_strings.h" #include "chrome/credential_provider/common/gcp_strings.h"
#include "chrome/credential_provider/extension/extension_strings.h" #include "chrome/credential_provider/extension/extension_strings.h"
#include "chrome/credential_provider/extension/os_service_manager.h" #include "chrome/credential_provider/extension/extension_utils.h"
#include "chrome/credential_provider/extension/scoped_handle.h"
#include "chrome/credential_provider/gaiacp/gcp_utils.h" #include "chrome/credential_provider/gaiacp/gcp_utils.h"
#include "chrome/credential_provider/gaiacp/logging.h" #include "chrome/credential_provider/gaiacp/logging.h"
#include "chrome/credential_provider/gaiacp/reg_utils.h" #include "chrome/credential_provider/gaiacp/reg_utils.h"
...@@ -158,81 +157,6 @@ HRESULT UnregisterDlls(const base::FilePath& dest_path, ...@@ -158,81 +157,6 @@ HRESULT UnregisterDlls(const base::FilePath& dest_path,
} // namespace } // namespace
DWORD InstallGCPWExtension(const base::FilePath& extension_exe_path) {
credential_provider::extension::OSServiceManager* service_manager =
credential_provider::extension::OSServiceManager::Get();
SERVICE_STATUS service_status;
DWORD error_code = service_manager->GetServiceStatus(&service_status);
if (error_code != ERROR_SUCCESS &&
error_code != ERROR_SERVICE_DOES_NOT_EXIST) {
LOGFN(ERROR) << "service_manager->GetServiceStatus failed win32="
<< error_code;
return error_code;
}
if (error_code == ERROR_SUCCESS) {
if (service_status.dwCurrentState != SERVICE_STOPPED) {
error_code = service_manager->ControlService(SERVICE_CONTROL_STOP,
&service_status);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->ControlService failed win32="
<< error_code;
return error_code;
}
}
error_code = service_manager->DeleteService();
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->DeleteService failed win32="
<< error_code;
return error_code;
}
}
credential_provider::extension::ScopedScHandle sc_handle;
error_code = service_manager->InstallService(extension_exe_path, &sc_handle);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->InstallService failed win32="
<< error_code;
return error_code;
}
return ERROR_SUCCESS;
}
DWORD UninstallGCPWExtension() {
credential_provider::extension::OSServiceManager* service_manager =
credential_provider::extension::OSServiceManager::Get();
SERVICE_STATUS service_status;
DWORD error_code = service_manager->GetServiceStatus(&service_status);
if (error_code != ERROR_SUCCESS &&
error_code != ERROR_SERVICE_DOES_NOT_EXIST) {
LOGFN(ERROR) << "service_manager->GetServiceStatus failed win32="
<< error_code;
return error_code;
}
if (error_code == ERROR_SUCCESS) {
if (service_status.dwCurrentState != SERVICE_STOPPED) {
error_code = service_manager->ControlService(SERVICE_CONTROL_STOP,
&service_status);
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->ControlService failed win32="
<< error_code;
return error_code;
}
}
error_code = service_manager->DeleteService();
if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "service_manager->DeleteService failed win32="
<< error_code;
return error_code;
}
}
return ERROR_SUCCESS;
}
HRESULT DoInstall(const base::FilePath& installer_path, HRESULT DoInstall(const base::FilePath& installer_path,
const base::string16& product_version, const base::string16& product_version,
FakesForTesting* fakes) { FakesForTesting* fakes) {
...@@ -288,9 +212,9 @@ HRESULT DoInstall(const base::FilePath& installer_path, ...@@ -288,9 +212,9 @@ HRESULT DoInstall(const base::FilePath& installer_path,
<< putHR(hr); << putHR(hr);
} }
if (GetGlobalFlagOrDefault(extension::kEnableGCPWExtension, 1)) { if (extension::IsGCPWExtensionEnabled()) {
DWORD error_code = DWORD error_code = extension::InstallGCPWExtension(
InstallGCPWExtension(dest_path.Append(kCredentialProviderExtensionExe)); dest_path.Append(kCredentialProviderExtensionExe));
if (error_code != ERROR_SUCCESS) { if (error_code != ERROR_SUCCESS) {
LOGFN(ERROR) << "InstallGCPWExtension failed win32=" << error_code; LOGFN(ERROR) << "InstallGCPWExtension failed win32=" << error_code;
return HRESULT_FROM_WIN32(error_code); return HRESULT_FROM_WIN32(error_code);
...@@ -311,7 +235,8 @@ HRESULT DoUninstall(const base::FilePath& installer_path, ...@@ -311,7 +235,8 @@ HRESULT DoUninstall(const base::FilePath& installer_path,
has_failures |= FAILED(UnregisterDlls(dest_path, register_dlls.data(), has_failures |= FAILED(UnregisterDlls(dest_path, register_dlls.data(),
register_dlls.size(), fakes)); register_dlls.size(), fakes));
has_failures |= FAILED(HRESULT_FROM_WIN32(UninstallGCPWExtension())); has_failures |=
FAILED(HRESULT_FROM_WIN32(extension::UninstallGCPWExtension()));
// If the DLLs are unregistered, Credential Provider will not be loaded by // If the DLLs are unregistered, Credential Provider will not be loaded by
// Winlogon. Therefore, it is safe to delete the startup sentinel file at this // Winlogon. Therefore, it is safe to delete the startup sentinel file at this
......
...@@ -18,15 +18,6 @@ namespace credential_provider { ...@@ -18,15 +18,6 @@ namespace credential_provider {
struct FakesForTesting; struct FakesForTesting;
// Define command line swtiches for setup.
// Installs GCPW Extension service. If there is an already GCPW extension, it is
// stopped and deleted initially.
DWORD InstallGCPWExtension(const base::FilePath& extension_exe_path);
// Uninstalls GCPW Extension service by stopping and deleting the service.
DWORD UninstallGCPWExtension();
// Does a full install of GCP. |installer_path| is the full path to the // Does a full install of GCP. |installer_path| is the full path to the
// installer exe and |product_version| is the version of GCP being installed. // installer exe and |product_version| is the version of GCP being installed.
HRESULT DoInstall(const base::FilePath& installer_path, HRESULT DoInstall(const base::FilePath& installer_path,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "chrome/common/chrome_version.h" #include "chrome/common/chrome_version.h"
#include "chrome/credential_provider/common/gcp_strings.h" #include "chrome/credential_provider/common/gcp_strings.h"
#include "chrome/credential_provider/extension/extension_strings.h" #include "chrome/credential_provider/extension/extension_strings.h"
#include "chrome/credential_provider/extension/extension_utils.h"
#include "chrome/credential_provider/gaiacp/gaia_credential_provider.h" #include "chrome/credential_provider/gaiacp/gaia_credential_provider.h"
#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h" #include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h"
#include "chrome/credential_provider/gaiacp/gcp_utils.h" #include "chrome/credential_provider/gaiacp/gcp_utils.h"
...@@ -250,11 +251,6 @@ void GcpSetupTest::ExpectAllFilesToExist( ...@@ -250,11 +251,6 @@ void GcpSetupTest::ExpectAllFilesToExist(
base::FilePath root = installed_path_for_version(product_version); base::FilePath root = installed_path_for_version(product_version);
EXPECT_EQ(exist, base::PathExists(root)); EXPECT_EQ(exist, base::PathExists(root));
base::win::RegKey key;
ASSERT_EQ(ERROR_SUCCESS,
key.Create(HKEY_LOCAL_MACHINE, kGcpRootKeyName, KEY_READ));
DWORD copy_extension_reg;
key.ReadValueDW(extension::kEnableGCPWExtension, &copy_extension_reg);
bool extension_found = false; bool extension_found = false;
auto install_files = GCPWFiles::Get()->GetEffectiveInstallFiles(); auto install_files = GCPWFiles::Get()->GetEffectiveInstallFiles();
...@@ -265,7 +261,7 @@ void GcpSetupTest::ExpectAllFilesToExist( ...@@ -265,7 +261,7 @@ void GcpSetupTest::ExpectAllFilesToExist(
EXPECT_EQ(exist, base::PathExists(root.Append(install_file))); EXPECT_EQ(exist, base::PathExists(root.Append(install_file)));
} }
EXPECT_EQ(copy_extension_reg == 1, extension_found); EXPECT_EQ(extension::IsGCPWExtensionEnabled(), extension_found);
} }
void GcpSetupTest::ExpectCredentialProviderToBeRegistered( void GcpSetupTest::ExpectCredentialProviderToBeRegistered(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment