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.

485 lines
21 KiB

  1. //---------------------------------------------------------------------------
  2. // This is a desperate attempt to try and track dependancies.
  3. #ifndef _UTIL_H
  4. #define _UTIL_H
  5. #include "unicpp\utils.h"
  6. #include <xml.h>
  7. #include <inetutil.h>
  8. #define SZ_REGKEY_FILEASSOCIATION TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileAssociation")
  9. STDAPI Stream_WriteString(IStream *pstm, LPCTSTR psz, BOOL bWideInStream);
  10. STDAPI Stream_ReadString(IStream *pstm, LPTSTR pwsz, UINT cchBuf, BOOL bWideInStream);
  11. STDAPI Str_SetFromStream(IStream *pstm, LPTSTR *ppsz, BOOL bWideInStream);
  12. #define HIDWORD(_qw) (DWORD)((_qw)>>32)
  13. #define LODWORD(_qw) (DWORD)(_qw)
  14. // Sizes of various stringized numbers
  15. #define MAX_INT64_SIZE 30 // 2^64 is less than 30 chars long
  16. #define MAX_COMMA_NUMBER_SIZE (MAX_INT64_SIZE + 10)
  17. #define MAX_COMMA_AS_K_SIZE (MAX_COMMA_NUMBER_SIZE + 10)
  18. STDAPI_(void) SHPlaySound(LPCTSTR pszSound);
  19. STDAPI_(BOOL) TouchFile(LPCTSTR pszFile);
  20. STDAPI_(BOOL) IsNullTime(const FILETIME *pft);
  21. #ifdef AddCommas
  22. #undef AddCommas
  23. #endif
  24. STDAPI_(LPTSTR) AddCommas(DWORD dw, LPTSTR pszOut, UINT cchOut);
  25. STDAPI_(LPTSTR) AddCommas64(_int64 n, LPTSTR pszOut, UINT cchOut);
  26. #ifdef ShortSizeFormat
  27. #undef ShortSizeFormat
  28. #endif
  29. STDAPI_(LPTSTR) ShortSizeFormat(DWORD dw, LPTSTR szBuf, UINT cchBuf);
  30. STDAPI_(LPTSTR) ShortSizeFormat64(__int64 qwSize, LPTSTR szBuf, UINT cchBuf);
  31. STDAPI_(int) GetDateString(WORD wDate, LPWSTR pszStr);
  32. STDAPI_(WORD) ParseDateString(LPCWSTR pszStr);
  33. STDAPI_(int) GetTimeString(WORD wTime, LPTSTR szStr);
  34. #define GetTopLevelAncestor(hwnd) GetAncestor(hwnd, GA_ROOT)
  35. STDAPI_(BOOL) ParseField(LPCTSTR szData, int n, LPTSTR szBuf, int iBufLen);
  36. STDAPI_(UINT) Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags);
  37. STDAPI_(void) SetICIKeyModifiers(DWORD* pfMask);
  38. STDAPI_(void) GetMsgPos(POINT *ppt);
  39. //For use with CreateDesktopComponents
  40. #define DESKCOMP_IMAGE 0x00000001
  41. #define DESKCOMP_URL 0x00000002
  42. #define DESKCOMP_MULTI 0x00000004
  43. #define DESKCOMP_CDF 0x00000008
  44. STDAPI IsDeskCompHDrop(IDataObject * pido);
  45. STDAPI CreateDesktopComponents(LPCSTR pszUrl, IDataObject * pido, HWND hwnd, DWORD fFlags, int x, int y);
  46. STDAPI ExecuteDeskCompHDrop(LPTSTR pszMultipleUrls, HWND hwnd, int x, int y);
  47. STDAPI_(LONG) RegSetString(HKEY hk, LPCTSTR pszSubKey, LPCTSTR pszValue);
  48. STDAPI_(BOOL) RegSetValueString(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPCTSTR psz);
  49. STDAPI_(BOOL) RegGetValueString(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPTSTR psz, DWORD cb);
  50. STDAPI_(BOOL) GetShellClassInfo(LPCTSTR pszPath, LPTSTR pszKey, LPTSTR pszBuffer, DWORD cchBuffer);
  51. STDAPI_(BOOL) GetShellClassInfoInfoTip(LPCTSTR pszPath, LPTSTR pszBuffer, DWORD cchBuffer);
  52. #define RGS_IGNORECLEANBOOT 0x00000001
  53. #define TrimWhiteSpaceW(psz) StrTrimW(psz, L" \t")
  54. #define TrimWhiteSpaceA(psz) StrTrimA(psz, " \t")
  55. #ifdef UNICODE
  56. #define TrimWhiteSpace TrimWhiteSpaceW
  57. #else
  58. #define TrimWhiteSpace TrimWhiteSpaceA
  59. #endif
  60. STDAPI_(LPCTSTR) SkipLeadingSlashes(LPCTSTR pszURL);
  61. STDAPI_(LPSTR) ResourceCStrToStrA(HINSTANCE hAppInst, LPCSTR lpcText);
  62. STDAPI_(LPWSTR) ResourceCStrToStrW(HINSTANCE hAppInst, LPCWSTR lpcText);
  63. #ifdef UNICODE
  64. #define ResourceCStrToStr ResourceCStrToStrW
  65. #else
  66. #define ResourceCStrToStr ResourceCStrToStrA
  67. #endif
  68. STDAPI_(void) SHRegCloseKeys(HKEY ahkeys[], UINT ckeys);
  69. STDAPI_(void) HWNDWSPrintf(HWND hwnd, LPCTSTR psz);
  70. #define ustrcmp(psz1, psz2) _ustrcmp(psz1, psz2, FALSE)
  71. #define ustrcmpi(psz1, psz2) _ustrcmp(psz1, psz2, TRUE)
  72. int _ustrcmp(LPCTSTR psz1, LPCTSTR psz2, BOOL fCaseInsensitive);
  73. STDAPI StringToStrRet(LPCTSTR pszName, STRRET *pStrRet);
  74. STDAPI ResToStrRet(UINT id, STRRET *pStrRet);
  75. STDAPI_(LPITEMIDLIST) ILCombineParentAndFirst(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidl, LPCITEMIDLIST pidlNext);
  76. STDAPI_(LPITEMIDLIST) ILCloneUpTo(LPCITEMIDLIST pidl, LPCITEMIDLIST pidlUpTo);
  77. STDAPI_(LPITEMIDLIST) ILResize(LPITEMIDLIST pidl, UINT cbRequired, UINT cbExtra);
  78. typedef struct {
  79. LPITEMIDLIST pidlParent;
  80. LPDATAOBJECT pdtobj;
  81. LPCTSTR pStartPage;
  82. IShellFolder* psf;
  83. // keep this last
  84. LPTHREAD_START_ROUTINE lpStartAddress;
  85. } PROPSTUFF;
  86. // NOTE (reinerf): the alpha cpp compiler seems to mess up the type "LPITEMIDLIST",
  87. // to work around the compiler we pass the last param as an LPVOID instead of a LPITEMIDLIST
  88. HRESULT SHLaunchPropSheet(LPTHREAD_START_ROUTINE lpStartAddress, LPDATAOBJECT pdtobj, LPCTSTR pStartPage, IShellFolder* psf, LPVOID pidlParent);
  89. // these don't do anything since shell32 does not support unload, but use this
  90. // for code consistancy with dlls that do support this
  91. #define DllAddRef()
  92. #define DllRelease()
  93. //
  94. // these are functions that moved from shlexec.c.
  95. // most of them have something to do with locating and identifying applications
  96. //
  97. HWND GetTopParentWindow(HWND hwnd);
  98. // map the PropVariantClear function to our internal wrapper to save loading OleAut32.dll
  99. #define PropVariantClear PropVariantClearLazy
  100. STDAPI PropVariantClearLazy(PROPVARIANT * pvar);
  101. STDAPI GetCurFolderImpl(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidl);
  102. STDAPI GetPathFromLinkFile(LPCTSTR pszLinkPath, LPTSTR pszTargetPath, int cchTargetPath);
  103. STDAPI_(BOOL) GetFileDescription(LPCTSTR pszPath, LPTSTR pszDesc, UINT *pcchDesc);
  104. STDAPI_(BOOL) IsPathInOpenWithKillList(LPCTSTR pszPath);
  105. // calls ShellMessageBox if SHRestricted fails the restriction
  106. STDAPI_(BOOL) SHIsRestricted(HWND hwnd, RESTRICTIONS rest);
  107. STDAPI_(BOOL) SafePathListAppend(LPTSTR pszDestPath, DWORD cchDestSize, LPCTSTR pszPathToAdd);
  108. STDAPI_(BOOL) ILGetDisplayNameExA(IShellFolder *psfRoot, LPCITEMIDLIST pidl, LPSTR pszName, DWORD cchSize, int fType);
  109. STDAPI_(BOOL) ILGetDisplayNameExW(IShellFolder *psfRoot, LPCITEMIDLIST pidl, LPWSTR pszName, DWORD cchSize, int fType);
  110. STDAPI_(BOOL) Priv_Str_SetPtrW(WCHAR *UNALIGNED *ppwzCurrent, LPCWSTR pwzNew);
  111. #define SEARCHNAMESPACEID_FILE_PATH 1 // Go parse it.
  112. #define SEARCHNAMESPACEID_DOCUMENTFOLDERS 2
  113. #define SEARCHNAMESPACEID_LOCALHARDDRIVES 3
  114. #define SEARCHNAMESPACEID_MYNETWORKPLACES 4
  115. STDAPI_(LPTSTR) DumpPidl(LPCITEMIDLIST pidl);
  116. STDAPI_(BOOL) SHTrackPopupMenu(HMENU hmenu, UINT wFlags, int x, int y, int wReserved, HWND hwnd, LPCRECT lprc);
  117. STDAPI_(HMENU) SHLoadPopupMenu(HINSTANCE hinst, UINT id);
  118. STDAPI_(void) PathToAppPathKey(LPCTSTR pszPath, LPTSTR pszKey, int cchKey);
  119. STDAPI_(BOOL) PathToAppPath(LPCTSTR pszPath, LPTSTR pszResult);
  120. STDAPI_(BOOL) PathIsRegisteredProgram(LPCTSTR pszPath);
  121. STDAPI_(BOOL) PathRetryRemovable(HRESULT hr, LPCTSTR pszPath);
  122. STDAPI_(HANDLE) SHGetCachedGlobalCounter(HANDLE *phCache, const GUID *pguid);
  123. STDAPI_(void) SHDestroyCachedGlobalCounter(HANDLE *phCache);
  124. #define GPFIDL_DEFAULT 0x0000 // normal Win32 file name, servers and drive roots included
  125. #define GPFIDL_ALTNAME 0x0001 // short file name
  126. #define GPFIDL_UNCPRINTER 0x0002 // include UNC printer names too (non file system item)
  127. STDAPI_(BOOL) SHGetPathFromIDListEx(LPCITEMIDLIST pidl, LPTSTR pszPath, UINT uOpts);
  128. STDAPI_(BOOL) DAD_DragEnterEx3(HWND hwndTarget, const POINTL ptStart, IDataObject *pdtobj);
  129. STDAPI_(BOOL) DAD_DragMoveEx(HWND hwndTarget, const POINTL ptStart);
  130. STDAPI DefaultSearchGUID(GUID *pGuid);
  131. STDAPI SavePersistHistory(IUnknown* punk, IStream* pstm);
  132. #define TBCDIDASYNC L"DidAsyncInvoke"
  133. STDAPI SEI2ICIX(LPSHELLEXECUTEINFO pei, LPCMINVOKECOMMANDINFOEX pici, LPVOID *ppvFree);
  134. STDAPI ICIX2SEI(LPCMINVOKECOMMANDINFOEX pici, LPSHELLEXECUTEINFO pei);
  135. STDAPI ICI2ICIX(LPCMINVOKECOMMANDINFO piciIn, LPCMINVOKECOMMANDINFOEX piciOut, LPVOID *ppvFree);
  136. STDAPI_(BOOL) PathIsEqualOrSubFolderOf(LPCTSTR pszSubFolder, const UINT rgFolders[], DWORD crgFolder);
  137. STDAPI_(BOOL) PathIsSubFolderOf(LPCTSTR pszFolder, const UINT rgFolders[], DWORD crgFolders);
  138. STDAPI_(BOOL) PathIsOneOf(LPCTSTR pszFolder, const UINT rgFolders[], DWORD crgFolders);
  139. STDAPI_(BOOL) PathIsDirectChildOf(LPCTSTR pszParent, LPCTSTR pszChild);
  140. STDAPI_(LPTSTR) PathBuildSimpleRoot(int iDrive, LPTSTR pszDrive);
  141. IProgressDialog * CProgressDialog_CreateInstance(UINT idTitle, UINT idAnimation, HINSTANCE hAnimationInst);
  142. STDAPI_(BOOL) IsWindowInProcess(HWND hwnd);
  143. STDAPI BindCtx_CreateWithMode(DWORD grfMode, IBindCtx **ppbc);
  144. STDAPI_(DWORD) BindCtx_GetMode(IBindCtx *pbc, DWORD grfModeDefault);
  145. STDAPI_(BOOL) BindCtx_ContainsObject(IBindCtx *pbc, LPOLESTR sz);
  146. STDAPI SaveShortcutInFolder(int csidl, LPTSTR pszName, IShellLink *psl);
  147. STDAPI SHCreateFileSysBindCtx(const WIN32_FIND_DATA *pfd, IBindCtx **ppbc);
  148. STDAPI SHCreateFileSysBindCtxEx(const WIN32_FIND_DATA *pfd, DWORD grfMode, DWORD grfFlags, IBindCtx **ppbc);
  149. STDAPI SHIsFileSysBindCtx(IBindCtx *pbc, WIN32_FIND_DATA **ppfd);
  150. STDAPI SHSimpleIDListFromFindData(LPCTSTR pszPath, const WIN32_FIND_DATA *pfd, LPITEMIDLIST *ppidl);
  151. STDAPI SHSimpleIDListFromFindData2(IShellFolder *psf, const WIN32_FIND_DATA *pfd, LPITEMIDLIST *ppidl);
  152. STDAPI SHCreateFSIDList(LPCTSTR pszFolder, const WIN32_FIND_DATA *pfd, LPITEMIDLIST *ppidl);
  153. STDAPI SimulateDropWithPasteSucceeded(IDropTarget * pdrop, IDataObject * pdtobj, DWORD grfKeyState, const POINTL *ppt, DWORD dwEffect, IUnknown * punkSite, BOOL fClearClipboard);
  154. STDAPI DeleteFilesInDataObject(HWND hwnd, UINT uFlags, IDataObject *pdtobj, UINT fOptions);
  155. STDAPI GetCLSIDFromIDList(LPCITEMIDLIST pidl, CLSID *pclsid);
  156. STDAPI GetItemCLSID(IShellFolder2 *psf, LPCITEMIDLIST pidl, CLSID *pclsid);
  157. #ifdef DEBUG
  158. STDAPI_(BOOL) AssertIsIDListInNameSpace(LPCITEMIDLIST pidl, const CLSID *pclsid);
  159. #endif
  160. STDAPI_(BOOL) IsIDListInNameSpace(LPCITEMIDLIST pidl, const CLSID *pclsid);
  161. STDAPI_(void) CleanupFileSystem();
  162. SHSTDAPI_(HICON) SHGetFileIcon(HINSTANCE hinst, LPCTSTR pszPath, DWORD dwFileAttribute, UINT uFlags);
  163. STDAPI GetIconLocationFromExt(IN LPTSTR pszExt, OUT LPTSTR pszIconPath, UINT cchIconPath, OUT LPINT piIconIndex);
  164. STDAPI_(BOOL) IsMainShellProcess(); // is this the process that owns the desktop hwnd (eg the main explorer process)
  165. STDAPI_(BOOL) IsProcessAnExplorer();
  166. __inline BOOL IsSecondaryExplorerProcess()
  167. {
  168. return (IsProcessAnExplorer() && !IsMainShellProcess());
  169. }
  170. STDAPI SHILAppend(LPITEMIDLIST pidlToAppend, LPITEMIDLIST *ppidl);
  171. STDAPI SHILPrepend(LPITEMIDLIST pidlToPrepend, LPITEMIDLIST *ppidl);
  172. //
  173. // IDList macros and other stuff needed by the COFSFolder project
  174. //
  175. typedef enum {
  176. ILCFP_FLAG_NORMAL = 0x0000,
  177. ILCFP_FLAG_SKIPJUNCTIONS = 0x0001, // implies ILCFP_FLAG_NO_MAP_ALIAS
  178. ILCFP_FLAG_NO_MAP_ALIAS = 0x0002,
  179. } ILCFP_FLAGS;
  180. STDAPI ILCreateFromCLSID(REFCLSID clsid, LPITEMIDLIST *ppidl);
  181. STDAPI ILCreateFromPathEx(LPCTSTR pszPath, IUnknown *punkToSkip, ILCFP_FLAGS dwFlags, LPITEMIDLIST *ppidl, DWORD *rgfInOut);
  182. STDAPI_(BOOL) ILIsParent(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, BOOL fImmediate);
  183. STDAPI_(BOOL) SHSkipJunctionBinding(IBindCtx *pbc, const CLSID *pclsidSkip);
  184. STDAPI SHCreateSkipBindCtx(IUnknown *punkToSkip, IBindCtx **ppbc);
  185. STDAPI_(void) SetUnknownOnSuccess(HRESULT hres, IUnknown *punk, IUnknown **ppunkToSet);
  186. STDAPI SHCacheTrackingFolder(LPCITEMIDLIST pidlRoot, int csidlTarget, IShellFolder2 **ppsfCache);
  187. #define MAKEINTIDLIST(csidl) (LPCITEMIDLIST)MAKEINTRESOURCE(csidl)
  188. STDAPI_(BOOL) PathIsShortcut(LPCTSTR psz, DWORD dwFileAttributes);
  189. typedef struct _ICONMAP
  190. {
  191. UINT uType; // SHID_ type
  192. UINT indexResource; // Resource index (of SHELL232.DLL)
  193. } ICONMAP, *LPICONMAP;
  194. STDAPI_(UINT) SILGetIconIndex(LPCITEMIDLIST pidl, const ICONMAP aicmp[], UINT cmax);
  195. HMONITOR GetPrimaryMonitor();
  196. BOOL GetMonitorRects(HMONITOR hMon, LPRECT prc, BOOL bWork);
  197. #define GetMonitorRect(hMon, prc) \
  198. GetMonitorRects((hMon), (prc), FALSE)
  199. #define GetMonitorWorkArea(hMon, prc) \
  200. GetMonitorRects((hMon), (prc), TRUE)
  201. #define IsMonitorValid(hMon) \
  202. GetMonitorRects((hMon), NULL, TRUE)
  203. #define GetNumberOfMonitors() \
  204. GetSystemMetrics(SM_CMONITORS)
  205. BOOL IsSelf(UINT cidl, LPCITEMIDLIST *apidl);
  206. #ifdef __cplusplus
  207. #define IsEqualSCID(a, b) (((a).pid == (b).pid) && IsEqualIID((a).fmtid, (b).fmtid) )
  208. #else
  209. #define IsEqualSCID(a, b) (((a).pid == (b).pid) && IsEqualIID(&((a).fmtid),&((b).fmtid)))
  210. #endif
  211. //
  212. // Helper function for defview callbacks.
  213. //
  214. STDAPI SHFindFirstFile(LPCTSTR pszPath, WIN32_FIND_DATA *pfd, HANDLE *phfind);
  215. STDAPI SHFindFirstFileRetry(HWND hwnd, IUnknown *punkEnableModless, LPCTSTR pszPath, WIN32_FIND_DATA *pfd, HANDLE *phfind, DWORD dwFlags);
  216. STDAPI FindFirstRetryRemovable(HWND hwnd, IUnknown *punkModless, LPCTSTR pszPath, WIN32_FIND_DATA *pfd, HANDLE *phfind);
  217. STDAPI_(UINT) SHEnumErrorMessageBox(HWND hwnd, UINT idTemplate, DWORD err, LPCTSTR pszParam, BOOL fNet, UINT dwFlags);
  218. LPSTR _ConstructMessageStringA(HINSTANCE hInst, LPCSTR pszMsg, va_list *ArgList);
  219. LPWSTR _ConstructMessageStringW(HINSTANCE hInst, LPCWSTR pszMsg, va_list *ArgList);
  220. #ifdef UNICODE
  221. #define _ConstructMessageString _ConstructMessageStringW
  222. #else
  223. #define _ConstructMessageString _ConstructMessageStringA
  224. #endif
  225. // TransferDelete() fOptions flags
  226. #define SD_USERCONFIRMATION 0x0001
  227. #define SD_SILENT 0x0002
  228. #define SD_NOUNDO 0x0004
  229. #define SD_WARNONNUKE 0x0008 // we pass this for drag-drop on recycle bin in case something is really going to be deleted
  230. STDAPI TransferDelete(HWND hwnd, HDROP hDrop, UINT fOptions);
  231. STDAPI_(BOOL) App_IsLFNAware(LPCTSTR pszFile);
  232. STDAPI_(void) ReplaceDlgIcon(HWND hDlg, UINT id, HICON hIcon);
  233. STDAPI_(LONG) GetOfflineShareStatus(LPCTSTR pcszPath);
  234. HRESULT SHGetSetFolderSetting(LPCTSTR pszIniFile, DWORD dwReadWrite, LPCTSTR pszSection,
  235. LPCTSTR pszKey, LPTSTR pszValue, DWORD cchValueSize);
  236. HRESULT SHGetSetFolderSettingPath(LPCTSTR pszIniFile, DWORD dwReadWrite, LPCTSTR pszSection,
  237. LPCTSTR pszKey, LPTSTR pszValue, DWORD cchValueSize);
  238. void ExpandOtherVariables(LPTSTR pszFile, int cch);
  239. void SubstituteWebDir(LPTSTR pszFile, int cch);
  240. STDAPI_(BOOL) IsExplorerBrowser(IShellBrowser *psb);
  241. STDAPI_(BOOL) IsExplorerModeBrowser(IUnknown *psite);
  242. STDAPI_(HWND) ShellFolderViewWindow(HWND hwnd); // evil that should be gone
  243. STDAPI InvokeFolderPidl(LPCITEMIDLIST pidl, int nCmdShow);
  244. STDAPI IUnknown_HTMLBackgroundColor(IUnknown *punk, COLORREF *pclr);
  245. STDAPI_(int) MapSCIDToColumn(IShellFolder2* psf2, const SHCOLUMNID* pscid);
  246. #ifdef COLUMNS_IN_DESKTOPINI
  247. STDAPI _GetNextCol(LPTSTR* ppszText, DWORD* pnCol);
  248. #endif
  249. STDAPI SHReadProperty(IShellFolder *psf, LPCITEMIDLIST pidl, REFFMTID fmtid, PROPID pid, VARIANT *pvar);
  250. // IDLIST.C
  251. STDAPI ILCompareRelIDs(IShellFolder *psfParent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, LPARAM lParam);
  252. STDAPI ILGetRelDisplayName(IShellFolder *psf, STRRET *psr, LPCITEMIDLIST pidlRel, LPCTSTR pszName, LPCTSTR pszTemplate, DWORD dwFlags);
  253. STDAPI SHGetIconFromPIDL(IShellFolder *psf, IShellIcon *psi, LPCITEMIDLIST pidl, UINT flags, int *piImage);
  254. STDAPI_(int) SHRenameFileEx(HWND hwnd, IUnknown *punkEnableModless, LPCTSTR pszDir, LPCTSTR pszOldName, LPCTSTR pszNewName);
  255. #define MAX_ASSOC_KEYS 7
  256. STDAPI AssocKeyFromElement(IAssociationElement *pae, HKEY *phk);
  257. STDAPI_(DWORD) SHGetAssocKeys(IQueryAssociations *pqa, HKEY *rgKeys, DWORD cKeys);
  258. STDAPI_(DWORD) SHGetAssocKeysEx(IAssociationArray *paa, ASSOCELEM_MASK mask, HKEY *rgKeys, DWORD cKeys);
  259. STDAPI_(DWORD) SHGetAssocKeysForIDList(LPCITEMIDLIST pidlFull, HKEY *rgKeys, DWORD cKeys);
  260. STDAPI AssocElemCreateForClass(const CLSID *pclsid, PCWSTR pszClass, IAssociationElement **ppae);
  261. STDAPI AssocElemCreateForKey(const CLSID *pclsid, HKEY hk, IAssociationElement **ppae);
  262. STDAPI AssocGetDetailsOfSCID(IShellFolder *psf, LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv, BOOL *pfFoundScid);
  263. STDAPI_(HKEY) SHOpenShellFolderKey(const CLSID *pclsid);
  264. STDAPI_(BOOL) SHQueryShellFolderValue(const CLSID *pclsid, LPCTSTR pszValueName);
  265. STDAPI_(DWORD) SHGetAttributesFromCLSID(const CLSID *pclsid, DWORD dwDefAttrs);
  266. STDAPI_(DWORD) SHGetAttributesFromCLSID2(const CLSID *pclsid, DWORD dwDefAttrs, DWORD dwRequested);
  267. STDAPI SHGetUIObjectOf(LPCITEMIDLIST pidl, HWND hwnd, REFIID riid, void **ppv);
  268. STDAPI_(UINT) QueryCancelAutoPlayMsg();
  269. STDAPI_(void) EnableAndShowWindow(HWND hWnd, BOOL bShow);
  270. STDAPI_(void) DPA_FreeIDArray(HDPA hdpa);
  271. STDAPI DetailsOf(IShellFolder2 *psf2, LPCITEMIDLIST pidl, DWORD flags, LPTSTR psz, UINT cch);
  272. // Disk Cleanup launch flags
  273. #define DISKCLEANUP_NOFLAG 0x00000000
  274. #define DISKCLEANUP_DEFAULT 0x00000001
  275. #define DISKCLEANUP_LOWDISK 0x00000002
  276. #define DISKCLEANUP_VERYLOWDISK 0x00000004
  277. #define DISKCLEANUP_MODAL 0x00000008
  278. STDAPI_(void) LaunchDiskCleanup(HWND hwnd, int idDrive, UINT uFlags);
  279. STDAPI_(BOOL) GetDiskCleanupPath(LPTSTR pszBuf, UINT cbSize);
  280. STDAPI ParsePrinterName(LPCTSTR pszPrinter, LPITEMIDLIST *ppidl);
  281. STDAPI ParsePrinterNameEx(LPCTSTR pszPrinter, LPITEMIDLIST *ppidl, BOOL bValidated, DWORD dwType, USHORT uFlags);
  282. STDAPI GetVariantFromRegistryValue(HKEY hkey, LPCTSTR pszValueName, VARIANT *pv);
  283. STDAPI_(UINT) GetControlCharWidth(HWND hwnd);
  284. STDAPI_(BOOL) ShowSuperHidden();
  285. STDAPI_(BOOL) IsSuperHidden(DWORD dwAttribs);
  286. STDAPI_(void) PathComposeWithArgs(LPTSTR pszPath, LPTSTR pszArgs);
  287. STDAPI_(BOOL) PathSeperateArgs(LPTSTR pszPath, LPTSTR pszArgs);
  288. STDAPI_(int) CompareIDsAlphabetical(IShellFolder2 *psf, UINT iColumn, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  289. // folder.cpp
  290. enum
  291. {
  292. XLATEALIAS_MYDOCS = 0x00000001,
  293. XLATEALIAS_DESKTOP = 0x00000002,
  294. XLATEALIAS_COMMONDOCS = 0x00000003, // BUGBUG?: XLATEALIAS_DESKTOP & XLATEALIAS_MYDOCS
  295. // XLATEALIAS_MYPICS,
  296. // XLATEALIAS_NETHOOD,
  297. };
  298. #define XLATEALIAS_ALL ((DWORD)0x0000ffff)
  299. STDAPI SHILAliasTranslate(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidlAlias, DWORD dwXlateAliases);
  300. STDAPI StatStgFromFindData(const WIN32_FIND_DATA * pfd, DWORD dwFlags, STATSTG * pstat);
  301. STDAPI_(BOOL) IsDesktopBrowser(IUnknown *punkSite);
  302. STDAPI_(void) SHChangeNotifyDeregisterWindow(HWND hwnd);
  303. STDAPI GetCCHMaxFromPath(LPCTSTR szFullPath, UINT *pcchMax, BOOL fShowExtension);
  304. STDAPI ViewModeFromSVID(const SHELLVIEWID *pvid, FOLDERVIEWMODE *pViewMode);
  305. STDAPI SVIDFromViewMode(FOLDERVIEWMODE uViewMode, SHELLVIEWID *psvid);
  306. STDAPI_(DWORD) SetLinkFlags(IShellLink *psl, DWORD dwFlags, DWORD dwMask);
  307. STDAPI TBCGetBindCtx(BOOL fCreate, IBindCtx **ppbc);
  308. STDAPI TBCGetObjectParam(LPCOLESTR pszKey, REFIID riid, void **ppv);
  309. STDAPI TBCRegisterObjectParam(LPCOLESTR pszKey, IUnknown *punk, IBindCtx **ppbcLifetime);
  310. STDAPI TBCSetEnvironmentVariable(LPCWSTR pszVar, LPCWSTR pszValue, IBindCtx **ppbcLifetime);
  311. STDAPI TBCGetEnvironmentVariable(LPCWSTR pszVar, LPWSTR pszValue, DWORD cchValue);
  312. STDAPI_(int) CompareVariants(VARIANT va1, VARIANT va2);
  313. STDAPI_(int) CompareBySCID(IShellFolder2 *psf, const SHCOLUMNID *pscid, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  314. STDAPI_(int) CompareFolderness(IShellFolder *psf, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  315. STDAPI_(BOOL) IsRegItemName(LPCTSTR pszName, CLSID* pclsid);
  316. STDAPI SHCreateShellItemFromParent(IShellItem *psiParent, LPCWSTR pszName, IShellItem **ppsi);
  317. STDAPI GetMyDocumentsDisplayName(LPTSTR pszPath, UINT cch);
  318. STDAPI BSTRFromCLSID(REFCLSID clsid, BSTR *pbstr);
  319. typedef struct {
  320. LPCWSTR pszCmd; // verbW
  321. LPCSTR pszCmdA; // verbA
  322. WPARAM idDFMCmd; // id to map to
  323. UINT idDefCmd; // extra info defcm uses
  324. } ICIVERBTOIDMAP;
  325. HRESULT SHMapICIVerbToCmdID(LPCMINVOKECOMMANDINFO pici, const ICIVERBTOIDMAP* pmap, UINT cmap, UINT *pid);
  326. HRESULT SHMapCmdIDToVerb(UINT_PTR idCmd, const ICIVERBTOIDMAP* pmap, UINT cmap, LPSTR pszName, UINT cchMax, BOOL bUnicode);
  327. STDAPI SHPropertiesForUnk(HWND hwnd, IUnknown *punk, LPCTSTR psz);
  328. STDAPI SHFullIDListFromFolderAndItem(IShellFolder *psf, LPCITEMIDLIST pidl, LPITEMIDLIST *ppidl);
  329. STDAPI_(BOOL) IsWindowClass(HWND hwndTest, LPCTSTR pszClass);
  330. STDAPI DCA_ExtCreateInstance(HDCA hdca, int iItem, REFIID riid, LPVOID FAR* ppv);
  331. STDAPI WrapInfotip(IShellFolder *psf, LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, IUnknown *punk);
  332. STDAPI CloneIDListArray(UINT cidl, const LPCITEMIDLIST rgpidl[], UINT *pcidl, LPITEMIDLIST **papidl);
  333. typedef BOOL (CALLBACK* ENUMSHELLWINPROC)(HWND hwnd, LPCITEMIDLIST pidl, LPARAM lParam);
  334. STDAPI EnumShellWindows(ENUMSHELLWINPROC pEnumFunc, LPARAM lParam);
  335. // Infotip Helper Functions
  336. BOOL SHShowInfotips();
  337. HRESULT SHCreateInfotipWindow(HWND hwndParent, LPWSTR pszInfotip, HWND *phwndInfotip);
  338. HRESULT SHShowInfotipWindow(HWND hwndInfotip, BOOL bShow);
  339. HRESULT SHDestroyInfotipWindow(HWND *phwndInfotip);
  340. BOOL PolicyNoActiveDesktop(void);
  341. // should we should wizards as icons in defview of this object?
  342. STDAPI SHShouldShowWizards(IUnknown *punksite);
  343. STDAPI SplitIDList(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidlFolder, LPCITEMIDLIST *ppidlChild);
  344. STDAPI SHSimulateDropWithSite(IDropTarget *pdrop, IDataObject *pdtobj, DWORD grfKeyState,
  345. const POINTL *ppt, DWORD *pdwEffect, IUnknown *punkSite);
  346. STDAPI FindAppForFileInUse(PCWSTR pszFile, PWSTR *ppszApp);
  347. HRESULT InitializeDirectUI();
  348. void UnInitializeDirectUI();
  349. BOOL IsForceGuestModeOn(void);
  350. BOOL IsFolderSecurityModeOn(void);
  351. STDAPI_(int) StrCmpLogicalRestricted(PCWSTR psz1, PCWSTR psz2);
  352. #endif // _UTIL_H