mountmgr: Move the DiskArbitration support to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
95615a4afb
commit
236a1bc8f0
|
@ -827,9 +827,4 @@ void run_dbus_loop(void)
|
|||
TRACE( "Skipping, DBUS support not compiled in\n" );
|
||||
}
|
||||
|
||||
NTSTATUS dhcp_request( void *args )
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
#endif /* SONAME_LIBDBUS_1 */
|
||||
|
|
|
@ -18,8 +18,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#pragma makedep unix
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
@ -43,6 +46,8 @@
|
|||
#include "winsock2.h"
|
||||
#include "ws2ipdef.h"
|
||||
#include "dhcpcsdk.h"
|
||||
#include "unixlib.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mountmgr);
|
||||
|
@ -163,9 +168,9 @@ static void appeared_callback( DADiskRef disk, void *context )
|
|||
}
|
||||
|
||||
if (removable)
|
||||
add_dos_device( -1, device, device, mount_point, type, guid_ptr, &scsi_info );
|
||||
queue_device_op( ADD_DOS_DEVICE, device, device, mount_point, type, guid_ptr, NULL, &scsi_info );
|
||||
else
|
||||
if (guid_ptr) add_volume( device, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr, NULL, &scsi_info );
|
||||
if (guid_ptr) queue_device_op( ADD_VOLUME, device, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr, NULL, &scsi_info );
|
||||
|
||||
done:
|
||||
CFRelease( dict );
|
||||
|
@ -191,20 +196,17 @@ static void disappeared_callback( DADiskRef disk, void *context )
|
|||
|
||||
TRACE( "got unmount notification for '%s'\n", device );
|
||||
|
||||
if ((ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) && CFBooleanGetValue( ref ))
|
||||
remove_dos_device( -1, device );
|
||||
else
|
||||
remove_volume( device );
|
||||
queue_device_op( REMOVE_DEVICE, device, NULL, NULL, 0, NULL, NULL, NULL );
|
||||
|
||||
done:
|
||||
CFRelease( dict );
|
||||
}
|
||||
|
||||
static DWORD WINAPI runloop_thread( void *arg )
|
||||
void run_diskarbitration_loop(void)
|
||||
{
|
||||
DASessionRef session = DASessionCreate( NULL );
|
||||
|
||||
if (!session) return 1;
|
||||
if (!session) return;
|
||||
|
||||
DASessionScheduleWithRunLoop( session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode );
|
||||
DARegisterDiskAppearedCallback( session, kDADiskDescriptionMatchVolumeMountable,
|
||||
|
@ -216,20 +218,11 @@ static DWORD WINAPI runloop_thread( void *arg )
|
|||
CFRunLoopRun();
|
||||
DASessionUnscheduleFromRunLoop( session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode );
|
||||
CFRelease( session );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void initialize_diskarbitration(void)
|
||||
{
|
||||
HANDLE handle;
|
||||
|
||||
if (!(handle = CreateThread( NULL, 0, runloop_thread, NULL, 0, NULL ))) return;
|
||||
CloseHandle( handle );
|
||||
}
|
||||
|
||||
#else /* HAVE_DISKARBITRATION_DISKARBITRATION_H */
|
||||
|
||||
void initialize_diskarbitration(void)
|
||||
void run_diskarbitration_loop(void)
|
||||
{
|
||||
TRACE( "Skipping, Disk Arbitration support not compiled in\n" );
|
||||
}
|
||||
|
@ -291,17 +284,17 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_request_param *param, char *buf, ULONG offset,
|
||||
ULONG size )
|
||||
NTSTATUS dhcp_request( void *args )
|
||||
{
|
||||
CFStringRef service_id = find_service_id( unix_name );
|
||||
const struct dhcp_request_params *params = args;
|
||||
CFStringRef service_id = find_service_id( params->unix_name );
|
||||
CFDictionaryRef dict;
|
||||
CFDataRef value;
|
||||
DWORD ret = 0;
|
||||
CFIndex len;
|
||||
|
||||
param->offset = 0;
|
||||
param->size = 0;
|
||||
params->req->offset = 0;
|
||||
params->req->size = 0;
|
||||
|
||||
if (!service_id) return 0;
|
||||
if (!(dict = SCDynamicStoreCopyDHCPInfo( NULL, service_id )))
|
||||
|
@ -310,25 +303,25 @@ ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_reques
|
|||
return 0;
|
||||
}
|
||||
CFRelease( service_id );
|
||||
if (!(value = DHCPInfoGetOptionData( dict, map_option(param->id) )))
|
||||
if (!(value = DHCPInfoGetOptionData( dict, map_option(params->req->id) )))
|
||||
{
|
||||
CFRelease( dict );
|
||||
return 0;
|
||||
}
|
||||
len = CFDataGetLength( value );
|
||||
|
||||
switch (param->id)
|
||||
switch (params->req->id)
|
||||
{
|
||||
case OPTION_SUBNET_MASK:
|
||||
case OPTION_ROUTER_ADDRESS:
|
||||
case OPTION_BROADCAST_ADDRESS:
|
||||
{
|
||||
DWORD *ptr = (DWORD *)(buf + offset);
|
||||
if (len == sizeof(*ptr) && size >= sizeof(*ptr))
|
||||
DWORD *ptr = (DWORD *)(params->buffer + params->offset);
|
||||
if (len == sizeof(*ptr) && params->size >= sizeof(*ptr))
|
||||
{
|
||||
CFDataGetBytes( value, CFRangeMake(0, len), (UInt8 *)ptr );
|
||||
param->offset = offset;
|
||||
param->size = sizeof(*ptr);
|
||||
params->req->offset = params->offset;
|
||||
params->req->size = sizeof(*ptr);
|
||||
TRACE( "returning %08x\n", *ptr );
|
||||
}
|
||||
ret = sizeof(*ptr);
|
||||
|
@ -338,33 +331,32 @@ ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_reques
|
|||
case OPTION_DOMAIN_NAME:
|
||||
case OPTION_MSFT_IE_PROXY:
|
||||
{
|
||||
char *ptr = buf + offset;
|
||||
if (size >= len)
|
||||
char *ptr = params->buffer + params->offset;
|
||||
if (params->size >= len)
|
||||
{
|
||||
CFDataGetBytes( value, CFRangeMake(0, len), (UInt8 *)ptr );
|
||||
param->offset = offset;
|
||||
param->size = len;
|
||||
params->req->offset = params->offset;
|
||||
params->req->size = len;
|
||||
TRACE( "returning %s\n", debugstr_an(ptr, len) );
|
||||
}
|
||||
ret = len;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FIXME( "option %u not supported\n", param->id );
|
||||
FIXME( "option %u not supported\n", params->req->id );
|
||||
break;
|
||||
}
|
||||
|
||||
CFRelease( dict );
|
||||
return ret;
|
||||
*params->ret_size = ret;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#elif !defined(SONAME_LIBDBUS_1)
|
||||
|
||||
ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_request_param *param, char *buf, ULONG offset,
|
||||
ULONG size )
|
||||
NTSTATUS dhcp_request( void *args )
|
||||
{
|
||||
FIXME( "support not compiled in\n" );
|
||||
return 0;
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -408,15 +408,11 @@ static void WINAPI query_dhcp_request_params( TP_CALLBACK_INSTANCE *instance, vo
|
|||
offset = FIELD_OFFSET(struct mountmgr_dhcp_request_params, params[query->count]);
|
||||
for (i = 0; i < query->count; i++)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
offset += get_dhcp_request_param( query->unix_name, &query->params[i], (char *)query, offset, outsize - offset );
|
||||
#else
|
||||
ULONG ret_size;
|
||||
struct dhcp_request_params params = { query->unix_name, &query->params[i],
|
||||
(char *)query, offset, outsize - offset, &ret_size };
|
||||
MOUNTMGR_CALL( dhcp_request, ¶ms );
|
||||
offset += ret_size;
|
||||
#endif
|
||||
if (offset > outsize)
|
||||
{
|
||||
if (offset >= sizeof(query->size)) query->size = offset;
|
||||
|
@ -685,8 +681,6 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
|
|||
params.op_apc = device_op;
|
||||
CloseHandle( CreateThread( NULL, 0, run_loop_thread, ¶ms, 0, NULL ));
|
||||
|
||||
initialize_diskarbitration();
|
||||
|
||||
#ifdef _WIN64
|
||||
/* create a symlink so that the Wine port overrides key can be edited with 32-bit reg or regedit */
|
||||
RegCreateKeyExW( HKEY_LOCAL_MACHINE, wow64_ports_keyW, 0, NULL, REG_OPTION_CREATE_LINK,
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
#define WINE_MOUNTMGR_EXTENSIONS
|
||||
#include "ddk/mountmgr.h"
|
||||
|
||||
extern void initialize_diskarbitration(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern WCHAR *strdupW( const WCHAR * ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* device functions */
|
||||
|
@ -114,8 +112,4 @@ extern struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICOD
|
|||
extern void delete_mount_point( struct mount_point *mount ) DECLSPEC_HIDDEN;
|
||||
extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len ) DECLSPEC_HIDDEN;
|
||||
|
||||
#ifdef __APPLE__
|
||||
extern ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_request_param *param,
|
||||
char *buf, ULONG offset, ULONG size ) DECLSPEC_HIDDEN;
|
||||
#endif
|
||||
#endif /* __WINE_MOUNTMGR_H */
|
||||
|
|
|
@ -128,6 +128,7 @@ static NTSTATUS run_loop( void *args )
|
|||
const struct run_loop_params *params = args;
|
||||
|
||||
run_loop_params = *params;
|
||||
run_diskarbitration_loop();
|
||||
run_dbus_loop();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ extern void queue_device_op( enum device_op op, const char *udi, const char *dev
|
|||
const char *mount_point, enum device_type type, const GUID *guid,
|
||||
const char *disk_serial, const struct scsi_info *info ) DECLSPEC_HIDDEN;
|
||||
extern void run_dbus_loop(void) DECLSPEC_HIDDEN;
|
||||
extern void run_diskarbitration_loop(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern NTSTATUS dhcp_request( void *args ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS query_symbol_file( void *buff, ULONG insize, ULONG outsize, ULONG *info ) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue