util.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 17k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //---------------------------------------------------------------------------
  2. // This is a desperate attempt to try and track dependancies.
  3. #ifndef _UTIL_H
  4. #define _UTIL_H
  5. #include "unicpputils.h"
  6. STDAPI Stream_WriteString(IStream *pstm, LPCTSTR psz, BOOL bWideInStream);
  7. STDAPI Stream_ReadString(IStream *pstm, LPTSTR pwsz, UINT cchBuf, BOOL bWideInStream);
  8. STDAPI Str_SetFromStream(IStream *pstm, LPTSTR *ppsz, BOOL bWideInStream);
  9. STDAPI CopyStreamUI(IStream *pstmSrc, IStream *pstmDest, IProgressDialog *pdlg);
  10. #define HIDWORD(_qw)    (DWORD)((_qw)>>32)
  11. #define LODWORD(_qw)    (DWORD)(_qw)
  12. // Sizes of various stringized numbers
  13. #define MAX_INT64_SIZE  30              // 2^64 is less than 30 chars long
  14. #define MAX_COMMA_NUMBER_SIZE   (MAX_INT64_SIZE + 10)
  15. #define MAX_COMMA_AS_K_SIZE     (MAX_COMMA_NUMBER_SIZE + 10)
  16. STDAPI_(void)   SHPlaySound(LPCTSTR pszSound);
  17. STDAPI_(BOOL)   TouchFile(LPCTSTR pszFile);
  18. STDAPI_(BOOL)   IsNullTime(const FILETIME *pft);
  19. STDAPI_(LPTSTR) AddCommas(DWORD dw, LPTSTR lpBuff);
  20. STDAPI_(LPTSTR) AddCommas64(_int64 n, LPTSTR lpBuff);
  21. STDAPI_(LPWSTR) AddCommasW(DWORD dw, LPWSTR lpBuff);    // BUGBUG_BOBDAY Temporary until UNICODE
  22. STDAPI_(LPTSTR) ShortSizeFormat(DWORD dw, LPTSTR szBuf);
  23. STDAPI_(LPTSTR) ShortSizeFormat64(__int64 qwSize, LPTSTR szBuf);
  24. STDAPI_(void) DosTimeToDateTimeString(WORD wDate, WORD wTime, LPTSTR pszText, UINT cchText, int fmt);
  25. STDAPI_(int)  GetDateString(WORD wDate, LPTSTR szStr);
  26. STDAPI_(WORD) ParseDateString(LPCWSTR pszStr);
  27. STDAPI_(int)  GetTimeString(WORD wTime, LPTSTR szStr);
  28. STDAPI_(HWND) GetTopLevelAncestor(HWND hWnd);
  29. STDAPI_(BOOL) ParseField(LPCTSTR szData, int n, LPTSTR szBuf, int iBufLen);
  30. STDAPI_(UINT) Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags);
  31. STDAPI_(void) SetICIKeyModifiers(DWORD* pfMask);
  32. STDAPI_(void) GetMsgPos(POINT *ppt);
  33. //For use with CreateDesktopComponents
  34. #define DESKCOMP_IMAGE  0x00000001
  35. #define DESKCOMP_URL    0x00000002
  36. #define DESKCOMP_MULTI  0x00000004
  37. #define DESKCOMP_CDF    0x00000008
  38. STDAPI IsDeskCompHDrop(IDataObject * pido);
  39. STDAPI CreateDesktopComponents(LPCSTR pszUrl, IDataObject * pido, HWND hwnd, DWORD fFlags, int x, int y);
  40. STDAPI ExecuteDeskCompHDrop(LPTSTR pszMultipleUrls, HWND hwnd, int x, int y);
  41. STDAPI_(LONG) RegSetString(HKEY hk, LPCTSTR pszSubKey, LPCTSTR pszValue);
  42. STDAPI_(BOOL) RegSetValueString(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPCTSTR psz);
  43. STDAPI_(BOOL) RegGetValueString(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPTSTR psz, DWORD cb);
  44. STDAPI_(BOOL) GetShellClassInfo(LPCTSTR pszPath, LPTSTR pszKey, LPTSTR pszBuffer, DWORD cchBuffer);
  45. STDAPI_(BOOL) GetShellClassInfoInfoTip(LPCTSTR pszPath, LPTSTR pszBuffer, DWORD cchBuffer);
  46. STDAPI_(BOOL) GetShellClassInfoHTMLInfoTipFile(LPCTSTR pszPath, LPTSTR pszBuffer, DWORD cchBuffer);
  47. #define RGS_IGNORECLEANBOOT 0x00000001
  48. #define TrimWhiteSpaceW(psz)        StrTrimW(psz, L" t")
  49. #define TrimWhiteSpaceA(psz)        StrTrimA(psz, " t")
  50. #ifdef UNICODE
  51. #define TrimWhiteSpace      TrimWhiteSpaceW
  52. #else
  53. #define TrimWhiteSpace      TrimWhiteSpaceA
  54. #endif
  55. STDAPI_(LPCTSTR) SkipLeadingSlashes(LPCTSTR pszURL);
  56. STDAPI_(BSTR) SysAllocStringA(LPCSTR);
  57. #ifdef UNICODE
  58. #define SysAllocStringT(psz)        SysAllocString(psz)
  59. #else // UNICODE
  60. #define SysAllocStringT(psz)        SysAllocStringA(psz)
  61. #endif // UNICODE
  62. STDAPI Shell32GetTypeInfo(LCID lcid, UUID uuid, ITypeInfo **ppITypeInfo);
  63. // BUGBUG: no reason to use lpcText (make this UINT id) since we
  64. // only want to load resources by ID
  65. STDAPI_(LPSTR) ResourceCStrToStrA(HINSTANCE hAppInst, LPCSTR lpcText);
  66. STDAPI_(LPWSTR) ResourceCStrToStrW(HINSTANCE hAppInst, LPCWSTR lpcText);
  67. #ifdef UNICODE
  68. #define ResourceCStrToStr   ResourceCStrToStrW
  69. #else
  70. #define ResourceCStrToStr   ResourceCStrToStrA
  71. #endif
  72. STDAPI_(void) SHRegCloseKeys(HKEY ahkeys[], UINT ckeys);
  73. STDAPI_(void) HWNDWSPrintf(HWND hwnd, LPCTSTR psz, BOOL fCompactPath);
  74. #define ustrcmp(psz1, psz2) _ustrcmp(psz1, psz2, FALSE)
  75. #define ustrcmpi(psz1, psz2) _ustrcmp(psz1, psz2, TRUE)
  76. int _ustrcmp(LPCTSTR psz1, LPCTSTR psz2, BOOL fCaseInsensitive);
  77. // On Win95, RegDeleteKey deletes the key and all subkeys.  On NT, RegDeleteKey
  78. // fails if there are any subkeys.  On NT, we'll make shell code that assumes
  79. // the Win95 behavior work by mapping SHRegDeleteKey to a helper function that
  80. // does the recursive delete.
  81. #ifdef WINNT
  82. LONG SHRegDeleteKeyW(HKEY hKey, LPCTSTR lpSubKey);
  83.  #ifdef UNICODE
  84.   #define SHRegDeleteKey SHRegDeleteKeyW
  85.  #else  // ANSI WINNT, a case that never really gets shipped.  Avoid making a
  86.        // needless SHRegDeleteKeyA by defining this function to the
  87.        // (non-recursive) RegDeleteKey
  88.   #define SHRegDeleteKey RegDeleteKey
  89.  #endif // UNICODE vs !UNICODE
  90. #else  // !WINNT
  91.  #define SHRegDeleteKey RegDeleteKey
  92. #endif // WINNT vs !WINNT
  93. STDAPI StringToStrRet(LPCTSTR pszName, STRRET *pStrRet);
  94. STDAPI ResToStrRet(UINT id, STRRET *pStrRet);
  95. STDAPI_(LPCTSTR) SkipServerSlashes(LPCTSTR pszName);
  96. STDAPI_(LPITEMIDLIST) ILCombineParentAndFirst(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidl, LPCITEMIDLIST pidlNext);
  97. STDAPI_(LPITEMIDLIST) ILCloneUpTo(LPCITEMIDLIST pidl, LPCITEMIDLIST pidlUpTo);
  98. STDAPI_(int)    lstrcmpiNoDBCS(LPCTSTR lpsz1, LPCTSTR lpsz2);
  99. typedef struct {
  100.     LPITEMIDLIST pidlParent;
  101.     LPDATAOBJECT pdtobj;
  102.     LPCTSTR pStartPage;
  103.     IShellFolder* psf;
  104.     // keep this last
  105.     LPTHREAD_START_ROUTINE lpStartAddress;
  106. }  PROPSTUFF;
  107. // BUGBUG (reinerf)
  108. // the fucking alpha cpp compiler seems to fuck up the goddam type "LPITEMIDLIST", so to work
  109. // around the fucking peice of shit compiler we pass the last param as an LPVOID instead of a LPITEMIDLIST
  110. STDAPI_(void) SHLaunchPropSheet(LPTHREAD_START_ROUTINE lpStartAddress, LPDATAOBJECT pdtobj, LPCTSTR pStartPage, IShellFolder* psf, LPVOID pidlParent);
  111. // these don't do anything since shell32 does not support unload, but use this
  112. // for code consistancy with dlls that do support this
  113. #define DllAddRef()
  114. #define DllRelease()
  115. //
  116. //  these are functions that moved from shlexec.c.
  117. //  most of them have something to do with locating and identifying applications
  118. //
  119. HWND GetTopParentWindow(HWND hwnd);
  120. DWORD SHProcessMessagesUntilEvent(HWND hwnd, HANDLE hEvent, DWORD dwTimeout);
  121. // map the PropVariantClear function to our internal wrapper to save loading OleAut32.dll
  122. #define PropVariantClear PropVariantClearLazy
  123. STDAPI PropVariantClearLazy(PROPVARIANT * pvar);
  124. #ifndef UNICODE
  125. int CountChar(LPCTSTR pcsz);
  126. #endif
  127. STDAPI_(BOOL) CenterWindow(HWND hwndChild, HWND hwndParent);
  128. STDAPI GetCurFolderImpl(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidl);
  129. STDAPI SHGetIDListFromUnk(IUnknown *punk, LPITEMIDLIST *ppidl);
  130. STDAPI SHGetTargetFolderPath(LPCITEMIDLIST pidl, LPTSTR pszPath, UINT cchBuf);
  131. STDAPI GetPathFromLinkFile(LPCTSTR pszLinkPath, LPTSTR pszTargetPath, int cchTargetPath);
  132. STDAPI_(void)    DrawMenuItem(DRAWITEMSTRUCT* pdi, LPCTSTR lpszMenuText, UINT iIcon);
  133. STDAPI_(LRESULT) MeasureMenuItem(MEASUREITEMSTRUCT *lpmi, LPCTSTR lpszMenuText);
  134. STDAPI_(BOOL) GetFileDescription(LPCTSTR pszPath, LPTSTR pszDesc, UINT *pcchDesc);
  135. STDAPI_(BOOL) IsPathInOpenWithKillList(LPCTSTR pszPath);
  136. STDAPI PathFromDataObject(IDataObject *pdtobj, LPTSTR pszPath, UINT cchPath);
  137. STDAPI PidlFromDataObject(IDataObject *pdtobj, LPITEMIDLIST * ppidlTarget);
  138. // calls ShellMessageBox if SHRestricted fails the restriction
  139. STDAPI_(BOOL) SHIsRestricted(HWND hwnd, RESTRICTIONS rest);
  140. STDAPI_(BOOL) SafePathListAppend(LPTSTR pszDestPath, DWORD cchDestSize, LPCTSTR pszPathToAdd);
  141. STDAPI_(BOOL) ILGetDisplayNameExA(IShellFolder *psfRoot, LPCITEMIDLIST pidl, LPSTR pszName, DWORD cchSize, int fType);
  142. STDAPI_(BOOL) ILGetDisplayNameExW(IShellFolder *psfRoot, LPCITEMIDLIST pidl, LPWSTR pszName, DWORD cchSize, int fType);
  143. STDAPI_(BOOL) Priv_Str_SetPtrW(WCHAR *UNALIGNED *ppwzCurrent, LPCWSTR pwzNew);
  144. #define SEARCHNAMESPACEID_FILE_PATH             1   // Go parse it.
  145. #define SEARCHNAMESPACEID_DOCUMENTFOLDERS       2
  146. #define SEARCHNAMESPACEID_LOCALHARDDRIVES       3
  147. #define SEARCHNAMESPACEID_MYNETWORKPLACES       4
  148. STDAPI_(LPTSTR) DumpPidl(LPCITEMIDLIST pidl);
  149. STDAPI_(BOOL) SHTrackPopupMenu(HMENU hmenu, UINT wFlags, int x, int y, int wReserved, HWND hwnd, LPCRECT lprc);
  150. STDAPI_(HMENU) SHLoadPopupMenu(HINSTANCE hinst, UINT id);
  151. STDAPI_(void) PathToAppPathKey(LPCTSTR pszPath, LPTSTR pszKey, int cchKey);
  152. STDAPI_(BOOL) PathToAppPath(LPCTSTR pszPath, LPTSTR pszResult);
  153. STDAPI_(BOOL) PathIsRegisteredProgram(LPCTSTR pszPath);
  154. STDAPI SHGetUIObjectOf(HWND hwnd, LPTSTR pszPath, REFIID riid, void **ppvOut);
  155. STDAPI_(HANDLE) SHGetCachedGlobalCounter(HANDLE *phCache, const GUID *pguid);
  156. STDAPI_(void) SHDestroyCachedGlobalCounter(HANDLE *phCache);
  157. #define GPFIDL_DEFAULT      0x0000      // normal Win32 file name
  158. #define GPFIDL_ALTNAME      0x0001      // short file name
  159. #define GPFIDL_NONFSNAME    0x0002      // non file system name
  160. STDAPI_(BOOL) SHGetPathFromIDListEx(LPCITEMIDLIST pidl, LPTSTR pszPath, UINT uOpts);
  161. // Review chrisny:  this can be moved into an object easily to handle generic droptarget, dropcursor
  162. // , autoscrool, etc. . .
  163. void _DragEnter(HWND hwndTarget, const POINTL ptStart, IDataObject *pdtObject);
  164. void _DragMove(HWND hwndTarget, const POINTL ptStart);
  165. STDAPI FindFileOrFolders_GetDefaultSearchGUID(IShellFolder2 *psf, LPGUID pGuid);
  166. STDAPI SavePersistHistory(IUnknown* punk, IStream* pstm);
  167. STDAPI SEI2ICIX(LPSHELLEXECUTEINFO pei, LPCMINVOKECOMMANDINFOEX pici, LPVOID *ppvFree);
  168. STDAPI ICIX2SEI(LPCMINVOKECOMMANDINFOEX pici, LPSHELLEXECUTEINFO pei);
  169. STDAPI ICI2ICIX(LPCMINVOKECOMMANDINFO piciIn, LPCMINVOKECOMMANDINFOEX piciOut, LPVOID *ppvFree);
  170. STDAPI_(BOOL) PathIsEqualOrSubFolder(LPCTSTR pszFolder, LPCTSTR pszSubFolder);
  171. STDAPI_(BOOL) PathIsEqualOrSubFolderOf(const UINT rgFolders[], LPCTSTR pszSubFolder);
  172. STDAPI_(LPTSTR) PathBuildSimpleRoot(int iDrive, LPTSTR pszDrive);
  173. IProgressDialog * CProgressDialog_CreateInstance(UINT idTitle, UINT idAnimation, HINSTANCE hAnimationInst);
  174. STDAPI_(BOOL) IsWindowInProcess(HWND hwnd);
  175. STDAPI_(DWORD) BindCtx_GetMode(IBindCtx *pbc, DWORD grfModeDefault);
  176. STDAPI SHCreateFileSysBindCtx(const WIN32_FIND_DATA *pfd, IBindCtx **ppbc);
  177. STDAPI SHIsFileSysBindCtx(IBindCtx *pbc, WIN32_FIND_DATA *pfd);
  178. STDAPI SHSimpleIDListFromFindData(LPCTSTR pszPath, const WIN32_FIND_DATA *pfd, LPITEMIDLIST *ppidl);
  179. STDAPI SHSimpleIDListFromFindData2(IShellFolder *psf, const WIN32_FIND_DATA *pfd, LPITEMIDLIST *ppidl);
  180. STDAPI SHCreateFSIDList(LPCTSTR pszFolder, const WIN32_FIND_DATA *pfd, LPITEMIDLIST *ppidl);
  181. STDAPI InvokeVerbOnItems(HWND hwnd, LPCTSTR pszVerb, UINT uFlags, IShellFolder *psf, UINT cidl, LPCITEMIDLIST *apidl);
  182. STDAPI InvokeVerbOnDataObj(HWND hwnd, LPCTSTR pszVerb, UINT uFlags, IDataObject *pdtobj);
  183. STDAPI DeleteFilesInDataObject(HWND hwnd, UINT uFlags, IDataObject *pdtobj);
  184. STDAPI DeleteFilesInDataObjectEx(HWND hwnd, UINT uFlags, IDataObject *pdtobj, UINT fOptions);
  185. STDAPI GetCLSIDFromIDList(LPCITEMIDLIST pidl, CLSID *pclsid);
  186. STDAPI GetItemCLSID(IShellFolder2 *psf, LPCITEMIDLIST pidl, CLSID *pclsid);
  187. STDAPI_(BOOL) IsIDListInNameSpace(LPCITEMIDLIST pidl, const CLSID *pclsid);
  188. STDAPI_(void) CleanupFileSystem();
  189. SHSTDAPI_(HICON) SHGetFileIcon(HINSTANCE hinst, LPCTSTR pszPath, DWORD dwFileAttribute, UINT uFlags);
  190. STDAPI GetIconLocationFromExt(IN LPTSTR pszExt, OUT LPTSTR pszIconPath, UINT cchIconPath, OUT LPINT piIconIndex);
  191. STDAPI_(BOOL) IsMainShellProcess(); // is this the process that owns the desktop hwnd (eg the main explorer process)
  192. STDAPI_(BOOL) IsProcessAnExplorer();
  193. __inline BOOL IsSecondaryExplorerProcess()
  194. {
  195.     return (IsProcessAnExplorer() && !IsMainShellProcess());
  196. }
  197. STDAPI SHILAppend(LPITEMIDLIST pidlToAppend, LPITEMIDLIST *ppidl);
  198. STDAPI SHILPrepend(LPITEMIDLIST pidlToPrepend, LPITEMIDLIST *ppidl);
  199. //
  200. // IDList macros and other stuff needed by the COFSFolder project
  201. //
  202. typedef enum {
  203.     ILCFP_FLAG_NORMAL           = 0x0000,
  204.     ILCFP_FLAG_SKIPJUNCTIONS    = 0x0001,
  205. } ILCFP_FLAGS;
  206. STDAPI ILCreateFromPathEx(LPCTSTR pszPath, IUnknown *punkToSkip, ILCFP_FLAGS dwFlags, LPITEMIDLIST *ppidl, DWORD *rgfInOut);
  207. STDAPI_(BOOL) ILIsParent(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, BOOL fImmediate);
  208. STDAPI_(BOOL) SHSkipJunctionBinding(IBindCtx *pbc, const CLSID *pclsidSkip);
  209. STDAPI SHCreateSkipBindCtx(IUnknown *punkToSkip, IBindCtx **ppbc);
  210. STDAPI_(void) SetUnknownOnSuccess(HRESULT hres, IUnknown *punk, IUnknown **ppunkToSet);
  211. STDAPI SHCacheTrackingFolder(LPCITEMIDLIST pidlRoot, int csidlTarget, IShellFolder2 **ppsfCache);
  212. #define MAKEINTIDLIST(csidl)    (LPCITEMIDLIST)MAKEINTRESOURCE(csidl)
  213. STDAPI_(BOOL) PathIsShortcut(LPCTSTR psz);
  214. typedef struct _ICONMAP
  215. {
  216.     UINT uType;                  // SHID_ type
  217.     UINT indexResource;          // Resource index (of SHELL232.DLL)
  218. } ICONMAP, *LPICONMAP;
  219. STDAPI_(UINT) SILGetIconIndex(LPCITEMIDLIST pidl, const ICONMAP aicmp[], UINT cmax);
  220. STDAPI_(LPITEMIDLIST) VariantToIDList(const VARIANT *pv);
  221. STDAPI VariantToBuffer(const VARIANT *pvar, void *pv, UINT cb);
  222. STDAPI VariantToGUID(const VARIANT *pvar, GUID *pguid);
  223. STDAPI VariantToStrRet(const VARIANT *pv, STRRET *pstret);
  224. STDAPI_(LPTSTR) VariantToStr(const VARIANT *pvar, LPTSTR pszBuf, int cchBuf);
  225. STDAPI_(LPCWSTR) VariantToStrW(const VARIANT *pvar);
  226. STDAPI InitVariantFromBuffer(VARIANT *pvar, const void *pv, UINT cb);
  227. STDAPI InitVariantFromIDList(VARIANT* pvar, LPCITEMIDLIST pidl);
  228. STDAPI InitVariantFromGUID(VARIANT *pvar, GUID *pguid);
  229. STDAPI InitVariantFromStr(VARIANT *pvar, LPCTSTR pstr);
  230. STDAPI InitVariantFromStrRet(STRRET *pstrret, LPCITEMIDLIST pidl, VARIANT *pv);
  231. BOOL IsSelf(UINT cidl, LPCITEMIDLIST *apidl);
  232. //
  233. // Context menu helper functions
  234. //
  235. STDAPI_(UINT) GetMenuIndexForCanonicalVerb(HMENU hMenu, IContextMenu* pcm, UINT idCmdFirst, LPCWSTR pwszVerb);
  236. BOOL AllowedToEncrypt();
  237. #ifdef __cplusplus
  238. #define IsEqualSCID(a, b)   (((a).pid == (b).pid) && IsEqualIID((a).fmtid, (b).fmtid) )
  239. #else
  240. #define IsEqualSCID(a, b)   (((a).pid == (b).pid) && IsEqualIID(&((a).fmtid),&((b).fmtid)))
  241. #endif
  242. //
  243. //  Helper function for defview callbacks.
  244. //
  245. STDAPI_(LPCITEMIDLIST) GetSelectedObjectFromSite(IUnknown *psite);
  246. STDAPI SHFindFirstFile(LPCTSTR pszPath, WIN32_FIND_DATA *pfd, HANDLE *phfind);
  247. STDAPI SHFindFirstFileRetry(HWND hwnd, IUnknown *punkEnableModless, LPCTSTR pszPath, WIN32_FIND_DATA *pfd, HANDLE *phfind, DWORD dwFlags);
  248. STDAPI_(UINT) SHEnumErrorMessageBox(HWND hwnd, UINT idTemplate, DWORD err, LPCTSTR pszParam, BOOL fNet, UINT dwFlags);
  249. LPSTR _ConstructMessageStringA(HINSTANCE hInst, LPCSTR pszMsg, va_list *ArgList);
  250. LPWSTR _ConstructMessageStringW(HINSTANCE hInst, LPCWSTR pszMsg, va_list *ArgList);
  251. #ifdef UNICODE
  252. #define _ConstructMessageString _ConstructMessageStringW
  253. #else
  254. #define _ConstructMessageString _ConstructMessageStringA
  255. #endif
  256. // TransferDelete() fOptions flags
  257. #define SD_USERCONFIRMATION      0x0001
  258. #define SD_SILENT                0x0002
  259. #define SD_NOUNDO                0x0004
  260. #define SD_WARNONNUKE            0x0008 // we pass this for drag-drop on recycle bin in case something is really going to be deleted
  261. STDAPI_(void) TransferDelete(HWND hwnd, HDROP hDrop, UINT fOptions);
  262. STDAPI LoadFromFile(const CLSID *pclsid, LPCTSTR pszFile, REFIID riid, void **ppv);
  263. STDAPI_(BOOL) App_IsLFNAware(LPCTSTR pszFile);
  264. //
  265. // SH(Get/Set)IniStringUTF7
  266. //
  267. // These are just like Get/WriteProfileString except that if the KeyName
  268. // begins with SZ_CANBEUNICODE, we will use SHGetIniString instead of
  269. // the profile functions.  (The SZ_CANBEUNICODE will be stripped off
  270. // before calling SHGetIniString.)  This allows us to stash unicode
  271. // strings into INI files (which are ASCII) by encoding them as UTF7.
  272. //
  273. // In other words, SHGetIniStringUTF7("Settings", SZ_CANBEUNICODE "Name", ...)
  274. // will read from section "Settings", key name "Name", but will also
  275. // look at the UTF7-encoded version stashed in the "Settings.W" section.
  276. //
  277. #ifdef UNICODE
  278. #define SZ_CANBEUNICODE     TEXT("@")
  279. #define CH_CANBEUNICODE     TEXT('@')
  280. STDAPI_(DWORD) SHGetIniStringUTF7(LPCWSTR lpSection, LPCWSTR lpKey, LPWSTR lpBuf, DWORD nSize, LPCWSTR lpFile);
  281. STDAPI_(BOOL) SHSetIniStringUTF7(LPCWSTR lpSection, LPCWSTR lpKey, LPCWSTR lpString, LPCWSTR lpFile);
  282. #else
  283. #define SZ_CANBEUNICODE     TEXT("")
  284. #define SHGetIniStringUTF7(lpSection, lpKey, lpBuf, nSize, lpFile) 
  285.   GetPrivateProfileStringA(lpSection, lpKey, "", lpBuf, nSize, lpFile)
  286. #define SHSetIniStringUTF7 WritePrivateProfileStringA
  287. #endif
  288. STDAPI_(BOOL) ShowSuperHidden();
  289. STDAPI_(void) ReplaceDlgIcon(HWND hDlg, UINT id, HICON hIcon);
  290. STDAPI_(LONG) GetOfflineShareStatus(LPCTSTR pcszPath);
  291. HRESULT SHGetSetFolderSetting(LPCTSTR pszIniFile, DWORD dwReadWrite, LPCTSTR pszSection,
  292.         LPCTSTR pszKey, LPTSTR pszValue, DWORD cchValueSize);
  293. HRESULT SHGetSetFolderSettingPath(LPCTSTR pszIniFile, DWORD dwReadWrite, LPCTSTR pszSection,
  294.         LPCTSTR pszKey, LPTSTR pszValue, DWORD cchValueSize);
  295. void ExpandOtherVariables(LPTSTR pszFile, int cch);
  296. void SubstituteWebDir(LPTSTR pszFile, int cch);
  297. #endif // _UTIL_H