quartz: Don't cast WSTR to BSTR, convert properly instead.
[wine/testsucceed.git] / dlls / shell32 / shell32_main.h
blob16fb4a5cbedc5348a6b0a9dbb61e5542c547ada8
1 /*
2 * internal Shell32 Library definitions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
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.
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.
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
22 #ifndef __WINE_SHELL_MAIN_H
23 #define __WINE_SHELL_MAIN_H
25 #include <stdarg.h>
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"
40 /*******************************************
41 * global SHELL32.DLL variables
43 extern HMODULE huser32;
44 extern HINSTANCE shell32_hInstance;
45 extern HIMAGELIST ShellSmallIconList;
46 extern HIMAGELIST ShellBigIconList;
48 BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
50 /* Iconcache */
51 #define INVALID_INDEX -1
52 BOOL SIC_Initialize(void);
53 void SIC_Destroy(void);
54 BOOL PidlToSicIndex (IShellFolder * sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int * pIndex);
55 INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags );
57 /* Classes Root */
58 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot);
59 BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
60 BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
61 BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx);
62 BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len);
64 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
65 BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot);
66 BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx);
67 BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
69 BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes);
71 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len);
72 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len);
74 /****************************************************************************
75 * Class constructors
77 LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST myPidl, LPCITEMIDLIST * apidl, UINT cidl);
78 LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []);
80 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID);
81 IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *aPidls, UINT uItemCount);
82 IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
83 LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER);
85 HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
86 HRESULT WINAPI IShellItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
87 HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
88 HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, LPVOID * ppv);
89 HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
90 HRESULT WINAPI ISF_MyComputer_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
91 HRESULT WINAPI ISF_NetworkPlaces_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
92 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
93 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV);
94 HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
95 HRESULT WINAPI UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
96 HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
97 HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
98 HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
99 HRESULT WINAPI RecycleBin_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv);
100 HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppOutput);
101 extern HRESULT CPanel_GetIconLocationW(LPCITEMIDLIST, LPWSTR, UINT, int*);
102 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
103 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
105 HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
107 LPEXTRACTICONA IExtractIconA_Constructor(LPCITEMIDLIST);
108 LPEXTRACTICONW IExtractIconW_Constructor(LPCITEMIDLIST);
110 /* menu merging */
111 #define MM_ADDSEPARATOR 0x00000001L
112 #define MM_SUBMENUSHAVEIDS 0x00000002L
113 HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags);
115 /* initialisation for FORMATETC */
116 #define InitFormatEtc(fe, cf, med) \
118 (fe).cfFormat=cf;\
119 (fe).dwAspect=DVASPECT_CONTENT;\
120 (fe).ptd=NULL;\
121 (fe).tymed=med;\
122 (fe).lindex=-1;\
125 #define KeyStateToDropEffect(kst)\
126 ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\
127 (((kst)&(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_COPY :\
128 DROPEFFECT_MOVE))
131 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
132 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
133 HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
134 HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
136 /* Change Notification */
137 void InitChangeNotifications(void);
138 void FreeChangeNotifications(void);
140 /* file operation */
141 #define ASK_DELETE_FILE 1
142 #define ASK_DELETE_FOLDER 2
143 #define ASK_DELETE_MULTIPLE_ITEM 3
144 #define ASK_CREATE_FOLDER 4
145 #define ASK_OVERWRITE_FILE 5
146 #define ASK_DELETE_SELECTED 6
147 #define ASK_TRASH_FILE 7
148 #define ASK_TRASH_FOLDER 8
149 #define ASK_TRASH_MULTIPLE_ITEM 9
150 #define ASK_CANT_TRASH_ITEM 10
151 #define ASK_OVERWRITE_FOLDER 11
153 BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir);
155 static inline BOOL SHELL_OsIsUnicode(void)
157 /* if high-bit of version is 0, we are emulating NT */
158 return !(GetVersion() & 0x80000000);
161 #define __SHFreeAndNil(ptr) \
163 SHFree(*ptr); \
164 *ptr = NULL; \
166 static inline void __SHCloneStrA(char ** target,const char * source)
168 *target = SHAlloc(strlen(source)+1);
169 strcpy(*target, source);
172 static inline void __SHCloneStrWtoA(char ** target, const WCHAR * source)
174 int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
175 *target = SHAlloc(len);
176 WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);
179 static inline void __SHCloneStrW(WCHAR ** target, const WCHAR * source)
181 *target = SHAlloc( (lstrlenW(source)+1) * sizeof(WCHAR) );
182 lstrcpyW(*target, source);
185 static inline WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source)
187 int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0);
188 *target = SHAlloc(len*sizeof(WCHAR));
189 MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len);
190 return *target;
194 extern WCHAR swShell32Name[MAX_PATH];
196 BOOL UNIXFS_is_rooted_at_desktop(void);
197 extern const GUID CLSID_UnixFolder;
198 extern const GUID CLSID_UnixDosFolder;
200 extern BOOL run_winemenubuilder( const WCHAR *args );
202 /* Default shell folder value registration */
203 HRESULT SHELL_RegisterShellFolders(void);
205 /* Detect Shell Links */
206 BOOL SHELL_IsShortcut(LPCITEMIDLIST);
208 #endif