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 http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef mozilla_mscom_COMWrappers_h
8 #define mozilla_mscom_COMWrappers_h
9 
10 #include <objbase.h>
11 
12 #if (NTDDI_VERSION < NTDDI_WIN8)
13 // Win8+ API that we use very carefully
14 DECLARE_HANDLE(CO_MTA_USAGE_COOKIE);
15 HRESULT WINAPI CoIncrementMTAUsage(CO_MTA_USAGE_COOKIE* pCookie);
16 #endif  // (NTDDI_VERSION < NTDDI_WIN8)
17 
18 // A set of wrapped COM functions, so that we can dynamically link to the
19 // functions in combase.dll on win8+. This prevents ole32.dll and many other
20 // DLLs loading, which are not required when we have win32k locked down.
21 namespace mozilla::mscom::wrapped {
22 
23 HRESULT CoInitializeEx(LPVOID pvReserved, DWORD dwCoInit);
24 
25 void CoUninitialize();
26 
27 HRESULT CoIncrementMTAUsage(CO_MTA_USAGE_COOKIE* pCookie);
28 
29 HRESULT CoGetApartmentType(APTTYPE* pAptType, APTTYPEQUALIFIER* pAptQualifier);
30 
31 HRESULT CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc,
32                              SOLE_AUTHENTICATION_SERVICE* asAuthSvc,
33                              void* pReserved1, DWORD dwAuthnLevel,
34                              DWORD dwImpLevel, void* pAuthList,
35                              DWORD dwCapabilities, void* pReserved3);
36 
37 HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
38                          DWORD dwClsContext, REFIID riid, LPVOID* ppv);
39 
40 HRESULT CoCreateGuid(GUID* pguid);
41 
42 }  // namespace mozilla::mscom::wrapped
43 
44 #endif  // mozilla_mscom_COMWrappers_h
45