/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* * A very simple wrapper that always launches Firefox in Private Browsing * mode. Any arguments given to this program will be forwarded to Firefox, * as well the information provided by GetStartupInfoW() (the latter is mainly * done to ensure that Firefox's `launch_method` Telemetry works, which * depends on shortcut information). * * Any errors that happen during this process will pop up a MessageBox * with a Windows error (if present) and a unique UUID for debugability -- * but these are very unlikely to be seen in practice.
*/ int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR aCmdLine, int) { wchar_t app[MAX_PATH];
DWORD ret = GetModuleFileNameW(nullptr, app, MAX_PATH); if (!ret ||
(ret == MAX_PATH && ::GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
ret = ::GetLastError();
raiseError(ret, ERR_GET_OUR_PATH); return ret;
} if (!PathRemoveFileSpecW(app)) {
raiseError(0, ERR_GET_APP_DIR); return 1;
} if (!PathAppendW(app, MOZ_APP_NAME L".exe")) {
raiseError(0, ERR_GET_APP_EXE); return 1;
}
std::wstring cmdLine(L"\"");
cmdLine += app;
cmdLine += L"\" -private-window"; if (wcslen(aCmdLine) > 0) {
cmdLine += L" ";
cmdLine += aCmdLine;
}
DWORD creationFlags = CREATE_UNICODE_ENVIRONMENT; // Mainly used to pass along shortcut information to ensure // launch_method Telemetry will be accurate.
STARTUPINFOW startupInfo = {0};
startupInfo.cb = sizeof(STARTUPINFOW);
GetStartupInfoW(&startupInfo);
PROCESS_INFORMATION pi;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.