Bug 950241 - Add process running helpers to CEHHelpers. r=bbondy

This commit is contained in:
Jim Mathies 2014-01-30 13:32:48 -06:00
Родитель f45fea2d50
Коммит 31b2d35574
2 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

@ -13,6 +13,8 @@
HANDLE sCon;
LPCWSTR metroDX10Available = L"MetroD3DAvailable";
LPCWSTR metroLastAHE = L"MetroLastAHE";
LPCWSTR cehDumpDebugStrings = L"CEHDump";
extern const WCHAR* kFirefoxExe;
typedef HRESULT (WINAPI*D3D10CreateDevice1Func)
(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT,
@ -23,7 +25,10 @@ void
Log(const wchar_t *fmt, ...)
{
#if !defined(SHOW_CONSOLE)
return;
DWORD dwRes = 0;
if (!GetDWORDRegKey(cehDumpDebugStrings, dwRes) || !dwRes) {
return;
}
#endif
va_list a = nullptr;
wchar_t szDebugString[1024];
@ -39,10 +44,8 @@ Log(const wchar_t *fmt, ...)
WriteConsoleW(sCon, szDebugString, lstrlenW(szDebugString), &len, nullptr);
WriteConsoleW(sCon, L"\n", 1, &len, nullptr);
if (IsDebuggerPresent()) {
OutputDebugStringW(szDebugString);
OutputDebugStringW(L"\n");
}
OutputDebugStringW(szDebugString);
OutputDebugStringW(L"\n");
}
#if defined(SHOW_CONSOLE)
@ -108,6 +111,18 @@ IsProcessRunning(const wchar_t *processName, bool bCheckIfMetro)
return exists;
}
bool
IsMetroProcessRunning()
{
return IsProcessRunning(kFirefoxExe, true);
}
bool
IsDesktopProcessRunning()
{
return IsProcessRunning(kFirefoxExe, false);
}
/*
* Retrieve the last front end ui we launched so we can target it
* again. This value is updated down in nsAppRunner when the browser

Просмотреть файл

@ -31,4 +31,5 @@ bool IsDX10Available();
bool GetDWORDRegKey(LPCWSTR name, DWORD &value);
bool SetDWORDRegKey(LPCWSTR name, DWORD value);
bool IsImmersiveProcessDynamic(HANDLE process);
bool IsProcessRunning(const wchar_t *processName, bool bCheckIfMetro);
bool IsMetroProcessRunning();
bool IsDesktopProcessRunning();