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.

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