[PRINTING]
[reactos.git] / reactos / dll / win32 / shell32 / wine / shell32_main.h
1 /*
2 * internal Shell32 Library definitions
3 *
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 #ifndef __WINE_SHELL_MAIN_H
23 #define __WINE_SHELL_MAIN_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /*******************************************
30 * global SHELL32.DLL variables
31 */
32 extern HMODULE huser32 DECLSPEC_HIDDEN;
33 extern HINSTANCE shell32_hInstance DECLSPEC_HIDDEN;
34
35 BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
36
37 /* Iconcache */
38 #define INVALID_INDEX -1
39 BOOL SIC_Initialize(void);
40 void SIC_Destroy(void) DECLSPEC_HIDDEN;
41 BOOL PidlToSicIndex (IShellFolder * sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int * pIndex) DECLSPEC_HIDDEN;
42 INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags ) DECLSPEC_HIDDEN;
43
44 /* Classes Root */
45 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) DECLSPEC_HIDDEN;
46 BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) DECLSPEC_HIDDEN;
47 BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) DECLSPEC_HIDDEN;
48 BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx);
49 BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) DECLSPEC_HIDDEN;
50
51 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
52 BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) DECLSPEC_HIDDEN;
53 BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPCSTR sName, DWORD len, int* picon_idx);
54 BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) DECLSPEC_HIDDEN;
55
56 BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes) DECLSPEC_HIDDEN;
57
58 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len) DECLSPEC_HIDDEN;
59 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) DECLSPEC_HIDDEN;
60
61 /****************************************************************************
62 * Class constructors
63 */
64 HRESULT IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST pMyPidl, PCUITEMID_CHILD_ARRAY apidl, UINT cidl, IDataObject **dataObject);
65 HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **enumerator);
66
67 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID);
68 IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *aPidls, UINT uItemCount);
69 HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv);
70 IContextMenu2 * ISvStaticItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *apidl, UINT cidl, HKEY hKey);
71 IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
72 HRESULT WINAPI IShellView_Constructor(IShellFolder *pFolder, IShellView **newView);
73 HRESULT WINAPI CDefView_Constructor(IShellFolder *pFolder, REFIID riid, LPVOID * ppvOut);
74 HRESULT WINAPI CDefViewDual_Constructor(REFIID riid, LPVOID * ppvOut);
75 HRESULT WINAPI CShellDispatch_Constructor(REFIID riid, LPVOID * ppvOut);
76
77 HRESULT WINAPI IShellLink_ConstructFromPath(WCHAR *path, REFIID riid, LPVOID *ppv);
78 HRESULT WINAPI IShellLink_ConstructFromFile(IShellFolder * psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv);
79 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV);
80 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) DECLSPEC_HIDDEN;
81 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) DECLSPEC_HIDDEN;
82
83 HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, REFIID iid, LPVOID * ppvOut);
84
85 HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, REFIID riid, void **ppv);
86
87 /* initialisation for FORMATETC */
88 #define InitFormatEtc(fe, cf, med) \
89 {\
90 (fe).cfFormat=cf;\
91 (fe).dwAspect=DVASPECT_CONTENT;\
92 (fe).ptd=NULL;\
93 (fe).tymed=med;\
94 (fe).lindex=-1;\
95 };
96
97 #define KeyStateToDropEffect(kst)\
98 ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\
99 (((kst)&(MK_CONTROL)) ? DROPEFFECT_COPY :\
100 (((kst)&(MK_SHIFT)) ? DROPEFFECT_MOVE :\
101 DROPEFFECT_NONE)))
102
103
104 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
105 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
106 HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
107 HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
108
109 /* Change Notification */
110 void InitChangeNotifications(void) DECLSPEC_HIDDEN;
111 void FreeChangeNotifications(void) DECLSPEC_HIDDEN;
112 void InitIconOverlays(void);
113
114 /* file operation */
115 #define ASK_DELETE_FILE 1
116 #define ASK_DELETE_FOLDER 2
117 #define ASK_DELETE_MULTIPLE_ITEM 3
118 #define ASK_CREATE_FOLDER 4
119 #define ASK_OVERWRITE_FILE 5
120 #define ASK_DELETE_SELECTED 6
121 #define ASK_TRASH_FILE 7
122 #define ASK_TRASH_FOLDER 8
123 #define ASK_TRASH_MULTIPLE_ITEM 9
124 #define ASK_CANT_TRASH_ITEM 10
125 #define ASK_OVERWRITE_FOLDER 11
126
127 BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pwszDir, BOOL bShowUI);
128 BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir);
129
130 void WINAPI _InsertMenuItemW (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
131 UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState);
132
133 static __inline BOOL SHELL_OsIsUnicode(void)
134 {
135 /* if high-bit of version is 0, we are emulating NT */
136 return !(GetVersion() & 0x80000000);
137 }
138
139 #define __SHFreeAndNil(ptr) \
140 {\
141 SHFree(*ptr); \
142 *ptr = NULL; \
143 };
144 static __inline void __SHCloneStrA(char **target, const char *source)
145 {
146 *target = (char *)SHAlloc(strlen(source) + 1);
147 strcpy(*target, source);
148 }
149
150 static __inline void __SHCloneStrWtoA(char **target, const WCHAR *source)
151 {
152 int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
153 *target = (char *)SHAlloc(len);
154 WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);
155 }
156
157 static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
158 {
159 *target = (WCHAR *)SHAlloc((lstrlenW(source) + 1) * sizeof(WCHAR) );
160 lstrcpyW(*target, source);
161 }
162
163 static __inline LPWSTR __SHCloneStrAtoW(WCHAR **target, const char *source)
164 {
165 int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0);
166 *target = (WCHAR *)SHAlloc(len * sizeof(WCHAR));
167 MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len);
168 return *target;
169 }
170
171 /* handle conversions */
172 #define HICON_16(h32) (LOWORD(h32))
173 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
174 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
175 #define HINSTANCE_16(h32) (LOWORD(h32))
176
177 extern WCHAR swShell32Name[MAX_PATH] DECLSPEC_HIDDEN;
178
179 BOOL UNIXFS_is_rooted_at_desktop(void) DECLSPEC_HIDDEN;
180 extern const GUID CLSID_UnixFolder DECLSPEC_HIDDEN;
181 extern const GUID CLSID_UnixDosFolder DECLSPEC_HIDDEN;
182
183 /* Default shell folder value registration */
184 HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN;
185
186 /* Detect Shell Links */
187 BOOL SHELL_IsShortcut(LPCITEMIDLIST) DECLSPEC_HIDDEN;
188
189 INT_PTR CALLBACK SH_FileGeneralDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
190 INT_PTR CALLBACK SH_FileVersionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
191 HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle);
192 BOOL SH_ShowDriveProperties(WCHAR *drive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl);
193 BOOL SH_ShowRecycleBinProperties(WCHAR sDrive);
194 BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl);
195 BOOL SH_ShowFolderProperties(LPWSTR pwszFolder, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl);
196 LPWSTR SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf);
197
198 HRESULT WINAPI DoRegisterServer(void);
199 HRESULT WINAPI DoUnregisterServer(void);
200
201 #ifdef __cplusplus
202 } /* extern "C" */
203 #endif
204
205 #endif /* __WINE_SHELL_MAIN_H */