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.

224 lines
10 KiB

  1. /*****************************************************************************\
  2. FILE: regutil.h
  3. DESCRIPTION:
  4. This file will contain helper functions to load and save values to the
  5. registry that are theme related.
  6. BryanSt 3/24/2000
  7. Copyright (C) Microsoft Corp 2000-2000. All rights reserved.
  8. \*****************************************************************************/
  9. #ifndef _REGUTIL_H
  10. #define _REGUTIL_H
  11. #define MAX_THEME_SIZE MAX_PATH
  12. /////////////////////////////////////////////////////////////////////
  13. // String Constants
  14. /////////////////////////////////////////////////////////////////////
  15. // Registry Strings
  16. #define SZ_REGKEY_CPDESKTOP TEXT("Control Panel\\Desktop")
  17. #define SZ_REGKEY_USERMETRICS TEXT("Control Panel\\Desktop\\WindowMetrics")
  18. #define SZ_REGKEY_APPEARANCE TEXT("Control Panel\\Appearance")
  19. #define SZ_APPEARANCE_SCHEMES TEXT("Control Panel\\Appearance\\Schemes")
  20. #define SZ_APPEARANCE_NEWSCHEMES TEXT("Control Panel\\Appearance\\New Schemes")
  21. #define SZ_REGKEY_UPGRADE_KEY TEXT("Control Panel\\Appearance\\New Schemes\\Current Settings\\Sizes\\0")
  22. #define SZ_REGKEY_ACCESS_HIGHCONTRAST TEXT("Control Panel\\Accessibility\\HighContrast")
  23. #define SZ_REGKEY_CP_CURSORS TEXT("Control Panel\\Cursors")
  24. #define SZ_REGKEY_STYLES TEXT("Styles")
  25. #define SZ_REGKEY_SIZES TEXT("Sizes")
  26. #define SZ_THEMES_MSTHEMEDIRS SZ_THEMES TEXT("\\VisualStyleDirs")
  27. #define SZ_THEMES_THEMEDIRS SZ_THEMES TEXT("\\InstalledThemes")
  28. #define SZ_REGKEY_PLUS98DIR TEXT("Software\\Microsoft\\Plus!98")
  29. #define SZ_REGKEY_CURRENT_THEME TEXT("Software\\Microsoft\\Plus!\\Themes\\Current")
  30. #define SZ_REGKEY_THEME_FILTERS TEXT("Software\\Microsoft\\Plus!\\Themes\\Apply")
  31. #define SZ_REGKEY_IE_DOWNLOADDIR TEXT("Software\\Microsoft\\Internet Explorer")
  32. #define SZ_THEMES TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Themes")
  33. #define SZ_REGKEY_LASTTHEME TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\LastTheme")
  34. #define SZ_REGKEY_THEME_SITES TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\DownloadSites")
  35. #define SZ_REGKEY_THEME_DEFVSON TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\DefaultVisualStyleOn")
  36. #define SZ_REGKEY_THEME_DEFVSOFF TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\DefaultVisualStyleOff")
  37. #define SZ_CP_SETTINGS_VIDEO TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Settings\\Video")
  38. #define SZ_REGVALUE_PLUS98DIR TEXT("Path")
  39. #define SZ_REGVALUE_ICONSIZE TEXT("Shell Icon Size")
  40. #define SZ_REGVALUE_SMALLICONSIZE TEXT("Shell Small Icon Size")
  41. #define SZ_REGVALUE_DEFAULTFONTNAME TEXT("DefaultFontName")
  42. #define SZ_REGVALUE_RECENTFOURCHARSETS TEXT("RecentFourCharsets")
  43. #define SZ_REGVALUE_DISPLAYNAME TEXT("DisplayName")
  44. #define SZ_REGVALUE_DISPLAYTHEMESPG TEXT("DisplayThemesPage")
  45. #define SZ_REGVALUE_DISPLAYSCHEMES TEXT("DisplaySchemes")
  46. #define SZ_REGVALUE_DISPLAYSCHEMES64 TEXT("DisplaySchemes64")
  47. #define SZ_REGVALUE_CURRENT TEXT("Current")
  48. #define SZ_REGVALUE_CURRENTSCHEME TEXT("CurrentScheme")
  49. #define SZ_REGVALUE_SELECTEDSIZE TEXT("SelectedSize")
  50. #define SZ_REGVALUE_SELECTEDSTYLE TEXT("SelectedStyle")
  51. #define SZ_REGVALUE_CONTRASTLEVEL TEXT("Contrast")
  52. #define SZ_REGVALUE_DROPSHADOW TEXT("Drop Shadow")
  53. #define SZ_REGVALUE_FLATMENUS TEXT("Flat Menus")
  54. #define SZ_REGVALUE_LEGACYNAME TEXT("LegacyName")
  55. #define SZ_REGVALUE_ENABLEPLUSTHEMES TEXT("Enable Plus Themes")
  56. #define SZ_REGVALUE_CURRENT_SETTINGS TEXT("Current Settings ")
  57. #define SZ_REGVALUE_LOGINFO TEXT("LoggingOn")
  58. #define SZ_REGVALUE_ENABLEPREVIEW TEXT("Enable Preview")
  59. #define SZ_REGVALUE_ENABLETHEMEINSTALL TEXT("Enable Theme Install")
  60. #define SZ_REGVALUE_IE_DOWNLOADDIR TEXT("Download Directory")
  61. #define SZ_REGVALUE_ICONCOLORDEPTH TEXT("Shell Icon BPP") // (4 if the checkbox is false, otherwise 16, don't set it to anything else)
  62. #define SZ_REGVALUE_SMOOTHSCROLL TEXT("SmoothScroll")
  63. #define SZ_REGVALUE_LT_THEMEFILE TEXT("ThemeFile")
  64. #define SZ_REGVALUE_LT_WALLPAPER TEXT("Wallpaper")
  65. #define SZ_REGVALUE_INSTALL_THEME TEXT("InstallTheme")
  66. #define SZ_REGVALUE_INSTALLCUSTOM_THEME TEXT("CustomInstallTheme")
  67. #define SZ_REGVALUE_INSTALL_VISUALSTYLE TEXT("InstallVisualStyle")
  68. #define SZ_REGVALUE_INSTALL_VSCOLOR TEXT("InstallVisualStyleColor")
  69. #define SZ_REGVALUE_INSTALL_VSSIZE TEXT("InstallVisualStyleSize")
  70. #define SZ_REGVALUE_MODIFIED_DISPNAME TEXT("DisplayName of Modified")
  71. #define SZ_REGVALUE_POLICY_SETVISUALSTYLE TEXT("SetVisualStyle") // This policy means that this visual style always needs to be set.
  72. #define SZ_REGVALUE_POLICY_INSTALLVISUALSTYLE TEXT("InstallVisualStyle") // This policy means that this visual style should be installed the first time whistler is used
  73. #define SZ_REGVALUE_POLICY_INSTALLTHEME TEXT("InstallTheme") // This policy indicates the .theme to install
  74. #define SZ_REGVALUE_CONVERTED_WALLPAPER TEXT("ConvertedWallpaper")
  75. #define SZ_REGVALUE_NO_THEMEINSTALL TEXT("NoThemeInstall") // If this is REG_SZ "TRUE" in HKCU or HKLM, then no .Theme or .msstyles will be loaded during setup.
  76. #define SZ_REGVALUE_ACCESS_HCFLAGS TEXT("Flags") // Accessibility High Contrast Flags
  77. #define SZ_REGVALUE_CURSOR_CURRENTSCHEME TEXT("Scheme Source") // This is the currently selected cursor color scheme in SZ_REGKEY_CP_CURSORS
  78. #define SZ_REGKEY_POLICIES_SYSTEM TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System")
  79. // System Policies
  80. #define POLICY_KEY_EXPLORER L"Explorer"
  81. #define POLICY_KEY_SYSTEM L"System"
  82. #define POLICY_KEY_ACTIVEDESKTOP L"ActiveDesktop"
  83. #define SZ_REGKEY_POLICIES_DESKTOP TEXT("Software\\Policies\\Microsoft\\Windows\\Control Panel\\Desktop")
  84. #define SZ_POLICY_NOCHANGEWALLPAPER TEXT("NoChangingWallpaper") // Under CU, "ActiveDesktop"
  85. #define SZ_POLICY_NODISPSCREENSAVERPG TEXT("NoDispScrSavPage") // Under CU, "System"
  86. #define SZ_POLICY_SCREENSAVEACTIVE TEXT("ScreenSaveActive") // Under CU, SZ_REGKEY_POLICIES_DESKTOP
  87. #define POLICY_VALUE_ANIMATION L"NoChangeAnimation" // Under LM|CU, "Explorer"
  88. #define POLICY_VALUE_KEYBOARDNAV L"NoChangeKeyboardNavigationIndicators" // Under LM|CU, "Explorer"
  89. #define SZ_POLICY_SCREENSAVETIMEOUT L"ScreenSaveTimeOut"
  90. #define SZ_WEBVW_SKIN_FILE L"visualstyle.css"
  91. #define SZ_SAVEGROUP_NOSKIN_KEY L"Control Panel\\Appearance\\New Schemes\\Current Settings SaveNoVisualStyle"
  92. #define SZ_SAVEGROUP_ALL_KEY L"Control Panel\\Appearance\\New Schemes\\Current Settings SaveAll"
  93. #define SZ_SAVEGROUP_NOSKIN_TITLE L"Current Settings SaveNoVisualStyle"
  94. #define SZ_SAVEGROUP_ALL_TITLE L"Current Settings SaveAll"
  95. #define SZ_SAVEGROUP_ALL TEXT("::SaveAll")
  96. #define SZ_SAVEGROUP_NOSKIN TEXT("::SaveNoVisualStyle")
  97. #ifdef UNICODE
  98. # define SCHEME_VERSION 2 // Ver 2 == Unicode
  99. #else
  100. # define SCHEME_VERSION 3 // Ver 3 == Memphis ANSI
  101. #endif
  102. #define SCHEME_VERSION_WIN32 4 // Win32 version of schemes can be loaded from both NT and Win95
  103. #define SCHEME_VERSION_400 1
  104. #define SCHEME_VERSION_NT_400 2
  105. #ifndef COLOR_HOTLIGHT
  106. #define COLOR_HOTLIGHT 26
  107. #define COLOR_GRADIENTACTIVECAPTION 27
  108. #define COLOR_GRADIENTINACTIVECAPTION 28
  109. #endif
  110. #define COLOR_MAX_40 (COLOR_INFOBK+1)
  111. #define COLOR_MAX_41 (COLOR_GRADIENTINACTIVECAPTION+1)
  112. #undef MAX_SM_COLOR_WIN2k
  113. #define MAX_SM_COLOR_WIN2k COLOR_MAX_41
  114. #define SYSTEM_LOCALE_CHARSET 0 //The first item in the array is always system locale charset.
  115. #define MAXSCHEMENAME 100
  116. #define REG_BAD_DWORD 0xF0F0F0F0
  117. /////////////////////////////////////////////////////////////////////
  118. // Data Structures
  119. /////////////////////////////////////////////////////////////////////
  120. typedef struct
  121. {
  122. SHORT version;
  123. // for alignment
  124. WORD wDummy;
  125. NONCLIENTMETRICS ncm;
  126. LOGFONT lfIconTitle;
  127. COLORREF rgb[COLOR_MAX];
  128. } SCHEMEDATA;
  129. #define NO_CHANGE 0x0000
  130. #define METRIC_CHANGE 0x0001
  131. #define COLOR_CHANGE 0x0002
  132. #define DPI_CHANGE 0x0004
  133. #define SCHEME_CHANGE 0x8000
  134. typedef struct
  135. {
  136. DWORD dwChanged;
  137. SCHEMEDATA schemeData;
  138. int nDXIcon;
  139. int nDYIcon;
  140. int nIcon;
  141. int nSmallIcon;
  142. BOOL fModifiedScheme;
  143. BOOL fFlatMenus;
  144. BOOL fHighContrast;
  145. } SYSTEMMETRICSALL;
  146. /////////////////////////////////////////////////////////////////////
  147. // Shared Function
  148. /////////////////////////////////////////////////////////////////////
  149. // Theme Store Functions
  150. HRESULT SystemMetricsAll_Set(IN SYSTEMMETRICSALL * pState, CDimmedWindow* pDimmedWindow);
  151. HRESULT SystemMetricsAll_Get(IN SYSTEMMETRICSALL * pState);
  152. HRESULT SystemMetricsAll_Copy(IN SYSTEMMETRICSALL * pStateSource, IN SYSTEMMETRICSALL * pStateDest);
  153. HRESULT SystemMetricsAll_Load(IN IThemeSize * pSizeToLoad, IN SYSTEMMETRICSALL * pState, IN const int * pnNewDPI);
  154. HRESULT SystemMetricsAll_Save(IN SYSTEMMETRICSALL * pState, IN IThemeSize * pSizeToSaveTo, IN const int * pnNewDPI);
  155. // Misc.
  156. HRESULT Look_GetSchemeData(IN HKEY hkSchemes, IN LPCTSTR pszSchemeName, IN SCHEMEDATA *psd);
  157. HRESULT Look_GetCurSchemeNameAndData(SCHEMEDATA *psd, LPTSTR lpszSchemeName, int cbSize);
  158. #define LF32toLF(lplf32, lplf) (*(lplf) = *(lplf32))
  159. #define LFtoLF32(lplf, lplf32) (*(lplf32) = *(lplf))
  160. #define DPI_PERSISTED 96
  161. // PersistToLive: This will convert the size from the stored size (at 96 DPI) to the current DPI.
  162. // PersistToLive: This will convert the size from the current DPI to the stored size (at 96 DPI).
  163. HRESULT DPIConvert_SystemMetricsAll(BOOL fScaleSizes, SYSTEMMETRICSALL * pStateToModify, int nFromDPI, int nToDPI);
  164. extern PTSTR s_pszColorNames[COLOR_MAX];
  165. BOOL GetRegValueInt(HKEY hMainKey, LPCTSTR lpszSubKey, LPCTSTR lpszValName, int* piValue);
  166. BOOL SetRegValueInt( HKEY hMainKey, LPCTSTR lpszSubKey, LPCTSTR lpszValName, int iValue );
  167. BOOL SetRegValueDword( HKEY hk, LPCTSTR pSubKey, LPCTSTR pValue, DWORD dwVal );
  168. DWORD GetRegValueDword( HKEY hk, LPCTSTR pSubKey, LPCTSTR pValue );
  169. #include "PreviewSM.h"
  170. #endif // _REGUTIL_H