4 * Copyright 2008 Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
28 #include "autolock.hxx"
31 typedef RPC_STATUS (RPC_ENTRY *FP_RpcBindingSetAuthInfoExA)(
32 IN RPC_BINDING_HANDLE Binding,
33 IN unsigned char __RPC_FAR * ServerPrincName,
34 IN unsigned long AuthnLevel,
35 IN unsigned long AuthnSvc,
36 IN RPC_AUTH_IDENTITY_HANDLE AuthIdentity, OPTIONAL
37 IN unsigned long AuthzSvc,
38 IN RPC_SECURITY_QOS *SecurityQos OPTIONAL
41 typedef RPC_STATUS (RPC_ENTRY *FP_RpcBindingSetAuthInfoExW)(
42 IN RPC_BINDING_HANDLE Binding,
43 IN unsigned short __RPC_FAR * ServerPrincName,
44 IN unsigned long AuthnLevel,
45 IN unsigned long AuthnSvc,
46 IN RPC_AUTH_IDENTITY_HANDLE AuthIdentity, OPTIONAL
47 IN unsigned long AuthzSvc, OPTIONAL
48 IN RPC_SECURITY_QOS *SecurityQOS
51 typedef RPC_STATUS (RPC_ENTRY *FP_RpcServerRegisterIfEx)(
52 IN RPC_IF_HANDLE IfSpec,
53 IN UUID __RPC_FAR * MgrTypeUuid,
54 IN RPC_MGR_EPV __RPC_FAR * MgrEpv,
55 IN unsigned int Flags,
56 IN unsigned int MaxCalls,
57 IN RPC_IF_CALLBACK_FN __RPC_FAR *IfCallback
61 #define FP_RpcBindingSetAuthInfoEx FP_RpcBindingSetAuthInfoExW
62 #define FN_RpcBindingSetAuthInfoEx "RpcBindingSetAuthInfoExW"
64 #define FP_RpcBindingSetAuthInfoEx FP_RpcBindingSetAuthInfoExA
65 #define FN_RpcBindingSetAuthInfoEx "RpcBindingSetAuthInfoExA"
68 #define FN_RpcServerRegisterIfEx "RpcServerRegisterIfEx"
75 FP_RpcBindingSetAuthInfoEx fRpcBindingSetAuthInfoEx;
76 FP_RpcServerRegisterIfEx fRpcServerRegisterIfEx;
79 static DWORD Initialize();
80 static DWORD Cleanup();
81 static DWORD Info(InitInfo& info);
83 static bool Initialized() { return s_init; }
86 static CcOsLock s_lock;
87 static DWORD s_refcount;
90 static InitInfo s_info;
91 static HINSTANCE s_hRpcDll;
94 #define INIT_INIT_EX(trap, error) \
97 if (!Init::Initialized()) \
99 DWORD rc = Init::Initialize(); \
100 if (rc) return (trap) ? (error) : rc; \