mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
kernelbase: Use NtCreateFile in CreateConsoleScreenBuffer.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e5b8ffcc9
commit
e613d81d81
2 changed files with 18 additions and 13 deletions
|
@ -3290,6 +3290,12 @@ static void test_FreeConsole(void)
|
|||
(GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_FILE_NOT_FOUND /* winxp */)),
|
||||
"CreateFileA failed: %u\n", GetLastError());
|
||||
|
||||
handle = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||
CONSOLE_TEXTMODE_BUFFER, NULL);
|
||||
ok(handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_HANDLE,
|
||||
"CreateConsoleScreenBuffer returned: %p (%u)\n", handle, GetLastError());
|
||||
|
||||
if (!skip_nt)
|
||||
{
|
||||
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );
|
||||
|
|
|
@ -326,7 +326,11 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateConsoleScreenBuffer( DWORD access, DWORD s
|
|||
SECURITY_ATTRIBUTES *sa, DWORD flags,
|
||||
void *data )
|
||||
{
|
||||
HANDLE ret = INVALID_HANDLE_VALUE;
|
||||
OBJECT_ATTRIBUTES attr = {sizeof(attr)};
|
||||
IO_STATUS_BLOCK iosb;
|
||||
UNICODE_STRING name;
|
||||
HANDLE handle;
|
||||
NTSTATUS status;
|
||||
|
||||
TRACE( "(%x,%x,%p,%x,%p)\n", access, share, sa, flags, data );
|
||||
|
||||
|
@ -336,18 +340,13 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateConsoleScreenBuffer( DWORD access, DWORD s
|
|||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
SERVER_START_REQ( create_console_output )
|
||||
{
|
||||
req->handle_in = 0;
|
||||
req->access = access;
|
||||
req->attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0;
|
||||
req->share = share;
|
||||
req->fd = -1;
|
||||
if (!wine_server_call_err( req ))
|
||||
ret = console_handle_map( wine_server_ptr_handle( reply->handle_out ));
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return ret;
|
||||
RtlInitUnicodeString( &name, L"\\Device\\ConDrv\\ScreenBuffer" );
|
||||
attr.ObjectName = &name;
|
||||
attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
|
||||
if (sa && sa->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
|
||||
status = NtCreateFile( &handle, access, &attr, &iosb, NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN,
|
||||
FILE_NON_DIRECTORY_FILE, NULL, 0 );
|
||||
return set_ntstatus( status ) ? handle : INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue