2 * Win32 console functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 * Copyright 1997 Karl Garrison
6 * Copyright 1998 John Richardson
7 * Copyright 1998 Marcus Meissner
8 * Copyright 2001,2002,2004,2005,2010 Eric Pouech
9 * Copyright 2001 Alexandre Julliard
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #define NONAMELESSUNION
33 #define WIN32_NO_STATUS
40 #include "wine/condrv.h"
41 #include "wine/debug.h"
42 #include "kernel_private.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(console
);
46 /******************************************************************
47 * OpenConsoleW (KERNEL32.@)
50 * Open a handle to the current process console.
51 * Returns INVALID_HANDLE_VALUE on failure.
53 HANDLE WINAPI
OpenConsoleW(LPCWSTR name
, DWORD access
, BOOL inherit
, DWORD creation
)
55 SECURITY_ATTRIBUTES sa
;
57 TRACE("(%s, 0x%08lx, %d, %lu)\n", debugstr_w(name
), access
, inherit
, creation
);
59 if (!name
|| (wcsicmp( L
"CONIN$", name
) && wcsicmp( L
"CONOUT$", name
)) || creation
!= OPEN_EXISTING
)
61 SetLastError( ERROR_INVALID_PARAMETER
);
62 return INVALID_HANDLE_VALUE
;
65 sa
.nLength
= sizeof(sa
);
66 sa
.lpSecurityDescriptor
= NULL
;
67 sa
.bInheritHandle
= inherit
;
69 return CreateFileW( name
, access
, FILE_SHARE_READ
| FILE_SHARE_WRITE
, &sa
, creation
, 0, NULL
);
72 /******************************************************************
73 * VerifyConsoleIoHandle (KERNEL32.@)
77 BOOL WINAPI
VerifyConsoleIoHandle(HANDLE handle
)
81 return !NtDeviceIoControlFile( handle
, NULL
, NULL
, NULL
, &io
, IOCTL_CONDRV_GET_MODE
,
82 NULL
, 0, &mode
, sizeof(mode
) );
85 /******************************************************************
86 * DuplicateConsoleHandle (KERNEL32.@)
90 HANDLE WINAPI
DuplicateConsoleHandle(HANDLE handle
, DWORD access
, BOOL inherit
,
94 return DuplicateHandle(GetCurrentProcess(), handle
, GetCurrentProcess(), &ret
,
95 access
, inherit
, options
) ? ret
: INVALID_HANDLE_VALUE
;
98 /******************************************************************
99 * CloseConsoleHandle (KERNEL32.@)
103 BOOL WINAPI
CloseConsoleHandle(HANDLE handle
)
105 return CloseHandle(handle
);
108 /******************************************************************
109 * GetConsoleInputWaitHandle (KERNEL32.@)
113 HANDLE WINAPI
GetConsoleInputWaitHandle(void)
115 return GetStdHandle( STD_INPUT_HANDLE
);
119 /***********************************************************************
120 * GetConsoleKeyboardLayoutNameA (KERNEL32.@)
122 BOOL WINAPI
GetConsoleKeyboardLayoutNameA(LPSTR layoutName
)
124 FIXME( "stub %p\n", layoutName
);
128 /***********************************************************************
129 * GetConsoleKeyboardLayoutNameW (KERNEL32.@)
131 BOOL WINAPI
GetConsoleKeyboardLayoutNameW(LPWSTR layoutName
)
135 FIXME( "stub %p\n", layoutName
);
139 BOOL WINAPI
SetConsoleIcon(HICON icon
)
141 FIXME(": (%p) stub!\n", icon
);
142 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
146 DWORD WINAPI
GetNumberOfConsoleFonts(void)
151 BOOL WINAPI
SetConsoleFont(HANDLE hConsole
, DWORD index
)
153 FIXME("(%p, %lu): stub!\n", hConsole
, index
);
154 SetLastError(LOWORD(E_NOTIMPL
) /* win10 1709+ */);
158 BOOL WINAPI
SetConsoleKeyShortcuts(BOOL set
, BYTE keys
, VOID
*a
, DWORD b
)
160 FIXME(": (%u %u %p %lu) stub!\n", set
, keys
, a
, b
);
161 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
166 BOOL WINAPI
GetConsoleFontInfo(HANDLE hConsole
, BOOL maximize
, DWORD numfonts
, CONSOLE_FONT_INFO
*info
)
168 FIXME("(%p %d %lu %p): stub!\n", hConsole
, maximize
, numfonts
, info
);
169 SetLastError(LOWORD(E_NOTIMPL
) /* win10 1709+ */);