shell32: Partially implement Mac Trash backing for the Recycle Bin.

This commit is contained in:
Ken Thomases 2012-03-14 16:49:47 -05:00 committed by Alexandre Julliard
parent f67d34f7af
commit cd454fdc2e
5 changed files with 91 additions and 5 deletions

4
configure vendored
View File

@ -666,6 +666,7 @@ COREAUDIO
SECURITYLIB
DISKARBITRATIONLIB
LDEXECFLAGS
CORESERVICESLIB
APPLICATIONSERVICESLIB
IOKITLIB
COREFOUNDATIONLIB
@ -5752,6 +5753,7 @@ for ac_header in \
CL/cl.h \
Carbon/Carbon.h \
CoreAudio/CoreAudio.h \
CoreServices/CoreServices.h \
DiskArbitration/DiskArbitration.h \
IOKit/IOKitLib.h \
IOKit/hid/IOHIDLib.h \
@ -6495,6 +6497,8 @@ fi
APPLICATIONSERVICESLIB="-framework ApplicationServices"
CORESERVICESLIB="-framework CoreServices"
case $host_os in
darwin11*)
LDEXECFLAGS="-image_base 0x7bf00000 -Wl,-macosx_version_min,10.6,-segaddr,WINE_DOS,0x00001000,-segaddr,WINE_SHAREDHEAP,0x7f000000"

View File

@ -392,6 +392,7 @@ AC_CHECK_HEADERS(\
CL/cl.h \
Carbon/Carbon.h \
CoreAudio/CoreAudio.h \
CoreServices/CoreServices.h \
DiskArbitration/DiskArbitration.h \
IOKit/IOKitLib.h \
IOKit/hid/IOHIDLib.h \
@ -714,6 +715,7 @@ case $host_os in
AC_SUBST(COREFOUNDATIONLIB,"-framework CoreFoundation")
AC_SUBST(IOKITLIB,"-framework IOKit -framework CoreFoundation")
AC_SUBST(APPLICATIONSERVICESLIB,"-framework ApplicationServices")
AC_SUBST(CORESERVICESLIB,"-framework CoreServices")
case $host_os in
darwin11*)
AC_SUBST(LDEXECFLAGS,["-image_base 0x7bf00000 -Wl,-macosx_version_min,10.6,-segaddr,WINE_DOS,0x00001000,-segaddr,WINE_SHAREDHEAP,0x7f000000"]) ;;

View File

@ -3,6 +3,7 @@ MODULE = shell32.dll
IMPORTLIB = shell32
IMPORTS = uuid shlwapi comctl32 user32 gdi32 advapi32
DELAYIMPORTS = ole32 oleaut32 shdocvw version
EXTRALIBS = @CORESERVICESLIB@
C_SRCS = \
appbar.c \

View File

@ -22,7 +22,20 @@
#include "config.h"
#ifdef HAVE_CORESERVICES_CORESERVICES_H
#define GetCurrentThread MacGetCurrentThread
#define LoadResource MacLoadResource
#include <CoreServices/CoreServices.h>
#undef GetCurrentThread
#undef LoadResource
#undef DPRINTF
#endif
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
@ -41,17 +54,78 @@
#include "winreg.h"
#include "shlwapi.h"
#include "winternl.h"
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include "wine/debug.h"
#include "shell32_main.h"
#include "xdg.h"
WINE_DEFAULT_DEBUG_CHANNEL(trash);
#ifdef HAVE_CORESERVICES_CORESERVICES_H
BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
{
char *unix_path;
OSStatus status;
FSRef ref;
FSCatalogInfo catalogInfo;
TRACE("(%s)\n", debugstr_w(wszPath));
if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE;
status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL);
HeapFree(GetProcessHeap(), 0, unix_path);
if (status == noErr)
status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalogInfo, NULL,
NULL, NULL);
if (status == noErr)
status = FSFindFolder(catalogInfo.volume, kTrashFolderType,
kCreateFolder, &ref);
return (status == noErr);
}
BOOL TRASH_TrashFile(LPCWSTR wszPath)
{
char *unix_path;
OSStatus status;
TRACE("(%s)\n", debugstr_w(wszPath));
if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE;
status = FSPathMoveObjectToTrashSync(unix_path, NULL, kFSFileOperationSkipPreflight);
HeapFree(GetProcessHeap(), 0, unix_path);
return (status == noErr);
}
HRESULT TRASH_EnumItems(LPITEMIDLIST **pidls, int *count)
{
FIXME("stub!\n");
return E_NOTIMPL;
}
HRESULT TRASH_UnpackItemID(LPCSHITEMID id, WIN32_FIND_DATAW *data)
{
FIXME("stub!\n");
return E_NOTIMPL;
}
HRESULT TRASH_RestoreItem(LPCITEMIDLIST pidl)
{
FIXME("stub!\n");
return E_NOTIMPL;
}
HRESULT TRASH_EraseItem(LPCITEMIDLIST pidl)
{
FIXME("stub!\n");
return E_NOTIMPL;
}
#else /* HAVE_CORESERVICES_CORESERVICES_H */
static CRITICAL_SECTION TRASH_Creating;
static CRITICAL_SECTION_DEBUG TRASH_Creating_Debug =
{
@ -603,3 +677,5 @@ HRESULT TRASH_EraseItem(LPCITEMIDLIST pidl)
SHFree(file_path);
return S_OK;
}
#endif /* HAVE_CORESERVICES_CORESERVICES_H */

View File

@ -61,6 +61,9 @@
/* Define to 1 if you have the <CoreAudio/CoreAudio.h> header file. */
#undef HAVE_COREAUDIO_COREAUDIO_H
/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */
#undef HAVE_CORESERVICES_CORESERVICES_H
/* Define to 1 if you have the <cups/cups.h> header file. */
#undef HAVE_CUPS_CUPS_H