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.

106 lines
2.4 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. dloaddef.w
  5. Abstract:
  6. This header defines the basic data types and macros needed to support
  7. building delay-load stubs to be linked into kernel32.
  8. See nt/base/dload where dload.lib is built.
  9. See nt/net/published/lib/dload where dloadnet.lib is built.
  10. Both are linked into kernel32 and provide the failure hooks which support
  11. delay loading (via /DELAYLOAD linker switch) various DLLs in the system.
  12. Author:
  13. Shaun Cox (shaunco) 10-Mar-2000
  14. Environment:
  15. User mode only.
  16. Revision History:
  17. --*/
  18. #pragma once
  19. #define celems(_x) (sizeof(_x) / sizeof(_x[0]))
  20. typedef struct _DLOAD_PROCNAME_ENTRY
  21. {
  22. LPCSTR pszProcName;
  23. FARPROC pfnProc;
  24. } DLOAD_PROCNAME_ENTRY;
  25. #define DLPENTRY(_fcn) { #_fcn, (FARPROC)_fcn },
  26. #define DEFINE_PROCNAME_ENTRIES(_dllbasename) \
  27. const DLOAD_PROCNAME_ENTRY c_PmapEntries_##_dllbasename [] =
  28. typedef struct _DLOAD_PROCNAME_MAP
  29. {
  30. UINT NumberOfEntries;
  31. const DLOAD_PROCNAME_ENTRY* pProcNameEntry;
  32. } DLOAD_PROCNAME_MAP;
  33. #define DECLARE_PROCNAME_MAP(_dllbasename) \
  34. extern const DLOAD_PROCNAME_MAP c_Pmap_##_dllbasename;
  35. #define DEFINE_PROCNAME_MAP(_dllbasename) \
  36. const DLOAD_PROCNAME_MAP c_Pmap_##_dllbasename = \
  37. { \
  38. celems(c_PmapEntries_##_dllbasename), \
  39. c_PmapEntries_##_dllbasename \
  40. };
  41. typedef struct _DLOAD_ORDINAL_ENTRY
  42. {
  43. DWORD dwOrdinal;
  44. FARPROC pfnProc;
  45. } DLOAD_ORDINAL_ENTRY;
  46. #define DLOENTRY(_ord, _fcn) { _ord, (FARPROC)_fcn },
  47. #define DEFINE_ORDINAL_ENTRIES(_dllbasename) \
  48. const DLOAD_ORDINAL_ENTRY c_OmapEntries_##_dllbasename [] =
  49. typedef struct _DLOAD_ORDINAL_MAP
  50. {
  51. UINT NumberOfEntries;
  52. const DLOAD_ORDINAL_ENTRY* pOrdinalEntry;
  53. } DLOAD_ORDINAL_MAP;
  54. #define DECLARE_ORDINAL_MAP(_dllbasename) \
  55. extern const DLOAD_ORDINAL_MAP c_Omap_##_dllbasename;
  56. #define DEFINE_ORDINAL_MAP(_dllbasename) \
  57. const DLOAD_ORDINAL_MAP c_Omap_##_dllbasename = \
  58. { \
  59. celems(c_OmapEntries_##_dllbasename), \
  60. c_OmapEntries_##_dllbasename \
  61. };
  62. typedef struct _DLOAD_DLL_ENTRY
  63. {
  64. LPCSTR pszDll;
  65. const DLOAD_PROCNAME_MAP* pProcNameMap;
  66. const DLOAD_ORDINAL_MAP* pOrdinalMap;
  67. } DLOAD_DLL_ENTRY;
  68. typedef struct _DLOAD_DLL_MAP
  69. {
  70. UINT NumberOfEntries;
  71. const DLOAD_DLL_ENTRY* pDllEntry;
  72. } DLOAD_DLL_MAP;