Module: wine Branch: master Commit: 9c02e01dcb1ee281fac7d50bdbc5e4fb93af4971 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9c02e01dcb1ee281fac7d50bdb...
Author: Maarten Lankhorst m.b.lankhorst@gmail.com Date: Mon Mar 3 22:58:32 2008 -0800
explorer/mountmgr.sys: Move device hotplug code over to mount manager.
---
dlls/mountmgr.sys/Makefile.in | 6 ++++ {programs/explorer => dlls/mountmgr.sys}/device.c | 8 +++--- {programs/explorer => dlls/mountmgr.sys}/diskarb.c | 10 ++++---- {programs/explorer => dlls/mountmgr.sys}/hal.c | 18 +++++++------- dlls/mountmgr.sys/mountmgr.c | 4 +++ dlls/mountmgr.sys/mountmgr.h | 25 ++++++++++++++++++++ programs/explorer/Makefile.in | 5 ---- programs/explorer/desktop.c | 2 - 8 files changed, 53 insertions(+), 25 deletions(-)
diff --git a/dlls/mountmgr.sys/Makefile.in b/dlls/mountmgr.sys/Makefile.in index f73e4d4..fd36a13 100644 --- a/dlls/mountmgr.sys/Makefile.in +++ b/dlls/mountmgr.sys/Makefile.in @@ -4,9 +4,15 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = mountmgr.sys IMPORTS = advapi32 ntoskrnl.exe kernel32 ntdll +DELAYIMPORTS = user32 EXTRADLLFLAGS = -Wb,--subsystem,native +EXTRADEFS = @HALINCL@ +EXTRALIBS = @DISKARBITRATIONLIB@ -luuid
C_SRCS = \ + device.c \ + diskarb.c \ + hal.c \ mountmgr.c
@MAKE_DLL_RULES@ diff --git a/programs/explorer/device.c b/dlls/mountmgr.sys/device.c similarity index 96% rename from programs/explorer/device.c rename to dlls/mountmgr.sys/device.c index 922f4d0..0435f35 100644 --- a/programs/explorer/device.c +++ b/dlls/mountmgr.sys/device.c @@ -37,7 +37,7 @@ #include "wine/list.h" #include "wine/debug.h"
-WINE_DEFAULT_DEBUG_CHANNEL(explorer); +WINE_DEFAULT_DEBUG_CHANNEL(mountmgr);
struct dos_drive { @@ -72,8 +72,8 @@ static void send_notify( int drive, int code ) info.dbcv_reserved = 0; info.dbcv_unitmask = 1 << drive; info.dbcv_flags = DBTF_MEDIA; - SendMessageTimeoutW( HWND_BROADCAST, WM_DEVICECHANGE, code, (LPARAM)&info, - SMTO_ABORTIFHUNG, 0, &result ); + result = BroadcastSystemMessageW( BSF_FORCEIFHUNG|BSF_QUERY, NULL, + WM_DEVICECHANGE, code, (LPARAM)&info ); }
static inline int is_valid_device( struct stat *st ) @@ -213,7 +213,7 @@ found:
set_mount_point( drive, mount_point );
- WINE_TRACE( "added device %c: udi %s for %s on %s type %s\n", + TRACE( "added device %c: udi %s for %s on %s type %s\n", 'a' + drive->drive, wine_dbgstr_a(udi), wine_dbgstr_a(device), wine_dbgstr_a(mount_point), wine_dbgstr_a(type) );
diff --git a/programs/explorer/diskarb.c b/dlls/mountmgr.sys/diskarb.c similarity index 93% rename from programs/explorer/diskarb.c rename to dlls/mountmgr.sys/diskarb.c index 08a8097..d5f3d61 100644 --- a/programs/explorer/diskarb.c +++ b/dlls/mountmgr.sys/diskarb.c @@ -33,9 +33,9 @@ #include "winuser.h"
#include "wine/debug.h" -#include "explorer_private.h" +#include "mountmgr.h"
-WINE_DEFAULT_DEBUG_CHANNEL(explorer); +WINE_DEFAULT_DEBUG_CHANNEL(mountmgr);
#ifdef HAVE_DISKARBITRATION_DISKARBITRATION_H
@@ -72,7 +72,7 @@ static void appeared_callback( DADiskRef disk, void *context ) type = "cdrom"; }
- WINE_TRACE( "got mount notification for '%s' on '%s'\n", device, mount_point ); + TRACE( "got mount notification for '%s' on '%s'\n", device, mount_point );
add_dos_device( device, device, mount_point, type ); done: @@ -101,7 +101,7 @@ static void disappeared_callback( DADiskRef disk, void *context ) strcpy( device, "/dev/r" ); CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
- WINE_TRACE( "got unmount notification for '%s'\n", device ); + TRACE( "got unmount notification for '%s'\n", device );
remove_dos_device( device ); done: @@ -139,7 +139,7 @@ void initialize_diskarbitration(void)
void initialize_diskarbitration(void) { - WINE_TRACE( "Skipping, Disk Arbitration support not compiled in\n" ); + TRACE( "Skipping, Disk Arbitration support not compiled in\n" ); }
#endif /* HAVE_DISKARBITRATION_DISKARBITRATION_H */ diff --git a/programs/explorer/hal.c b/dlls/mountmgr.sys/hal.c similarity index 92% rename from programs/explorer/hal.c rename to dlls/mountmgr.sys/hal.c index df31c6b..615edf0 100644 --- a/programs/explorer/hal.c +++ b/dlls/mountmgr.sys/hal.c @@ -36,9 +36,9 @@ #include "wine/library.h" #include "wine/exception.h" #include "wine/debug.h" -#include "explorer_private.h" +#include "mountmgr.h"
-WINE_DEFAULT_DEBUG_CHANNEL(explorer); +WINE_DEFAULT_DEBUG_CHANNEL(mountmgr);
#ifdef SONAME_LIBHAL
@@ -98,7 +98,7 @@ static BOOL load_functions(void) return TRUE;
failed: - WINE_WARN( "failed to load HAL support: %s\n", error ); + WARN( "failed to load HAL support: %s\n", error ); return FALSE; }
@@ -153,7 +153,7 @@ static void removed_device( LibHalContext *ctx, const char *udi ) { DBusError error;
- WINE_TRACE( "removed %s\n", wine_dbgstr_a(udi) ); + TRACE( "removed %s\n", wine_dbgstr_a(udi) );
if (remove_dos_device( udi )) { @@ -167,7 +167,7 @@ static void removed_device( LibHalContext *ctx, const char *udi ) static void property_modified (LibHalContext *ctx, const char *udi, const char *key, dbus_bool_t is_removed, dbus_bool_t is_added) { - WINE_TRACE( "udi %s key %s %s\n", wine_dbgstr_a(udi), wine_dbgstr_a(key), + TRACE( "udi %s key %s %s\n", wine_dbgstr_a(udi), wine_dbgstr_a(key), is_added ? "added" : is_removed ? "removed" : "modified" );
if (!strcmp( key, "volume.mount_point" )) new_device( ctx, udi ); @@ -187,7 +187,7 @@ static DWORD WINAPI hal_thread( void *arg ) p_dbus_error_init( &error ); if (!(dbc = p_dbus_bus_get( DBUS_BUS_SYSTEM, &error ))) { - WINE_WARN( "failed to get system dbus connection: %s\n", error.message ); + WARN( "failed to get system dbus connection: %s\n", error.message ); p_dbus_error_free( &error ); return 1; } @@ -199,7 +199,7 @@ static DWORD WINAPI hal_thread( void *arg )
if (!p_libhal_ctx_init( ctx, &error )) { - WINE_WARN( "HAL context init failed: %s\n", error.message ); + WARN( "HAL context init failed: %s\n", error.message ); p_dbus_error_free( &error ); return 1; } @@ -218,7 +218,7 @@ static DWORD WINAPI hal_thread( void *arg ) } __EXCEPT( assert_fault ) { - WINE_WARN( "dbus assertion failure, disabling HAL support\n" ); + WARN( "dbus assertion failure, disabling HAL support\n" ); return 1; } __ENDTRY; @@ -243,7 +243,7 @@ void initialize_hal(void)
void initialize_hal(void) { - WINE_TRACE( "Skipping, HAL support not compiled in\n" ); + TRACE( "Skipping, HAL support not compiled in\n" ); }
#endif /* SONAME_LIBHAL */ diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index ee819a5..73e2554 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -38,6 +38,7 @@ #include "wine/library.h" #include "wine/unicode.h" #include "wine/debug.h" +#include "mountmgr.h"
WINE_DEFAULT_DEBUG_CHANNEL(mountmgr);
@@ -493,6 +494,9 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) return status; }
+ initialize_hal(); + initialize_diskarbitration(); + RtlInitUnicodeString( &nameW, harddiskW ); status = IoCreateDriver( &nameW, harddisk_driver_entry );
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h new file mode 100644 index 0000000..1e1ce85 --- /dev/null +++ b/dlls/mountmgr.sys/mountmgr.h @@ -0,0 +1,25 @@ +/* + * Mountmanager private header + * + * Copyright 2008 Maarten Lankhorst + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +extern void initialize_hal(void); +extern void initialize_diskarbitration(void); +extern BOOL add_dos_device( const char *udi, const char *device, + const char *mount_point, const char *type ); +extern BOOL remove_dos_device( const char *udi ); diff --git a/programs/explorer/Makefile.in b/programs/explorer/Makefile.in index 9498a0f..4854eda 100644 --- a/programs/explorer/Makefile.in +++ b/programs/explorer/Makefile.in @@ -6,15 +6,10 @@ MODULE = explorer.exe APPMODE = -mwindows IMPORTS = rpcrt4 user32 gdi32 advapi32 kernel32 ntdll DELAYIMPORTS = comctl32 -EXTRADEFS = @HALINCL@ -EXTRALIBS = @DISKARBITRATIONLIB@
C_SRCS = \ desktop.c \ - device.c \ - diskarb.c \ explorer.c \ - hal.c \ systray.c
@MAKE_PROG_RULES@ diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index ddca914..40b2f8e 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -234,8 +234,6 @@ void manage_desktop( char *arg ) SystemParametersInfoA( SPI_SETDESKPATTERN, -1, NULL, FALSE ); SetDeskWallPaper( (LPSTR)-1 ); initialize_display_settings( hwnd ); - initialize_diskarbitration(); - initialize_hal(); initialize_systray(); } else