diff options
-rw-r--r-- | chrome_elf/blacklist/blacklist.cc | 10 | ||||
-rw-r--r-- | sandbox/win/src/sandbox.cc | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc index bf48435..ea140c4 100644 --- a/chrome_elf/blacklist/blacklist.cc +++ b/chrome_elf/blacklist/blacklist.cc @@ -138,8 +138,14 @@ class OSInfo { }; bool IsNonBrowserProcess() { - wchar_t* command_line = GetCommandLine(); - return (command_line && wcsstr(command_line, L"--type")); + typedef bool (*IsSandboxedProcessFunc)(); + IsSandboxedProcessFunc is_sandboxed_process = + reinterpret_cast<IsSandboxedProcessFunc>( + GetProcAddress(GetModuleHandle(NULL), "IsSandboxedProcess")); + if (is_sandboxed_process && is_sandboxed_process()) + return true; + + return false; } // Record that the thunk setup completed succesfully and close the registry diff --git a/sandbox/win/src/sandbox.cc b/sandbox/win/src/sandbox.cc index d26daa4..984dfec 100644 --- a/sandbox/win/src/sandbox.cc +++ b/sandbox/win/src/sandbox.cc @@ -12,8 +12,7 @@ namespace sandbox { // The section for IPC and policy. SANDBOX_INTERCEPT HANDLE g_shared_section; - -static bool s_is_broker = false; +static bool s_is_broker = false; // GetBrokerServices: the current implementation relies on a shared section // that is created by the broker and opened by the target. @@ -42,3 +41,8 @@ TargetServices* SandboxFactory::GetTargetServices() { } } // namespace sandbox + +// Allows querying for whether the current process has been sandboxed. +extern "C" bool __declspec(dllexport) IsSandboxedProcess() { + return sandbox::g_shared_section != NULL; +} |