Hi, i like to know what modifikations the attached patch needs to go into git.
More things need to be done in this area. I know of: - more registry keys [1] - remove the registry keys when a serial port disappears (USB) - the links in the dosdevice directory needs to be created Patches for the items above will be created, when the current patch went into git References: 1 http://www.winehq.org/pipermail/wine-patches/2009-April/071999.html - http://www.winehq.org/pipermail/wine-devel/2009-April/074476.html -- Stefan
--- wine-git/dlls/mountmgr.sys/Makefile.in 2009-06-01 15:06:52.000000000 +0200 +++ wine-build/dlls/mountmgr.sys/Makefile.in 2009-08-31 21:47:48.000000000 +0200 @@ -13,7 +13,8 @@ device.c \ diskarb.c \ hal.c \ - mountmgr.c + mountmgr.c \ + serial.c @MAKE_DLL_RULES@ --- wine-git/dlls/mountmgr.sys/hal.c 2009-07-22 19:00:15.000000000 +0200 +++ wine-build/dlls/mountmgr.sys/hal.c 2009-08-31 20:02:02.000000000 +0200 @@ -60,6 +60,7 @@ DO_FUNC(libhal_ctx_set_device_removed); \ DO_FUNC(libhal_ctx_shutdown); \ DO_FUNC(libhal_device_get_property_bool); \ + DO_FUNC(libhal_device_get_property_int); \ DO_FUNC(libhal_device_get_property_string); \ DO_FUNC(libhal_device_add_property_watch); \ DO_FUNC(libhal_device_remove_property_watch); \ @@ -144,11 +145,15 @@ char *uuid_str = NULL; GUID guid, *guid_ptr = NULL; enum device_type drive_type; + int port; p_dbus_error_init( &error ); if (!(device = p_libhal_device_get_property_string( ctx, udi, "block.device", &error ))) - goto done; + { + p_dbus_error_free( &error ); + goto serial; + } if (!(mount_point = p_libhal_device_get_property_string( ctx, udi, "volume.mount_point", &error ))) goto done; @@ -175,6 +180,16 @@ p_libhal_device_add_property_watch( ctx, udi, &error ); } else if (guid_ptr) add_volume( udi, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr ); + goto done; + +serial: + if (!(device = p_libhal_device_get_property_string( ctx, udi, "serial.device", &error ))) + goto done; + + if ( -1 == (port = p_libhal_device_get_property_int( ctx, udi, "serial.port", &error ))) + goto done; + + add_serial_device(port, device); done: if (type) p_libhal_free_string( type ); --- wine-git/dlls/mountmgr.sys/mountmgr.h 2009-07-23 19:00:14.000000000 +0200 +++ wine-build/dlls/mountmgr.sys/mountmgr.h 2009-08-31 17:05:00.000000000 +0200 @@ -60,6 +60,8 @@ extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point ); extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ); +extern NTSTATUS add_serial_device(int, const char*); + /* mount point functions */ struct mount_point; --- /dev/null 2009-08-31 15:42:12.509074980 +0200 +++ wine-build/dlls/mountmgr.sys/serial.c 2009-08-31 22:08:12.000000000 +0200 @@ -0,0 +1,76 @@ +/* + * Handling of serial port + * + * Copyright 2009 Stefan Leichter + * + * 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 + */ + +#include "config.h" +#include "wine/port.h" + +#include <stdio.h> + +#include "mountmgr.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mountmgr); + +NTSTATUS add_serial_device(int port, const char *device) +{ + static const WCHAR format_data[] = {'C','O','M','%','d',0}; + static const WCHAR serialcom[] = {'M','a','c','h','i','n','e','\\', + 'H','A','R','D','W','A','R','E','\\', + 'D','E','V','I','C','E','M','A','P','\\', + 'S','E','R','I','A','L','C','O','M','M',0}; + static const UNICODE_STRING serialcom_str + = {sizeof(serialcom)-1, sizeof(serialcom), (WCHAR*) serialcom}; + + CHAR value[50]; + HANDLE targetKey = NULL; + NTSTATUS retval; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING valueU = {0, 0, NULL}; + WCHAR data[10]; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = (UNICODE_STRING*) &serialcom_str; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if(STATUS_SUCCESS != (retval = NtCreateKey( &targetKey, KEY_ALL_ACCESS, + &attr, 0, NULL, REG_OPTION_VOLATILE, NULL))) + { + ERR("Unable to create HARDWARE\\DEVICEMAP\\SERIALCOMM registry key\n" ); + goto cleanup; + } + sprintf(value, "\\Device\\Serial%d", port); + RtlCreateUnicodeStringFromAsciiz( &valueU, value); + sprintfW(data, format_data, port+1); + + if(STATUS_SUCCESS != (retval = NtSetValueKey( targetKey, &valueU, 0, REG_SZ, + (BYTE*)data, (1 + strlenW(data)) * sizeof(WCHAR)))) + ERR("Unable to create registry value %s/ data %s\n", + debugstr_w(valueU.Buffer), debugstr_w(data)); + +cleanup: + if(targetKey) NtClose(targetKey); + RtlFreeUnicodeString(&valueU); + return retval; +}