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.

243 lines
12 KiB

  1. #ifndef _DUTIL_H_
  2. #define _DUTIL_H_
  3. #include "local.h"
  4. #include "deskstat.h"
  5. extern "C" LONG g_cRefThisDll;
  6. typedef struct _EnumMonitorsArea
  7. {
  8. int iMonitors;
  9. RECT rcWorkArea[LV_MAX_WORKAREAS];
  10. RECT rcMonitor[LV_MAX_WORKAREAS];
  11. RECT rcVirtualMonitor;
  12. RECT rcVirtualWorkArea; //Excluding the tray/toolbar areas
  13. } EnumMonitorsArea;
  14. void SaveDefaultFolderSettings();
  15. BOOL GetFileName(HWND hdlg, LPTSTR pszFileName, int iSize, int iTypeId[], DWORD dwFlags[]);
  16. void PatternToDwords(LPTSTR psz, DWORD *pdwBits);
  17. void PatternToWords(LPTSTR psz, WORD *pwBits);
  18. BOOL IsValidPattern(LPCTSTR pszPat);
  19. BOOL IsNormalWallpaper(LPCTSTR pszFileName);
  20. BOOL IsWallpaperPicture(LPCTSTR pszWallpaper);
  21. BOOL CheckAndResolveLocalUrlFile(LPTSTR pszFileName, int cchFileName);
  22. void GetMyCurHomePageStartPos(int *piLeft, int *piTop, DWORD *pdwWidth, DWORD *pdwHeight);
  23. BOOL AddRemoveDesktopComponentNoUI(BOOL fAdd, DWORD dwApplyFlags, LPCTSTR pszUrl, LPCTSTR pszFriendlyName, int iCompType, int iLeft, int iTop, int iWidth, int iHeight, BOOL fChecked, DWORD dwCurItemState, BOOL fNoScroll = FALSE, BOOL fCanResize = TRUE);
  24. void InitDeskHtmlGlobals(void);
  25. HBITMAP LoadMonitorBitmap(void);
  26. void PositionComponent(COMPONENTA *pcomp, COMPPOS *pcp, int iCompType, BOOL fCheckItemState);
  27. BOOL UpdateDesktopPosition(LPTSTR pszCompId, int iLeft, int iTop, DWORD dwWidth, DWORD dwHeight, int izIndex, BOOL fSaveState, BOOL fSaveOriginal, DWORD dwNewState);
  28. BOOL GetSavedStateInfo(LPTSTR pszCompId, LPCOMPSTATEINFO pCompState, BOOL fRestoredState);
  29. DWORD GetCurrentState(LPTSTR pszCompId);
  30. BOOL UpdateComponentFlags(LPCTSTR pszCompId, DWORD dwMask, DWORD dwNewFlags);
  31. void GetRegLocation(LPTSTR lpszResult, DWORD cchResult, LPCTSTR lpszKey, LPCTSTR lpszScheme);
  32. BOOL ValidateFileName(HWND hwnd, LPCTSTR pszFilename, int iTypeString);
  33. void EnableADifHtmlWallpaper(HWND hwnd);
  34. BOOL GetWallpaperDirName(LPTSTR lpszWallPaperDir, int iBuffSize);
  35. BOOL _AddDesktopComponentA(HWND hwnd, LPCSTR pszUrlA, int iCompType, int iLeft, int iTop, int iWidth, int iHeight, DWORD dwFlags);
  36. void GetMonitorSettings(EnumMonitorsArea* ema);
  37. int GetWorkAreaIndexFromPoint(POINT pt, LPCRECT prect, int crect);
  38. void ReadWallpaperStyleFromReg(LPCTSTR pszRegKey, DWORD *pdwWallpaperStyle, BOOL fIgnorePlatforms);
  39. BOOL GetWallpaperWithPath(LPCTSTR szWallpaper, LPTSTR szWallpaperWithPath, int iBufSize);
  40. BOOL GetViewAreas(LPRECT lprcViewAreas, int* pnViewAreas);
  41. BOOL GetZoomRect(BOOL fFullScreen, BOOL fAdjustListview, int tridentLeft, int tridentTop, DWORD componentWidth, DWORD componentHeight, LPRECT prcZoom, LPRECT prcWork);
  42. void GetNextComponentPosition(COMPPOS *pcp);
  43. void IncrementComponentsPositioned(void);
  44. void ValidateComponentPosition(COMPPOS *pcp, DWORD dwComponentState, int iComponentType, BOOL *pbChangedPosition, BOOL *pbChangedSize);
  45. int GetcyCaption();
  46. BOOL IsICWCompleted(void);
  47. void LaunchICW(void);
  48. BOOL IsLocalPicture(LPCTSTR pszURL);
  49. BOOL DisableUndisplayableComponents(IActiveDesktop *pIAD);
  50. HRESULT PathExpandEnvStringsWrap(LPTSTR pszString, DWORD cchSize);
  51. // Top level reg keys
  52. #define REG_DESKCOMP TEXT("Software\\Microsoft\\Internet Explorer\\Desktop")
  53. #define REG_DESKCOMP_GENERAL TEXT("Software\\Microsoft\\Internet Explorer\\Desktop%sGeneral")
  54. #define REG_DESKCOMP_GENERAL_SUFFIX TEXT("General")
  55. #define REG_DESKCOMP_COMPONENTS TEXT("Software\\Microsoft\\Internet Explorer\\Desktop%sComponents")
  56. #define REG_DESKCOMP_COMPONENTS_SUFFIX TEXT("Components")
  57. #define REG_DESKCOMP_SAFEMODE TEXT("Software\\Microsoft\\Internet Explorer\\Desktop\\SafeMode")
  58. #define REG_DESKCOMP_SAFEMODE_SUFFIX TEXT("SafeMode")
  59. #define REG_DESKCOMP_SAFEMODE_SUFFIX_L L"SafeMode"
  60. #define REG_DESKCOMP_SCHEME TEXT("Software\\Microsoft\\Internet Explorer\\Desktop\\Scheme")
  61. #define REG_DESKCOMP_SCHEME_LOCATION TEXT("Software\\Microsoft\\Internet Explorer\\Desktop\\Scheme\\Location")
  62. #define REG_DESKCOMP_SCHEME_SUFFIX TEXT("Scheme")
  63. #define REG_DESKCOMP_COMPONENTS_ROOT TEXT("Software\\Microsoft\\Internet Explorer\\Desktop\\Components")
  64. #define REG_DESKCOMP_GENERAL_ROOT TEXT("Software\\Microsoft\\Internet Explorer\\Desktop\\General")
  65. #define REG_DESKCOMP_OLDWORKAREAS TEXT("Software\\Microsoft\\Internet Explorer\\Desktop\\Old WorkAreas")
  66. #define REG_DESKCOMP_ADMINCOMP_ROOT TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ActiveDesktop\\AdminComponent")
  67. // values for toplevel (misc)
  68. #define REG_VAL_MISC_CHANNELSIZE TEXT("ChannelSize")
  69. // values for General
  70. #define REG_VAL_GENERAL_CCOMPPOS TEXT("ComponentsPositioned")
  71. #define REG_VAL_GENERAL_DESKTOPFILE TEXT("HTMLFile")
  72. #define REG_VAL_GENERAL_TILEWALLPAPER TEXT("TileWallpaper")
  73. #define REG_VAL_GENERAL_WALLPAPER TEXT("Wallpaper")
  74. #define REG_VAL_GENERAL_BACKUPWALLPAPER TEXT("BackupWallpaper")
  75. #define REG_VAL_GENERAL_WALLPAPERTIME TEXT("WallpaperFileTime")
  76. #define REG_VAL_GENERAL_WALLPAPERLOCALTIME TEXT("WallpaperLocalFileTime")
  77. #define REG_VAL_GENERAL_WALLPAPERSTYLE TEXT("WallpaperStyle")
  78. #define REG_VAL_GENERAL_VISITGALLERY TEXT("VisitGallery")
  79. #define REG_VAL_GENERAL_RESTRICTUPDATE TEXT("RestrictChannelUI")
  80. // values for Components
  81. #define REG_VAL_COMP_VERSION TEXT("DeskHtmlVersion")
  82. #define REG_VAL_COMP_MINOR_VERSION TEXT("DeskHtmlMinorVersion")
  83. #define REG_VAL_COMP_GENFLAGS TEXT("GeneralFlags")
  84. #define REG_VAL_COMP_SETTINGS TEXT("Settings")
  85. #define REG_VAL_COMP_UPGRADED_FROM TEXT("UpgradedFrom")
  86. // values for each component entry
  87. #define REG_VAL_COMP_FLAGS TEXT("Flags")
  88. #define REG_VAL_COMP_NAME TEXT("FriendlyName")
  89. #define REG_VAL_COMP_POSITION TEXT("Position")
  90. #define REG_VAL_COMP_SOURCE TEXT("Source")
  91. #define REG_VAL_COMP_SUBSCRIBED_URL TEXT("SubscribedURL")
  92. #define REG_VAL_COMP_CURSTATE TEXT("CurrentState")
  93. #define REG_VAL_COMP_ORIGINALSTATEINFO TEXT("OriginalStateInfo")
  94. #define REG_VAL_COMP_RESTOREDSTATEINFO TEXT("RestoredStateInfo")
  95. // values for Scheme
  96. #define REG_VAL_SCHEME_DISPLAY TEXT("Display")
  97. #define REG_VAL_SCHEME_EDIT TEXT("Edit")
  98. // values for old work areas
  99. #define REG_VAL_OLDWORKAREAS_COUNT TEXT("NoOfOldWorkAreas")
  100. #define REG_VAL_OLDWORKAREAS_RECTS TEXT("OldWorkAreaRects")
  101. // values for Admin Component
  102. #define REG_VAL_ADMINCOMP_ADD TEXT("Add")
  103. #define REG_VAL_ADMINCOMP_DELETE TEXT("Delete")
  104. TCHAR g_szNone[];
  105. EXTERN_C const TCHAR c_szPatterns[];
  106. EXTERN_C const TCHAR c_szComponentPreview[];
  107. EXTERN_C const TCHAR c_szRegDeskHtmlProp[];
  108. EXTERN_C const TCHAR c_szBackgroundPreview2[];
  109. EXTERN_C const TCHAR c_szZero[];
  110. EXTERN_C const TCHAR c_szWallpaper[];
  111. #define EnableApplyButton(hdlg) PropSheet_Changed(GetParent(hdlg), hdlg)
  112. // Note: Incrementing the CUR_DESKHTML_VERSION will blow away all the existing
  113. // components already in the registry. So, do this with caution!
  114. #define CUR_DESKHTML_VERSION 0x110
  115. // Note: Incrementing the CUR_DESKHTM_MINOR_VERSION can be used to do two things:
  116. // 1. It will simply set the dirty bit sothat the desktop.htt gets re-generated.
  117. // For example, do this whenever template file deskmovr.htt changes.
  118. // 2. It can be used to add a new default component (for example "MyCurrentHome") without
  119. // destroying any of the existing components in the user's registry.
  120. //
  121. #define CUR_DESKHTML_MINOR_VERSION 0x0005
  122. //The following are the Major and minor version numbers stamped on the registry for IE4.0x
  123. #define IE4_DESKHTML_VERSION 0x010e
  124. #define IE4_DESKHTML_MINOR_VERSION 0x0001
  125. //The following are the Major and minor version numbers stamped on the registry for IE5.0x
  126. #define IE5_DESKHTML_VERSION 0x010f
  127. #define IE5_DESKHTML_MINOR_VERSION 0x0001
  128. //The following are the Major and minor version numbers stamped on the registry for NT5 (W2K)
  129. #define NT5_DESKHTML_VERSION 0x0110
  130. #define NT5_DESKHTML_MINOR_VERSION 0x0003
  131. //The following major & minor version is the only version where desktop v2 was present
  132. //as a component.
  133. #define DESKV2_DESKHTML_VERSION 0x0110
  134. #define DESKV2_DESKHTML_MINOR_VERSION 0x0004
  135. #define COMPON_FILENAME TEXT("\\Web\\Compon.htm")
  136. #define COMPONENTHTML_FILENAME TEXT("\\Web\\TryIt.htm")
  137. #define DESKTOPHTML_DEFAULT_SAFEMODE TEXT("\\Web\\SafeMode.htt")
  138. #define DESKTOPHTML_DEFAULT_WALLPAPER TEXT("Wallpapr.htm")
  139. #define DESKTOPHTML_DEFAULT_MEMPHIS_WALLPAPER TEXT("Windows98.htm")
  140. #define DESKTOPHTML_DEFAULT_NT5_WALLPAPER TEXT("Active Desktop Wallpaper.htm")
  141. //#define DESKTOPHTML_DEFAULT_NT5_WALLPAPER TEXT("Windows 2000 Wallpaper.bmp")
  142. #define PREVIEW_PICTURE_FILENAME TEXT("PrePict.htm")
  143. #define DESKTOPHTML_WEB_DIR TEXT("\\Web")
  144. #define GFN_PICTURE 0x00000001
  145. #define GFN_LOCALHTM 0x00000002 // local *.htm and *.html files only
  146. #define GFN_URL 0x00000004
  147. #define GFN_CDF 0x00000008
  148. #define GFN_LOCALMHTML 0x00000010 // local *.mht and *.mhtml files only
  149. #define GFN_ALL (GFN_PICTURE | GFN_LOCALHTM | GFN_URL | GFN_CDF | GFN_LOCALMHTML)
  150. #define CXYDESKPATTERN 8
  151. // Valid bits for REG_VAL_COMP_SETTINGS
  152. #define COMPSETTING_ENABLE 0x00000001
  153. //
  154. // Dimensions of the monitor contents in the monitor bitmap.
  155. // Used in the desk property sheet "preview" controls.
  156. //
  157. #define MON_X 16
  158. #define MON_Y 17
  159. #define MON_DX 152
  160. #define MON_DY 112
  161. //
  162. // Attributes of default components.
  163. //
  164. #define EGG_LEFT 130
  165. #define EGG_TOP 180
  166. #define EGG_WIDTH 160
  167. #define EGG_HEIGHT 160
  168. #define CBAR_SOURCE TEXT("131A6951-7F78-11D0-A979-00C04FD705A2")
  169. #define CBAR_TOP 6
  170. #define CBAR_WIDTH 84
  171. #define CBAR_BUTTON_HEIGHT 35 // height of one button
  172. // My Current Home page component's default values.
  173. #define MY_HOMEPAGE_SOURCE TEXT("About:Home")
  174. #define MY_HOMEPAGE_SOURCEW L"About:Home"
  175. #define MYCURHOME_TOP 6
  176. #define MYCURHOME_WIDTH 160
  177. #define MYCURHOME_HEIGHT 160
  178. #define COMPONENT_PER_ROW 3
  179. #define COMPONENT_PER_COL 2
  180. int SHLoadString(HINSTANCE hInstance, UINT uID, LPTSTR szBuffer, int nBufferMax);
  181. #define LoadMenuPopup(id) SHLoadMenuPopup(HINST_THISDLL, id)
  182. #define VALIDATESTATE(x) ((((x) & ~IS_VALIDSTATEBITS) == 0) && ((((x) & IS_VALIDSIZESTATEBITS) == IS_NORMAL) || (((x) & IS_VALIDSIZESTATEBITS) == IS_SPLIT) || (((x) & IS_VALIDSIZESTATEBITS) == IS_FULLSCREEN)))
  183. #define ISZOOMED(x) (((x)->dwCurItemState & IS_SPLIT) || ((x)->dwCurItemState & IS_FULLSCREEN))
  184. #define IsZoomedState(itemState) ((((itemState) & IS_SPLIT) != 0) || (((itemState) & IS_FULLSCREEN) != 0))
  185. // dvutil.cpp
  186. #include <webcheck.h>
  187. #include <mshtml.h>
  188. typedef struct IHTMLElement IHTMLElement;
  189. HRESULT CSSOM_TopLeft(IHTMLElement * pIElem, POINT * ppt);
  190. HRESULT GetHTMLElementStrMember(IHTMLElement *pielem, LPTSTR pszName, DWORD cchSize, BSTR bstrMember);
  191. HRESULT IElemCheckForExistingSubscription(IHTMLElement *pielem);
  192. HRESULT IElemCloseDesktopComp(IHTMLElement *pielem);
  193. HRESULT IElemGetSubscriptionsDialog(IHTMLElement *pielem, HWND hwnd);
  194. HRESULT IElemSubscribeDialog(IHTMLElement *pielem, HWND hwnd);
  195. HRESULT IElemUnsubscribe(IHTMLElement *pielem);
  196. HRESULT IElemUpdate(IHTMLElement *pielem);
  197. HRESULT IElemOpenInNewWindow(IHTMLElement *pielem, IOleClientSite *piOCSite, BOOL fShowFrame, LONG width, LONG height);
  198. HRESULT ShowSubscriptionProperties(LPCTSTR pszUrl, HWND hwnd);
  199. HRESULT CreateSubscriptionsWizard(SUBSCRIPTIONTYPE subType, LPCTSTR pszUrl, SUBSCRIPTIONINFO *pInfo, HWND hwnd);
  200. BOOL CheckForExistingSubscription(LPCTSTR lpcszURL);
  201. void ZoomComponent(COMPPOS * pcp, DWORD dwItemState, BOOL fAdjustListview);
  202. #define GET_CYCAPTION (GetcyCaption())
  203. #define GET_CXSIZE (GetSystemMetrics(SM_CXSIZEFRAME) - GetSystemMetrics(SM_CXBORDER))
  204. #define GET_CYSIZE (GetSystemMetrics(SM_CYSIZEFRAME) - GetSystemMetrics(SM_CYBORDER))
  205. #endif // _DUTIL_H_