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
0701b074
Commit
0701b074
authored
Mar 30, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get the drive root directories from the symlinks in dosdevices/ if
they exist. Added creation of drive symlinks in the device transition code.
parent
21e5909a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
6 deletions
+96
-6
volume.c
dlls/kernel/volume.c
+46
-3
drive.c
files/drive.c
+50
-3
No files found.
dlls/kernel/volume.c
View file @
0701b074
...
...
@@ -148,6 +148,30 @@ static char *get_dos_device_path( LPCWSTR name )
}
/* create symlinks for the DOS drives; helper for VOLUME_CreateDevices */
static
int
create_drives
(
void
)
{
WCHAR
name
[
3
],
rootW
[
MAX_PATHNAME_LEN
];
int
i
,
count
=
0
;
for
(
i
=
0
;
i
<
26
;
i
++
)
{
const
char
*
root
=
DRIVE_GetRoot
(
i
);
if
(
!
root
)
continue
;
name
[
0
]
=
'a'
+
i
;
name
[
1
]
=
':'
;
name
[
2
]
=
0
;
if
(
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
root
,
-
1
,
rootW
,
MAX_PATHNAME_LEN
)
&&
DefineDosDeviceW
(
DDD_RAW_TARGET_PATH
,
name
,
rootW
))
{
MESSAGE
(
"Created symlink %s/dosdevices/%c: -> %s
\n
"
,
wine_get_config_dir
(),
'a'
+
i
,
root
);
count
++
;
}
}
return
count
;
}
/***********************************************************************
* VOLUME_CreateDevices
*
...
...
@@ -161,7 +185,7 @@ void VOLUME_CreateDevices(void)
int
i
,
count
=
0
;
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
config_dir
)
+
sizeof
(
"/dosdevices"
)
)))
strlen
(
config_dir
)
+
sizeof
(
"/dosdevices"
)
+
3
)))
return
;
strcpy
(
buffer
,
config_dir
);
...
...
@@ -245,10 +269,29 @@ void VOLUME_CreateDevices(void)
}
NtClose
(
hkey
);
}
count
+=
create_drives
();
}
else
{
struct
stat
st
;
int
i
;
/* it is possible that the serial/parallel devices have been created but */
/* not the drives; check for at least one drive symlink to catch that case */
strcat
(
buffer
,
"/a:"
);
for
(
i
=
0
;
i
<
26
;
i
++
)
{
buffer
[
strlen
(
buffer
)
-
2
]
=
'a'
+
i
;
if
(
!
lstat
(
buffer
,
&
st
))
break
;
}
if
(
i
==
26
)
count
+=
create_drives
();
}
if
(
count
)
MESSAGE
(
"
\n
You can now remove the [SerialPorts] and [ParallelPorts] sections
\n
"
"in your configuration file, they are replaced by the above symlinks.
\n\n
"
);
}
"in your configuration file, as well as the
\"
Path=
\"
definitions in
\n
"
"the drive sections, they are replaced by the above symlinks.
\n\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
...
...
files/drive.c
View file @
0701b074
...
...
@@ -130,7 +130,7 @@ static inline UINT DRIVE_GetDriveType( INT drive, LPCWSTR value )
*/
int
DRIVE_Init
(
void
)
{
int
i
,
len
,
count
=
0
;
int
i
,
len
,
symlink_count
=
0
,
count
=
0
;
WCHAR
driveW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'D'
,
'r'
,
'i'
,
'v'
,
'e'
,
' '
,
'A'
,
0
};
...
...
@@ -144,6 +144,8 @@ int DRIVE_Init(void)
DWORD
dummy
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
char
*
root
;
const
char
*
config_dir
=
wine_get_config_dir
();
static
const
WCHAR
PathW
[]
=
{
'P'
,
'a'
,
't'
,
'h'
,
0
};
static
const
WCHAR
TypeW
[]
=
{
'T'
,
'y'
,
'p'
,
'e'
,
0
};
...
...
@@ -157,6 +159,45 @@ int DRIVE_Init(void)
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
/* get the root of the drives from symlinks */
root
=
NULL
;
for
(
i
=
0
,
drive
=
DOSDrives
;
i
<
MAX_DOS_DRIVES
;
i
++
,
drive
++
)
{
if
(
!
root
)
{
root
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
config_dir
)
+
sizeof
(
"/dosdevices/a:"
)
);
strcpy
(
root
,
config_dir
);
strcat
(
root
,
"/dosdevices/a:"
);
}
root
[
strlen
(
root
)
-
2
]
=
'a'
+
i
;
if
(
stat
(
root
,
&
drive_stat_buffer
))
{
if
(
!
lstat
(
root
,
&
drive_stat_buffer
))
MESSAGE
(
"Could not stat %s (%s), ignoring drive %c:
\n
"
,
root
,
strerror
(
errno
),
'a'
+
i
);
continue
;
}
if
(
!
S_ISDIR
(
drive_stat_buffer
.
st_mode
))
{
MESSAGE
(
"%s is not a directory, ignoring drive %c:
\n
"
,
root
,
'a'
+
i
);
continue
;
}
drive
->
root
=
root
;
drive
->
dos_cwd
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
drive
->
dos_cwd
[
0
]));
drive
->
unix_cwd
=
heap_strdup
(
""
);
drive
->
device
=
NULL
;
drive
->
flags
=
0
;
drive
->
dev
=
drive_stat_buffer
.
st_dev
;
drive
->
ino
=
drive_stat_buffer
.
st_ino
;
drive
->
type
=
DRIVE_FIXED
;
root
=
NULL
;
symlink_count
++
;
}
if
(
root
)
HeapFree
(
GetProcessHeap
(),
0
,
root
);
/* now get the parameters from the config file */
for
(
i
=
0
,
drive
=
DOSDrives
;
i
<
MAX_DOS_DRIVES
;
i
++
,
drive
++
)
{
RtlInitUnicodeString
(
&
nameW
,
driveW
);
...
...
@@ -164,6 +205,8 @@ int DRIVE_Init(void)
if
(
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
)
!=
STATUS_SUCCESS
)
continue
;
/* Get the root path */
if
(
!
symlink_count
)
{
RtlInitUnicodeString
(
&
nameW
,
PathW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
...
...
@@ -214,7 +257,12 @@ int DRIVE_Init(void)
drive
->
flags
=
0
;
drive
->
dev
=
drive_stat_buffer
.
st_dev
;
drive
->
ino
=
drive_stat_buffer
.
st_ino
;
drive
->
type
=
DRIVE_FIXED
;
}
}
if
(
drive
->
root
)
{
/* Get the drive type */
RtlInitUnicodeString
(
&
nameW
,
TypeW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
...
...
@@ -222,7 +270,6 @@ int DRIVE_Init(void)
WCHAR
*
data
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
drive
->
type
=
DRIVE_GetDriveType
(
i
,
data
);
}
else
drive
->
type
=
DRIVE_FIXED
;
/* Get the device */
RtlInitUnicodeString
(
&
nameW
,
DeviceW
);
...
...
@@ -266,7 +313,7 @@ int DRIVE_Init(void)
NtClose
(
hkey
);
}
if
(
!
count
)
if
(
!
count
&&
!
symlink_count
)
{
MESSAGE
(
"Warning: no valid DOS drive found, check your configuration file.
\n
"
);
/* Create a C drive pointing to Unix root dir */
...
...
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