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.

197 lines
6.9 KiB

  1. #ifndef __EXTRA_H__
  2. #define __EXTRA_H__
  3. /* hacked headers from filesync... */
  4. #define PUBLIC FAR PASCAL
  5. #define CPUBLIC FAR _cdecl
  6. #define PRIVATE NEAR PASCAL
  7. #define MAXBUFLEN 260
  8. #define MAXMSGLEN 520
  9. #define MAXMEDLEN 64
  10. #define MAXSHORTLEN 32
  11. #define NULL_CHAR '\0'
  12. #define DPA_ERR (-1)
  13. #define DPA_APPEND 0x7fff
  14. #define CRL_FLAGS CRL_FL_DELETE_DELETED_TWINS
  15. /* err.h */
  16. #include "err.h"
  17. /* port32.h */
  18. #ifndef CSC_ON_NT
  19. /* void Cls_OnContextMenu(HWND hwnd, HWND hwndClick, int x, int y) */
  20. #define HANDLE_WM_CONTEXTMENU(hwnd, wParam, lParam, fn) \
  21. ((fn)((hwnd), (HWND)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
  22. #endif
  23. void InitializeAll(WPARAM wParam);
  24. /* globals...*/
  25. extern UINT g_uDumpFlags; // Controls what structs get dumped
  26. extern int g_cxIconSpacing;
  27. extern int g_cyIconSpacing;
  28. extern int g_cxBorder;
  29. extern int g_cyBorder;
  30. extern int g_cxMargin;
  31. extern int g_cxIcon;
  32. extern int g_cyIcon;
  33. extern int g_cxIconMargin;
  34. extern int g_cyIconMargin;
  35. extern int g_cxLabelMargin;
  36. extern int g_cyLabelSpace;
  37. extern char const FAR c_szWinHelpFile[];
  38. // Debugging variables
  39. extern UINT g_uBreakFlags; // Controls when to int 3
  40. extern UINT g_uTraceFlags; // Controls what trace messages are spewed
  41. extern UINT g_uDumpFlags; // Controls what structs get dumped
  42. /* brfprv.h */
  43. void PUBLIC PathMakePresentable(LPSTR pszPath);
  44. UINT PUBLIC PathGetLocality(LPCSTR pszPath, LPSTR pszBuf);
  45. LPSTR PUBLIC PathFindNextComponentI(LPCSTR lpszPath);
  46. // Path locality values, relative to a briefcase
  47. //
  48. #define PL_FALSE 0 // path is not related at all to a briefcase
  49. #define PL_ROOT 1 // path directly references the root of a briefcase
  50. #define PL_INSIDE 2 // path is somewhere inside a briefcase
  51. /* comm.h */
  52. LPSTR PUBLIC _ConstructMessageString(HINSTANCE hinst, LPCSTR pszMsg, va_list *ArgList);
  53. BOOL PUBLIC ConstructMessage(LPSTR * ppsz, HINSTANCE hinst, LPCSTR pszMsg, ...);
  54. // Flags for MyDrawText()
  55. #define MDT_DRAWTEXT 0x00000001
  56. #define MDT_ELLIPSES 0x00000002
  57. #define MDT_LINK 0x00000004
  58. #define MDT_SELECTED 0x00000008
  59. #define MDT_DESELECTED 0x00000010
  60. #define MDT_DEPRESSED 0x00000020
  61. #define MDT_EXTRAMARGIN 0x00000040
  62. #define MDT_TRANSPARENT 0x00000080
  63. #define MDT_LEFT 0x00000100
  64. #define MDT_RIGHT 0x00000200
  65. #define MDT_CENTER 0x00000400
  66. #define MDT_VCENTER 0x00000800
  67. #define MDT_CLIPPED 0x00001000
  68. void PUBLIC MyDrawText(HDC hdc, LPCSTR pszText, RECT FAR* prc, UINT flags, int cyChar, int cxEllipses, COLORREF clrText, COLORREF clrTextBk);
  69. void PUBLIC FileTimeToDateTimeString(LPFILETIME pft, LPSTR pszBuf, int cchBuf);
  70. // Copies psz into *ppszBuf and (re)allocates *ppszBuf accordingly
  71. BOOL PUBLIC GSetString(LPSTR * ppszBuf, LPCSTR psz);
  72. // FileInfo struct that contains file time/size info
  73. //
  74. typedef struct _FileInfo
  75. {
  76. HICON hicon;
  77. FILETIME ftMod;
  78. DWORD dwSize; // size of the file
  79. DWORD dwAttributes; // attributes
  80. LPARAM lParam;
  81. LPSTR pszDisplayName; // points to the display name
  82. char szPath[1];
  83. } FileInfo;
  84. #define FIGetSize(pfi) ((pfi)->dwSize)
  85. #define FIGetPath(pfi) ((pfi)->szPath)
  86. #define FIGetDisplayName(pfi) ((pfi)->pszDisplayName)
  87. #define FIGetAttributes(pfi) ((pfi)->dwAttributes)
  88. #define FIIsFolder(pfi) (IsFlagSet((pfi)->dwAttributes, SFGAO_FOLDER))
  89. #ifndef REINT
  90. // tHACK to not cause warnings in reint.c because of this def later in shdsys.h
  91. #define SetFlag(obj, f) do {obj |= (f);} while (0)
  92. #define ToggleFlag(obj, f) do {obj ^= (f);} while (0)
  93. #define ClearFlag(obj, f) do {obj &= ~(f);} while (0)
  94. #define IsFlagSet(obj, f) (BOOL)(((obj) & (f)) == (f))
  95. #define IsFlagClear(obj, f) (BOOL)(((obj) & (f)) != (f))
  96. #endif
  97. // Flags for FICreate
  98. #define FIF_DEFAULT 0x0000
  99. #define FIF_ICON 0x0001
  100. #define FIF_DONTTOUCH 0x0002
  101. HRESULT PUBLIC FICreate(LPCSTR pszPath, FileInfo ** ppfi, UINT uFlags);
  102. BOOL PUBLIC FISetPath(FileInfo ** ppfi, LPCSTR pszPathNew, UINT uFlags);
  103. BOOL PUBLIC FIGetInfoString(FileInfo * pfi, LPSTR pszBuf, int cchBuf);
  104. void PUBLIC FIFree(FileInfo * pfi);
  105. //
  106. // Non-shared memory allocation
  107. //
  108. // void * GAlloc(DWORD cbBytes)
  109. // Alloc a chunk of memory, quickly, with no 64k limit on size of
  110. // individual objects or total object size. Initialize to zero.
  111. //
  112. #define GAlloc(cbBytes) GlobalAlloc(GPTR, cbBytes)
  113. // void * GReAlloc(void * pv, DWORD cbNewSize)
  114. // Realloc one of above. If pv is NULL, then this function will do
  115. // an alloc for you. Initializes new portion to zero.
  116. //
  117. #define GReAlloc(pv, cbNewSize) GlobalReAlloc(pv, cbNewSize, GMEM_MOVEABLE | GMEM_ZEROINIT)
  118. // void GFree(void *pv)
  119. // Free pv if it is nonzero. Set pv to zero.
  120. //
  121. #define GFree(pv) do { (pv) ? GlobalFree(pv) : (void)0; pv = NULL; } while (0)
  122. // DWORD GGetSize(void *pv)
  123. // Get the size of a block allocated by Alloc()
  124. //
  125. #define GGetSize(pv) GlobalSize(pv)
  126. // type * GAllocType(type); (macro)
  127. // Alloc some memory the size of <type> and return pointer to <type>.
  128. //
  129. #define GAllocType(type) (type *)GAlloc(sizeof(type))
  130. // type * GAllocArray(type, int cNum); (macro)
  131. // Alloc an array of data the size of <type>.
  132. //
  133. #define GAllocArray(type, cNum) (type *)GAlloc(sizeof(type) * (cNum))
  134. // type * GReAllocArray(type, void * pb, int cNum);
  135. //
  136. #define GReAllocArray(type, pb, cNum) (type *)GReAlloc(pb, sizeof(type) * (cNum))
  137. // Color macros
  138. //
  139. #define ColorText(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT)
  140. #define ColorBk(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHT : COLOR_WINDOW)
  141. #define ColorMenuText(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)
  142. #define ColorMenuBk(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHT : COLOR_MENU)
  143. #define GetImageDrawStyle(nState) (((nState) & ODS_SELECTED) ? ILD_SELECTED : ILD_NORMAL)
  144. #define CCH_NUL (sizeof(TCHAR))
  145. #define CbFromCch(cch) ((cch)*sizeof(TCHAR))
  146. /* strings.h */
  147. LPSTR PUBLIC SzFromIDS (UINT ids, LPSTR pszBuf, UINT cchBuf);
  148. #define IsSzEqual(sz1, sz2) (BOOL)(lstrcmpi(sz1, sz2) == 0)
  149. /* comm.h */
  150. VOID PUBLIC SetRectFromExtent(HDC hdc, LPRECT lprc, LPCSTR lpcsz);
  151. #endif