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
188ed272
Commit
188ed272
authored
Sep 07, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Sep 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Improve parameter validation for SetupCreateDiskSpaceListA/W.
parent
9b693dda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
0 deletions
+162
-0
diskspace.c
dlls/setupapi/diskspace.c
+8
-0
Makefile.in
dlls/setupapi/tests/Makefile.in
+1
-0
diskspace.c
dlls/setupapi/tests/diskspace.c
+153
-0
No files found.
dlls/setupapi/diskspace.c
View file @
188ed272
...
...
@@ -53,6 +53,14 @@ HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT
WCHAR
*
ptr
;
LPDISKSPACELIST
list
=
NULL
;
TRACE
(
"(%p, %u, 0x%08x)
\n
"
,
Reserved1
,
Reserved2
,
Flags
);
if
(
Reserved1
||
Reserved2
||
Flags
&
~
SPDSL_IGNORE_DISK
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
rc
=
GetLogicalDriveStringsW
(
255
,
drives
);
if
(
rc
==
0
)
...
...
dlls/setupapi/tests/Makefile.in
View file @
188ed272
...
...
@@ -7,6 +7,7 @@ IMPORTS = setupapi user32 advapi32
C_SRCS
=
\
devinst.c
\
diskspace.c
\
install.c
\
misc.c
\
parser.c
\
...
...
dlls/setupapi/tests/diskspace.c
0 → 100644
View file @
188ed272
/*
* Unit tests for disk space functions
*
* Copyright 2010 Andrew Nguyen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"
#include "winreg.h"
#include "setupapi.h"
#include "wine/test.h"
static
void
test_SetupCreateDiskSpaceListA
(
void
)
{
HDSKSPC
ret
;
ret
=
SetupCreateDiskSpaceListA
(
NULL
,
0
,
0
);
ok
(
ret
!=
NULL
,
"Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL
\n
"
);
ok
(
SetupDestroyDiskSpaceList
(
ret
),
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
ret
=
SetupCreateDiskSpaceListA
(
NULL
,
0
,
SPDSL_IGNORE_DISK
);
ok
(
ret
!=
NULL
,
"Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL
\n
"
);
ok
(
SetupDestroyDiskSpaceList
(
ret
),
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListA
(
NULL
,
0
,
~
0U
);
ok
(
ret
==
NULL
||
broken
(
ret
!=
NULL
),
/* NT4/Win9x/Win2k */
"Expected SetupCreateDiskSpaceListA to return NULL, got %p
\n
"
,
ret
);
if
(
!
ret
)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
else
ok
(
SetupDestroyDiskSpaceList
(
ret
),
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListA
(
NULL
,
0xdeadbeef
,
0
);
ok
(
ret
==
NULL
,
"Expected SetupCreateDiskSpaceListA to return NULL, got %p
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* NT4/Win9x/Win2k */
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListA
((
void
*
)
0xdeadbeef
,
0
,
0
);
ok
(
ret
==
NULL
,
"Expected SetupCreateDiskSpaceListA to return NULL, got %p
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* NT4/Win9x/Win2k */
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListA
((
void
*
)
0xdeadbeef
,
0xdeadbeef
,
0
);
ok
(
ret
==
NULL
,
"Expected SetupCreateDiskSpaceListA to return NULL, got %p
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* NT4/Win9x/Win2k */
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
}
static
void
test_SetupCreateDiskSpaceListW
(
void
)
{
HDSKSPC
ret
;
ret
=
SetupCreateDiskSpaceListW
(
NULL
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
win_skip
(
"SetupCreateDiskSpaceListW is not implemented
\n
"
);
return
;
}
ok
(
ret
!=
NULL
,
"Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL
\n
"
);
ok
(
SetupDestroyDiskSpaceList
(
ret
),
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
ret
=
SetupCreateDiskSpaceListW
(
NULL
,
0
,
SPDSL_IGNORE_DISK
);
ok
(
ret
!=
NULL
,
"Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL
\n
"
);
ok
(
SetupDestroyDiskSpaceList
(
ret
),
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListW
(
NULL
,
0
,
~
0U
);
ok
(
ret
==
NULL
||
broken
(
ret
!=
NULL
),
/* NT4/Win2k */
"Expected SetupCreateDiskSpaceListW to return NULL, got %p
\n
"
,
ret
);
if
(
!
ret
)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
else
ok
(
SetupDestroyDiskSpaceList
(
ret
),
"Expected SetupDestroyDiskSpaceList to succeed
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListW
(
NULL
,
0xdeadbeef
,
0
);
ok
(
ret
==
NULL
,
"Expected SetupCreateDiskSpaceListW to return NULL, got %p
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* NT4/Win2k */
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListW
((
void
*
)
0xdeadbeef
,
0
,
0
);
ok
(
ret
==
NULL
,
"Expected SetupCreateDiskSpaceListW to return NULL, got %p
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* NT4/Win2k */
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetupCreateDiskSpaceListW
((
void
*
)
0xdeadbeef
,
0xdeadbeef
,
0
);
ok
(
ret
==
NULL
,
"Expected SetupCreateDiskSpaceListW to return NULL, got %p
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* NT4/Win2k */
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
}
START_TEST
(
diskspace
)
{
test_SetupCreateDiskSpaceListA
();
test_SetupCreateDiskSpaceListW
();
}
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