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
5a6d38c2
Commit
5a6d38c2
authored
Dec 21, 2013
by
André Hentschel
Committed by
Alexandre Julliard
Dec 26, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Adapt input checking in OpenConsoleW to match win8 behaviour.
parent
d7afa575
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
28 deletions
+52
-28
console.c
dlls/kernel32/console.c
+1
-9
console.c
dlls/kernel32/tests/console.c
+51
-19
No files found.
dlls/kernel32/console.c
View file @
5a6d38c2
...
...
@@ -382,19 +382,11 @@ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creat
output
=
(
HANDLE
)
TRUE
;
}
if
(
output
==
INVALID_HANDLE_VALUE
)
if
(
output
==
INVALID_HANDLE_VALUE
||
creation
!=
OPEN_EXISTING
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
INVALID_HANDLE_VALUE
;
}
else
if
(
creation
!=
OPEN_EXISTING
)
{
if
(
!
creation
||
creation
==
CREATE_NEW
||
creation
==
CREATE_ALWAYS
)
SetLastError
(
ERROR_SHARING_VIOLATION
);
else
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
INVALID_HANDLE_VALUE
;
}
SERVER_START_REQ
(
open_console
)
{
...
...
dlls/kernel32/tests/console.c
View file @
5a6d38c2
...
...
@@ -1062,39 +1062,60 @@ static void test_OpenConsoleW(void)
DWORD
gle
,
gle2
;
}
invalid_table
[]
=
{
{
NULL
,
0
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
0xdeadbeef
,
0xdeadbeef
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
0
,
FALSE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
0xdeadbeef
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
0xdeadbeef
,
TRUE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
0
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
NULL
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_EXISTING
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
0
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
0xdeadbeef
,
0xdeadbeef
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
0
,
FALSE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
0xdeadbeef
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
0xdeadbeef
,
TRUE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
0
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
emptyW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_EXISTING
,
ERROR_INVALID_PARAMETER
,
ERROR_PATH_NOT_FOUND
},
{
invalidW
,
0
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_FILE_NOT_FOUND
},
{
invalidW
,
0xdeadbeef
,
0xdeadbeef
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
invalidW
,
0
,
FALSE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
invalidW
,
0xdeadbeef
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_FILE_NOT_FOUND
},
{
invalidW
,
0xdeadbeef
,
TRUE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
invalidW
,
0
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
ERROR_FILE_NOT_FOUND
},
{
invalidW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_FILE_NOT_FOUND
},
{
invalidW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
ERROR_FILE_NOT_FOUND
},
{
invalidW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_EXISTING
,
ERROR_INVALID_PARAMETER
,
ERROR_FILE_NOT_FOUND
},
{
coninW
,
0
,
FALSE
,
0
,
ERROR_SHARING_VIOLATION
,
0
},
{
coninW
,
0xdeadbeef
,
0xdeadbeef
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
coninW
,
0
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
0
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_SHARING_VIOLATION
,
0
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_NEW
,
ERROR_SHARING_VIOLATION
,
0
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_ALWAYS
,
ERROR_SHARING_VIOLATION
,
0
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
0
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
TRUNCATE_EXISTING
,
ERROR_INVALID_PARAMETER
,
0
},
{
conoutW
,
0
,
FALSE
,
0
,
ERROR_SHARING_VIOLATION
,
0
},
{
conoutW
,
0xdeadbeef
,
0xdeadbeef
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
conoutW
,
0
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
0
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
,
ERROR_SHARING_VIOLATION
,
0
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_NEW
,
ERROR_SHARING_VIOLATION
,
0
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_ALWAYS
,
ERROR_SHARING_VIOLATION
,
0
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
,
ERROR_INVALID_PARAMETER
,
0
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
TRUNCATE_EXISTING
,
ERROR_INVALID_PARAMETER
,
0
},
{
coninW
,
0
,
FALSE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
coninW
,
0xdeadbeef
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_ACCESS_DENIED
},
{
coninW
,
0xdeadbeef
,
TRUE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
conoutW
,
0
,
FALSE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
{
conoutW
,
0xceadbeef
,
FALSE
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_ACCESS_DENIED
},
{
conoutW
,
0xdeadbeef
,
TRUE
,
0xdeadbeef
,
ERROR_INVALID_PARAMETER
,
0
},
};
static
const
struct
{
LPCWSTR
name
;
DWORD
access
;
BOOL
inherit
;
DWORD
creation
;
}
valid_table
[]
=
{
{
coninW
,
0
,
FALSE
,
0
},
{
coninW
,
0
,
TRUE
,
0
},
{
coninW
,
GENERIC_EXECUTE
,
TRUE
,
0
},
{
coninW
,
GENERIC_ALL
,
TRUE
,
0
},
{
coninW
,
0
,
FALSE
,
OPEN_ALWAYS
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_NEW
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_ALWAYS
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
},
{
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
TRUNCATE_EXISTING
},
{
conoutW
,
0
,
FALSE
,
0
},
{
conoutW
,
0
,
FALSE
,
OPEN_ALWAYS
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
0
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_NEW
,
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
CREATE_ALWAYS
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_ALWAYS
},
{
conoutW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
TRUNCATE_EXISTING
},
};
int
index
;
...
...
@@ -1120,6 +1141,17 @@ static void test_OpenConsoleW(void)
invalid_table
[
index
].
gle
,
invalid_table
[
index
].
gle2
,
index
,
gle
);
}
for
(
index
=
0
;
index
<
sizeof
(
valid_table
)
/
sizeof
(
valid_table
[
0
]);
index
++
)
{
ret
=
pOpenConsoleW
(
valid_table
[
index
].
name
,
valid_table
[
index
].
access
,
valid_table
[
index
].
inherit
,
valid_table
[
index
].
creation
);
todo_wine
ok
(
ret
!=
INVALID_HANDLE_VALUE
||
broken
(
ret
==
INVALID_HANDLE_VALUE
/* until Win7 */
),
"Expected OpenConsoleW to succeed for index %d, got %p
\n
"
,
index
,
ret
);
if
(
ret
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
ret
);
}
/* OpenConsoleW should not touch the last error on success. */
SetLastError
(
0xdeadbeef
);
ret
=
pOpenConsoleW
(
coninW
,
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
OPEN_EXISTING
);
...
...
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