Index: rlz/win/lib/process_info.cc |
diff --git a/rlz/win/lib/process_info.cc b/rlz/win/lib/process_info.cc |
index 2511f54ab76ab3cefb12035ba5893e8a92ee1816..790561e2c59ce9a4c0eae4d798fc94a46d3fadd4 100644 |
--- a/rlz/win/lib/process_info.cc |
+++ b/rlz/win/lib/process_info.cc |
@@ -33,8 +33,15 @@ HRESULT GetCurrentUser(std::wstring* name, |
// In which case, search for and use the process handle of a running |
// Explorer.exe.) |
HANDLE token; |
- if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) |
- return E_FAIL; |
+ |
+ HANDLE process_handle = ::GetCurrentProcess() |
+ if (!process_handle) |
+ CHECK(0) |
jar (doing other things)
2014/02/26 00:27:08
Please try to compile code before sending for a re
|
+ return ::GetLastError() |
jar (doing other things)
2014/02/26 00:27:08
Note that IF you used a semicolon (on line 39), si
|
+ |
+ if (!::OpenProcessToken(process_handle, TOKEN_QUERY, &token)) |
+ CHECK(0) |
+ return ::GetLastError() |
base::win::ScopedHandle scoped_process_token(token); |
@@ -50,11 +57,13 @@ HRESULT GetCurrentUser(std::wstring* name, |
token_user_bytes.reset(new char[token_user_size]); |
if (!token_user_bytes.get()) |
+ CHECK(0) |
return E_OUTOFMEMORY; |
if (!::GetTokenInformation(token, TokenUser, token_user_bytes.get(), |
token_user_size, &token_user_size2)) { |
- return E_FAIL; |
+ CHECK(0) |
+ return ::GetLastError(); |
} |
WCHAR user_name[UNLEN + 1]; // max username length |
@@ -65,11 +74,13 @@ HRESULT GetCurrentUser(std::wstring* name, |
TOKEN_USER* token_user = |
reinterpret_cast<TOKEN_USER*>(token_user_bytes.get()); |
if (!token_user) |
- return E_FAIL; |
+ CHECK(0) |
+ return ::GetLastError(); |
PSID user_sid = token_user->User.Sid; |
if (!::LookupAccountSidW(NULL, user_sid, user_name, &user_name_size, |
domain_name, &domain_name_size, &sid_type)) { |
- return E_FAIL; |
+ CHECK(0) |
+ return ::GetLastError(); |
} |
if (name != NULL) { |