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 #include "shell32_version.h" 30 31 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) 32 33 /******************************************* 34 * global SHELL32.DLL variables 35 */ 36 extern HMODULE huser32 DECLSPEC_HIDDEN; 37 extern HINSTANCE shell32_hInstance DECLSPEC_HIDDEN; 38 39 BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList); 40 41 /* Iconcache */ 42 #define INVALID_INDEX -1 43 BOOL SIC_Initialize(void); 44 void SIC_Destroy(void) DECLSPEC_HIDDEN; 45 BOOL PidlToSicIndex (IShellFolder * sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int * pIndex) DECLSPEC_HIDDEN; 46 INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags ) DECLSPEC_HIDDEN; 47 extern INT ShellLargeIconSize; 48 extern INT ShellSmallIconSize; 49 extern INT ShellIconBPP; 50 51 /* Classes Root */ 52 HRESULT HCR_GetProgIdKeyOfExtension(PCWSTR szExtension, PHKEY phKey, BOOL AllowFallback); 53 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) DECLSPEC_HIDDEN; 54 BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) DECLSPEC_HIDDEN; 55 BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) DECLSPEC_HIDDEN; 56 BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx); 57 BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) DECLSPEC_HIDDEN; 58 59 #ifdef __REACTOS__ 60 /* Current User */ 61 BOOL HCU_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) DECLSPEC_HIDDEN; 62 63 /* Local Machine */ 64 BOOL HLM_GetIconW(int reg_idx, LPWSTR szDest, DWORD len, int* picon_idx) DECLSPEC_HIDDEN; 65 #endif 66 67 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */ 68 BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) DECLSPEC_HIDDEN; 69 BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPCSTR sName, DWORD len, int* picon_idx); 70 BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) DECLSPEC_HIDDEN; 71 72 BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes) DECLSPEC_HIDDEN; 73 74 /* File associations */ 75 #define SHELL32_AssocGetFolderDescription SHELL32_AssocGetFSDirectoryDescription 76 HRESULT SHELL32_AssocGetFSDirectoryDescription(PWSTR Buf, UINT cchBuf); 77 HRESULT SHELL32_AssocGetFileDescription(PCWSTR Name, PWSTR Buf, UINT cchBuf); 78 79 80 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len) DECLSPEC_HIDDEN; 81 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) DECLSPEC_HIDDEN; 82 83 /**************************************************************************** 84 * Class constructors 85 */ 86 HRESULT IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST pMyPidl, PCUITEMID_CHILD_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject); 87 HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **enumerator); 88 89 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID); 90 IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *aPidls, UINT uItemCount); 91 HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv); 92 IContextMenu2 * ISvStaticItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *apidl, UINT cidl, HKEY hKey); 93 IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop); 94 HRESULT WINAPI CDefViewDual_Constructor(REFIID riid, LPVOID * ppvOut); 95 HRESULT WINAPI CShellDispatch_Constructor(REFIID riid, LPVOID * ppvOut); 96 97 HRESULT WINAPI IShellLink_ConstructFromPath(WCHAR *path, REFIID riid, LPVOID *ppv); 98 HRESULT WINAPI IShellLink_ConstructFromFile(IShellFolder * psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv); 99 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV); 100 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) DECLSPEC_HIDDEN; 101 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) DECLSPEC_HIDDEN; 102 103 /* initialisation for FORMATETC */ 104 #define InitFormatEtc(fe, cf, med) \ 105 {\ 106 (fe).cfFormat=cf;\ 107 (fe).dwAspect=DVASPECT_CONTENT;\ 108 (fe).ptd=NULL;\ 109 (fe).tymed=med;\ 110 (fe).lindex=-1;\ 111 }; 112 113 #define KeyStateToDropEffect(kst)\ 114 ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\ 115 (((kst)&(MK_CONTROL)) ? DROPEFFECT_COPY :\ 116 (((kst)&(MK_SHIFT)) ? DROPEFFECT_MOVE :\ 117 DROPEFFECT_NONE))) 118 119 120 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN; 121 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN; 122 HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN; 123 HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN; 124 125 /* Change Notification */ 126 void InitChangeNotifications(void) DECLSPEC_HIDDEN; 127 void FreeChangeNotifications(void) DECLSPEC_HIDDEN; 128 129 /* file operation */ 130 #define ASK_DELETE_FILE 1 131 #define ASK_DELETE_FOLDER 2 132 #define ASK_DELETE_MULTIPLE_ITEM 3 133 #define ASK_CREATE_FOLDER 4 134 #define ASK_OVERWRITE_FILE 5 135 #define ASK_DELETE_SELECTED 6 136 #define ASK_TRASH_FILE 7 137 #define ASK_TRASH_FOLDER 8 138 #define ASK_TRASH_MULTIPLE_ITEM 9 139 #define ASK_CANT_TRASH_ITEM 10 140 #define ASK_OVERWRITE_FOLDER 11 141 142 BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pwszDir, BOOL bShowUI); 143 BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir); 144 145 BOOL WINAPI _InsertMenuItemW (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 146 UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState); 147 148 static __inline BOOL SHELL_OsIsUnicode(void) 149 { 150 /* if high-bit of version is 0, we are emulating NT */ 151 return !(GetVersion() & 0x80000000); 152 } 153 154 #define __SHFreeAndNil(ptr) \ 155 {\ 156 SHFree(*ptr); \ 157 *ptr = NULL; \ 158 }; 159 static __inline void __SHCloneStrA(char **target, const char *source) 160 { 161 *target = (char *)SHAlloc(strlen(source) + 1); 162 strcpy(*target, source); 163 } 164 165 static __inline void __SHCloneStrWtoA(char **target, const WCHAR *source) 166 { 167 int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL); 168 *target = (char *)SHAlloc(len); 169 WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL); 170 } 171 172 static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source) 173 { 174 *target = (WCHAR *)SHAlloc((lstrlenW(source) + 1) * sizeof(WCHAR) ); 175 lstrcpyW(*target, source); 176 } 177 178 static __inline LPWSTR __SHCloneStrAtoW(WCHAR **target, const char *source) 179 { 180 int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0); 181 *target = (WCHAR *)SHAlloc(len * sizeof(WCHAR)); 182 MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len); 183 return *target; 184 } 185 186 /* handle conversions */ 187 #define HICON_16(h32) (LOWORD(h32)) 188 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16)) 189 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) 190 #define HINSTANCE_16(h32) (LOWORD(h32)) 191 192 extern WCHAR swShell32Name[MAX_PATH] DECLSPEC_HIDDEN; 193 194 BOOL UNIXFS_is_rooted_at_desktop(void) DECLSPEC_HIDDEN; 195 extern const GUID CLSID_UnixFolder DECLSPEC_HIDDEN; 196 extern const GUID CLSID_UnixDosFolder DECLSPEC_HIDDEN; 197 198 /* Default shell folder value registration */ 199 HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN; 200 201 /* Detect Shell Links */ 202 BOOL SHELL_IsShortcut(LPCITEMIDLIST) DECLSPEC_HIDDEN; 203 204 HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle); 205 HPROPSHEETPAGE SH_CreatePropertySheetPageEx(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, 206 LPCWSTR pwszTitle, LPFNPSPCALLBACK Callback); 207 LPWSTR SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf); 208 209 HRESULT WINAPI DoRegisterServer(void); 210 HRESULT WINAPI DoUnregisterServer(void); 211 212 #ifdef __cplusplus 213 } /* extern "C" */ 214 #endif 215 216 #endif /* __WINE_SHELL_MAIN_H */ 217