Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
d3e93408
Commit
d3e93408
authored
Mar 03, 2016
by
Michael Müller
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Implement SetupQueryDrivesInDiskSpaceList.
parent
73f566ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
155 additions
and
18 deletions
+155
-18
diskspace.c
dlls/setupapi/diskspace.c
+85
-0
stubs.c
dlls/setupapi/stubs.c
+0
-18
diskspace.c
dlls/setupapi/tests/diskspace.c
+70
-0
No files found.
dlls/setupapi/diskspace.c
View file @
d3e93408
...
...
@@ -419,3 +419,88 @@ BOOL WINAPI SetupAddToDiskSpaceListA(HDSKSPC diskspace, PCSTR targetfile,
if
(
targetfileW
)
HeapFree
(
GetProcessHeap
(),
0
,
targetfileW
);
return
ret
;
}
/***********************************************************************
* SetupQueryDrivesInDiskSpaceListW (SETUPAPI.@)
*/
BOOL
WINAPI
SetupQueryDrivesInDiskSpaceListW
(
HDSKSPC
diskspace
,
PWSTR
buffer
,
DWORD
size
,
PDWORD
required_size
)
{
struct
space_list
*
list
=
diskspace
;
struct
file_entry
*
file
;
DWORD
cur_size
=
1
;
BOOL
used
[
26
];
TRACE
(
"(%p, %p, %ld, %p)
\n
"
,
diskspace
,
buffer
,
size
,
required_size
);
if
(
!
diskspace
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
memset
(
&
used
,
0
,
sizeof
(
used
));
LIST_FOR_EACH_ENTRY
(
file
,
&
list
->
files
,
struct
file_entry
,
entry
)
{
int
device
;
/* UNC paths are not yet supported by this function */
if
(
towlower
(
file
->
path
[
0
])
<
'a'
||
towlower
(
file
->
path
[
0
])
>
'z'
||
file
->
path
[
1
]
!=
':'
)
continue
;
device
=
towlower
(
file
->
path
[
0
])
-
'a'
;
if
(
used
[
device
])
continue
;
cur_size
+=
3
;
if
(
buffer
)
{
if
(
cur_size
>
size
)
{
if
(
required_size
)
*
required_size
=
cur_size
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
*
buffer
++
=
towlower
(
file
->
path
[
0
]);
*
buffer
++
=
':'
;
*
buffer
++
=
0
;
}
used
[
device
]
=
TRUE
;
}
if
(
buffer
&&
size
)
*
buffer
=
0
;
if
(
required_size
)
*
required_size
=
cur_size
;
return
TRUE
;
}
/***********************************************************************
* SetupQueryDrivesInDiskSpaceListA (SETUPAPI.@)
*/
BOOL
WINAPI
SetupQueryDrivesInDiskSpaceListA
(
HDSKSPC
diskspace
,
PSTR
buffer
,
DWORD
size
,
PDWORD
required_size
)
{
WCHAR
*
bufferW
=
NULL
;
BOOL
ret
;
int
i
;
if
(
buffer
&&
size
)
{
bufferW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
if
(
!
bufferW
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
}
ret
=
SetupQueryDrivesInDiskSpaceListW
(
diskspace
,
bufferW
?
bufferW
:
(
WCHAR
*
)
buffer
,
size
,
required_size
);
if
(
bufferW
)
{
for
(
i
=
0
;
i
<
size
;
i
++
)
buffer
[
i
]
=
bufferW
[
i
];
HeapFree
(
GetProcessHeap
(),
0
,
bufferW
);
}
return
ret
;
}
dlls/setupapi/stubs.c
View file @
d3e93408
...
...
@@ -231,24 +231,6 @@ INT WINAPI SetupPromptReboot( HSPFILEQ file_queue, HWND owner, BOOL scan_only )
}
/***********************************************************************
* SetupQueryDrivesInDiskSpaceListA (SETUPAPI.@)
*/
BOOL
WINAPI
SetupQueryDrivesInDiskSpaceListA
(
HDSKSPC
disk_space
,
PSTR
return_buffer
,
DWORD
return_buffer_size
,
PDWORD
required_size
)
{
FIXME
(
"%p, %p, %ld, %p: stub
\n
"
,
disk_space
,
return_buffer
,
return_buffer_size
,
required_size
);
return
FALSE
;
}
/***********************************************************************
* SetupQueryDrivesInDiskSpaceListW (SETUPAPI.@)
*/
BOOL
WINAPI
SetupQueryDrivesInDiskSpaceListW
(
HDSKSPC
disk_space
,
PWSTR
return_buffer
,
DWORD
return_buffer_size
,
PDWORD
required_size
)
{
FIXME
(
"%p, %p, %ld, %p: stub
\n
"
,
disk_space
,
return_buffer
,
return_buffer_size
,
required_size
);
return
FALSE
;
}
/***********************************************************************
* SetupAddToSourceListA (SETUPAPI.@)
*/
BOOL
WINAPI
SetupAddToSourceListA
(
DWORD
flags
,
PCSTR
source
)
...
...
dlls/setupapi/tests/diskspace.c
View file @
d3e93408
...
...
@@ -616,6 +616,75 @@ static void test_SetupAddToDiskSpaceListA(void)
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
}
static
void
test_SetupQueryDrivesInDiskSpaceListA
(
void
)
{
char
buffer
[
MAX_PATH
];
HDSKSPC
handle
;
DWORD
size
;
BOOL
ret
;
handle
=
SetupCreateDiskSpaceListA
(
NULL
,
0
,
SPDSL_IGNORE_DISK
);
ok
(
handle
!=
NULL
,
"Expected SetupCreateDiskSpaceListA to return a valid handle
\n
"
);
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
NULL
,
0
,
NULL
);
ok
(
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to succeed
\n
"
);
size
=
0
;
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
NULL
,
0
,
&
size
);
ok
(
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to succeed
\n
"
);
ok
(
size
==
1
,
"Expected size 1, got %lu
\n
"
,
size
);
ret
=
SetupAddToDiskSpaceListA
(
handle
,
"F:
\\
random-file.dat"
,
0
,
FILEOP_COPY
,
0
,
0
);
ok
(
ret
,
"Expected SetupAddToDiskSpaceListA to succeed
\n
"
);
ret
=
SetupAddToDiskSpaceListA
(
handle
,
"G:
\\
random-file.dat"
,
0
,
FILEOP_COPY
,
0
,
0
);
ok
(
ret
,
"Expected SetupAddToDiskSpaceListA to succeed
\n
"
);
ret
=
SetupAddToDiskSpaceListA
(
handle
,
"G:
\\
random-file2.dat"
,
0
,
FILEOP_COPY
,
0
,
0
);
ok
(
ret
,
"Expected SetupAddToDiskSpaceListA to succeed
\n
"
);
ret
=
SetupAddToDiskSpaceListA
(
handle
,
"X:
\\
random-file.dat"
,
0
,
FILEOP_COPY
,
0
,
0
);
ok
(
ret
,
"Expected SetupAddToDiskSpaceListA to succeed
\n
"
);
size
=
0
;
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
NULL
,
0
,
&
size
);
ok
(
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to succeed
\n
"
);
ok
(
size
==
10
,
"Expected size 10, got %lu
\n
"
,
size
);
size
=
0
;
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
buffer
,
0
,
&
size
);
ok
(
!
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to fail
\n
"
);
ok
(
size
==
4
,
"Expected size 4, got %lu
\n
"
,
size
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %lu
\n
"
,
GetLastError
());
size
=
0
;
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
buffer
,
4
,
&
size
);
ok
(
!
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to fail
\n
"
);
ok
(
size
==
7
,
"Expected size 7, got %lu
\n
"
,
size
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %lu
\n
"
,
GetLastError
());
size
=
0
;
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
buffer
,
7
,
&
size
);
ok
(
!
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to fail
\n
"
);
ok
(
size
==
10
,
"Expected size 10, got %lu
\n
"
,
size
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %lu
\n
"
,
GetLastError
());
size
=
0
;
memset
(
buffer
,
0xff
,
sizeof
(
buffer
));
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
buffer
,
sizeof
(
buffer
),
&
size
);
ok
(
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to succeed
\n
"
);
ok
(
size
==
10
,
"Expected size 10, got %lu
\n
"
,
size
);
ok
(
!
memcmp
(
"f:
\0
g:
\0
x:
\0\0
"
,
buffer
,
10
),
"Device list does not match
\n
"
);
memset
(
buffer
,
0xff
,
sizeof
(
buffer
));
ret
=
SetupQueryDrivesInDiskSpaceListA
(
handle
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
ret
,
"Expected SetupQueryDrivesInDiskSpaceListA to succeed
\n
"
);
ok
(
!
memcmp
(
"f:
\0
g:
\0
x:
\0\0
"
,
buffer
,
10
),
"Device list does not match
\n
"
);
}
START_TEST
(
diskspace
)
{
test_SetupCreateDiskSpaceListA
();
...
...
@@ -625,4 +694,5 @@ START_TEST(diskspace)
test_SetupQuerySpaceRequiredOnDriveA
();
test_SetupQuerySpaceRequiredOnDriveW
();
test_SetupAddToDiskSpaceListA
();
test_SetupQueryDrivesInDiskSpaceListA
();
}
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