Leaked source code of windows server 2003
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.

121 lines
2.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: demand.cpp
  7. //
  8. // Contents: On demand loading
  9. //
  10. // History: 12-Dec-98 philh Created
  11. // 01-Jan-02 philh Moved from wininet to winhttp
  12. //
  13. //----------------------------------------------------------------------------
  14. #include <global.hxx>
  15. #include <winwlx.h>
  16. #include <sensapi.h>
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Function: DemandLoadDllMain
  20. //
  21. // Synopsis: DLL Main like initialization of on demand loading
  22. //
  23. //----------------------------------------------------------------------------
  24. BOOL WINAPI DemandLoadDllMain (
  25. HMODULE hModule,
  26. ULONG ulReason,
  27. LPVOID pvReserved
  28. )
  29. {
  30. BOOL fRet = TRUE;
  31. switch ( ulReason )
  32. {
  33. case DLL_PROCESS_ATTACH:
  34. break;
  35. case DLL_THREAD_ATTACH:
  36. break;
  37. case DLL_PROCESS_DETACH:
  38. break;
  39. case DLL_THREAD_DETACH:
  40. break;
  41. }
  42. return( fRet );
  43. }
  44. //+---------------------------------------------------------------------------
  45. //
  46. // Function: CryptnetWlxLogoffEvent
  47. //
  48. // Synopsis: logoff event processing
  49. //
  50. //----------------------------------------------------------------------------
  51. BOOL WINAPI
  52. CryptnetWlxLogoffEvent (PWLX_NOTIFICATION_INFO pNotificationInfo)
  53. {
  54. return TRUE;
  55. }
  56. BOOL
  57. WINAPI
  58. I_CryptNetIsConnected()
  59. {
  60. DWORD dwFlags;
  61. BOOL fIsConnected;
  62. fIsConnected = IsNetworkAlive(&dwFlags);
  63. if (!fIsConnected) {
  64. DWORD dwLastError = GetLastError();
  65. I_CryptNetDebugErrorPrintfA(
  66. "CRYPTNET.DLL --> NOT CONNECTED : Error %d (0x%x)\n",
  67. dwLastError, dwLastError);
  68. }
  69. return fIsConnected;
  70. }
  71. //
  72. // Cracks the Url and returns the host name component.
  73. //
  74. BOOL
  75. WINAPI
  76. I_CryptNetGetHostNameFromUrl (
  77. IN LPWSTR pwszUrl,
  78. IN DWORD cchHostName,
  79. OUT LPWSTR pwszHostName
  80. )
  81. {
  82. BOOL fResult = TRUE;
  83. HRESULT hr;
  84. DWORD cchOut = cchHostName - 1;
  85. *pwszHostName = L'\0';
  86. // Remove any leading spaces
  87. while (L' ' == *pwszUrl)
  88. pwszUrl++;
  89. hr = UrlGetPartW(
  90. pwszUrl,
  91. pwszHostName,
  92. &cchOut,
  93. URL_PART_HOSTNAME,
  94. 0 // dwFlags
  95. );
  96. if (S_OK != hr)
  97. {
  98. SetLastError( (DWORD) hr );
  99. fResult = FALSE;
  100. }
  101. return fResult;
  102. }