Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

751 lines
20 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name :
  4. globals.c
  5. Abstract:
  6. Defines global variables for the common tcpsvcs.dll
  7. ( It is defined separately because the debug variable should be
  8. "C" variable.)
  9. Author:
  10. Murali R. Krishnan ( MuraliK ) 18-Nov-1994
  11. Revision History:
  12. MuraliK 21-Feb-1995 Added Debugging Variables definitions
  13. --*/
  14. #include <tcpdllp.hxx>
  15. #pragma hdrstop
  16. #include <isplat.h>
  17. //
  18. // private routines
  19. //
  20. BOOL
  21. DummySvclocFn(
  22. VOID
  23. );
  24. BOOL
  25. LoadNTSecurityEntryPoints(
  26. VOID
  27. );
  28. BOOL
  29. LoadW95SecurityEntryPoints(
  30. VOID
  31. );
  32. BOOL
  33. GetSecurityDllEntryPoints(
  34. IN HINSTANCE hInstance
  35. );
  36. BOOL
  37. GetLogonDllEntryPoints(
  38. IN HINSTANCE hInstance
  39. );
  40. //
  41. // Declare all the debugging related variables
  42. //
  43. #ifdef _NO_TRACING_
  44. DECLARE_DEBUG_VARIABLE();
  45. DECLARE_DEBUG_PRINTS_OBJECT();
  46. #endif
  47. #define DEFAULT_DEBUG_FLAGS_VALUE ( 0)
  48. //
  49. // inetsloc entry points
  50. //
  51. HINSTANCE g_hSvcLocDll = NULL;
  52. INET_REGISTER_SVC_FN pfnInetRegisterSvc = NULL;
  53. INET_DEREGISTER_SVC_FN pfnInetDeregisterSvc = NULL;
  54. INET_INIT_CONTROL_SVC_FN pfnInitSvcLoc = NULL;
  55. INET_INIT_CONTROL_SVC_FN pfnTerminateSvcLoc = NULL;
  56. // UNDONE remove? schannel no longer needed???
  57. //
  58. // schannel entrypoints
  59. //
  60. HINSTANCE g_hSchannel = NULL;
  61. SSL_CRACK_CERTIFICATE_FN fnCrackCert = NULL;
  62. SSL_FREE_CERTIFICATE_FN fnFreeCert = NULL;
  63. //
  64. // crypt32 entrypoints
  65. //
  66. HINSTANCE g_hCrypt32Dll = NULL;
  67. CRYPT32_FREE_CERTCTXT_FN pfnFreeCertCtxt = NULL;
  68. CRYPT32_GET_CERTCTXT_PROP_FN pfnGetCertCtxtProp = NULL;
  69. CRYPT32_CERT_VERIFY_REVOCATION_FN pfnCertVerifyRevocation = NULL;
  70. CRYPT32_CERT_VERIFY_TIME_VALIDITY pfnCertVerifyTimeValidity = NULL;
  71. CRYPT32_CERT_NAME_TO_STR_A_FN pfnCertNameToStrA = NULL;
  72. //
  73. // sspi entrypoints
  74. //
  75. HINSTANCE g_hSecurityDll = NULL;
  76. ACCEPT_SECURITY_CONTEXT_FN pfnAcceptSecurityContext = NULL;
  77. ACQUIRE_CREDENTIALS_HANDLE_FN pfnAcquireCredentialsHandle = NULL;
  78. COMPLETE_AUTH_TOKEN_FN pfnCompleteAuthToken = NULL;
  79. DELETE_SECURITY_CONTEXT_FN pfnDeleteSecurityContext = NULL;
  80. ENUMERATE_SECURITY_PACKAGES_FN pfnEnumerateSecurityPackages = NULL;
  81. IMPERSONATE_SECURITY_CONTEXT_FN pfnImpersonateSecurityContext = NULL;
  82. INITIALIZE_SECURITY_CONTEXT_FN pfnInitializeSecurityContext = NULL;
  83. FREE_CONTEXT_BUFFER_FN pfnFreeContextBuffer = NULL;
  84. FREE_CREDENTIALS_HANDLE_FN pfnFreeCredentialsHandle = NULL;
  85. QUERY_CONTEXT_ATTRIBUTES_FN pfnQueryContextAttributes = NULL;
  86. QUERY_SECURITY_CONTEXT_TOKEN_FN pfnQuerySecurityContextToken = NULL;
  87. QUERY_SECURITY_PACKAGE_INFO_FN pfnQuerySecurityPackageInfo = NULL;
  88. REVERT_SECURITY_CONTEXT_FN pfnRevertSecurityContext = NULL;
  89. //
  90. // logon entry points
  91. //
  92. LOGON32_INITIALIZE_FN pfnLogon32Initialize = NULL;
  93. LOGON_NET_USER_A_FN pfnLogonNetUserA = NULL;
  94. LOGON_NET_USER_W_FN pfnLogonNetUserW = NULL;
  95. NET_USER_COOKIE_A_FN pfnNetUserCookieA = NULL;
  96. LOGON_DIGEST_USER_A_FN pfnLogonDigestUserA = NULL;
  97. GET_DEFAULT_DOMAIN_NAME_FN pfnGetDefaultDomainName = NULL;
  98. //
  99. // advapi32
  100. //
  101. DUPLICATE_TOKEN_EX_FN pfnDuplicateTokenEx = NULL;
  102. LSA_OPEN_POLICY_FN pfnLsaOpenPolicy = NULL;
  103. LSA_RETRIEVE_PRIVATE_DATA_FN pfnLsaRetrievePrivateData = NULL;
  104. LSA_STORE_PRIVATE_DATA_FN pfnLsaStorePrivateData = NULL;
  105. LSA_FREE_MEMORY_FN pfnLsaFreeMemory = NULL;
  106. LSA_CLOSE_FN pfnLsaClose = NULL;
  107. LSA_NT_STATUS_TO_WIN_ERROR_FN pfnLsaNtStatusToWinError = NULL;
  108. //
  109. // kernel32
  110. //
  111. #if _WIN64
  112. LONG
  113. INET_InterlockedIncrement(
  114. IN OUT LPLONG lpAddend
  115. )
  116. {
  117. return InterlockedIncrement(lpAddend);
  118. }
  119. LONG
  120. INET_InterlockedCompareExchange (
  121. IN OUT PLONG Destination,
  122. IN LONG ExChange,
  123. IN LONG Comperand
  124. )
  125. {
  126. return InterlockedCompareExchange(Destination, ExChange, Comperand);
  127. }
  128. LONG
  129. INET_InterlockedExchangeAdd(
  130. IN OUT LPLONG Addend,
  131. IN LONG Value
  132. )
  133. {
  134. return InterlockedExchangeAdd(Addend, Value);
  135. }
  136. LONG
  137. __cdecl
  138. INET_InterlockedDecrement(
  139. IN OUT LPLONG lpAddend
  140. )
  141. {
  142. return InterlockedDecrement(lpAddend);
  143. }
  144. INTERLOCKED_EXCHANGE_ADD_FN pfnInterlockedExchangeAdd = INET_InterlockedExchangeAdd;
  145. INTERLOCKED_COMPARE_EXCHANGE_FN pfnInterlockedCompareExchange = (INTERLOCKED_COMPARE_EXCHANGE_FN)INET_InterlockedCompareExchange;
  146. INTERLOCKED_INCREMENT_FN pfnInterlockedIncrement = INET_InterlockedIncrement;
  147. INTERLOCKED_DECREMENT_FN pfnInterlockedDecrement = INET_InterlockedDecrement;
  148. READ_DIR_CHANGES_W_FN pfnReadDirChangesW = ReadDirectoryChangesW;
  149. #else
  150. INTERLOCKED_EXCHANGE_ADD_FN pfnInterlockedExchangeAdd = NULL;
  151. INTERLOCKED_COMPARE_EXCHANGE_FN pfnInterlockedCompareExchange = NULL;
  152. INTERLOCKED_INCREMENT_FN pfnInterlockedIncrement = NULL;
  153. INTERLOCKED_DECREMENT_FN pfnInterlockedDecrement = NULL;
  154. READ_DIR_CHANGES_W_FN pfnReadDirChangesW;
  155. #endif
  156. //
  157. // lonsi
  158. //
  159. HINSTANCE g_hLonsiNT = NULL;
  160. HINSTANCE g_hLonsiW95 = NULL;
  161. //
  162. // rpcref
  163. //
  164. HINSTANCE g_hRpcRef = NULL;
  165. PFN_INETINFO_START_RPC_SERVER pfnInetinfoStartRpcServer = NULL;
  166. PFN_INETINFO_STOP_RPC_SERVER pfnInetinfoStopRpcServer = NULL;
  167. BOOL
  168. GetDynamicEntryPoints(
  169. VOID
  170. )
  171. {
  172. HINSTANCE hTemp;
  173. DBG_ASSERT(IISIsValidPlatform());
  174. if ( TsIsWindows95() ) {
  175. goto win95_only;
  176. }
  177. //
  178. // advapi32
  179. //
  180. hTemp = LoadLibrary("advapi32.dll");
  181. if ( hTemp != NULL ) {
  182. pfnDuplicateTokenEx = (DUPLICATE_TOKEN_EX_FN)
  183. GetProcAddress(hTemp,"DuplicateTokenEx");
  184. pfnLsaOpenPolicy = (LSA_OPEN_POLICY_FN)
  185. GetProcAddress(hTemp,"LsaOpenPolicy");
  186. pfnLsaRetrievePrivateData = (LSA_RETRIEVE_PRIVATE_DATA_FN)
  187. GetProcAddress(hTemp,"LsaRetrievePrivateData");
  188. pfnLsaStorePrivateData = (LSA_STORE_PRIVATE_DATA_FN)
  189. GetProcAddress(hTemp,"LsaStorePrivateData");
  190. pfnLsaFreeMemory = (LSA_FREE_MEMORY_FN)
  191. GetProcAddress(hTemp,"LsaFreeMemory");
  192. pfnLsaClose = (LSA_CLOSE_FN)
  193. GetProcAddress(hTemp,"LsaClose");
  194. pfnLsaNtStatusToWinError = (LSA_NT_STATUS_TO_WIN_ERROR_FN)
  195. GetProcAddress(hTemp,"LsaNtStatusToWinError");
  196. FreeLibrary(hTemp);
  197. if ( !pfnDuplicateTokenEx ||
  198. !pfnLsaOpenPolicy ||
  199. !pfnLsaRetrievePrivateData ||
  200. !pfnLsaFreeMemory ||
  201. !pfnLsaClose ||
  202. !pfnLsaNtStatusToWinError ) {
  203. DBGPRINTF((DBG_CONTEXT,
  204. "Unable to obtain an advapi32 entry point\n"));
  205. goto error_exit;
  206. }
  207. } else {
  208. DBGPRINTF((DBG_CONTEXT, "Error %d loading advapi32.dll\n",
  209. GetLastError() ));
  210. goto error_exit;
  211. }
  212. //
  213. // kernel32
  214. //
  215. #ifndef _WIN64
  216. hTemp = LoadLibrary("kernel32.dll");
  217. if ( hTemp != NULL ) {
  218. pfnInterlockedExchangeAdd = (INTERLOCKED_EXCHANGE_ADD_FN)
  219. GetProcAddress(hTemp,"InterlockedExchangeAdd");
  220. pfnInterlockedCompareExchange = (INTERLOCKED_COMPARE_EXCHANGE_FN)
  221. GetProcAddress(hTemp,"InterlockedCompareExchange");
  222. pfnInterlockedIncrement = (INTERLOCKED_INCREMENT_FN)
  223. GetProcAddress(hTemp,"InterlockedIncrement");
  224. pfnInterlockedDecrement = (INTERLOCKED_DECREMENT_FN)
  225. GetProcAddress(hTemp,"InterlockedDecrement");
  226. pfnReadDirChangesW = (READ_DIR_CHANGES_W_FN)
  227. GetProcAddress(hTemp,"ReadDirectoryChangesW");
  228. FreeLibrary(hTemp);
  229. if ( !pfnInterlockedExchangeAdd ||
  230. !pfnInterlockedCompareExchange ||
  231. !pfnInterlockedIncrement ||
  232. !pfnInterlockedDecrement ||
  233. !pfnReadDirChangesW ) {
  234. DBGPRINTF((DBG_CONTEXT,
  235. "Unable to obtain NT kernel32 entry point\n"));
  236. goto error_exit;
  237. }
  238. } else {
  239. DBGPRINTF((DBG_CONTEXT,"Error %d loading kernel32.dll\n",
  240. GetLastError()));
  241. goto error_exit;
  242. }
  243. #endif
  244. //
  245. // load the service locator entry points. Not fatal on failure.
  246. //
  247. // Loading of the inetsloc.dll service is disabled
  248. // g_hSvcLocDll = LoadLibrary("inetsloc.dll");
  249. g_hSvcLocDll = NULL;
  250. if ( g_hSvcLocDll != NULL ) {
  251. pfnInetRegisterSvc = (INET_REGISTER_SVC_FN)
  252. GetProcAddress( g_hSvcLocDll, "INetRegisterService" );
  253. pfnInetDeregisterSvc = (INET_DEREGISTER_SVC_FN)
  254. GetProcAddress( g_hSvcLocDll, "INetDeregisterService" );
  255. pfnInitSvcLoc = (INET_INIT_CONTROL_SVC_FN)
  256. GetProcAddress( g_hSvcLocDll, "InitSvcLocator" );
  257. pfnTerminateSvcLoc = (INET_INIT_CONTROL_SVC_FN)
  258. GetProcAddress( g_hSvcLocDll, "TerminateSvcLocator" );
  259. if ( !pfnInetRegisterSvc ||
  260. !pfnInetDeregisterSvc ||
  261. !pfnInitSvcLoc ||
  262. !pfnTerminateSvcLoc ) {
  263. DBGPRINTF((DBG_CONTEXT,"Unable to find an inetsloc entrypoint\n"));
  264. FreeLibrary( g_hSvcLocDll );
  265. g_hSvcLocDll = NULL;
  266. }
  267. }
  268. if ( g_hSvcLocDll == NULL ) {
  269. DBGPRINTF((DBG_CONTEXT,
  270. "Unable to find an inetsloc.dll entrypoints!!!. Ignore if NTW.\n"));
  271. pfnInitSvcLoc = (INET_INIT_CONTROL_SVC_FN)DummySvclocFn;
  272. pfnTerminateSvcLoc = (INET_INIT_CONTROL_SVC_FN)DummySvclocFn;
  273. }
  274. //
  275. // rpcref
  276. //
  277. g_hRpcRef = LoadLibrary("rpcref.dll");
  278. if ( g_hRpcRef != NULL ) {
  279. pfnInetinfoStartRpcServer = (PFN_INETINFO_START_RPC_SERVER)
  280. GetProcAddress(g_hRpcRef,"InetinfoStartRpcServerListen");
  281. pfnInetinfoStopRpcServer = (PFN_INETINFO_STOP_RPC_SERVER)
  282. GetProcAddress(g_hRpcRef,"InetinfoStopRpcServerListen");
  283. } else {
  284. DBGPRINTF((DBG_CONTEXT, "Error %d loading rpcref.dll\n",
  285. GetLastError() ));
  286. goto error_exit;
  287. }
  288. if ( !LoadNTSecurityEntryPoints( ) ) {
  289. goto error_exit;
  290. }
  291. return(TRUE);
  292. win95_only:
  293. g_hLonsiW95 = LoadLibrary( "lonsiw95.dll" );
  294. if ( g_hLonsiW95 == NULL ) {
  295. DBGPRINTF((DBG_CONTEXT,"Error %d loading lonsiw95.dll\n",
  296. GetLastError()));
  297. goto error_exit;
  298. }
  299. //
  300. // kernel32
  301. //
  302. pfnInterlockedExchangeAdd = (INTERLOCKED_EXCHANGE_ADD_FN)
  303. GetProcAddress(g_hLonsiW95,"FakeInterlockedExchangeAdd");
  304. pfnInterlockedCompareExchange = (INTERLOCKED_COMPARE_EXCHANGE_FN)
  305. GetProcAddress(g_hLonsiW95,"FakeInterlockedCompareExchange");
  306. pfnInterlockedIncrement = (INTERLOCKED_INCREMENT_FN)
  307. GetProcAddress(g_hLonsiW95,"FakeInterlockedIncrement");
  308. pfnInterlockedDecrement = (INTERLOCKED_DECREMENT_FN)
  309. GetProcAddress(g_hLonsiW95,"FakeInterlockedDecrement");
  310. if ( !pfnInterlockedExchangeAdd ||
  311. !pfnInterlockedCompareExchange ||
  312. !pfnInterlockedIncrement ||
  313. !pfnInterlockedDecrement ) {
  314. DBGPRINTF((DBG_CONTEXT,
  315. "Unable to obtain Win95 kernel32 entry points\n"));
  316. goto error_exit;
  317. }
  318. //
  319. // svcloc
  320. //
  321. pfnInitSvcLoc = (INET_INIT_CONTROL_SVC_FN)DummySvclocFn;
  322. pfnTerminateSvcLoc = (INET_INIT_CONTROL_SVC_FN)DummySvclocFn;
  323. //
  324. // security/schannel/lsa
  325. //
  326. if ( !LoadW95SecurityEntryPoints( ) ) {
  327. goto error_exit;
  328. }
  329. return(TRUE);
  330. error_exit:
  331. return(FALSE);
  332. } // GetDynamicEntryPoints
  333. VOID
  334. FreeDynamicLibraries(
  335. VOID
  336. )
  337. {
  338. if ( g_hSchannel != NULL ) {
  339. FreeLibrary( g_hSchannel );
  340. g_hSchannel = NULL;
  341. }
  342. if ( g_hCrypt32Dll != NULL ) {
  343. FreeLibrary( g_hCrypt32Dll );
  344. g_hCrypt32Dll = NULL;
  345. }
  346. if ( g_hSecurityDll != NULL ) {
  347. FreeLibrary( g_hSecurityDll );
  348. g_hSecurityDll = NULL;
  349. }
  350. if ( g_hSvcLocDll != NULL ) {
  351. FreeLibrary( g_hSvcLocDll );
  352. g_hSvcLocDll = NULL;
  353. }
  354. if ( g_hRpcRef != NULL ) {
  355. FreeLibrary( g_hRpcRef );
  356. g_hRpcRef = NULL;
  357. }
  358. if ( g_hLonsiNT != NULL ) {
  359. FreeLibrary( g_hLonsiNT );
  360. g_hLonsiNT = NULL;
  361. }
  362. if ( g_hLonsiW95 != NULL ) {
  363. FreeLibrary( g_hLonsiW95 );
  364. g_hLonsiW95 = NULL;
  365. }
  366. return;
  367. } // FreeDynamicLibraries
  368. BOOL
  369. LoadNTSecurityEntryPoints(
  370. VOID
  371. )
  372. {
  373. IF_DEBUG(DLL_SECURITY) {
  374. DBGPRINTF((DBG_CONTEXT,"Entering LoadNTSecurityEntryPoints\n"));
  375. }
  376. //
  377. // Load Schannel
  378. //
  379. g_hSchannel = LoadLibrary( "schannel.dll" );
  380. if ( g_hSchannel != NULL ) {
  381. fnCrackCert = (SSL_CRACK_CERTIFICATE_FN)
  382. GetProcAddress( g_hSchannel, "SslCrackCertificate" );
  383. fnFreeCert = (SSL_FREE_CERTIFICATE_FN)
  384. GetProcAddress( g_hSchannel, "SslFreeCertificate" );
  385. } else {
  386. DBGPRINTF((DBG_CONTEXT,
  387. "Unable to load schannel.dll[err %d]\n", GetLastError() ));
  388. }
  389. //
  390. // Load Crypt32
  391. //
  392. g_hCrypt32Dll = LoadLibrary( "crypt32.dll" );
  393. if ( g_hCrypt32Dll != NULL ) {
  394. pfnFreeCertCtxt = (CRYPT32_FREE_CERTCTXT_FN)
  395. GetProcAddress( g_hCrypt32Dll, "CertFreeCertificateContext" );
  396. pfnGetCertCtxtProp = (CRYPT32_GET_CERTCTXT_PROP_FN)
  397. GetProcAddress( g_hCrypt32Dll, "CertGetCertificateContextProperty" );
  398. pfnCertVerifyRevocation = (CRYPT32_CERT_VERIFY_REVOCATION_FN)
  399. GetProcAddress( g_hCrypt32Dll, "CertVerifyRevocation" );
  400. pfnCertVerifyTimeValidity = (CRYPT32_CERT_VERIFY_TIME_VALIDITY)
  401. GetProcAddress( g_hCrypt32Dll, "CertVerifyTimeValidity" );
  402. pfnCertNameToStrA = (CRYPT32_CERT_NAME_TO_STR_A_FN)
  403. GetProcAddress( g_hCrypt32Dll, "CertNameToStrA" );
  404. } else {
  405. DBGPRINTF((DBG_CONTEXT,
  406. "Unable to load crypt32.dll[err %d]\n", GetLastError() ));
  407. }
  408. DBG_ASSERT( pfnFreeCertCtxt );
  409. DBG_ASSERT( pfnGetCertCtxtProp );
  410. DBG_ASSERT( pfnCertVerifyRevocation );
  411. DBG_ASSERT( pfnCertVerifyTimeValidity );
  412. DBG_ASSERT( pfnCertNameToStrA );
  413. //
  414. // Load security.dll
  415. //
  416. g_hSecurityDll = LoadLibrary( "security.dll" );
  417. if ( g_hSecurityDll == NULL ) {
  418. DBGPRINTF((DBG_CONTEXT,"Error %d loading security.dll\n",
  419. GetLastError()));
  420. return(FALSE);
  421. }
  422. if ( !GetSecurityDllEntryPoints( g_hSecurityDll ) ) {
  423. return(FALSE);
  424. }
  425. //
  426. // Load lsa stuff from lonsint.dll
  427. //
  428. g_hLonsiNT = LoadLibrary( "lonsint.dll" );
  429. if ( g_hLonsiNT == NULL ) {
  430. DBGPRINTF((DBG_CONTEXT,"Error %d loading lonsint.dll\n",
  431. GetLastError()));
  432. return(FALSE);
  433. }
  434. if ( !GetLogonDllEntryPoints( g_hLonsiNT ) ) {
  435. return FALSE;
  436. }
  437. return(TRUE);
  438. } // LoadNTSecurityEntryPoints
  439. BOOL
  440. LoadW95SecurityEntryPoints(
  441. VOID
  442. )
  443. {
  444. IF_DEBUG(DLL_SECURITY) {
  445. DBGPRINTF((DBG_CONTEXT,"Entering LoadW95SecurityEntryPoints\n"));
  446. }
  447. //
  448. // Load Schannel
  449. //
  450. fnCrackCert = NULL;
  451. fnFreeCert = NULL;
  452. //
  453. // Load security.dll
  454. //
  455. DBG_ASSERT(g_hLonsiW95 != NULL);
  456. if ( !GetSecurityDllEntryPoints( g_hLonsiW95 ) ) {
  457. return(FALSE);
  458. }
  459. if ( !GetLogonDllEntryPoints( g_hLonsiW95 ) ) {
  460. return FALSE;
  461. }
  462. return(TRUE);
  463. } // LoadNTSecurityEntryPoints
  464. BOOL
  465. GetSecurityDllEntryPoints(
  466. IN HINSTANCE hInstance
  467. )
  468. {
  469. pfnAcceptSecurityContext = (ACCEPT_SECURITY_CONTEXT_FN)
  470. GetProcAddress( hInstance, "AcceptSecurityContext" );
  471. pfnAcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN)
  472. GetProcAddress( hInstance, "AcquireCredentialsHandleA" );
  473. pfnCompleteAuthToken = (COMPLETE_AUTH_TOKEN_FN)
  474. GetProcAddress( hInstance, "CompleteAuthToken" );
  475. pfnDeleteSecurityContext = (DELETE_SECURITY_CONTEXT_FN)
  476. GetProcAddress( hInstance, "DeleteSecurityContext" );
  477. pfnEnumerateSecurityPackages = (ENUMERATE_SECURITY_PACKAGES_FN)
  478. GetProcAddress( hInstance, "EnumerateSecurityPackagesA" );
  479. pfnImpersonateSecurityContext = (IMPERSONATE_SECURITY_CONTEXT_FN)
  480. GetProcAddress( hInstance, "ImpersonateSecurityContext" );
  481. pfnInitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN)
  482. GetProcAddress( hInstance, "InitializeSecurityContextA" );
  483. pfnFreeContextBuffer = (FREE_CONTEXT_BUFFER_FN)
  484. GetProcAddress( hInstance, "FreeContextBuffer" );
  485. pfnFreeCredentialsHandle = (FREE_CREDENTIALS_HANDLE_FN)
  486. GetProcAddress( hInstance, "FreeCredentialsHandle" );
  487. pfnQueryContextAttributes = (QUERY_CONTEXT_ATTRIBUTES_FN)
  488. GetProcAddress( hInstance, "QueryContextAttributesA" );
  489. pfnQuerySecurityContextToken = (QUERY_SECURITY_CONTEXT_TOKEN_FN)
  490. GetProcAddress( hInstance, "QuerySecurityContextToken" );
  491. pfnQuerySecurityPackageInfo = (QUERY_SECURITY_PACKAGE_INFO_FN)
  492. GetProcAddress( hInstance, "QuerySecurityPackageInfoA" );
  493. pfnRevertSecurityContext = (REVERT_SECURITY_CONTEXT_FN)
  494. GetProcAddress( hInstance, "RevertSecurityContext" );
  495. if ( !pfnAcceptSecurityContext ||
  496. !pfnAcquireCredentialsHandle ||
  497. !pfnCompleteAuthToken ||
  498. !pfnDeleteSecurityContext ||
  499. !pfnEnumerateSecurityPackages ||
  500. !pfnImpersonateSecurityContext ||
  501. !pfnInitializeSecurityContext ||
  502. !pfnFreeContextBuffer ||
  503. !pfnFreeCredentialsHandle ||
  504. !pfnQueryContextAttributes ||
  505. !pfnQuerySecurityContextToken ||
  506. !pfnQuerySecurityPackageInfo ||
  507. !pfnRevertSecurityContext ) {
  508. DBGPRINTF((DBG_CONTEXT,"Unable to get security entry points\n"));
  509. SetLastError(ERROR_PROC_NOT_FOUND);
  510. DBG_ASSERT(FALSE);
  511. return FALSE;
  512. }
  513. return(TRUE);
  514. } // GetSecurityDllEntryPoints
  515. BOOL
  516. GetLogonDllEntryPoints(
  517. IN HINSTANCE hInstance
  518. )
  519. {
  520. pfnLogon32Initialize = (LOGON32_INITIALIZE_FN)
  521. GetProcAddress( hInstance, "IISLogon32Initialize" );
  522. pfnLogonNetUserA = (LOGON_NET_USER_A_FN)
  523. GetProcAddress( hInstance, "IISLogonNetUserA" );
  524. pfnLogonNetUserW = (LOGON_NET_USER_W_FN)
  525. GetProcAddress( hInstance, "IISLogonNetUserW" );
  526. pfnNetUserCookieA = (NET_USER_COOKIE_A_FN)
  527. GetProcAddress( hInstance, "IISNetUserCookieA" );
  528. pfnLogonDigestUserA = (LOGON_DIGEST_USER_A_FN)
  529. GetProcAddress( hInstance, "IISLogonDigestUserA" );
  530. pfnGetDefaultDomainName = (GET_DEFAULT_DOMAIN_NAME_FN)
  531. GetProcAddress( hInstance, "IISGetDefaultDomainName" );
  532. if ( !pfnLogon32Initialize ||
  533. !pfnLogonNetUserA ||
  534. !pfnLogonNetUserW ||
  535. !pfnNetUserCookieA ||
  536. !pfnLogonDigestUserA ||
  537. !pfnGetDefaultDomainName ) {
  538. DBGPRINTF((DBG_CONTEXT,"Unable to get an entry point on lonsint.dll\n"));
  539. SetLastError( ERROR_PROC_NOT_FOUND );
  540. DBG_ASSERT(FALSE);
  541. return FALSE;
  542. }
  543. return(TRUE);
  544. } // GetLogonDllEntryPoints
  545. #ifdef _NO_TRACING_
  546. DWORD
  547. GetDebugFlagsFromReg(IN LPCTSTR pszRegEntry)
  548. {
  549. HKEY hkey = NULL;
  550. DWORD err;
  551. DWORD dwDebug = DEFAULT_DEBUG_FLAGS_VALUE;
  552. err = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
  553. pszRegEntry,
  554. 0,
  555. KEY_READ,
  556. &hkey);
  557. if ( hkey != NULL) {
  558. DBG_CODE(
  559. dwDebug =
  560. LOAD_DEBUG_FLAGS_FROM_REG(hkey, DEFAULT_DEBUG_FLAGS_VALUE)
  561. );
  562. RegCloseKey(hkey);
  563. }
  564. return ( dwDebug);
  565. } // GetDebugFlagsFromReg()
  566. #endif
  567. BOOL
  568. DummySvclocFn(
  569. VOID
  570. )
  571. {
  572. return(TRUE);
  573. } // DummySvclocFn