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.

71 lines
2.5 KiB

  1. #ifndef __MapiInit_h__
  2. #define __MapiInit_h__
  3. #include <mapix.h>
  4. // This defines a bunch of macros for pretty GetProcAddress stuff...
  5. // DECLARE_PFNTYPE is for those functions that are not defined as the example above
  6. #define DECLARE_PFNTYPE( FnName ) typedef FnName FAR* LP##FnName;
  7. #define DECLARE_PFNTYPE_INST( FnName ) LP##FnName lpfn##FnName = NULL;
  8. // DECLARE_PROC goes in the header file
  9. #define DECLARE_PROC( FnDecl, FnName ) extern LP##FnDecl lpfn##FnName;
  10. // DECLARE_PROC_INST goes in the .c or .cpp file
  11. #define DECLARE_PROC_INST( FnDecl, FnName ) LP##FnDecl lpfn##FnName = NULL;
  12. // This begins a proc map as described at the top of this file
  13. #define BEGIN_PROC_MAP( LibName ) APIFCN LibName##ProcList[] = {
  14. // Each function that is being loaded has an entry in the proc map
  15. #define PROC_MAP_ENTRY( FnName ) { (LPVOID * ) &lpfn##FnName, #FnName },
  16. // Some functions we have to give an explicit name
  17. #define PROC_MAP_ENTRY_EXPLICIT_NAME( pFnName, FnName ) { (LPVOID * ) &lpfn##pFnName, #FnName },
  18. // This is at the end of a proc map
  19. #define END_PROC_MAP };
  20. // User calls LOAD_PROCS with the PROC map that they have built....
  21. #define LOAD_PROCS(szDllName, LibName, pHInstance) HrInitLpfn(LibName##ProcList, ARRAY_ELEMENTS(LibName##ProcList), pHInstance, szDllName);
  22. typedef void ( STDAPICALLTYPE FREEPROWS ) ( LPSRowSet lpRows );
  23. typedef FREEPROWS FAR* LPFREEPROWS;
  24. typedef HRESULT( STDAPICALLTYPE HRQUERYALLROWS ) (
  25. LPMAPITABLE lpTable,
  26. LPSPropTagArray lpPropTags,
  27. LPSRestriction lpRestriction,
  28. LPSSortOrderSet lpSortOrderSet,
  29. LONG crowsMax,
  30. LPSRowSet FAR *lppRows
  31. );
  32. typedef HRQUERYALLROWS FAR* LPHRQUERYALLROWS;
  33. typedef HRESULT( STDAPICALLTYPE HRGETONEPROP ) (
  34. LPMAPIPROP lpMapiProp,
  35. ULONG ulPropTag,
  36. LPSPropValue FAR *lppProp
  37. );
  38. typedef HRGETONEPROP FAR* LPHRGETONEPROP;
  39. // We are forward declaring them like this so that
  40. // the fns can be visible from several cpp files....
  41. // MAPI32.DLL stuff
  42. DECLARE_PROC( MAPIINITIALIZE, MAPIInitialize );
  43. DECLARE_PROC( MAPIUNINITIALIZE, MAPIUninitialize );
  44. DECLARE_PROC( MAPIALLOCATEBUFFER, MAPIAllocateBuffer );
  45. DECLARE_PROC( MAPIALLOCATEMORE, MAPIAllocateMore );
  46. DECLARE_PROC( MAPIFREEBUFFER, MAPIFreeBuffer );
  47. DECLARE_PROC( MAPILOGONEX, MAPILogonEx );
  48. DECLARE_PROC( MAPIADMINPROFILES, MAPIAdminProfiles );
  49. DECLARE_PROC( FREEPROWS, FreeProws );
  50. DECLARE_PROC( HRQUERYALLROWS, HrQueryAllRows );
  51. DECLARE_PROC( HRGETONEPROP, HrGetOneProp );
  52. bool LoadMapiFns( HINSTANCE* phInstMapi32DLL );
  53. #endif // __MapiInit_h__