Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
21e5909a
Commit
21e5909a
authored
Mar 30, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for DOS drives in QueryDosDevice and DefineDosDevice.
parent
455cf6c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
25 deletions
+53
-25
volume.c
dlls/kernel/volume.c
+53
-25
No files found.
dlls/kernel/volume.c
View file @
21e5909a
...
...
@@ -114,7 +114,7 @@ static char *read_symlink( const char *path )
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
0
;
}
if
(
ret
!=
size
of
(
buffer
)
)
if
(
ret
!=
size
)
{
buffer
[
ret
]
=
0
;
return
buffer
;
...
...
@@ -878,7 +878,9 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW(LPCWSTR str, LPWSTR dst, DWORD siz
*/
BOOL
WINAPI
DefineDosDeviceW
(
DWORD
flags
,
LPCWSTR
devname
,
LPCWSTR
targetpath
)
{
DWORD
dosdev
;
DWORD
len
,
dosdev
;
BOOL
ret
=
FALSE
;
char
*
path
=
NULL
,
*
target
,
*
p
;
if
(
!
(
flags
&
DDD_RAW_TARGET_PATH
))
{
...
...
@@ -888,41 +890,44 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
return
FALSE
;
}
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
targetpath
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
target
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
{
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
targetpath
,
-
1
,
target
,
len
,
NULL
,
NULL
);
for
(
p
=
target
;
*
p
;
p
++
)
if
(
*
p
==
'\\'
)
*
p
=
'/'
;
}
else
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
/* first check for a DOS device */
if
((
dosdev
=
RtlIsDosDeviceName_U
(
devname
)))
{
WCHAR
name
[
5
];
DWORD
len
;
char
*
path
,
*
target
,
*
p
;
BOOL
ret
=
FALSE
;
memcpy
(
name
,
devname
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
LOWORD
(
dosdev
)
);
name
[
LOWORD
(
dosdev
)
/
sizeof
(
WCHAR
)]
=
0
;
if
(
!
(
path
=
get_dos_device_path
(
name
)))
return
FALSE
;
path
=
get_dos_device_path
(
name
);
}
else
if
(
isalphaW
(
devname
[
0
])
&&
devname
[
1
]
==
':'
&&
!
devname
[
2
])
/* drive mapping */
{
path
=
get_dos_device_path
(
devname
);
}
else
SetLastError
(
ERROR_FILE_NOT_FOUND
);
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
targetpath
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
target
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
if
(
path
)
{
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
targetpath
,
-
1
,
target
,
len
,
NULL
,
NULL
);
for
(
p
=
target
;
*
p
;
p
++
)
if
(
*
p
==
'\\'
)
*
p
=
'/'
;
TRACE
(
"creating symlink %s -> %s
\n
"
,
path
,
target
);
unlink
(
path
);
if
(
!
symlink
(
target
,
path
))
ret
=
TRUE
;
else
FILE_SetDosError
();
HeapFree
(
GetProcessHeap
(),
0
,
target
);
}
else
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
return
ret
;
}
/* now it must be a drive mapping */
FIXME
(
"(0x%08lx,%s,%s) drive mappings not supported yet
\n
"
,
flags
,
debugstr_w
(
devname
),
debugstr_w
(
targetpath
)
);
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
target
);
return
ret
;
}
...
...
@@ -983,13 +988,21 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
char
*
path
,
*
link
;
DWORD
dosdev
,
ret
=
0
;
if
(
!
(
dosdev
=
RtlIsDosDeviceName_U
(
devname
)))
if
((
dosdev
=
RtlIsDosDeviceName_U
(
devname
)))
{
memcpy
(
name
,
devname
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
LOWORD
(
dosdev
)
);
name
[
LOWORD
(
dosdev
)
/
sizeof
(
WCHAR
)]
=
0
;
}
else
if
(
devname
[
0
]
&&
devname
[
1
]
==
':'
&&
!
devname
[
2
])
{
memcpy
(
name
,
devname
,
3
*
sizeof
(
WCHAR
)
);
}
else
{
SetLastError
(
ERROR_BAD_PATHNAME
);
return
0
;
}
memcpy
(
name
,
devname
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
LOWORD
(
dosdev
)
);
name
[
LOWORD
(
dosdev
)
/
sizeof
(
WCHAR
)]
=
0
;
if
(
!
(
path
=
get_dos_device_path
(
name
)))
return
0
;
link
=
read_symlink
(
path
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
...
...
@@ -999,7 +1012,7 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
ret
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
link
,
-
1
,
target
,
bufsize
);
HeapFree
(
GetProcessHeap
(),
0
,
link
);
}
else
/* look for
defaults */
else
if
(
dosdev
)
/* look for device
defaults */
{
if
(
!
strcmpiW
(
name
,
auxW
))
{
...
...
@@ -1101,6 +1114,21 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
p
+=
5
;
}
}
for
(
i
=
0
;
i
<
26
;
i
++
)
{
sprintf
(
dev
,
"%c:"
,
'a'
+
i
);
if
(
!
stat
(
path
,
&
st
))
{
if
(
p
+
3
>=
target
+
bufsize
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
0
;
}
*
p
++
=
'A'
+
i
;
*
p
++
=
':'
;
*
p
++
=
0
;
}
}
*
p
++
=
0
;
/* terminating null */
return
p
-
target
;
}
...
...
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