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.

113 lines
3.3 KiB

  1. #include <windows.h>
  2. #include <delayimp.h>
  3. #include <esent.h>
  4. ////////////////////////////////////////////////////////////////////////////////
  5. static JET_ERR WINAPI hook_ESENT()
  6. {
  7. return JET_wrnNyi;
  8. }
  9. static HRESULT WINAPI hook_HRESULT()
  10. {
  11. return HRESULT_FROM_WIN32( ERROR_PROC_NOT_FOUND );
  12. }
  13. static VOID* WINAPI hook_NULL()
  14. {
  15. SetLastError( ERROR_PROC_NOT_FOUND );
  16. return NULL;
  17. }
  18. static DWORD WINAPI hook_ACCESSDENIED()
  19. {
  20. return ERROR_ACCESS_DENIED;
  21. }
  22. ////////////////////////////////////////////////////////////////////////////////
  23. FARPROC WINAPI HELPSVC_DelayLoadFailureHook( UINT unReason, PDelayLoadInfo pDelayInfo )
  24. {
  25. if(!lstrcmpiA( pDelayInfo->szDll, "esent.dll" ))
  26. {
  27. // ESENT.DLL :: JetAttachDatabase
  28. // ESENT.DLL :: JetBeginSession
  29. // ESENT.DLL :: JetBeginTransaction
  30. // ESENT.DLL :: JetCloseDatabase
  31. // ESENT.DLL :: JetCloseTable
  32. // ESENT.DLL :: JetCommitTransaction
  33. // ESENT.DLL :: JetCreateDatabase
  34. // ESENT.DLL :: JetCreateTable
  35. // ESENT.DLL :: JetCreateTableColumnIndex
  36. // ESENT.DLL :: JetDBUtilities
  37. // ESENT.DLL :: JetDelete
  38. // ESENT.DLL :: JetDetachDatabase
  39. // ESENT.DLL :: JetDupCursor
  40. // ESENT.DLL :: JetEndSession
  41. // ESENT.DLL :: JetGetObjectInfo
  42. // ESENT.DLL :: JetGetTableColumnInfo
  43. // ESENT.DLL :: JetGetTableIndexInfo
  44. // ESENT.DLL :: JetGotoBookmark
  45. // ESENT.DLL :: JetInit
  46. // ESENT.DLL :: JetMakeKey
  47. // ESENT.DLL :: JetMove
  48. // ESENT.DLL :: JetOpenDatabase
  49. // ESENT.DLL :: JetOpenTable
  50. // ESENT.DLL :: JetPrepareUpdate
  51. // ESENT.DLL :: JetResetSessionContext
  52. // ESENT.DLL :: JetRetrieveColumn
  53. // ESENT.DLL :: JetRetrieveColumns
  54. // ESENT.DLL :: JetRollback
  55. // ESENT.DLL :: JetSeek
  56. // ESENT.DLL :: JetSetColumn
  57. // ESENT.DLL :: JetSetCurrentIndex2
  58. // ESENT.DLL :: JetSetIndexRange
  59. // ESENT.DLL :: JetSetSessionContext
  60. // ESENT.DLL :: JetSetSystemParameter
  61. // ESENT.DLL :: JetTerm2
  62. // ESENT.DLL :: JetUpdate
  63. return (FARPROC)hook_ESENT;
  64. }
  65. else if(!lstrcmpiA( pDelayInfo->szDll, "wintrust.dll" ))
  66. {
  67. // WINTRUST.DLL :: WinVerifyTrust
  68. return (FARPROC)hook_HRESULT;
  69. }
  70. else if(!lstrcmpiA( pDelayInfo->szDll, "NETAPI32.dll" ))
  71. {
  72. // NETAPI32.DLL :: NetApiBufferFree
  73. // NETAPI32.DLL :: NetLocalGroupAdd
  74. // NETAPI32.DLL :: NetLocalGroupAddMembers
  75. // NETAPI32.DLL :: NetLocalGroupDel
  76. // NETAPI32.DLL :: NetUserAdd
  77. // NETAPI32.DLL :: NetUserDel
  78. // NETAPI32.DLL :: NetUserGetInfo
  79. // NETAPI32.DLL :: NetUserSetInfo
  80. return (FARPROC)hook_ACCESSDENIED;
  81. }
  82. // CABINET.DLL :: *
  83. // CRYPT32.DLL :: CertCloseStore
  84. // CRYPT32.DLL :: CertEnumCertificatesInStore
  85. // CRYPT32.DLL :: CertFreeCertificateContext
  86. // CRYPT32.DLL :: CertGetNameStringW
  87. // CRYPT32.DLL :: CryptQueryObject
  88. // SECUR32.dll :: TranslateNameW
  89. // SHLWAPI.DLL :: StrChrA
  90. // SHLWAPI.DLL :: StrStrIW
  91. // USERENV.DLL :: CreateEnvironmentBlock
  92. // USERENV.DLL :: DestroyEnvironmentBlock
  93. // WININET.DLL :: InternetCanonicalizeUrlW
  94. // WINSTA.DLL :: WinStationIsHelpAssistantSession
  95. // WINSTA.DLL :: WinStationQueryInformationW
  96. // WTSAPI32.DLL :: WTSEnumerateSessionsW
  97. // WTSAPI32.DLL :: WTSFreeMemory
  98. return (FARPROC)hook_NULL; // Also covers hook_ZERO and hook_FALSE.
  99. }
  100. // we assume DELAYLOAD_VERSION >= 0x0200
  101. PfnDliHook __pfnDliFailureHook2 = HELPSVC_DelayLoadFailureHook;