Commit 8f606820 authored by thakis's avatar thakis Committed by Commit bot

Add more casts.

Fixes several clang/win errors like
..\..\sandbox\win\sandbox_poc\pocdll\registry.cc(24,10) :  error(clang): value of type 'HKEY' (aka 'HKEY__ *') is not implicitly convertible to 'LONG_PTR' (aka 'long')
    case HKEY_USERS:
         ^~~~~~~~~~

Also fix a format string warning while here.

No intended behavior change.
BUG=82385

Review URL: https://codereview.chromium.org/542863002

Cr-Commit-Position: refs/heads/master@{#293540}
parent 0dcab3d5
...@@ -13,15 +13,15 @@ ...@@ -13,15 +13,15 @@
// The return value is the string corresponding to the hive or "unknown" // The return value is the string corresponding to the hive or "unknown"
const wchar_t *HKEYToString(const HKEY key) { const wchar_t *HKEYToString(const HKEY key) {
switch (reinterpret_cast<LONG_PTR>(key)) { switch (reinterpret_cast<LONG_PTR>(key)) {
case HKEY_CLASSES_ROOT: case reinterpret_cast<LONG_PTR>(HKEY_CLASSES_ROOT):
return L"HKEY_CLASSES_ROOT"; return L"HKEY_CLASSES_ROOT";
case HKEY_CURRENT_CONFIG: case reinterpret_cast<LONG_PTR>(HKEY_CURRENT_CONFIG):
return L"HKEY_CURRENT_CONFIG"; return L"HKEY_CURRENT_CONFIG";
case HKEY_CURRENT_USER: case reinterpret_cast<LONG_PTR>(HKEY_CURRENT_USER):
return L"HKEY_CURRENT_USER"; return L"HKEY_CURRENT_USER";
case HKEY_LOCAL_MACHINE: case reinterpret_cast<LONG_PTR>(HKEY_LOCAL_MACHINE):
return L"HKEY_LOCAL_MACHINE"; return L"HKEY_LOCAL_MACHINE";
case HKEY_USERS: case reinterpret_cast<LONG_PTR>(HKEY_USERS):
return L"HKEY_USERS"; return L"HKEY_USERS";
} }
return L"unknown"; return L"unknown";
...@@ -43,7 +43,7 @@ void TryOpenKey(const HKEY hive, const wchar_t *path, FILE *output) { ...@@ -43,7 +43,7 @@ void TryOpenKey(const HKEY hive, const wchar_t *path, FILE *output) {
key); key);
::RegCloseKey(key); ::RegCloseKey(key);
} else { } else {
fprintf(output, "[BLOCKED] Opening key \"%S\\%S\". Error %d\r\n", fprintf(output, "[BLOCKED] Opening key \"%S\\%S\". Error %ld\r\n",
HKEYToString(hive), HKEYToString(hive),
path, path,
err_code); err_code);
......
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