Commit e1544127 authored by Tien Mai's avatar Tien Mai Committed by Commit Bot

[GCPW] Add Windows version information in some log messages

Bug: 939353
Change-Id: I8e4486cc471164b0586076361b2155b8bdc7bc02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508772Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Tien Mai <tienmai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638701}
parent 1eca54dd
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.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/gaiacp/associated_user_validator.h" #include "chrome/credential_provider/gaiacp/associated_user_validator.h"
...@@ -116,7 +117,9 @@ BOOL CGaiaCredentialProviderModule::DllMain(HINSTANCE /*hinstance*/, ...@@ -116,7 +117,9 @@ BOOL CGaiaCredentialProviderModule::DllMain(HINSTANCE /*hinstance*/,
credential_provider::ConfigureGcpCrashReporting(*cmd_line); credential_provider::ConfigureGcpCrashReporting(*cmd_line);
} }
LOGFN(INFO) << "DllMain(DLL_PROCESS_ATTACH)"; LOGFN(INFO) << "DllMain(DLL_PROCESS_ATTACH) Build: "
<< base::win::OSInfo::GetInstance()->Kernel32BaseVersion()
<< " Version:" << GetWindowsVersion();
break; break;
} }
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
......
...@@ -246,7 +246,7 @@ void ScopedStartupInfo::Shutdown() { ...@@ -246,7 +246,7 @@ void ScopedStartupInfo::Shutdown() {
} }
// Waits for a process to terminate while capturing output from |output_handle| // Waits for a process to terminate while capturing output from |output_handle|
// to the buffer |output_buffer| of size |buffer_size|. The buffer is expected // to the buffer |output_buffer| of length |buffer_size|. The buffer is expected
// to be relatively small. The exit code of the process is written to // to be relatively small. The exit code of the process is written to
// |exit_code|. // |exit_code|.
HRESULT WaitForProcess(base::win::ScopedHandle::Handle process_handle, HRESULT WaitForProcess(base::win::ScopedHandle::Handle process_handle,
...@@ -699,6 +699,18 @@ base::FilePath::StringType GetInstallParentDirectoryName() { ...@@ -699,6 +699,18 @@ base::FilePath::StringType GetInstallParentDirectoryName() {
#endif #endif
} }
base::string16 GetWindowsVersion() {
wchar_t release_id[32];
ULONG length = base::size(release_id) * sizeof(release_id[0]);
HRESULT hr =
GetMachineRegString(L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
L"ReleaseId", release_id, &length);
if (SUCCEEDED(hr))
return release_id;
return L"Unknown";
}
FakesForTesting::FakesForTesting() {} FakesForTesting::FakesForTesting() {}
FakesForTesting::~FakesForTesting() {} FakesForTesting::~FakesForTesting() {}
......
...@@ -239,6 +239,11 @@ std::string GetDictStringUTF8( ...@@ -239,6 +239,11 @@ std::string GetDictStringUTF8(
const std::unique_ptr<base::DictionaryValue>& dict, const std::unique_ptr<base::DictionaryValue>& dict,
const char* name); const char* name);
// Returns the major build version of Windows by reading the registry.
// See:
// https://stackoverflow.com/questions/31072543/reliable-way-to-get-windows-version-from-registry
base::string16 GetWindowsVersion();
class OSUserManager; class OSUserManager;
class OSProcessManager; class OSProcessManager;
......
...@@ -133,8 +133,10 @@ int APIENTRY wWinMain(HINSTANCE hInstance, ...@@ -133,8 +133,10 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
LOGFN(INFO) << "Module: " << gcp_setup_exe_path; LOGFN(INFO) << "Module: " << gcp_setup_exe_path;
LOGFN(INFO) << "Args: " << lpCmdLine; LOGFN(INFO) << "Args: " << lpCmdLine;
LOGFN(INFO) << "Version: " << TEXT(CHROME_VERSION_STRING); LOGFN(INFO) << "Version: " << TEXT(CHROME_VERSION_STRING);
LOGFN(INFO) << "Windows: " LOGFN(INFO) << "Windows: "
<< base::win::OSInfo::GetInstance()->Kernel32BaseVersion(); << base::win::OSInfo::GetInstance()->Kernel32BaseVersion()
<< " Version:" << credential_provider::GetWindowsVersion();
// If running from omaha, make sure machine install is used. // If running from omaha, make sure machine install is used.
if (IsPerUserInstallFromGoogleUpdate()) { if (IsPerUserInstallFromGoogleUpdate()) {
......
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