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
7c4939cb
Commit
7c4939cb
authored
Jun 06, 2009
by
Guy Albertelli
Committed by
Alexandre Julliard
Jun 11, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Fix tests to pass on Win9x and WinME.
parent
5fbf895d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
29 deletions
+43
-29
file.c
dlls/kernel32/tests/file.c
+43
-29
No files found.
dlls/kernel32/tests/file.c
View file @
7c4939cb
...
@@ -55,10 +55,11 @@ static const char sillytext[] =
...
@@ -55,10 +55,11 @@ static const char sillytext[] =
"sdlkfjasdlkfj a dslkj adsklf
\n
\n
asdklf askldfa sdlkf
\n
sadklf asdklf asdf "
;
"sdlkfjasdlkfj a dslkj adsklf
\n
\n
asdklf askldfa sdlkf
\n
sadklf asdklf asdf "
;
struct
test_list
{
struct
test_list
{
const
char
*
file
;
const
char
*
file
;
/* file string to test */
const
DWORD
err
;
const
DWORD
err
;
/* Win NT and further error code */
const
DWORD
options
;
const
LONG
err2
;
/* Win 9x & ME error code or -1 */
const
BOOL
todo_flag
;
const
DWORD
options
;
/* option flag to use for open */
const
BOOL
todo_flag
;
/* todo_wine indicator */
}
;
}
;
static
void
InitFunctionPointers
(
void
)
static
void
InitFunctionPointers
(
void
)
...
@@ -717,19 +718,19 @@ static void test_CreateFileA(void)
...
@@ -717,19 +718,19 @@ static void test_CreateFileA(void)
static
const
char
nt_drive
[]
=
"
\\\\
?
\\
A:"
;
static
const
char
nt_drive
[]
=
"
\\\\
?
\\
A:"
;
DWORD
i
,
ret
,
len
;
DWORD
i
,
ret
,
len
;
struct
test_list
p
[]
=
{
struct
test_list
p
[]
=
{
{
""
,
ERROR_PATH_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* dir as file w \ */
{
""
,
ERROR_PATH_NOT_FOUND
,
-
1
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* dir as file w \ */
{
""
,
ERROR_SUCCESS
,
FILE_FLAG_BACKUP_SEMANTICS
,
FALSE
},
/* dir as dir w \ */
{
""
,
ERROR_SUCCESS
,
ERROR_PATH_NOT_FOUND
,
FILE_FLAG_BACKUP_SEMANTICS
,
FALSE
},
/* dir as dir w \ */
{
"a"
,
ERROR_FILE_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* non-exist file */
{
"a"
,
ERROR_FILE_NOT_FOUND
,
-
1
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* non-exist file */
{
"a
\\
"
,
ERROR_FILE_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* non-exist dir */
{
"a
\\
"
,
ERROR_FILE_NOT_FOUND
,
ERROR_PATH_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* non-exist dir */
{
"removeme"
,
ERROR_ACCESS_DENIED
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* exist dir w/o \ */
{
"removeme"
,
ERROR_ACCESS_DENIED
,
-
1
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* exist dir w/o \ */
{
"removeme
\\
"
,
ERROR_PATH_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* exst dir w \ */
{
"removeme
\\
"
,
ERROR_PATH_NOT_FOUND
,
-
1
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* exst dir w \ */
{
"c:"
,
ERROR_ACCESS_DENIED
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* device in file namespace */
{
"c:"
,
ERROR_ACCESS_DENIED
,
ERROR_PATH_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* device in file namespace */
{
"c:"
,
ERROR_SUCCESS
,
FILE_FLAG_BACKUP_SEMANTICS
,
FALSE
},
/* device in file namespace as dir */
{
"c:"
,
ERROR_SUCCESS
,
ERROR_PATH_NOT_FOUND
,
FILE_FLAG_BACKUP_SEMANTICS
,
FALSE
},
/* device in file namespace as dir */
{
"c:
\\
"
,
ERROR_PATH_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* root dir w \ */
{
"c:
\\
"
,
ERROR_PATH_NOT_FOUND
,
ERROR_ACCESS_DENIED
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* root dir w \ */
{
"c:
\\
"
,
ERROR_SUCCESS
,
FILE_FLAG_BACKUP_SEMANTICS
,
FALSE
},
/* root dir w \ as dir */
{
"c:
\\
"
,
ERROR_SUCCESS
,
ERROR_ACCESS_DENIED
,
FILE_FLAG_BACKUP_SEMANTICS
,
FALSE
},
/* root dir w \ as dir */
{
"
\\\\
?
\\
c:"
,
ERROR_SUCCESS
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* dev namespace drive */
{
"
\\\\
?
\\
c:"
,
ERROR_SUCCESS
,
ERROR_BAD_NETPATH
,
FILE_ATTRIBUTE_NORMAL
,
FALSE
},
/* dev namespace drive */
{
"
\\\\
?
\\
c:
\\
"
,
ERROR_PATH_NOT_FOUND
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* dev namespace drive w \ */
{
"
\\\\
?
\\
c:
\\
"
,
ERROR_PATH_NOT_FOUND
,
ERROR_BAD_NETPATH
,
FILE_ATTRIBUTE_NORMAL
,
TRUE
},
/* dev namespace drive w \ */
{
NULL
,
0
,
0
,
FALSE
}
{
NULL
,
0
,
-
1
,
0
,
FALSE
}
};
};
BY_HANDLE_FILE_INFORMATION
Finfo
;
BY_HANDLE_FILE_INFORMATION
Finfo
;
...
@@ -829,13 +830,17 @@ static void test_CreateFileA(void)
...
@@ -829,13 +830,17 @@ static void test_CreateFileA(void)
}
}
/* otherwise validate results with expectations */
/* otherwise validate results with expectations */
else
if
(
p
[
i
].
todo_flag
)
else
if
(
p
[
i
].
todo_flag
)
todo_wine
ok
((
hFile
==
INVALID_HANDLE_VALUE
&&
p
[
i
].
err
==
GetLastError
())
||
todo_wine
ok
(
(
hFile
==
INVALID_HANDLE_VALUE
&&
(
p
[
i
].
err
==
GetLastError
()
||
p
[
i
].
err2
==
GetLastError
()))
||
(
hFile
!=
INVALID_HANDLE_VALUE
&&
p
[
i
].
err
==
ERROR_SUCCESS
),
(
hFile
!=
INVALID_HANDLE_VALUE
&&
p
[
i
].
err
==
ERROR_SUCCESS
),
"CreateFileA failed on %s, hFile %p, err=%u, should be %u
\n
"
,
"CreateFileA failed on %s, hFile %p, err=%u, should be %u
\n
"
,
filename
,
hFile
,
GetLastError
(),
p
[
i
].
err
);
filename
,
hFile
,
GetLastError
(),
p
[
i
].
err
);
else
else
ok
((
hFile
==
INVALID_HANDLE_VALUE
&&
p
[
i
].
err
==
GetLastError
())
||
ok
(
(
hFile
!=
INVALID_HANDLE_VALUE
&&
p
[
i
].
err
==
ERROR_SUCCESS
),
(
hFile
==
INVALID_HANDLE_VALUE
&&
(
p
[
i
].
err
==
GetLastError
()
||
p
[
i
].
err2
==
GetLastError
()))
||
(
hFile
!=
INVALID_HANDLE_VALUE
&&
p
[
i
].
err
==
ERROR_SUCCESS
),
"CreateFileA failed on %s, hFile %p, err=%u, should be %u
\n
"
,
"CreateFileA failed on %s, hFile %p, err=%u, should be %u
\n
"
,
filename
,
hFile
,
GetLastError
(),
p
[
i
].
err
);
filename
,
hFile
,
GetLastError
(),
p
[
i
].
err
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
...
@@ -852,21 +857,26 @@ static void test_CreateFileA(void)
...
@@ -852,21 +857,26 @@ static void test_CreateFileA(void)
NULL
,
NULL
,
OPEN_EXISTING
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
ok
(
hFile
!=
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_SUCCESS
,
if
(
hFile
!=
INVALID_HANDLE_VALUE
&&
GetLastError
()
!=
ERROR_PATH_NOT_FOUND
)
{
ok
(
hFile
!=
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_SUCCESS
,
"CreateFileA did not work, last error %u on volume <%s>
\n
"
,
"CreateFileA did not work, last error %u on volume <%s>
\n
"
,
GetLastError
(),
temp_path
);
GetLastError
(),
temp_path
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
{
ret
=
GetFileInformationByHandle
(
hFile
,
&
Finfo
);
if
(
ret
)
{
{
ok
(
Finfo
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
,
ret
=
GetFileInformationByHandle
(
hFile
,
&
Finfo
);
"CreateFileA probably did not open temp directory %s correctly
\n
file information does not include FILE_ATTRIBUTE_DIRECTORY, actual=0x%08x
\n
"
,
if
(
ret
)
{
ok
(
Finfo
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
,
"CreateFileA probably did not open temp directory %s correctly
\n
file information does not include FILE_ATTRIBUTE_DIRECTORY, actual=0x%08x
\n
"
,
temp_path
,
Finfo
.
dwFileAttributes
);
temp_path
,
Finfo
.
dwFileAttributes
);
}
CloseHandle
(
hFile
);
}
}
CloseHandle
(
hFile
);
}
}
else
skip
(
"Probable Win9x, got ERROR_PATH_NOT_FOUND w/ FILE_FLAG_BACKUP_SEMANTICS or %s
\n
"
,
temp_path
);
/* *** Test opening volumes/devices using drive letter *** */
/* *** Test opening volumes/devices using drive letter *** */
...
@@ -879,7 +889,8 @@ static void test_CreateFileA(void)
...
@@ -879,7 +889,8 @@ static void test_CreateFileA(void)
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_NO_BUFFERING
,
NULL
);
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_NO_BUFFERING
,
NULL
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
||
GetLastError
()
!=
ERROR_ACCESS_DENIED
)
if
(
hFile
!=
INVALID_HANDLE_VALUE
||
(
GetLastError
()
!=
ERROR_ACCESS_DENIED
&&
GetLastError
()
!=
ERROR_BAD_NETPATH
))
{
{
/* if we have adm rights to volume, then try rest of tests */
/* if we have adm rights to volume, then try rest of tests */
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileA did not open %s, last error=%u
\n
"
,
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileA did not open %s, last error=%u
\n
"
,
...
@@ -946,6 +957,9 @@ static void test_CreateFileA(void)
...
@@ -946,6 +957,9 @@ static void test_CreateFileA(void)
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
}
}
/* If we see ERROR_BAD_NETPATH then on Win9x or WinME, so skip */
else
if
(
GetLastError
()
==
ERROR_BAD_NETPATH
)
skip
(
"Probable Win9x, got ERROR_BAD_NETPATH (53)
\n
"
);
else
else
skip
(
"Do not have authority to access volumes. Tests skipped
\n
"
);
skip
(
"Do not have authority to access volumes. Tests skipped
\n
"
);
...
...
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