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.

121 lines
3.0 KiB

  1. #ifndef _OFFGLUE_H_
  2. #define _OFFGLUE_H_
  3. #define fTrue TRUE
  4. #define fFalse FALSE
  5. #define MsoImageList_Create ImageList_Create
  6. #define MsoImageList_Destroy ImageList_Destroy
  7. #define MsoImageList_ReplaceIcon ImageList_ReplaceIcon
  8. #define InvalidateVBAObjects(x,y,z)
  9. typedef struct _num
  10. {
  11. CHAR rgb[8];
  12. } NUM;
  13. typedef struct _ulargeint
  14. {
  15. union
  16. {
  17. struct
  18. {
  19. DWORD dw;
  20. DWORD dwh;
  21. };
  22. struct
  23. {
  24. WORD w0;
  25. WORD w1;
  26. WORD w2;
  27. WORD w3;
  28. };
  29. };
  30. } ULInt;
  31. // Macro to release a COM interface
  32. #define RELEASEINTERFACE( punk ) \
  33. if( punk != NULL ) \
  34. { \
  35. (punk)->lpVtbl->Release(punk); \
  36. punk = NULL; \
  37. }
  38. // Determine the elements in a fixed-sized vector
  39. #define NUM_ELEMENTS( vector ) ( sizeof(vector) / sizeof( (vector)[0] ) )
  40. #ifdef __cplusplus
  41. extern TEXT("C") {
  42. #endif // __cplusplus
  43. //Wrapper functions to the client supplied mem alloc and free
  44. void *PvMemAlloc(DWORD cb);
  45. void VFreeMemP(void *pv, DWORD cb);
  46. void *PvMemRealloc(void *pv, DWORD cbOld, DWORD cbNew);
  47. void *PvStrDup(LPCTSTR p);
  48. int CchGetString();
  49. // Function to convert a ULInt to an sz without leading zero's
  50. // Returns cch -- not including zero-terminator
  51. WORD CchULIntToSz(ULInt, TCHAR *, WORD );
  52. int CchTszLen(const TCHAR *psz);
  53. int CchWszLen(const WCHAR *psz);
  54. int CchAnsiSzLen(const CHAR *psz);
  55. VOID FillBuf(void *p, unsigned w, unsigned cb);
  56. // Function to scan memory for a given value
  57. BOOL FScanMem(LPBYTE pb, byte bVal, DWORD cb);
  58. BYTE *PbMemCopy(void *pvDst, const void *pvSrc, unsigned cb);
  59. VOID SzCopy(void *pszDst, const void *pszSrc);
  60. BYTE *PbSzNCopy(void *pvDst, const void *pvSrc, unsigned cb);
  61. BOOL FFreeAndCloseisdbhead();
  62. //Displays an alert using the give ids
  63. int IdDoAlert(HWND, int ids, int mb);
  64. // Wide-Char - MBCS helpers
  65. LPWSTR WINAPI A2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars);
  66. LPSTR WINAPI W2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars);
  67. #ifdef __cplusplus
  68. }; // extern "C"
  69. #endif // __cplusplus
  70. // Wide-Char - MBCS helpers
  71. #define USES_CONVERSION int _convert = 0
  72. #ifndef A2WHELPER
  73. #define A2WHELPER A2WHelper
  74. #define W2AHELPER W2AHelper
  75. #endif
  76. #define A2W(lpa) (\
  77. ((LPCSTR)lpa == NULL) ? NULL : ( _convert = (lstrlenA(lpa)+1),\
  78. A2WHELPER((LPWSTR) alloca(_convert*2), lpa, _convert)))
  79. #define W2A(lpw) (\
  80. ((LPCWSTR)lpw == NULL) ? NULL : ( _convert = (lstrlenW(lpw)+1)*2,\
  81. W2AHELPER((LPSTR) alloca(_convert), lpw, _convert)))
  82. #define A2CW(lpa) ((LPCWSTR)A2W(lpa))
  83. #define W2CA(lpw) ((LPCSTR)W2A(lpw))
  84. #ifdef _UNICODE
  85. #define T2A W2A
  86. #define A2T A2W
  87. #define T2W(lp) lp
  88. #define W2T(lp) lp
  89. #define T2CA W2CA
  90. #define A2CT A2CW
  91. #define T2CW(lp) lp
  92. #define W2CT(lp) lp
  93. #else
  94. #define T2W A2W
  95. #define W2T W2A
  96. #define T2A(lp) lp
  97. #define A2T(lp) lp
  98. #define T2CW A2CW
  99. #define W2CT W2CA
  100. #define T2CA(lp) lp
  101. #define A2CT(lp) lp
  102. #endif // _UNICODE
  103. #endif // _OFFGLUE_H_