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.

562 lines
18 KiB

  1. #ifndef _PRIV_H_
  2. #define _PRIV_H_
  3. // For use with VC6
  4. #pragma warning(4:4519) //default template arguments are only allowed on a class template; ignored
  5. #pragma warning(4:4242) //'initializing' : conversion from 'unsigned int' to 'unsigned short', possible loss of data
  6. // Extra error checking (catches false errors, but useful to run every so often)
  7. #if 0
  8. #pragma warning(3:4701) // local may be used w/o init
  9. #pragma warning(3:4702) // Unreachable code
  10. #pragma warning(3:4705) // Statement has no effect
  11. #pragma warning(3:4709) // command operator w/o index expression
  12. #endif
  13. // Sundown: forcing value to bool
  14. #pragma warning(disable:4800)
  15. // This stuff must run on Win95
  16. #define _WIN32_WINDOWS 0x0400
  17. #ifndef WINVER
  18. #define WINVER 0x0400
  19. #endif
  20. #define _OLEAUT32_ // get DECLSPEC_IMPORT stuff right, we are defing these
  21. #define _BROWSEUI_ // define bruiapi as functions exported instead of imported
  22. #define _WINMM_ // for DECLSPEC_IMPORT in mmsystem.h
  23. #define _WINX32_ // get DECLSPEC_IMPORT stuff right for WININET API
  24. #define _URLCACHEAPI // get DECLSPEC_IMPORT stuff right for WININET CACHE API
  25. #define _UXTHEME_ // get DECLSPEC_IMPORT stuff right for uxtheme
  26. #ifndef STRICT
  27. #define STRICT
  28. #endif
  29. // Map KERNEL32 unicode string functions to SHLWAPI
  30. // This is needed way up here.
  31. #define lstrcmpW StrCmpW
  32. #define lstrcmpiW StrCmpIW
  33. #define lstrcpyW StrCpyW
  34. #define lstrcpynW StrCpyNW
  35. #define lstrcatW StrCatW
  36. //
  37. // Enable channel code for IE4 upgrades.
  38. //
  39. #define ENABLE_CHANNELS
  40. #ifdef __cplusplus
  41. extern "C" { /* Assume C declarations for C++. */
  42. #endif /* __cplusplus */
  43. #include <nt.h>
  44. #include <ntrtl.h>
  45. #include <nturtl.h>
  46. #ifdef __cplusplus
  47. } /* End of extern "C" {. */
  48. #endif /* __cplusplus */
  49. /////////////////////////////////////////////////////////////////////////
  50. //
  51. // ATL / OLE HACKHACK
  52. //
  53. // Include <w95wraps.h> before anything else that messes with names.
  54. // Although everybody gets the wrong name, at least it's *consistently*
  55. // the wrong name, so everything links.
  56. //
  57. // NOTE: This means that while debugging you will see functions like
  58. // CWindowImplBase__DefWindowProcWrapW when you expected to see
  59. // CWindowImplBase__DefWindowProc.
  60. //
  61. #define POST_IE5_BETA // turn on post-split iedev stuff
  62. #include <w95wraps.h>
  63. #include <windows.h>
  64. // VariantInit is a trivial function -- avoid using OleAut32, use intrinsic
  65. // version of memset for a good size win
  66. // (it's here so that atl (in stdafx.h) gets it too)
  67. #define VariantInit(p) memset(p, 0, sizeof(*(p)))
  68. #define _FIX_ENABLEMODELESS_CONFLICT // for shlobj.h
  69. //WinInet need to be included BEFORE ShlObjp.h
  70. #define HLINK_NO_GUIDS
  71. #include <hlink.h>
  72. #include <wininet.h>
  73. #include <winineti.h>
  74. #include <urlmon.h>
  75. #undef GetClassInfo
  76. #include <shlobj.h>
  77. #include <exdispid.h>
  78. #undef GetClassInfo
  79. #include <objidl.h>
  80. #include <shlwapi.h>
  81. //#include <shconv.h> // replacement for atlconv.h if ATL is not included below
  82. #if defined(__cplusplus) && !defined(DONT_USE_ATL)
  83. // (stdafx.h must come before windowsx.h)
  84. #include "stdafx.h" // ATL header file for this component
  85. // AtlMisc.h needs some defines from AtlApp.h
  86. #ifndef __ATLAPP_H__
  87. #include "AtlApp.h"
  88. #endif
  89. // include CString, CSize, CRect, CPoint, CFindFile from WTL10
  90. // see %_NTROOT%\public\sdk\inc\wtl10
  91. #include "AtlMisc.h"
  92. // Include LBSTR::CString
  93. #include <locbstr.h>
  94. #endif
  95. #include <windowsx.h>
  96. #include <shellapi.h>
  97. #include <crtfree.h>
  98. #include <ole2ver.h>
  99. #include <olectl.h>
  100. #include <hliface.h>
  101. #include <docobj.h>
  102. #define DLL_IS_ROOTABLE
  103. #include <ccstock.h>
  104. #include <ccstock2.h>
  105. #include <port32.h>
  106. #include <shellp.h>
  107. #include <ieguidp.h>
  108. #include <isguids.h>
  109. #include <mimeinfo.h>
  110. #include <hlguids.h>
  111. #include <mshtmdid.h>
  112. #include <dispex.h> // IDispatchEx
  113. #include <perhist.h>
  114. #include <shobjidl.h>
  115. #include <iepriv.h>
  116. #include <help.h>
  117. #include <multimon.h>
  118. #define DISALLOW_Assert // Force to use ASSERT instead of Assert
  119. #define DISALLOW_DebugMsg // Force to use TraceMsg instead of DebugMsg
  120. #include <debug.h>
  121. #include <urlhist.h>
  122. #include <regstr.h> // for REGSTR_PATH_EXPLORE
  123. #define USE_SYSTEM_URL_MONIKER
  124. #include <urlmon.h>
  125. #include <winineti.h> // Cache APIs & structures
  126. #include <inetreg.h>
  127. #define _INTSHCUT_ // get DECLSPEC_IMPORT stuff right for INTSHCUT.h
  128. #include <intshcut.h>
  129. #include <propset.h> // If this ever becomes a problem, remove this once OLE adds an official header
  130. #include <regapix.h> // MAXIMUM_SUB_KEY_LENGTH, MAXIMUM_VALUE_NAME_LENGTH, MAXIMUM_DATA_LENGTH
  131. #include <browseui.h>
  132. #include <shdocvw.h>
  133. #include <commctrl.h>
  134. #include <shfusion.h>
  135. #define STRSAFE_NO_DEPRECATE
  136. #include <strsafe.h>
  137. //
  138. // WARNING: Don't add private header files in shdocvw here randomly, which
  139. // will force us to re-compiling everything. Keep those private headers
  140. // out of priv.h
  141. //
  142. // #include <iface.h>
  143. #include "globals.h"
  144. #include "runonnt.h"
  145. #include "util.h"
  146. #include "brutil.h"
  147. #include "qistub.h"
  148. #ifdef DEBUG
  149. #include "dbutil.h"
  150. #endif
  151. // Include the automation definitions...
  152. #include <exdisp.h>
  153. #include <exdispid.h>
  154. #include <brdispp.h>
  155. #include <ocmm.h>
  156. #include <mshtmhst.h>
  157. #include <simpdata.h>
  158. #include <htiface.h>
  159. #include <objsafe.h>
  160. #include "shui.h"
  161. #define URLID_URLBASE 0
  162. #define URLID_LOCATION 1
  163. /////// URLID_FTPFOLDER 2 // Taken by a pre-release FTP Folder dll
  164. #define URLID_PROTOCOL 3
  165. // If stdshnor.bmp or stdshhot.bmp are modifed, change this number to reflect the
  166. // new number of glyphs
  167. #define NUMBER_SHELLGLYPHS 47
  168. #define MAX_SHELLGLYPHINDEX SHELLTOOLBAR_OFFSET + NUMBER_SHELLGLYPHS - 1
  169. // Increment steps. For changing the with of the TB buttons. For localization
  170. #define WIDTH_FACTOR 4
  171. //
  172. // Neutral ANSI/UNICODE types and macros... 'cus Chicago seems to lack them
  173. //
  174. #define DLL_IS_UNICODE (sizeof(TCHAR) == sizeof(WCHAR))
  175. //===========================================================================
  176. // ITEMIDLIST
  177. //===========================================================================
  178. // unsafe macros
  179. #define _ILSkip(pidl, cb) ((LPITEMIDLIST)(((BYTE*)(pidl))+cb))
  180. #define _ILNext(pidl) _ILSkip(pidl, (pidl)->mkid.cb)
  181. #define SEN_FIRST (0U-550U) // ;Internal
  182. #ifdef __cplusplus
  183. //
  184. // Pseudoclass for the variable-sized OLECMDTEXT structure.
  185. // You need to declare it as a class (and not a BYTE buffer that is
  186. // suitable cast) because BYTE buffers are not guaranteed to be aligned.
  187. //
  188. template <int n>
  189. class OLECMDTEXTV : public OLECMDTEXT {
  190. WCHAR wszBuf[n-1]; // "-1" because OLECMDTEXT includes 1 wchar
  191. };
  192. extern "C" { /* Assume C declarations for C++. */
  193. #endif /* __cplusplus */
  194. void CInternetToolbar_CleanUp();
  195. void CUserAssist_CleanUp(DWORD dwReason, LPVOID lpvReserved);
  196. void CBrandBand_CleanUp();
  197. STDAPI_(HCURSOR) LoadHandCursor(DWORD dwRes);
  198. // Count of images Currently - 2 (Normal and Hot)
  199. #define CIMLISTS 2
  200. typedef struct tagIMLCACHE
  201. {
  202. HIMAGELIST arhiml[CIMLISTS];
  203. HIMAGELIST arhimlPendingDelete[CIMLISTS];
  204. COLORREF cr3D;
  205. BOOL fSmallIcons;
  206. BOOL fUseClassicGlyphs;
  207. } IMLCACHE;
  208. void IMLCACHE_CleanUp(IMLCACHE * pimlCache, DWORD dwFlags);
  209. #define IML_DELETEPENDING 0x01
  210. #define IML_DESTROY 0x02
  211. extern const ITEMIDLIST c_idlDesktop;
  212. typedef const BYTE *LPCBYTE;
  213. #define RECTWIDTH(rc) ((rc).right-(rc).left)
  214. #define RECTHEIGHT(rc) ((rc).bottom-(rc).top)
  215. #define EnterModeless() AddRef() // Used for selfref'ing
  216. #define ExitModeless() Release()
  217. //
  218. // Debug helper functions
  219. //
  220. #ifdef DEBUG
  221. LPCTSTR Dbg_GetCFName(UINT ucf);
  222. LPCTSTR Dbg_GetHRESULTName(HRESULT hr);
  223. LPCTSTR Dbg_GetREFIIDName(REFIID riid);
  224. LPCTSTR Dbg_GetVTName(VARTYPE vt);
  225. BOOL IsStringContained(LPCTSTR pcszBigger, LPCTSTR pcszSuffix);
  226. #endif // DEBUG
  227. //
  228. // In DEBUG, send all our class registrations through a wrapper that
  229. // checks that the class is on our unregister-at-unload list.
  230. //
  231. #ifdef DEBUG
  232. #undef SHRegisterClass
  233. #undef RegisterClass
  234. #define SHRegisterClass SHRegisterClassD
  235. #define RegisterClass RegisterClassD
  236. STDAPI_(BOOL) SHRegisterClassD(CONST WNDCLASS* pwc);
  237. STDAPI_(ATOM) RegisterClassD(CONST WNDCLASS* pwc);
  238. #ifdef UNICODE
  239. #define RealSHRegisterClass SHRegisterClassW
  240. #define RealRegisterClass RegisterClassWrapW
  241. #else
  242. #define RealSHRegisterClass SHRegisterClassA
  243. #define RealRegisterClass RegisterClassA
  244. #endif // UNICODE
  245. #endif // DEBUG
  246. //
  247. // In DEBUG, send FindWindow through a wrapper that ensures that the
  248. // critical section is not taken. FindWindow sends interthreadmessages,
  249. // which is not obvious.
  250. //
  251. #ifdef DEBUG
  252. #undef FindWindow
  253. #undef FindWindowEx
  254. #define FindWindow FindWindowD
  255. #define FindWindowEx FindWindowExD
  256. STDAPI_(HWND) FindWindowD (LPCTSTR lpClassName, LPCTSTR lpWindowName);
  257. STDAPI_(HWND) FindWindowExD(HWND hwndParent, HWND hwndChildAfter, LPCTSTR lpClassName, LPCTSTR lpWindowName);
  258. #ifdef UNICODE
  259. #define RealFindWindowEx FindWindowExWrapW
  260. #else
  261. #define RealFindWindowEx FindWindowExA
  262. #endif // UNICODE
  263. #endif // DEBUG
  264. //
  265. // Trace/dump/break flags specific to shell32\.
  266. // (Standard flags defined in shellp.h)
  267. //
  268. // Break flags
  269. #define BF_ONDUMPMENU 0x10000000 // Stop after dumping menus
  270. #define BF_ONLOADED 0x00000010 // Stop when loaded
  271. // Trace flags
  272. #define TF_UEM 0x00000010 // UEM stuff
  273. #define TF_AUTOCOMPLETE 0x00000100 // AutoCompletion
  274. // The following aren't really valid until the ccshell.ini file is updated.
  275. #define TF_SHDLIFE 0x00000200
  276. #define TF_SHDREF 0x00000400
  277. #define TF_SHDPERF 0x00000800
  278. #define TF_SHDAUTO 0x00001000
  279. #define TF_MENUBAND 0x00002000 // Menu band messages
  280. #define TF_SITEMAP 0x00004000 // Sitemap messages
  281. #define TF_SHDTHREAD 0x00008000 // Thread management
  282. #define TF_SHDCONTROL 0x00010000 // ActiveX Control
  283. #define TF_SHDAPPHACK 0x00020000 // Hack for app-bug
  284. #define TF_SHDBINDING 0x00040000 // Moniker binding
  285. #define TF_SHDPROGRESS 0x00080000 // Download progress
  286. #define TF_SHDNAVIGATE 0x00100000 // Navigation
  287. #define TF_SHDUIACTIVATE 0x00200000 // UI-Activation/Deactivation
  288. #define TF_OCCONTROL 0x00400000 // OC Hosting Window Control
  289. #define TF_PIDLWRAP 0x00800000 // Pidl / Protocol wrapping
  290. #define TF_REGCHECK 0x00000100 // Registry check stuff
  291. #define TF_COCREATE 0x02000000 // WinList/CoCreate(Browser only)
  292. #define TF_URLNAMESPACE 0x04000000 // URL Name Space
  293. #define TF_BAND 0x08000000 // Bands (ISF Band, etc)
  294. #define TF_TRAVELLOG 0x10000000 // TravelLog and Navigation stack
  295. #define TF_DDE 0x20000000 // PMDDE traces
  296. #define TF_CUSTOM1 0x40000000 // Custom messages #1
  297. #define TF_CUSTOM2 0x80000000 // Custom messages #2
  298. #define TF_ACCESSIBILITY TF_CUSTOM2 // accessibility messages: tabstop handling, get/lose tab focus, accelerators
  299. //There is some thinking that says this should be removed, but why risk the regression
  300. #define TF_OBJECTCACHE TF_TRAVELLOG
  301. // (Re-use TF_CUSTOM1 and TF_CUSTOM2 by defining a TF_ value in your
  302. // local file to one of these values while you have the file checked
  303. // out.)
  304. // Dump flags
  305. #define DF_SITEMAP 0x00000001 // Sitemap
  306. #define DF_MEMLEAK 0x00000002 // Dump leaked memory at the end
  307. #define DF_DEBUGQI 0x00000004 // Alloc stub object for each QI
  308. #define DF_DEBUGQINOREF 0x00000008 // No AddRef/Release QI stub
  309. #define DF_DEBUGMENU 0x00000010 // Dump menu handles
  310. #define DF_URL 0x00000020 // Display URLs
  311. #define DF_AUTOCOMPLETE 0x00000040 // AutoCompletion
  312. #define DF_DELAYLOADDLL 0x00000080 // Delay-loaded DLL
  313. #define DF_SHELLLIST 0x00000100 // CShellList contents
  314. #define DF_INTSHCUT 0x00000200 // Internet shortcut structs
  315. #define DF_URLPROP 0x00000400 // URL properties
  316. #define DF_MSGHOOK 0x00000800 // Menu MessageFilter
  317. #define DF_GETMSGHOOK 0x00001000 // GetMessageFilter
  318. #define DF_TRANSACCELIO 0x00002000 // GetMessageFilter
  319. // Prototype flags
  320. #define PF_USERMENUS 0x00000001 // Use traditional USER menu bar
  321. #define PF_NEWFAVMENU 0x00000002 // New favorites menu
  322. #define PF_NOBROWSEUI 0x00001000 // don't use browseui
  323. #define PF_FORCEANSI 0x00002000 // Assume that Shell32 is ANSI
  324. // global object array - used for class factory, auto registration, type libraries, oc information
  325. //
  326. #include "cfdefs.h"
  327. #define OIF_ALLOWAGGREGATION 0x0001
  328. #define OIF_DONTIECREATE 0x0002
  329. //
  330. // global variables
  331. //
  332. //
  333. // Function prototypes
  334. //
  335. STDAPI CMyHlinkSrc_CreateInstance(REFCLSID rclsid, DWORD grfContext, REFIID riid, LPVOID* ppvOut);
  336. STDAPI CMyHlinkSrc_OleCreate(CLSID rclsid, REFIID riid, DWORD renderOpt,
  337. FORMATETC* pFormatEtc, IOleClientSite* pclient,
  338. IStorage* pstg, LPVOID* ppvOut);
  339. STDAPI CMyHlinkSrc_OleLoad(IStorage* pstg, REFIID riid, IOleClientSite* pclient, LPVOID* ppvOut);
  340. HRESULT SHRegisterTypeLib(void);
  341. VOID SHCheckRegistry(void);
  342. STDAPI_(IBindCtx *) BCW_Create(IBindCtx* pibc);
  343. STDAPI_(void) DllAddRef(void);
  344. STDAPI_(void) DllRelease(void);
  345. #define MAX_URL_STRING INTERNET_MAX_URL_LENGTH
  346. #define MAX_NAME_STRING INTERNET_MAX_PATH_LENGTH
  347. #define MAX_BROWSER_WINDOW_TITLE 128
  348. #define REG_SUBKEY_FAVORITESA "\\MenuOrder\\Favorites"
  349. #define REG_SUBKEY_FAVORITES TEXT(REG_SUBKEY_FAVORITESA)
  350. //
  351. // Class names
  352. //
  353. #define c_szExploreClass TEXT("ExploreWClass")
  354. #define c_szIExploreClass TEXT("IEFrame")
  355. #ifdef IE3CLASSNAME
  356. #define c_szCabinetClass TEXT("IEFrame")
  357. #else
  358. #define c_szCabinetClass TEXT("CabinetWClass")
  359. #endif
  360. #define c_szAutoSuggestClass TEXT("Auto-Suggest Dropdown")
  361. // Stack allocated BSTR (to avoid calling SysAllocString)
  362. typedef struct _SA_BSTR {
  363. ULONG cb;
  364. WCHAR wsz[MAX_URL_STRING];
  365. } SA_BSTR;
  366. // A "fake" variants for use on the stack - usable for [in] parameters only!!!
  367. typedef struct _SA_BSTRGUID {
  368. UINT cb;
  369. WCHAR wsz[39];
  370. } SA_BSTRGUID;
  371. #define InitFakeBSTR(pSA_BSTR, guid) SHStringFromGUIDW((guid), (pSA_BSTR)->wsz, ARRAYSIZE((pSA_BSTR)->wsz)), (pSA_BSTR)->cb = (38*sizeof(WCHAR))
  372. STDAPI _SetStdLocation(LPTSTR szPath, UINT id);
  373. STDAPI CDocObjectHost_AddPages(LPARAM that, HWND hwnd, HINSTANCE hinst, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
  374. STDAPI_(void) CDocObjectHost_GetCurrentPage(LPARAM that, LPTSTR szBuf, UINT cchMax);
  375. //
  376. // a couple bogus pidls
  377. //
  378. #define PIDL_LOCALHISTORY ((LPCITEMIDLIST)-1)
  379. #define PIDL_NOTHING ((LPCITEMIDLIST)-2)
  380. #define CALLWNDPROC WNDPROC
  381. // Smartly delay load OLEAUT32
  382. HRESULT VariantClearLazy(VARIANTARG *pvarg);
  383. #define VariantClear VariantClearLazy
  384. WINOLEAUTAPI VariantCopyLazy(VARIANTARG * pvargDest, VARIANTARG * pvargSrc);
  385. #define VariantCopy VariantCopyLazy
  386. #ifdef UNICODE
  387. #define IsDBCSLeadByte(x) ((x), FALSE)
  388. #else
  389. #define IsDBCSLeadByte(x) IsDBCSLeadByteEx(CP_ACP,x)
  390. #endif
  391. #define ILIsEqual(p1, p2) IEILIsEqual(p1, p2, FALSE)
  392. #ifdef __cplusplus
  393. //
  394. // C++ modules only
  395. //
  396. #include <shstr.h>
  397. extern "C" const ITEMIDLIST s_idlNULL;
  398. // helper routines for view state stuff
  399. IStream *GetDesktopRegStream(DWORD grfMode, LPCTSTR pszName, LPCTSTR pszStreams);
  400. IStream *GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCTSTR pszName, LPCTSTR pszStreamMRU, LPCTSTR pszStreams);
  401. // StreamHeader Signatures
  402. #define STREAMHEADER_SIG_CADDRESSBAND 0xF432E001
  403. #define STREAMHEADER_SIG_CADDRESSEDITBOX 0x24F92A92
  404. #define CoCreateInstance IECreateInstance
  405. HRESULT IECreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
  406. DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv);
  407. #endif
  408. extern HRESULT LoadHistoryShellFolder(IUnknown *punkSFHistory, IHistSFPrivate **pphsfHistory); // from urlhist.cpp
  409. extern void CUrlHistory_CleanUp();
  410. // Dummy union macros for code compilation on platforms not
  411. // supporting nameless stuct/union
  412. #ifdef NONAMELESSUNION
  413. #define DUMMYUNION_MEMBER(member) DUMMYUNIONNAME.##member
  414. #define DUMMYUNION2_MEMBER(member) DUMMYUNIONNAME2.##member
  415. #define DUMMYUNION3_MEMBER(member) DUMMYUNIONNAME3.##member
  416. #define DUMMYUNION4_MEMBER(member) DUMMYUNIONNAME4.##member
  417. #define DUMMYUNION5_MEMBER(member) DUMMYUNIONNAME5.##member
  418. #else
  419. #define DUMMYUNION_MEMBER(member) member
  420. #define DUMMYUNION2_MEMBER(member) member
  421. #define DUMMYUNION3_MEMBER(member) member
  422. #define DUMMYUNION4_MEMBER(member) member
  423. #define DUMMYUNION5_MEMBER(member) member
  424. #endif
  425. #undef COMCTL32_VERSION
  426. #define COMCTL32_VERSION 5 // Browseui is stuck with Version 5 comctl32 because it has to run downlevel.
  427. #ifdef __cplusplus
  428. } /* End of extern "C" {. */
  429. #endif /* __cplusplus */
  430. #undef ExpandEnvironmentStrings
  431. #define ExpandEnvironmentStrings #error "Use SHExpandEnvironmentStrings instead"
  432. // Uncomment the following define to enable ATL components to be built in
  433. // browseui.dll. You'll also have to perform the following steps:
  434. // 1. modify the type library in brdispp.idl (Note that this is for private components only)
  435. // 2. modify selfreg.inx to register your components
  436. // 3. copy atl.cpp and atl.h from shdocvw, and modify to return the appropriate classes
  437. // 4. add atl.* to the makefile
  438. // #define ATL_ENABLED
  439. #endif // _PRIV_H_