include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / dlls / kernel32 / console.c
blob0ab7d53d867f3f3f81d7c11c29468fda33e88e08
1 /*
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
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <string.h>
29 #include <limits.h>
31 #include "ntstatus.h"
32 #define WIN32_NO_STATUS
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winternl.h"
36 #include "winnls.h"
37 #include "winerror.h"
38 #include "wincon.h"
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.@)
48 * Undocumented
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.@)
74 * Undocumented
76 BOOL WINAPI VerifyConsoleIoHandle(HANDLE handle)
78 IO_STATUS_BLOCK io;
79 DWORD mode;
80 return !NtDeviceIoControlFile( handle, NULL, NULL, NULL, &io, IOCTL_CONDRV_GET_MODE,
81 NULL, 0, &mode, sizeof(mode) );
84 /******************************************************************
85 * DuplicateConsoleHandle (KERNEL32.@)
87 * Undocumented
89 HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit,
90 DWORD options)
92 HANDLE ret;
93 return DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), &ret,
94 access, inherit, options) ? ret : INVALID_HANDLE_VALUE;
97 /******************************************************************
98 * CloseConsoleHandle (KERNEL32.@)
100 * Undocumented
102 BOOL WINAPI CloseConsoleHandle(HANDLE handle)
104 return CloseHandle(handle);
107 /******************************************************************
108 * GetConsoleInputWaitHandle (KERNEL32.@)
110 * Undocumented
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);
124 return TRUE;
127 /***********************************************************************
128 * GetConsoleKeyboardLayoutNameW (KERNEL32.@)
130 BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR layoutName)
132 static int once;
133 if (!once++)
134 FIXME( "stub %p\n", layoutName);
135 return TRUE;
138 BOOL WINAPI SetConsoleIcon(HICON icon)
140 FIXME(": (%p) stub!\n", icon);
141 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
142 return FALSE;
145 DWORD WINAPI GetNumberOfConsoleFonts(void)
147 return 1;
150 BOOL WINAPI SetConsoleFont(HANDLE hConsole, DWORD index)
152 FIXME("(%p, %lu): stub!\n", hConsole, index);
153 SetLastError(LOWORD(E_NOTIMPL) /* win10 1709+ */);
154 return FALSE;
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);
161 return FALSE;
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+ */);
169 return FALSE;