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
32 #define WIN32_NO_STATUS
39 #include "wine/condrv.h"
40 #include "wine/debug.h"
41 #include "kernel_private.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(console
);
45 /******************************************************************
46 * OpenConsoleW (KERNEL32.@)
49 * Open a handle to the current process console.
50 * Returns INVALID_HANDLE_VALUE on failure.
52 HANDLE WINAPI
OpenConsoleW(LPCWSTR name
, DWORD access
, BOOL inherit
, DWORD creation
)
54 SECURITY_ATTRIBUTES sa
;
56 TRACE("(%s, 0x%08lx, %d, %lu)\n", debugstr_w(name
), access
, inherit
, creation
);
58 if (!name
|| (wcsicmp( L
"CONIN$", name
) && wcsicmp( L
"CONOUT$", name
)) || creation
!= OPEN_EXISTING
)
60 SetLastError( ERROR_INVALID_PARAMETER
);
61 return INVALID_HANDLE_VALUE
;
64 sa
.nLength
= sizeof(sa
);
65 sa
.lpSecurityDescriptor
= NULL
;
66 sa
.bInheritHandle
= inherit
;
68 return CreateFileW( name
, access
, FILE_SHARE_READ
| FILE_SHARE_WRITE
, &sa
, creation
, 0, NULL
);
71 /******************************************************************
72 * VerifyConsoleIoHandle (KERNEL32.@)
76 BOOL WINAPI
VerifyConsoleIoHandle(HANDLE handle
)
80 return !NtDeviceIoControlFile( handle
, NULL
, NULL
, NULL
, &io
, IOCTL_CONDRV_GET_MODE
,
81 NULL
, 0, &mode
, sizeof(mode
) );
84 /******************************************************************
85 * DuplicateConsoleHandle (KERNEL32.@)
89 HANDLE WINAPI
DuplicateConsoleHandle(HANDLE handle
, DWORD access
, BOOL inherit
,
93 return DuplicateHandle(GetCurrentProcess(), handle
, GetCurrentProcess(), &ret
,
94 access
, inherit
, options
) ? ret
: INVALID_HANDLE_VALUE
;
97 /******************************************************************
98 * CloseConsoleHandle (KERNEL32.@)
102 BOOL WINAPI
CloseConsoleHandle(HANDLE handle
)
104 return CloseHandle(handle
);
107 /******************************************************************
108 * GetConsoleInputWaitHandle (KERNEL32.@)
112 HANDLE WINAPI
GetConsoleInputWaitHandle(void)
114 return GetStdHandle( STD_INPUT_HANDLE
);
118 /***********************************************************************
119 * GetConsoleKeyboardLayoutNameA (KERNEL32.@)
121 BOOL WINAPI
GetConsoleKeyboardLayoutNameA(LPSTR layoutName
)
123 FIXME( "stub %p\n", layoutName
);
127 /***********************************************************************
128 * GetConsoleKeyboardLayoutNameW (KERNEL32.@)
130 BOOL WINAPI
GetConsoleKeyboardLayoutNameW(LPWSTR layoutName
)
134 FIXME( "stub %p\n", layoutName
);
138 BOOL WINAPI
SetConsoleIcon(HICON icon
)
140 FIXME(": (%p) stub!\n", icon
);
141 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
145 DWORD WINAPI
GetNumberOfConsoleFonts(void)
150 BOOL WINAPI
SetConsoleFont(HANDLE hConsole
, DWORD index
)
152 FIXME("(%p, %lu): stub!\n", hConsole
, index
);
153 SetLastError(LOWORD(E_NOTIMPL
) /* win10 1709+ */);
157 BOOL WINAPI
SetConsoleKeyShortcuts(BOOL set
, BYTE keys
, VOID
*a
, DWORD b
)
159 FIXME(": (%u %u %p %lu) stub!\n", set
, keys
, a
, b
);
160 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
165 BOOL WINAPI
GetConsoleFontInfo(HANDLE hConsole
, BOOL maximize
, DWORD numfonts
, CONSOLE_FONT_INFO
*info
)
167 FIXME("(%p %d %lu %p): stub!\n", hConsole
, maximize
, numfonts
, info
);
168 SetLastError(LOWORD(E_NOTIMPL
) /* win10 1709+ */);