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.

110 lines
2.9 KiB

  1. #ifndef WIN32_LEAN_AND_MEAN
  2. #define WIN32_LEAN_AND_MEAN
  3. #endif // WIN32_LEAN_AND_MEAN
  4. #include <windows.h>
  5. #ifndef SECURITY_WIN32
  6. #define SECURITY_WIN32
  7. #endif // SECURITY_WIN32
  8. #include <shlwapi.h>
  9. #include "sspi.h"
  10. #include "issperr.h"
  11. #include "security.h"
  12. #include "md5.h"
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <assert.h>
  16. #include "mmfile.hxx"
  17. #include "cred.hxx"
  18. #include "params.hxx"
  19. #include "cache.hxx"
  20. #include "digest.hxx"
  21. #include "digestui.hxx"
  22. #include "persist.hxx"
  23. extern CRITICAL_SECTION DllCritSect;
  24. extern CCredCache *g_pCache;
  25. extern DWORD g_dwCredPersistAvail;
  26. extern BOOL g_fCredCacheInit;
  27. extern HMODULE g_hModule;
  28. extern HMODULE g_hShlwapi;
  29. extern DWORD_PTR g_pHeap;
  30. LPSTR NewString(LPSTR);
  31. //SECURITY_ATTRIBUTES *MakeFullAccessSA (VOID);
  32. BOOL DigestServicesExist();
  33. BOOL InitGlobals();
  34. #define SSP_SPM_NT_DLL "security.dll"
  35. #define SSP_SPM_WIN95_DLL "secur32.dll"
  36. // Data returned from package on QuerySecurityPackageInfo
  37. #define PACKAGE_NAME "Digest"
  38. #define PACKAGE_COMMENT "Digest SSPI Authentication Package"
  39. #define PACKAGE_NAMEW L"Digest"
  40. #define PACKAGE_COMMENTW L"Digest SSPI Authentication Package"
  41. #define PACKAGE_CAPABILITIES (SECPKG_FLAG_CLIENT_ONLY | SECPKG_FLAG_CONNECTION | SECPKG_FLAG_ASCII_BUFFERS)
  42. #define PACKAGE_VERSION 1
  43. #define MAX_USERNAME_LEN 64
  44. #define MAX_PASSWORD_LEN 64
  45. // This is the number we enter in
  46. // Registry\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\SecurityService
  47. // for example: 123 = REG_SZ "sampssp.dll"
  48. #define PACKAGE_RPCID SECPKG_ID_NONE
  49. #define PACKAGE_MAXTOKEN 0XFFFF
  50. // Digest setup registry info for DllInstall.
  51. // From wininet\auth\spluginx.hxx
  52. #define PLUGIN_AUTH_FLAGS_CAN_HANDLE_UI 0x02
  53. #define PLUGIN_AUTH_FLAGS_KEEP_ALIVE_NOT_REQUIRED 0x10
  54. // SecurityProviders reg key info.
  55. #define SECURITY_PROVIDERS_REG_KEY "System\\CurrentControlSet\\Control\\SecurityProviders"
  56. #ifndef UNIX
  57. #define SECURITY_PROVIDERS_SZ "SecurityProviders"
  58. #else
  59. #define SECURITY_PROVIDERS_SZ "Providers"
  60. #endif /* UNIX */
  61. // Hosts database reg key.
  62. #define DIGEST_HOSTS_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Digest\\Hosts\\"
  63. // Per-process lock.
  64. #define LOCK_GLOBALS() EnterCriticalSection(&DllCritSect)
  65. #define UNLOCK_GLOBALS() LeaveCriticalSection(&DllCritSect)
  66. // Current client logon.
  67. struct DIGEST_PKG_DATA
  68. {
  69. LPSTR szAppCtx;
  70. LPSTR szUserCtx;
  71. };
  72. #define DIGEST_PKG_FLAGS_IGNORE_TRUSTED_HOST_LIST 0x4
  73. #define DIGEST_PKG_FLAGS_IGNORE_STALE_HEADER 0x8
  74. // Shlwapi dll and exports used for parsing domain header.
  75. #define SHLWAPI_DLL_SZ "shlwapi.dll"
  76. typedef HRESULT (*PFNURLUNESCAPE)(LPSTR, LPSTR, LPDWORD, DWORD);
  77. typedef HRESULT (*PFNURLGETPART) (LPCSTR, LPSTR, LPDWORD, DWORD, DWORD);
  78. #ifdef DBG
  79. #define DIGEST_ASSERT(fVal) if (!fVal) DebugBreak();
  80. #else
  81. #define DIGEST_ASSERT(fVal)
  82. #endif
  83.