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.

127 lines
6.3 KiB

  1. /*****************************************************************************\
  2. FILE: util.h
  3. DESCRIPTION:
  4. Shared stuff that operates on all classes.
  5. BryanSt 8/13/1999
  6. Copyright (C) Microsoft Corp 1999-1999. All rights reserved.
  7. \*****************************************************************************/
  8. #ifndef _UTIL_H
  9. #define _UTIL_H
  10. #include "regutil.h"
  11. #define HINST_THISDLL g_hinst
  12. extern BOOL g_fInSetup;
  13. enum enumTSPerfFlag
  14. {
  15. TSPerFlag_NoADWallpaper = 0,
  16. TSPerFlag_NoWallpaper,
  17. TSPerFlag_NoVisualStyles,
  18. TSPerFlag_NoWindowDrag,
  19. TSPerFlag_NoAnimation,
  20. };
  21. // String Helpers
  22. HRESULT HrSysAllocStringW(IN const OLECHAR * pwzSource, OUT BSTR * pbstrDest);
  23. HRESULT HrSysAllocString(IN const OLECHAR * pwzSource, OUT BSTR * pbstrDest);
  24. void PathUnExpandEnvStringsWrap(LPTSTR pszString, DWORD cchSize);
  25. void PathExpandEnvStringsWrap(LPTSTR pszString, DWORD cchSize);
  26. #define SysAllocStringT(pszString) SysAllocString(pszString)
  27. HRESULT StrReplaceToken(IN LPCTSTR pszToken, IN LPCTSTR pszReplaceValue, IN LPTSTR pszString, IN DWORD cchSize);
  28. HRESULT HrWritePrivateProfileStringW(LPCWSTR pszAppName, LPCWSTR pszKeyName, LPCWSTR pszString, LPCWSTR pszFileName);
  29. // File System Helpers
  30. HRESULT HrSHFileOpDeleteFile(HWND hwnd, FILEOP_FLAGS dwFlags, LPTSTR pszPath);
  31. // Registry Helpers
  32. HRESULT HrRegOpenKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
  33. HRESULT HrRegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTSTR lpClass, DWORD dwOptions,
  34. REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition);
  35. HRESULT HrRegQueryValueEx(HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
  36. HRESULT HrRegSetValueEx(IN HKEY hKey, IN LPCTSTR lpValueName, IN DWORD dwReserved, IN DWORD dwType, IN CONST BYTE *lpData, IN DWORD cbData);
  37. HRESULT HrRegEnumKey(HKEY hKey, DWORD dwIndex, LPTSTR lpName, DWORD cbName);
  38. HRESULT HrRegEnumValue(HKEY hKey, DWORD dwIndex, LPTSTR lpValueName, LPDWORD lpcValueName, LPDWORD lpReserved,
  39. LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
  40. HRESULT HrRegQueryInfoKey(HKEY hKey, LPTSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen,
  41. LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime);
  42. HRESULT HrBStrRegQueryValue(IN HKEY hKey, IN LPCTSTR lpValueName, OUT BSTR * pbstr);
  43. HRESULT HrSHGetValue(IN HKEY hKey, IN LPCTSTR pszSubKey, OPTIONAL IN LPCTSTR pszValue, OPTIONAL OUT LPDWORD pdwType, OPTIONAL OUT LPVOID pvData, OPTIONAL OUT LPDWORD pcbData);
  44. HRESULT HrSHSetValue(IN HKEY hkey, IN LPCTSTR pszSubKey, OPTIONAL IN LPCTSTR pszValue, DWORD dwType, OPTIONAL OUT LPVOID pvData, IN DWORD cbData);
  45. DWORD HrRegGetDWORD(HKEY hKey, LPCWSTR szKey, LPCWSTR szValue, DWORD dwDefault);
  46. HRESULT HrRegSetDWORD(HKEY hKey, LPCWSTR szKey, LPCWSTR szValue, DWORD dwData);
  47. HRESULT HrRegDeleteValue(IN HKEY hKey, IN LPCTSTR pszSubKey, IN LPCTSTR pszValueName);
  48. HRESULT HrRegSetValueString(HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValueName, LPCWSTR pszString);
  49. HRESULT HrRegGetValueString(HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValueName, LPWSTR pszString, DWORD cchSize);
  50. HRESULT HrRegSetPath(IN HKEY hKey, IN LPCTSTR pszSubKey, IN LPCTSTR pszValueName, BOOL fUseExpandSZ, LPCWSTR pszPath);
  51. HRESULT HrRegGetPath(IN HKEY hKey, IN LPCTSTR pszSubKey, IN LPCTSTR pszValueName, IN LPWSTR pszPath, IN DWORD cchSize);
  52. // Palette Helpers
  53. COLORREF GetNearestPaletteColor(HPALETTE hpal, COLORREF rgb);
  54. BOOL IsPaletteColor(HPALETTE hpal, COLORREF rgb);
  55. // Theme Specific Helpers
  56. HRESULT SHGetResourcePath(BOOL fLocaleNode, IN LPWSTR pszPath, IN DWORD cchSize);
  57. HRESULT ExpandResourceDir(IN LPWSTR pszPath, IN DWORD cchSize);
  58. HRESULT GetCurrentUserCustomName(LPWSTR pszDisplayName, DWORD cchSize);
  59. HRESULT InstallVisualStyle(IThemeManager * pThemeManager, LPCTSTR pszVisualStylePath, LPCTSTR pszVisualStyleColor, LPCTSTR pszVisualStyleSize);
  60. HRESULT ApplyVisualStyle(LPCTSTR pszVisualStylePath, LPCTSTR pszVisualStyleColor, LPCTSTR pszVisualStyleSize);
  61. // IProperty Bag Helpers
  62. STDAPI SHPropertyBag_WritePunk(IN IPropertyBag * ppb, IN LPCWSTR pwzPropName, IN IUnknown * punk);
  63. STDAPI SHPropertyBag_ReadByRef(IN IPropertyBag * ppb, IN LPCWSTR pwzPropName, IN void * p, IN SIZE_T cbSize);
  64. STDAPI SHPropertyBag_WriteByRef(IN IPropertyBag * ppb, IN LPCWSTR pwzPropName, IN void * p);
  65. HRESULT GetPageByCLSID(IUnknown * punkSite, const GUID * pClsid, IPropertyBag ** ppPropertyBag);
  66. HRESULT IEnumUnknown_FindCLSID(IN IUnknown * punk, IN CLSID clsid, OUT IUnknown ** ppunkFound);
  67. // UXTheme wrappers
  68. DWORD QueryThemeServicesWrap(void);
  69. // Other Helpers
  70. BOOL _InitComCtl32();
  71. HRESULT HrShellExecute(HWND hwnd, LPCTSTR lpVerb, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd);
  72. COLORREF ConvertColor(LPTSTR pszColor);
  73. BOOL IUnknown_CompareCLSID(IN IUnknown * punk, IN CLSID clsid);
  74. UINT ErrorMessageBox(HWND hwndOwner, LPCTSTR pszTitle, UINT idTemplate, HRESULT hr, LPCTSTR pszParam, UINT dwFlags);
  75. HRESULT DisplayThemeErrorDialog(HWND hwndParent, HRESULT hrError, UINT nTitle, UINT nTemplate);
  76. BOOL EnumDisplaySettingsExWrap(LPCTSTR lpszDeviceName, DWORD iModeNum, LPDEVMODE lpDevMode, DWORD dwFlags);
  77. void LogStatus(LPCSTR pszMessage, ...);
  78. void LogSystemMetrics(LPCSTR pszMessage, SYSTEMMETRICSALL * pSystemMetrics);
  79. void PostMessageBroadAsync(IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam);
  80. void SystemParametersInfoAsync(IN UINT uiAction, IN UINT uiParam, IN void * pvParam, IN DWORD cbSize, IN UINT fWinIni, IN CDimmedWindow* pDimmedWindow);
  81. void DebugStartWatch(void);
  82. DWORD DebugStopWatch(void);
  83. BOOL IsTSPerfFlagEnabled(enumTSPerfFlag eTSFlag);
  84. void SPISetThreadCounter(LONG *pcThreads);
  85. BOOL SPICreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, void *pvData);
  86. typedef struct tagPROGRESSINFO
  87. {
  88. IProgressDialog * ppd;
  89. ULARGE_INTEGER uliBytesCompleted;
  90. ULARGE_INTEGER uliBytesTotal;
  91. } PROGRESSINFO, * LPPROGRESSINFO;
  92. HRESULT HrByteToStream(LPSTREAM *lppstm, LPBYTE lpb, ULONG cb);
  93. void GetDateString(char * szSentDateString, ULONG stringLen);
  94. void SystemPathAppend(TCHAR *pszPath, TCHAR *pszMore);
  95. #endif // _UTIL_H