Commit b1203af6 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

mountmgr: Create devices and registry entries for parallel ports.

parent a6cdfea1
......@@ -95,6 +95,7 @@ static struct list volumes_list = LIST_INIT(volumes_list);
static DRIVER_OBJECT *harddisk_driver;
static DRIVER_OBJECT *serial_driver;
static DRIVER_OBJECT *parallel_driver;
static CRITICAL_SECTION device_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
......@@ -998,7 +999,10 @@ static BOOL create_port_device( DRIVER_OBJECT *driver, int n, const char *unix_p
HKEY wine_ports_key, HKEY windows_ports_key )
{
static const WCHAR comW[] = {'C','O','M','%','u',0};
static const WCHAR lptW[] = {'L','P','T','%','u',0};
static const WCHAR device_serialW[] = {'\\','D','e','v','i','c','e','\\','S','e','r','i','a','l','%','u',0};
static const WCHAR device_parallelW[] = {'\\','D','e','v','i','c','e','\\','P','a','r','a','l','l','e','l','%','u',0};
static const WCHAR dosdevices_lptW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','L','P','T','%','u',0};
const WCHAR *dos_name_format, *nt_name_format, *reg_value_format;
WCHAR dos_name[7], reg_value[256], nt_buffer[32];
DWORD type, size;
......@@ -1007,10 +1011,18 @@ static BOOL create_port_device( DRIVER_OBJECT *driver, int n, const char *unix_p
DEVICE_OBJECT *dev_obj;
NTSTATUS status;
dos_name_format = comW;
nt_name_format = device_serialW;
reg_value_format = comW;
/* TODO: support parallel ports */
if (driver == serial_driver)
{
dos_name_format = comW;
nt_name_format = device_serialW;
reg_value_format = comW;
}
else
{
dos_name_format = lptW;
nt_name_format = device_parallelW;
reg_value_format = dosdevices_lptW;
}
sprintfW( dos_name, dos_name_format, n );
......@@ -1065,9 +1077,19 @@ static void create_port_devices( DRIVER_OBJECT *driver )
"",
#endif
};
static const char *parallel_search_paths[] = {
#ifdef linux
"/dev/lp%u",
#else
"",
#endif
};
static const WCHAR serialcomm_keyW[] = {'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 WCHAR parallel_ports_keyW[] = {'H','A','R','D','W','A','R','E','\\',
'D','E','V','I','C','E','M','A','P','\\',
'P','A','R','A','L','L','E','L',' ','P','O','R','T','S',0};
const char **search_paths;
const WCHAR *windows_ports_key_name;
char *dosdevices_path, *p;
......@@ -1078,13 +1100,24 @@ static void create_port_devices( DRIVER_OBJECT *driver )
if (!(dosdevices_path = get_dosdevices_path( &p )))
return;
p[0] = 'c';
p[1] = 'o';
p[2] = 'm';
search_paths = serial_search_paths;
num_search_paths = sizeof(serial_search_paths)/sizeof(serial_search_paths[0]);
windows_ports_key_name = serialcomm_keyW;
/* TODO: support parallel ports */
if (driver == serial_driver)
{
p[0] = 'c';
p[1] = 'o';
p[2] = 'm';
search_paths = serial_search_paths;
num_search_paths = sizeof(serial_search_paths)/sizeof(serial_search_paths[0]);
windows_ports_key_name = serialcomm_keyW;
}
else
{
p[0] = 'l';
p[1] = 'p';
p[2] = 't';
search_paths = parallel_search_paths;
num_search_paths = sizeof(parallel_search_paths)/sizeof(parallel_search_paths[0]);
windows_ports_key_name = parallel_ports_keyW;
}
p += 3;
RegOpenKeyExW( HKEY_LOCAL_MACHINE, ports_keyW, 0, KEY_QUERY_VALUE, &wine_ports_key );
......@@ -1136,3 +1169,14 @@ NTSTATUS WINAPI serial_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path
return STATUS_SUCCESS;
}
/* driver entry point for the parallel port driver */
NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{
parallel_driver = driver;
/* TODO: fill in driver->MajorFunction */
create_port_devices( driver );
return STATUS_SUCCESS;
}
......@@ -420,6 +420,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
static const WCHAR link_mountmgrW[] = {'\\','?','?','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0};
static const WCHAR harddiskW[] = {'\\','D','r','i','v','e','r','\\','H','a','r','d','d','i','s','k',0};
static const WCHAR driver_serialW[] = {'\\','D','r','i','v','e','r','\\','S','e','r','i','a','l',0};
static const WCHAR driver_parallelW[] = {'\\','D','r','i','v','e','r','\\','P','a','r','a','l','l','e','l',0};
static const WCHAR devicemapW[] = {'H','A','R','D','W','A','R','E','\\','D','E','V','I','C','E','M','A','P',0};
static const WCHAR parallelW[] = {'P','A','R','A','L','L','E','L',' ','P','O','R','T','S',0};
static const WCHAR serialW[] = {'S','E','R','I','A','L','C','O','M','M',0};
......@@ -467,5 +468,8 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
RtlInitUnicodeString( &nameW, driver_serialW );
IoCreateDriver( &nameW, serial_driver_entry );
RtlInitUnicodeString( &nameW, driver_parallelW );
IoCreateDriver( &nameW, parallel_driver_entry );
return status;
}
......@@ -58,6 +58,7 @@ extern NTSTATUS remove_dos_device( int letter, const char *udi ) DECLSPEC_HIDDEN
extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI serial_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
/* mount point functions */
......
......@@ -434,26 +434,6 @@ static void flush_dir_queue(void)
}
/***********************************************************************
* get_default_lpt_device
*
* Return the default device to use for parallel ports.
*/
static char *get_default_lpt_device( int num )
{
char *ret = NULL;
if (num < 1 || num > 256) return NULL;
#ifdef linux
ret = RtlAllocateHeap( GetProcessHeap(), 0, sizeof("/dev/lp256") );
if (!ret) return NULL;
sprintf( ret, "/dev/lp%d", num - 1 );
#else
FIXME( "no known default for device lpt%d\n", num );
#endif
return ret;
}
#ifdef __ANDROID__
static char *unescape_field( char *str )
......@@ -2476,7 +2456,6 @@ static NTSTATUS get_dos_device( const WCHAR *name, UINT name_len, ANSI_STRING *u
dev[2] = 0; /* remove last ':' to get the drive mount point symlink */
new_name = get_default_drive_device( unix_name );
}
else if (!strncmp( dev, "lpt", 3 )) new_name = get_default_lpt_device( atoi(dev + 3 ));
if (!new_name) break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment