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.

390 lines
11 KiB

  1. // Copyright (C) 1996-1997 Microsoft Corporation. All rights reserved.
  2. #ifndef __HEADER_H__
  3. #define __HEADER_H__
  4. #ifndef STDCALL
  5. #define STDCALL __stdcall
  6. #endif
  7. #ifndef INLINE
  8. #define INLINE __inline // Remove for profiling
  9. #endif
  10. #define MAX_TOPIC_NAME 256
  11. #define MAX_STRING_RESOURCE_LEN 256
  12. #define STRING_SEP_CHAR '|'
  13. const int MAX_FLAGS = 3;
  14. const char CH_MACRO = '!'; // means a macro in a .hhc file
  15. typedef unsigned long HASH;
  16. #define _WINUSERP_ // so winuserp.h doesn't get pulled (which causes fatal errors)
  17. //////////////////////////////////// Includes ///////////////////////////////
  18. // Don't mess with the order header files are included
  19. #include <windows.h>
  20. #include <winnls.h>
  21. #include <ole2.h>
  22. #include <stddef.h>
  23. #include <malloc.h>
  24. #include <crtdbg.h>
  25. #include "IPServer.h"
  26. #define NO_SHLWAPI_PATH
  27. #define NO_SHLWAPI_REG
  28. #define NO_SHLWAPI_STREAM
  29. #define NO_SHLWAPI_GDI
  30. #include <shlwapi.h>
  31. //
  32. // W2K contants which aren't in our headers.
  33. //
  34. #ifndef WM_CHANGEUISTATE
  35. //--- New messages in NT5 only.
  36. #define WM_CHANGEUISTATE 0x0127
  37. #define WM_UPDATEUISTATE 0x0128
  38. #define WM_QUERYUISTATE 0x0129
  39. //--- LOWORD(wParam) values in WM_*UISTATE.
  40. #define UIS_SET 1
  41. #define UIS_CLEAR 2
  42. #define UIS_INITIALIZE 3
  43. //--- HIWORD(wParam) values in WM_*UISTATE
  44. #define UISF_HIDEFOCUS 0x1
  45. #define UISF_HIDEACCEL 0x2
  46. #endif
  47. // Debugging Support Class --- ClassObjectCount
  48. #include "objcnt.h"
  49. #undef StrChr
  50. #undef StrRChr
  51. #include "unicode.h"
  52. #include "funcs.h"
  53. #include "cstr.h"
  54. #include "shared.h"
  55. #include "lcmem.h"
  56. #include "ctable.h"
  57. #include "wmp.h"
  58. // Language Information
  59. #include "language.h"
  60. // Get the ATL includes.
  61. #include "atlinc.h"
  62. #ifdef HHCTRL
  63. // Include the definitions for HTML Help API
  64. #include "htmlhelp.h"
  65. // Include out global resource cache
  66. #include "rescache.h"
  67. #endif
  68. /////////////////////////////////////////////////////////////////////////////
  69. // map as many CRT functions to Win32, ShlWAPI, or private functions as we can
  70. //
  71. // UNICODE
  72. #define wcscat StrCatW
  73. #define wcscpy StrCpyW
  74. #define _wcscpy StrCpyW
  75. #define wcsncpy StrCpyNW
  76. #define _wcsncpy StrCpyNW
  77. #define wcscmp StrCmpW
  78. #define _wcscmp StrCmpW
  79. #define wcsicmp StrCmpIW
  80. #define _wcsicmp StrCmpIW
  81. #define wcsnicmp StrCmpNIW
  82. #define wcslen lstrlenW
  83. // intrinsics -- no need to map these
  84. // #define strcat lstrcatA
  85. // #define strlen lstrlenA
  86. // #define strcpy lstrcpyA
  87. // #define strcmp lstrcmpA
  88. // ANSI
  89. #define StrChr StrChrA
  90. #define strchr StrChrA
  91. #define strncpy lstrcpynA
  92. #define stricmp lstrcmpiA
  93. #define _stricmp lstrcmpiA
  94. #define strcmpi lstrcmpiA
  95. #define _strcmpi lstrcmpiA
  96. #define strncmp StrCmpNA
  97. #define strnicmp StrCmpNIA
  98. #define _strnicmp StrCmpNIA
  99. #define strstr StrStrA
  100. #define stristr StrStrIA
  101. // #define strncat StrCatN --> not supported in IE3 shlwapi
  102. // MISC
  103. #define splitpath SplitPath
  104. #define _splitpath SplitPath
  105. #define atoi Atoi
  106. #define isspace IsSpace
  107. #define strpbrk StrPBrk
  108. #define qsort QSort
  109. #define tolower ToLower
  110. #define strrchr StrRChr
  111. #ifdef _DEBUG
  112. #define STATIC // because icecap doesn't believe in static functions
  113. #else
  114. #define STATIC static
  115. #endif
  116. // the length of a guid once printed out with -'s, leading and trailing bracket,
  117. // plus 1 for NULL
  118. const int GUID_STR_LEN = 40;
  119. typedef enum {
  120. ACT_NOTHING,
  121. ACT_ABOUT_BOX,
  122. ACT_CONTENTS,
  123. ACT_INDEX,
  124. ACT_RELATED_TOPICS,
  125. ACT_TEXT_POPUP,
  126. ACT_WINHELP,
  127. ACT_HHCTRL_VERSION,
  128. ACT_SPLASH,
  129. ACT_SHORTCUT,
  130. ACT_CLOSE,
  131. ACT_MINIMIZE,
  132. ACT_MAXIMIZE,
  133. ACT_KEYWORD_SEARCH,
  134. ACT_TCARD, // data stored in m_pszActionData, not m_ptblItems
  135. ACT_HHWIN_PRINT, // tell hhwin to print the current frameset
  136. ACT_KLINK,
  137. ACT_ALINK,
  138. ACT_SAMPLE,
  139. } CTRL_ACTION;
  140. // The type of image to display for the control
  141. typedef enum {
  142. IMG_BITMAP,
  143. IMG_CHILD_WINDOW,
  144. IMG_TEXT,
  145. IMG_RELATED, // Related topics
  146. IMG_BUTTON,
  147. } IMAGE_TYPE;
  148. enum THRD_COMMAND {
  149. THRD_ANY,
  150. THRD_TERMINATE,
  151. };
  152. typedef enum {
  153. SK_SET,
  154. SK_CUR,
  155. SK_END
  156. } SEEK_TYPE;
  157. #define CH_OPEN_PAREN '('
  158. #define CH_CLOSE_PAREN ')'
  159. #define CH_COLON ':'
  160. #define CH_SEMICOLON ';'
  161. #define CH_START_QUOTE '`'
  162. #define CH_END_QUOTE '\''
  163. #define CH_QUOTE '"'
  164. #define CH_BACKSLASH '\\'
  165. #define CH_FORWARDSLASH '/'
  166. #define CH_EQUAL '='
  167. #define CH_SPACE ' '
  168. #define CH_COMMA ','
  169. #define CH_LEFT_BRACKET '['
  170. #define CH_RIGHT_BRACKET ']'
  171. #define CH_TAB '\t'
  172. // Same errors as used by hha.dll
  173. typedef enum { // File System errors
  174. FSERR_NONE = 0, // no error
  175. FSERR_CANCELLED, // user cancelled
  176. FSERR_CANT_OPEN, // can't open file
  177. FSERR_CANT_READ, // error while reading the file
  178. FSERR_CANT_WRITE, // error while writing to the file
  179. FSERR_INVALID_FORMAT, // invalid file format
  180. FSERR_TRUNCATED, // file is truncated
  181. FSERR_INSF_MEMORY, // insuficient global memory
  182. FSERR_INTERNAL, // internal error
  183. FSERR_24BIT_NOT_SUPPORTED, // not supported by this file format
  184. FSERR_REALLY_A_BMP, // This is really a BMP file.
  185. FSERR_MONO_NOT_SUPPORTED,
  186. FSERR_256_NOT_SUPPORTED,
  187. FSERR_NOROOM_FOR_TMP, // insufficient room in windows directory
  188. FSERR_NON_FLASH_EPS, // not a Flash EPS file
  189. FSERR_GETDIBITS_FAILURE,
  190. FSERR_ACCESS_DENIED,
  191. FSERR_INS_FILE_HANDLES,
  192. FSERR_INVALID_PATH,
  193. FSERR_FILE_NOT_FOUND,
  194. FSERR_DISK_FULL,
  195. FSERR_UNSUPPORTED_FORMAT,
  196. FSERR_UNSUPPORTED_GIF_FORMAT,
  197. FSERR_INVALID_GIF_COLOR,
  198. FSERR_UNSUPPORTED_GIF_EXTENSION,
  199. FSERR_CORRUPTED_FILE,
  200. FSERR_TRY_FILTER, // native doesn't support, so use filter
  201. FSERR_UNSUPPORTED_JPEG,
  202. FSERR_UNSUPPORTED_OUTPUT_FORMAT,
  203. } FSERR;
  204. #define MAX_SS_NAME_LEN 51 // 50 char limit + NULL
  205. #define TAMSG_IE_ACCEL 1
  206. #define TAMSG_TAKE_FOCUS 2
  207. #define TAMSG_NOT_IE_ACCEL 3
  208. #define ANY_PROCESS_ID 0
  209. #define WS_EX_LAYOUT_RTL 0x00400000L // Right to left mirroring (Win98 and NT5 only)
  210. extern DWORD g_RTL_Style; // additional windows style for RTL layout (all platforms)
  211. extern DWORD g_RTL_Mirror_Style; // additional windows style for RTL mirroring
  212. extern BOOL g_fThreadRunning; // TRUE if our thread is doing something
  213. extern HANDLE g_hsemNavigate;
  214. extern const CLSID *g_pLibid;
  215. extern BOOL g_fMachineHasLicense;
  216. extern BOOL g_fCheckedForLicense;
  217. extern BOOL g_fServerHasTypeLibrary;
  218. extern HWND g_hwndParking;
  219. extern BOOL g_fDualCPU; // -1 until initialized, then TRUE or FALSE
  220. extern CRITICAL_SECTION g_CriticalSection;
  221. extern HINSTANCE g_hinstOcx;
  222. extern HBRUSH g_hbrBackGround; // background brush
  223. extern HBITMAP g_hbmpSplash;
  224. extern HPALETTE g_hpalSplash;
  225. extern HWND g_hwndSplash;
  226. extern int g_cWindowSlots; // current number of allocated window slots
  227. extern int g_curHmData;
  228. extern int g_cHmSlots;
  229. extern UINT g_fuBiDiMessageBox;
  230. extern BOOL g_fCoInitialized; // means we called CoInitialize()
  231. extern VARIANT_BOOL g_fHaveLocale;
  232. extern LCID g_lcidLocale;
  233. extern BOOL g_fSysWin95; // we're under Win95 system, not just NT SUR
  234. extern BOOL g_fSysWinNT; // we're under some form of Windows NT
  235. extern BOOL g_fSysWin95Shell; // we're under Win95 or Windows NT SUR { > 3/51)
  236. extern BOOL g_bWinNT5; // we're under NT5
  237. extern BOOL g_bWin98; // we're under Win98
  238. extern BOOL g_fBiDi; // TRUE if this is a BiDi system
  239. extern BOOL g_bBiDiUi; // TRUE when we have a localized Hebrew or Arabic UI
  240. extern BOOL g_bArabicUi; // TRUE when we have a Arabic UI
  241. extern BOOL g_fRegisteredSpash; // TRUE if Splash window has been registered
  242. extern BOOL g_fNonFirstKey; // accept keyboard entry for non-first level index keys
  243. extern BOOL g_bMsItsMonikerSupport; // "ms-its:" moniker supported starting with IE 4
  244. extern BOOL g_fIE3; // affects which features we can support
  245. extern BOOL g_fDBCSSystem;
  246. extern LCID g_lcidSystem; // Only used for input to CompareString. used in util.cpp stristr()
  247. extern LANGID g_langSystem; // used only by fts.cpp, ipserver.cpp and rescache.cpp
  248. extern const char g_szLibName[];
  249. extern const CLSID *g_pLibid;
  250. extern CTable* g_ptblItems;
  251. extern const char g_szReflectClassName[]; // "CtlFrameWork_ReflectWindow";
  252. extern UINT MSG_MOUSEWHEEL;
  253. extern const char txtInclude[]; // ":include";
  254. extern const char txtFileHeader[]; // "file:";
  255. extern const char txtHttpHeader[]; // "http:";
  256. extern const char txtFtpHeader[]; // "ftp:";
  257. extern const char txtZeroLength[]; // "";
  258. extern const char txtHtmlHelpWindowClass[];
  259. extern const char txtHtmlHelpChildWindowClass[];
  260. extern const char txtSizeBarChildWindowClass[];
  261. extern const char txtSysRoot[];
  262. extern const char txtMkStore[]; // "mk:@MSITStore:";
  263. extern const char txtItsMoniker[]; // "its:";
  264. extern const char txtMsItsMoniker[]; // "ms-its:";
  265. extern const char txtHlpDir[]; // "Help";
  266. extern const char txtOpenCmd[]; // "htmlfile\\shell\\open\\command";
  267. extern const char txtDoubleColonSep[]; // "::";
  268. extern const char txtSepBack[]; // "::/";
  269. extern const char txtDefExtension[]; // ".chm";
  270. extern const char txtCollectionExtension[]; // ".col";
  271. extern const char txtChmColon[]; // ".chm::";
  272. extern const char txtDefFile[]; // "::/default.htm";
  273. // Internal window types
  274. extern const char txtDefWindow[]; // Per-chm version.
  275. extern const char txtGlobalDefWindow[] ; // Global version.
  276. // Special windows --- The filename parameter is ignored for these windows.
  277. extern const char txtPrintWindow[] ;
  278. #include "Util.H"
  279. // inline function only support for hour glass
  280. struct CHourGlass
  281. {
  282. CHourGlass()
  283. { hcurRestore = SetCursor(LoadCursor(NULL,
  284. (LPCTSTR) IDC_WAIT)); }
  285. ~CHourGlass()
  286. { SetCursor(hcurRestore); }
  287. void Restore()
  288. { SetCursor(hcurRestore); }
  289. HCURSOR hcurRestore;
  290. };
  291. //=--------------------------------------------------------------------------=
  292. // Global object information table
  293. //=--------------------------------------------------------------------------=
  294. // for each object in your application, you have an entry in this table. they
  295. // do not necessarily have to be CoCreatable, but if they are used, then they
  296. // should reside here. use the macros to fill in this table.
  297. //
  298. typedef struct tagOBJECTINFO {
  299. unsigned short usType;
  300. void *pInfo;
  301. } OBJECTINFO;
  302. extern OBJECTINFO g_ObjectInfo[];
  303. class CBusy
  304. {
  305. public:
  306. CBusy() { m_iBusyCount = 0; }
  307. BOOL Set( BOOL bBusy )
  308. {
  309. if( bBusy )
  310. m_iBusyCount++;
  311. else
  312. m_iBusyCount--;
  313. if( m_iBusyCount < 0 )
  314. m_iBusyCount = 0;
  315. return IsBusy();
  316. }
  317. inline BOOL IsBusy() { return (BOOL) m_iBusyCount; }
  318. private:
  319. BOOL m_iBusyCount;
  320. };
  321. extern CBusy g_Busy;
  322. #endif // __HEADER_H__