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
c3ee3da5
Commit
c3ee3da5
authored
Apr 14, 2014
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Filter out console handles in GetFileSize.
parent
991746b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
file.c
dlls/kernel32/file.c
+6
-0
console.c
dlls/kernel32/tests/console.c
+42
-0
No files found.
dlls/kernel32/file.c
View file @
c3ee3da5
...
...
@@ -983,6 +983,12 @@ BOOL WINAPI GetFileSizeEx( HANDLE hFile, PLARGE_INTEGER lpFileSize )
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
if
(
is_console_handle
(
hFile
))
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
status
=
NtQueryInformationFile
(
hFile
,
&
io
,
&
info
,
sizeof
(
info
),
FileStandardInformation
);
if
(
status
==
STATUS_SUCCESS
)
{
...
...
dlls/kernel32/tests/console.c
View file @
c3ee3da5
...
...
@@ -2553,6 +2553,47 @@ static void test_ReadConsoleOutputAttribute(HANDLE output_handle)
ok
(
count
==
1
,
"Expected count to be 1, got %u
\n
"
,
count
);
}
static
void
test_ReadConsole
(
void
)
{
HANDLE
std_input
;
DWORD
ret
,
bytes
;
char
buf
[
1024
];
std_input
=
GetStdHandle
(
STD_INPUT_HANDLE
);
SetLastError
(
0xdeadbeef
);
ret
=
GetFileSize
(
std_input
,
NULL
);
ok
(
ret
==
INVALID_FILE_SIZE
,
"expected INVALID_FILE_SIZE, got %#x
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
if
(
0
)
/* FIXME: uncomment once Wine doesn't hang forever */
{
bytes
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
ReadFile
(
std_input
,
buf
,
-
128
,
&
bytes
,
NULL
);
ok
(
!
ret
,
"expected 0, got %u
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"expected ERROR_NOT_ENOUGH_MEMORY, got %d
\n
"
,
GetLastError
());
ok
(
!
bytes
,
"expected 0, got %u
\n
"
,
bytes
);
bytes
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
ReadConsoleA
(
std_input
,
buf
,
-
128
,
&
bytes
,
NULL
);
ok
(
!
ret
,
"expected 0, got %u
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"expected ERROR_NOT_ENOUGH_MEMORY, got %d
\n
"
,
GetLastError
());
ok
(
bytes
==
0xdeadbeef
,
"expected 0xdeadbeef, %#x
\n
"
,
bytes
);
}
if
(
0
)
/* FIXME: uncomment once Wine doesn't hang forever */
{
bytes
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
ReadConsoleW
(
std_input
,
buf
,
-
128
,
&
bytes
,
NULL
);
ok
(
!
ret
,
"expected 0, got %u
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"expected ERROR_NOT_ENOUGH_MEMORY, got %d
\n
"
,
GetLastError
());
ok
(
bytes
==
0xdeadbeef
,
"expected 0xdeadbeef, %#x
\n
"
,
bytes
);
}
}
START_TEST
(
console
)
{
static
const
char
font_name
[]
=
"Lucida Console"
;
...
...
@@ -2646,6 +2687,7 @@ START_TEST(console)
ok
(
sbi
.
dwSize
.
Y
==
size
,
"Unexpected buffer size: %d instead of %d
\n
"
,
sbi
.
dwSize
.
Y
,
size
);
if
(
!
ret
)
return
;
test_ReadConsole
();
/* Non interactive tests */
testCursor
(
hConOut
,
sbi
.
dwSize
);
/* test parameters (FIXME: test functionality) */
...
...
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