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
8ddaf6cc
Commit
8ddaf6cc
authored
Oct 13, 2006
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Oct 14, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Win64 printf format warning fixes.
parent
c044f26e
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
417 additions
and
418 deletions
+417
-418
Makefile.in
dlls/ntdll/tests/Makefile.in
+0
-1
atom.c
dlls/ntdll/tests/atom.c
+92
-92
env.c
dlls/ntdll/tests/env.c
+9
-9
error.c
dlls/ntdll/tests/error.c
+4
-4
exception.c
dlls/ntdll/tests/exception.c
+7
-7
info.c
dlls/ntdll/tests/info.c
+115
-115
large_int.c
dlls/ntdll/tests/large_int.c
+12
-12
om.c
dlls/ntdll/tests/om.c
+50
-50
path.c
dlls/ntdll/tests/path.c
+1
-1
port.c
dlls/ntdll/tests/port.c
+9
-9
reg.c
dlls/ntdll/tests/reg.c
+20
-20
rtl.c
dlls/ntdll/tests/rtl.c
+47
-47
rtlbitmap.c
dlls/ntdll/tests/rtlbitmap.c
+5
-5
rtlstr.c
dlls/ntdll/tests/rtlstr.c
+32
-32
string.c
dlls/ntdll/tests/string.c
+14
-14
No files found.
dlls/ntdll/tests/Makefile.in
View file @
8ddaf6cc
...
...
@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
TESTDLL
=
ntdll.dll
IMPORTS
=
kernel32
EXTRADEFS
=
-DWINE_NO_LONG_AS_INT
CTESTS
=
\
atom.c
\
...
...
dlls/ntdll/tests/atom.c
View file @
8ddaf6cc
...
...
@@ -98,30 +98,30 @@ static DWORD RtlAtomTestThread(LPVOID Table)
WCHAR
Name
[
64
];
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
Atom
);
ok
(
!
res
,
"Unable to find atom from another thread, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to find atom from another thread, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom2
,
&
Atom
);
ok
(
!
res
,
"Unable to lookup pinned atom in table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to lookup pinned atom in table, retval: %x
\n
"
,
res
);
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom
,
&
RefCount
,
&
PinCount
,
Name
,
&
Len
);
ok
(
res
==
STATUS_BUFFER_TOO_SMALL
,
"We got wrong retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_BUFFER_TOO_SMALL
,
"We got wrong retval: %x
\n
"
,
res
);
Len
=
64
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom
,
&
RefCount
,
&
PinCount
,
Name
,
&
Len
);
ok
(
!
res
,
"Failed with longenough buffer, retval: %
l
x
\n
"
,
res
);
ok
(
RefCount
==
1
,
"Refcount was not 1 but %
l
x
\n
"
,
RefCount
);
ok
(
PinCount
==
1
,
"Pincount was not 1 but %
l
x
\n
"
,
PinCount
);
ok
(
!
res
,
"Failed with longenough buffer, retval: %x
\n
"
,
res
);
ok
(
RefCount
==
1
,
"Refcount was not 1 but %x
\n
"
,
RefCount
);
ok
(
PinCount
==
1
,
"Pincount was not 1 but %x
\n
"
,
PinCount
);
ok
(
!
lstrcmpW
(
Name
,
testAtom2
),
"We found wrong atom!!
\n
"
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %
l
d
\n
"
,
Len
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %d
\n
"
,
Len
);
Len
=
64
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom
,
NULL
,
NULL
,
Name
,
&
Len
);
ok
(
!
res
,
"RtlQueryAtomInAtomTable with optional args invalid failed, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"RtlQueryAtomInAtomTable with optional args invalid failed, retval: %x
\n
"
,
res
);
ok
(
!
lstrcmpW
(
Name
,
testAtom2
),
"Found Wrong atom!
\n
"
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %
l
d
\n
"
,
Len
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %d
\n
"
,
Len
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
Atom
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %x
\n
"
,
res
);
return
0
;
}
...
...
@@ -143,65 +143,65 @@ static void test_NtAtom(void)
if
(
!
res
)
{
res
=
pRtlDestroyAtomTable
(
AtomTable
);
ok
(
!
res
,
"We could create the atom table, but we couldn't destroy it! retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"We could create the atom table, but we couldn't destroy it! retval: %x
\n
"
,
res
);
}
AtomTable
=
NULL
;
res
=
pRtlCreateAtomTable
(
37
,
&
AtomTable
);
ok
(
!
res
,
"We're unable to create an atom table with a valid table size retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"We're unable to create an atom table with a valid table size retval: %x
\n
"
,
res
);
if
(
!
res
)
{
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom1
,
&
Atom1
);
ok
(
!
res
,
"We were unable to add a simple atom to the atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"We were unable to add a simple atom to the atom table, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1Cap
,
&
testAtom
);
ok
(
!
res
,
"We were unable to find capital version of the atom, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"We were unable to find capital version of the atom, retval: %x
\n
"
,
res
);
ok
(
Atom1
==
testAtom
,
"Found wrong atom in table when querying capital atom
\n
"
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1Low
,
&
testAtom
);
ok
(
!
res
,
"Unable to find lowercase version of the atom, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to find lowercase version of the atom, retval: %x
\n
"
,
res
);
ok
(
testAtom
==
Atom1
,
"Found wrong atom when querying lowercase atom
\n
"
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
EmptyAtom
,
&
testEAtom
);
ok
(
res
==
STATUS_OBJECT_NAME_INVALID
,
"Got wrong retval, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_INVALID
,
"Got wrong retval, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
!
res
,
"Failed to find totally legitimate atom, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Failed to find totally legitimate atom, retval: %x
\n
"
,
res
);
ok
(
testAtom
==
Atom1
,
"Found wrong atom!
\n
"
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom2
,
&
Atom2
);
ok
(
!
res
,
"Unable to add other legitimate atom to table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add other legitimate atom to table, retval: %x
\n
"
,
res
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
Atom2
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %x
\n
"
,
res
);
testThread
=
CreateThread
(
NULL
,
0
,
(
LPTHREAD_START_ROUTINE
)
RtlAtomTestThread
,
&
AtomTable
,
0
,
NULL
);
WaitForSingleObject
(
testThread
,
INFINITE
);
Len
=
64
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom2
,
&
RefCount
,
&
PinCount
,
Name
,
&
Len
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
RefCount
==
1
,
"RefCount is not 1 but %
l
x
\n
"
,
RefCount
);
ok
(
PinCount
==
1
,
"PinCount is not 1 but %
l
x
\n
"
,
PinCount
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %x
\n
"
,
res
);
ok
(
RefCount
==
1
,
"RefCount is not 1 but %x
\n
"
,
RefCount
);
ok
(
PinCount
==
1
,
"PinCount is not 1 but %x
\n
"
,
PinCount
);
ok
(
!
lstrcmpW
(
Name
,
testAtom2
),
"We found wrong atom
\n
"
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %
l
d
\n
"
,
Len
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %d
\n
"
,
Len
);
res
=
pRtlEmptyAtomTable
(
AtomTable
,
FALSE
);
ok
(
!
res
,
"Unable to empty atom table, retval %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to empty atom table, retval %x
\n
"
,
res
);
Len
=
64
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom2
,
&
RefCount
,
&
PinCount
,
Name
,
&
Len
);
ok
(
!
res
,
"It seems RtlEmptyAtomTable deleted our pinned atom eaven though we asked it not to, retval: %
l
x
\n
"
,
res
);
ok
(
RefCount
==
1
,
"RefCount is not 1 but %
l
x
\n
"
,
RefCount
);
ok
(
PinCount
==
1
,
"PinCount is not 1 but %
l
x
\n
"
,
PinCount
);
ok
(
!
res
,
"It seems RtlEmptyAtomTable deleted our pinned atom eaven though we asked it not to, retval: %x
\n
"
,
res
);
ok
(
RefCount
==
1
,
"RefCount is not 1 but %x
\n
"
,
RefCount
);
ok
(
PinCount
==
1
,
"PinCount is not 1 but %x
\n
"
,
PinCount
);
ok
(
!
lstrcmpW
(
Name
,
testAtom2
),
"We found wrong atom
\n
"
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %
l
d
\n
"
,
Len
);
ok
((
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
))
==
Len
,
"Returned wrong length %d
\n
"
,
Len
);
Len
=
8
;
Name
[
0
]
=
Name
[
1
]
=
Name
[
2
]
=
Name
[
3
]
=
Name
[
4
]
=
0x55AA
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom2
,
NULL
,
NULL
,
Name
,
&
Len
);
ok
(
!
res
,
"query atom %
l
x
\n
"
,
res
);
ok
(
Len
==
6
,
"wrong length %
l
u
\n
"
,
Len
);
ok
(
!
res
,
"query atom %x
\n
"
,
res
);
ok
(
Len
==
6
,
"wrong length %u
\n
"
,
Len
);
ok
(
!
memcmp
(
Name
,
testAtom2
,
Len
),
"wrong atom string
\n
"
);
ok
(
!
Name
[
3
],
"wrong string termination
\n
"
);
ok
(
Name
[
4
]
==
0x55AA
,
"buffer overwrite
\n
"
);
...
...
@@ -209,74 +209,74 @@ static void test_NtAtom(void)
Len
=
lstrlenW
(
testAtom2
)
*
sizeof
(
WCHAR
);
memset
(
Name
,
'.'
,
sizeof
(
Name
));
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom2
,
NULL
,
NULL
,
Name
,
&
Len
);
ok
(
!
res
,
"query atom %
l
x
\n
"
,
res
);
ok
(
Len
==
(
lstrlenW
(
testAtom2
)
-
1
)
*
sizeof
(
WCHAR
),
"wrong length %
l
u
\n
"
,
Len
);
ok
(
!
res
,
"query atom %x
\n
"
,
res
);
ok
(
Len
==
(
lstrlenW
(
testAtom2
)
-
1
)
*
sizeof
(
WCHAR
),
"wrong length %u
\n
"
,
Len
);
ok
(
!
memcmp
(
testAtom2
,
Name
,
(
lstrlenW
(
testAtom2
)
-
1
)
*
sizeof
(
WCHAR
)),
"wrong atom name
\n
"
);
ok
(
Name
[
lstrlenW
(
testAtom2
)
-
1
]
==
'\0'
,
"wrong char
\n
"
);
ok
(
Name
[
lstrlenW
(
testAtom2
)]
==
(
'.'
<<
8
)
+
'.'
,
"wrong char
\n
"
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom2
,
&
testAtom
);
ok
(
!
res
,
"We can't find our pinned atom!! retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"We can't find our pinned atom!! retval: %x
\n
"
,
res
);
ok
(
testAtom
==
Atom2
,
"We found wrong atom!!!
\n
"
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"We found the atom in our table eaven though we asked RtlEmptyAtomTable to remove it, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"We found the atom in our table eaven though we asked RtlEmptyAtomTable to remove it, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom3
,
&
Atom3
);
ok
(
!
res
,
"Unable to add atom to table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add atom to table, retval: %x
\n
"
,
res
);
res
=
pRtlEmptyAtomTable
(
AtomTable
,
TRUE
);
ok
(
!
res
,
"Unable to empty atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to empty atom table, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom2
,
&
testAtom
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"The pinned atom should be removed, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"The pinned atom should be removed, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom3
,
&
testAtom
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"Non pinned atom should also be removed, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"Non pinned atom should also be removed, retval: %x
\n
"
,
res
);
res
=
pRtlDestroyAtomTable
(
AtomTable
);
ok
(
!
res
,
"Can't destroy atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Can't destroy atom table, retval: %x
\n
"
,
res
);
}
AtomTable
=
NULL
;
res
=
pRtlCreateAtomTable
(
37
,
&
AtomTable
);
ok
(
!
res
,
"Unable to create atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to create atom table, retval: %x
\n
"
,
res
);
if
(
!
res
)
{
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"Didn't get expected retval with querying an empty atom table, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"Didn't get expected retval with querying an empty atom table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom1
,
&
Atom1
);
ok
(
!
res
,
"Unable to add atom to atom table, retval %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add atom to atom table, retval %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
!
res
,
"Can't find previously added atom in table, retval: %
l
x
\n
"
,
res
);
ok
(
testAtom
==
Atom1
,
"Found wrong atom! retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Can't find previously added atom in table, retval: %x
\n
"
,
res
);
ok
(
testAtom
==
Atom1
,
"Found wrong atom! retval: %x
\n
"
,
res
);
res
=
pRtlDeleteAtomFromAtomTable
(
AtomTable
,
Atom1
);
ok
(
!
res
,
"Unable to delete atom from table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to delete atom from table, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"Able to find previously deleted atom in table, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"Able to find previously deleted atom in table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom1
,
&
Atom1
);
ok
(
!
res
,
"Unable to add atom to atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add atom to atom table, retval: %x
\n
"
,
res
);
Len
=
0
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom1
,
NULL
,
NULL
,
Name
,
&
Len
);
ok
(
res
==
STATUS_BUFFER_TOO_SMALL
,
"Got wrong retval, retval: %
l
x
\n
"
,
res
);
ok
((
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
))
==
Len
,
"Got wrong length %
l
x
\n
"
,
Len
);
ok
(
res
==
STATUS_BUFFER_TOO_SMALL
,
"Got wrong retval, retval: %x
\n
"
,
res
);
ok
((
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
))
==
Len
,
"Got wrong length %x
\n
"
,
Len
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
Atom1
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
!
res
,
"Unable to find atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to find atom in atom table, retval: %x
\n
"
,
res
);
ok
(
testAtom
==
Atom1
,
"Wrong atom found
\n
"
);
res
=
pRtlDeleteAtomFromAtomTable
(
AtomTable
,
Atom1
);
ok
(
res
==
STATUS_WAS_LOCKED
,
"Unable to delete atom from table, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_WAS_LOCKED
,
"Unable to delete atom from table, retval: %x
\n
"
,
res
);
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
testAtom1
,
&
testAtom
);
ok
(
!
res
,
"Able to find deleted atom in table
\n
"
);
...
...
@@ -299,82 +299,82 @@ static void test_NtIntAtom(void)
AtomTable
=
NULL
;
res
=
pRtlCreateAtomTable
(
37
,
&
AtomTable
);
ok
(
!
res
,
"Unable to create atom table, %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to create atom table, %x
\n
"
,
res
);
if
(
!
res
)
{
/* According to the kernel32 functions, integer atoms are only allowd from
* 0x0001 to 0xbfff and not 0xc000 to 0xffff, which is correct */
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
(
PWSTR
)
0
,
&
testAtom
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"Didn't get expected result from adding 0 int atom, retval: %
l
x
\n
"
,
res
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"Didn't get expected result from adding 0 int atom, retval: %x
\n
"
,
res
);
for
(
i
=
1
;
i
<=
0xbfff
;
i
++
)
{
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
(
PWSTR
)
i
,
&
testAtom
);
ok
(
!
res
,
"Unable to add valid integer atom %i, retval: %
l
x
\n
"
,
i
,
res
);
ok
(
!
res
,
"Unable to add valid integer atom %i, retval: %x
\n
"
,
i
,
res
);
}
for
(
i
=
1
;
i
<=
0xbfff
;
i
++
)
{
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
(
PWSTR
)
i
,
&
testAtom
);
ok
(
!
res
,
"Unable to find int atom %i, retval: %
l
x
\n
"
,
i
,
res
);
ok
(
!
res
,
"Unable to find int atom %i, retval: %x
\n
"
,
i
,
res
);
if
(
!
res
)
{
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
testAtom
);
ok
(
!
res
,
"Unable to pin int atom %i, retval: %
l
x
\n
"
,
i
,
res
);
ok
(
!
res
,
"Unable to pin int atom %i, retval: %x
\n
"
,
i
,
res
);
}
}
for
(
i
=
0xc000
;
i
<=
0xffff
;
i
++
)
{
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
(
PWSTR
)
i
,
&
testAtom
);
ok
(
res
,
"Able to illeageal integer atom %i, retval: %
l
x
\n
"
,
i
,
res
);
ok
(
res
,
"Able to illeageal integer atom %i, retval: %x
\n
"
,
i
,
res
);
}
res
=
pRtlDestroyAtomTable
(
AtomTable
);
ok
(
!
res
,
"Unable to destroy atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to destroy atom table, retval: %x
\n
"
,
res
);
}
AtomTable
=
NULL
;
res
=
pRtlCreateAtomTable
(
37
,
&
AtomTable
);
ok
(
!
res
,
"Unable to create atom table, %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to create atom table, %x
\n
"
,
res
);
if
(
!
res
)
{
res
=
pRtlLookupAtomInAtomTable
(
AtomTable
,
(
PWSTR
)
123
,
&
testAtom
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtomInt
,
&
testAtom
);
ok
(
!
res
,
"Unable to add int atom to table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add int atom to table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtomIntInv
,
&
testAtom
);
ok
(
!
res
,
"Unable to add int atom to table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add int atom to table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
(
PWSTR
)
123
,
&
testAtom
);
ok
(
!
res
,
"Unable to add int atom to table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add int atom to table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
(
PWSTR
)
123
,
&
testAtom
);
ok
(
!
res
,
"Unable to re-add int atom to table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to re-add int atom to table, retval: %x
\n
"
,
res
);
Len
=
64
;
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
testAtom
,
&
RefCount
,
&
PinCount
,
Name
,
&
Len
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
PinCount
==
1
,
"Expected pincount 1 but got %
l
x
\n
"
,
PinCount
);
ok
(
RefCount
==
1
,
"Expected refcount 1 but got %
l
x
\n
"
,
RefCount
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %x
\n
"
,
res
);
ok
(
PinCount
==
1
,
"Expected pincount 1 but got %x
\n
"
,
PinCount
);
ok
(
RefCount
==
1
,
"Expected refcount 1 but got %x
\n
"
,
RefCount
);
ok
(
!
lstrcmpW
(
testAtomOTT
,
Name
),
"Got wrong atom name
\n
"
);
ok
((
lstrlenW
(
testAtomOTT
)
*
sizeof
(
WCHAR
))
==
Len
,
"Got wrong len %
l
d
\n
"
,
Len
);
ok
((
lstrlenW
(
testAtomOTT
)
*
sizeof
(
WCHAR
))
==
Len
,
"Got wrong len %d
\n
"
,
Len
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
testAtom
);
ok
(
!
res
,
"Unable to pin int atom, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin int atom, retval: %x
\n
"
,
res
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
testAtom
);
ok
(
!
res
,
"Unable to pin int atom, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin int atom, retval: %x
\n
"
,
res
);
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
testAtom
,
&
RefCount
,
&
PinCount
,
NULL
,
NULL
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
PinCount
==
1
,
"Expected pincount 1 but got %
l
x
\n
"
,
PinCount
);
ok
(
RefCount
==
1
,
"Expected refcount 1 but got %
l
x
\n
"
,
RefCount
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %x
\n
"
,
res
);
ok
(
PinCount
==
1
,
"Expected pincount 1 but got %x
\n
"
,
PinCount
);
ok
(
RefCount
==
1
,
"Expected refcount 1 but got %x
\n
"
,
RefCount
);
res
=
pRtlDestroyAtomTable
(
AtomTable
);
ok
(
!
res
,
"Unable to destroy atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to destroy atom table, retval: %x
\n
"
,
res
);
}
}
...
...
@@ -388,40 +388,40 @@ static void test_NtRefPinAtom(void)
AtomTable
=
NULL
;
res
=
pRtlCreateAtomTable
(
37
,
&
AtomTable
);
ok
(
!
res
,
"Unable to create atom table, %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to create atom table, %x
\n
"
,
res
);
if
(
!
res
)
{
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom1
,
&
Atom
);
ok
(
!
res
,
"Unable to add our atom to the atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add our atom to the atom table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom1
,
&
Atom
);
ok
(
!
res
,
"Unable to add our atom to the atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add our atom to the atom table, retval: %x
\n
"
,
res
);
res
=
pRtlAddAtomToAtomTable
(
AtomTable
,
testAtom1
,
&
Atom
);
ok
(
!
res
,
"Unable to add our atom to the atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to add our atom to the atom table, retval: %x
\n
"
,
res
);
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom
,
&
RefCount
,
&
PinCount
,
NULL
,
NULL
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
PinCount
==
0
,
"Expected pincount 0 but got %
l
x
\n
"
,
PinCount
);
ok
(
RefCount
==
3
,
"Expected refcount 3 but got %
lx
\n
"
,
RefCount
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %x
\n
"
,
res
);
ok
(
PinCount
==
0
,
"Expected pincount 0 but got %x
\n
"
,
PinCount
);
ok
(
RefCount
==
3
,
"Expected refcount 3 but got %
x
\n
"
,
RefCount
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
Atom
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %x
\n
"
,
res
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
Atom
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %x
\n
"
,
res
);
res
=
pRtlPinAtomInAtomTable
(
AtomTable
,
Atom
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to pin atom in atom table, retval: %x
\n
"
,
res
);
res
=
pRtlQueryAtomInAtomTable
(
AtomTable
,
Atom
,
&
RefCount
,
&
PinCount
,
NULL
,
NULL
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %
l
x
\n
"
,
res
);
ok
(
PinCount
==
1
,
"Expected pincount 1 but got %
l
x
\n
"
,
PinCount
);
ok
(
RefCount
==
3
,
"Expected refcount 3 but got %
l
x
\n
"
,
RefCount
);
ok
(
!
res
,
"Unable to query atom in atom table, retval: %x
\n
"
,
res
);
ok
(
PinCount
==
1
,
"Expected pincount 1 but got %x
\n
"
,
PinCount
);
ok
(
RefCount
==
3
,
"Expected refcount 3 but got %x
\n
"
,
RefCount
);
res
=
pRtlDestroyAtomTable
(
AtomTable
);
ok
(
!
res
,
"Unable to destroy atom table, retval: %
l
x
\n
"
,
res
);
ok
(
!
res
,
"Unable to destroy atom table, retval: %x
\n
"
,
res
);
}
}
...
...
@@ -434,7 +434,7 @@ static void test_Global(void)
ULONG
ptr_size
=
sizeof
(
ATOM_BASIC_INFORMATION
)
+
255
*
sizeof
(
WCHAR
);
res
=
pNtAddAtom
(
testAtom1
,
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
),
&
atom
);
ok
(
!
res
,
"Added atom (%
l
x)
\n
"
,
res
);
ok
(
!
res
,
"Added atom (%x)
\n
"
,
res
);
memset
(
abi
->
Name
,
0x55
,
255
*
sizeof
(
WCHAR
));
res
=
pNtQueryInformationAtom
(
atom
,
AtomBasicInformation
,
(
void
*
)
ptr
,
ptr_size
,
NULL
);
...
...
@@ -446,13 +446,13 @@ static void test_Global(void)
ptr_size
=
sizeof
(
ATOM_BASIC_INFORMATION
);
res
=
pNtQueryInformationAtom
(
atom
,
AtomBasicInformation
,
(
void
*
)
ptr
,
ptr_size
,
NULL
);
ok
(
res
==
STATUS_BUFFER_TOO_SMALL
,
"wrong return status (%
l
x)
\n
"
,
res
);
ok
(
res
==
STATUS_BUFFER_TOO_SMALL
,
"wrong return status (%x)
\n
"
,
res
);
ok
(
abi
->
NameLength
==
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
),
"ok string length
\n
"
);
memset
(
abi
->
Name
,
0x55
,
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
));
ptr_size
=
sizeof
(
ATOM_BASIC_INFORMATION
)
+
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
);
res
=
pNtQueryInformationAtom
(
atom
,
AtomBasicInformation
,
(
void
*
)
ptr
,
ptr_size
,
NULL
);
ok
(
!
res
,
"atom lookup %
l
x
\n
"
,
res
);
ok
(
!
res
,
"atom lookup %x
\n
"
,
res
);
ok
(
!
lstrcmpW
(
abi
->
Name
,
testAtom1
),
"strings don't match
\n
"
);
ok
(
abi
->
NameLength
==
lstrlenW
(
testAtom1
)
*
sizeof
(
WCHAR
),
"wrong string length
\n
"
);
ok
(
abi
->
Name
[
lstrlenW
(
testAtom1
)]
==
0
,
"buffer overwrite %x
\n
"
,
abi
->
Name
[
lstrlenW
(
testAtom1
)]);
...
...
dlls/ntdll/tests/env.c
View file @
8ddaf6cc
...
...
@@ -99,7 +99,7 @@ static void testQuery(void)
pRtlMultiByteToUnicodeN
(
bn
,
sizeof
(
bn
),
NULL
,
test
->
var
,
strlen
(
test
->
var
)
+
1
);
nts
=
pRtlQueryEnvironmentVariable_U
(
small_env
,
&
name
,
&
value
);
ok
(
nts
==
test
->
status
,
"[%d]: Wrong status for '%s', expecting %
lx got %l
x
\n
"
,
ok
(
nts
==
test
->
status
,
"[%d]: Wrong status for '%s', expecting %
x got %
x
\n
"
,
test
-
tests
,
test
->
var
,
test
->
status
,
nts
);
if
(
nts
==
test
->
status
)
switch
(
nts
)
{
...
...
@@ -139,7 +139,7 @@ static void testSetHelper(LPWSTR* env, const char* var, const char* val, NTSTATU
pRtlMultiByteToUnicodeN
(
bval1
,
sizeof
(
bval1
),
NULL
,
val
,
strlen
(
val
)
+
1
);
}
nts
=
pRtlSetEnvironmentVariable
(
env
,
&
uvar
,
val
?
&
uval
:
NULL
);
ok
(
nts
==
ret
,
"Setting var %s=%s (%
lx/%l
x)
\n
"
,
var
,
val
,
nts
,
ret
);
ok
(
nts
==
ret
,
"Setting var %s=%s (%
x/%
x)
\n
"
,
var
,
val
,
nts
,
ret
);
if
(
nts
==
STATUS_SUCCESS
)
{
uval
.
Length
=
0
;
...
...
@@ -155,7 +155,7 @@ static void testSetHelper(LPWSTR* env, const char* var, const char* val, NTSTATU
ok
(
val
==
NULL
,
"Couldn't find variable, but didn't delete it. val = %s
\n
"
,
val
);
break
;
default:
ok
(
0
,
"Wrong ret %
l
u for %s
\n
"
,
nts
,
var
);
ok
(
0
,
"Wrong ret %u for %s
\n
"
,
nts
,
var
);
break
;
}
}
...
...
@@ -240,18 +240,18 @@ static void testExpand(void)
nts
=
pRtlExpandEnvironmentStrings_U
(
small_env
,
&
us_src
,
&
us_dst
,
&
ul
);
ok
(
ul
==
strlen
(
test
->
dst
)
*
sizeof
(
WCHAR
)
+
sizeof
(
WCHAR
),
"Wrong returned length for %s: %
l
u
\n
"
,
test
->
src
,
ul
);
"Wrong returned length for %s: %u
\n
"
,
test
->
src
,
ul
);
us_dst
.
Length
=
0
;
us_dst
.
MaximumLength
=
sizeof
(
dst
);
us_dst
.
Buffer
=
dst
;
nts
=
pRtlExpandEnvironmentStrings_U
(
small_env
,
&
us_src
,
&
us_dst
,
&
ul
);
ok
(
nts
==
STATUS_SUCCESS
,
"Call failed (%
l
u)
\n
"
,
nts
);
ok
(
nts
==
STATUS_SUCCESS
,
"Call failed (%u)
\n
"
,
nts
);
ok
(
ul
==
us_dst
.
Length
+
sizeof
(
WCHAR
),
"Wrong returned length for %s: %
l
u
\n
"
,
test
->
src
,
ul
);
"Wrong returned length for %s: %u
\n
"
,
test
->
src
,
ul
);
ok
(
ul
==
strlen
(
test
->
dst
)
*
sizeof
(
WCHAR
)
+
sizeof
(
WCHAR
),
"Wrong returned length for %s: %
l
u
\n
"
,
test
->
src
,
ul
);
"Wrong returned length for %s: %u
\n
"
,
test
->
src
,
ul
);
ok
(
lstrcmpW
(
dst
,
rst
)
==
0
,
"Wrong result for %s: expecting %s
\n
"
,
test
->
src
,
test
->
dst
);
...
...
@@ -260,9 +260,9 @@ static void testExpand(void)
us_dst
.
Buffer
=
dst
;
dst
[
8
]
=
'-'
;
nts
=
pRtlExpandEnvironmentStrings_U
(
small_env
,
&
us_src
,
&
us_dst
,
&
ul
);
ok
(
nts
==
STATUS_BUFFER_TOO_SMALL
,
"Call failed (%
l
u)
\n
"
,
nts
);
ok
(
nts
==
STATUS_BUFFER_TOO_SMALL
,
"Call failed (%u)
\n
"
,
nts
);
ok
(
ul
==
strlen
(
test
->
dst
)
*
sizeof
(
WCHAR
)
+
sizeof
(
WCHAR
),
"Wrong returned length for %s (with buffer too small): %
l
u
\n
"
,
test
->
src
,
ul
);
"Wrong returned length for %s (with buffer too small): %u
\n
"
,
test
->
src
,
ul
);
ok
(
memcmp
(
dst
,
rst
,
8
*
sizeof
(
WCHAR
))
==
0
,
"Wrong result for %s (with buffer too small): expecting %s
\n
"
,
test
->
src
,
test
->
dst
);
...
...
dlls/ntdll/tests/error.c
View file @
8ddaf6cc
...
...
@@ -71,7 +71,7 @@ static void cmp_call(NTSTATUS win_nt, ULONG win32, const char* message)
err
=
statustodoserror
(
win_nt
);
ok
(
err
==
win32
,
"%s (%
lx): got %ld, expected %l
d
\n
"
,
"%s (%
x): got %d, expected %
d
\n
"
,
message
,
win_nt
,
err
,
win32
);
}
...
...
@@ -82,7 +82,7 @@ static void cmp_call2(NTSTATUS win_nt, ULONG win32, const char* message)
err
=
statustodoserror
(
win_nt
);
ok
(
err
==
win32
||
(
!
strict
&&
err
==
ERROR_MR_MID_NOT_FOUND
),
"%s (%
lx): got %ld, expected %l
d (or MID_NOT_FOUND)
\n
"
,
"%s (%
x): got %d, expected %
d (or MID_NOT_FOUND)
\n
"
,
message
,
win_nt
,
err
,
win32
);
}
...
...
@@ -92,7 +92,7 @@ static void cmp_call3(NTSTATUS win_nt, ULONG win32_1, ULONG win32_2, const char*
err
=
statustodoserror
(
win_nt
);
ok
(
err
==
win32_1
||
(
!
strict
&&
err
==
win32_2
),
"%s (%
lx): got %ld, expected %ld or %l
d
\n
"
,
"%s (%
x): got %d, expected %d or %
d
\n
"
,
message
,
win_nt
,
err
,
win32_1
,
win32_2
);
}
...
...
@@ -103,7 +103,7 @@ static void cmp_call4(NTSTATUS win_nt, ULONG win32_1, ULONG win32_2, const char*
err
=
statustodoserror
(
win_nt
);
ok
(
err
==
win32_1
||
(
!
strict
&&
(
err
==
win32_2
||
err
==
ERROR_MR_MID_NOT_FOUND
)),
"%s (%
lx): got %ld, expected %ld or %l
d
\n
"
,
"%s (%
x): got %d, expected %d or %
d
\n
"
,
message
,
win_nt
,
err
,
win32_1
,
win32_2
);
}
...
...
dlls/ntdll/tests/exception.c
View file @
8ddaf6cc
...
...
@@ -169,20 +169,20 @@ static DWORD handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *fram
unsigned
int
i
,
entry
=
except
-
exceptions
;
got_exception
++
;
trace
(
"exception: %
lx flags:%l
x addr:%p
\n
"
,
trace
(
"exception: %
x flags:%
x addr:%p
\n
"
,
rec
->
ExceptionCode
,
rec
->
ExceptionFlags
,
rec
->
ExceptionAddress
);
ok
(
rec
->
ExceptionCode
==
except
->
status
,
"%u: Wrong exception code %
lx/%l
x
\n
"
,
entry
,
rec
->
ExceptionCode
,
except
->
status
);
"%u: Wrong exception code %
x/%
x
\n
"
,
entry
,
rec
->
ExceptionCode
,
except
->
status
);
ok
(
rec
->
ExceptionAddress
==
except
->
code
+
except
->
offset
,
"%u: Wrong exception address %p/%p
\n
"
,
entry
,
rec
->
ExceptionAddress
,
except
->
code
+
except
->
offset
);
ok
(
rec
->
NumberParameters
==
except
->
nb_params
,
"%u: Wrong number of parameters %
lu/%l
u
\n
"
,
entry
,
rec
->
NumberParameters
,
except
->
nb_params
);
"%u: Wrong number of parameters %
u/%
u
\n
"
,
entry
,
rec
->
NumberParameters
,
except
->
nb_params
);
for
(
i
=
0
;
i
<
rec
->
NumberParameters
;
i
++
)
ok
(
rec
->
ExceptionInformation
[
i
]
==
except
->
params
[
i
],
"%u: Wrong parameter %d: %lx/%
l
x
\n
"
,
"%u: Wrong parameter %d: %lx/%x
\n
"
,
entry
,
i
,
rec
->
ExceptionInformation
[
i
],
except
->
params
[
i
]
);
/* don't handle exception if it's not the address we expected */
...
...
@@ -277,9 +277,9 @@ static void test_debug_regs(void)
pNtCurrentTeb
()
->
Tib
.
ExceptionList
=
exc_frame
.
frame
.
Prev
;
ctx
.
ContextFlags
=
CONTEXT_DEBUG_REGISTERS
;
res
=
pNtGetContextThread
(
GetCurrentThread
(),
&
ctx
);
ok
(
res
==
STATUS_SUCCESS
,
"NtGetContextThread failed with %
l
x
\n
"
,
res
);
ok
(
ctx
.
Dr0
==
0x42424242
,
"failed to set debugregister 0 to 0x42424242, got %
l
x
\n
"
,
ctx
.
Dr0
);
ok
(
ctx
.
Dr7
==
0x155
,
"failed to set debugregister 7 to 0x155, got %
l
x
\n
"
,
ctx
.
Dr7
);
ok
(
res
==
STATUS_SUCCESS
,
"NtGetContextThread failed with %x
\n
"
,
res
);
ok
(
ctx
.
Dr0
==
0x42424242
,
"failed to set debugregister 0 to 0x42424242, got %x
\n
"
,
ctx
.
Dr0
);
ok
(
ctx
.
Dr7
==
0x155
,
"failed to set debugregister 7 to 0x155, got %x
\n
"
,
ctx
.
Dr7
);
}
/* test the single step exception behaviour */
...
...
dlls/ntdll/tests/info.c
View file @
8ddaf6cc
...
...
@@ -68,33 +68,33 @@ static void test_query_basic(void)
/* Use a nonexistent info class */
trace
(
"Check nonexistent info class
\n
"
);
status
=
pNtQuerySystemInformation
(
-
1
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INVALID_INFO_CLASS
,
"Expected STATUS_INVALID_INFO_CLASS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_INFO_CLASS
,
"Expected STATUS_INVALID_INFO_CLASS, got %08x
\n
"
,
status
);
/* Use an existing class but with a zero-length buffer */
trace
(
"Check zero-length buffer
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemBasicInformation
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
/* Use an existing class, correct length but no SystemInformation buffer */
trace
(
"Check no SystemInformation buffer
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemBasicInformation
,
NULL
,
sizeof
(
sbi
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %08x
\n
"
,
status
);
/* Use a existing class, correct length, a pointer to a buffer but no ReturnLength pointer */
trace
(
"Check no ReturnLength pointer
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemBasicInformation
,
&
sbi
,
sizeof
(
sbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
/* Check a too large buffer size */
trace
(
"Check a too large buffer size
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemBasicInformation
,
&
sbi
,
sizeof
(
sbi
)
*
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
/* Finally some correct calls */
trace
(
"Check with correct parameters
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemBasicInformation
,
&
sbi
,
sizeof
(
sbi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
sbi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
sbi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Check if we have some return values */
trace
(
"Number of Processors : %d
\n
"
,
sbi
.
NumberOfProcessors
);
...
...
@@ -108,12 +108,12 @@ static void test_query_cpu(void)
SYSTEM_CPU_INFORMATION
sci
;
status
=
pNtQuerySystemInformation
(
SystemCpuInformation
,
&
sci
,
sizeof
(
sci
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Check if we have some return values */
trace
(
"Processor FeatureSet : %08
l
x
\n
"
,
sci
.
FeatureSet
);
ok
(
sci
.
FeatureSet
!=
0
,
"Expected some features for this processor, got %08
l
x
\n
"
,
sci
.
FeatureSet
);
trace
(
"Processor FeatureSet : %08x
\n
"
,
sci
.
FeatureSet
);
ok
(
sci
.
FeatureSet
!=
0
,
"Expected some features for this processor, got %08x
\n
"
,
sci
.
FeatureSet
);
}
static
void
test_query_performance
(
void
)
...
...
@@ -123,15 +123,15 @@ static void test_query_performance(void)
SYSTEM_PERFORMANCE_INFORMATION
spi
;
status
=
pNtQuerySystemInformation
(
SystemPerformanceInformation
,
&
spi
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtQuerySystemInformation
(
SystemPerformanceInformation
,
&
spi
,
sizeof
(
spi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
spi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
spi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemPerformanceInformation
,
&
spi
,
sizeof
(
spi
)
+
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
spi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
spi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Not return values yet, as struct members are unknown */
}
...
...
@@ -171,46 +171,46 @@ static void test_query_timeofday(void)
trace
(
"Windows version is NT, we have to cater for differences with W2K/WinXP
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%
l
d)
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%d)
\n
"
,
ReturnLength
);
sti
.
uCurrentTimeZoneId
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
28
,
&
ReturnLength
);
ok
(
0xdeadbeef
==
sti
.
uCurrentTimeZoneId
,
"This part of the buffer should not have been filled
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
32
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
32
==
ReturnLength
,
"ReturnLength should be 0, it is (%
l
d)
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
32
==
ReturnLength
,
"ReturnLength should be 0, it is (%d)
\n
"
,
ReturnLength
);
}
else
{
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%
l
d)
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%d)
\n
"
,
ReturnLength
);
sti
.
uCurrentTimeZoneId
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
24
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
24
==
ReturnLength
,
"ReturnLength should be 24, it is (%
l
d)
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
24
==
ReturnLength
,
"ReturnLength should be 24, it is (%d)
\n
"
,
ReturnLength
);
ok
(
0xdeadbeef
==
sti
.
uCurrentTimeZoneId
,
"This part of the buffer should not have been filled
\n
"
);
sti
.
uCurrentTimeZoneId
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
32
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
32
==
ReturnLength
,
"ReturnLength should be 32, it is (%
l
d)
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
32
==
ReturnLength
,
"ReturnLength should be 32, it is (%d)
\n
"
,
ReturnLength
);
ok
(
0xdeadbeef
!=
sti
.
uCurrentTimeZoneId
,
"Buffer should have been partially filled
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
49
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%
l
d)
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%d)
\n
"
,
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
sizeof
(
sti
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
sti
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
sti
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
}
/* Check if we have some return values */
trace
(
"uCurrentTimeZoneId : (%
l
d)
\n
"
,
sti
.
uCurrentTimeZoneId
);
trace
(
"uCurrentTimeZoneId : (%d)
\n
"
,
sti
.
uCurrentTimeZoneId
);
}
static
void
test_query_process
(
void
)
...
...
@@ -256,7 +256,7 @@ static void test_query_process(void)
spi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
spi
,
SystemInformationLength
*=
2
);
}
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
/* Get the first dwOffset, from this we can deduce the OS version we're running
*
...
...
@@ -304,7 +304,7 @@ static void test_query_process(void)
{
k
++
;
ok
(
spi
->
ti
[
j
].
dwOwningPID
==
spi
->
dwProcessID
,
"The owning pid of the thread (%
ld) doesn't equal the pid (%l
d) of the process
\n
"
,
"The owning pid of the thread (%
d) doesn't equal the pid (%
d) of the process
\n
"
,
spi
->
ti
[
j
].
dwOwningPID
,
spi
->
dwProcessID
);
}
}
...
...
@@ -338,25 +338,25 @@ static void test_query_procperf(void)
sppi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
NeededLength
);
status
=
pNtQuerySystemInformation
(
SystemProcessorPerformanceInformation
,
sppi
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
/* Try it for 1 processor */
status
=
pNtQuerySystemInformation
(
SystemProcessorPerformanceInformation
,
sppi
,
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Try it for all processors */
status
=
pNtQuerySystemInformation
(
SystemProcessorPerformanceInformation
,
sppi
,
NeededLength
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
NeededLength
==
ReturnLength
,
"Inconsistent length (%
ld) <-> (%l
d)
\n
"
,
NeededLength
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
NeededLength
==
ReturnLength
,
"Inconsistent length (%
d) <-> (%
d)
\n
"
,
NeededLength
,
ReturnLength
);
/* A too large given buffer size */
sppi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
sppi
,
NeededLength
+
2
);
status
=
pNtQuerySystemInformation
(
SystemProcessorPerformanceInformation
,
sppi
,
NeededLength
+
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
NeededLength
==
ReturnLength
,
"Inconsistent length (%
ld) <-> (%l
d)
\n
"
,
NeededLength
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
NeededLength
==
ReturnLength
,
"Inconsistent length (%
d) <-> (%
d)
\n
"
,
NeededLength
,
ReturnLength
);
HeapFree
(
GetProcessHeap
(),
0
,
sppi
);
}
...
...
@@ -373,13 +373,13 @@ static void test_query_module(void)
/* Request the needed length */
status
=
pNtQuerySystemInformation
(
SystemModuleInformation
,
smi
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
ReturnLength
>
0
,
"Expected a ReturnLength to show the needed length
\n
"
);
SystemInformationLength
=
ReturnLength
;
smi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
smi
,
SystemInformationLength
);
status
=
pNtQuerySystemInformation
(
SystemModuleInformation
,
smi
,
SystemInformationLength
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ModuleCount
=
smi
->
ModulesCount
;
sm
=
&
smi
->
Modules
[
0
];
...
...
@@ -391,7 +391,7 @@ static void test_query_module(void)
/* Loop through all the modules/drivers, Wine doesn't get here (yet) */
for
(
i
=
0
;
i
<
ModuleCount
;
i
++
)
{
ok
(
i
==
sm
->
Id
,
"Id (%d) should have matched %
l
u
\n
"
,
sm
->
Id
,
i
);
ok
(
i
==
sm
->
Id
,
"Id (%d) should have matched %u
\n
"
,
sm
->
Id
,
i
);
sm
++
;
}
...
...
@@ -411,21 +411,21 @@ static void test_query_handle(void)
/* The following check assumes more than one handle on any given system */
todo_wine
{
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
}
ok
(
ReturnLength
>
0
,
"Expected ReturnLength to be > 0, it was %
l
d
\n
"
,
ReturnLength
);
ok
(
ReturnLength
>
0
,
"Expected ReturnLength to be > 0, it was %d
\n
"
,
ReturnLength
);
SystemInformationLength
=
ReturnLength
;
shi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shi
,
SystemInformationLength
);
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
/* Check if we have some return values */
trace
(
"Number of Handles : %
l
d
\n
"
,
shi
->
Count
);
trace
(
"Number of Handles : %d
\n
"
,
shi
->
Count
);
todo_wine
{
/* our implementation is a stub for now */
ok
(
shi
->
Count
>
1
,
"Expected more than 1 handles, got (%
l
d)
\n
"
,
shi
->
Count
);
ok
(
shi
->
Count
>
1
,
"Expected more than 1 handles, got (%d)
\n
"
,
shi
->
Count
);
}
HeapFree
(
GetProcessHeap
(),
0
,
shi
);
...
...
@@ -438,15 +438,15 @@ static void test_query_cache(void)
SYSTEM_CACHE_INFORMATION
sci
;
status
=
pNtQuerySystemInformation
(
SystemCacheInformation
,
&
sci
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtQuerySystemInformation
(
SystemCacheInformation
,
&
sci
,
sizeof
(
sci
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemCacheInformation
,
&
sci
,
sizeof
(
sci
)
+
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
}
static
void
test_query_interrupt
(
void
)
...
...
@@ -464,11 +464,11 @@ static void test_query_interrupt(void)
sii
=
HeapAlloc
(
GetProcessHeap
(),
0
,
NeededLength
);
status
=
pNtQuerySystemInformation
(
SystemInterruptInformation
,
sii
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
/* Try it for all processors */
status
=
pNtQuerySystemInformation
(
SystemInterruptInformation
,
sii
,
NeededLength
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
/* Windows XP and W2K3 (and others?) always return 0 for the ReturnLength
* No test added for this as it's highly unlikely that an app depends on this
...
...
@@ -484,15 +484,15 @@ static void test_query_kerndebug(void)
SYSTEM_KERNEL_DEBUGGER_INFORMATION
skdi
;
status
=
pNtQuerySystemInformation
(
SystemKernelDebuggerInformation
,
&
skdi
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtQuerySystemInformation
(
SystemKernelDebuggerInformation
,
&
skdi
,
sizeof
(
skdi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
skdi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
skdi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemKernelDebuggerInformation
,
&
skdi
,
sizeof
(
skdi
)
+
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
skdi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
skdi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
}
static
void
test_query_regquota
(
void
)
...
...
@@ -502,15 +502,15 @@ static void test_query_regquota(void)
SYSTEM_REGISTRY_QUOTA_INFORMATION
srqi
;
status
=
pNtQuerySystemInformation
(
SystemRegistryQuotaInformation
,
&
srqi
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtQuerySystemInformation
(
SystemRegistryQuotaInformation
,
&
srqi
,
sizeof
(
srqi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
srqi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
srqi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemRegistryQuotaInformation
,
&
srqi
,
sizeof
(
srqi
)
+
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
srqi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
srqi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
}
static
void
test_query_process_basic
(
void
)
...
...
@@ -536,48 +536,48 @@ static void test_query_process_basic(void)
/* Use a nonexistent info class */
trace
(
"Check nonexistent info class
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
-
1
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INVALID_INFO_CLASS
,
"Expected STATUS_INVALID_INFO_CLASS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_INFO_CLASS
,
"Expected STATUS_INVALID_INFO_CLASS, got %08x
\n
"
,
status
);
/* Do not give a handle and buffer */
trace
(
"Check NULL handle and buffer and zero-length buffersize
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
/* Use a correct info class and buffer size, but still no handle and buffer */
trace
(
"Check NULL handle and buffer
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
NULL
,
sizeof
(
pbi
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
||
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x
\n
"
,
status
);
/* Use a correct info class and buffer size, but still no handle */
trace
(
"Check NULL handle
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08x
\n
"
,
status
);
/* Use a greater buffer size */
trace
(
"Check NULL handle and too large buffersize
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
)
*
2
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
/* Use no ReturnLength */
trace
(
"Check NULL ReturnLength
\n
"
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
/* Finally some correct calls */
trace
(
"Check with correct parameters
\n
"
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
pbi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
pbi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Everything is correct except a too large buffersize */
trace
(
"Too large buffersize
\n
"
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
)
*
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
pbi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
sizeof
(
pbi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Check if we have some return values */
trace
(
"ProcessID : %
l
d
\n
"
,
pbi
.
UniqueProcessId
);
trace
(
"ProcessID : %d
\n
"
,
pbi
.
UniqueProcessId
);
ok
(
pbi
.
UniqueProcessId
>
0
,
"Expected a ProcessID > 0, got 0
\n
"
);
}
...
...
@@ -589,10 +589,10 @@ static void test_query_process_vm(void)
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessVmCounters
,
NULL
,
sizeof
(
pvi
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
||
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessVmCounters
,
&
pvi
,
sizeof
(
pvi
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08x
\n
"
,
status
);
/* Windows XP and W2K3 will report success for a size of 44 AND 48 !
Windows W2K will only report success for 44.
...
...
@@ -601,15 +601,15 @@ static void test_query_process_vm(void)
*/
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessVmCounters
,
&
pvi
,
24
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessVmCounters
,
&
pvi
,
sizeof
(
pvi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
pvi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
pvi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessVmCounters
,
&
pvi
,
46
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
pvi
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
sizeof
(
pvi
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Check if we have some return values */
trace
(
"WorkingSetSize : %ld
\n
"
,
pvi
.
WorkingSetSize
);
...
...
@@ -635,24 +635,24 @@ static void test_query_process_io(void)
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessIoCounters
,
NULL
,
sizeof
(
pii
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
||
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessIoCounters
,
&
pii
,
sizeof
(
pii
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessIoCounters
,
&
pii
,
24
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessIoCounters
,
&
pii
,
sizeof
(
pii
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
pii
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
pii
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessIoCounters
,
&
pii
,
sizeof
(
pii
)
*
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
pii
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
sizeof
(
pii
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Check if we have some return values */
trace
(
"OtherOperationCount : 0x%
lx%08l
x
\n
"
,
(
DWORD
)(
pii
.
OtherOperationCount
>>
32
),
(
DWORD
)
pii
.
OtherOperationCount
);
trace
(
"OtherOperationCount : 0x%
x%08
x
\n
"
,
(
DWORD
)(
pii
.
OtherOperationCount
>>
32
),
(
DWORD
)
pii
.
OtherOperationCount
);
todo_wine
{
ok
(
pii
.
OtherOperationCount
>
0
,
"Expected an OtherOperationCount > 0
\n
"
);
...
...
@@ -669,27 +669,27 @@ static void test_query_process_times(void)
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessTimes
,
NULL
,
sizeof
(
spti
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
||
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessTimes
,
&
spti
,
sizeof
(
spti
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessTimes
,
&
spti
,
24
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
process
=
OpenProcess
(
PROCESS_QUERY_INFORMATION
,
FALSE
,
one_before_last_pid
);
if
(
!
process
)
{
trace
(
"Could not open process with ID : %
ld, error : %08l
x. Going to use current one.
\n
"
,
one_before_last_pid
,
GetLastError
());
trace
(
"Could not open process with ID : %
d, error : %08
x. Going to use current one.
\n
"
,
one_before_last_pid
,
GetLastError
());
process
=
GetCurrentProcess
();
trace
(
"ProcessTimes for current process
\n
"
);
}
else
trace
(
"ProcessTimes for process with ID : %
l
d
\n
"
,
one_before_last_pid
);
trace
(
"ProcessTimes for process with ID : %d
\n
"
,
one_before_last_pid
);
status
=
pNtQueryInformationProcess
(
process
,
ProcessTimes
,
&
spti
,
sizeof
(
spti
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
spti
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
spti
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
CloseHandle
(
process
);
FileTimeToSystemTime
((
const
FILETIME
*
)
&
spti
.
CreateTime
,
&
UTC
);
...
...
@@ -709,8 +709,8 @@ static void test_query_process_times(void)
trace
(
"UserTime : %02d:%02d:%02d.%03d
\n
"
,
Local
.
wHour
,
Local
.
wMinute
,
Local
.
wSecond
,
Local
.
wMilliseconds
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessTimes
,
&
spti
,
sizeof
(
spti
)
*
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
spti
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
sizeof
(
spti
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
}
static
void
test_query_process_handlecount
(
void
)
...
...
@@ -722,35 +722,35 @@ static void test_query_process_handlecount(void)
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessHandleCount
,
NULL
,
sizeof
(
handlecount
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
||
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessHandleCount
,
&
handlecount
,
sizeof
(
handlecount
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessHandleCount
,
&
handlecount
,
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
process
=
OpenProcess
(
PROCESS_QUERY_INFORMATION
,
FALSE
,
one_before_last_pid
);
if
(
!
process
)
{
trace
(
"Could not open process with ID : %
ld, error : %08l
x. Going to use current one.
\n
"
,
one_before_last_pid
,
GetLastError
());
trace
(
"Could not open process with ID : %
d, error : %08
x. Going to use current one.
\n
"
,
one_before_last_pid
,
GetLastError
());
process
=
GetCurrentProcess
();
trace
(
"ProcessHandleCount for current process
\n
"
);
}
else
trace
(
"ProcessHandleCount for process with ID : %
l
d
\n
"
,
one_before_last_pid
);
trace
(
"ProcessHandleCount for process with ID : %d
\n
"
,
one_before_last_pid
);
status
=
pNtQueryInformationProcess
(
process
,
ProcessHandleCount
,
&
handlecount
,
sizeof
(
handlecount
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
handlecount
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
sizeof
(
handlecount
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
CloseHandle
(
process
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessHandleCount
,
&
handlecount
,
sizeof
(
handlecount
)
*
2
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08
l
x
\n
"
,
status
);
ok
(
sizeof
(
handlecount
)
==
ReturnLength
,
"Inconsistent length %
l
d
\n
"
,
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
sizeof
(
handlecount
)
==
ReturnLength
,
"Inconsistent length %d
\n
"
,
ReturnLength
);
/* Check if we have some return values */
trace
(
"HandleCount : %
l
d
\n
"
,
handlecount
);
trace
(
"HandleCount : %d
\n
"
,
handlecount
);
todo_wine
{
ok
(
handlecount
>
0
,
"Expected some handles, got 0
\n
"
);
...
...
@@ -771,32 +771,32 @@ static void test_readvirtualmemory(void)
/* normal operation */
status
=
pNtReadVirtualMemory
(
process
,
teststring
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
readcount
==
12
,
"Expected to read 12 bytes, got %ld
\n
"
,
readcount
);
ok
(
strcmp
(
teststring
,
buffer
)
==
0
,
"Expected read memory to be the same as original memory
\n
"
);
/* no number of bytes */
memset
(
buffer
,
0
,
12
);
status
=
pNtReadVirtualMemory
(
process
,
teststring
,
buffer
,
12
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
strcmp
(
teststring
,
buffer
)
==
0
,
"Expected read memory to be the same as original memory
\n
"
);
/* illegal remote address */
todo_wine
{
status
=
pNtReadVirtualMemory
(
process
,
(
void
*
)
0x1234
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_PARTIAL_COPY
,
"Expected STATUS_PARTIAL_COPY, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_PARTIAL_COPY
,
"Expected STATUS_PARTIAL_COPY, got %08x
\n
"
,
status
);
ok
(
readcount
==
0
,
"Expected to read 0 bytes, got %ld
\n
"
,
readcount
);
}
/* 0 handle */
status
=
pNtReadVirtualMemory
(
0
,
teststring
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08x
\n
"
,
status
);
ok
(
readcount
==
0
,
"Expected to read 0 bytes, got %ld
\n
"
,
readcount
);
/* pseudo handle for current process*/
memset
(
buffer
,
0
,
12
);
status
=
pNtReadVirtualMemory
((
HANDLE
)
-
1
,
teststring
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
readcount
==
12
,
"Expected to read 12 bytes, got %ld
\n
"
,
readcount
);
ok
(
strcmp
(
teststring
,
buffer
)
==
0
,
"Expected read memory to be the same as original memory
\n
"
);
...
...
dlls/ntdll/tests/large_int.c
View file @
8ddaf6cc
...
...
@@ -113,7 +113,7 @@ static void test_RtlExtendedMagicDivide(void)
for
(
i
=
0
;
i
<
NB_MAGIC_DIVIDE
;
i
++
)
{
result
=
pRtlExtendedMagicDivide
(
magic_divide
[
i
].
a
,
magic_divide
[
i
].
b
,
magic_divide
[
i
].
shift
);
ok
(
result
==
magic_divide
[
i
].
result
,
"call failed: RtlExtendedMagicDivide(0x%lx%08lx, 0x%lx%08lx, %d) has result 0x%lx%08lx, expected 0x%lx%08l
x
\n
"
,
"call failed: RtlExtendedMagicDivide(0x%x%08x, 0x%x%08x, %d) has result 0x%x%08x, expected 0x%x%08
x
\n
"
,
(
DWORD
)(
magic_divide
[
i
].
a
>>
32
),
(
DWORD
)
magic_divide
[
i
].
a
,
(
DWORD
)(
magic_divide
[
i
].
b
>>
32
),
(
DWORD
)
magic_divide
[
i
].
b
,
magic_divide
[
i
].
shift
,
(
DWORD
)(
result
>>
32
),
(
DWORD
)
result
,
(
DWORD
)(
magic_divide
[
i
].
result
>>
32
),
(
DWORD
)
magic_divide
[
i
].
result
);
...
...
@@ -324,26 +324,26 @@ static void one_RtlInt64ToUnicodeString_test(int test_num, const largeint2str_t
}
/* if */
}
else
{
ok
(
result
==
largeint2str
->
result
,
"(test %d): RtlInt64ToUnicodeString(0x%lx%08lx, %d, [out]) has result %lx, expected: %l
x
\n
"
,
"(test %d): RtlInt64ToUnicodeString(0x%x%08x, %d, [out]) has result %x, expected: %
x
\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
result
,
largeint2str
->
result
);
if
(
result
==
STATUS_SUCCESS
)
{
ok
(
unicode_string
.
Buffer
[
unicode_string
.
Length
/
sizeof
(
WCHAR
)]
==
'\0'
,
"(test %d): RtlInt64ToUnicodeString(0x%lx%08l
x, %d, [out]) string
\"
%s
\"
is not NULL terminated
\n
"
,
"(test %d): RtlInt64ToUnicodeString(0x%x%08
x, %d, [out]) string
\"
%s
\"
is not NULL terminated
\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
ansi_str
.
Buffer
);
}
/* if */
}
/* if */
ok
(
memcmp
(
unicode_string
.
Buffer
,
expected_unicode_string
.
Buffer
,
LARGE_STRI_BUFFER_LENGTH
*
sizeof
(
WCHAR
))
==
0
,
"(test %d): RtlInt64ToUnicodeString(0x%
lx%08l
x, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): RtlInt64ToUnicodeString(0x%
x%08
x, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
ansi_str
.
Buffer
,
expected_ansi_str
.
Buffer
);
ok
(
unicode_string
.
Length
==
expected_unicode_string
.
Length
,
"(test %d): RtlInt64ToUnicodeString(0x%
lx%08l
x, %d, [out]) string has Length %d, expected: %d
\n
"
,
"(test %d): RtlInt64ToUnicodeString(0x%
x%08
x, %d, [out]) string has Length %d, expected: %d
\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
unicode_string
.
Length
,
expected_unicode_string
.
Length
);
ok
(
unicode_string
.
MaximumLength
==
expected_unicode_string
.
MaximumLength
,
"(test %d): RtlInt64ToUnicodeString(0x%
lx%08l
x, %d, [out]) string has MaximumLength %d, expected: %d
\n
"
,
"(test %d): RtlInt64ToUnicodeString(0x%
x%08
x, %d, [out]) string has MaximumLength %d, expected: %d
\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
unicode_string
.
MaximumLength
,
expected_unicode_string
.
MaximumLength
);
pRtlFreeAnsiString
(
&
expected_ansi_str
);
...
...
@@ -376,11 +376,11 @@ static void one_RtlLargeIntegerToChar_test(int test_num, const largeint2str_t *l
result
=
pRtlLargeIntegerToChar
(
&
value
,
largeint2str
->
base
,
largeint2str
->
MaximumLength
,
dest_str
);
}
/* if */
ok
(
result
==
largeint2str
->
result
,
"(test %d): RtlLargeIntegerToChar(0x%
lx%08lx, %d, %d, [out]) has result %lx, expected: %l
x
\n
"
,
"(test %d): RtlLargeIntegerToChar(0x%
x%08x, %d, %d, [out]) has result %x, expected: %
x
\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
largeint2str
->
MaximumLength
,
result
,
largeint2str
->
result
);
ok
(
memcmp
(
dest_str
,
largeint2str
->
Buffer
,
LARGE_STRI_BUFFER_LENGTH
)
==
0
,
"(test %d): RtlLargeIntegerToChar(0x%
lx%08l
x, %d, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): RtlLargeIntegerToChar(0x%
x%08
x, %d, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
(
DWORD
)(
largeint2str
->
value
>>
32
),
(
DWORD
)
largeint2str
->
value
,
largeint2str
->
base
,
largeint2str
->
MaximumLength
,
dest_str
,
largeint2str
->
Buffer
);
}
...
...
@@ -399,25 +399,25 @@ static void test_RtlLargeIntegerToChar(void)
value
=
largeint2str
[
0
].
value
;
result
=
pRtlLargeIntegerToChar
(
&
value
,
20
,
largeint2str
[
0
].
MaximumLength
,
NULL
);
ok
(
result
==
STATUS_INVALID_PARAMETER
,
"(test a): RtlLargeIntegerToChar(0x%
lx%08lx, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test a): RtlLargeIntegerToChar(0x%
x%08x, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
(
DWORD
)(
largeint2str
[
0
].
value
>>
32
),
(
DWORD
)
largeint2str
[
0
].
value
,
20
,
largeint2str
[
0
].
MaximumLength
,
result
,
STATUS_INVALID_PARAMETER
);
result
=
pRtlLargeIntegerToChar
(
&
value
,
20
,
0
,
NULL
);
ok
(
result
==
STATUS_INVALID_PARAMETER
,
"(test b): RtlLargeIntegerToChar(0x%
lx%08lx, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test b): RtlLargeIntegerToChar(0x%
x%08x, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
(
DWORD
)(
largeint2str
[
0
].
value
>>
32
),
(
DWORD
)
largeint2str
[
0
].
value
,
20
,
largeint2str
[
0
].
MaximumLength
,
result
,
STATUS_INVALID_PARAMETER
);
result
=
pRtlLargeIntegerToChar
(
&
value
,
largeint2str
[
0
].
base
,
0
,
NULL
);
ok
(
result
==
STATUS_BUFFER_OVERFLOW
,
"(test c): RtlLargeIntegerToChar(0x%
lx%08lx, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test c): RtlLargeIntegerToChar(0x%
x%08x, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
(
DWORD
)(
largeint2str
[
0
].
value
>>
32
),
(
DWORD
)
largeint2str
[
0
].
value
,
largeint2str
[
0
].
base
,
0
,
result
,
STATUS_BUFFER_OVERFLOW
);
result
=
pRtlLargeIntegerToChar
(
&
value
,
largeint2str
[
0
].
base
,
largeint2str
[
0
].
MaximumLength
,
NULL
);
ok
(
result
==
STATUS_ACCESS_VIOLATION
,
"(test d): RtlLargeIntegerToChar(0x%
lx%08lx, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test d): RtlLargeIntegerToChar(0x%
x%08x, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
(
DWORD
)(
largeint2str
[
0
].
value
>>
32
),
(
DWORD
)
largeint2str
[
0
].
value
,
largeint2str
[
0
].
base
,
largeint2str
[
0
].
MaximumLength
,
result
,
STATUS_ACCESS_VIOLATION
);
}
...
...
dlls/ntdll/tests/om.c
View file @
8ddaf6cc
...
...
@@ -59,22 +59,22 @@ void test_case_sensitive (void)
pRtlInitUnicodeString
(
&
str
,
buffer1
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Mutant(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Mutant(%08x)
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08
l
x)
\n
"
,
status
);
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer2
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Event(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Event(%08x)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer3
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtOpenMutant
(
&
h
,
GENERIC_ALL
,
&
attr
);
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08
l
x)
\n
"
,
status
);
"NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)
\n
"
,
status
);
pNtClose
(
Mutant
);
...
...
@@ -82,16 +82,16 @@ void test_case_sensitive (void)
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08
l
x)
\n
"
,
status
);
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)
\n
"
,
status
);
attr
.
Attributes
=
0
;
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)
\n
"
,
status
);
pNtClose
(
Event
);
}
...
...
@@ -115,36 +115,36 @@ void test_namespace_pipe(void)
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateNamedPipeFile
(
&
pipe
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
1
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create NamedPipe(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create NamedPipe(%08x)
\n
"
,
status
);
status
=
pNtCreateNamedPipeFile
(
&
pipe
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
1
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_INSTANCE_NOT_AVAILABLE
,
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08
l
x)
\n
"
,
status
);
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer2
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateNamedPipeFile
(
&
pipe
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
1
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_INSTANCE_NOT_AVAILABLE
,
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08
l
x)
\n
"
,
status
);
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)
\n
"
,
status
);
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open NamedPipe(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open NamedPipe(%08x)
\n
"
,
status
);
pNtClose
(
h
);
pRtlInitUnicodeString
(
&
str
,
buffer3
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
||
status
==
STATUS_PIPE_NOT_AVAILABLE
,
"pNtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08
l
x)
\n
"
,
status
);
"pNtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer4
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
ok
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"pNtOpenFile should have failed with STATUS_OBJECT_NAME_NOT_FOUND got(%08
l
x)
\n
"
,
status
);
"pNtOpenFile should have failed with STATUS_OBJECT_NAME_NOT_FOUND got(%08x)
\n
"
,
status
);
pNtClose
(
pipe
);
}
...
...
@@ -154,10 +154,10 @@ void test_namespace_pipe(void)
#define DIR_TEST_CREATE_FAILURE(h,e) \
status = pNtCreateDirectoryObject(h, DIRECTORY_QUERY, &attr);\
ok(status == e,"NtCreateDirectoryObject should have failed with %s got(%08
l
x)\n", #e, status);
ok(status == e,"NtCreateDirectoryObject should have failed with %s got(%08x)\n", #e, status);
#define DIR_TEST_OPEN_FAILURE(h,e) \
status = pNtOpenDirectoryObject(h, DIRECTORY_QUERY, &attr);\
ok(status == e,"NtOpenDirectoryObject should have failed with %s got(%08
l
x)\n", #e, status);
ok(status == e,"NtOpenDirectoryObject should have failed with %s got(%08x)\n", #e, status);
#define DIR_TEST_CREATE_OPEN_FAILURE(h,n,e) \
pRtlCreateUnicodeStringFromAsciiz(&str, n);\
DIR_TEST_CREATE_FAILURE(h,e) DIR_TEST_OPEN_FAILURE(h,e)\
...
...
@@ -165,10 +165,10 @@ void test_namespace_pipe(void)
#define DIR_TEST_CREATE_SUCCESS(h) \
status = pNtCreateDirectoryObject(h, DIRECTORY_QUERY, &attr); \
ok(status == STATUS_SUCCESS, "Failed to create Directory(%08
l
x)\n", status);
ok(status == STATUS_SUCCESS, "Failed to create Directory(%08x)\n", status);
#define DIR_TEST_OPEN_SUCCESS(h) \
status = pNtOpenDirectoryObject(h, DIRECTORY_QUERY, &attr); \
ok(status == STATUS_SUCCESS, "Failed to open Directory(%08
l
x)\n", status);
ok(status == STATUS_SUCCESS, "Failed to open Directory(%08x)\n", status);
#define DIR_TEST_CREATE_OPEN_SUCCESS(h,n) \
pRtlCreateUnicodeStringFromAsciiz(&str, n);\
DIR_TEST_CREATE_SUCCESS(h) pNtClose(h); DIR_TEST_OPEN_SUCCESS(h) pNtClose(h); \
...
...
@@ -192,13 +192,13 @@ static void test_name_collisions(void)
pNtClose
(
h
);
status
=
pNtCreateMutant
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
??
\\
PIPE
\\
om.c-mutant"
);
status
=
pNtCreateMutant
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
||
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
...
...
@@ -208,68 +208,68 @@ static void test_name_collisions(void)
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_OPENIF
,
dir
,
NULL
);
h
=
CreateMutexA
(
NULL
,
FALSE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateMutexA failed got ret=%p (%
l
d)
\n
"
,
h
,
GetLastError
());
ok
(
h
!=
0
,
"CreateMutexA failed got ret=%p (%d)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateMutant
(
&
h1
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateMutant should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)
\n
"
,
status
);
h2
=
CreateMutexA
(
NULL
,
FALSE
,
"om.c-test"
);
winerr
=
GetLastError
();
ok
(
h2
!=
0
&&
winerr
==
ERROR_ALREADY_EXISTS
,
"CreateMutexA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%
l
d)
\n
"
,
h2
,
winerr
);
"CreateMutexA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)
\n
"
,
h2
,
winerr
);
pNtClose
(
h
);
pNtClose
(
h1
);
pNtClose
(
h2
);
h
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateEventA failed got ret=%p (%
l
d)
\n
"
,
h
,
GetLastError
());
ok
(
h
!=
0
,
"CreateEventA failed got ret=%p (%d)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateEvent
(
&
h1
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08
l
x)
\n
"
,
status
);
"NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)
\n
"
,
status
);
h2
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
"om.c-test"
);
winerr
=
GetLastError
();
ok
(
h2
!=
0
&&
winerr
==
ERROR_ALREADY_EXISTS
,
"CreateEventA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%
l
d)
\n
"
,
h2
,
winerr
);
"CreateEventA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)
\n
"
,
h2
,
winerr
);
pNtClose
(
h
);
pNtClose
(
h1
);
pNtClose
(
h2
);
h
=
CreateSemaphoreA
(
NULL
,
1
,
2
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateSemaphoreA failed got ret=%p (%
l
d)
\n
"
,
h
,
GetLastError
());
ok
(
h
!=
0
,
"CreateSemaphoreA failed got ret=%p (%d)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateSemaphore
(
&
h1
,
GENERIC_ALL
,
&
attr
,
1
,
2
);
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateSemaphore should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08
l
x)
\n
"
,
status
);
"NtCreateSemaphore should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)
\n
"
,
status
);
h2
=
CreateSemaphoreA
(
NULL
,
1
,
2
,
"om.c-test"
);
winerr
=
GetLastError
();
ok
(
h2
!=
0
&&
winerr
==
ERROR_ALREADY_EXISTS
,
"CreateSemaphoreA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%
l
d)
\n
"
,
h2
,
winerr
);
"CreateSemaphoreA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)
\n
"
,
h2
,
winerr
);
pNtClose
(
h
);
pNtClose
(
h1
);
pNtClose
(
h2
);
h
=
CreateWaitableTimerA
(
NULL
,
TRUE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateWaitableTimerA failed got ret=%p (%
l
d)
\n
"
,
h
,
GetLastError
());
ok
(
h
!=
0
,
"CreateWaitableTimerA failed got ret=%p (%d)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateTimer
(
&
h1
,
GENERIC_ALL
,
&
attr
,
NotificationTimer
);
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateTimer should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08
l
x)
\n
"
,
status
);
"NtCreateTimer should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)
\n
"
,
status
);
h2
=
CreateWaitableTimerA
(
NULL
,
TRUE
,
"om.c-test"
);
winerr
=
GetLastError
();
ok
(
h2
!=
0
&&
winerr
==
ERROR_ALREADY_EXISTS
,
"CreateWaitableTimerA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%
l
d)
\n
"
,
h2
,
winerr
);
"CreateWaitableTimerA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)
\n
"
,
h2
,
winerr
);
pNtClose
(
h
);
pNtClose
(
h1
);
pNtClose
(
h2
);
h
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
256
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateFileMappingA failed got ret=%p (%
l
d)
\n
"
,
h
,
GetLastError
());
ok
(
h
!=
0
,
"CreateFileMappingA failed got ret=%p (%d)
\n
"
,
h
,
GetLastError
());
size
.
u
.
LowPart
=
256
;
size
.
u
.
HighPart
=
0
;
status
=
pNtCreateSection
(
&
h1
,
SECTION_MAP_WRITE
,
&
attr
,
&
size
,
PAGE_READWRITE
,
SEC_COMMIT
,
0
);
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateSection should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08
l
x)
\n
"
,
status
);
"NtCreateSection should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)
\n
"
,
status
);
h2
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
256
,
"om.c-test"
);
winerr
=
GetLastError
();
ok
(
h2
!=
0
&&
winerr
==
ERROR_ALREADY_EXISTS
,
"CreateFileMappingA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%
l
d)
\n
"
,
h2
,
winerr
);
"CreateFileMappingA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)
\n
"
,
h2
,
winerr
);
pNtClose
(
h
);
pNtClose
(
h1
);
pNtClose
(
h2
);
...
...
@@ -288,17 +288,17 @@ void test_directory(void)
/* No name and/or no attributes */
status
=
pNtCreateDirectoryObject
(
NULL
,
DIRECTORY_QUERY
,
&
attr
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08
l
x)
\n
"
,
status
);
"NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)
\n
"
,
status
);
status
=
pNtOpenDirectoryObject
(
NULL
,
DIRECTORY_QUERY
,
&
attr
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08
l
x)
\n
"
,
status
);
"NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)
\n
"
,
status
);
status
=
pNtCreateDirectoryObject
(
&
h
,
DIRECTORY_QUERY
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Directory without attributes(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Directory without attributes(%08x)
\n
"
,
status
);
pNtClose
(
h
);
status
=
pNtOpenDirectoryObject
(
&
h
,
DIRECTORY_QUERY
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08
l
x)
\n
"
,
status
);
"NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08x)
\n
"
,
status
);
InitializeObjectAttributes
(
&
attr
,
NULL
,
0
,
0
,
NULL
);
DIR_TEST_CREATE_SUCCESS
(
&
dir
)
...
...
@@ -334,7 +334,7 @@ void test_directory(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
BaseNamedObjects
\\
Local"
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtOpenSymbolicLinkObject
(
&
dir
,
SYMBOLIC_LINK_QUERY
,
&
attr
);
\
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open SymbolicLink(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open SymbolicLink(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
dir
,
NULL
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"one more level"
);
...
...
@@ -421,23 +421,23 @@ void test_directory(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
om.c-mutant"
);
status
=
pNtCreateMutant
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_PATH_SYNTAX_BAD
,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
om.c-mutant
\\
"
);
status
=
pNtCreateMutant
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_PATH_SYNTAX_BAD
,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"om.c
\\
-mutant"
);
status
=
pNtCreateMutant
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08
l
x)
\n
"
,
status
);
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"om.c-mutant"
);
status
=
pNtCreateMutant
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Mutant(%08
l
x)
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Mutant(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
pNtClose
(
h
);
...
...
@@ -446,10 +446,10 @@ void test_directory(void)
#define SYMLNK_TEST_CREATE_FAILURE(h,e) \
status = pNtCreateSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr, &target);\
ok(status == e,"NtCreateSymbolicLinkObject should have failed with %s got(%08
l
x)\n", #e, status);
ok(status == e,"NtCreateSymbolicLinkObject should have failed with %s got(%08x)\n", #e, status);
#define SYMLNK_TEST_OPEN_FAILURE(h,e) \
status = pNtOpenSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr);\
ok(status == e,"NtOpenSymbolicLinkObject should have failed with %s got(%08
l
x)\n", #e, status);
ok(status == e,"NtOpenSymbolicLinkObject should have failed with %s got(%08x)\n", #e, status);
#define SYMLNK_TEST_CREATE_OPEN_FAILURE(h,n,t,e) \
pRtlCreateUnicodeStringFromAsciiz(&str, n);\
pRtlCreateUnicodeStringFromAsciiz(&target, t);\
...
...
@@ -460,10 +460,10 @@ void test_directory(void)
#define SYMLNK_TEST_CREATE_SUCCESS(h) \
status = pNtCreateSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr, &target); \
ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08
l
x)\n", status);
ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08x)\n", status);
#define SYMLNK_TEST_OPEN_SUCCESS(h) \
status = pNtOpenSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr); \
ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08
l
x)\n", status);
ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status);
void
test_symboliclink
(
void
)
{
...
...
@@ -478,10 +478,10 @@ void test_symboliclink(void)
status
=
pNtCreateSymbolicLinkObject
(
&
h
,
SYMBOLIC_LINK_QUERY
,
NULL
,
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08
l
x)
\n
"
,
status
);
"NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)
\n
"
,
status
);
status
=
pNtOpenSymbolicLinkObject
(
&
h
,
SYMBOLIC_LINK_QUERY
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08
l
x)
\n
"
,
status
);
"NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)
\n
"
,
status
);
InitializeObjectAttributes
(
&
attr
,
NULL
,
0
,
0
,
NULL
);
SYMLNK_TEST_CREATE_FAILURE
(
&
link
,
STATUS_INVALID_PARAMETER
)
...
...
@@ -523,7 +523,7 @@ void test_symboliclink(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"Local
\\
test-link
\\
PIPE"
);
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open NamedPipe(%08
l
x)
\n
"
,
status
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open NamedPipe(%08x)
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
str
);
pNtClose
(
h
);
...
...
dlls/ntdll/tests/path.c
View file @
8ddaf6cc
...
...
@@ -266,7 +266,7 @@ static void test_RtlGetFullPathName_U(void)
len
=
strlen
(
test
->
rname
)
*
sizeof
(
WCHAR
);
pRtlMultiByteToUnicodeN
(
pathbufW
,
sizeof
(
pathbufW
),
NULL
,
test
->
path
,
strlen
(
test
->
path
)
+
1
);
ret
=
pRtlGetFullPathName_U
(
pathbufW
,
MAX_PATH
,
rbufferW
,
&
file_part
);
ok
(
ret
==
len
,
"Wrong result %
l
d/%d for
\"
%s
\"\n
"
,
ret
,
len
,
test
->
path
);
ok
(
ret
==
len
,
"Wrong result %d/%d for
\"
%s
\"\n
"
,
ret
,
len
,
test
->
path
);
ok
(
pRtlUnicodeToMultiByteN
(
rbufferA
,
MAX_PATH
,
&
reslen
,
rbufferW
,(
lstrlenW
(
rbufferW
)
+
1
)
*
sizeof
(
WCHAR
))
==
STATUS_SUCCESS
,
"RtlUnicodeToMultiByteN failed
\n
"
);
ok
(
lstrcmpiA
(
rbufferA
,
test
->
rname
)
==
0
,
"Got
\"
%s
\"
expected
\"
%s
\"\n
"
,
rbufferA
,
test
->
rname
);
...
...
dlls/ntdll/tests/port.c
View file @
8ddaf6cc
...
...
@@ -153,10 +153,10 @@ static void ProcessConnectionRequest(PLPC_MESSAGE LpcMessage, PHANDLE pAcceptPor
ok
(
!*
LpcMessage
->
Data
,
"Expected empty string!
\n
"
);
status
=
pNtAcceptConnectPort
(
pAcceptPortHandle
,
0
,
LpcMessage
,
1
,
0
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
status
=
pNtCompleteConnectPort
(
*
pAcceptPortHandle
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
}
static
void
ProcessLpcRequest
(
HANDLE
PortHandle
,
PLPC_MESSAGE
LpcMessage
)
...
...
@@ -171,7 +171,7 @@ static void ProcessLpcRequest(HANDLE PortHandle, PLPC_MESSAGE LpcMessage)
lstrcpy
((
LPSTR
)
LpcMessage
->
Data
,
REPLY
);
status
=
pNtReplyPort
(
PortHandle
,
LpcMessage
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
ok
(
LpcMessage
->
MessageType
==
LPC_REQUEST
,
"Expected LPC_REQUEST, got %d
\n
"
,
LpcMessage
->
MessageType
);
ok
(
!
lstrcmp
((
LPSTR
)
LpcMessage
->
Data
,
REPLY
),
...
...
@@ -192,10 +192,10 @@ static DWORD WINAPI test_ports_client(LPVOID arg)
sqos
.
EffectiveOnly
=
TRUE
;
status
=
pNtConnectPort
(
&
PortHandle
,
&
port
,
&
sqos
,
0
,
0
,
&
len
,
NULL
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
status
=
pNtRegisterThreadTerminatePort
(
PortHandle
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
size
=
FIELD_OFFSET
(
LPC_MESSAGE
,
Data
)
+
MAX_MESSAGE_LEN
;
LpcMessage
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
...
...
@@ -207,7 +207,7 @@ static DWORD WINAPI test_ports_client(LPVOID arg)
lstrcpy
((
LPSTR
)
LpcMessage
->
Data
,
REQUEST1
);
status
=
pNtRequestPort
(
PortHandle
,
LpcMessage
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
ok
(
LpcMessage
->
MessageType
==
0
,
"Expected 0, got %d
\n
"
,
LpcMessage
->
MessageType
);
ok
(
!
lstrcmp
((
LPSTR
)
LpcMessage
->
Data
,
REQUEST1
),
"Expected %s, got %s
\n
"
,
REQUEST1
,
LpcMessage
->
Data
);
...
...
@@ -220,7 +220,7 @@ static DWORD WINAPI test_ports_client(LPVOID arg)
/* Send the message and wait for the reply */
status
=
pNtRequestWaitReplyPort
(
PortHandle
,
LpcMessage
,
out
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
ok
(
!
lstrcmp
((
LPSTR
)
out
->
Data
,
REPLY
),
"Expected %s, got %s
\n
"
,
REPLY
,
out
->
Data
);
ok
(
out
->
MessageType
==
LPC_REPLY
,
"Expected LPC_REPLY, got %d
\n
"
,
out
->
MessageType
);
...
...
@@ -246,7 +246,7 @@ static void test_ports_server(void)
status
=
pNtCreatePort
(
&
PortHandle
,
&
obj
,
100
,
100
,
0
);
todo_wine
{
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
l
d
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %d
\n
"
,
status
);
}
size
=
FIELD_OFFSET
(
LPC_MESSAGE
,
Data
)
+
MAX_MESSAGE_LEN
;
...
...
@@ -258,7 +258,7 @@ static void test_ports_server(void)
status
=
pNtReplyWaitReceivePort
(
PortHandle
,
NULL
,
NULL
,
LpcMessage
);
todo_wine
{
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
ld(%l
x)
\n
"
,
status
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %
d(%
x)
\n
"
,
status
,
status
);
}
/* STATUS_INVALID_HANDLE: win2k without admin rights will perform an
* endless loop here
...
...
dlls/ntdll/tests/reg.c
View file @
8ddaf6cc
...
...
@@ -289,7 +289,7 @@ static void test_RtlQueryRegistryValues(void)
QueryTable
[
2
].
DefaultLength
=
0
;
status
=
pRtlQueryRegistryValues
(
RelativeTo
,
winetestpath
.
Buffer
,
QueryTable
,
0
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlQueryRegistryValues return: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlQueryRegistryValues return: 0x%08x
\n
"
,
status
);
pRtlFreeHeap
(
GetProcessHeap
(),
0
,
QueryTable
);
}
...
...
@@ -317,13 +317,13 @@ static void test_NtOpenKey(void)
/* NULL key */
status
=
pNtOpenKey
(
NULL
,
0
,
&
attr
);
todo_wine
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08x
\n
"
,
status
);
/* Length > sizeof(OBJECT_ATTRIBUTES) */
attr
.
Length
*=
2
;
status
=
pNtOpenKey
(
&
key
,
am
,
&
attr
);
todo_wine
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"Expected STATUS_INVALID_PARAMETER, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"Expected STATUS_INVALID_PARAMETER, got: 0x%08x
\n
"
,
status
);
}
static
void
test_NtCreateKey
(
void
)
...
...
@@ -336,35 +336,35 @@ static void test_NtCreateKey(void)
/* All NULL */
status
=
pNtCreateKey
(
NULL
,
0
,
NULL
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08x
\n
"
,
status
);
/* Only the key */
status
=
pNtCreateKey
(
&
key
,
0
,
NULL
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
/* W2K3/XP/W2K */
||
status
==
STATUS_INVALID_PARAMETER
/* NT4 */
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER(NT4), got: 0x%08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER(NT4), got: 0x%08x
\n
"
,
status
);
/* Only accessmask */
status
=
pNtCreateKey
(
NULL
,
am
,
NULL
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08x
\n
"
,
status
);
/* Key and accessmask */
status
=
pNtCreateKey
(
&
key
,
am
,
NULL
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
/* W2K3/XP/W2K */
||
status
==
STATUS_INVALID_PARAMETER
/* NT4 */
,
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER(NT4), got: 0x%08
l
x
\n
"
,
status
);
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER(NT4), got: 0x%08x
\n
"
,
status
);
InitializeObjectAttributes
(
&
attr
,
&
winetestpath
,
0
,
0
,
0
);
/* Only attributes */
status
=
pNtCreateKey
(
NULL
,
0
,
&
attr
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got: 0x%08x
\n
"
,
status
);
status
=
pNtCreateKey
(
&
key
,
am
,
&
attr
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"NtCreateKey Failed: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"NtCreateKey Failed: 0x%08x
\n
"
,
status
);
/* Length > sizeof(OBJECT_ATTRIBUTES) */
attr
.
Length
*=
2
;
status
=
pNtCreateKey
(
&
key
,
am
,
&
attr
,
0
,
0
,
0
,
0
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"Expected STATUS_INVALID_PARAMETER, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"Expected STATUS_INVALID_PARAMETER, got: 0x%08x
\n
"
,
status
);
pNtClose
(
&
key
);
}
...
...
@@ -382,10 +382,10 @@ static void test_NtSetValueKey(void)
InitializeObjectAttributes
(
&
attr
,
&
winetestpath
,
0
,
0
,
0
);
status
=
pNtOpenKey
(
&
key
,
am
,
&
attr
);
ok
(
status
==
STATUS_SUCCESS
,
"NtOpenKey Failed: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"NtOpenKey Failed: 0x%08x
\n
"
,
status
);
status
=
pNtSetValueKey
(
key
,
&
ValName
,
0
,
REG_DWORD
,
&
data
,
sizeof
(
data
));
ok
(
status
==
STATUS_SUCCESS
,
"NtSetValueKey Failed: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"NtSetValueKey Failed: 0x%08x
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
ValName
);
pNtClose
(
&
key
);
...
...
@@ -396,7 +396,7 @@ static void test_RtlOpenCurrentUser(void)
NTSTATUS
status
;
HKEY
handle
;
status
=
pRtlOpenCurrentUser
(
KEY_READ
,
&
handle
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlOpenCurrentUser Failed: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlOpenCurrentUser Failed: 0x%08x
\n
"
,
status
);
pNtClose
(
&
handle
);
}
...
...
@@ -405,10 +405,10 @@ static void test_RtlCheckRegistryKey(void)
NTSTATUS
status
;
status
=
pRtlCheckRegistryKey
(
RTL_REGISTRY_ABSOLUTE
,
winetestpath
.
Buffer
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE: 0x%08x
\n
"
,
status
);
status
=
pRtlCheckRegistryKey
((
RTL_REGISTRY_ABSOLUTE
|
RTL_REGISTRY_OPTIONAL
),
winetestpath
.
Buffer
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE and RTL_REGISTRY_OPTIONAL: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE and RTL_REGISTRY_OPTIONAL: 0x%08x
\n
"
,
status
);
}
static
void
test_NtFlushKey
(
void
)
...
...
@@ -419,13 +419,13 @@ static void test_NtFlushKey(void)
ACCESS_MASK
am
=
KEY_ALL_ACCESS
;
status
=
pNtFlushKey
(
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got: 0x%08x
\n
"
,
status
);
InitializeObjectAttributes
(
&
attr
,
&
winetestpath
,
0
,
0
,
0
);
pNtOpenKey
(
&
hkey
,
am
,
&
attr
);
status
=
pNtFlushKey
(
hkey
);
ok
(
status
==
STATUS_SUCCESS
,
"NtDeleteKey Failed: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"NtDeleteKey Failed: 0x%08x
\n
"
,
status
);
pNtClose
(
hkey
);
}
...
...
@@ -438,13 +438,13 @@ static void test_NtDeleteKey(void)
ACCESS_MASK
am
=
KEY_ALL_ACCESS
;
status
=
pNtDeleteKey
(
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got: 0x%08x
\n
"
,
status
);
InitializeObjectAttributes
(
&
attr
,
&
winetestpath
,
0
,
0
,
0
);
status
=
pNtOpenKey
(
&
hkey
,
am
,
&
attr
);
status
=
pNtDeleteKey
(
hkey
);
ok
(
status
==
STATUS_SUCCESS
,
"NtDeleteKey Failed: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"NtDeleteKey Failed: 0x%08x
\n
"
,
status
);
}
static
void
test_RtlpNtQueryValueKey
(
void
)
...
...
@@ -452,7 +452,7 @@ static void test_RtlpNtQueryValueKey(void)
NTSTATUS
status
;
status
=
pRtlpNtQueryValueKey
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got: 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got: 0x%08x
\n
"
,
status
);
}
START_TEST
(
reg
)
...
...
dlls/ntdll/tests/rtl.c
View file @
8ddaf6cc
...
...
@@ -130,39 +130,39 @@ static void test_RtlCompareMemoryUlong(void)
a
[
2
]
=
0x89ab
;
a
[
3
]
=
0xcdef
;
result
=
pRtlCompareMemoryUlong
(
a
,
0
,
0x0123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 0, 0x0123) returns %
l
u, expected 0
\n
"
,
a
,
result
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 0, 0x0123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
3
,
0x0123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %
l
u, expected 0
\n
"
,
a
,
result
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
4
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
5
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
7
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
8
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
9
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
4
,
0x0127
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 4, 0x0127) returns %
l
u, expected 0
\n
"
,
a
,
result
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 4, 0x0127) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
4
,
0x7123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 4, 0x7123) returns %
l
u, expected 0
\n
"
,
a
,
result
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 4, 0x7123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
16
,
0x4567
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 16, 0x4567) returns %
l
u, expected 0
\n
"
,
a
,
result
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 16, 0x4567) returns %u, expected 0
\n
"
,
a
,
result
);
a
[
1
]
=
0x0123
;
result
=
pRtlCompareMemoryUlong
(
a
,
3
,
0x0123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %
l
u, expected 0
\n
"
,
a
,
result
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
4
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
5
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
7
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %
l
u, expected 4
\n
"
,
a
,
result
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
8
,
0x0123
);
ok
(
result
==
8
,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %
l
u, expected 8
\n
"
,
a
,
result
);
ok
(
result
==
8
,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 8
\n
"
,
a
,
result
);
result
=
pRtlCompareMemoryUlong
(
a
,
9
,
0x0123
);
ok
(
result
==
8
,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %
l
u, expected 8
\n
"
,
a
,
result
);
ok
(
result
==
8
,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 8
\n
"
,
a
,
result
);
}
#define COPY(len) memset(dest,0,sizeof(dest_aligned_block)); pRtlMoveMemory(dest, src, len)
...
...
@@ -266,7 +266,7 @@ static void test_RtlUlonglongByteSwap(void)
result
=
pRtlUlonglongByteSwap
(
((
ULONGLONG
)
0x76543210
<<
32
)
|
0x87654321
);
ok
(
(((
ULONGLONG
)
0x21436587
<<
32
)
|
0x10325476
)
==
result
,
"RtlUlonglongByteSwap(0x7654321087654321) returns 0x%
lx%08l
x, expected 0x2143658710325476
\n
"
,
"RtlUlonglongByteSwap(0x7654321087654321) returns 0x%
x%08
x, expected 0x2143658710325476
\n
"
,
(
DWORD
)(
result
>>
32
),
(
DWORD
)
result
);
}
...
...
@@ -301,7 +301,7 @@ static void test_RtlUniform(void)
expected
=
0x7fffffc3
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 0)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
/*
* The algorithm is now:
...
...
@@ -322,7 +322,7 @@ static void test_RtlUniform(void)
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
1
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 1)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 1)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
/*
* For seed = 2 the const_2 is 0x7fffffc3:
...
...
@@ -331,7 +331,7 @@ static void test_RtlUniform(void)
expected
=
seed
*
0xffffffed
+
0x7fffffc3
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 2)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 2)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
/*
* More tests show that if seed is odd the result must be incremented by 1:
...
...
@@ -340,21 +340,21 @@ static void test_RtlUniform(void)
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
(
seed
&
1
);
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 2)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 2)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
seed
=
0x6bca1aa
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1aa)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 0x6bca1aa)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
seed
=
0x6bca1ab
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
1
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ab)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 0x6bca1ab)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
/*
* When seed is 0x6bca1ac there is an exception:
...
...
@@ -363,7 +363,7 @@ static void test_RtlUniform(void)
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
2
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ac)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 0x6bca1ac)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
/*
* Note that up to here const_3 is not used
...
...
@@ -375,14 +375,14 @@ static void test_RtlUniform(void)
expected
=
(
seed
*
0xffffffed
+
0x7fffffc3
)
&
MAXLONG
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ad)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 0x6bca1ad)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
seed
=
0x6bca1ae
;
expected
=
(
seed
*
0xffffffed
+
0x7fffffc3
+
1
)
&
MAXLONG
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ae)) returns %
lx, expected %l
x
\n
"
,
"RtlUniform(&seed (seed == 0x6bca1ae)) returns %
x, expected %
x
\n
"
,
result
,
expected
);
/*
* There are several ranges where for odd or even seed the result must be
...
...
@@ -490,10 +490,10 @@ static void test_RtlUniform(void)
seed_bak
=
seed
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"test: 0x%
lx%08lx RtlUniform(&seed (seed == %lx)) returns %lx, expected %l
x
\n
"
,
"test: 0x%
x%08x RtlUniform(&seed (seed == %x)) returns %x, expected %
x
\n
"
,
(
DWORD
)(
num
>>
32
),
(
DWORD
)
num
,
seed_bak
,
result
,
expected
);
ok
(
seed
==
expected
,
"test: 0x%
lx%08lx RtlUniform(&seed (seed == %lx)) sets seed to %lx, expected %l
x
\n
"
,
"test: 0x%
x%08x RtlUniform(&seed (seed == %x)) sets seed to %x, expected %
x
\n
"
,
(
DWORD
)(
num
>>
32
),
(
DWORD
)
num
,
seed_bak
,
result
,
expected
);
}
/* for */
/*
...
...
@@ -537,10 +537,10 @@ static void test_RtlUniform(void)
seed_bak
=
seed
;
result
=
pRtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"test: 0x%
lx%08lx RtlUniform(&seed (seed == %lx)) returns %lx, expected %l
x
\n
"
,
"test: 0x%
x%08x RtlUniform(&seed (seed == %x)) returns %x, expected %
x
\n
"
,
(
DWORD
)(
num
>>
32
),
(
DWORD
)
num
,
seed_bak
,
result
,
expected
);
ok
(
seed
==
expected
,
"test: 0x%
lx%08lx RtlUniform(&seed (seed == %lx)) sets seed to %lx, expected %l
x
\n
"
,
"test: 0x%
x%08x RtlUniform(&seed (seed == %x)) sets seed to %x, expected %
x
\n
"
,
(
DWORD
)(
num
>>
32
),
(
DWORD
)
num
,
seed_bak
,
result
,
expected
);
}
/* for */
/*
...
...
@@ -617,10 +617,10 @@ static void test_RtlRandom(void)
seed_expected
=
0x44b
;
result
=
pRtlRandom
(
&
seed
);
ok
(
result
==
result_expected
,
"pRtlRandom(&seed (seed == 0)) returns %
lx, expected %l
x
\n
"
,
"pRtlRandom(&seed (seed == 0)) returns %
x, expected %
x
\n
"
,
result
,
result_expected
);
ok
(
seed
==
seed_expected
,
"pRtlRandom(&seed (seed == 0)) sets seed to %
lx, expected %l
x
\n
"
,
"pRtlRandom(&seed (seed == 0)) sets seed to %
x, expected %
x
\n
"
,
seed
,
seed_expected
);
/*
* Seed is not equal to result as with RtlUniform. To see more we
...
...
@@ -631,10 +631,10 @@ static void test_RtlRandom(void)
seed_expected
=
0x44b
;
result
=
pRtlRandom
(
&
seed
);
ok
(
result
==
result_expected
,
"RtlRandom(&seed (seed == 0)) returns %
lx, expected %l
x
\n
"
,
"RtlRandom(&seed (seed == 0)) returns %
x, expected %
x
\n
"
,
result
,
result_expected
);
ok
(
seed
==
seed_expected
,
"RtlRandom(&seed (seed == 0)) sets seed to %
lx, expected %l
x
\n
"
,
"RtlRandom(&seed (seed == 0)) sets seed to %
x, expected %
x
\n
"
,
seed
,
seed_expected
);
/*
* Seed is set to the same value as before but the result is different.
...
...
@@ -645,10 +645,10 @@ static void test_RtlRandom(void)
seed_expected
=
0x44b
;
result
=
pRtlRandom
(
&
seed
);
ok
(
result
==
result_expected
,
"RtlRandom(&seed (seed == 0)) returns %
lx, expected %l
x
\n
"
,
"RtlRandom(&seed (seed == 0)) returns %
x, expected %
x
\n
"
,
result
,
result_expected
);
ok
(
seed
==
seed_expected
,
"RtlRandom(&seed (seed == 0)) sets seed to %
lx, expected %l
x
\n
"
,
"RtlRandom(&seed (seed == 0)) sets seed to %
x, expected %
x
\n
"
,
seed
,
seed_expected
);
/*
* Seed is aggain set to the same value as before. This time we also
...
...
@@ -693,10 +693,10 @@ static void test_RtlRandom(void)
seed_expected
=
0x5a1
;
result
=
pRtlRandom
(
&
seed
);
ok
(
result
==
result_expected
,
"RtlRandom(&seed (seed == 1)) returns %
lx, expected %l
x
\n
"
,
"RtlRandom(&seed (seed == 1)) returns %
x, expected %
x
\n
"
,
result
,
result_expected
);
ok
(
seed
==
seed_expected
,
"RtlRandom(&seed (seed == 1)) sets seed to %
lx, expected %l
x
\n
"
,
"RtlRandom(&seed (seed == 1)) sets seed to %
x, expected %
x
\n
"
,
seed
,
seed_expected
);
/*
* If there is just one saved_value the result now would be
...
...
@@ -754,10 +754,10 @@ static void test_RtlRandom(void)
}
/* if */
result
=
pRtlRandom
(
&
seed
);
ok
(
result
==
result_expected
,
"test: 0x%
lx%08lx RtlUniform(&seed (seed == %lx)) returns %lx, expected %l
x
\n
"
,
"test: 0x%
x%08x RtlUniform(&seed (seed == %x)) returns %x, expected %
x
\n
"
,
(
DWORD
)(
num
>>
32
),
(
DWORD
)
num
,
seed_bak
,
result
,
result_expected
);
ok
(
seed
==
seed_expected
,
"test: 0x%
lx%08lx RtlUniform(&seed (seed == %lx)) sets seed to %lx, expected %l
x
\n
"
,
"test: 0x%
x%08x RtlUniform(&seed (seed == %x)) sets seed to %x, expected %
x
\n
"
,
(
DWORD
)(
num
>>
32
),
(
DWORD
)
num
,
seed_bak
,
result
,
seed_expected
);
}
/* for */
}
...
...
@@ -793,7 +793,7 @@ static void test_RtlAreAllAccessesGranted(void)
result
=
pRtlAreAllAccessesGranted
(
all_accesses
[
test_num
].
GrantedAccess
,
all_accesses
[
test_num
].
DesiredAccess
);
ok
(
all_accesses
[
test_num
].
result
==
result
,
"(test %d): RtlAreAllAccessesGranted(%08lx, %08l
x) returns %d, expected %d
\n
"
,
"(test %d): RtlAreAllAccessesGranted(%08x, %08
x) returns %d, expected %d
\n
"
,
test_num
,
all_accesses
[
test_num
].
GrantedAccess
,
all_accesses
[
test_num
].
DesiredAccess
,
result
,
all_accesses
[
test_num
].
result
);
...
...
@@ -830,7 +830,7 @@ static void test_RtlAreAnyAccessesGranted(void)
result
=
pRtlAreAnyAccessesGranted
(
any_accesses
[
test_num
].
GrantedAccess
,
any_accesses
[
test_num
].
DesiredAccess
);
ok
(
any_accesses
[
test_num
].
result
==
result
,
"(test %d): RtlAreAnyAccessesGranted(%08lx, %08l
x) returns %d, expected %d
\n
"
,
"(test %d): RtlAreAnyAccessesGranted(%08x, %08
x) returns %d, expected %d
\n
"
,
test_num
,
any_accesses
[
test_num
].
GrantedAccess
,
any_accesses
[
test_num
].
DesiredAccess
,
result
,
any_accesses
[
test_num
].
result
);
...
...
@@ -845,7 +845,7 @@ static void test_RtlComputeCrc32(void)
return
;
crc
=
pRtlComputeCrc32
(
crc
,
(
LPBYTE
)
src
,
LEN
);
ok
(
crc
==
0x40861dc2
,
"Expected 0x40861dc2, got %8
l
x
\n
"
,
crc
);
ok
(
crc
==
0x40861dc2
,
"Expected 0x40861dc2, got %8x
\n
"
,
crc
);
}
...
...
@@ -879,7 +879,7 @@ static void test_HandleTables(void)
result
=
pRtlFreeHandle
(
&
HandleTable
,
&
MyHandle
->
RtlHandle
);
ok
(
result
,
"Couldn't free handle %p
\n
"
,
MyHandle
);
status
=
pRtlDestroyHandleTable
(
&
HandleTable
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlDestroyHandleTable failed with error 0x%08
l
x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlDestroyHandleTable failed with error 0x%08x
\n
"
,
status
);
}
static
void
test_RtlAllocateAndInitializeSid
(
void
)
...
...
@@ -889,16 +889,16 @@ static void test_RtlAllocateAndInitializeSid(void)
PSID
psid
;
ret
=
pRtlAllocateAndInitializeSid
(
&
sia
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ok
(
!
ret
,
"RtlAllocateAndInitializeSid error %08
l
x
\n
"
,
ret
);
ok
(
!
ret
,
"RtlAllocateAndInitializeSid error %08x
\n
"
,
ret
);
ret
=
pRtlFreeSid
(
psid
);
ok
(
!
ret
,
"RtlFreeSid error %08
l
x
\n
"
,
ret
);
ok
(
!
ret
,
"RtlFreeSid error %08x
\n
"
,
ret
);
/* these tests crash on XP
ret = pRtlAllocateAndInitializeSid(NULL, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, NULL);*/
ret
=
pRtlAllocateAndInitializeSid
(
&
sia
,
9
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ok
(
ret
==
STATUS_INVALID_SID
,
"wrong error %08
l
x
\n
"
,
ret
);
ok
(
ret
==
STATUS_INVALID_SID
,
"wrong error %08x
\n
"
,
ret
);
}
START_TEST
(
rtl
)
...
...
dlls/ntdll/tests/rtlbitmap.c
View file @
8ddaf6cc
...
...
@@ -425,14 +425,14 @@ static void test_RtlFindMostSignificantBit(void)
ulLong
<<=
i
;
cPos
=
pRtlFindMostSignificantBit
(
ulLong
);
ok
(
cPos
==
i
,
"didn't find MSB 0x%
lx%08l
x %d %d
\n
"
,
ok
(
cPos
==
i
,
"didn't find MSB 0x%
x%08
x %d %d
\n
"
,
(
DWORD
)(
ulLong
>>
32
),
(
DWORD
)
ulLong
,
i
,
cPos
);
/* Set all bits lower than bit i */
ulLong
=
((
ulLong
-
1
)
<<
1
)
|
1
;
cPos
=
pRtlFindMostSignificantBit
(
ulLong
);
ok
(
cPos
==
i
,
"didn't find MSB 0x%
lx%08l
x %d %d
\n
"
,
ok
(
cPos
==
i
,
"didn't find MSB 0x%
x%08
x %d %d
\n
"
,
(
DWORD
)(
ulLong
>>
32
),
(
DWORD
)
ulLong
,
i
,
cPos
);
}
cPos
=
pRtlFindMostSignificantBit
(
0
);
...
...
@@ -453,13 +453,13 @@ static void test_RtlFindLeastSignificantBit(void)
ulLong
=
(
ULONGLONG
)
1
<<
i
;
cPos
=
pRtlFindLeastSignificantBit
(
ulLong
);
ok
(
cPos
==
i
,
"didn't find LSB 0x%
lx%08l
x %d %d
\n
"
,
ok
(
cPos
==
i
,
"didn't find LSB 0x%
x%08
x %d %d
\n
"
,
(
DWORD
)(
ulLong
>>
32
),
(
DWORD
)
ulLong
,
i
,
cPos
);
ulLong
=
~
((
ULONGLONG
)
0
)
<<
i
;
cPos
=
pRtlFindLeastSignificantBit
(
ulLong
);
ok
(
cPos
==
i
,
"didn't find LSB 0x%
lx%08l
x %d %d
\n
"
,
ok
(
cPos
==
i
,
"didn't find LSB 0x%
x%08
x %d %d
\n
"
,
(
DWORD
)(
ulLong
>>
32
),
(
DWORD
)
ulLong
,
i
,
cPos
);
}
cPos
=
pRtlFindLeastSignificantBit
(
0
);
...
...
@@ -532,7 +532,7 @@ static void test_RtlFindSetRuns(void)
ULONG
ulStart
=
0
;
ulCount
=
pRtlFindLongestRunSet
(
&
bm
,
&
ulStart
);
ok
(
ulCount
==
33
&&
ulStart
==
1877
,
"didn't find longest %
ld %l
d
\n
"
,
ulCount
,
ulStart
);
ok
(
ulCount
==
33
&&
ulStart
==
1877
,
"didn't find longest %
d %
d
\n
"
,
ulCount
,
ulStart
);
memset
(
buff
,
0
,
sizeof
(
buff
));
ulCount
=
pRtlFindLongestRunSet
(
&
bm
,
&
ulStart
);
...
...
dlls/ntdll/tests/rtlstr.c
View file @
8ddaf6cc
...
...
@@ -199,7 +199,7 @@ static void test_RtlInitUnicodeStringEx(void)
uni
.
Buffer
=
(
void
*
)
0xdeadbeef
;
result
=
pRtlInitUnicodeStringEx
(
&
uni
,
teststring
);
ok
(
result
==
STATUS_SUCCESS
,
"pRtlInitUnicodeStringEx(&uni, 0) returns %
l
x, expected 0
\n
"
,
"pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected 0
\n
"
,
result
);
ok
(
uni
.
Length
==
32
,
"pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u
\n
"
,
...
...
@@ -230,7 +230,7 @@ static void test_RtlInitUnicodeStringEx(void)
uni
.
Buffer
=
(
void
*
)
0xdeadbeef
;
result
=
pRtlInitUnicodeStringEx
(
&
uni
,
teststring2
);
ok
(
result
==
STATUS_NAME_TOO_LONG
,
"pRtlInitUnicodeStringEx(&uni, 0) returns %
lx, expected %l
x
\n
"
,
"pRtlInitUnicodeStringEx(&uni, 0) returns %
x, expected %
x
\n
"
,
result
,
STATUS_NAME_TOO_LONG
);
ok
(
uni
.
Length
==
12345
,
"pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u
\n
"
,
...
...
@@ -263,7 +263,7 @@ static void test_RtlInitUnicodeStringEx(void)
uni
.
Buffer
=
(
void
*
)
0xdeadbeef
;
result
=
pRtlInitUnicodeStringEx
(
&
uni
,
0
);
ok
(
result
==
STATUS_SUCCESS
,
"pRtlInitUnicodeStringEx(&uni, 0) returns %
l
x, expected 0
\n
"
,
"pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected 0
\n
"
,
result
);
ok
(
uni
.
Length
==
0
,
"pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u
\n
"
,
...
...
@@ -439,7 +439,7 @@ static void test_RtlDuplicateUnicodeString(void)
dest_ansi_buf
[
dest_ansi_str
.
Length
]
=
'\0'
;
dest_ansi_str
.
Buffer
=
dest_ansi_buf
;
ok
(
result
==
dupl_ustr
[
test_num
].
result
,
"(test %d): RtlDuplicateUnicodeString(%d, source, dest) has result %lx, expected %l
x
\n
"
,
"(test %d): RtlDuplicateUnicodeString(%d, source, dest) has result %x, expected %
x
\n
"
,
test_num
,
dupl_ustr
[
test_num
].
add_nul
,
result
,
dupl_ustr
[
test_num
].
result
);
ok
(
dest_str
.
Length
==
dupl_ustr
[
test_num
].
res_Length
,
"(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination has Length %d, expected %d
\n
"
,
...
...
@@ -778,7 +778,7 @@ static void test_RtlUnicodeStringToAnsiString(void)
}
result
=
pRtlUnicodeStringToAnsiString
(
&
ansi_str
,
&
uni_str
,
ustr2astr
[
test_num
].
doalloc
);
ok
(
result
==
ustr2astr
[
test_num
].
result
,
"(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) has result %lx, expected %l
x
\n
"
,
"(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) has result %x, expected %
x
\n
"
,
test_num
,
ustr2astr
[
test_num
].
doalloc
,
result
,
ustr2astr
[
test_num
].
result
);
ok
(
ansi_str
.
Length
==
ustr2astr
[
test_num
].
res_Length
,
"(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) ansi has Length %d, expected %d
\n
"
,
...
...
@@ -839,7 +839,7 @@ static void test_RtlAppendAsciizToString(void)
}
result
=
pRtlAppendAsciizToString
(
&
dest_str
,
app_asc2str
[
test_num
].
src
);
ok
(
result
==
app_asc2str
[
test_num
].
result
,
"(test %d): RtlAppendAsciizToString(dest, src) has result %lx, expected %l
x
\n
"
,
"(test %d): RtlAppendAsciizToString(dest, src) has result %x, expected %
x
\n
"
,
test_num
,
result
,
app_asc2str
[
test_num
].
result
);
ok
(
dest_str
.
Length
==
app_asc2str
[
test_num
].
res_Length
,
"(test %d): RtlAppendAsciizToString(dest, src) dest has Length %d, expected %d
\n
"
,
...
...
@@ -920,7 +920,7 @@ static void test_RtlAppendStringToString(void)
}
result
=
pRtlAppendStringToString
(
&
dest_str
,
&
src_str
);
ok
(
result
==
app_str2str
[
test_num
].
result
,
"(test %d): RtlAppendStringToString(dest, src) has result %lx, expected %l
x
\n
"
,
"(test %d): RtlAppendStringToString(dest, src) has result %x, expected %
x
\n
"
,
test_num
,
result
,
app_str2str
[
test_num
].
result
);
ok
(
dest_str
.
Length
==
app_str2str
[
test_num
].
res_Length
,
"(test %d): RtlAppendStringToString(dest, src) dest has Length %d, expected %d
\n
"
,
...
...
@@ -992,7 +992,7 @@ static void test_RtlAppendUnicodeToString(void)
}
result
=
pRtlAppendUnicodeToString
(
&
dest_str
,
(
LPCWSTR
)
app_uni2str
[
test_num
].
src
);
ok
(
result
==
app_uni2str
[
test_num
].
result
,
"(test %d): RtlAppendUnicodeToString(dest, src) has result %lx, expected %l
x
\n
"
,
"(test %d): RtlAppendUnicodeToString(dest, src) has result %x, expected %
x
\n
"
,
test_num
,
result
,
app_uni2str
[
test_num
].
result
);
ok
(
dest_str
.
Length
==
app_uni2str
[
test_num
].
res_Length
,
"(test %d): RtlAppendUnicodeToString(dest, src) dest has Length %d, expected %d
\n
"
,
...
...
@@ -1077,7 +1077,7 @@ static void test_RtlAppendUnicodeStringToString(void)
}
result
=
pRtlAppendUnicodeStringToString
(
&
dest_str
,
&
src_str
);
ok
(
result
==
app_ustr2str
[
test_num
].
result
,
"(test %d): RtlAppendStringToString(dest, src) has result %lx, expected %l
x
\n
"
,
"(test %d): RtlAppendStringToString(dest, src) has result %x, expected %
x
\n
"
,
test_num
,
result
,
app_ustr2str
[
test_num
].
result
);
ok
(
dest_str
.
Length
==
app_ustr2str
[
test_num
].
res_Length
,
"(test %d): RtlAppendStringToString(dest, src) dest has Length %d, expected %d
\n
"
,
...
...
@@ -1196,7 +1196,7 @@ static void test_RtlFindCharInUnicodeString(void)
pos
=
12345
;
result
=
pRtlFindCharInUnicodeString
(
find_ch_in_ustr
[
test_num
].
flags
,
&
main_str
,
&
search_chars
,
&
pos
);
ok
(
result
==
find_ch_in_ustr
[
test_num
].
result
,
"(test %d): RtlFindCharInUnicodeString(%d, %s, %s, [out]) has result %
lx, expected %l
x
\n
"
,
"(test %d): RtlFindCharInUnicodeString(%d, %s, %s, [out]) has result %
x, expected %
x
\n
"
,
test_num
,
find_ch_in_ustr
[
test_num
].
flags
,
find_ch_in_ustr
[
test_num
].
main_str
,
find_ch_in_ustr
[
test_num
].
search_chars
,
result
,
find_ch_in_ustr
[
test_num
].
result
);
...
...
@@ -1347,7 +1347,7 @@ static void test_RtlUnicodeStringToInteger(void)
pRtlInitUnicodeString
(
&
uni
,
wstr
);
result
=
pRtlUnicodeStringToInteger
(
&
uni
,
str2int
[
test_num
].
base
,
&
value
);
ok
(
result
==
str2int
[
test_num
].
result
,
"(test %d): RtlUnicodeStringToInteger(
\"
%s
\"
, %d, [out]) has result %lx, expected: %l
x
\n
"
,
"(test %d): RtlUnicodeStringToInteger(
\"
%s
\"
, %d, [out]) has result %x, expected: %
x
\n
"
,
test_num
,
str2int
[
test_num
].
str
,
str2int
[
test_num
].
base
,
result
,
str2int
[
test_num
].
result
);
ok
(
value
==
str2int
[
test_num
].
value
,
"(test %d): RtlUnicodeStringToInteger(
\"
%s
\"
, %d, [out]) assigns value %d, expected: %d
\n
"
,
...
...
@@ -1359,17 +1359,17 @@ static void test_RtlUnicodeStringToInteger(void)
pRtlInitUnicodeString
(
&
uni
,
wstr
);
result
=
pRtlUnicodeStringToInteger
(
&
uni
,
str2int
[
1
].
base
,
NULL
);
ok
(
result
==
STATUS_ACCESS_VIOLATION
,
"call failed: RtlUnicodeStringToInteger(
\"
%s
\"
, %d, NULL) has result %
l
x
\n
"
,
"call failed: RtlUnicodeStringToInteger(
\"
%s
\"
, %d, NULL) has result %x
\n
"
,
str2int
[
1
].
str
,
str2int
[
1
].
base
,
result
);
result
=
pRtlUnicodeStringToInteger
(
&
uni
,
20
,
NULL
);
ok
(
result
==
STATUS_INVALID_PARAMETER
,
"call failed: RtlUnicodeStringToInteger(
\"
%s
\"
, 20, NULL) has result %
l
x
\n
"
,
"call failed: RtlUnicodeStringToInteger(
\"
%s
\"
, 20, NULL) has result %x
\n
"
,
str2int
[
1
].
str
,
result
);
uni
.
Length
=
10
;
/* Make Length shorter (5 WCHARS instead of 7) */
result
=
pRtlUnicodeStringToInteger
(
&
uni
,
str2int
[
1
].
base
,
&
value
);
ok
(
result
==
STATUS_SUCCESS
,
"call failed: RtlUnicodeStringToInteger(
\"
12345
\"
, %d, [out]) has result %
l
x
\n
"
,
"call failed: RtlUnicodeStringToInteger(
\"
12345
\"
, %d, [out]) has result %x
\n
"
,
str2int
[
1
].
base
,
result
);
ok
(
value
==
12345
,
"didn't return expected value (test a): expected: %d, got: %d
\n
"
,
...
...
@@ -1378,7 +1378,7 @@ static void test_RtlUnicodeStringToInteger(void)
uni
.
Length
=
5
;
/* Use odd Length (2.5 WCHARS) */
result
=
pRtlUnicodeStringToInteger
(
&
uni
,
str2int
[
1
].
base
,
&
value
);
ok
(
result
==
STATUS_SUCCESS
,
"call failed: RtlUnicodeStringToInteger(
\"
12
\"
, %d, [out]) has result %
l
x
\n
"
,
"call failed: RtlUnicodeStringToInteger(
\"
12
\"
, %d, [out]) has result %x
\n
"
,
str2int
[
1
].
base
,
result
);
ok
(
value
==
12
,
"didn't return expected value (test b): expected: %d, got: %d
\n
"
,
...
...
@@ -1387,7 +1387,7 @@ static void test_RtlUnicodeStringToInteger(void)
uni
.
Length
=
2
;
result
=
pRtlUnicodeStringToInteger
(
&
uni
,
str2int
[
1
].
base
,
&
value
);
ok
(
result
==
STATUS_SUCCESS
,
"call failed: RtlUnicodeStringToInteger(
\"
1
\"
, %d, [out]) has result %
l
x
\n
"
,
"call failed: RtlUnicodeStringToInteger(
\"
1
\"
, %d, [out]) has result %x
\n
"
,
str2int
[
1
].
base
,
result
);
ok
(
value
==
1
,
"didn't return expected value (test c): expected: %d, got: %d
\n
"
,
...
...
@@ -1409,7 +1409,7 @@ static void test_RtlCharToInteger(void)
value
=
0xdeadbeef
;
result
=
pRtlCharToInteger
(
str2int
[
test_num
].
str
,
str2int
[
test_num
].
base
,
&
value
);
ok
(
result
==
str2int
[
test_num
].
result
,
"(test %d): call failed: RtlCharToInteger(
\"
%s
\"
, %d, [out]) has result %lx, expected: %l
x
\n
"
,
"(test %d): call failed: RtlCharToInteger(
\"
%s
\"
, %d, [out]) has result %x, expected: %
x
\n
"
,
test_num
,
str2int
[
test_num
].
str
,
str2int
[
test_num
].
base
,
result
,
str2int
[
test_num
].
result
);
ok
(
value
==
str2int
[
test_num
].
value
,
"(test %d): call failed: RtlCharToInteger(
\"
%s
\"
, %d, [out]) assigns value %d, expected: %d
\n
"
,
...
...
@@ -1419,12 +1419,12 @@ static void test_RtlCharToInteger(void)
result
=
pRtlCharToInteger
(
str2int
[
1
].
str
,
str2int
[
1
].
base
,
NULL
);
ok
(
result
==
STATUS_ACCESS_VIOLATION
,
"call failed: RtlCharToInteger(
\"
%s
\"
, %d, NULL) has result %
l
x
\n
"
,
"call failed: RtlCharToInteger(
\"
%s
\"
, %d, NULL) has result %x
\n
"
,
str2int
[
1
].
str
,
str2int
[
1
].
base
,
result
);
result
=
pRtlCharToInteger
(
str2int
[
1
].
str
,
20
,
NULL
);
ok
(
result
==
STATUS_INVALID_PARAMETER
,
"call failed: RtlCharToInteger(
\"
%s
\"
, 20, NULL) has result %
l
x
\n
"
,
"call failed: RtlCharToInteger(
\"
%s
\"
, 20, NULL) has result %x
\n
"
,
str2int
[
1
].
str
,
result
);
}
...
...
@@ -1592,22 +1592,22 @@ static void one_RtlIntegerToUnicodeString_test(int test_num, const int2str_t *in
}
}
else
{
ok
(
result
==
int2str
->
result
,
"(test %d): RtlIntegerToUnicodeString(%lu, %d, [out]) has result %lx, expected: %l
x
\n
"
,
"(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) has result %x, expected: %
x
\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
result
,
int2str
->
result
);
if
(
result
==
STATUS_SUCCESS
)
{
ok
(
unicode_string
.
Buffer
[
unicode_string
.
Length
/
sizeof
(
WCHAR
)]
==
'\0'
,
"(test %d): RtlIntegerToUnicodeString(%l
u, %d, [out]) string
\"
%s
\"
is not NULL terminated
\n
"
,
"(test %d): RtlIntegerToUnicodeString(%
u, %d, [out]) string
\"
%s
\"
is not NULL terminated
\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
ansi_str
.
Buffer
);
}
}
ok
(
memcmp
(
unicode_string
.
Buffer
,
expected_unicode_string
.
Buffer
,
STRI_BUFFER_LENGTH
*
sizeof
(
WCHAR
))
==
0
,
"(test %d): RtlIntegerToUnicodeString(%
l
u, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
ansi_str
.
Buffer
,
expected_ansi_str
.
Buffer
);
ok
(
unicode_string
.
Length
==
expected_unicode_string
.
Length
,
"(test %d): RtlIntegerToUnicodeString(%
l
u, %d, [out]) string has Length %d, expected: %d
\n
"
,
"(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string has Length %d, expected: %d
\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
unicode_string
.
Length
,
expected_unicode_string
.
Length
);
ok
(
unicode_string
.
MaximumLength
==
expected_unicode_string
.
MaximumLength
,
"(test %d): RtlIntegerToUnicodeString(%
l
u, %d, [out]) string has MaximumLength %d, expected: %d
\n
"
,
"(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string has MaximumLength %d, expected: %d
\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
unicode_string
.
MaximumLength
,
expected_unicode_string
.
MaximumLength
);
pRtlFreeAnsiString
(
&
expected_ansi_str
);
pRtlFreeAnsiString
(
&
ansi_str
);
...
...
@@ -1632,10 +1632,10 @@ static void one_RtlIntegerToChar_test(int test_num, const int2str_t *int2str)
dest_str
[
STRI_BUFFER_LENGTH
]
=
'\0'
;
result
=
pRtlIntegerToChar
(
int2str
->
value
,
int2str
->
base
,
int2str
->
MaximumLength
,
dest_str
);
ok
(
result
==
int2str
->
result
,
"(test %d): RtlIntegerToChar(%
lu, %d, %d, [out]) has result %lx, expected: %l
x
\n
"
,
"(test %d): RtlIntegerToChar(%
u, %d, %d, [out]) has result %x, expected: %
x
\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
int2str
->
MaximumLength
,
result
,
int2str
->
result
);
ok
(
memcmp
(
dest_str
,
int2str
->
Buffer
,
STRI_BUFFER_LENGTH
)
==
0
,
"(test %d): RtlIntegerToChar(%
l
u, %d, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): RtlIntegerToChar(%u, %d, %d, [out]) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
int2str
->
value
,
int2str
->
base
,
int2str
->
MaximumLength
,
dest_str
,
int2str
->
Buffer
);
}
...
...
@@ -1650,22 +1650,22 @@ static void test_RtlIntegerToChar(void)
result
=
pRtlIntegerToChar
(
int2str
[
0
].
value
,
20
,
int2str
[
0
].
MaximumLength
,
NULL
);
ok
(
result
==
STATUS_INVALID_PARAMETER
,
"(test a): RtlIntegerToChar(%
lu, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test a): RtlIntegerToChar(%
u, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
int2str
[
0
].
value
,
20
,
int2str
[
0
].
MaximumLength
,
result
,
STATUS_INVALID_PARAMETER
);
result
=
pRtlIntegerToChar
(
int2str
[
0
].
value
,
20
,
0
,
NULL
);
ok
(
result
==
STATUS_INVALID_PARAMETER
,
"(test b): RtlIntegerToChar(%
lu, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test b): RtlIntegerToChar(%
u, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
int2str
[
0
].
value
,
20
,
0
,
result
,
STATUS_INVALID_PARAMETER
);
result
=
pRtlIntegerToChar
(
int2str
[
0
].
value
,
int2str
[
0
].
base
,
0
,
NULL
);
ok
(
result
==
STATUS_BUFFER_OVERFLOW
,
"(test c): RtlIntegerToChar(%
lu, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test c): RtlIntegerToChar(%
u, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
int2str
[
0
].
value
,
int2str
[
0
].
base
,
0
,
result
,
STATUS_BUFFER_OVERFLOW
);
result
=
pRtlIntegerToChar
(
int2str
[
0
].
value
,
int2str
[
0
].
base
,
int2str
[
0
].
MaximumLength
,
NULL
);
ok
(
result
==
STATUS_ACCESS_VIOLATION
,
"(test d): RtlIntegerToChar(%
lu, %d, %d, NULL) has result %lx, expected: %l
x
\n
"
,
"(test d): RtlIntegerToChar(%
u, %d, %d, NULL) has result %x, expected: %
x
\n
"
,
int2str
[
0
].
value
,
int2str
[
0
].
base
,
int2str
[
0
].
MaximumLength
,
result
,
STATUS_ACCESS_VIOLATION
);
}
...
...
@@ -1688,7 +1688,7 @@ static void test_RtlGUIDFromString(void)
str
.
Buffer
=
(
LPWSTR
)
szGuid
;
ret
=
pRtlGUIDFromString
(
&
str
,
&
guid
);
ok
(
ret
==
0
,
"expected ret=0, got 0x%0
l
x
\n
"
,
ret
);
ok
(
ret
==
0
,
"expected ret=0, got 0x%0x
\n
"
,
ret
);
ok
(
memcmp
(
&
guid
,
&
IID_Endianess
,
sizeof
(
guid
))
==
0
,
"Endianess broken
\n
"
);
str
.
Length
=
str
.
MaximumLength
=
(
sizeof
(
szGuid2
)
-
1
)
/
sizeof
(
WCHAR
);
...
...
@@ -1707,7 +1707,7 @@ static void test_RtlStringFromGUID(void)
str
.
Buffer
=
NULL
;
ret
=
pRtlStringFromGUID
(
&
IID_Endianess
,
&
str
);
ok
(
ret
==
0
,
"expected ret=0, got 0x%0
l
x
\n
"
,
ret
);
ok
(
ret
==
0
,
"expected ret=0, got 0x%0x
\n
"
,
ret
);
ok
(
str
.
Buffer
&&
!
lstrcmpW
(
str
.
Buffer
,
szGuid
),
"Endianess broken
\n
"
);
}
...
...
dlls/ntdll/tests/string.c
View file @
8ddaf6cc
...
...
@@ -413,7 +413,7 @@ static void test_ulongtow(void)
expected_wstr
[
LARGE_STRI_BUFFER_LENGTH
]
=
'\0'
;
result
=
p_itow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test a): _itow(%
l
d, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test a): _itow(%d, NULL, 10) has result %p, expected: NULL
\n
"
,
ulong2str
[
0
].
value
,
result
);
for
(
pos
=
0
;
pos
<
LARGE_STRI_BUFFER_LENGTH
;
pos
++
)
{
...
...
@@ -422,7 +422,7 @@ static void test_ulongtow(void)
expected_wstr
[
LARGE_STRI_BUFFER_LENGTH
]
=
'\0'
;
result
=
p_ltow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test b): _ltow(%
l
d, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test b): _ltow(%d, NULL, 10) has result %p, expected: NULL
\n
"
,
ulong2str
[
0
].
value
,
result
);
for
(
pos
=
0
;
pos
<
LARGE_STRI_BUFFER_LENGTH
;
pos
++
)
{
...
...
@@ -431,7 +431,7 @@ static void test_ulongtow(void)
expected_wstr
[
LARGE_STRI_BUFFER_LENGTH
]
=
'\0'
;
result
=
p_ultow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test c): _ultow(%
l
d, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test c): _ultow(%d, NULL, 10) has result %p, expected: NULL
\n
"
,
ulong2str
[
0
].
value
,
result
);
}
...
...
@@ -673,7 +673,7 @@ static void one_i64tow_test(int test_num, const ulonglong2str_t *ulonglong2str)
result
=
p_i64tow
(
ulonglong2str
->
value
,
dest_wstr
,
ulonglong2str
->
base
);
pRtlUnicodeStringToAnsiString
(
&
ansi_str
,
&
unicode_string
,
1
);
ok
(
result
==
dest_wstr
,
"(test %d): _i64tow(0x%
lx%08l
x, [out], %d) has result %p, expected: %p
\n
"
,
"(test %d): _i64tow(0x%
x%08
x, [out], %d) has result %p, expected: %p
\n
"
,
test_num
,
(
DWORD
)(
ulonglong2str
->
value
>>
32
),
(
DWORD
)
ulonglong2str
->
value
,
ulonglong2str
->
base
,
result
,
dest_wstr
);
if
(
ulonglong2str
->
mask
&
0x04
)
{
...
...
@@ -684,14 +684,14 @@ static void one_i64tow_test(int test_num, const ulonglong2str_t *ulonglong2str)
expected_wstr
[
LARGE_STRI_BUFFER_LENGTH
]
=
'\0'
;
if
(
memcmp
(
dest_wstr
,
expected_wstr
,
LARGE_STRI_BUFFER_LENGTH
*
sizeof
(
WCHAR
))
!=
0
)
{
ok
(
memcmp
(
dest_wstr
,
expected_wstr
,
LARGE_STRI_BUFFER_LENGTH
*
sizeof
(
WCHAR
))
==
0
,
"(test %d): _i64tow(0x%lx%08l
x, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): _i64tow(0x%x%08
x, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
(
DWORD
)(
ulonglong2str
->
value
>>
32
),
(
DWORD
)
ulonglong2str
->
value
,
ulonglong2str
->
base
,
ansi_str
.
Buffer
,
ulonglong2str
->
Buffer
);
}
/* if */
}
/* if */
}
else
{
ok
(
memcmp
(
dest_wstr
,
expected_wstr
,
LARGE_STRI_BUFFER_LENGTH
*
sizeof
(
WCHAR
))
==
0
,
"(test %d): _i64tow(0x%lx%08l
x, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): _i64tow(0x%x%08
x, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
(
DWORD
)(
ulonglong2str
->
value
>>
32
),
(
DWORD
)
ulonglong2str
->
value
,
ulonglong2str
->
base
,
ansi_str
.
Buffer
,
ulonglong2str
->
Buffer
);
}
/* if */
...
...
@@ -724,11 +724,11 @@ static void one_ui64tow_test(int test_num, const ulonglong2str_t *ulonglong2str)
result
=
p_ui64tow
(
ulonglong2str
->
value
,
dest_wstr
,
ulonglong2str
->
base
);
pRtlUnicodeStringToAnsiString
(
&
ansi_str
,
&
unicode_string
,
1
);
ok
(
result
==
dest_wstr
,
"(test %d): _ui64tow(0x%
lx%08l
x, [out], %d) has result %p, expected: %p
\n
"
,
"(test %d): _ui64tow(0x%
x%08
x, [out], %d) has result %p, expected: %p
\n
"
,
test_num
,
(
DWORD
)(
ulonglong2str
->
value
>>
32
),
(
DWORD
)
ulonglong2str
->
value
,
ulonglong2str
->
base
,
result
,
dest_wstr
);
ok
(
memcmp
(
dest_wstr
,
expected_wstr
,
LARGE_STRI_BUFFER_LENGTH
*
sizeof
(
WCHAR
))
==
0
,
"(test %d): _ui64tow(0x%
lx%08l
x, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
"(test %d): _ui64tow(0x%
x%08
x, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
(
DWORD
)(
ulonglong2str
->
value
>>
32
),
(
DWORD
)
ulonglong2str
->
value
,
ulonglong2str
->
base
,
ansi_str
.
Buffer
,
ulonglong2str
->
Buffer
);
pRtlFreeAnsiString
(
&
ansi_str
);
...
...
@@ -759,7 +759,7 @@ static void test_ulonglongtow(void)
expected_wstr
[
LARGE_STRI_BUFFER_LENGTH
]
=
'\0'
;
result
=
p_i64tow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test d): _i64tow(0x%
lx%08l
x, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test d): _i64tow(0x%
x%08
x, NULL, 10) has result %p, expected: NULL
\n
"
,
(
DWORD
)(
ulonglong2str
[
0
].
value
>>
32
),
(
DWORD
)
ulonglong2str
[
0
].
value
,
result
);
if
(
p_ui64tow
)
{
...
...
@@ -769,7 +769,7 @@ static void test_ulonglongtow(void)
expected_wstr
[
LARGE_STRI_BUFFER_LENGTH
]
=
'\0'
;
result
=
p_ui64tow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test e): _ui64tow(0x%lx%08l
x, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test e): _ui64tow(0x%x%08
x, NULL, 10) has result %p, expected: NULL
\n
"
,
(
DWORD
)(
ulonglong2str
[
0
].
value
>>
32
),
(
DWORD
)
ulonglong2str
[
0
].
value
,
result
);
}
/* if */
}
...
...
@@ -896,7 +896,7 @@ static void test_wtoi(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
uni
,
str2long
[
test_num
].
str
);
result
=
p_wtoi
(
uni
.
Buffer
);
ok
(
result
==
str2long
[
test_num
].
value
,
"(test %d): call failed: _wtoi(
\"
%s
\"
) has result %d, expected: %l
d
\n
"
,
"(test %d): call failed: _wtoi(
\"
%s
\"
) has result %d, expected: %
d
\n
"
,
test_num
,
str2long
[
test_num
].
str
,
result
,
str2long
[
test_num
].
value
);
pRtlFreeUnicodeString
(
&
uni
);
}
/* for */
...
...
@@ -913,7 +913,7 @@ static void test_wtol(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
uni
,
str2long
[
test_num
].
str
);
result
=
p_wtol
(
uni
.
Buffer
);
ok
(
result
==
str2long
[
test_num
].
value
,
"(test %d): call failed: _wtol(
\"
%s
\"
) has result %ld, expected: %l
d
\n
"
,
"(test %d): call failed: _wtol(
\"
%s
\"
) has result %d, expected: %
d
\n
"
,
test_num
,
str2long
[
test_num
].
str
,
result
,
str2long
[
test_num
].
value
);
pRtlFreeUnicodeString
(
&
uni
);
}
/* for */
...
...
@@ -1051,7 +1051,7 @@ static void test_atoi64(void)
for
(
test_num
=
0
;
test_num
<
NB_STR2LONGLONG
;
test_num
++
)
{
result
=
p_atoi64
(
str2longlong
[
test_num
].
str
);
ok
(
result
==
str2longlong
[
test_num
].
value
,
"(test %d): call failed: _atoi64(
\"
%s
\"
) has result 0x%lx%08lx, expected: 0x%lx%08l
x
\n
"
,
"(test %d): call failed: _atoi64(
\"
%s
\"
) has result 0x%x%08x, expected: 0x%x%08
x
\n
"
,
test_num
,
str2longlong
[
test_num
].
str
,
(
DWORD
)(
result
>>
32
),
(
DWORD
)
result
,
(
DWORD
)(
str2longlong
[
test_num
].
value
>>
32
),
(
DWORD
)
str2longlong
[
test_num
].
value
);
}
/* for */
...
...
@@ -1068,7 +1068,7 @@ static void test_wtoi64(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
uni
,
str2longlong
[
test_num
].
str
);
result
=
p_wtoi64
(
uni
.
Buffer
);
ok
(
result
==
str2longlong
[
test_num
].
value
,
"(test %d): call failed: _wtoi64(
\"
%s
\"
) has result 0x%lx%08lx, expected: 0x%lx%08l
x
\n
"
,
"(test %d): call failed: _wtoi64(
\"
%s
\"
) has result 0x%x%08x, expected: 0x%x%08
x
\n
"
,
test_num
,
str2longlong
[
test_num
].
str
,
(
DWORD
)(
result
>>
32
),
(
DWORD
)
result
,
(
DWORD
)(
str2longlong
[
test_num
].
value
>>
32
),
(
DWORD
)
str2longlong
[
test_num
].
value
);
pRtlFreeUnicodeString
(
&
uni
);
...
...
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