Bug 1944627 - update sidebar button checked state for non-revamped sidebar cases...
[gecko.git] / browser / app / winlauncher / NtLoaderAPI.cpp
blob97f8a201862dc0b46234d502c55bae30d23e389d
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/. */
7 #include "mozilla/LoaderAPIInterfaces.h"
9 #include "freestanding/CheckForCaller.h"
10 #include "freestanding/LoaderPrivateAPI.h"
12 namespace mozilla {
14 extern "C" MOZ_EXPORT nt::LoaderAPI* GetNtLoaderAPI(
15 nt::LoaderObserver* aNewObserver) {
16 // Make sure the caller is inside mozglue.dll - we don't want to allow
17 // external access to this function, as it contains details about
18 // the SharedSection which is used to sandbox future child processes.
19 const bool isCallerMozglue =
20 CheckForAddress(RETURN_ADDRESS(), L"mozglue.dll");
21 MOZ_ASSERT(isCallerMozglue);
22 if (!isCallerMozglue) {
23 return nullptr;
26 freestanding::EnsureInitialized();
27 freestanding::LoaderPrivateAPI& api = freestanding::gLoaderPrivateAPI;
28 api.SetObserver(aNewObserver);
30 return &api;
33 } // namespace mozilla