Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ce7c3b50
Commit
ce7c3b50
authored
Jan 27, 2004
by
Francois Gouget
Committed by
Alexandre Julliard
Jan 27, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add trailing '\n's to ok() calls.
parent
333ecf3b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
526 additions
and
526 deletions
+526
-526
file.c
dlls/kernel/tests/file.c
+205
-205
format_msg.c
dlls/kernel/tests/format_msg.c
+58
-58
access.c
dlls/netapi32/tests/access.c
+23
-23
apibuf.c
dlls/netapi32/tests/apibuf.c
+20
-20
wksta.c
dlls/netapi32/tests/wksta.c
+22
-22
clist.c
dlls/shlwapi/tests/clist.c
+103
-103
clsid.c
dlls/shlwapi/tests/clsid.c
+15
-15
path.c
dlls/shlwapi/tests/path.c
+7
-7
shreg.c
dlls/shlwapi/tests/shreg.c
+41
-41
string.c
dlls/shlwapi/tests/string.c
+32
-32
No files found.
dlls/kernel/tests/file.c
View file @
ce7c3b50
...
@@ -55,35 +55,35 @@ static void test__hread( void )
...
@@ -55,35 +55,35 @@ static void test__hread( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't open file
\"
%s
\"
again (err=%ld)"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't open file
\"
%s
\"
again (err=%ld)
\n
"
,
filename
,
GetLastError
(
)
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
ok
(
lstrlenA
(
sillytext
)
==
bytes_read
,
"file read size error"
);
ok
(
lstrlenA
(
sillytext
)
==
bytes_read
,
"file read size error
\n
"
);
for
(
bytes_wanted
=
0
;
bytes_wanted
<
lstrlenA
(
sillytext
);
bytes_wanted
++
)
for
(
bytes_wanted
=
0
;
bytes_wanted
<
lstrlenA
(
sillytext
);
bytes_wanted
++
)
{
{
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains
\n
"
);
ok
(
_hread
(
filehandle
,
buffer
,
bytes_wanted
)
==
bytes_wanted
,
"erratic _hread return value"
);
ok
(
_hread
(
filehandle
,
buffer
,
bytes_wanted
)
==
bytes_wanted
,
"erratic _hread return value
\n
"
);
for
(
i
=
0
;
i
<
bytes_wanted
;
i
++
)
for
(
i
=
0
;
i
<
bytes_wanted
;
i
++
)
{
{
ok
(
buffer
[
i
]
==
sillytext
[
i
],
"that's not what's written"
);
ok
(
buffer
[
i
]
==
sillytext
[
i
],
"that's not what's written
\n
"
);
}
}
}
}
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
}
...
@@ -102,21 +102,21 @@ static void test__hwrite( void )
...
@@ -102,21 +102,21 @@ static void test__hwrite( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
""
,
0
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
""
,
0
),
"_hwrite complains
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
ok
(
0
==
bytes_read
,
"file read size error"
);
ok
(
0
==
bytes_read
,
"file read size error
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
...
@@ -130,18 +130,18 @@ static void test__hwrite( void )
...
@@ -130,18 +130,18 @@ static void test__hwrite( void )
buffer
[
i
]
=
rand
(
);
buffer
[
i
]
=
rand
(
);
checksum
[
0
]
=
checksum
[
0
]
+
buffer
[
i
];
checksum
[
0
]
=
checksum
[
0
]
+
buffer
[
i
];
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
buffer
,
sizeof
(
buffer
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
buffer
,
sizeof
(
buffer
)
),
"_hwrite complains
\n
"
);
bytes_written
=
bytes_written
+
sizeof
(
buffer
);
bytes_written
=
bytes_written
+
sizeof
(
buffer
);
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
checksum
,
1
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
checksum
,
1
),
"_hwrite complains
\n
"
);
bytes_written
++
;
bytes_written
++
;
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
memory_object
=
LocalAlloc
(
LPTR
,
bytes_written
);
memory_object
=
LocalAlloc
(
LPTR
,
bytes_written
);
ok
(
0
!=
memory_object
,
"LocalAlloc fails. (Could be out of memory.)"
);
ok
(
0
!=
memory_object
,
"LocalAlloc fails. (Could be out of memory.)
\n
"
);
contents
=
LocalLock
(
memory_object
);
contents
=
LocalLock
(
memory_object
);
...
@@ -149,9 +149,9 @@ static void test__hwrite( void )
...
@@ -149,9 +149,9 @@ static void test__hwrite( void )
contents
=
LocalLock
(
memory_object
);
contents
=
LocalLock
(
memory_object
);
ok
(
NULL
!=
contents
,
"LocalLock whines"
);
ok
(
NULL
!=
contents
,
"LocalLock whines
\n
"
);
ok
(
bytes_written
==
_hread
(
filehandle
,
contents
,
bytes_written
),
"read length differ from write length"
);
ok
(
bytes_written
==
_hread
(
filehandle
,
contents
,
bytes_written
),
"read length differ from write length
\n
"
);
checksum
[
0
]
=
'\0'
;
checksum
[
0
]
=
'\0'
;
i
=
0
;
i
=
0
;
...
@@ -162,11 +162,11 @@ static void test__hwrite( void )
...
@@ -162,11 +162,11 @@ static void test__hwrite( void )
}
}
while
(
i
<
bytes_written
-
1
);
while
(
i
<
bytes_written
-
1
);
ok
(
checksum
[
0
]
==
contents
[
i
],
"stored checksum differ from computed checksum"
);
ok
(
checksum
[
0
]
==
contents
[
i
],
"stored checksum differ from computed checksum
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
}
...
@@ -177,15 +177,15 @@ static void test__lclose( void )
...
@@ -177,15 +177,15 @@ static void test__lclose( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
}
...
@@ -201,107 +201,107 @@ static void test__lcreat( void )
...
@@ -201,107 +201,107 @@ static void test__lcreat( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains
\n
"
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
lstrlenA
(
sillytext
),
"erratic _hread return value"
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
lstrlenA
(
sillytext
),
"erratic _hread return value
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should be able to find file"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should be able to find file
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
());
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
());
filehandle
=
_lcreat
(
filename
,
1
);
/* readonly */
filehandle
=
_lcreat
(
filename
,
1
);
/* readonly */
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite shouldn't be able to write never the less"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite shouldn't be able to write never the less
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should be able to find file"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should be able to find file
\n
"
);
ok
(
0
==
DeleteFileA
(
filename
),
"shouldn't be able to delete a readonly file"
);
ok
(
0
==
DeleteFileA
(
filename
),
"shouldn't be able to delete a readonly file
\n
"
);
ok
(
SetFileAttributesA
(
filename
,
FILE_ATTRIBUTE_NORMAL
)
!=
0
,
"couldn't change attributes on file"
);
ok
(
SetFileAttributesA
(
filename
,
FILE_ATTRIBUTE_NORMAL
)
!=
0
,
"couldn't change attributes on file
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"now it should be possible to delete the file!"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"now it should be possible to delete the file!
\n
"
);
filehandle
=
_lcreat
(
filename
,
2
);
filehandle
=
_lcreat
(
filename
,
2
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains
\n
"
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
lstrlenA
(
sillytext
),
"erratic _hread return value"
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
lstrlenA
(
sillytext
),
"erratic _hread return value
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should STILL be able to find file"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should STILL be able to find file
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
filehandle
=
_lcreat
(
filename
,
4
);
/* SYSTEM file */
filehandle
=
_lcreat
(
filename
,
4
);
/* SYSTEM file */
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
(
)
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains
\n
"
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
lstrlenA
(
sillytext
),
"erratic _hread return value"
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
lstrlenA
(
sillytext
),
"erratic _hread return value
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should STILL be able to find file"
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should STILL be able to find file
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
filehandle
=
_lcreat
(
slashname
,
0
);
/* illegal name */
filehandle
=
_lcreat
(
slashname
,
0
);
/* illegal name */
if
(
HFILE_ERROR
==
filehandle
)
{
if
(
HFILE_ERROR
==
filehandle
)
{
err
=
GetLastError
();
err
=
GetLastError
();
ok
(
err
==
ERROR_INVALID_NAME
||
err
==
ERROR_PATH_NOT_FOUND
,
ok
(
err
==
ERROR_INVALID_NAME
||
err
==
ERROR_PATH_NOT_FOUND
,
"creating file
\"
%s
\"
failed with error %d"
,
slashname
,
err
);
"creating file
\"
%s
\"
failed with error %d
\n
"
,
slashname
,
err
);
}
else
{
/* only NT succeeds */
}
else
{
/* only NT succeeds */
_lclose
(
filehandle
);
_lclose
(
filehandle
);
find
=
FindFirstFileA
(
slashname
,
&
search_results
);
find
=
FindFirstFileA
(
slashname
,
&
search_results
);
if
(
INVALID_HANDLE_VALUE
==
find
)
if
(
INVALID_HANDLE_VALUE
==
find
)
ok
(
0
,
"file
\"
%s
\"
not found"
,
slashname
);
ok
(
0
,
"file
\"
%s
\"
not found
\n
"
,
slashname
);
else
{
else
{
ok
(
0
!=
FindClose
(
find
),
"FindClose complains (%ld)"
,
GetLastError
());
ok
(
0
!=
FindClose
(
find
),
"FindClose complains (%ld)
\n
"
,
GetLastError
());
slashname
[
strlen
(
slashname
)
-
1
]
=
0
;
slashname
[
strlen
(
slashname
)
-
1
]
=
0
;
ok
(
!
strcmp
(
slashname
,
search_results
.
cFileName
),
ok
(
!
strcmp
(
slashname
,
search_results
.
cFileName
),
"found unexpected name
\"
%s
\"
"
,
search_results
.
cFileName
);
"found unexpected name
\"
%s
\"
\n
"
,
search_results
.
cFileName
);
ok
(
FILE_ATTRIBUTE_ARCHIVE
==
search_results
.
dwFileAttributes
,
ok
(
FILE_ATTRIBUTE_ARCHIVE
==
search_results
.
dwFileAttributes
,
"attributes of file
\"
%s
\"
are 0x%04lx"
,
search_results
.
cFileName
,
"attributes of file
\"
%s
\"
are 0x%04lx
\n
"
,
search_results
.
cFileName
,
search_results
.
dwFileAttributes
);
search_results
.
dwFileAttributes
);
}
}
ok
(
0
!=
DeleteFileA
(
slashname
),
"Can't delete
\"
%s
\"
(%ld)"
,
slashname
,
ok
(
0
!=
DeleteFileA
(
slashname
),
"Can't delete
\"
%s
\"
(%ld)
\n
"
,
slashname
,
GetLastError
());
GetLastError
());
}
}
filehandle
=
_lcreat
(
filename
,
8
);
/* illegal attribute */
filehandle
=
_lcreat
(
filename
,
8
);
/* illegal attribute */
if
(
HFILE_ERROR
==
filehandle
)
if
(
HFILE_ERROR
==
filehandle
)
ok
(
0
,
"couldn't create volume label
\"
%s
\"
"
,
filename
);
ok
(
0
,
"couldn't create volume label
\"
%s
\"
\n
"
,
filename
);
else
{
else
{
_lclose
(
filehandle
);
_lclose
(
filehandle
);
find
=
FindFirstFileA
(
filename
,
&
search_results
);
find
=
FindFirstFileA
(
filename
,
&
search_results
);
if
(
INVALID_HANDLE_VALUE
==
find
)
if
(
INVALID_HANDLE_VALUE
==
find
)
ok
(
0
,
"file
\"
%s
\"
not found"
,
filename
);
ok
(
0
,
"file
\"
%s
\"
not found
\n
"
,
filename
);
else
{
else
{
ok
(
0
!=
FindClose
(
find
),
"FindClose complains (%ld)"
,
GetLastError
());
ok
(
0
!=
FindClose
(
find
),
"FindClose complains (%ld)
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
filename
,
search_results
.
cFileName
),
ok
(
!
strcmp
(
filename
,
search_results
.
cFileName
),
"found unexpected name
\"
%s
\"
"
,
search_results
.
cFileName
);
"found unexpected name
\"
%s
\"
\n
"
,
search_results
.
cFileName
);
ok
(
FILE_ATTRIBUTE_ARCHIVE
==
search_results
.
dwFileAttributes
,
ok
(
FILE_ATTRIBUTE_ARCHIVE
==
search_results
.
dwFileAttributes
,
"attributes of file
\"
%s
\"
are 0x%04lx"
,
search_results
.
cFileName
,
"attributes of file
\"
%s
\"
are 0x%04lx
\n
"
,
search_results
.
cFileName
,
search_results
.
dwFileAttributes
);
search_results
.
dwFileAttributes
);
}
}
ok
(
0
!=
DeleteFileA
(
filename
),
"Can't delete
\"
%s
\"
(%ld)"
,
slashname
,
ok
(
0
!=
DeleteFileA
(
filename
),
"Can't delete
\"
%s
\"
(%ld)
\n
"
,
slashname
,
GetLastError
());
GetLastError
());
}
}
}
}
...
@@ -317,29 +317,29 @@ static void test__llseek( void )
...
@@ -317,29 +317,29 @@ static void test__llseek( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
for
(
i
=
0
;
i
<
400
;
i
++
)
for
(
i
=
0
;
i
<
400
;
i
++
)
{
{
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
}
}
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
400
*
strlen
(
sillytext
),
FILE_CURRENT
),
"should be able to seek"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
400
*
strlen
(
sillytext
),
FILE_CURRENT
),
"should be able to seek
\n
"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
27
+
35
*
strlen
(
sillytext
),
FILE_BEGIN
),
"should be able to seek"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
27
+
35
*
strlen
(
sillytext
),
FILE_BEGIN
),
"should be able to seek
\n
"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
ok
(
1
==
bytes_read
,
"file read size error"
);
ok
(
1
==
bytes_read
,
"file read size error
\n
"
);
ok
(
buffer
[
0
]
==
sillytext
[
27
],
"_llseek error, it got lost seeking"
);
ok
(
buffer
[
0
]
==
sillytext
[
27
],
"_llseek error, it got lost seeking
\n
"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
-
400
*
strlen
(
sillytext
),
FILE_END
),
"should be able to seek"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
-
400
*
strlen
(
sillytext
),
FILE_END
),
"should be able to seek
\n
"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
ok
(
1
==
bytes_read
,
"file read size error"
);
ok
(
1
==
bytes_read
,
"file read size error
\n
"
);
ok
(
buffer
[
0
]
==
sillytext
[
0
],
"_llseek error, it got lost seeking"
);
ok
(
buffer
[
0
]
==
sillytext
[
0
],
"_llseek error, it got lost seeking
\n
"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
1000000
,
FILE_END
),
"should be able to seek past file; poor, poor Windows programmers"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
1000000
,
FILE_END
),
"should be able to seek past file; poor, poor Windows programmers
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
}
...
@@ -352,31 +352,31 @@ static void test__llopen( void )
...
@@ -352,31 +352,31 @@ static void test__llopen( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
ok
(
HFILE_ERROR
==
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite shouldn't be able to write!"
);
ok
(
HFILE_ERROR
==
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite shouldn't be able to write!
\n
"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
);
ok
(
strlen
(
sillytext
)
==
bytes_read
,
"file read size error"
);
ok
(
strlen
(
sillytext
)
==
bytes_read
,
"file read size error
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
ok
(
strlen
(
sillytext
)
==
bytes_read
,
"file read size error"
);
ok
(
strlen
(
sillytext
)
==
bytes_read
,
"file read size error
\n
"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite should write just fine"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite should write just fine
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_WRITE
);
filehandle
=
_lopen
(
filename
,
OF_WRITE
);
ok
(
HFILE_ERROR
==
_hread
(
filehandle
,
buffer
,
1
),
"you should only be able to write this file"
);
ok
(
HFILE_ERROR
==
_hread
(
filehandle
,
buffer
,
1
),
"you should only be able to write this file
\n
"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite should write just fine"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite should write just fine
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
/* TODO - add tests for the SHARE modes - use two processes to pull this one off */
/* TODO - add tests for the SHARE modes - use two processes to pull this one off */
}
}
...
@@ -392,35 +392,35 @@ static void test__lread( void )
...
@@ -392,35 +392,35 @@ static void test__lread( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't open file
\"
%s
\"
again (err=%ld)"
,
filename
,
GetLastError
());
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't open file
\"
%s
\"
again (err=%ld)
\n
"
,
filename
,
GetLastError
());
bytes_read
=
_lread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
bytes_read
=
_lread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
ok
(
lstrlenA
(
sillytext
)
==
bytes_read
,
"file read size error"
);
ok
(
lstrlenA
(
sillytext
)
==
bytes_read
,
"file read size error
\n
"
);
for
(
bytes_wanted
=
0
;
bytes_wanted
<
strlen
(
sillytext
);
bytes_wanted
++
)
for
(
bytes_wanted
=
0
;
bytes_wanted
<
strlen
(
sillytext
);
bytes_wanted
++
)
{
{
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains"
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains
\n
"
);
ok
(
_lread
(
filehandle
,
buffer
,
bytes_wanted
)
==
bytes_wanted
,
"erratic _hread return value"
);
ok
(
_lread
(
filehandle
,
buffer
,
bytes_wanted
)
==
bytes_wanted
,
"erratic _hread return value
\n
"
);
for
(
i
=
0
;
i
<
bytes_wanted
;
i
++
)
for
(
i
=
0
;
i
<
bytes_wanted
;
i
++
)
{
{
ok
(
buffer
[
i
]
==
sillytext
[
i
],
"that's not what's written"
);
ok
(
buffer
[
i
]
==
sillytext
[
i
],
"that's not what's written
\n
"
);
}
}
}
}
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
}
...
@@ -439,21 +439,21 @@ static void test__lwrite( void )
...
@@ -439,21 +439,21 @@ static void test__lwrite( void )
filehandle
=
_lcreat
(
filename
,
0
);
filehandle
=
_lcreat
(
filename
,
0
);
if
(
filehandle
==
HFILE_ERROR
)
if
(
filehandle
==
HFILE_ERROR
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
HFILE_ERROR
!=
_lwrite
(
filehandle
,
""
,
0
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_lwrite
(
filehandle
,
""
,
0
),
"_hwrite complains
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
ok
(
0
==
bytes_read
,
"file read size error"
);
ok
(
0
==
bytes_read
,
"file read size error
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
...
@@ -467,18 +467,18 @@ static void test__lwrite( void )
...
@@ -467,18 +467,18 @@ static void test__lwrite( void )
buffer
[
i
]
=
rand
(
);
buffer
[
i
]
=
rand
(
);
checksum
[
0
]
=
checksum
[
0
]
+
buffer
[
i
];
checksum
[
0
]
=
checksum
[
0
]
+
buffer
[
i
];
}
}
ok
(
HFILE_ERROR
!=
_lwrite
(
filehandle
,
buffer
,
sizeof
(
buffer
)
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_lwrite
(
filehandle
,
buffer
,
sizeof
(
buffer
)
),
"_hwrite complains
\n
"
);
bytes_written
=
bytes_written
+
sizeof
(
buffer
);
bytes_written
=
bytes_written
+
sizeof
(
buffer
);
}
}
ok
(
HFILE_ERROR
!=
_lwrite
(
filehandle
,
checksum
,
1
),
"_hwrite complains"
);
ok
(
HFILE_ERROR
!=
_lwrite
(
filehandle
,
checksum
,
1
),
"_hwrite complains
\n
"
);
bytes_written
++
;
bytes_written
++
;
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
memory_object
=
LocalAlloc
(
LPTR
,
bytes_written
);
memory_object
=
LocalAlloc
(
LPTR
,
bytes_written
);
ok
(
0
!=
memory_object
,
"LocalAlloc fails, could be out of memory"
);
ok
(
0
!=
memory_object
,
"LocalAlloc fails, could be out of memory
\n
"
);
contents
=
LocalLock
(
memory_object
);
contents
=
LocalLock
(
memory_object
);
...
@@ -486,9 +486,9 @@ static void test__lwrite( void )
...
@@ -486,9 +486,9 @@ static void test__lwrite( void )
contents
=
LocalLock
(
memory_object
);
contents
=
LocalLock
(
memory_object
);
ok
(
NULL
!=
contents
,
"LocalLock whines"
);
ok
(
NULL
!=
contents
,
"LocalLock whines
\n
"
);
ok
(
bytes_written
==
_hread
(
filehandle
,
contents
,
bytes_written
),
"read length differ from write length"
);
ok
(
bytes_written
==
_hread
(
filehandle
,
contents
,
bytes_written
),
"read length differ from write length
\n
"
);
checksum
[
0
]
=
'\0'
;
checksum
[
0
]
=
'\0'
;
i
=
0
;
i
=
0
;
...
@@ -499,11 +499,11 @@ static void test__lwrite( void )
...
@@ -499,11 +499,11 @@ static void test__lwrite( void )
}
}
while
(
i
<
bytes_written
-
1
);
while
(
i
<
bytes_written
-
1
);
ok
(
checksum
[
0
]
==
contents
[
i
],
"stored checksum differ from computed checksum"
);
ok
(
checksum
[
0
]
==
contents
[
i
],
"stored checksum differ from computed checksum
\n
"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains"
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains
\n
"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)"
,
GetLastError
(
)
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
}
static
void
test_CopyFileA
(
void
)
static
void
test_CopyFileA
(
void
)
...
@@ -514,14 +514,14 @@ static void test_CopyFileA(void)
...
@@ -514,14 +514,14 @@ static void test_CopyFileA(void)
DWORD
ret
;
DWORD
ret
;
ret
=
GetTempPathA
(
MAX_PATH
,
temp_path
);
ret
=
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
ret
!=
0
,
"GetTempPathA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempPathA error %ld
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH"
);
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
source
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
source
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
dest
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
dest
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
ret
=
CopyFileA
(
source
,
dest
,
TRUE
);
ret
=
CopyFileA
(
source
,
dest
,
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
...
@@ -546,14 +546,14 @@ static void test_CopyFileW(void)
...
@@ -546,14 +546,14 @@ static void test_CopyFileW(void)
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
;
return
;
ok
(
ret
!=
0
,
"GetTempPathW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempPathW error %ld
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH"
);
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
source
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
source
);
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld
\n
"
,
GetLastError
());
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
dest
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
dest
);
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld
\n
"
,
GetLastError
());
ret
=
CopyFileW
(
source
,
dest
,
TRUE
);
ret
=
CopyFileW
(
source
,
dest
,
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
...
@@ -577,16 +577,16 @@ static void test_CreateFileA(void)
...
@@ -577,16 +577,16 @@ static void test_CreateFileA(void)
DWORD
ret
;
DWORD
ret
;
ret
=
GetTempPathA
(
MAX_PATH
,
temp_path
);
ret
=
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
ret
!=
0
,
"GetTempPathA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempPathA error %ld
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH"
);
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
filename
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
filename
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
hFile
=
CreateFileA
(
filename
,
GENERIC_READ
,
0
,
NULL
,
hFile
=
CreateFileA
(
filename
,
GENERIC_READ
,
0
,
NULL
,
CREATE_NEW
,
FILE_FLAG_RANDOM_ACCESS
,
0
);
CREATE_NEW
,
FILE_FLAG_RANDOM_ACCESS
,
0
);
ok
(
hFile
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
ok
(
hFile
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS"
);
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS
\n
"
);
ret
=
DeleteFileA
(
filename
);
ret
=
DeleteFileA
(
filename
);
ok
(
ret
,
"DeleteFileA: error %ld
\n
"
,
GetLastError
());
ok
(
ret
,
"DeleteFileA: error %ld
\n
"
,
GetLastError
());
...
@@ -603,16 +603,16 @@ static void test_CreateFileW(void)
...
@@ -603,16 +603,16 @@ static void test_CreateFileW(void)
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
;
return
;
ok
(
ret
!=
0
,
"GetTempPathW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempPathW error %ld
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH"
);
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
filename
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
filename
);
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld
\n
"
,
GetLastError
());
hFile
=
CreateFileW
(
filename
,
GENERIC_READ
,
0
,
NULL
,
hFile
=
CreateFileW
(
filename
,
GENERIC_READ
,
0
,
NULL
,
CREATE_NEW
,
FILE_FLAG_RANDOM_ACCESS
,
0
);
CREATE_NEW
,
FILE_FLAG_RANDOM_ACCESS
,
0
);
ok
(
hFile
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
ok
(
hFile
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS"
);
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS
\n
"
);
ret
=
DeleteFileW
(
filename
);
ret
=
DeleteFileW
(
filename
);
ok
(
ret
,
"DeleteFileW: error %ld
\n
"
,
GetLastError
());
ok
(
ret
,
"DeleteFileW: error %ld
\n
"
,
GetLastError
());
...
@@ -627,7 +627,7 @@ static void test_GetTempFileNameA() {
...
@@ -627,7 +627,7 @@ static void test_GetTempFileNameA() {
/* this test may depend on the config file settings */
/* this test may depend on the config file settings */
result
=
GetTempFileNameA
(
"C:"
,
"abc"
,
1
,
out
);
result
=
GetTempFileNameA
(
"C:"
,
"abc"
,
1
,
out
);
ok
(
result
!=
0
,
"GetTempFileNameA: error %ld
\n
"
,
GetLastError
()
);
ok
(
result
!=
0
,
"GetTempFileNameA: error %ld
\n
"
,
GetLastError
()
);
ok
(
((
out
[
0
]
==
'C'
)
&&
(
out
[
1
]
==
':'
))
&&
(
out
[
2
]
==
'\\'
),
"GetTempFileNameA: first three characters should be C:
\\
, string was actually %s"
,
out
);
ok
(
((
out
[
0
]
==
'C'
)
&&
(
out
[
1
]
==
':'
))
&&
(
out
[
2
]
==
'\\'
),
"GetTempFileNameA: first three characters should be C:
\\
, string was actually %s
\n
"
,
out
);
result
=
GetTempFileNameA
(
"c:
\\
windows
\\
"
,
"abc"
,
2
,
out
);
result
=
GetTempFileNameA
(
"c:
\\
windows
\\
"
,
"abc"
,
2
,
out
);
ok
(
result
!=
0
,
"GetTempFileNameA: error %ld
\n
"
,
GetLastError
()
);
ok
(
result
!=
0
,
"GetTempFileNameA: error %ld
\n
"
,
GetLastError
()
);
...
@@ -642,12 +642,12 @@ static void test_DeleteFileA( void )
...
@@ -642,12 +642,12 @@ static void test_DeleteFileA( void )
ret
=
DeleteFileA
(
NULL
);
ret
=
DeleteFileA
(
NULL
);
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
"DeleteFileA(NULL) returned ret=%d error=%ld"
,
ret
,
GetLastError
());
"DeleteFileA(NULL) returned ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
ret
=
DeleteFileA
(
""
);
ret
=
DeleteFileA
(
""
);
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
||
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
||
GetLastError
()
==
ERROR_BAD_PATHNAME
),
GetLastError
()
==
ERROR_BAD_PATHNAME
),
"DeleteFileA(
\"\"
) returned ret=%d error=%ld"
,
ret
,
GetLastError
());
"DeleteFileA(
\"\"
) returned ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
}
}
static
void
test_DeleteFileW
(
void
)
static
void
test_DeleteFileW
(
void
)
...
@@ -659,11 +659,11 @@ static void test_DeleteFileW( void )
...
@@ -659,11 +659,11 @@ static void test_DeleteFileW( void )
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
;
return
;
ok
(
!
ret
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"DeleteFileW(NULL) returned ret=%d error=%ld"
,
ret
,
GetLastError
());
"DeleteFileW(NULL) returned ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
ret
=
DeleteFileW
(
emptyW
);
ret
=
DeleteFileW
(
emptyW
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"DeleteFileW(
\"\"
) returned ret=%d error=%ld"
,
ret
,
GetLastError
());
"DeleteFileW(
\"\"
) returned ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
}
}
#define IsDotDir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
#define IsDotDir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
...
@@ -676,14 +676,14 @@ static void test_MoveFileA(void)
...
@@ -676,14 +676,14 @@ static void test_MoveFileA(void)
DWORD
ret
;
DWORD
ret
;
ret
=
GetTempPathA
(
MAX_PATH
,
tempdir
);
ret
=
GetTempPathA
(
MAX_PATH
,
tempdir
);
ok
(
ret
!=
0
,
"GetTempPathA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempPathA error %ld
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH"
);
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameA
(
tempdir
,
prefix
,
0
,
source
);
ret
=
GetTempFileNameA
(
tempdir
,
prefix
,
0
,
source
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
ret
=
GetTempFileNameA
(
tempdir
,
prefix
,
0
,
dest
);
ret
=
GetTempFileNameA
(
tempdir
,
prefix
,
0
,
dest
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
ret
=
MoveFileA
(
source
,
dest
);
ret
=
MoveFileA
(
source
,
dest
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
...
@@ -697,14 +697,14 @@ static void test_MoveFileA(void)
...
@@ -697,14 +697,14 @@ static void test_MoveFileA(void)
lstrcatA
(
tempdir
,
"Remove Me"
);
lstrcatA
(
tempdir
,
"Remove Me"
);
ret
=
CreateDirectoryA
(
tempdir
,
NULL
);
ret
=
CreateDirectoryA
(
tempdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA failed"
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA failed
\n
"
);
lstrcpyA
(
source
,
dest
);
lstrcpyA
(
source
,
dest
);
lstrcpyA
(
dest
,
tempdir
);
lstrcpyA
(
dest
,
tempdir
);
lstrcatA
(
dest
,
"
\\
wild?.*"
);
lstrcatA
(
dest
,
"
\\
wild?.*"
);
ret
=
MoveFileA
(
source
,
dest
);
ret
=
MoveFileA
(
source
,
dest
);
todo_wine
{
todo_wine
{
ok
(
!
ret
,
"MoveFileA: shouldn't move to wildcard file"
);
ok
(
!
ret
,
"MoveFileA: shouldn't move to wildcard file
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_NAME
,
ok
(
GetLastError
()
==
ERROR_INVALID_NAME
,
"MoveFileA: with wildcards, unexpected error %ld
\n
"
,
GetLastError
());
"MoveFileA: with wildcards, unexpected error %ld
\n
"
,
GetLastError
());
#if 0
#if 0
...
@@ -725,7 +725,7 @@ static void test_MoveFileA(void)
...
@@ -725,7 +725,7 @@ static void test_MoveFileA(void)
lpName = fd.cAlternateFileName;
lpName = fd.cAlternateFileName;
if (!lpName[0])
if (!lpName[0])
lpName = fd.cFileName;
lpName = fd.cFileName;
ok(IsDotDir(lpName), "MoveFileA: wildcards file created!");
ok(IsDotDir(lpName), "MoveFileA: wildcards file created!
\n
");
}
}
while (FindNextFileA(hFind, &fd));
while (FindNextFileA(hFind, &fd));
FindClose(hFind);
FindClose(hFind);
...
@@ -752,14 +752,14 @@ static void test_MoveFileW(void)
...
@@ -752,14 +752,14 @@ static void test_MoveFileW(void)
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
ret
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
;
return
;
ok
(
ret
!=
0
,
"GetTempPathW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempPathW error %ld
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH"
);
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
source
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
source
);
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld
\n
"
,
GetLastError
());
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
dest
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
dest
);
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameW error %ld
\n
"
,
GetLastError
());
ret
=
MoveFileW
(
source
,
dest
);
ret
=
MoveFileW
(
source
,
dest
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
...
@@ -783,17 +783,17 @@ static void test_offset_in_overlapped_structure(void)
...
@@ -783,17 +783,17 @@ static void test_offset_in_overlapped_structure(void)
UINT
i
;
UINT
i
;
char
temp_path
[
MAX_PATH
],
temp_fname
[
MAX_PATH
];
char
temp_path
[
MAX_PATH
],
temp_fname
[
MAX_PATH
];
ok
(
GetTempPathA
(
MAX_PATH
,
temp_path
)
!=
0
,
"GetTempPathA error %ld"
,
GetLastError
());
ok
(
GetTempPathA
(
MAX_PATH
,
temp_path
)
!=
0
,
"GetTempPathA error %ld
\n
"
,
GetLastError
());
ok
(
GetTempFileNameA
(
temp_path
,
"pfx"
,
0
,
temp_fname
)
!=
0
,
"GetTempFileNameA error %ld"
,
GetLastError
());
ok
(
GetTempFileNameA
(
temp_path
,
"pfx"
,
0
,
temp_fname
)
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
/*** Write File *****************************************************/
/*** Write File *****************************************************/
hFile
=
CreateFileA
(
temp_fname
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
0
);
hFile
=
CreateFileA
(
temp_fname
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
0
);
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileA error %ld"
,
GetLastError
());
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileA error %ld
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
sizeof
(
buf
);
i
++
)
buf
[
i
]
=
i
;
for
(
i
=
0
;
i
<
sizeof
(
buf
);
i
++
)
buf
[
i
]
=
i
;
ok
(
WriteFile
(
hFile
,
buf
,
sizeof
(
buf
),
&
done
,
NULL
),
"WriteFile error %ld"
,
GetLastError
());
ok
(
WriteFile
(
hFile
,
buf
,
sizeof
(
buf
),
&
done
,
NULL
),
"WriteFile error %ld
\n
"
,
GetLastError
());
ok
(
done
==
sizeof
(
buf
),
"expected number of bytes written %lu"
,
done
);
ok
(
done
==
sizeof
(
buf
),
"expected number of bytes written %lu
\n
"
,
done
);
memset
(
&
ov
,
0
,
sizeof
(
ov
));
memset
(
&
ov
,
0
,
sizeof
(
ov
));
ov
.
Offset
=
PATTERN_OFFSET
;
ov
.
Offset
=
PATTERN_OFFSET
;
...
@@ -801,19 +801,19 @@ static void test_offset_in_overlapped_structure(void)
...
@@ -801,19 +801,19 @@ static void test_offset_in_overlapped_structure(void)
rc
=
WriteFile
(
hFile
,
pattern
,
sizeof
(
pattern
),
&
done
,
&
ov
);
rc
=
WriteFile
(
hFile
,
pattern
,
sizeof
(
pattern
),
&
done
,
&
ov
);
/* Win 9x does not support the overlapped I/O on files */
/* Win 9x does not support the overlapped I/O on files */
if
(
rc
||
GetLastError
()
!=
ERROR_INVALID_PARAMETER
)
{
if
(
rc
||
GetLastError
()
!=
ERROR_INVALID_PARAMETER
)
{
ok
(
rc
,
"WriteFile error %ld"
,
GetLastError
());
ok
(
rc
,
"WriteFile error %ld
\n
"
,
GetLastError
());
ok
(
done
==
sizeof
(
pattern
),
"expected number of bytes written %lu"
,
done
);
ok
(
done
==
sizeof
(
pattern
),
"expected number of bytes written %lu
\n
"
,
done
);
trace
(
"Current offset = %04lx
\n
"
,
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
));
trace
(
"Current offset = %04lx
\n
"
,
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
));
ok
(
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
)
==
(
PATTERN_OFFSET
+
sizeof
(
pattern
)),
ok
(
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
)
==
(
PATTERN_OFFSET
+
sizeof
(
pattern
)),
"expected file offset %d"
,
PATTERN_OFFSET
+
sizeof
(
pattern
));
"expected file offset %d
\n
"
,
PATTERN_OFFSET
+
sizeof
(
pattern
));
ov
.
Offset
=
sizeof
(
buf
)
*
2
;
ov
.
Offset
=
sizeof
(
buf
)
*
2
;
ov
.
OffsetHigh
=
0
;
ov
.
OffsetHigh
=
0
;
ok
(
WriteFile
(
hFile
,
pattern
,
sizeof
(
pattern
),
&
done
,
&
ov
),
"WriteFile error %ld"
,
GetLastError
());
ok
(
WriteFile
(
hFile
,
pattern
,
sizeof
(
pattern
),
&
done
,
&
ov
),
"WriteFile error %ld
\n
"
,
GetLastError
());
ok
(
done
==
sizeof
(
pattern
),
"expected number of bytes written %lu"
,
done
);
ok
(
done
==
sizeof
(
pattern
),
"expected number of bytes written %lu
\n
"
,
done
);
/*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/
/*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/
ok
(
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
)
==
(
sizeof
(
buf
)
*
2
+
sizeof
(
pattern
)),
ok
(
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
)
==
(
sizeof
(
buf
)
*
2
+
sizeof
(
pattern
)),
"expected file offset %d"
,
sizeof
(
buf
)
*
2
+
sizeof
(
pattern
));
"expected file offset %d
\n
"
,
sizeof
(
buf
)
*
2
+
sizeof
(
pattern
));
}
}
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
...
@@ -821,7 +821,7 @@ static void test_offset_in_overlapped_structure(void)
...
@@ -821,7 +821,7 @@ static void test_offset_in_overlapped_structure(void)
/*** Read File *****************************************************/
/*** Read File *****************************************************/
hFile
=
CreateFileA
(
temp_fname
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
hFile
=
CreateFileA
(
temp_fname
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileA error %ld"
,
GetLastError
());
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileA error %ld
\n
"
,
GetLastError
());
memset
(
buf
,
0
,
sizeof
(
buf
));
memset
(
buf
,
0
,
sizeof
(
buf
));
memset
(
&
ov
,
0
,
sizeof
(
ov
));
memset
(
&
ov
,
0
,
sizeof
(
ov
));
...
@@ -830,12 +830,12 @@ static void test_offset_in_overlapped_structure(void)
...
@@ -830,12 +830,12 @@ static void test_offset_in_overlapped_structure(void)
rc
=
ReadFile
(
hFile
,
buf
,
sizeof
(
pattern
),
&
done
,
&
ov
);
rc
=
ReadFile
(
hFile
,
buf
,
sizeof
(
pattern
),
&
done
,
&
ov
);
/* Win 9x does not support the overlapped I/O on files */
/* Win 9x does not support the overlapped I/O on files */
if
(
rc
||
GetLastError
()
!=
ERROR_INVALID_PARAMETER
)
{
if
(
rc
||
GetLastError
()
!=
ERROR_INVALID_PARAMETER
)
{
ok
(
rc
,
"ReadFile error %ld"
,
GetLastError
());
ok
(
rc
,
"ReadFile error %ld
\n
"
,
GetLastError
());
ok
(
done
==
sizeof
(
pattern
),
"expected number of bytes read %lu"
,
done
);
ok
(
done
==
sizeof
(
pattern
),
"expected number of bytes read %lu
\n
"
,
done
);
trace
(
"Current offset = %04lx
\n
"
,
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
));
trace
(
"Current offset = %04lx
\n
"
,
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
));
ok
(
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
)
==
(
PATTERN_OFFSET
+
sizeof
(
pattern
)),
ok
(
SetFilePointer
(
hFile
,
0
,
NULL
,
FILE_CURRENT
)
==
(
PATTERN_OFFSET
+
sizeof
(
pattern
)),
"expected file offset %d"
,
PATTERN_OFFSET
+
sizeof
(
pattern
));
"expected file offset %d
\n
"
,
PATTERN_OFFSET
+
sizeof
(
pattern
));
ok
(
!
memcmp
(
buf
,
pattern
,
sizeof
(
pattern
)),
"pattern match failed"
);
ok
(
!
memcmp
(
buf
,
pattern
,
sizeof
(
pattern
)),
"pattern match failed
\n
"
);
}
}
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
...
@@ -854,62 +854,62 @@ static void test_LockFile(void)
...
@@ -854,62 +854,62 @@ static void test_LockFile(void)
CREATE_ALWAYS
,
0
,
0
);
CREATE_ALWAYS
,
0
,
0
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
{
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)"
,
filename
,
GetLastError
());
ok
(
0
,
"couldn't create file
\"
%s
\"
(err=%ld)
\n
"
,
filename
,
GetLastError
());
return
;
return
;
}
}
ok
(
WriteFile
(
handle
,
sillytext
,
strlen
(
sillytext
),
&
written
,
NULL
),
"write failed"
);
ok
(
WriteFile
(
handle
,
sillytext
,
strlen
(
sillytext
),
&
written
,
NULL
),
"write failed
\n
"
);
ok
(
LockFile
(
handle
,
0
,
0
,
0
,
0
),
"LockFile failed"
);
ok
(
LockFile
(
handle
,
0
,
0
,
0
,
0
),
"LockFile failed
\n
"
);
ok
(
UnlockFile
(
handle
,
0
,
0
,
0
,
0
),
"UnlockFile failed"
);
ok
(
UnlockFile
(
handle
,
0
,
0
,
0
,
0
),
"UnlockFile failed
\n
"
);
ok
(
!
UnlockFile
(
handle
,
0
,
0
,
0
,
0
),
"UnlockFile succeeded"
);
ok
(
!
UnlockFile
(
handle
,
0
,
0
,
0
,
0
),
"UnlockFile succeeded
\n
"
);
ok
(
LockFile
(
handle
,
10
,
0
,
20
,
0
),
"LockFile 10,20 failed"
);
ok
(
LockFile
(
handle
,
10
,
0
,
20
,
0
),
"LockFile 10,20 failed
\n
"
);
/* overlapping locks must fail */
/* overlapping locks must fail */
ok
(
!
LockFile
(
handle
,
12
,
0
,
10
,
0
),
"LockFile 12,10 succeeded"
);
ok
(
!
LockFile
(
handle
,
12
,
0
,
10
,
0
),
"LockFile 12,10 succeeded
\n
"
);
ok
(
!
LockFile
(
handle
,
5
,
0
,
6
,
0
),
"LockFile 5,6 succeeded"
);
ok
(
!
LockFile
(
handle
,
5
,
0
,
6
,
0
),
"LockFile 5,6 succeeded
\n
"
);
/* non-overlapping locks must succeed */
/* non-overlapping locks must succeed */
ok
(
LockFile
(
handle
,
5
,
0
,
5
,
0
),
"LockFile 5,5 failed"
);
ok
(
LockFile
(
handle
,
5
,
0
,
5
,
0
),
"LockFile 5,5 failed
\n
"
);
ok
(
!
UnlockFile
(
handle
,
10
,
0
,
10
,
0
),
"UnlockFile 10,10 succeeded"
);
ok
(
!
UnlockFile
(
handle
,
10
,
0
,
10
,
0
),
"UnlockFile 10,10 succeeded
\n
"
);
ok
(
UnlockFile
(
handle
,
10
,
0
,
20
,
0
),
"UnlockFile 10,20 failed"
);
ok
(
UnlockFile
(
handle
,
10
,
0
,
20
,
0
),
"UnlockFile 10,20 failed
\n
"
);
ok
(
!
UnlockFile
(
handle
,
10
,
0
,
20
,
0
),
"UnlockFile 10,20 again succeeded"
);
ok
(
!
UnlockFile
(
handle
,
10
,
0
,
20
,
0
),
"UnlockFile 10,20 again succeeded
\n
"
);
ok
(
UnlockFile
(
handle
,
5
,
0
,
5
,
0
),
"UnlockFile 5,5 failed"
);
ok
(
UnlockFile
(
handle
,
5
,
0
,
5
,
0
),
"UnlockFile 5,5 failed
\n
"
);
overlapped
.
Offset
=
100
;
overlapped
.
Offset
=
100
;
overlapped
.
OffsetHigh
=
0
;
overlapped
.
OffsetHigh
=
0
;
overlapped
.
hEvent
=
0
;
overlapped
.
hEvent
=
0
;
ok
(
LockFileEx
(
handle
,
0
,
0
,
100
,
0
,
&
overlapped
),
"LockFileEx 100,100 failed"
);
ok
(
LockFileEx
(
handle
,
0
,
0
,
100
,
0
,
&
overlapped
),
"LockFileEx 100,100 failed
\n
"
);
/* overlapping shared locks are OK */
/* overlapping shared locks are OK */
overlapped
.
Offset
=
150
;
overlapped
.
Offset
=
150
;
ok
(
LockFileEx
(
handle
,
0
,
0
,
100
,
0
,
&
overlapped
),
"LockFileEx 150,100 failed"
);
ok
(
LockFileEx
(
handle
,
0
,
0
,
100
,
0
,
&
overlapped
),
"LockFileEx 150,100 failed
\n
"
);
/* but exclusive is not */
/* but exclusive is not */
ok
(
!
LockFileEx
(
handle
,
LOCKFILE_EXCLUSIVE_LOCK
|
LOCKFILE_FAIL_IMMEDIATELY
,
0
,
50
,
0
,
&
overlapped
),
ok
(
!
LockFileEx
(
handle
,
LOCKFILE_EXCLUSIVE_LOCK
|
LOCKFILE_FAIL_IMMEDIATELY
,
0
,
50
,
0
,
&
overlapped
),
"LockFileEx exclusive 150,50 succeeded"
);
"LockFileEx exclusive 150,50 succeeded
\n
"
);
ok
(
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 150,100 failed"
);
ok
(
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 150,100 failed
\n
"
);
ok
(
!
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 150,100 again succeeded"
);
ok
(
!
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 150,100 again succeeded
\n
"
);
overlapped
.
Offset
=
100
;
overlapped
.
Offset
=
100
;
ok
(
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 100,100 failed"
);
ok
(
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 100,100 failed
\n
"
);
ok
(
!
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 100,100 again succeeded"
);
ok
(
!
UnlockFileEx
(
handle
,
0
,
100
,
0
,
&
overlapped
),
"UnlockFileEx 100,100 again succeeded
\n
"
);
ok
(
LockFile
(
handle
,
0
,
0x10000000
,
0
,
0xf0000000
),
"LockFile failed"
);
ok
(
LockFile
(
handle
,
0
,
0x10000000
,
0
,
0xf0000000
),
"LockFile failed
\n
"
);
ok
(
!
LockFile
(
handle
,
~
0
,
~
0
,
1
,
0
),
"LockFile ~0,1 succeeded"
);
ok
(
!
LockFile
(
handle
,
~
0
,
~
0
,
1
,
0
),
"LockFile ~0,1 succeeded
\n
"
);
ok
(
!
LockFile
(
handle
,
0
,
0x20000000
,
20
,
0
),
"LockFile 0x20000000,20 succeeded"
);
ok
(
!
LockFile
(
handle
,
0
,
0x20000000
,
20
,
0
),
"LockFile 0x20000000,20 succeeded
\n
"
);
ok
(
UnlockFile
(
handle
,
0
,
0x10000000
,
0
,
0xf0000000
),
"UnlockFile failed"
);
ok
(
UnlockFile
(
handle
,
0
,
0x10000000
,
0
,
0xf0000000
),
"UnlockFile failed
\n
"
);
/* wrap-around lock should not do anything */
/* wrap-around lock should not do anything */
/* (but still succeeds on NT4 so we don't check result) */
/* (but still succeeds on NT4 so we don't check result) */
LockFile
(
handle
,
0
,
0x10000000
,
0
,
0xf0000001
);
LockFile
(
handle
,
0
,
0x10000000
,
0
,
0xf0000001
);
ok
(
LockFile
(
handle
,
~
0
,
~
0
,
1
,
0
),
"LockFile ~0,1 failed"
);
ok
(
LockFile
(
handle
,
~
0
,
~
0
,
1
,
0
),
"LockFile ~0,1 failed
\n
"
);
ok
(
UnlockFile
(
handle
,
~
0
,
~
0
,
1
,
0
),
"Unlockfile ~0,1 failed"
);
ok
(
UnlockFile
(
handle
,
~
0
,
~
0
,
1
,
0
),
"Unlockfile ~0,1 failed
\n
"
);
/* zero-byte lock */
/* zero-byte lock */
ok
(
LockFile
(
handle
,
100
,
0
,
0
,
0
),
"LockFile 100,0 failed"
);
ok
(
LockFile
(
handle
,
100
,
0
,
0
,
0
),
"LockFile 100,0 failed
\n
"
);
ok
(
!
LockFile
(
handle
,
98
,
0
,
4
,
0
),
"LockFile 98,4 succeeded"
);
ok
(
!
LockFile
(
handle
,
98
,
0
,
4
,
0
),
"LockFile 98,4 succeeded
\n
"
);
ok
(
LockFile
(
handle
,
90
,
0
,
10
,
0
),
"LockFile 90,10 failed"
);
ok
(
LockFile
(
handle
,
90
,
0
,
10
,
0
),
"LockFile 90,10 failed
\n
"
);
ok
(
LockFile
(
handle
,
100
,
0
,
10
,
0
),
"LockFile 100,10 failed"
);
ok
(
LockFile
(
handle
,
100
,
0
,
10
,
0
),
"LockFile 100,10 failed
\n
"
);
ok
(
UnlockFile
(
handle
,
90
,
0
,
10
,
0
),
"UnlockFile 90,10 failed"
);
ok
(
UnlockFile
(
handle
,
90
,
0
,
10
,
0
),
"UnlockFile 90,10 failed
\n
"
);
ok
(
UnlockFile
(
handle
,
100
,
0
,
10
,
0
),
"UnlockFile 100,10 failed"
);
ok
(
UnlockFile
(
handle
,
100
,
0
,
10
,
0
),
"UnlockFile 100,10 failed
\n
"
);
ok
(
UnlockFile
(
handle
,
100
,
0
,
0
,
0
),
"UnlockFile 100,0 failed"
);
ok
(
UnlockFile
(
handle
,
100
,
0
,
0
,
0
),
"UnlockFile 100,0 failed
\n
"
);
CloseHandle
(
handle
);
CloseHandle
(
handle
);
DeleteFileA
(
filename
);
DeleteFileA
(
filename
);
...
@@ -923,12 +923,12 @@ static void test_FindFirstFileA()
...
@@ -923,12 +923,12 @@ static void test_FindFirstFileA()
handle
=
FindFirstFileA
(
"C:
\\
"
,
&
search_results
);
handle
=
FindFirstFileA
(
"C:
\\
"
,
&
search_results
);
err
=
GetLastError
();
err
=
GetLastError
();
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"FindFirstFile on Root directory should Fail"
);
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"FindFirstFile on Root directory should Fail
\n
"
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
if
(
handle
==
INVALID_HANDLE_VALUE
)
ok
(
err
==
ERROR_FILE_NOT_FOUND
,
"Bad Error number %d
\n
"
,
err
);
ok
(
err
==
ERROR_FILE_NOT_FOUND
,
"Bad Error number %d
\n
"
,
err
);
handle
=
FindFirstFileA
(
"C:
\\
*"
,
&
search_results
);
handle
=
FindFirstFileA
(
"C:
\\
*"
,
&
search_results
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"FindFirstFile on C:
\\
* should succeed"
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"FindFirstFile on C:
\\
* should succeed
\n
"
);
ok
(
FindClose
(
handle
)
==
TRUE
,
"Failed to close handle"
);
ok
(
FindClose
(
handle
)
==
TRUE
,
"Failed to close handle
\n
"
);
}
}
static
void
test_FindNextFileA
()
static
void
test_FindNextFileA
()
...
@@ -938,14 +938,14 @@ static void test_FindNextFileA()
...
@@ -938,14 +938,14 @@ static void test_FindNextFileA()
int
err
;
int
err
;
handle
=
FindFirstFileA
(
"C:
\\
*"
,
&
search_results
);
handle
=
FindFirstFileA
(
"C:
\\
*"
,
&
search_results
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"FindFirstFile on C:
\\
* should succeed"
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"FindFirstFile on C:
\\
* should succeed
\n
"
);
while
(
FindNextFile
(
handle
,
&
search_results
))
while
(
FindNextFile
(
handle
,
&
search_results
))
{
{
/* get to the end of the files */
/* get to the end of the files */
}
}
ok
(
FindClose
(
handle
)
==
TRUE
,
"Failed to close handle"
);
ok
(
FindClose
(
handle
)
==
TRUE
,
"Failed to close handle
\n
"
);
err
=
GetLastError
();
err
=
GetLastError
();
ok
(
err
==
ERROR_NO_MORE_FILES
,
"GetLastError should return ERROR_NO_MORE_FILES"
);
ok
(
err
==
ERROR_NO_MORE_FILES
,
"GetLastError should return ERROR_NO_MORE_FILES
\n
"
);
}
}
static
void
test_MapFile
()
static
void
test_MapFile
()
...
@@ -976,7 +976,7 @@ static void test_MapFile()
...
@@ -976,7 +976,7 @@ static void test_MapFile()
ok
(
CloseHandle
(
hmap
),
"can't close mapping handle
\n
"
);
ok
(
CloseHandle
(
hmap
),
"can't close mapping handle
\n
"
);
ok
(
CloseHandle
(
handle
),
"can't close file handle
\n
"
);
ok
(
CloseHandle
(
handle
),
"can't close file handle
\n
"
);
ok
(
DeleteFileA
(
filename
),
"DeleteFile failed after map"
);
ok
(
DeleteFileA
(
filename
),
"DeleteFile failed after map
\n
"
);
}
}
START_TEST
(
file
)
START_TEST
(
file
)
...
...
dlls/kernel/tests/format_msg.c
View file @
ce7c3b50
...
@@ -47,177 +47,177 @@ void test_message_from_string(void)
...
@@ -47,177 +47,177 @@ void test_message_from_string(void)
/* the basics */
/* the basics */
r
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_STRING
,
"test"
,
0
,
r
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_STRING
,
"test"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* using the format feature */
/* using the format feature */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!s!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!s!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"test"
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"test"
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* no format */
/* no format */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"test"
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"test"
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* two pieces */
/* two pieces */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1%2"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1%2"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"te"
,
"st"
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"te"
,
"st"
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* three pieces */
/* three pieces */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1%3%2%1"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1%3%2%1"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"t"
,
"s"
,
"e"
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"t"
,
"s"
,
"e"
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* s doesn't seem to work in format strings */
/* s doesn't seem to work in format strings */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%!s!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%!s!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"test"
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
"test"
);
ok
(
!
strcmp
(
"!s!"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"!s!"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
3
,
"failed: r=%ld"
,
r
);
ok
(
r
==
3
,
"failed: r=%ld
\n
"
,
r
);
/* S is unicode */
/* S is unicode */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!S!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!S!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
szwTest
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
szwTest
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* as characters */
/* as characters */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!c!%2!c!%3!c!%1!c!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!c!%2!c!%3!c!%1!c!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
't'
,
'e'
,
's'
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
't'
,
'e'
,
's'
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* some numbers */
/* some numbers */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!d!%2!d!%3!d!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!d!%2!d!%3!d!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
1
,
2
,
3
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
1
,
2
,
3
);
ok
(
!
strcmp
(
"123"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"123"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
3
,
"failed: r=%ld"
,
r
);
ok
(
r
==
3
,
"failed: r=%ld
\n
"
,
r
);
/* a single digit with some spacing */
/* a single digit with some spacing */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4d!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4d!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
1
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
1
);
ok
(
!
strcmp
(
" 1"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" 1"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* a single digit, left justified */
/* a single digit, left justified */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!-4d!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!-4d!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
1
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
1
);
ok
(
!
strcmp
(
"1 "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"1 "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* two digit decimal number */
/* two digit decimal number */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4d!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4d!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
ok
(
!
strcmp
(
" 11"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" 11"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* a hex number */
/* a hex number */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4x!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4x!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
ok
(
!
strcmp
(
" b"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" b"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* a hex number, upper case */
/* a hex number, upper case */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4X!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4X!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
ok
(
!
strcmp
(
" B"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" B"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* a hex number, upper case, left justified */
/* a hex number, upper case, left justified */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!-4X!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!-4X!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
11
);
ok
(
!
strcmp
(
"B "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"B "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* a long hex number, upper case */
/* a long hex number, upper case */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4X!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!4X!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
0x1ab
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
0x1ab
);
ok
(
!
strcmp
(
" 1AB"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" 1AB"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* two percent... */
/* two percent... */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
" %%%% "
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
" %%%% "
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
" %% "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" %% "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* periods are special cases */
/* periods are special cases */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
" %.%. %1!d!"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
" %.%. %1!d!"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
0x1ab
);
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
0x1ab
);
ok
(
!
strcmp
(
" .. 427"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" .. 427"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
7
,
"failed: r=%ld"
,
r
);
ok
(
r
==
7
,
"failed: r=%ld
\n
"
,
r
);
/* %0 ends the line */
/* %0 ends the line */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"test%0test"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"test%0test"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"test"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* %! prints an exclaimation */
/* %! prints an exclaimation */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"yah%!%0 "
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"yah%!%0 "
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"yah!"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"yah!"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* %space */
/* %space */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"% % "
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"% % "
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
" "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* line feed */
/* line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"hi
\n
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"hi
\n
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"hi
\r\n
"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"hi
\r\n
"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* carriage return line feed */
/* carriage return line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"hi
\r\n
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"hi
\r\n
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"hi
\r\n
"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"hi
\r\n
"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* carriage return line feed */
/* carriage return line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"
\r
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"
\r
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"
\r\n
"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"
\r\n
"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
2
,
"failed: r=%ld"
,
r
);
ok
(
r
==
2
,
"failed: r=%ld
\n
"
,
r
);
/* carriage return line feed */
/* carriage return line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"
\r\r\n
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"
\r\r\n
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"
\r\n\r\n
"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"
\r\n\r\n
"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* change of pace... test the low byte of dwflags */
/* change of pace... test the low byte of dwflags */
/* line feed */
/* line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"hi
\n
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"hi
\n
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"hi "
,
out
)
||
!
strcmp
(
"hi
\r\n
"
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"hi "
,
out
)
||
!
strcmp
(
"hi
\r\n
"
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
3
||
r
==
4
,
"failed: r=%ld"
,
r
);
ok
(
r
==
3
||
r
==
4
,
"failed: r=%ld
\n
"
,
r
);
/* carriage return line feed */
/* carriage return line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"hi
\r\n
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"hi
\r\n
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
"hi "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
"hi "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
3
,
"failed: r=%ld"
,
r
);
ok
(
r
==
3
,
"failed: r=%ld
\n
"
,
r
);
/* carriage return line feed */
/* carriage return line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"
\r
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"
\r
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
" "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
1
,
"failed: r=%ld"
,
r
);
ok
(
r
==
1
,
"failed: r=%ld
\n
"
,
r
);
/* carriage return line feed */
/* carriage return line feed */
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"
\r\r\n
"
,
0
,
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
"
\r\r\n
"
,
0
,
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
0
,
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
));
ok
(
!
strcmp
(
" "
,
out
),
"failed out=[%s]"
,
out
);
ok
(
!
strcmp
(
" "
,
out
),
"failed out=[%s]
\n
"
,
out
);
ok
(
r
==
2
,
"failed: r=%ld"
,
r
);
ok
(
r
==
2
,
"failed: r=%ld
\n
"
,
r
);
}
}
START_TEST
(
format_msg
)
START_TEST
(
format_msg
)
...
...
dlls/netapi32/tests/access.c
View file @
ce7c3b50
...
@@ -56,11 +56,11 @@ static int init_access_tests(void)
...
@@ -56,11 +56,11 @@ static int init_access_tests(void)
rc
=
GetUserNameW
(
user_name
,
&
dwSize
);
rc
=
GetUserNameW
(
user_name
,
&
dwSize
);
if
(
rc
==
FALSE
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
rc
==
FALSE
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
0
;
return
0
;
ok
(
rc
,
"User Name Retrieved"
);
ok
(
rc
,
"User Name Retrieved
\n
"
);
computer_name
[
0
]
=
0
;
computer_name
[
0
]
=
0
;
dwSize
=
sizeof
(
computer_name
);
dwSize
=
sizeof
(
computer_name
);
ok
(
GetComputerNameW
(
computer_name
,
&
dwSize
),
"Computer Name Retrieved"
);
ok
(
GetComputerNameW
(
computer_name
,
&
dwSize
),
"Computer Name Retrieved
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -77,45 +77,45 @@ void run_usergetinfo_tests(void)
...
@@ -77,45 +77,45 @@ void run_usergetinfo_tests(void)
/* Level 0 */
/* Level 0 */
rc
=
pNetUserGetInfo
(
NULL
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
NULL
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
NERR_Success
,
"NetUserGetInfo: rc=%ld"
,
rc
);
ok
(
rc
==
NERR_Success
,
"NetUserGetInfo: rc=%ld
\n
"
,
rc
);
ok
(
!
lstrcmpW
(
sAdminUserName
,
ui0
->
usri0_name
),
"This is really user name"
);
ok
(
!
lstrcmpW
(
sAdminUserName
,
ui0
->
usri0_name
),
"This is really user name
\n
"
);
pNetApiBufferSize
(
ui0
,
&
dwSize
);
pNetApiBufferSize
(
ui0
,
&
dwSize
);
ok
(
dwSize
>=
(
sizeof
(
USER_INFO_0
)
+
ok
(
dwSize
>=
(
sizeof
(
USER_INFO_0
)
+
(
lstrlenW
(
ui0
->
usri0_name
)
+
1
)
*
sizeof
(
WCHAR
)),
(
lstrlenW
(
ui0
->
usri0_name
)
+
1
)
*
sizeof
(
WCHAR
)),
"Is allocated with NetApiBufferAllocate"
);
"Is allocated with NetApiBufferAllocate
\n
"
);
/* Level 10 */
/* Level 10 */
rc
=
pNetUserGetInfo
(
NULL
,
sAdminUserName
,
10
,
(
LPBYTE
*
)
&
ui10
);
rc
=
pNetUserGetInfo
(
NULL
,
sAdminUserName
,
10
,
(
LPBYTE
*
)
&
ui10
);
ok
(
rc
==
NERR_Success
,
"NetUserGetInfo: rc=%ld"
,
rc
);
ok
(
rc
==
NERR_Success
,
"NetUserGetInfo: rc=%ld
\n
"
,
rc
);
ok
(
!
lstrcmpW
(
sAdminUserName
,
ui10
->
usri10_name
),
"This is really user name"
);
ok
(
!
lstrcmpW
(
sAdminUserName
,
ui10
->
usri10_name
),
"This is really user name
\n
"
);
pNetApiBufferSize
(
ui10
,
&
dwSize
);
pNetApiBufferSize
(
ui10
,
&
dwSize
);
ok
(
dwSize
>=
(
sizeof
(
USER_INFO_10
)
+
ok
(
dwSize
>=
(
sizeof
(
USER_INFO_10
)
+
(
lstrlenW
(
ui10
->
usri10_name
)
+
1
+
(
lstrlenW
(
ui10
->
usri10_name
)
+
1
+
lstrlenW
(
ui10
->
usri10_comment
)
+
1
+
lstrlenW
(
ui10
->
usri10_comment
)
+
1
+
lstrlenW
(
ui10
->
usri10_usr_comment
)
+
1
+
lstrlenW
(
ui10
->
usri10_usr_comment
)
+
1
+
lstrlenW
(
ui10
->
usri10_full_name
)
+
1
)
*
sizeof
(
WCHAR
)),
lstrlenW
(
ui10
->
usri10_full_name
)
+
1
)
*
sizeof
(
WCHAR
)),
"Is allocated with NetApiBufferAllocate"
);
"Is allocated with NetApiBufferAllocate
\n
"
);
pNetApiBufferFree
(
ui0
);
pNetApiBufferFree
(
ui0
);
pNetApiBufferFree
(
ui10
);
pNetApiBufferFree
(
ui10
);
/* errors handling */
/* errors handling */
rc
=
pNetUserGetInfo
(
NULL
,
sAdminUserName
,
10000
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
NULL
,
sAdminUserName
,
10000
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
ERROR_INVALID_LEVEL
,
"Invalid Level: rc=%ld"
,
rc
);
ok
(
rc
==
ERROR_INVALID_LEVEL
,
"Invalid Level: rc=%ld
\n
"
,
rc
);
rc
=
pNetUserGetInfo
(
NULL
,
sNonexistentUser
,
0
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
NULL
,
sNonexistentUser
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
NERR_UserNotFound
,
"Invalid User Name: rc=%ld"
,
rc
);
ok
(
rc
==
NERR_UserNotFound
,
"Invalid User Name: rc=%ld
\n
"
,
rc
);
todo_wine
{
todo_wine
{
/* FIXME - Currently Wine can't verify whether the network path is good or bad */
/* FIXME - Currently Wine can't verify whether the network path is good or bad */
rc
=
pNetUserGetInfo
(
sBadNetPath
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
sBadNetPath
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
ERROR_BAD_NETPATH
||
rc
==
ERROR_NETWORK_UNREACHABLE
,
ok
(
rc
==
ERROR_BAD_NETPATH
||
rc
==
ERROR_NETWORK_UNREACHABLE
,
"Bad Network Path: rc=%ld"
,
rc
);
"Bad Network Path: rc=%ld
\n
"
,
rc
);
}
}
rc
=
pNetUserGetInfo
(
sEmptyStr
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
sEmptyStr
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
ERROR_BAD_NETPATH
,
"Bad Network Path: rc=%ld"
,
rc
);
ok
(
rc
==
ERROR_BAD_NETPATH
,
"Bad Network Path: rc=%ld
\n
"
,
rc
);
rc
=
pNetUserGetInfo
(
sInvalidName
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
sInvalidName
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
ERROR_INVALID_NAME
,
"Invalid Server Name: rc=%ld"
,
rc
);
ok
(
rc
==
ERROR_INVALID_NAME
,
"Invalid Server Name: rc=%ld
\n
"
,
rc
);
rc
=
pNetUserGetInfo
(
sInvalidName2
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
rc
=
pNetUserGetInfo
(
sInvalidName2
,
sAdminUserName
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
ERROR_INVALID_NAME
,
"Invalid Server Name: rc=%ld"
,
rc
);
ok
(
rc
==
ERROR_INVALID_NAME
,
"Invalid Server Name: rc=%ld
\n
"
,
rc
);
}
}
/* checks Level 1 of NetQueryDisplayInformation */
/* checks Level 1 of NetQueryDisplayInformation */
...
@@ -137,22 +137,22 @@ void run_querydisplayinformation1_tests(void)
...
@@ -137,22 +137,22 @@ void run_querydisplayinformation1_tests(void)
(
PVOID
*
)
&
Buffer
);
(
PVOID
*
)
&
Buffer
);
ok
((
Result
==
ERROR_SUCCESS
)
||
(
Result
==
ERROR_MORE_DATA
),
ok
((
Result
==
ERROR_SUCCESS
)
||
(
Result
==
ERROR_MORE_DATA
),
"Information Retrieved"
);
"Information Retrieved
\n
"
);
rec
=
Buffer
;
rec
=
Buffer
;
for
(;
EntryCount
>
0
;
EntryCount
--
)
for
(;
EntryCount
>
0
;
EntryCount
--
)
{
{
if
(
!
lstrcmpW
(
rec
->
usri1_name
,
sAdminUserName
))
if
(
!
lstrcmpW
(
rec
->
usri1_name
,
sAdminUserName
))
{
{
ok
(
!
hasAdmin
,
"One admin user"
);
ok
(
!
hasAdmin
,
"One admin user
\n
"
);
ok
(
rec
->
usri1_flags
&
UF_SCRIPT
,
"UF_SCRIPT flag is set"
);
ok
(
rec
->
usri1_flags
&
UF_SCRIPT
,
"UF_SCRIPT flag is set
\n
"
);
ok
(
rec
->
usri1_flags
&
UF_NORMAL_ACCOUNT
,
"UF_NORMAL_ACCOUNT flag is set"
);
ok
(
rec
->
usri1_flags
&
UF_NORMAL_ACCOUNT
,
"UF_NORMAL_ACCOUNT flag is set
\n
"
);
hasAdmin
=
TRUE
;
hasAdmin
=
TRUE
;
}
}
else
if
(
!
lstrcmpW
(
rec
->
usri1_name
,
sGuestUserName
))
else
if
(
!
lstrcmpW
(
rec
->
usri1_name
,
sGuestUserName
))
{
{
ok
(
!
hasGuest
,
"One guest record"
);
ok
(
!
hasGuest
,
"One guest record
\n
"
);
ok
(
rec
->
usri1_flags
&
UF_SCRIPT
,
"UF_SCRIPT flag is set"
);
ok
(
rec
->
usri1_flags
&
UF_SCRIPT
,
"UF_SCRIPT flag is set
\n
"
);
ok
(
rec
->
usri1_flags
&
UF_NORMAL_ACCOUNT
,
"UF_NORMAL_ACCOUNT flag is set"
);
ok
(
rec
->
usri1_flags
&
UF_NORMAL_ACCOUNT
,
"UF_NORMAL_ACCOUNT flag is set
\n
"
);
hasGuest
=
TRUE
;
hasGuest
=
TRUE
;
}
}
...
@@ -163,8 +163,8 @@ void run_querydisplayinformation1_tests(void)
...
@@ -163,8 +163,8 @@ void run_querydisplayinformation1_tests(void)
pNetApiBufferFree
(
Buffer
);
pNetApiBufferFree
(
Buffer
);
}
while
(
Result
==
ERROR_MORE_DATA
);
}
while
(
Result
==
ERROR_MORE_DATA
);
ok
(
hasAdmin
,
"Has Administrator account"
);
ok
(
hasAdmin
,
"Has Administrator account
\n
"
);
ok
(
hasGuest
,
"Has Guest account"
);
ok
(
hasGuest
,
"Has Guest account
\n
"
);
}
}
START_TEST
(
access
)
START_TEST
(
access
)
...
...
dlls/netapi32/tests/apibuf.c
View file @
ce7c3b50
...
@@ -45,37 +45,37 @@ void run_apibuf_tests(void)
...
@@ -45,37 +45,37 @@ void run_apibuf_tests(void)
/* test normal logic */
/* test normal logic */
ok
(
pNetApiBufferAllocate
(
1024
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
ok
(
pNetApiBufferAllocate
(
1024
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Reserved memory"
);
"Reserved memory
\n
"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size
\n
"
);
ok
(
dwSize
>=
1024
,
"The size is correct"
);
ok
(
dwSize
>=
1024
,
"The size is correct
\n
"
);
ok
(
pNetApiBufferReallocate
(
p
,
1500
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
ok
(
pNetApiBufferReallocate
(
p
,
1500
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Reallocated"
);
"Reallocated
\n
"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size
\n
"
);
ok
(
dwSize
>=
1500
,
"The size is correct"
);
ok
(
dwSize
>=
1500
,
"The size is correct
\n
"
);
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed"
);
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed
\n
"
);
/* test errors handling */
/* test errors handling */
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed"
);
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed
\n
"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size
\n
"
);
ok
(
dwSize
>=
0
,
"The size"
);
ok
(
dwSize
>=
0
,
"The size
\n
"
);
ok
(
pNetApiBufferSize
(
NULL
,
&
dwSize
)
==
ERROR_INVALID_PARAMETER
,
"Error for NULL pointer"
);
ok
(
pNetApiBufferSize
(
NULL
,
&
dwSize
)
==
ERROR_INVALID_PARAMETER
,
"Error for NULL pointer
\n
"
);
/* border reallocate cases */
/* border reallocate cases */
ok
(
pNetApiBufferReallocate
(
0
,
1500
,
(
LPVOID
*
)
&
p
)
!=
NERR_Success
,
"(Re)allocated"
);
ok
(
pNetApiBufferReallocate
(
0
,
1500
,
(
LPVOID
*
)
&
p
)
!=
NERR_Success
,
"(Re)allocated
\n
"
);
ok
(
p
==
NULL
,
"Some memory got allocated"
);
ok
(
p
==
NULL
,
"Some memory got allocated
\n
"
);
ok
(
pNetApiBufferAllocate
(
1024
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Memory not reserved"
);
ok
(
pNetApiBufferAllocate
(
1024
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Memory not reserved
\n
"
);
ok
(
pNetApiBufferReallocate
(
p
,
0
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Not freed"
);
ok
(
pNetApiBufferReallocate
(
p
,
0
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Not freed
\n
"
);
ok
(
p
==
NULL
,
"Pointer not cleared"
);
ok
(
p
==
NULL
,
"Pointer not cleared
\n
"
);
/* 0-length buffer */
/* 0-length buffer */
ok
(
pNetApiBufferAllocate
(
0
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
ok
(
pNetApiBufferAllocate
(
0
,
(
LPVOID
*
)
&
p
)
==
NERR_Success
,
"Reserved memory"
);
"Reserved memory
\n
"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size"
);
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size
\n
"
);
ok
((
dwSize
>=
0
)
&&
(
dwSize
<
0xFFFFFFFF
),
"The size of the 0-length buffer"
);
ok
((
dwSize
>=
0
)
&&
(
dwSize
<
0xFFFFFFFF
),
"The size of the 0-length buffer
\n
"
);
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed"
);
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed
\n
"
);
}
}
START_TEST
(
apibuf
)
START_TEST
(
apibuf
)
...
...
dlls/netapi32/tests/wksta.c
View file @
ce7c3b50
...
@@ -52,11 +52,11 @@ static int init_wksta_tests(void)
...
@@ -52,11 +52,11 @@ static int init_wksta_tests(void)
rc
=
GetUserNameW
(
user_name
,
&
dwSize
);
rc
=
GetUserNameW
(
user_name
,
&
dwSize
);
if
(
rc
==
FALSE
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
rc
==
FALSE
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
0
;
return
0
;
ok
(
rc
,
"User Name Retrieved"
);
ok
(
rc
,
"User Name Retrieved
\n
"
);
computer_name
[
0
]
=
0
;
computer_name
[
0
]
=
0
;
dwSize
=
sizeof
(
computer_name
);
dwSize
=
sizeof
(
computer_name
);
ok
(
GetComputerNameW
(
computer_name
,
&
dwSize
),
"Computer Name Retrieved"
);
ok
(
GetComputerNameW
(
computer_name
,
&
dwSize
),
"Computer Name Retrieved
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -67,8 +67,8 @@ static void run_get_comp_name_tests(void)
...
@@ -67,8 +67,8 @@ static void run_get_comp_name_tests(void)
if
(
!
pNetpGetComputerName
)
if
(
!
pNetpGetComputerName
)
return
;
return
;
ok
(
pNetpGetComputerName
(
&
ws
)
==
NERR_Success
,
"Computer name is retrieved"
);
ok
(
pNetpGetComputerName
(
&
ws
)
==
NERR_Success
,
"Computer name is retrieved
\n
"
);
ok
(
!
lstrcmpW
(
computer_name
,
ws
),
"This is really computer name"
);
ok
(
!
lstrcmpW
(
computer_name
,
ws
),
"This is really computer name
\n
"
);
pNetApiBufferFree
(
ws
);
pNetApiBufferFree
(
ws
);
}
}
...
@@ -84,35 +84,35 @@ static void run_wkstausergetinfo_tests(void)
...
@@ -84,35 +84,35 @@ static void run_wkstausergetinfo_tests(void)
/* Level 0 */
/* Level 0 */
ok
(
pNetWkstaUserGetInfo
(
NULL
,
0
,
(
LPBYTE
*
)
&
ui0
)
==
NERR_Success
,
ok
(
pNetWkstaUserGetInfo
(
NULL
,
0
,
(
LPBYTE
*
)
&
ui0
)
==
NERR_Success
,
"NetWkstaUserGetInfo is successful"
);
"NetWkstaUserGetInfo is successful
\n
"
);
ok
(
!
lstrcmpW
(
user_name
,
ui0
->
wkui0_username
),
"This is really user name"
);
ok
(
!
lstrcmpW
(
user_name
,
ui0
->
wkui0_username
),
"This is really user name
\n
"
);
pNetApiBufferSize
(
ui0
,
&
dwSize
);
pNetApiBufferSize
(
ui0
,
&
dwSize
);
ok
(
dwSize
>=
(
sizeof
(
WKSTA_USER_INFO_0
)
+
ok
(
dwSize
>=
(
sizeof
(
WKSTA_USER_INFO_0
)
+
lstrlenW
(
ui0
->
wkui0_username
)
*
sizeof
(
WCHAR
)),
lstrlenW
(
ui0
->
wkui0_username
)
*
sizeof
(
WCHAR
)),
"Is allocated with NetApiBufferAllocate"
);
"Is allocated with NetApiBufferAllocate
\n
"
);
/* Level 1 */
/* Level 1 */
ok
(
pNetWkstaUserGetInfo
(
NULL
,
1
,
(
LPBYTE
*
)
&
ui1
)
==
NERR_Success
,
ok
(
pNetWkstaUserGetInfo
(
NULL
,
1
,
(
LPBYTE
*
)
&
ui1
)
==
NERR_Success
,
"NetWkstaUserGetInfo is successful"
);
"NetWkstaUserGetInfo is successful
\n
"
);
ok
(
lstrcmpW
(
ui1
->
wkui1_username
,
ui0
->
wkui0_username
)
==
0
,
ok
(
lstrcmpW
(
ui1
->
wkui1_username
,
ui0
->
wkui0_username
)
==
0
,
"the same name as returned for level 0"
);
"the same name as returned for level 0
\n
"
);
pNetApiBufferSize
(
ui1
,
&
dwSize
);
pNetApiBufferSize
(
ui1
,
&
dwSize
);
ok
(
dwSize
>=
(
sizeof
(
WKSTA_USER_INFO_1
)
+
ok
(
dwSize
>=
(
sizeof
(
WKSTA_USER_INFO_1
)
+
(
lstrlenW
(
ui1
->
wkui1_username
)
+
(
lstrlenW
(
ui1
->
wkui1_username
)
+
lstrlenW
(
ui1
->
wkui1_logon_domain
)
+
lstrlenW
(
ui1
->
wkui1_logon_domain
)
+
lstrlenW
(
ui1
->
wkui1_oth_domains
)
+
lstrlenW
(
ui1
->
wkui1_oth_domains
)
+
lstrlenW
(
ui1
->
wkui1_logon_server
))
*
sizeof
(
WCHAR
)),
lstrlenW
(
ui1
->
wkui1_logon_server
))
*
sizeof
(
WCHAR
)),
"Is allocated with NetApiBufferAllocate"
);
"Is allocated with NetApiBufferAllocate
\n
"
);
/* Level 1101 */
/* Level 1101 */
ok
(
pNetWkstaUserGetInfo
(
NULL
,
1101
,
(
LPBYTE
*
)
&
ui1101
)
==
NERR_Success
,
ok
(
pNetWkstaUserGetInfo
(
NULL
,
1101
,
(
LPBYTE
*
)
&
ui1101
)
==
NERR_Success
,
"NetWkstaUserGetInfo is successful"
);
"NetWkstaUserGetInfo is successful
\n
"
);
ok
(
lstrcmpW
(
ui1101
->
wkui1101_oth_domains
,
ui1
->
wkui1_oth_domains
)
==
0
,
ok
(
lstrcmpW
(
ui1101
->
wkui1101_oth_domains
,
ui1
->
wkui1_oth_domains
)
==
0
,
"the same oth_domains as returned for level 1"
);
"the same oth_domains as returned for level 1
\n
"
);
pNetApiBufferSize
(
ui1101
,
&
dwSize
);
pNetApiBufferSize
(
ui1101
,
&
dwSize
);
ok
(
dwSize
>=
(
sizeof
(
WKSTA_USER_INFO_1101
)
+
ok
(
dwSize
>=
(
sizeof
(
WKSTA_USER_INFO_1101
)
+
lstrlenW
(
ui1101
->
wkui1101_oth_domains
)
*
sizeof
(
WCHAR
)),
lstrlenW
(
ui1101
->
wkui1101_oth_domains
)
*
sizeof
(
WCHAR
)),
"Is allocated with NetApiBufferAllocate"
);
"Is allocated with NetApiBufferAllocate
\n
"
);
pNetApiBufferFree
(
ui0
);
pNetApiBufferFree
(
ui0
);
pNetApiBufferFree
(
ui1
);
pNetApiBufferFree
(
ui1
);
...
@@ -120,7 +120,7 @@ static void run_wkstausergetinfo_tests(void)
...
@@ -120,7 +120,7 @@ static void run_wkstausergetinfo_tests(void)
/* errors handling */
/* errors handling */
ok
(
pNetWkstaUserGetInfo
(
NULL
,
10000
,
(
LPBYTE
*
)
&
ui0
)
==
ERROR_INVALID_LEVEL
,
ok
(
pNetWkstaUserGetInfo
(
NULL
,
10000
,
(
LPBYTE
*
)
&
ui0
)
==
ERROR_INVALID_LEVEL
,
"Invalid level"
);
"Invalid level
\n
"
);
}
}
static
void
run_wkstatransportenum_tests
(
void
)
static
void
run_wkstatransportenum_tests
(
void
)
...
@@ -136,7 +136,7 @@ static void run_wkstatransportenum_tests(void)
...
@@ -136,7 +136,7 @@ static void run_wkstatransportenum_tests(void)
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
1
,
NULL
,
MAX_PREFERRED_LENGTH
,
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
1
,
NULL
,
MAX_PREFERRED_LENGTH
,
NULL
,
&
totalEntries
,
NULL
);
NULL
,
&
totalEntries
,
NULL
);
ok
(
apiReturn
==
ERROR_INVALID_LEVEL
||
apiReturn
==
ERROR_INVALID_PARAMETER
,
ok
(
apiReturn
==
ERROR_INVALID_LEVEL
||
apiReturn
==
ERROR_INVALID_PARAMETER
,
"NetWkstaTransportEnum returned %ld"
,
apiReturn
);
"NetWkstaTransportEnum returned %ld
\n
"
,
apiReturn
);
/* 2nd check: is param 5 passed? (only if level passes?) */
/* 2nd check: is param 5 passed? (only if level passes?) */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
NULL
,
MAX_PREFERRED_LENGTH
,
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
NULL
,
MAX_PREFERRED_LENGTH
,
...
@@ -147,30 +147,30 @@ static void run_wkstatransportenum_tests(void)
...
@@ -147,30 +147,30 @@ static void run_wkstatransportenum_tests(void)
return
;
return
;
ok
(
apiReturn
==
STATUS_ACCESS_VIOLATION
||
apiReturn
==
ERROR_INVALID_PARAMETER
,
ok
(
apiReturn
==
STATUS_ACCESS_VIOLATION
||
apiReturn
==
ERROR_INVALID_PARAMETER
,
"NetWkstaTransportEnum returned %ld"
,
apiReturn
);
"NetWkstaTransportEnum returned %ld
\n
"
,
apiReturn
);
/* 3rd check: is param 3 passed? */
/* 3rd check: is param 3 passed? */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
NULL
,
MAX_PREFERRED_LENGTH
,
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
NULL
,
MAX_PREFERRED_LENGTH
,
NULL
,
NULL
,
NULL
);
NULL
,
NULL
,
NULL
);
ok
(
apiReturn
==
STATUS_ACCESS_VIOLATION
||
apiReturn
==
ERROR_INVALID_PARAMETER
,
ok
(
apiReturn
==
STATUS_ACCESS_VIOLATION
||
apiReturn
==
ERROR_INVALID_PARAMETER
,
"NetWkstaTransportEnum returned %ld"
,
apiReturn
);
"NetWkstaTransportEnum returned %ld
\n
"
,
apiReturn
);
/* 4th check: is param 6 passed? */
/* 4th check: is param 6 passed? */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
&
bufPtr
,
MAX_PREFERRED_LENGTH
,
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
&
bufPtr
,
MAX_PREFERRED_LENGTH
,
&
entriesRead
,
NULL
,
NULL
);
&
entriesRead
,
NULL
,
NULL
);
ok
(
apiReturn
==
RPC_X_NULL_REF_POINTER
,
"null pointer"
);
ok
(
apiReturn
==
RPC_X_NULL_REF_POINTER
,
"null pointer
\n
"
);
/* final check: valid return, actually get data back */
/* final check: valid return, actually get data back */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
&
bufPtr
,
MAX_PREFERRED_LENGTH
,
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
&
bufPtr
,
MAX_PREFERRED_LENGTH
,
&
entriesRead
,
&
totalEntries
,
NULL
);
&
entriesRead
,
&
totalEntries
,
NULL
);
ok
(
apiReturn
==
NERR_Success
||
apiReturn
==
ERROR_NETWORK_UNREACHABLE
,
ok
(
apiReturn
==
NERR_Success
||
apiReturn
==
ERROR_NETWORK_UNREACHABLE
,
"NetWkstaTransportEnum returned %ld"
,
apiReturn
);
"NetWkstaTransportEnum returned %ld
\n
"
,
apiReturn
);
if
(
apiReturn
==
NERR_Success
)
{
if
(
apiReturn
==
NERR_Success
)
{
/* WKSTA_TRANSPORT_INFO_0 *transports = (WKSTA_TRANSPORT_INFO_0 *)bufPtr; */
/* WKSTA_TRANSPORT_INFO_0 *transports = (WKSTA_TRANSPORT_INFO_0 *)bufPtr; */
ok
(
bufPtr
!=
NULL
,
"got data back"
);
ok
(
bufPtr
!=
NULL
,
"got data back
\n
"
);
ok
(
entriesRead
>
0
,
"read at least one transport"
);
ok
(
entriesRead
>
0
,
"read at least one transport
\n
"
);
ok
(
totalEntries
>
0
,
"at least one transport"
);
ok
(
totalEntries
>
0
,
"at least one transport
\n
"
);
pNetApiBufferFree
(
bufPtr
);
pNetApiBufferFree
(
bufPtr
);
}
}
}
}
...
...
dlls/shlwapi/tests/clist.c
View file @
ce7c3b50
...
@@ -215,31 +215,31 @@ static HRESULT (WINAPI *pSHLWAPI_214)(_IDummyStream*,ULARGE_INTEGER*);
...
@@ -215,31 +215,31 @@ static HRESULT (WINAPI *pSHLWAPI_214)(_IDummyStream*,ULARGE_INTEGER*);
static
void
InitFunctionPtrs
()
static
void
InitFunctionPtrs
()
{
{
SHLWAPI_hshlwapi
=
LoadLibraryA
(
"shlwapi.dll"
);
SHLWAPI_hshlwapi
=
LoadLibraryA
(
"shlwapi.dll"
);
ok
(
SHLWAPI_hshlwapi
!=
0
,
"LoadLibrary failed"
);
ok
(
SHLWAPI_hshlwapi
!=
0
,
"LoadLibrary failed
\n
"
);
if
(
SHLWAPI_hshlwapi
)
if
(
SHLWAPI_hshlwapi
)
{
{
pSHLWAPI_17
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
17
);
pSHLWAPI_17
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
17
);
ok
(
pSHLWAPI_17
!=
0
,
"No Ordinal 17"
);
ok
(
pSHLWAPI_17
!=
0
,
"No Ordinal 17
\n
"
);
pSHLWAPI_18
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
18
);
pSHLWAPI_18
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
18
);
ok
(
pSHLWAPI_18
!=
0
,
"No Ordinal 18"
);
ok
(
pSHLWAPI_18
!=
0
,
"No Ordinal 18
\n
"
);
pSHLWAPI_19
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
19
);
pSHLWAPI_19
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
19
);
ok
(
pSHLWAPI_19
!=
0
,
"No Ordinal 19"
);
ok
(
pSHLWAPI_19
!=
0
,
"No Ordinal 19
\n
"
);
pSHLWAPI_20
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
20
);
pSHLWAPI_20
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
20
);
ok
(
pSHLWAPI_20
!=
0
,
"No Ordinal 20"
);
ok
(
pSHLWAPI_20
!=
0
,
"No Ordinal 20
\n
"
);
pSHLWAPI_21
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
21
);
pSHLWAPI_21
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
21
);
ok
(
pSHLWAPI_21
!=
0
,
"No Ordinal 21"
);
ok
(
pSHLWAPI_21
!=
0
,
"No Ordinal 21
\n
"
);
pSHLWAPI_22
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
22
);
pSHLWAPI_22
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
22
);
ok
(
pSHLWAPI_22
!=
0
,
"No Ordinal 22"
);
ok
(
pSHLWAPI_22
!=
0
,
"No Ordinal 22
\n
"
);
pSHLWAPI_166
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
166
);
pSHLWAPI_166
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
166
);
ok
(
pSHLWAPI_166
!=
0
,
"No Ordinal 166"
);
ok
(
pSHLWAPI_166
!=
0
,
"No Ordinal 166
\n
"
);
pSHLWAPI_184
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
184
);
pSHLWAPI_184
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
184
);
ok
(
pSHLWAPI_184
!=
0
,
"No Ordinal 184"
);
ok
(
pSHLWAPI_184
!=
0
,
"No Ordinal 184
\n
"
);
pSHLWAPI_212
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
212
);
pSHLWAPI_212
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
212
);
ok
(
pSHLWAPI_212
!=
0
,
"No Ordinal 212"
);
ok
(
pSHLWAPI_212
!=
0
,
"No Ordinal 212
\n
"
);
pSHLWAPI_213
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
213
);
pSHLWAPI_213
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
213
);
ok
(
pSHLWAPI_213
!=
0
,
"No Ordinal 213"
);
ok
(
pSHLWAPI_213
!=
0
,
"No Ordinal 213
\n
"
);
pSHLWAPI_214
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
214
);
pSHLWAPI_214
=
(
void
*
)
GetProcAddress
(
SHLWAPI_hshlwapi
,
(
LPSTR
)
214
);
ok
(
pSHLWAPI_214
!=
0
,
"No Ordinal 214"
);
ok
(
pSHLWAPI_214
!=
0
,
"No Ordinal 214
\n
"
);
}
}
}
}
...
@@ -289,30 +289,30 @@ static void test_CList(void)
...
@@ -289,30 +289,30 @@ static void test_CList(void)
/* Add it */
/* Add it */
hRet
=
pSHLWAPI_20
(
&
list
,
inserted
);
hRet
=
pSHLWAPI_20
(
&
list
,
inserted
);
ok
(
hRet
>
S_OK
,
"failed list add"
);
ok
(
hRet
>
S_OK
,
"failed list add
\n
"
);
if
(
hRet
>
S_OK
)
if
(
hRet
>
S_OK
)
{
{
ok
(
list
&&
list
->
ulSize
,
"item not added"
);
ok
(
list
&&
list
->
ulSize
,
"item not added
\n
"
);
/* Find it */
/* Find it */
inserted
=
pSHLWAPI_22
(
list
,
item
->
ulId
);
inserted
=
pSHLWAPI_22
(
list
,
item
->
ulId
);
ok
(
inserted
!=
NULL
,
"lost after adding"
);
ok
(
inserted
!=
NULL
,
"lost after adding
\n
"
);
ok
(
!
inserted
||
inserted
->
ulId
!=
~
0UL
,
"find returned a container"
);
ok
(
!
inserted
||
inserted
->
ulId
!=
~
0UL
,
"find returned a container
\n
"
);
/* Check size */
/* Check size */
if
(
inserted
&&
inserted
->
ulSize
&
0x3
)
if
(
inserted
&&
inserted
->
ulSize
&
0x3
)
{
{
/* Contained */
/* Contained */
ok
(
inserted
[
-
1
].
ulId
==
~
0UL
,
"invalid size is not countained"
);
ok
(
inserted
[
-
1
].
ulId
==
~
0UL
,
"invalid size is not countained
\n
"
);
ok
(
inserted
[
-
1
].
ulSize
>
inserted
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
ok
(
inserted
[
-
1
].
ulSize
>
inserted
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
"container too small"
);
"container too small
\n
"
);
}
}
else
if
(
inserted
)
else
if
(
inserted
)
{
{
ok
(
inserted
->
ulSize
==
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
ok
(
inserted
->
ulSize
==
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
"id %ld size wrong (%ld!=%ld)"
,
inserted
->
ulId
,
inserted
->
ulSize
,
"id %ld size wrong (%ld!=%ld)
\n
"
,
inserted
->
ulId
,
inserted
->
ulSize
,
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
));
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
));
}
}
if
(
inserted
)
if
(
inserted
)
...
@@ -324,9 +324,9 @@ static void test_CList(void)
...
@@ -324,9 +324,9 @@ static void test_CList(void)
if
(
bufftest
[
sizeof
(
SHLWAPI_CLIST
)
+
i
]
!=
i
*
2
)
if
(
bufftest
[
sizeof
(
SHLWAPI_CLIST
)
+
i
]
!=
i
*
2
)
bDataOK
=
FALSE
;
bDataOK
=
FALSE
;
ok
(
bDataOK
==
TRUE
,
"data corrupted on insert"
);
ok
(
bDataOK
==
TRUE
,
"data corrupted on insert
\n
"
);
}
}
ok
(
!
inserted
||
inserted
->
ulId
==
item
->
ulId
,
"find got wrong item"
);
ok
(
!
inserted
||
inserted
->
ulId
==
item
->
ulId
,
"find got wrong item
\n
"
);
}
}
item
++
;
item
++
;
}
}
...
@@ -335,32 +335,32 @@ static void test_CList(void)
...
@@ -335,32 +335,32 @@ static void test_CList(void)
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
hRet
=
pSHLWAPI_17
(
&
streamobj
,
list
);
hRet
=
pSHLWAPI_17
(
&
streamobj
,
list
);
ok
(
hRet
==
S_OK
,
"write failed"
);
ok
(
hRet
==
S_OK
,
"write failed
\n
"
);
if
(
hRet
==
S_OK
)
if
(
hRet
==
S_OK
)
{
{
/* 1 call for each element, + 1 for OK (use our null element for this) */
/* 1 call for each element, + 1 for OK (use our null element for this) */
ok
(
streamobj
.
writecalls
==
sizeof
(
SHLWAPI_CLIST_items
)
/
sizeof
(
SHLWAPI_CLIST
),
ok
(
streamobj
.
writecalls
==
sizeof
(
SHLWAPI_CLIST_items
)
/
sizeof
(
SHLWAPI_CLIST
),
"wrong call count"
);
"wrong call count
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read() in write"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read() in write
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() in write"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() in write
\n
"
);
}
}
/* Failure cases for writing */
/* Failure cases for writing */
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
streamobj
.
failwritecall
=
TRUE
;
streamobj
.
failwritecall
=
TRUE
;
hRet
=
pSHLWAPI_17
(
&
streamobj
,
list
);
hRet
=
pSHLWAPI_17
(
&
streamobj
,
list
);
ok
(
hRet
==
STG_E_ACCESSDENIED
,
"changed object failure return"
);
ok
(
hRet
==
STG_E_ACCESSDENIED
,
"changed object failure return
\n
"
);
ok
(
streamobj
.
writecalls
==
1
,
"called object after failure"
);
ok
(
streamobj
.
writecalls
==
1
,
"called object after failure
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read() after failure"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read() after failure
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() after failure"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() after failure
\n
"
);
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
streamobj
.
failwritesize
=
TRUE
;
streamobj
.
failwritesize
=
TRUE
;
hRet
=
pSHLWAPI_17
(
&
streamobj
,
list
);
hRet
=
pSHLWAPI_17
(
&
streamobj
,
list
);
ok
(
hRet
==
STG_E_MEDIUMFULL
,
"changed size failure return"
);
ok
(
hRet
==
STG_E_MEDIUMFULL
,
"changed size failure return
\n
"
);
ok
(
streamobj
.
writecalls
==
1
,
"called object after size failure"
);
ok
(
streamobj
.
writecalls
==
1
,
"called object after size failure
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read() after failure"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read() after failure
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() after failure"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() after failure
\n
"
);
/* Invalid inputs for adding */
/* Invalid inputs for adding */
inserted
=
(
LPSHLWAPI_CLIST
)
buff
;
inserted
=
(
LPSHLWAPI_CLIST
)
buff
;
...
@@ -368,48 +368,48 @@ static void test_CList(void)
...
@@ -368,48 +368,48 @@ static void test_CList(void)
inserted
->
ulId
=
33
;
inserted
->
ulId
=
33
;
hRet
=
pSHLWAPI_20
(
&
list
,
inserted
);
hRet
=
pSHLWAPI_20
(
&
list
,
inserted
);
/* The call succeeds but the item is not inserted */
/* The call succeeds but the item is not inserted */
ok
(
hRet
==
S_OK
,
"failed bad element size"
);
ok
(
hRet
==
S_OK
,
"failed bad element size
\n
"
);
inserted
=
pSHLWAPI_22
(
list
,
33
);
inserted
=
pSHLWAPI_22
(
list
,
33
);
ok
(
inserted
==
NULL
,
"inserted bad element size"
);
ok
(
inserted
==
NULL
,
"inserted bad element size
\n
"
);
inserted
=
(
LPSHLWAPI_CLIST
)
buff
;
inserted
=
(
LPSHLWAPI_CLIST
)
buff
;
inserted
->
ulSize
=
44
;
inserted
->
ulSize
=
44
;
inserted
->
ulId
=
~
0UL
;
inserted
->
ulId
=
~
0UL
;
hRet
=
pSHLWAPI_20
(
&
list
,
inserted
);
hRet
=
pSHLWAPI_20
(
&
list
,
inserted
);
/* The call succeeds but the item is not inserted */
/* The call succeeds but the item is not inserted */
ok
(
hRet
==
S_OK
,
"failed adding a container"
);
ok
(
hRet
==
S_OK
,
"failed adding a container
\n
"
);
item
=
SHLWAPI_CLIST_items
;
item
=
SHLWAPI_CLIST_items
;
/* Look for non-existing item in populated list */
/* Look for non-existing item in populated list */
inserted
=
pSHLWAPI_22
(
list
,
99999999
);
inserted
=
pSHLWAPI_22
(
list
,
99999999
);
ok
(
inserted
==
NULL
,
"found a non-existing item"
);
ok
(
inserted
==
NULL
,
"found a non-existing item
\n
"
);
while
(
item
->
ulSize
)
while
(
item
->
ulSize
)
{
{
/* Delete items */
/* Delete items */
BOOL
bRet
=
pSHLWAPI_21
(
&
list
,
item
->
ulId
);
BOOL
bRet
=
pSHLWAPI_21
(
&
list
,
item
->
ulId
);
ok
(
bRet
==
TRUE
,
"couldn't find item to delete"
);
ok
(
bRet
==
TRUE
,
"couldn't find item to delete
\n
"
);
item
++
;
item
++
;
}
}
/* Look for non-existing item in empty list */
/* Look for non-existing item in empty list */
inserted
=
pSHLWAPI_22
(
list
,
99999999
);
inserted
=
pSHLWAPI_22
(
list
,
99999999
);
ok
(
inserted
==
NULL
,
"found an item in empty list"
);
ok
(
inserted
==
NULL
,
"found an item in empty list
\n
"
);
/* Create a list by reading in data */
/* Create a list by reading in data */
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
hRet
=
pSHLWAPI_18
(
&
streamobj
,
&
list
);
hRet
=
pSHLWAPI_18
(
&
streamobj
,
&
list
);
ok
(
hRet
==
S_OK
,
"failed create from Read()"
);
ok
(
hRet
==
S_OK
,
"failed create from Read()
\n
"
);
if
(
hRet
==
S_OK
)
if
(
hRet
==
S_OK
)
{
{
ok
(
streamobj
.
readbeyondend
==
FALSE
,
"read beyond end"
);
ok
(
streamobj
.
readbeyondend
==
FALSE
,
"read beyond end
\n
"
);
/* 2 calls per item, but only 1 for the terminator */
/* 2 calls per item, but only 1 for the terminator */
ok
(
streamobj
.
readcalls
==
sizeof
(
SHLWAPI_CLIST_items
)
/
sizeof
(
SHLWAPI_CLIST
)
*
2
-
1
,
ok
(
streamobj
.
readcalls
==
sizeof
(
SHLWAPI_CLIST_items
)
/
sizeof
(
SHLWAPI_CLIST
)
*
2
-
1
,
"wrong call count"
);
"wrong call count
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write() from create"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write() from create
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() from create"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() from create
\n
"
);
item
=
SHLWAPI_CLIST_items
;
item
=
SHLWAPI_CLIST_items
;
...
@@ -417,25 +417,25 @@ static void test_CList(void)
...
@@ -417,25 +417,25 @@ static void test_CList(void)
while
(
item
->
ulSize
)
while
(
item
->
ulSize
)
{
{
inserted
=
pSHLWAPI_22
(
list
,
item
->
ulId
);
inserted
=
pSHLWAPI_22
(
list
,
item
->
ulId
);
ok
(
inserted
!=
NULL
,
"lost after adding"
);
ok
(
inserted
!=
NULL
,
"lost after adding
\n
"
);
ok
(
!
inserted
||
inserted
->
ulId
!=
~
0UL
,
"find returned a container"
);
ok
(
!
inserted
||
inserted
->
ulId
!=
~
0UL
,
"find returned a container
\n
"
);
/* Check size */
/* Check size */
if
(
inserted
&&
inserted
->
ulSize
&
0x3
)
if
(
inserted
&&
inserted
->
ulSize
&
0x3
)
{
{
/* Contained */
/* Contained */
ok
(
inserted
[
-
1
].
ulId
==
~
0UL
,
"invalid size is not countained"
);
ok
(
inserted
[
-
1
].
ulId
==
~
0UL
,
"invalid size is not countained
\n
"
);
ok
(
inserted
[
-
1
].
ulSize
>
inserted
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
ok
(
inserted
[
-
1
].
ulSize
>
inserted
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
"container too small"
);
"container too small
\n
"
);
}
}
else
if
(
inserted
)
else
if
(
inserted
)
{
{
ok
(
inserted
->
ulSize
==
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
ok
(
inserted
->
ulSize
==
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
),
"id %ld size wrong (%ld!=%ld)"
,
inserted
->
ulId
,
inserted
->
ulSize
,
"id %ld size wrong (%ld!=%ld)
\n
"
,
inserted
->
ulId
,
inserted
->
ulSize
,
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
));
item
->
ulSize
+
sizeof
(
SHLWAPI_CLIST
));
}
}
ok
(
!
inserted
||
inserted
->
ulId
==
item
->
ulId
,
"find got wrong item"
);
ok
(
!
inserted
||
inserted
->
ulId
==
item
->
ulId
,
"find got wrong item
\n
"
);
if
(
inserted
)
if
(
inserted
)
{
{
BOOL
bDataOK
=
TRUE
;
BOOL
bDataOK
=
TRUE
;
...
@@ -445,7 +445,7 @@ static void test_CList(void)
...
@@ -445,7 +445,7 @@ static void test_CList(void)
if
(
bufftest
[
sizeof
(
SHLWAPI_CLIST
)
+
i
]
!=
i
*
2
)
if
(
bufftest
[
sizeof
(
SHLWAPI_CLIST
)
+
i
]
!=
i
*
2
)
bDataOK
=
FALSE
;
bDataOK
=
FALSE
;
ok
(
bDataOK
==
TRUE
,
"data corrupted on insert"
);
ok
(
bDataOK
==
TRUE
,
"data corrupted on insert
\n
"
);
}
}
item
++
;
item
++
;
}
}
...
@@ -455,21 +455,21 @@ static void test_CList(void)
...
@@ -455,21 +455,21 @@ static void test_CList(void)
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
streamobj
.
failreadcall
=
TRUE
;
streamobj
.
failreadcall
=
TRUE
;
hRet
=
pSHLWAPI_18
(
&
streamobj
,
&
list
);
hRet
=
pSHLWAPI_18
(
&
streamobj
,
&
list
);
ok
(
hRet
==
STG_E_ACCESSDENIED
,
"changed object failure return"
);
ok
(
hRet
==
STG_E_ACCESSDENIED
,
"changed object failure return
\n
"
);
ok
(
streamobj
.
readbeyondend
==
FALSE
,
"read beyond end"
);
ok
(
streamobj
.
readbeyondend
==
FALSE
,
"read beyond end
\n
"
);
ok
(
streamobj
.
readcalls
==
1
,
"called object after read failure"
);
ok
(
streamobj
.
readcalls
==
1
,
"called object after read failure
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write() after read failure"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write() after read failure
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() after read failure"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek() after read failure
\n
"
);
/* Read returns large object */
/* Read returns large object */
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
streamobj
.
readreturnlarge
=
TRUE
;
streamobj
.
readreturnlarge
=
TRUE
;
hRet
=
pSHLWAPI_18
(
&
streamobj
,
&
list
);
hRet
=
pSHLWAPI_18
(
&
streamobj
,
&
list
);
ok
(
hRet
==
S_OK
,
"failed create from Read() with large item"
);
ok
(
hRet
==
S_OK
,
"failed create from Read() with large item
\n
"
);
ok
(
streamobj
.
readbeyondend
==
FALSE
,
"read beyond end"
);
ok
(
streamobj
.
readbeyondend
==
FALSE
,
"read beyond end
\n
"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write() after read failure"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write() after read failure
\n
"
);
ok
(
streamobj
.
seekcalls
==
2
,
"wrong Seek() call count (%d)"
,
streamobj
.
seekcalls
);
ok
(
streamobj
.
seekcalls
==
2
,
"wrong Seek() call count (%d)
\n
"
,
streamobj
.
seekcalls
);
pSHLWAPI_19
(
list
);
pSHLWAPI_19
(
list
);
}
}
...
@@ -485,46 +485,46 @@ static void test_SHLWAPI_166(void)
...
@@ -485,46 +485,46 @@ static void test_SHLWAPI_166(void)
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
bRet
=
pSHLWAPI_166
(
&
streamobj
);
bRet
=
pSHLWAPI_166
(
&
streamobj
);
ok
(
bRet
==
TRUE
,
"failed before seek adjusted"
);
ok
(
bRet
==
TRUE
,
"failed before seek adjusted
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()
\n
"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count
\n
"
);
streamobj
.
statcalls
=
0
;
streamobj
.
statcalls
=
0
;
streamobj
.
pos
.
QuadPart
=
50001
;
streamobj
.
pos
.
QuadPart
=
50001
;
bRet
=
pSHLWAPI_166
(
&
streamobj
);
bRet
=
pSHLWAPI_166
(
&
streamobj
);
ok
(
bRet
==
FALSE
,
"failed after seek adjusted"
);
ok
(
bRet
==
FALSE
,
"failed after seek adjusted
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()
\n
"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count
\n
"
);
/* Failure cases */
/* Failure cases */
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
streamobj
.
pos
.
QuadPart
=
50001
;
streamobj
.
pos
.
QuadPart
=
50001
;
streamobj
.
failstatcall
=
TRUE
;
/* 1: Stat() Bad, Read() OK */
streamobj
.
failstatcall
=
TRUE
;
/* 1: Stat() Bad, Read() OK */
bRet
=
pSHLWAPI_166
(
&
streamobj
);
bRet
=
pSHLWAPI_166
(
&
streamobj
);
ok
(
bRet
==
FALSE
,
"should be FALSE after read is OK"
);
ok
(
bRet
==
FALSE
,
"should be FALSE after read is OK
\n
"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
seekcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
pos
.
QuadPart
==
0
,
"Didn't seek to start"
);
ok
(
streamobj
.
pos
.
QuadPart
==
0
,
"Didn't seek to start
\n
"
);
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
streamobj
.
pos
.
QuadPart
=
50001
;
streamobj
.
pos
.
QuadPart
=
50001
;
streamobj
.
failstatcall
=
TRUE
;
streamobj
.
failstatcall
=
TRUE
;
streamobj
.
failreadcall
=
TRUE
;
/* 2: Stat() Bad, Read() Bad Also */
streamobj
.
failreadcall
=
TRUE
;
/* 2: Stat() Bad, Read() Bad Also */
bRet
=
pSHLWAPI_166
(
&
streamobj
);
bRet
=
pSHLWAPI_166
(
&
streamobj
);
ok
(
bRet
==
TRUE
,
"Should be true after read fails"
);
ok
(
bRet
==
TRUE
,
"Should be true after read fails
\n
"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"Called Seek()"
);
ok
(
streamobj
.
seekcalls
==
0
,
"Called Seek()
\n
"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
pos
.
QuadPart
==
50001
,
"called Seek() after read failed"
);
ok
(
streamobj
.
pos
.
QuadPart
==
50001
,
"called Seek() after read failed
\n
"
);
}
}
static
void
test_SHLWAPI_184
(
void
)
static
void
test_SHLWAPI_184
(
void
)
...
@@ -539,10 +539,10 @@ static void test_SHLWAPI_184(void)
...
@@ -539,10 +539,10 @@ static void test_SHLWAPI_184(void)
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
hRet
=
pSHLWAPI_184
(
&
streamobj
,
buff
,
sizeof
(
buff
));
hRet
=
pSHLWAPI_184
(
&
streamobj
,
buff
,
sizeof
(
buff
));
ok
(
hRet
==
S_OK
,
"failed Read()"
);
ok
(
hRet
==
S_OK
,
"failed Read()
\n
"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
readcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()
\n
"
);
}
}
static
void
test_SHLWAPI_212
(
void
)
static
void
test_SHLWAPI_212
(
void
)
...
@@ -557,10 +557,10 @@ static void test_SHLWAPI_212(void)
...
@@ -557,10 +557,10 @@ static void test_SHLWAPI_212(void)
InitDummyStream
(
&
streamobj
);
InitDummyStream
(
&
streamobj
);
hRet
=
pSHLWAPI_212
(
&
streamobj
,
buff
,
sizeof
(
buff
));
hRet
=
pSHLWAPI_212
(
&
streamobj
,
buff
,
sizeof
(
buff
));
ok
(
hRet
==
S_OK
,
"failed Write()"
);
ok
(
hRet
==
S_OK
,
"failed Write()
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()
\n
"
);
ok
(
streamobj
.
writecalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
writecalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()
\n
"
);
}
}
static
void
test_SHLWAPI_213
(
void
)
static
void
test_SHLWAPI_213
(
void
)
...
@@ -579,15 +579,15 @@ static void test_SHLWAPI_213(void)
...
@@ -579,15 +579,15 @@ static void test_SHLWAPI_213(void)
streamobj
.
seekcalls
=
0
;
streamobj
.
seekcalls
=
0
;
pSHLWAPI_213
(
&
streamobj
);
/* Should rewind */
pSHLWAPI_213
(
&
streamobj
);
/* Should rewind */
ok
(
streamobj
.
statcalls
==
0
,
"called Stat()"
);
ok
(
streamobj
.
statcalls
==
0
,
"called Stat()
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
seekcalls
==
1
,
"wrong call count
\n
"
);
ul
.
QuadPart
=
50001
;
ul
.
QuadPart
=
50001
;
hRet
=
pSHLWAPI_214
(
&
streamobj
,
&
ul
);
hRet
=
pSHLWAPI_214
(
&
streamobj
,
&
ul
);
ok
(
hRet
==
S_OK
,
"failed Stat()"
);
ok
(
hRet
==
S_OK
,
"failed Stat()
\n
"
);
ok
(
ul
.
QuadPart
==
0
,
"213 didn't rewind stream"
);
ok
(
ul
.
QuadPart
==
0
,
"213 didn't rewind stream
\n
"
);
}
}
static
void
test_SHLWAPI_214
(
void
)
static
void
test_SHLWAPI_214
(
void
)
...
@@ -607,12 +607,12 @@ static void test_SHLWAPI_214(void)
...
@@ -607,12 +607,12 @@ static void test_SHLWAPI_214(void)
streamobj
.
seekcalls
=
0
;
streamobj
.
seekcalls
=
0
;
hRet
=
pSHLWAPI_214
(
&
streamobj
,
&
ul
);
hRet
=
pSHLWAPI_214
(
&
streamobj
,
&
ul
);
ok
(
hRet
==
S_OK
,
"failed Stat()"
);
ok
(
hRet
==
S_OK
,
"failed Stat()
\n
"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count"
);
ok
(
streamobj
.
statcalls
==
1
,
"wrong call count
\n
"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()"
);
ok
(
streamobj
.
readcalls
==
0
,
"called Read()
\n
"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()"
);
ok
(
streamobj
.
writecalls
==
0
,
"called Write()
\n
"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()"
);
ok
(
streamobj
.
seekcalls
==
0
,
"called Seek()
\n
"
);
ok
(
ul
.
QuadPart
==
5000l
,
"Stat gave wrong size"
);
ok
(
ul
.
QuadPart
==
5000l
,
"Stat gave wrong size
\n
"
);
}
}
START_TEST
(
clist
)
START_TEST
(
clist
)
...
...
dlls/shlwapi/tests/clsid.c
View file @
ce7c3b50
...
@@ -114,13 +114,13 @@ static void test_ClassIDs(void)
...
@@ -114,13 +114,13 @@ static void test_ClassIDs(void)
while
(
*
guids
)
while
(
*
guids
)
{
{
dwLen
=
pSHLWAPI_23
(
*
guids
,
szBuff
,
256
);
dwLen
=
pSHLWAPI_23
(
*
guids
,
szBuff
,
256
);
ok
(
dwLen
==
39
,
"wrong size for id %d"
,
i
);
ok
(
dwLen
==
39
,
"wrong size for id %d
\n
"
,
i
);
bRet
=
pSHLWAPI_269
(
szBuff
,
&
guid
);
bRet
=
pSHLWAPI_269
(
szBuff
,
&
guid
);
ok
(
bRet
!=
FALSE
,
"created invalid string '%s'"
,
szBuff
);
ok
(
bRet
!=
FALSE
,
"created invalid string '%s'
\n
"
,
szBuff
);
if
(
bRet
)
if
(
bRet
)
ok
(
IsEqualGUID
(
*
guids
,
&
guid
),
"GUID created wrong %d"
,
i
);
ok
(
IsEqualGUID
(
*
guids
,
&
guid
),
"GUID created wrong %d
\n
"
,
i
);
guids
++
;
guids
++
;
i
++
;
i
++
;
...
@@ -128,42 +128,42 @@ static void test_ClassIDs(void)
...
@@ -128,42 +128,42 @@ static void test_ClassIDs(void)
/* Test endianess */
/* Test endianess */
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
256
);
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
256
);
ok
(
dwLen
==
39
,
"wrong size for IID_Endianess"
);
ok
(
dwLen
==
39
,
"wrong size for IID_Endianess
\n
"
);
ok
(
!
strcmp
(
szBuff
,
"{01020304-0506-0708-090A-0B0C0D0E0F0A}"
),
ok
(
!
strcmp
(
szBuff
,
"{01020304-0506-0708-090A-0B0C0D0E0F0A}"
),
"Endianess Broken, got '%s'"
,
szBuff
);
"Endianess Broken, got '%s'
\n
"
,
szBuff
);
/* test lengths */
/* test lengths */
szBuff
[
0
]
=
':'
;
szBuff
[
0
]
=
':'
;
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
0
);
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
0
);
ok
(
dwLen
==
0
,
"accepted bad length"
);
ok
(
dwLen
==
0
,
"accepted bad length
\n
"
);
ok
(
szBuff
[
0
]
==
':'
,
"wrote to buffer with no length"
);
ok
(
szBuff
[
0
]
==
':'
,
"wrote to buffer with no length
\n
"
);
szBuff
[
0
]
=
':'
;
szBuff
[
0
]
=
':'
;
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
38
);
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
38
);
ok
(
dwLen
==
0
,
"accepted bad length"
);
ok
(
dwLen
==
0
,
"accepted bad length
\n
"
);
ok
(
szBuff
[
0
]
==
':'
,
"wrote to buffer with no length"
);
ok
(
szBuff
[
0
]
==
':'
,
"wrote to buffer with no length
\n
"
);
szBuff
[
0
]
=
':'
;
szBuff
[
0
]
=
':'
;
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
39
);
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
39
);
ok
(
dwLen
==
39
,
"rejected ok length"
);
ok
(
dwLen
==
39
,
"rejected ok length
\n
"
);
ok
(
szBuff
[
0
]
==
'{'
,
"Didn't write to buffer with ok length"
);
ok
(
szBuff
[
0
]
==
'{'
,
"Didn't write to buffer with ok length
\n
"
);
/* Test string */
/* Test string */
strcpy
(
szBuff
,
"{xxx-"
);
strcpy
(
szBuff
,
"{xxx-"
);
bRet
=
pSHLWAPI_269
(
szBuff
,
&
guid
);
bRet
=
pSHLWAPI_269
(
szBuff
,
&
guid
);
ok
(
bRet
==
FALSE
,
"accepted invalid string"
);
ok
(
bRet
==
FALSE
,
"accepted invalid string
\n
"
);
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
39
);
dwLen
=
pSHLWAPI_23
(
&
IID_Endianess
,
szBuff
,
39
);
ok
(
dwLen
==
39
,
"rejected ok length"
);
ok
(
dwLen
==
39
,
"rejected ok length
\n
"
);
ok
(
szBuff
[
0
]
==
'{'
,
"Didn't write to buffer with ok length"
);
ok
(
szBuff
[
0
]
==
'{'
,
"Didn't write to buffer with ok length
\n
"
);
}
}
START_TEST
(
clsid
)
START_TEST
(
clsid
)
{
{
hShlwapi
=
LoadLibraryA
(
"shlwapi.dll"
);
hShlwapi
=
LoadLibraryA
(
"shlwapi.dll"
);
ok
(
hShlwapi
!=
0
,
"LoadLibraryA failed"
);
ok
(
hShlwapi
!=
0
,
"LoadLibraryA failed
\n
"
);
if
(
hShlwapi
)
if
(
hShlwapi
)
{
{
pSHLWAPI_269
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
269
);
pSHLWAPI_269
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
269
);
...
...
dlls/shlwapi/tests/path.c
View file @
ce7c3b50
...
@@ -56,12 +56,12 @@ static void hash_url(const char* szUrl)
...
@@ -56,12 +56,12 @@ static void hash_url(const char* szUrl)
DWORD
cbSize
=
sizeof
(
DWORD
);
DWORD
cbSize
=
sizeof
(
DWORD
);
DWORD
dwHash1
,
dwHash2
;
DWORD
dwHash1
,
dwHash2
;
ok
(
UrlHashA
(
szTestUrl
,
(
LPBYTE
)
&
dwHash1
,
cbSize
)
==
S_OK
,
"UrlHashA didn't return S_OK"
);
ok
(
UrlHashA
(
szTestUrl
,
(
LPBYTE
)
&
dwHash1
,
cbSize
)
==
S_OK
,
"UrlHashA didn't return S_OK
\n
"
);
ok
(
UrlHashW
(
wszTestUrl
,
(
LPBYTE
)
&
dwHash2
,
cbSize
)
==
S_OK
,
"UrlHashW didn't return S_OK"
);
ok
(
UrlHashW
(
wszTestUrl
,
(
LPBYTE
)
&
dwHash2
,
cbSize
)
==
S_OK
,
"UrlHashW didn't return S_OK
\n
"
);
FreeWideString
(
wszTestUrl
);
FreeWideString
(
wszTestUrl
);
ok
(
dwHash1
==
dwHash2
,
"Hashes didn't compare"
);
ok
(
dwHash1
==
dwHash2
,
"Hashes didn't compare
\n
"
);
}
}
static
void
test_UrlHash
(
void
)
static
void
test_UrlHash
(
void
)
...
@@ -81,13 +81,13 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
...
@@ -81,13 +81,13 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
DWORD
dwSize
;
DWORD
dwSize
;
dwSize
=
INTERNET_MAX_URL_LENGTH
;
dwSize
=
INTERNET_MAX_URL_LENGTH
;
ok
(
UrlGetPartA
(
szUrl
,
szPart
,
&
dwSize
,
dwPart
,
dwFlags
)
==
S_OK
,
"UrlGetPartA didn't return S_OK"
);
ok
(
UrlGetPartA
(
szUrl
,
szPart
,
&
dwSize
,
dwPart
,
dwFlags
)
==
S_OK
,
"UrlGetPartA didn't return S_OK
\n
"
);
dwSize
=
INTERNET_MAX_URL_LENGTH
;
dwSize
=
INTERNET_MAX_URL_LENGTH
;
ok
(
UrlGetPartW
(
wszUrl
,
wszPart
,
&
dwSize
,
dwPart
,
dwFlags
)
==
S_OK
,
"UrlGetPartW didn't return S_OK"
);
ok
(
UrlGetPartW
(
wszUrl
,
wszPart
,
&
dwSize
,
dwPart
,
dwFlags
)
==
S_OK
,
"UrlGetPartW didn't return S_OK
\n
"
);
wszConvertedPart
=
GetWideString
(
szPart
);
wszConvertedPart
=
GetWideString
(
szPart
);
ok
(
strcmpW
(
wszPart
,
wszConvertedPart
)
==
0
,
"Strings didn't match between ascii and unicode UrlGetPart!"
);
ok
(
strcmpW
(
wszPart
,
wszConvertedPart
)
==
0
,
"Strings didn't match between ascii and unicode UrlGetPart!
\n
"
);
FreeWideString
(
wszUrl
);
FreeWideString
(
wszUrl
);
FreeWideString
(
wszConvertedPart
);
FreeWideString
(
wszConvertedPart
);
...
@@ -95,7 +95,7 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
...
@@ -95,7 +95,7 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
/* Note that v6.0 and later don't return '?' with the query */
/* Note that v6.0 and later don't return '?' with the query */
ok
(
strcmp
(
szPart
,
szExpected
)
==
0
||
ok
(
strcmp
(
szPart
,
szExpected
)
==
0
||
(
*
szExpected
==
'?'
&&
!
strcmp
(
szPart
,
szExpected
+
1
)),
(
*
szExpected
==
'?'
&&
!
strcmp
(
szPart
,
szExpected
+
1
)),
"Expected %s, but got %s"
,
szExpected
,
szPart
);
"Expected %s, but got %s
\n
"
,
szExpected
,
szPart
);
}
}
static
void
test_UrlGetPart
(
void
)
static
void
test_UrlGetPart
(
void
)
...
...
dlls/shlwapi/tests/shreg.c
View file @
ce7c3b50
...
@@ -78,13 +78,13 @@ static HKEY create_test_entries(void)
...
@@ -78,13 +78,13 @@ static HKEY create_test_entries(void)
SetEnvironmentVariableA
(
"LONGSYSTEMVAR"
,
"bar"
);
SetEnvironmentVariableA
(
"LONGSYSTEMVAR"
,
"bar"
);
SetEnvironmentVariableA
(
"FOO"
,
"ImARatherLongButIndeedNeededString"
);
SetEnvironmentVariableA
(
"FOO"
,
"ImARatherLongButIndeedNeededString"
);
ok
(
!
RegCreateKeyA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
&
hKey
),
"RegCreateKeyA failed"
);
ok
(
!
RegCreateKeyA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
&
hKey
),
"RegCreateKeyA failed
\n
"
);
if
(
hKey
)
if
(
hKey
)
{
{
ok
(
!
RegSetValueExA
(
hKey
,
"Test1"
,
0
,
REG_EXPAND_SZ
,
sTestpath1
,
strlen
(
sTestpath1
)
+
1
),
"RegSetValueExA failed"
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test1"
,
0
,
REG_EXPAND_SZ
,
sTestpath1
,
strlen
(
sTestpath1
)
+
1
),
"RegSetValueExA failed
\n
"
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test2"
,
0
,
REG_SZ
,
sTestpath1
,
strlen
(
sTestpath1
)
+
1
),
"RegSetValueExA failed"
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test2"
,
0
,
REG_SZ
,
sTestpath1
,
strlen
(
sTestpath1
)
+
1
),
"RegSetValueExA failed
\n
"
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test3"
,
0
,
REG_EXPAND_SZ
,
sTestpath2
,
strlen
(
sTestpath2
)
+
1
),
"RegSetValueExA failed"
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test3"
,
0
,
REG_EXPAND_SZ
,
sTestpath2
,
strlen
(
sTestpath2
)
+
1
),
"RegSetValueExA failed
\n
"
);
}
}
sExpLen1
=
ExpandEnvironmentStringsA
(
sTestpath1
,
sExpTestpath1
,
sizeof
(
sExpTestpath1
));
sExpLen1
=
ExpandEnvironmentStringsA
(
sTestpath1
,
sExpTestpath1
,
sizeof
(
sExpTestpath1
));
...
@@ -104,16 +104,16 @@ static void test_SHGetValue(void)
...
@@ -104,16 +104,16 @@ static void test_SHGetValue(void)
strcpy
(
buf
,
sEmptyBuffer
);
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
MAX_PATH
;
dwSize
=
MAX_PATH
;
dwType
=
-
1
;
dwType
=
-
1
;
ok
(
!
SHGetValueA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
"Test1"
,
&
dwType
,
buf
,
&
dwSize
),
"SHGetValueA failed"
);
ok
(
!
SHGetValueA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
"Test1"
,
&
dwType
,
buf
,
&
dwSize
),
"SHGetValueA failed
\n
"
);
ok
(
0
==
strcmp
(
sExpTestpath1
,
buf
),
"(%s,%s)"
,
buf
,
sExpTestpath1
);
ok
(
0
==
strcmp
(
sExpTestpath1
,
buf
),
"(%s,%s)
\n
"
,
buf
,
sExpTestpath1
);
ok
(
REG_SZ
==
dwType
,
"(%lx)"
,
dwType
);
ok
(
REG_SZ
==
dwType
,
"(%lx)
\n
"
,
dwType
);
strcpy
(
buf
,
sEmptyBuffer
);
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
MAX_PATH
;
dwSize
=
MAX_PATH
;
dwType
=
-
1
;
dwType
=
-
1
;
ok
(
!
SHGetValueA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
"Test2"
,
&
dwType
,
buf
,
&
dwSize
),
"SHGetValueA failed"
);
ok
(
!
SHGetValueA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
"Test2"
,
&
dwType
,
buf
,
&
dwSize
),
"SHGetValueA failed
\n
"
);
ok
(
0
==
strcmp
(
sTestpath1
,
buf
)
,
"(%s)"
,
buf
);
ok
(
0
==
strcmp
(
sTestpath1
,
buf
)
,
"(%s)
\n
"
,
buf
);
ok
(
REG_SZ
==
dwType
,
"(%lx)"
,
dwType
);
ok
(
REG_SZ
==
dwType
,
"(%lx)
\n
"
,
dwType
);
}
}
static
void
test_SHGetRegPath
(
void
)
static
void
test_SHGetRegPath
(
void
)
...
@@ -124,8 +124,8 @@ static void test_SHGetRegPath(void)
...
@@ -124,8 +124,8 @@ static void test_SHGetRegPath(void)
return
;
return
;
strcpy
(
buf
,
sEmptyBuffer
);
strcpy
(
buf
,
sEmptyBuffer
);
ok
(
!
(
*
pSHRegGetPathA
)(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
"Test1"
,
buf
,
0
),
"SHRegGetPathA failed"
);
ok
(
!
(
*
pSHRegGetPathA
)(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
"Test1"
,
buf
,
0
),
"SHRegGetPathA failed
\n
"
);
ok
(
0
==
strcmp
(
sExpTestpath1
,
buf
)
,
"(%s)"
,
buf
);
ok
(
0
==
strcmp
(
sExpTestpath1
,
buf
)
,
"(%s)
\n
"
,
buf
);
}
}
static
void
test_SHQUeryValueEx
(
void
)
static
void
test_SHQUeryValueEx
(
void
)
...
@@ -138,7 +138,7 @@ static void test_SHQUeryValueEx(void)
...
@@ -138,7 +138,7 @@ static void test_SHQUeryValueEx(void)
const
char
*
sTestedFunction
=
""
;
const
char
*
sTestedFunction
=
""
;
DWORD
nUsedBuffer1
,
nUsedBuffer2
;
DWORD
nUsedBuffer1
,
nUsedBuffer2
;
ok
(
!
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
0
,
KEY_QUERY_VALUE
,
&
hKey
),
"test4 RegOpenKey"
);
ok
(
!
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
,
0
,
KEY_QUERY_VALUE
,
&
hKey
),
"test4 RegOpenKey
\n
"
);
/****** SHQueryValueExA ******/
/****** SHQueryValueExA ******/
...
@@ -148,29 +148,29 @@ static void test_SHQUeryValueEx(void)
...
@@ -148,29 +148,29 @@ static void test_SHQUeryValueEx(void)
/*
/*
* Case 1.1 All arguments are NULL
* Case 1.1 All arguments are NULL
*/
*/
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
NULL
,
NULL
,
NULL
),
"SHQueryValueExA failed"
);
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
NULL
,
NULL
,
NULL
),
"SHQueryValueExA failed
\n
"
);
/*
/*
* Case 1.2 dwType is set
* Case 1.2 dwType is set
*/
*/
dwType
=
-
1
;
dwType
=
-
1
;
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
&
dwType
,
NULL
,
NULL
),
"SHQueryValueExA failed"
);
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
&
dwType
,
NULL
,
NULL
),
"SHQueryValueExA failed
\n
"
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
ok
(
dwType
==
REG_SZ
,
"(%lu)
\n
"
,
dwType
);
/*
/*
* dwSize is set
* dwSize is set
* dwExpanded < dwUnExpanded
* dwExpanded < dwUnExpanded
*/
*/
dwSize
=
6
;
dwSize
=
6
;
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
NULL
,
NULL
,
&
dwSize
),
"SHQueryValueExA failed"
);
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
NULL
,
NULL
,
&
dwSize
),
"SHQueryValueExA failed
\n
"
);
ok
(
dwSize
==
nUsedBuffer1
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer1
);
ok
(
dwSize
==
nUsedBuffer1
,
"(%lu,%lu)
\n
"
,
dwSize
,
nUsedBuffer1
);
/*
/*
* dwExpanded > dwUnExpanded
* dwExpanded > dwUnExpanded
*/
*/
dwSize
=
6
;
dwSize
=
6
;
ok
(
!
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
NULL
,
NULL
,
&
dwSize
),
"SHQueryValueExA failed"
);
ok
(
!
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
NULL
,
NULL
,
&
dwSize
),
"SHQueryValueExA failed
\n
"
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)
\n
"
,
dwSize
,
nUsedBuffer2
);
/*
/*
...
@@ -180,10 +180,10 @@ static void test_SHQUeryValueEx(void)
...
@@ -180,10 +180,10 @@ static void test_SHQUeryValueEx(void)
dwSize
=
6
;
dwSize
=
6
;
dwType
=
-
1
;
dwType
=
-
1
;
dwRet
=
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
);
dwRet
=
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
);
ok
(
dwRet
==
ERROR_MORE_DATA
,
"(%lu)"
,
dwRet
);
ok
(
dwRet
==
ERROR_MORE_DATA
,
"(%lu)
\n
"
,
dwRet
);
ok
(
0
==
strcmp
(
sEmptyBuffer
,
buf
),
"(%s)"
,
buf
);
ok
(
0
==
strcmp
(
sEmptyBuffer
,
buf
),
"(%s)
\n
"
,
buf
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
ok
(
dwType
==
REG_SZ
,
"(%lu)
\n
"
,
dwType
);
ok
(
dwSize
==
nUsedBuffer1
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer1
);
ok
(
dwSize
==
nUsedBuffer1
,
"(%lu,%lu)
\n
"
,
dwSize
,
nUsedBuffer1
);
/*
/*
* string grows during expanding
* string grows during expanding
...
@@ -192,10 +192,10 @@ static void test_SHQUeryValueEx(void)
...
@@ -192,10 +192,10 @@ static void test_SHQUeryValueEx(void)
dwSize
=
6
;
dwSize
=
6
;
dwType
=
-
1
;
dwType
=
-
1
;
dwRet
=
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
);
dwRet
=
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
);
ok
(
ERROR_MORE_DATA
==
dwRet
,
"ERROR_MORE_DATA"
);
ok
(
ERROR_MORE_DATA
==
dwRet
,
"ERROR_MORE_DATA
\n
"
);
ok
(
0
==
strcmp
(
sEmptyBuffer
,
buf
),
"(%s)"
,
buf
);
ok
(
0
==
strcmp
(
sEmptyBuffer
,
buf
),
"(%s)
\n
"
,
buf
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)
\n
"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
ok
(
dwType
==
REG_SZ
,
"(%lu)
\n
"
,
dwType
);
/*
/*
* if the unexpanded string fits into the buffer it can get cut when expanded
* if the unexpanded string fits into the buffer it can get cut when expanded
...
@@ -203,11 +203,11 @@ static void test_SHQUeryValueEx(void)
...
@@ -203,11 +203,11 @@ static void test_SHQUeryValueEx(void)
strcpy
(
buf
,
sEmptyBuffer
);
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
sExpLen2
-
4
;
dwSize
=
sExpLen2
-
4
;
dwType
=
-
1
;
dwType
=
-
1
;
ok
(
ERROR_MORE_DATA
==
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
),
"Expected ERROR_MORE_DATA"
);
ok
(
ERROR_MORE_DATA
==
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
),
"Expected ERROR_MORE_DATA
\n
"
);
ok
(
0
==
strncmp
(
sExpTestpath2
,
buf
,
sExpLen2
-
4
-
1
),
"(%s)"
,
buf
);
ok
(
0
==
strncmp
(
sExpTestpath2
,
buf
,
sExpLen2
-
4
-
1
),
"(%s)
\n
"
,
buf
);
ok
(
sExpLen2
-
4
-
1
==
strlen
(
buf
),
"(%s)"
,
buf
);
ok
(
sExpLen2
-
4
-
1
==
strlen
(
buf
),
"(%s)
\n
"
,
buf
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)
\n
"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
ok
(
dwType
==
REG_SZ
,
"(%lu)
\n
"
,
dwType
);
/*
/*
* The buffer is NULL but the size is set
* The buffer is NULL but the size is set
...
@@ -216,9 +216,9 @@ static void test_SHQUeryValueEx(void)
...
@@ -216,9 +216,9 @@ static void test_SHQUeryValueEx(void)
dwSize
=
6
;
dwSize
=
6
;
dwType
=
-
1
;
dwType
=
-
1
;
dwRet
=
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
NULL
,
&
dwSize
);
dwRet
=
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
NULL
,
&
dwSize
);
ok
(
ERROR_SUCCESS
==
dwRet
,
"(%lu)"
,
dwRet
);
ok
(
ERROR_SUCCESS
==
dwRet
,
"(%lu)
\n
"
,
dwRet
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)
\n
"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
ok
(
dwType
==
REG_SZ
,
"(%lu)
\n
"
,
dwType
);
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
...
@@ -239,20 +239,20 @@ static void test_SHCopyKey(void)
...
@@ -239,20 +239,20 @@ static void test_SHCopyKey(void)
hKeyDst
=
NULL
;
hKeyDst
=
NULL
;
if
(
RegCreateKeyA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
"
\\
CopyDestination"
,
&
hKeyDst
)
||
!
hKeyDst
)
if
(
RegCreateKeyA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
"
\\
CopyDestination"
,
&
hKeyDst
)
||
!
hKeyDst
)
{
{
ok
(
0
,
"didn't open dest"
);
ok
(
0
,
"didn't open dest
\n
"
);
return
;
return
;
}
}
hKeySrc
=
NULL
;
hKeySrc
=
NULL
;
if
(
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
REG_CURRENT_VERSION
,
&
hKeySrc
)
||
!
hKeySrc
)
if
(
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
REG_CURRENT_VERSION
,
&
hKeySrc
)
||
!
hKeySrc
)
{
{
ok
(
0
,
"didn't open source"
);
ok
(
0
,
"didn't open source
\n
"
);
return
;
return
;
}
}
if
(
pSHCopyKeyA
)
if
(
pSHCopyKeyA
)
ok
(
!
(
*
pSHCopyKeyA
)(
hKeyDst
,
NULL
,
hKeySrc
,
0
),
"failed copy"
);
ok
(
!
(
*
pSHCopyKeyA
)(
hKeyDst
,
NULL
,
hKeySrc
,
0
),
"failed copy
\n
"
);
RegCloseKey
(
hKeySrc
);
RegCloseKey
(
hKeySrc
);
RegCloseKey
(
hKeyDst
);
RegCloseKey
(
hKeyDst
);
...
@@ -261,12 +261,12 @@ static void test_SHCopyKey(void)
...
@@ -261,12 +261,12 @@ static void test_SHCopyKey(void)
hKeyDst
=
NULL
;
hKeyDst
=
NULL
;
if
(
RegOpenKeyA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
"
\\
CopyDestination
\\
AeDebug"
,
&
hKeyDst
)
||
!
hKeyDst
)
if
(
RegOpenKeyA
(
HKEY_CURRENT_USER
,
REG_TEST_KEY
"
\\
CopyDestination
\\
AeDebug"
,
&
hKeyDst
)
||
!
hKeyDst
)
{
{
ok
(
0
,
"didn't open copy"
);
ok
(
0
,
"didn't open copy
\n
"
);
return
;
return
;
}
}
/* And the we copied the values too */
/* And the we copied the values too */
ok
(
!
SHQueryValueExA
(
hKeyDst
,
"Debugger"
,
NULL
,
NULL
,
NULL
,
NULL
),
"SHQueryValueExA failed"
);
ok
(
!
SHQueryValueExA
(
hKeyDst
,
"Debugger"
,
NULL
,
NULL
,
NULL
,
NULL
),
"SHQueryValueExA failed
\n
"
);
RegCloseKey
(
hKeyDst
);
RegCloseKey
(
hKeyDst
);
}
}
...
...
dlls/shlwapi/tests/string.c
View file @
ce7c3b50
...
@@ -159,7 +159,7 @@ static void test_StrChrA(void)
...
@@ -159,7 +159,7 @@ static void test_StrChrA(void)
WORD
count
;
WORD
count
;
/* this test crashes on win2k SP4 */
/* this test crashes on win2k SP4 */
/*ok(!StrChrA(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrA(NULL,'\0'), "found a character in a NULL string!
\n
");*/
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
string
[
count
]
=
(
char
)
count
;
string
[
count
]
=
(
char
)
count
;
...
@@ -186,7 +186,7 @@ static void test_StrChrW(void)
...
@@ -186,7 +186,7 @@ static void test_StrChrW(void)
WORD
count
;
WORD
count
;
/* this test crashes on win2k SP4 */
/* this test crashes on win2k SP4 */
/*ok(!StrChrW(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrW(NULL,'\0'), "found a character in a NULL string!
\n
");*/
for
(
count
=
32
;
count
<
16384
;
count
++
)
for
(
count
=
32
;
count
<
16384
;
count
++
)
string
[
count
]
=
count
;
string
[
count
]
=
count
;
...
@@ -195,13 +195,13 @@ static void test_StrChrW(void)
...
@@ -195,13 +195,13 @@ static void test_StrChrW(void)
for
(
count
=
32
;
count
<
16384
;
count
++
)
for
(
count
=
32
;
count
<
16384
;
count
++
)
{
{
LPWSTR
result
=
StrChrW
(
string
+
32
,
count
);
LPWSTR
result
=
StrChrW
(
string
+
32
,
count
);
ok
((
result
-
string
)
==
count
,
"found char %d in wrong place"
,
count
);
ok
((
result
-
string
)
==
count
,
"found char %d in wrong place
\n
"
,
count
);
}
}
for
(
count
=
32
;
count
<
16384
;
count
++
)
for
(
count
=
32
;
count
<
16384
;
count
++
)
{
{
LPWSTR
result
=
StrChrW
(
string
+
count
+
1
,
count
);
LPWSTR
result
=
StrChrW
(
string
+
count
+
1
,
count
);
ok
(
!
result
,
"found char not in the string"
);
ok
(
!
result
,
"found char not in the string
\n
"
);
}
}
}
}
...
@@ -211,7 +211,7 @@ static void test_StrChrIA(void)
...
@@ -211,7 +211,7 @@ static void test_StrChrIA(void)
WORD
count
;
WORD
count
;
/* this test crashes on win2k SP4 */
/* this test crashes on win2k SP4 */
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!
\n
");*/
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
string
[
count
]
=
(
char
)
count
;
string
[
count
]
=
(
char
)
count
;
...
@@ -221,14 +221,14 @@ static void test_StrChrIA(void)
...
@@ -221,14 +221,14 @@ static void test_StrChrIA(void)
{
{
LPSTR
result
=
StrChrIA
(
string
+
32
,
count
);
LPSTR
result
=
StrChrIA
(
string
+
32
,
count
);
ok
(
result
-
string
==
count
,
"found char '%c' in wrong place"
,
count
);
ok
(
result
-
string
==
count
,
"found char '%c' in wrong place
\n
"
,
count
);
ok
(
StrChrIA
(
result
,
count
)
!=
NULL
,
"didn't find lowercase '%c'"
,
count
);
ok
(
StrChrIA
(
result
,
count
)
!=
NULL
,
"didn't find lowercase '%c'
\n
"
,
count
);
}
}
for
(
count
=
'a'
;
count
<
'z'
;
count
++
)
for
(
count
=
'a'
;
count
<
'z'
;
count
++
)
{
{
LPSTR
result
=
StrChrIA
(
string
+
count
+
1
,
count
);
LPSTR
result
=
StrChrIA
(
string
+
count
+
1
,
count
);
ok
(
!
result
,
"found char not in the string"
);
ok
(
!
result
,
"found char not in the string
\n
"
);
}
}
}
}
...
@@ -238,7 +238,7 @@ static void test_StrChrIW(void)
...
@@ -238,7 +238,7 @@ static void test_StrChrIW(void)
WORD
count
;
WORD
count
;
/* this test crashes on win2k SP4 */
/* this test crashes on win2k SP4 */
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!
\n
");*/
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
string
[
count
]
=
count
;
string
[
count
]
=
count
;
...
@@ -248,14 +248,14 @@ static void test_StrChrIW(void)
...
@@ -248,14 +248,14 @@ static void test_StrChrIW(void)
{
{
LPWSTR
result
=
StrChrIW
(
string
+
32
,
count
);
LPWSTR
result
=
StrChrIW
(
string
+
32
,
count
);
ok
(
result
-
string
==
count
,
"found char '%c' in wrong place"
,
count
);
ok
(
result
-
string
==
count
,
"found char '%c' in wrong place
\n
"
,
count
);
ok
(
StrChrIW
(
result
,
count
)
!=
NULL
,
"didn't find lowercase '%c'"
,
count
);
ok
(
StrChrIW
(
result
,
count
)
!=
NULL
,
"didn't find lowercase '%c'
\n
"
,
count
);
}
}
for
(
count
=
'a'
;
count
<
'z'
;
count
++
)
for
(
count
=
'a'
;
count
<
'z'
;
count
++
)
{
{
LPWSTR
result
=
StrChrIW
(
string
+
count
+
1
,
count
);
LPWSTR
result
=
StrChrIW
(
string
+
count
+
1
,
count
);
ok
(
!
result
,
"found char not in the string"
);
ok
(
!
result
,
"found char not in the string
\n
"
);
}
}
}
}
...
@@ -265,7 +265,7 @@ static void test_StrRChrA(void)
...
@@ -265,7 +265,7 @@ static void test_StrRChrA(void)
WORD
count
;
WORD
count
;
/* this test crashes on win2k SP4 */
/* this test crashes on win2k SP4 */
/*ok(!StrRChrA(NULL, NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrRChrA(NULL, NULL,'\0'), "found a character in a NULL string!
\n
");*/
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
string
[
count
]
=
(
char
)
count
;
string
[
count
]
=
(
char
)
count
;
...
@@ -274,19 +274,19 @@ static void test_StrRChrA(void)
...
@@ -274,19 +274,19 @@ static void test_StrRChrA(void)
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
{
{
LPSTR
result
=
StrRChrA
(
string
+
32
,
NULL
,
count
);
LPSTR
result
=
StrRChrA
(
string
+
32
,
NULL
,
count
);
ok
(
result
-
string
==
count
,
"found char %d in wrong place"
,
count
);
ok
(
result
-
string
==
count
,
"found char %d in wrong place
\n
"
,
count
);
}
}
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
{
{
LPSTR
result
=
StrRChrA
(
string
+
count
+
1
,
NULL
,
count
);
LPSTR
result
=
StrRChrA
(
string
+
count
+
1
,
NULL
,
count
);
ok
(
!
result
,
"found char not in the string"
);
ok
(
!
result
,
"found char not in the string
\n
"
);
}
}
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
{
{
LPSTR
result
=
StrRChrA
(
string
+
count
+
1
,
string
+
127
,
count
);
LPSTR
result
=
StrRChrA
(
string
+
count
+
1
,
string
+
127
,
count
);
ok
(
!
result
,
"found char not in the string"
);
ok
(
!
result
,
"found char not in the string
\n
"
);
}
}
}
}
...
@@ -296,7 +296,7 @@ static void test_StrRChrW(void)
...
@@ -296,7 +296,7 @@ static void test_StrRChrW(void)
WORD
count
;
WORD
count
;
/* this test crashes on win2k SP4 */
/* this test crashes on win2k SP4 */
/*ok(!StrRChrW(NULL, NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrRChrW(NULL, NULL,'\0'), "found a character in a NULL string!
\n
");*/
for
(
count
=
32
;
count
<
128
;
count
++
)
for
(
count
=
32
;
count
<
128
;
count
++
)
string
[
count
]
=
count
;
string
[
count
]
=
count
;
...
@@ -335,7 +335,7 @@ static void test_StrCpyW(void)
...
@@ -335,7 +335,7 @@ static void test_StrCpyW(void)
MultiByteToWideChar
(
0
,
0
,
result
->
byte_size_64
,
-
1
,
szSrc
,
sizeof
(
szSrc
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
0
,
0
,
result
->
byte_size_64
,
-
1
,
szSrc
,
sizeof
(
szSrc
)
/
sizeof
(
WCHAR
));
StrCpyW
(
szBuff
,
szSrc
);
StrCpyW
(
szBuff
,
szSrc
);
ok
(
!
StrCmpW
(
szSrc
,
szBuff
),
"Copied string %s wrong"
,
result
->
byte_size_64
);
ok
(
!
StrCmpW
(
szSrc
,
szBuff
),
"Copied string %s wrong
\n
"
,
result
->
byte_size_64
);
result
++
;
result
++
;
}
}
}
}
...
@@ -349,7 +349,7 @@ static void test_StrToIntA(void)
...
@@ -349,7 +349,7 @@ static void test_StrToIntA(void)
while
(
result
->
string
)
while
(
result
->
string
)
{
{
return_val
=
StrToIntA
(
result
->
string
);
return_val
=
StrToIntA
(
result
->
string
);
ok
(
return_val
==
result
->
str_to_int
,
"converted '%s' wrong (%d)"
,
ok
(
return_val
==
result
->
str_to_int
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
->
string
,
return_val
);
result
++
;
result
++
;
}
}
...
@@ -365,7 +365,7 @@ static void test_StrToIntW(void)
...
@@ -365,7 +365,7 @@ static void test_StrToIntW(void)
{
{
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
return_val
=
StrToIntW
(
szBuff
);
return_val
=
StrToIntW
(
szBuff
);
ok
(
return_val
==
result
->
str_to_int
,
"converted '%s' wrong (%d)"
,
ok
(
return_val
==
result
->
str_to_int
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
->
string
,
return_val
);
result
++
;
result
++
;
}
}
...
@@ -381,10 +381,10 @@ static void test_StrToIntExA(void)
...
@@ -381,10 +381,10 @@ static void test_StrToIntExA(void)
{
{
return_val
=
-
1
;
return_val
=
-
1
;
bRet
=
StrToIntExA
(
result
->
string
,
0
,
&
return_val
);
bRet
=
StrToIntExA
(
result
->
string
,
0
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'"
,
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
result
->
string
);
if
(
bRet
)
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int_ex
,
"converted '%s' wrong (%d)"
,
ok
(
return_val
==
result
->
str_to_int_ex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
->
string
,
return_val
);
result
++
;
result
++
;
}
}
...
@@ -394,10 +394,10 @@ static void test_StrToIntExA(void)
...
@@ -394,10 +394,10 @@ static void test_StrToIntExA(void)
{
{
return_val
=
-
1
;
return_val
=
-
1
;
bRet
=
StrToIntExA
(
result
->
string
,
STIF_SUPPORT_HEX
,
&
return_val
);
bRet
=
StrToIntExA
(
result
->
string
,
STIF_SUPPORT_HEX
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'"
,
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
result
->
string
);
if
(
bRet
)
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int_hex
,
"converted '%s' wrong (%d)"
,
ok
(
return_val
==
result
->
str_to_int_hex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
->
string
,
return_val
);
result
++
;
result
++
;
}
}
...
@@ -415,10 +415,10 @@ static void test_StrToIntExW(void)
...
@@ -415,10 +415,10 @@ static void test_StrToIntExW(void)
return_val
=
-
1
;
return_val
=
-
1
;
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
bRet
=
StrToIntExW
(
szBuff
,
0
,
&
return_val
);
bRet
=
StrToIntExW
(
szBuff
,
0
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'"
,
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
result
->
string
);
if
(
bRet
)
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int_ex
,
"converted '%s' wrong (%d)"
,
ok
(
return_val
==
result
->
str_to_int_ex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
->
string
,
return_val
);
result
++
;
result
++
;
}
}
...
@@ -429,10 +429,10 @@ static void test_StrToIntExW(void)
...
@@ -429,10 +429,10 @@ static void test_StrToIntExW(void)
return_val
=
-
1
;
return_val
=
-
1
;
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
bRet
=
StrToIntExW
(
szBuff
,
STIF_SUPPORT_HEX
,
&
return_val
);
bRet
=
StrToIntExW
(
szBuff
,
STIF_SUPPORT_HEX
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'"
,
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
result
->
string
);
if
(
bRet
)
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int_hex
,
"converted '%s' wrong (%d)"
,
ok
(
return_val
==
result
->
str_to_int_hex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
->
string
,
return_val
);
result
++
;
result
++
;
}
}
...
@@ -447,10 +447,10 @@ static void test_StrDupA()
...
@@ -447,10 +447,10 @@ static void test_StrDupA()
{
{
lpszStr
=
StrDupA
(
result
->
byte_size_64
);
lpszStr
=
StrDupA
(
result
->
byte_size_64
);
ok
(
lpszStr
!=
NULL
,
"Dup failed"
);
ok
(
lpszStr
!=
NULL
,
"Dup failed
\n
"
);
if
(
lpszStr
)
if
(
lpszStr
)
{
{
ok
(
!
strcmp
(
result
->
byte_size_64
,
lpszStr
),
"Copied string wrong"
);
ok
(
!
strcmp
(
result
->
byte_size_64
,
lpszStr
),
"Copied string wrong
\n
"
);
LocalFree
((
HLOCAL
)
lpszStr
);
LocalFree
((
HLOCAL
)
lpszStr
);
}
}
result
++
;
result
++
;
...
@@ -460,7 +460,7 @@ static void test_StrDupA()
...
@@ -460,7 +460,7 @@ static void test_StrDupA()
* returned an empty string (as Wine does).
* returned an empty string (as Wine does).
*/
*/
lpszStr
=
StrDupA
(
NULL
);
lpszStr
=
StrDupA
(
NULL
);
ok
(
lpszStr
==
NULL
||
*
lpszStr
==
'\0'
,
"NULL string returned %p"
,
lpszStr
);
ok
(
lpszStr
==
NULL
||
*
lpszStr
==
'\0'
,
"NULL string returned %p
\n
"
,
lpszStr
);
}
}
static
void
test_StrFormatByteSize64A
(
void
)
static
void
test_StrFormatByteSize64A
(
void
)
...
@@ -531,7 +531,7 @@ void test_StrFromTimeIntervalA(void)
...
@@ -531,7 +531,7 @@ void test_StrFromTimeIntervalA(void)
{
{
StrFromTimeIntervalA
(
szBuff
,
256
,
result
->
ms
,
result
->
digits
);
StrFromTimeIntervalA
(
szBuff
,
256
,
result
->
ms
,
result
->
digits
);
ok
(
!
strcmp
(
result
->
time_interval
,
szBuff
),
"Formatted %ld %d wrong"
,
ok
(
!
strcmp
(
result
->
time_interval
,
szBuff
),
"Formatted %ld %d wrong
\n
"
,
result
->
ms
,
result
->
digits
);
result
->
ms
,
result
->
digits
);
result
++
;
result
++
;
}
}
...
...
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