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"
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
) {
26 freestanding::EnsureInitialized();
27 freestanding::LoaderPrivateAPI
& api
= freestanding::gLoaderPrivateAPI
;
28 api
.SetObserver(aNewObserver
);
33 } // namespace mozilla