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
4d7f510b
Commit
4d7f510b
authored
Jul 28, 2012
by
Alexandre Goujon
Committed by
Alexandre Julliard
Jul 30, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Reimplement GetLogicalDrives using Nt{Open, Query}DirectoryObject.
parent
7ef5661d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
volume.c
dlls/kernel32/volume.c
+26
-18
No files found.
dlls/kernel32/volume.c
View file @
4d7f510b
...
...
@@ -1435,28 +1435,36 @@ DWORD WINAPI QueryDosDeviceA( LPCSTR devname, LPSTR target, DWORD bufsize )
*/
DWORD
WINAPI
GetLogicalDrives
(
void
)
{
const
char
*
config_dir
=
wine_get_config_dir
();
struct
stat
st
;
char
*
buffer
,
*
dev
;
DWORD
ret
=
0
;
int
i
;
static
const
WCHAR
dosdevW
[]
=
{
'\\'
,
'D'
,
'o'
,
's'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
'\\'
,
0
};
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nt_name
;
DWORD
bitmask
=
0
;
NTSTATUS
status
;
HANDLE
handle
;
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
config_dir
)
+
sizeof
(
"/dosdevices/a:"
)
)))
RtlInitUnicodeString
(
&
nt_name
,
dosdevW
);
nt_name
.
Length
-=
sizeof
(
WCHAR
);
/* without trailing slash */
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nt_name
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
status
=
NtOpenDirectoryObject
(
&
handle
,
FILE_LIST_DIRECTORY
,
&
attr
);
if
(
!
status
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
}
strcpy
(
buffer
,
config_dir
);
strcat
(
buffer
,
"/dosdevices/a:"
);
dev
=
buffer
+
strlen
(
buffer
)
-
2
;
char
data
[
1024
];
DIRECTORY_BASIC_INFORMATION
*
info
=
(
DIRECTORY_BASIC_INFORMATION
*
)
data
;
ULONG
ctx
=
0
,
len
;
for
(
i
=
0
;
i
<
26
;
i
++
)
{
*
dev
=
'a'
+
i
;
if
(
!
stat
(
buffer
,
&
st
))
ret
|=
(
1
<<
i
);
while
(
!
NtQueryDirectoryObject
(
handle
,
info
,
sizeof
(
data
),
1
,
0
,
&
ctx
,
&
len
))
if
(
info
->
ObjectName
.
Length
==
2
*
sizeof
(
WCHAR
)
&&
info
->
ObjectName
.
Buffer
[
1
]
==
':'
)
bitmask
|=
1
<<
(
info
->
ObjectName
.
Buffer
[
0
]
-
'A'
);
NtClose
(
handle
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
ret
;
return
bitmask
;
}
...
...
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