netstat: Initial implementation.
[wine] / dlls / shell32 / 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 #include <stdarg.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winnls.h"
32 #include "commctrl.h"
33 #include "objbase.h"
34 #include "docobj.h"
35 #include "undocshell.h"
36 #include "shlobj.h"
37 #include "shellapi.h"
38 #include "wine/unicode.h"
39
40 /*******************************************
41 *  global SHELL32.DLL variables
42 */
43 extern HMODULE  huser32 DECLSPEC_HIDDEN;
44 extern HINSTANCE shell32_hInstance DECLSPEC_HIDDEN;
45 extern HIMAGELIST       ShellSmallIconList DECLSPEC_HIDDEN;
46 extern HIMAGELIST       ShellBigIconList DECLSPEC_HIDDEN;
47
48 /* Iconcache */
49 #define INVALID_INDEX -1
50 BOOL SIC_Initialize(void) DECLSPEC_HIDDEN;
51 void SIC_Destroy(void) DECLSPEC_HIDDEN;
52 BOOL PidlToSicIndex (IShellFolder * sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int * pIndex) DECLSPEC_HIDDEN;
53 INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags ) DECLSPEC_HIDDEN;
54
55 /* Classes Root */
56 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) DECLSPEC_HIDDEN;
57 BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) DECLSPEC_HIDDEN;
58 BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) DECLSPEC_HIDDEN;
59 BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx) DECLSPEC_HIDDEN;
60 BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) DECLSPEC_HIDDEN;
61
62 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
63 BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) DECLSPEC_HIDDEN;
64 BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx) DECLSPEC_HIDDEN;
65 BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) DECLSPEC_HIDDEN;
66
67 BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes) DECLSPEC_HIDDEN;
68
69 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len) DECLSPEC_HIDDEN;
70 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) DECLSPEC_HIDDEN;
71
72 BOOL WINAPI GUIDFromStringW(LPCWSTR, LPGUID) DECLSPEC_HIDDEN;
73
74 /****************************************************************************
75  * Class constructors
76  */
77 LPDATAOBJECT    IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST myPidl, LPCITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
78 LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []) DECLSPEC_HIDDEN;
79
80 LPCLASSFACTORY  IClassFactory_Constructor(REFCLSID) DECLSPEC_HIDDEN;
81 HRESULT ItemMenu_Constructor(IShellFolder*, LPCITEMIDLIST, const LPCITEMIDLIST*, UINT, REFIID, void**) DECLSPEC_HIDDEN;
82 HRESULT BackgroundMenu_Constructor(IShellFolder*, BOOL, REFIID, void**) DECLSPEC_HIDDEN;
83 LPSHELLVIEW     IShellView_Constructor(LPSHELLFOLDER) DECLSPEC_HIDDEN;
84
85 HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
86 HRESULT WINAPI IShellDispatch_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
87 HRESULT WINAPI IShellItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
88 HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
89 HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, LPVOID * ppv) DECLSPEC_HIDDEN;
90 HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
91 HRESULT WINAPI ISF_MyComputer_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
92 HRESULT WINAPI ISF_NetworkPlaces_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
93 HRESULT WINAPI Printers_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
94 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
95 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV) DECLSPEC_HIDDEN;
96 HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
97 HRESULT WINAPI UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
98 HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
99 HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
100 HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
101 HRESULT WINAPI RecycleBin_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv) DECLSPEC_HIDDEN;
102 HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppOutput) DECLSPEC_HIDDEN;
103 HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
104 HRESULT WINAPI KnownFolderManager_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
105 extern HRESULT CPanel_GetIconLocationW(LPCITEMIDLIST, LPWSTR, UINT, int*) DECLSPEC_HIDDEN;
106 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) DECLSPEC_HIDDEN;
107 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) DECLSPEC_HIDDEN;
108
109 HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN;
110 HRESULT WINAPI ApplicationAssociationRegistration_Constructor(IUnknown *outer, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
111
112
113 LPEXTRACTICONA  IExtractIconA_Constructor(LPCITEMIDLIST) DECLSPEC_HIDDEN;
114 LPEXTRACTICONW  IExtractIconW_Constructor(LPCITEMIDLIST) DECLSPEC_HIDDEN;
115
116 /* initialisation for FORMATETC */
117 #define InitFormatEtc(fe, cf, med) \
118         {\
119         (fe).cfFormat=cf;\
120         (fe).dwAspect=DVASPECT_CONTENT;\
121         (fe).ptd=NULL;\
122         (fe).tymed=med;\
123         (fe).lindex=-1;\
124         };
125
126 #define KeyStateToDropEffect(kst)\
127     ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\
128     (((kst)&(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_COPY :\
129     DROPEFFECT_MOVE))
130
131
132 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
133 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
134 HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
135 HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
136
137 /* Change Notification */
138 void InitChangeNotifications(void) DECLSPEC_HIDDEN;
139 void FreeChangeNotifications(void) DECLSPEC_HIDDEN;
140
141 /* file operation */
142 #define ASK_DELETE_FILE           1
143 #define ASK_DELETE_FOLDER         2
144 #define ASK_DELETE_MULTIPLE_ITEM  3
145 #define ASK_CREATE_FOLDER         4
146 #define ASK_OVERWRITE_FILE        5
147 #define ASK_DELETE_SELECTED       6
148 #define ASK_TRASH_FILE            7
149 #define ASK_TRASH_FOLDER          8
150 #define ASK_TRASH_MULTIPLE_ITEM   9
151 #define ASK_CANT_TRASH_ITEM      10
152 #define ASK_OVERWRITE_FOLDER     11
153
154 BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir) DECLSPEC_HIDDEN;
155
156 static inline BOOL SHELL_OsIsUnicode(void)
157 {
158     /* if high-bit of version is 0, we are emulating NT */
159     return !(GetVersion() & 0x80000000);
160 }
161
162 #define __SHFreeAndNil(ptr) \
163         {\
164           SHFree(*ptr); \
165           *ptr = NULL; \
166         };
167 static inline void __SHCloneStrA(char ** target,const char * source)
168 {
169         *target = SHAlloc(strlen(source)+1);
170         strcpy(*target, source);
171 }
172
173 static inline void __SHCloneStrWtoA(char ** target, const WCHAR * source)
174 {
175         int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
176         *target = SHAlloc(len);
177         WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);
178 }
179
180 static inline void __SHCloneStrW(WCHAR ** target, const WCHAR * source)
181 {
182         *target = SHAlloc( (lstrlenW(source)+1) * sizeof(WCHAR) );
183         lstrcpyW(*target, source);
184 }
185
186 static inline WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source)
187 {
188         int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0);
189         *target = SHAlloc(len*sizeof(WCHAR));
190         MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len);
191         return *target;
192 }
193
194
195 extern WCHAR swShell32Name[MAX_PATH] DECLSPEC_HIDDEN;
196
197 BOOL UNIXFS_is_rooted_at_desktop(void) DECLSPEC_HIDDEN;
198 extern const GUID CLSID_UnixFolder DECLSPEC_HIDDEN;
199 extern const GUID CLSID_UnixDosFolder DECLSPEC_HIDDEN;
200
201 extern BOOL run_winemenubuilder( const WCHAR *args ) DECLSPEC_HIDDEN;
202
203 /* Default shell folder value registration */
204 HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN;
205
206 /* Detect Shell Links */
207 BOOL SHELL_IsShortcut(LPCITEMIDLIST) DECLSPEC_HIDDEN;
208
209
210 /* IEnumIDList stuff */
211 struct enumlist
212 {
213         struct enumlist *pNext;
214         LPITEMIDLIST    pidl;
215 };
216
217 typedef struct
218 {
219         IEnumIDList     IEnumIDList_iface;
220         LONG            ref;
221         struct enumlist *mpFirst;
222         struct enumlist *mpLast;
223         struct enumlist *mpCurrent;
224 } IEnumIDListImpl;
225
226 /* Creates an IEnumIDList; add LPITEMIDLISTs to it with AddToEnumList. */
227 IEnumIDListImpl *IEnumIDList_Constructor(void) DECLSPEC_HIDDEN;
228 BOOL AddToEnumList(IEnumIDListImpl *list, LPITEMIDLIST pidl) DECLSPEC_HIDDEN;
229
230 /* Enumerates the folders and/or files (depending on dwFlags) in lpszPath and
231  * adds them to the already-created list.
232  */
233 BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags) DECLSPEC_HIDDEN;
234
235 #endif