xref: /reactos/dll/win32/shell32/shfldr.h (revision 9452b29c)
1 
2 /*
3  *  Virtual Folder
4  *  common definitions
5  *
6  *  Copyright 1997 Marcus Meissner
7  *  Copyright 1998, 1999, 2002 Juergen Schmied
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef _SHFLDR_H_
25 #define _SHFLDR_H_
26 
27 #define CHARS_IN_GUID 39
28 
29 typedef struct {
30     int colnameid;
31     int pcsFlags;
32     int fmt;
33     int cxChar;
34 } shvheader;
35 
36 #define GET_SHGDN_FOR(dwFlags)         ((DWORD)dwFlags & (DWORD)0x0000FF00)
37 #define GET_SHGDN_RELATION(dwFlags)    ((DWORD)dwFlags & (DWORD)0x000000FF)
38 
39 HRESULT
40 Shell_NextElement(
41     _Inout_ LPWSTR *ppch,
42     _Out_ LPWSTR pszOut,
43     _In_ INT cchOut,
44     _In_ BOOL bValidate);
45 
46 HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
47                   LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes);
48 
49 HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet);
50 
51 HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes);
52 
53 HRESULT SHELL32_CompareDetails(IShellFolder2* isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
54 
55 HRESULT SHELL32_CompareChildren(IShellFolder2* psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
56 
57 #ifdef __cplusplus
58 HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO* ppfti,
59                 LPCITEMIDLIST pidlChild, const GUID* clsid, REFIID riid, LPVOID *ppvOut);
60 
61 HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, const GUID* clsid,
62                                 int csidl, REFIID riid, LPVOID *ppvOut);
63 #endif
64 
65 HRESULT SHELL32_BindToSF (LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO* ppfti,
66                 LPCITEMIDLIST pidl, const GUID* clsid, REFIID riid, LPVOID *ppvOut);
67 
68 extern "C"
69 BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey);
70 
71 void AddFSClassKeysToArray(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, HKEY* array, UINT* cKeys);
72 
73 HRESULT CDefViewBckgrndMenu_CreateInstance(IShellFolder* psf, REFIID riid, void **ppv);
74 
75 HRESULT SH_GetApidlFromDataObject(IDataObject *pDataObject, PIDLIST_ABSOLUTE* ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl);
76 
77 static __inline int SHELL32_GUIDToStringA (REFGUID guid, LPSTR str)
78 {
79     return sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
80             guid.Data1, guid.Data2, guid.Data3,
81             guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
82             guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
83 }
84 
85 static __inline int SHELL32_GUIDToStringW (REFGUID guid, LPWSTR str)
86 {
87     static const WCHAR fmtW[] =
88      { '{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-',
89      '%','0','2','X','%','0','2','X','-',
90      '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
91      '%','0','2','X','%','0','2','X','}',0 };
92     return swprintf(str, fmtW,
93             guid.Data1, guid.Data2, guid.Data3,
94             guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
95             guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
96 }
97 
98 void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags);
99 BOOL SHELL_FS_HideExtension(LPCWSTR pwszPath);
100 
101 LSTATUS AddClassKeyToArray(const WCHAR* szClass, HKEY* array, UINT* cKeys);
102 
103 #ifdef __cplusplus
104 
105 HRESULT inline SHSetStrRet(LPSTRRET pStrRet, DWORD resId)
106 {
107     return SHSetStrRet(pStrRet, shell32_hInstance, resId);
108 }
109 
110 #endif
111 
112 #endif /* _SHFLDR_H_ */
113