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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __WINE_SHELL_MAIN_H
23 #define __WINE_SHELL_MAIN_H
27 #include "undocshell.h"
28 #include "wine/obj_shellfolder.h"
29 #include "wine/obj_dataobject.h"
30 #include "wine/obj_contextmenu.h"
31 #include "wine/obj_shellview.h"
32 #include "wine/obj_shelllink.h"
33 #include "wine/obj_extracticon.h"
34 #include "wine/windef16.h"
36 /*******************************************
37 * global SHELL32.DLL variables
39 extern HMODULE huser32;
40 extern HINSTANCE shell32_hInstance;
41 extern HIMAGELIST ShellSmallIconList;
42 extern HIMAGELIST ShellBigIconList;
45 /*******************************************
46 * pointer to functions dynamically loaded
48 extern void (WINAPI *pDLLInitComctl)(LPVOID);
50 BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
53 #define INVALID_INDEX -1
54 BOOL SIC_Initialize(void);
55 void SIC_Destroy(void);
56 BOOL PidlToSicIndex (IShellFolder * sh, LPITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, UINT * pIndex);
59 BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL bPrependDot);
60 BOOL HCR_GetExecuteCommand ( LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len );
61 BOOL HCR_GetDefaultIcon (LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr);
62 BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len);
63 BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest);
65 BOOL WINAPI AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
66 DWORD WINAPI ParseFieldA(LPCSTR src,DWORD field,LPSTR dst,DWORD len);
68 /****************************************************************************
71 LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner, LPITEMIDLIST myPidl, LPITEMIDLIST * apidl, UINT cidl);
72 LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []);
74 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID);
75 IContextMenu * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount);
76 IContextMenu * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent);
77 LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER);
79 HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
80 HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
81 HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
82 HRESULT WINAPI ISF_MyComputer_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
83 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
85 /* kind of enumidlist */
90 LPENUMIDLIST IEnumIDList_Constructor(LPCSTR,DWORD,DWORD);
92 LPEXTRACTICONA IExtractIconA_Constructor(LPITEMIDLIST);
93 HRESULT CreateStreamOnFile (LPCSTR pszFilename, IStream ** ppstm);
95 /* FIXME: rename the functions when the shell32.dll has it's own exports namespace */
96 HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
97 HRESULT WINAPI SHELL32_DllCanUnloadNow(void);
99 /* FIXME: move away */
100 #define ResultFromShort(i) MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i))
103 #define MM_ADDSEPARATOR 0x00000001L
104 #define MM_SUBMENUSHAVEIDS 0x00000002L
105 HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags);
107 /* initialisation for FORMATETC */
108 #define InitFormatEtc(fe, cf, med) \
111 (fe).dwAspect=DVASPECT_CONTENT;\
117 #define KeyStateToDropEffect(kst)\
118 (((kst) & MK_CONTROL) ?\
119 (((kst) & MK_SHIFT) ? DROPEFFECT_LINK : DROPEFFECT_COPY):\
123 BOOL SYSTRAY_Init(void);
126 extern HINSTANCE hShellOle32;
128 extern HRESULT (WINAPI *pOleInitialize)(LPVOID reserved);
129 extern void (WINAPI *pOleUninitialize)(void);
130 extern HRESULT (WINAPI *pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
131 extern HRESULT (WINAPI *pRevokeDragDrop)(HWND hwnd);
132 extern HRESULT (WINAPI *pDoDragDrop)(LPDATAOBJECT,LPDROPSOURCE,DWORD,DWORD*);
133 extern void (WINAPI *pReleaseStgMedium)(STGMEDIUM* pmedium);
134 extern HRESULT (WINAPI *pOleSetClipboard)(IDataObject* pDataObj);
135 extern HRESULT (WINAPI *pOleGetClipboard)(IDataObject** ppDataObj);
136 extern HRESULT (WINAPI *pCoCreateInstance)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
138 BOOL GetShellOle(void);
140 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
141 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
142 HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
143 HGLOBAL RenderFILECONTENTS (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
144 HGLOBAL RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
145 HGLOBAL RenderFILENAME (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
146 HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags);
148 /* Change Notification */
149 void InitChangeNotifications(void);
150 void FreeChangeNotifications(void);
153 #define ASK_DELETE_FILE 1
154 #define ASK_DELETE_FOLDER 2
155 #define ASK_DELETE_MULTIPLE_ITEM 3
157 BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI);
158 BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI);
159 BOOL SHELL_WarnItemDelete(int nKindOfDialog, LPCSTR szDir);
161 /* 16-bit functions */
162 void WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b);
163 UINT16 WINAPI DragQueryFile16(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, WORD wLength);
164 void WINAPI DragFinish16(HDROP16 h);
165 BOOL16 WINAPI DragQueryPoint16(HDROP16 hDrop, POINT16 *p);
166 HINSTANCE16 WINAPI ShellExecute16(HWND16,LPCSTR,LPCSTR,LPCSTR,LPCSTR,INT16);
167 HICON16 WINAPI ExtractIcon16(HINSTANCE16,LPCSTR,UINT16);
168 HICON16 WINAPI ExtractAssociatedIcon16(HINSTANCE16,LPSTR,LPWORD);
169 HICON16 WINAPI ExtractIconEx16 ( LPCSTR, INT16, HICON16 *, HICON16 *, UINT16 );
170 HINSTANCE16 WINAPI FindExecutable16(LPCSTR,LPCSTR,LPSTR);
171 HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16,LPCSTR,UINT16,WORD);
172 BOOL16 WINAPI ShellAbout16(HWND16,LPCSTR,LPCSTR,HICON16);
173 BOOL16 WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
175 inline static BOOL SHELL_OsIsUnicode(void)
177 /* if high-bit of version is 0, we are emulating NT */
178 return !(GetVersion() & 0x80000000);
181 #define __SHFreeAndNil(ptr) \
186 inline static void __SHCloneStrA(char ** target,const char * source)
188 *target = SHAlloc(strlen(source)+1); \
189 strcpy(*target, source); \
192 inline static void __SHCloneStrWtoA(char ** target, const WCHAR * source)
194 int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
195 *target = SHAlloc(len);
196 WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);