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
d967484e
Commit
d967484e
authored
Feb 07, 2012
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Added a couple of tests about console creation through CreateFile, and…
kernel32: Added a couple of tests about console creation through CreateFile, and fix some corner cases.
parent
9ac28c8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
file.c
dlls/kernel32/file.c
+3
-1
console.c
dlls/kernel32/tests/console.c
+63
-0
No files found.
dlls/kernel32/file.c
View file @
d967484e
...
...
@@ -1286,7 +1286,9 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
if
(
!
strcmpiW
(
filename
,
coninW
)
||
!
strcmpiW
(
filename
,
conoutW
))
{
ret
=
OpenConsoleW
(
filename
,
access
,
(
sa
&&
sa
->
bInheritHandle
),
creation
);
ret
=
OpenConsoleW
(
filename
,
access
,
(
sa
&&
sa
->
bInheritHandle
),
creation
?
OPEN_EXISTING
:
0
);
if
(
ret
==
INVALID_HANDLE_VALUE
)
SetLastError
(
ERROR_INVALID_PARAMETER
);
goto
done
;
}
...
...
dlls/kernel32/tests/console.c
View file @
d967484e
...
...
@@ -1116,6 +1116,68 @@ static void test_OpenConsoleW(void)
CloseHandle
(
ret
);
}
static
void
test_CreateFileW
(
void
)
{
static
const
WCHAR
coninW
[]
=
{
'C'
,
'O'
,
'N'
,
'I'
,
'N'
,
'$'
,
0
};
static
const
WCHAR
conoutW
[]
=
{
'C'
,
'O'
,
'N'
,
'O'
,
'U'
,
'T'
,
'$'
,
0
};
static
const
struct
{
LPCWSTR
name
;
DWORD
access
;
BOOL
inherit
;
DWORD
creation
;
DWORD
gle
;
BOOL
is_broken
;
}
cf_table
[]
=
{
{
coninW
,
0
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
TRUE
},
{
coninW
,
0
,
FALSE
,
OPEN_ALWAYS
,
0
,
FALSE
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
TRUE
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_NEW
,
0
,
FALSE
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_ALWAYS
,
0
,
FALSE
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
0
,
FALSE
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
TRUNCATE_EXISTING
,
0
,
FALSE
},
{
conoutW
,
0
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
TRUE
},
{
conoutW
,
0
,
FALSE
,
OPEN_ALWAYS
,
0
,
FALSE
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
TRUE
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_NEW
,
0
,
FALSE
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_ALWAYS
,
0
,
FALSE
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
0
,
FALSE
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
TRUNCATE_EXISTING
,
0
,
FALSE
},
};
int
index
;
HANDLE
ret
;
SECURITY_ATTRIBUTES
sa
;
for
(
index
=
0
;
index
<
sizeof
(
cf_table
)
/
sizeof
(
cf_table
[
0
]);
index
++
)
{
SetLastError
(
0xdeadbeef
);
sa
.
nLength
=
sizeof
(
sa
);
sa
.
lpSecurityDescriptor
=
NULL
;
sa
.
bInheritHandle
=
cf_table
[
index
].
inherit
;
ret
=
CreateFileW
(
cf_table
[
index
].
name
,
cf_table
[
index
].
access
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
&
sa
,
cf_table
[
index
].
creation
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
ret
==
INVALID_HANDLE_VALUE
)
{
ok
(
cf_table
[
index
].
gle
,
"Expected CreateFileW not to return INVALID_HANDLE_VALUE for index %d
\n
"
,
index
);
ok
(
GetLastError
()
==
cf_table
[
index
].
gle
,
"Expected GetLastError() to return %u for index %d, got %u
\n
"
,
cf_table
[
index
].
gle
,
index
,
GetLastError
());
}
else
{
ok
(
!
cf_table
[
index
].
gle
||
broken
(
cf_table
[
index
].
is_broken
)
/* Win7 */
,
"Expected CreateFileW to succeed for index %d
\n
"
,
index
);
CloseHandle
(
ret
);
}
}
}
static
void
test_VerifyConsoleIoHandle
(
HANDLE
handle
)
{
BOOL
ret
;
...
...
@@ -2546,6 +2608,7 @@ START_TEST(console)
test_GetConsoleProcessList
();
test_OpenConsoleW
();
test_CreateFileW
();
test_OpenCON
();
test_VerifyConsoleIoHandle
(
hConOut
);
test_GetSetStdHandle
();
...
...
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