Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b2ebab9f
Commit
b2ebab9f
authored
Oct 23, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mountmgr: Allow to specify the drive letter explicitly when creating/removing a drive.
parent
5f2d2c7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
18 deletions
+39
-18
device.c
dlls/mountmgr.sys/device.c
+32
-12
diskarb.c
dlls/mountmgr.sys/diskarb.c
+2
-2
hal.c
dlls/mountmgr.sys/hal.c
+2
-2
mountmgr.h
dlls/mountmgr.sys/mountmgr.h
+3
-2
No files found.
dlls/mountmgr.sys/device.c
View file @
b2ebab9f
...
...
@@ -464,16 +464,30 @@ static void create_drive_devices(void)
RtlFreeHeap
(
GetProcessHeap
(),
0
,
path
);
}
BOOL
add_dos_device
(
const
char
*
udi
,
const
char
*
device
,
const
char
*
mount_point
,
DWORD
type
)
/* create a new dos drive */
NTSTATUS
add_dos_device
(
int
letter
,
const
char
*
udi
,
const
char
*
device
,
const
char
*
mount_point
,
DWORD
type
)
{
struct
dos_drive
*
drive
,
*
next
;
int
letter
=
add_drive
(
device
,
type
);
if
(
letter
==
-
1
)
return
FALSE
;
if
(
letter
==
-
1
)
/* auto-assign a letter */
{
letter
=
add_drive
(
device
,
type
);
if
(
letter
==
-
1
)
return
STATUS_OBJECT_NAME_COLLISION
;
}
else
/* simply reset the device symlink */
{
char
*
path
,
*
p
;
if
(
!
(
path
=
get_dosdevices_path
(
&
p
)))
return
STATUS_NO_MEMORY
;
*
p
=
'a'
+
letter
;
unlink
(
path
);
if
(
device
)
symlink
(
device
,
path
);
}
LIST_FOR_EACH_ENTRY_SAFE
(
drive
,
next
,
&
drives_list
,
struct
dos_drive
,
entry
)
{
if
(
drive
->
udi
&&
!
strcmp
(
udi
,
drive
->
udi
))
if
(
udi
&&
drive
->
udi
&&
!
strcmp
(
udi
,
drive
->
udi
))
{
if
(
type
==
drive
->
type
)
goto
found
;
delete_disk_device
(
drive
);
...
...
@@ -482,7 +496,7 @@ BOOL add_dos_device( const char *udi, const char *device, const char *mount_poin
if
(
drive
->
drive
==
letter
)
delete_disk_device
(
drive
);
}
if
(
create_disk_device
(
udi
,
type
,
&
drive
))
return
FALSE
;
if
(
create_disk_device
(
udi
,
type
,
&
drive
))
return
STATUS_NO_MEMORY
;
found:
RtlFreeHeap
(
GetProcessHeap
(),
0
,
drive
->
unix_device
);
...
...
@@ -513,19 +527,25 @@ found:
RegCloseKey
(
hkey
);
}
send_notify
(
drive
->
drive
,
DBT_DEVICEARRIVAL
);
if
(
udi
)
send_notify
(
drive
->
drive
,
DBT_DEVICEARRIVAL
);
}
return
TRUE
;
return
STATUS_SUCCESS
;
}
BOOL
remove_dos_device
(
const
char
*
udi
)
/* remove an existing dos drive, by letter or udi */
NTSTATUS
remove_dos_device
(
int
letter
,
const
char
*
udi
)
{
HKEY
hkey
;
struct
dos_drive
*
drive
;
LIST_FOR_EACH_ENTRY
(
drive
,
&
drives_list
,
struct
dos_drive
,
entry
)
{
if
(
!
drive
->
udi
||
strcmp
(
udi
,
drive
->
udi
))
continue
;
if
(
letter
!=
-
1
&&
drive
->
drive
!=
letter
)
continue
;
if
(
udi
)
{
if
(
!
drive
->
udi
)
continue
;
if
(
strcmp
(
udi
,
drive
->
udi
))
continue
;
}
if
(
drive
->
drive
!=
-
1
)
{
...
...
@@ -540,12 +560,12 @@ BOOL remove_dos_device( const char *udi )
RegCloseKey
(
hkey
);
}
if
(
modified
)
send_notify
(
drive
->
drive
,
DBT_DEVICEREMOVECOMPLETE
);
if
(
modified
&&
udi
)
send_notify
(
drive
->
drive
,
DBT_DEVICEREMOVECOMPLETE
);
}
delete_disk_device
(
drive
);
return
TRUE
;
return
STATUS_SUCCESS
;
}
return
FALS
E
;
return
STATUS_NO_SUCH_DEVIC
E
;
}
/* handler for ioctls on the harddisk device */
...
...
dlls/mountmgr.sys/diskarb.c
View file @
b2ebab9f
...
...
@@ -69,7 +69,7 @@ static void appeared_callback( DADiskRef disk, void *context )
TRACE
(
"got mount notification for '%s' on '%s'
\n
"
,
device
,
mount_point
);
add_dos_device
(
device
,
device
,
mount_point
,
type
);
add_dos_device
(
-
1
,
device
,
device
,
mount_point
,
type
);
done:
CFRelease
(
dict
);
}
...
...
@@ -98,7 +98,7 @@ static void disappeared_callback( DADiskRef disk, void *context )
TRACE
(
"got unmount notification for '%s'
\n
"
,
device
);
remove_dos_device
(
device
);
remove_dos_device
(
-
1
,
device
);
done:
CFRelease
(
dict
);
}
...
...
dlls/mountmgr.sys/hal.c
View file @
b2ebab9f
...
...
@@ -135,7 +135,7 @@ static void new_device( LibHalContext *ctx, const char *udi )
if
(
type
&&
!
strcmp
(
type
,
"cdrom"
))
drive_type
=
DRIVE_CDROM
;
else
drive_type
=
DRIVE_REMOVABLE
;
/* FIXME: default to removable */
add_dos_device
(
udi
,
device
,
mount_point
,
drive_type
);
add_dos_device
(
-
1
,
udi
,
device
,
mount_point
,
drive_type
);
/* add property watch for mount point */
p_libhal_device_add_property_watch
(
ctx
,
udi
,
&
error
);
...
...
@@ -155,7 +155,7 @@ static void removed_device( LibHalContext *ctx, const char *udi )
TRACE
(
"removed %s
\n
"
,
wine_dbgstr_a
(
udi
)
);
if
(
remove_dos_device
(
udi
))
if
(
!
remove_dos_device
(
-
1
,
udi
))
{
p_dbus_error_init
(
&
error
);
p_libhal_device_remove_property_watch
(
ctx
,
udi
,
&
error
);
...
...
dlls/mountmgr.sys/mountmgr.h
View file @
b2ebab9f
...
...
@@ -39,8 +39,9 @@ extern void initialize_diskarbitration(void);
/* device functions */
extern
BOOL
add_dos_device
(
const
char
*
udi
,
const
char
*
device
,
const
char
*
mount_point
,
DWORD
type
);
extern
BOOL
remove_dos_device
(
const
char
*
udi
);
extern
NTSTATUS
add_dos_device
(
int
letter
,
const
char
*
udi
,
const
char
*
device
,
const
char
*
mount_point
,
DWORD
type
);
extern
NTSTATUS
remove_dos_device
(
int
letter
,
const
char
*
udi
);
extern
NTSTATUS
WINAPI
harddisk_driver_entry
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
path
);
/* mount point functions */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment