tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

LauncherProcessWin.h (2609B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_LauncherProcessWin_h
      8 #define mozilla_LauncherProcessWin_h
      9 
     10 #include "mozilla/Maybe.h"
     11 #include "mozilla/TypedEnumBits.h"
     12 
     13 #include <stdint.h>
     14 
     15 namespace mozilla {
     16 
     17 // Forward declaration
     18 struct StaticXREAppData;
     19 
     20 /**
     21 * Determine whether or not the current process should be run as the launcher
     22 * process, and run if so. If we are not supposed to run as the launcher
     23 * process, or in the event of a launcher process failure, return Nothing, thus
     24 * indicating that we should continue on the original startup code path.
     25 */
     26 Maybe<int> LauncherMain(int& argc, wchar_t* argv[]);
     27 
     28 enum class LauncherFlags : uint32_t {
     29  eNone = 0,
     30  eWaitForBrowser = (1 << 0),  // Launcher should block until browser finishes
     31  eNoDeelevate = (1 << 1),     // If elevated, do not attempt to de-elevate
     32  eDeelevating = (1 << 2),     // A de-elevation attempt has been made
     33 };
     34 
     35 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LauncherFlags);
     36 
     37 enum class DeelevationStatus : uint32_t {
     38  // The deelevation status could not be determined. Should never actually be
     39  // the value of `gDeelevationStatus`.
     40  Unknown = 0,
     41 
     42  // Deelevation did not need to be performed because the process was started
     43  // without administrative privileges.
     44  StartedUnprivileged = 1,
     45  // Deelevation would have been performed, but was prohibited due to a flag.
     46  DeelevationProhibited = 2,
     47  // The launcher process was successfully deelevated.
     48  SuccessfullyDeelevated = 3,
     49  // The launcher process was not successfully deelevated, but a
     50  // medium-integrity token was used to launch the main process.
     51  PartiallyDeelevated = 4,
     52  // Deelevation was attempted, but failed completely. The main process is
     53  // running with administrative privileges.
     54  UnsuccessfullyDeelevated = 5,
     55 
     56  // This is the static initial value of `gDeelevationStatus`; it acts as a
     57  // sentinel to determine whether the launcher has set it at all. (It's
     58  // therefore the normal value of `gDeelevationStatus` when the launcher is
     59  // disabled.)
     60  DefaultStaticValue = 0x55AA55AA,
     61 };
     62 
     63 // The result of the deelevation attempt. Set by the launcher process in the
     64 // main process when the two are distinct.
     65 extern const volatile DeelevationStatus gDeelevationStatus;
     66 
     67 }  // namespace mozilla
     68 
     69 #endif  // mozilla_LauncherProcessWin_h