kernel32: Move some more console functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-02-18 10:56:57 +01:00
parent 5d09d6d437
commit 4a5a3ba702
6 changed files with 463 additions and 378 deletions

View File

@ -1,32 +1,32 @@
@ stdcall AddConsoleAliasA(str str str) kernel32.AddConsoleAliasA
@ stdcall AddConsoleAliasW(wstr wstr wstr) kernel32.AddConsoleAliasW
@ stdcall ExpungeConsoleCommandHistoryA(str) kernel32.ExpungeConsoleCommandHistoryA
@ stdcall ExpungeConsoleCommandHistoryW(wstr) kernel32.ExpungeConsoleCommandHistoryW
@ stub GetConsoleAliasA
@ stdcall AddConsoleAliasA(str str str) kernelbase.AddConsoleAliasA
@ stdcall AddConsoleAliasW(wstr wstr wstr) kernelbase.AddConsoleAliasW
@ stdcall ExpungeConsoleCommandHistoryA(str) kernelbase.ExpungeConsoleCommandHistoryA
@ stdcall ExpungeConsoleCommandHistoryW(wstr) kernelbase.ExpungeConsoleCommandHistoryW
@ stdcall GetConsoleAliasA(str ptr long str) kernelbase.GetConsoleAliasA
@ stub GetConsoleAliasExesA
@ stdcall GetConsoleAliasExesLengthA() kernel32.GetConsoleAliasExesLengthA
@ stdcall GetConsoleAliasExesLengthW() kernel32.GetConsoleAliasExesLengthW
@ stdcall GetConsoleAliasExesLengthA() kernelbase.GetConsoleAliasExesLengthA
@ stdcall GetConsoleAliasExesLengthW() kernelbase.GetConsoleAliasExesLengthW
@ stub GetConsoleAliasExesW
@ stdcall GetConsoleAliasW(wstr ptr long wstr) kernel32.GetConsoleAliasW
@ stdcall GetConsoleAliasW(wstr ptr long wstr) kernelbase.GetConsoleAliasW
@ stub GetConsoleAliasesA
@ stdcall GetConsoleAliasesLengthA(str) kernel32.GetConsoleAliasesLengthA
@ stdcall GetConsoleAliasesLengthW(wstr) kernel32.GetConsoleAliasesLengthW
@ stdcall GetConsoleAliasesLengthA(str) kernelbase.GetConsoleAliasesLengthA
@ stdcall GetConsoleAliasesLengthW(wstr) kernelbase.GetConsoleAliasesLengthW
@ stub GetConsoleAliasesW
@ stdcall GetConsoleCommandHistoryA(long long long) kernel32.GetConsoleCommandHistoryA
@ stdcall GetConsoleCommandHistoryLengthA(str) kernel32.GetConsoleCommandHistoryLengthA
@ stdcall GetConsoleCommandHistoryLengthW(wstr) kernel32.GetConsoleCommandHistoryLengthW
@ stdcall GetConsoleCommandHistoryW(long long long) kernel32.GetConsoleCommandHistoryW
@ stdcall GetConsoleDisplayMode(ptr) kernel32.GetConsoleDisplayMode
@ stdcall GetConsoleFontSize(long long) kernel32.GetConsoleFontSize
@ stdcall GetConsoleCommandHistoryA(ptr long str) kernelbase.GetConsoleCommandHistoryA
@ stdcall GetConsoleCommandHistoryLengthA(str) kernelbase.GetConsoleCommandHistoryLengthA
@ stdcall GetConsoleCommandHistoryLengthW(wstr) kernelbase.GetConsoleCommandHistoryLengthW
@ stdcall GetConsoleCommandHistoryW(ptr long wstr) kernelbase.GetConsoleCommandHistoryW
@ stdcall GetConsoleDisplayMode(ptr) kernelbase.GetConsoleDisplayMode
@ stdcall GetConsoleFontSize(long long) kernelbase.GetConsoleFontSize
@ stub GetConsoleHistoryInfo
@ stdcall GetConsoleProcessList(ptr long) kernel32.GetConsoleProcessList
@ stdcall GetConsoleProcessList(ptr long) kernelbase.GetConsoleProcessList
@ stub GetConsoleSelectionInfo
@ stdcall GetConsoleWindow() kernel32.GetConsoleWindow
@ stdcall GetCurrentConsoleFont(long long ptr) kernel32.GetCurrentConsoleFont
@ stdcall GetCurrentConsoleFontEx(long long ptr) kernel32.GetCurrentConsoleFontEx
@ stdcall GetNumberOfConsoleMouseButtons(ptr) kernel32.GetNumberOfConsoleMouseButtons
@ stdcall SetConsoleDisplayMode(long long ptr) kernel32.SetConsoleDisplayMode
@ stdcall GetConsoleWindow() kernelbase.GetConsoleWindow
@ stdcall GetCurrentConsoleFont(long long ptr) kernelbase.GetCurrentConsoleFont
@ stdcall GetCurrentConsoleFontEx(long long ptr) kernelbase.GetCurrentConsoleFontEx
@ stdcall GetNumberOfConsoleMouseButtons(ptr) kernelbase.GetNumberOfConsoleMouseButtons
@ stdcall SetConsoleDisplayMode(long long ptr) kernelbase.SetConsoleDisplayMode
@ stub SetConsoleHistoryInfo
@ stub SetConsoleNumberOfCommandsA
@ stub SetConsoleNumberOfCommandsW
@ stdcall SetCurrentConsoleFontEx(long long ptr) kernel32.SetCurrentConsoleFontEx
@ stdcall SetCurrentConsoleFontEx(long long ptr) kernelbase.SetCurrentConsoleFontEx

View File

@ -43,24 +43,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(console);
/******************************************************************************
* GetConsoleWindow [KERNEL32.@] Get hwnd of the console window.
*
* RETURNS
* Success: hwnd of the console window.
* Failure: NULL
*/
HWND WINAPI GetConsoleWindow(void)
{
condrv_handle_t win;
BOOL ret;
ret = DeviceIoControl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_GET_WINDOW, NULL, 0, &win, sizeof(win), NULL, NULL );
return ret ? LongToHandle( win ) : NULL;
}
/******************************************************************
* OpenConsoleW (KERNEL32.@)
*
@ -134,23 +116,6 @@ HANDLE WINAPI GetConsoleInputWaitHandle(void)
}
/***********************************************************************
* SetConsoleTitleA (KERNEL32.@)
*/
BOOL WINAPI SetConsoleTitleA( LPCSTR title )
{
LPWSTR titleW;
BOOL ret;
DWORD len = MultiByteToWideChar( GetConsoleOutputCP(), 0, title, -1, NULL, 0 );
if (!(titleW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) return FALSE;
MultiByteToWideChar( GetConsoleOutputCP(), 0, title, -1, titleW, len );
ret = SetConsoleTitleW(titleW);
HeapFree(GetProcessHeap(), 0, titleW);
return ret;
}
/***********************************************************************
* GetConsoleKeyboardLayoutNameA (KERNEL32.@)
*/
@ -171,204 +136,6 @@ BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR layoutName)
return TRUE;
}
/***********************************************************************
* GetConsoleTitleA (KERNEL32.@)
*
* See GetConsoleTitleW.
*/
DWORD WINAPI GetConsoleTitleA(LPSTR title, DWORD size)
{
WCHAR *ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * size);
DWORD ret;
if (!ptr) return 0;
ret = GetConsoleTitleW( ptr, size );
if (ret)
{
WideCharToMultiByte( GetConsoleOutputCP(), 0, ptr, ret + 1, title, size, NULL, NULL);
ret = strlen(title);
}
HeapFree(GetProcessHeap(), 0, ptr);
return ret;
}
/***********************************************************************
* GetNumberOfConsoleMouseButtons (KERNEL32.@)
*/
BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons)
{
FIXME("(%p): stub\n", nrofbuttons);
*nrofbuttons = 2;
return TRUE;
}
/******************************************************************
* GetConsoleDisplayMode (KERNEL32.@)
*/
BOOL WINAPI GetConsoleDisplayMode(LPDWORD lpModeFlags)
{
TRACE("semi-stub: %p\n", lpModeFlags);
/* It is safe to successfully report windowed mode */
*lpModeFlags = 0;
return TRUE;
}
/******************************************************************
* SetConsoleDisplayMode (KERNEL32.@)
*/
BOOL WINAPI SetConsoleDisplayMode(HANDLE hConsoleOutput, DWORD dwFlags,
COORD *lpNewScreenBufferDimensions)
{
TRACE("(%p, %lx, (%d, %d))\n", hConsoleOutput, dwFlags,
lpNewScreenBufferDimensions->X, lpNewScreenBufferDimensions->Y);
if (dwFlags == 1)
{
/* We cannot switch to fullscreen */
return FALSE;
}
return TRUE;
}
/******************************************************************
* GetConsoleAliasW
*
*
* RETURNS
* 0 if an error occurred, non-zero for success
*
*/
DWORD WINAPI GetConsoleAliasW(LPWSTR lpSource, LPWSTR lpTargetBuffer,
DWORD TargetBufferLength, LPWSTR lpExename)
{
FIXME("(%s,%p,%ld,%s): stub\n", debugstr_w(lpSource), lpTargetBuffer, TargetBufferLength, debugstr_w(lpExename));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/******************************************************************
* GetConsoleProcessList (KERNEL32.@)
*/
DWORD WINAPI GetConsoleProcessList(LPDWORD processlist, DWORD processcount)
{
DWORD saved;
NTSTATUS status;
IO_STATUS_BLOCK io;
TRACE("(%p,%ld)\n", processlist, processcount);
if (!processlist || processcount < 1)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
saved = *processlist;
status = NtDeviceIoControlFile( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
NULL, NULL, NULL, &io, IOCTL_CONDRV_GET_PROCESS_LIST,
NULL, 0, processlist, processcount * sizeof(DWORD) );
if (!status) return io.Information / sizeof(DWORD);
if (status == STATUS_BUFFER_TOO_SMALL)
{
DWORD ret = *processlist;
*processlist = saved;
return ret;
}
*processlist = saved;
set_ntstatus( status );
return 0;
}
/* Undocumented, called by native doskey.exe */
DWORD WINAPI GetConsoleCommandHistoryA(DWORD unknown1, DWORD unknown2, DWORD unknown3)
{
FIXME(": (0x%lx, 0x%lx, 0x%lx) stub!\n", unknown1, unknown2, unknown3);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* Undocumented, called by native doskey.exe */
DWORD WINAPI GetConsoleCommandHistoryW(DWORD unknown1, DWORD unknown2, DWORD unknown3)
{
FIXME(": (0x%lx, 0x%lx, 0x%lx) stub!\n", unknown1, unknown2, unknown3);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* Undocumented, called by native doskey.exe */
DWORD WINAPI GetConsoleCommandHistoryLengthA(LPCSTR unknown)
{
FIXME(": (%s) stub!\n", debugstr_a(unknown));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* Undocumented, called by native doskey.exe */
DWORD WINAPI GetConsoleCommandHistoryLengthW(LPCWSTR unknown)
{
FIXME(": (%s) stub!\n", debugstr_w(unknown));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
DWORD WINAPI GetConsoleAliasesLengthA(LPSTR unknown)
{
FIXME(": (%s) stub!\n", debugstr_a(unknown));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR unknown)
{
FIXME(": (%s) stub!\n", debugstr_w(unknown));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
DWORD WINAPI GetConsoleAliasExesLengthA(void)
{
FIXME(": stub!\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
DWORD WINAPI GetConsoleAliasExesLengthW(void)
{
FIXME(": stub!\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
VOID WINAPI ExpungeConsoleCommandHistoryA(LPCSTR unknown)
{
FIXME(": (%s) stub!\n", debugstr_a(unknown));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
}
VOID WINAPI ExpungeConsoleCommandHistoryW(LPCWSTR unknown)
{
FIXME(": (%s) stub!\n", debugstr_w(unknown));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
}
BOOL WINAPI AddConsoleAliasA(LPSTR source, LPSTR target, LPSTR exename)
{
FIXME(": (%s, %s, %s) stub!\n", debugstr_a(source), debugstr_a(target), debugstr_a(exename));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL WINAPI AddConsoleAliasW(LPWSTR source, LPWSTR target, LPWSTR exename)
{
FIXME(": (%s, %s, %s) stub!\n", debugstr_w(source), debugstr_w(target), debugstr_w(exename));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL WINAPI SetConsoleIcon(HICON icon)
{
FIXME(": (%p) stub!\n", icon);
@ -396,103 +163,6 @@ BOOL WINAPI SetConsoleKeyShortcuts(BOOL set, BYTE keys, VOID *a, DWORD b)
}
BOOL WINAPI GetCurrentConsoleFontEx(HANDLE hConsole, BOOL maxwindow, CONSOLE_FONT_INFOEX *fontinfo)
{
DWORD size;
struct
{
struct condrv_output_info info;
WCHAR face_name[LF_FACESIZE - 1];
} data;
if (fontinfo->cbSize != sizeof(CONSOLE_FONT_INFOEX))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!DeviceIoControl( hConsole, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0,
&data, sizeof(data), &size, NULL ))
{
SetLastError( ERROR_INVALID_HANDLE );
return FALSE;
}
fontinfo->nFont = 0;
if (maxwindow)
{
fontinfo->dwFontSize.X = min( data.info.width, data.info.max_width );
fontinfo->dwFontSize.Y = min( data.info.height, data.info.max_height );
}
else
{
fontinfo->dwFontSize.X = data.info.font_width;
fontinfo->dwFontSize.Y = data.info.font_height;
}
size -= sizeof(data.info);
if (size) memcpy( fontinfo->FaceName, data.face_name, size );
fontinfo->FaceName[size / sizeof(WCHAR)] = 0;
fontinfo->FontFamily = data.info.font_pitch_family;
fontinfo->FontWeight = data.info.font_weight;
return TRUE;
}
BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, CONSOLE_FONT_INFO *fontinfo)
{
BOOL ret;
CONSOLE_FONT_INFOEX res;
res.cbSize = sizeof(CONSOLE_FONT_INFOEX);
ret = GetCurrentConsoleFontEx(hConsole, maxwindow, &res);
if(ret)
{
fontinfo->nFont = res.nFont;
fontinfo->dwFontSize.X = res.dwFontSize.X;
fontinfo->dwFontSize.Y = res.dwFontSize.Y;
}
return ret;
}
static COORD get_console_font_size(HANDLE hConsole, DWORD index)
{
struct condrv_output_info info;
COORD c = {0,0};
if (index >= GetNumberOfConsoleFonts())
{
SetLastError(ERROR_INVALID_PARAMETER);
return c;
}
if (DeviceIoControl( hConsole, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0, &info, sizeof(info), NULL, NULL ))
{
c.X = info.font_width;
c.Y = info.font_height;
}
else SetLastError( ERROR_INVALID_HANDLE );
return c;
}
#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER)
#undef GetConsoleFontSize
DWORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD index)
{
union {
COORD c;
DWORD w;
} x;
x.c = get_console_font_size(hConsole, index);
return x.w;
}
#else
COORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD index)
{
return get_console_font_size(hConsole, index);
}
#endif /* !defined(__i386__) */
BOOL WINAPI GetConsoleFontInfo(HANDLE hConsole, BOOL maximize, DWORD numfonts, CONSOLE_FONT_INFO *info)
{
FIXME("(%p %d %lu %p): stub!\n", hConsole, maximize, numfonts, info);

View File

@ -138,8 +138,8 @@
@ stdcall -import ActivateActCtx(ptr ptr)
@ stdcall AddAtomA(str)
@ stdcall AddAtomW(wstr)
@ stdcall AddConsoleAliasA(str str str)
@ stdcall AddConsoleAliasW(wstr wstr wstr)
@ stdcall -import AddConsoleAliasA(str str str)
@ stdcall -import AddConsoleAliasW(wstr wstr wstr)
@ stdcall -import AddDllDirectory(wstr)
# @ stub AddIntegrityLabelToBoundaryDescriptor
# @ stub AddLocalAlternateComputerNameA
@ -443,8 +443,8 @@
@ stub ExitVDM
@ stdcall -import ExpandEnvironmentStringsA(str ptr long)
@ stdcall -import ExpandEnvironmentStringsW(wstr ptr long)
@ stdcall ExpungeConsoleCommandHistoryA(str)
@ stdcall ExpungeConsoleCommandHistoryW(wstr)
@ stdcall -import ExpungeConsoleCommandHistoryA(str)
@ stdcall -import ExpungeConsoleCommandHistoryW(wstr)
@ stub ExtendVirtualBuffer
@ stdcall -i386 -private -norelay FT_Exit0() krnl386.exe16.FT_Exit0
@ stdcall -i386 -private -norelay FT_Exit12() krnl386.exe16.FT_Exit12
@ -580,27 +580,27 @@
@ stdcall GetComputerNameExA(long ptr ptr)
@ stdcall -import GetComputerNameExW(long ptr ptr)
@ stdcall GetComputerNameW(ptr ptr)
@ stub GetConsoleAliasA
@ stdcall -import GetConsoleAliasA(str ptr long str)
@ stub GetConsoleAliasExesA
@ stdcall GetConsoleAliasExesLengthA()
@ stdcall GetConsoleAliasExesLengthW()
@ stdcall -import GetConsoleAliasExesLengthA()
@ stdcall -import GetConsoleAliasExesLengthW()
@ stub GetConsoleAliasExesW
@ stdcall GetConsoleAliasW(wstr ptr long wstr)
@ stdcall -import GetConsoleAliasW(wstr ptr long wstr)
@ stub GetConsoleAliasesA
@ stdcall GetConsoleAliasesLengthA(str)
@ stdcall GetConsoleAliasesLengthW(wstr)
@ stdcall -import GetConsoleAliasesLengthA(str)
@ stdcall -import GetConsoleAliasesLengthW(wstr)
@ stub GetConsoleAliasesW
@ stdcall -import GetConsoleCP()
@ stub GetConsoleCharType
@ stdcall GetConsoleCommandHistoryA(long long long)
@ stdcall GetConsoleCommandHistoryLengthA(str)
@ stdcall GetConsoleCommandHistoryLengthW(wstr)
@ stdcall GetConsoleCommandHistoryW(long long long)
@ stdcall -import GetConsoleCommandHistoryA(ptr long str)
@ stdcall -import GetConsoleCommandHistoryLengthA(str)
@ stdcall -import GetConsoleCommandHistoryLengthW(wstr)
@ stdcall -import GetConsoleCommandHistoryW(ptr long wstr)
@ stdcall -import GetConsoleCursorInfo(long ptr)
@ stub GetConsoleCursorMode
@ stdcall GetConsoleDisplayMode(ptr)
@ stdcall -import GetConsoleDisplayMode(ptr)
@ stdcall GetConsoleFontInfo(ptr long long ptr)
@ stdcall GetConsoleFontSize(long long)
@ stdcall -import GetConsoleFontSize(long long)
@ stub GetConsoleHardwareState
# @ stub GetConsoleHistoryInfo
@ stdcall -import GetConsoleInputExeNameA(long ptr)
@ -613,19 +613,19 @@
# @ stub GetConsoleOriginalTitleA
# @ stub GetConsoleOriginalTitleW
@ stdcall -import GetConsoleOutputCP()
@ stdcall GetConsoleProcessList(ptr long)
@ stdcall -import GetConsoleProcessList(ptr long)
@ stdcall -import GetConsoleScreenBufferInfo(long ptr)
@ stdcall -import GetConsoleScreenBufferInfoEx(long ptr)
# @ stub GetConsoleSelectionInfo
@ stdcall GetConsoleTitleA(ptr long)
@ stdcall -import GetConsoleTitleA(ptr long)
@ stdcall -import GetConsoleTitleW(ptr long)
@ stdcall GetConsoleWindow()
@ stdcall -import GetConsoleWindow()
@ stdcall GetCurrencyFormatA(long long str ptr ptr long)
@ stdcall GetCurrencyFormatEx(wstr long wstr ptr ptr long)
@ stdcall GetCurrencyFormatW(long long wstr ptr ptr long)
@ stdcall -import GetCurrentActCtx(ptr)
@ stdcall GetCurrentConsoleFont(long long ptr)
@ stdcall GetCurrentConsoleFontEx(long long ptr)
@ stdcall -import GetCurrentConsoleFont(long long ptr)
@ stdcall -import GetCurrentConsoleFontEx(long long ptr)
@ stdcall -import GetCurrentDirectoryA(long ptr)
@ stdcall -import GetCurrentDirectoryW(long ptr)
@ stdcall GetCurrentPackageFamilyName(ptr ptr) kernelbase.GetCurrentPackageFamilyName
@ -760,7 +760,7 @@
@ stdcall GetNumberFormatW(long long wstr ptr ptr long)
@ stdcall GetNumberOfConsoleFonts()
@ stdcall -import GetNumberOfConsoleInputEvents(long ptr)
@ stdcall GetNumberOfConsoleMouseButtons(ptr)
@ stdcall -import GetNumberOfConsoleMouseButtons(ptr)
@ stdcall -import GetOEMCP()
@ stdcall -import GetOverlappedResult(long ptr ptr long)
@ stdcall -import GetOverlappedResultEx(long ptr ptr long long)
@ -1366,7 +1366,7 @@
@ stdcall -import SetConsoleCursorInfo(long ptr)
@ stub SetConsoleCursorMode
@ stdcall -import SetConsoleCursorPosition(long long)
@ stdcall SetConsoleDisplayMode(long long ptr)
@ stdcall -import SetConsoleDisplayMode(long long ptr)
@ stdcall SetConsoleFont(long long)
@ stub SetConsoleHardwareState
@ stdcall SetConsoleIcon(ptr)
@ -1386,7 +1386,7 @@
@ stdcall -import SetConsoleScreenBufferInfoEx(long ptr)
@ stdcall -import SetConsoleScreenBufferSize(long long)
@ stdcall -import SetConsoleTextAttribute(long long)
@ stdcall SetConsoleTitleA(str)
@ stdcall -import SetConsoleTitleA(str)
@ stdcall -import SetConsoleTitleW(wstr)
@ stdcall -import SetConsoleWindowInfo(long long ptr)
@ stdcall SetCriticalSectionSpinCount(ptr long) NTDLL.RtlSetCriticalSectionSpinCount

View File

@ -175,6 +175,27 @@ static COORD get_largest_console_window_size( HANDLE handle )
return c;
}
/* helper function for GetConsoleFontSize */
static COORD get_console_font_size( HANDLE handle, DWORD index )
{
struct condrv_output_info info;
COORD c = {0,0};
if (index >= 1 /* number of console fonts */)
{
SetLastError(ERROR_INVALID_PARAMETER);
return c;
}
if (DeviceIoControl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0, &info, sizeof(info), NULL, NULL ))
{
c.X = info.font_width;
c.Y = info.font_height;
}
else SetLastError( ERROR_INVALID_HANDLE );
return c;
}
static HANDLE create_console_server( void )
{
OBJECT_ATTRIBUTES attr = {sizeof(attr)};
@ -278,6 +299,29 @@ static BOOL init_console_std_handles( BOOL override_all )
return TRUE;
}
/******************************************************************
* AddConsoleAliasA (kernelbase.@)
*/
BOOL WINAPI AddConsoleAliasA( LPSTR source, LPSTR target, LPSTR exename )
{
FIXME( ": (%s, %s, %s) stub!\n", debugstr_a(source), debugstr_a(target), debugstr_a(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
}
/******************************************************************
* AddConsoleAliasW (kernelbase.@)
*/
BOOL WINAPI AddConsoleAliasW( LPWSTR source, LPWSTR target, LPWSTR exename )
{
FIXME( ": (%s, %s, %s) stub!\n", debugstr_w(source), debugstr_w(target), debugstr_w(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
}
/******************************************************************
* AttachConsole (kernelbase.@)
*/
@ -470,6 +514,26 @@ DWORD WINAPI CtrlRoutine( void *arg )
}
/******************************************************************
* ExpungeConsoleCommandHistoryA (kernelbase.@)
*/
void WINAPI ExpungeConsoleCommandHistoryA( LPCSTR exename )
{
FIXME( ": (%s) stub!\n", debugstr_a(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
}
/******************************************************************
* ExpungeConsoleCommandHistoryW (kernelbase.@)
*/
void WINAPI ExpungeConsoleCommandHistoryW( LPCWSTR exename )
{
FIXME( ": (%s) stub!\n", debugstr_w(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
}
/******************************************************************************
* FillConsoleOutputAttribute (kernelbase.@)
*/
@ -588,6 +652,116 @@ BOOL WINAPI DECLSPEC_HOTPATCH GenerateConsoleCtrlEvent( DWORD event, DWORD group
}
/******************************************************************
* GetConsoleAliasA (kernelbase.@)
*/
DWORD WINAPI GetConsoleAliasA( LPSTR source, LPSTR buffer, DWORD len, LPSTR exename )
{
FIXME( "(%s,%p,%ld,%s): stub\n", debugstr_a(source), buffer, len, debugstr_a(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleAliasW (kernelbase.@)
*/
DWORD WINAPI GetConsoleAliasW( LPWSTR source, LPWSTR buffer, DWORD len, LPWSTR exename )
{
FIXME( "(%s,%p,%ld,%s): stub\n", debugstr_w(source), buffer, len, debugstr_w(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleAliasExesLengthA (kernelbase.@)
*/
DWORD WINAPI GetConsoleAliasExesLengthA(void)
{
FIXME( ": stub\n" );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleAliasExesLengthW (kernelbase.@)
*/
DWORD WINAPI GetConsoleAliasExesLengthW(void)
{
FIXME( ": stub\n" );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleAliasesLengthA (kernelbase.@)
*/
DWORD WINAPI GetConsoleAliasesLengthA( LPSTR unknown )
{
FIXME( ": (%s) stub!\n", debugstr_a(unknown) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleAliasesLengthW (kernelbase.@)
*/
DWORD WINAPI GetConsoleAliasesLengthW( LPWSTR unknown )
{
FIXME( ": (%s) stub!\n", debugstr_w(unknown) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleCommandHistoryA (kernelbase.@)
*/
DWORD WINAPI GetConsoleCommandHistoryA( LPSTR buffer, DWORD len, LPCSTR exename )
{
FIXME( ": (%p, 0x%lx, %s) stub\n", buffer, len, debugstr_a(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleCommandHistoryW (kernelbase.@)
*/
DWORD WINAPI GetConsoleCommandHistoryW( LPWSTR buffer, DWORD len, LPCWSTR exename )
{
FIXME( ": (%p, 0x%lx, %s) stub\n", buffer, len, debugstr_w(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleCommandHistoryLengthA (kernelbase.@)
*/
DWORD WINAPI GetConsoleCommandHistoryLengthA( LPCSTR exename )
{
FIXME( ": (%s) stub!\n", debugstr_a(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************
* GetConsoleCommandHistoryLengthW (kernelbase.@)
*/
DWORD WINAPI GetConsoleCommandHistoryLengthW( LPCWSTR exename )
{
FIXME( ": (%s) stub!\n", debugstr_w(exename) );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/******************************************************************************
* GetConsoleCP (kernelbase.@)
*/
@ -625,6 +799,41 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleCursorInfo( HANDLE handle, CONSOLE_CURSO
}
/***********************************************************************
* GetConsoleDisplayMode (kernelbase.@)
*/
BOOL WINAPI GetConsoleDisplayMode( LPDWORD flags )
{
TRACE( "semi-stub: %p\n", flags );
/* It is safe to successfully report windowed mode */
*flags = 0;
return TRUE;
}
/***********************************************************************
* GetConsoleFontSize (kernelbase.@)
*/
#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER)
#undef GetConsoleFontSize
DWORD WINAPI GetConsoleFontSize( HANDLE handle, DWORD index )
{
union {
COORD c;
DWORD w;
} x;
x.c = get_console_font_size( handle, index );
return x.w;
}
#else
COORD WINAPI GetConsoleFontSize( HANDLE handle, DWORD index )
{
return get_console_font_size( handle, index );
}
#endif /* !defined(__i386__) */
/***********************************************************************
* GetConsoleInputExeNameA (kernelbase.@)
*/
@ -675,6 +884,42 @@ UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
}
/***********************************************************************
* GetConsoleProcessList (kernelbase.@)
*/
DWORD WINAPI GetConsoleProcessList( DWORD *list, DWORD count )
{
DWORD saved;
NTSTATUS status;
IO_STATUS_BLOCK io;
TRACE( "(%p,%ld)\n", list, count);
if (!list || count < 1)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
saved = *list;
status = NtDeviceIoControlFile( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
NULL, NULL, NULL, &io, IOCTL_CONDRV_GET_PROCESS_LIST,
NULL, 0, list, count * sizeof(DWORD) );
if (!status) return io.Information / sizeof(DWORD);
if (status == STATUS_BUFFER_TOO_SMALL)
{
DWORD ret = *list;
*list = saved;
return ret;
}
*list = saved;
set_ntstatus( status );
return 0;
}
/***********************************************************************
* GetConsoleScreenBufferInfo (kernelbase.@)
*/
@ -742,6 +987,26 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfoEx( HANDLE handle,
}
/******************************************************************************
* GetConsoleTitleA (kernelbase.@)
*/
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA( LPSTR title, DWORD size )
{
WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * size );
DWORD ret;
if (!ptr) return 0;
ret = GetConsoleTitleW( ptr, size );
if (ret)
{
WideCharToMultiByte( GetConsoleOutputCP(), 0, ptr, ret + 1, title, size, NULL, NULL);
ret = strlen(title);
}
HeapFree( GetProcessHeap(), 0, ptr );
return ret;
}
/******************************************************************************
* GetConsoleTitleW (kernelbase.@)
*/
@ -759,6 +1024,86 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW( LPWSTR title, DWORD size )
}
/******************************************************************************
* GetConsoleWindow (kernelbase.@)
*/
HWND WINAPI GetConsoleWindow(void)
{
condrv_handle_t win;
BOOL ret;
ret = DeviceIoControl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_GET_WINDOW, NULL, 0, &win, sizeof(win), NULL, NULL );
return ret ? LongToHandle( win ) : NULL;
}
/***********************************************************************
* GetCurrentConsoleFontEx (kernelbase.@)
*/
BOOL WINAPI GetCurrentConsoleFontEx( HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFOEX *info )
{
DWORD size;
struct
{
struct condrv_output_info info;
WCHAR face_name[LF_FACESIZE - 1];
} data;
if (info->cbSize != sizeof(CONSOLE_FONT_INFOEX))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!DeviceIoControl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0,
&data, sizeof(data), &size, NULL ))
{
SetLastError( ERROR_INVALID_HANDLE );
return FALSE;
}
info->nFont = 0;
if (maxwindow)
{
info->dwFontSize.X = min( data.info.width, data.info.max_width );
info->dwFontSize.Y = min( data.info.height, data.info.max_height );
}
else
{
info->dwFontSize.X = data.info.font_width;
info->dwFontSize.Y = data.info.font_height;
}
size -= sizeof(data.info);
if (size) memcpy( info->FaceName, data.face_name, size );
info->FaceName[size / sizeof(WCHAR)] = 0;
info->FontFamily = data.info.font_pitch_family;
info->FontWeight = data.info.font_weight;
return TRUE;
}
/***********************************************************************
* GetCurrentConsoleFont (kernelbase.@)
*/
BOOL WINAPI GetCurrentConsoleFont( HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFO *info )
{
BOOL ret;
CONSOLE_FONT_INFOEX res;
res.cbSize = sizeof(CONSOLE_FONT_INFOEX);
ret = GetCurrentConsoleFontEx( handle, maxwindow, &res );
if (ret)
{
info->nFont = res.nFont;
info->dwFontSize.X = res.dwFontSize.X;
info->dwFontSize.Y = res.dwFontSize.Y;
}
return ret;
}
/***********************************************************************
* GetLargestConsoleWindowSize (kernelbase.@)
*/
@ -797,6 +1142,17 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetNumberOfConsoleInputEvents( HANDLE handle, DWOR
}
/***********************************************************************
* GetNumberOfConsoleMouseButtons (kernelbase.@)
*/
BOOL WINAPI GetNumberOfConsoleMouseButtons( DWORD *count )
{
FIXME( "(%p): stub\n", count );
*count = 2;
return TRUE;
}
/***********************************************************************
* PeekConsoleInputA (kernelbase.@)
*/
@ -1141,6 +1497,21 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCursorPosition( HANDLE handle, COORD pos
}
/***********************************************************************
* SetConsoleDisplayMode (kernelbase.@)
*/
BOOL WINAPI SetConsoleDisplayMode( HANDLE handle, DWORD flags, COORD *size )
{
TRACE( "(%p, %lx, (%d, %d))\n", handle, flags, size->X, size->Y );
if (flags == 1)
{
/* We cannot switch to fullscreen */
return FALSE;
}
return TRUE;
}
/******************************************************************************
* SetConsoleInputExeNameA (kernelbase.@)
*/
@ -1262,6 +1633,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTextAttribute( HANDLE handle, WORD attr
}
/******************************************************************************
* SetConsoleTitleA (kernelbase.@)
*/
BOOL WINAPI SetConsoleTitleA( LPCSTR title )
{
LPWSTR titleW;
BOOL ret;
DWORD len = MultiByteToWideChar( GetConsoleOutputCP(), 0, title, -1, NULL, 0 );
if (!(titleW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
MultiByteToWideChar( GetConsoleOutputCP(), 0, title, -1, titleW, len );
ret = SetConsoleTitleW(titleW);
HeapFree( GetProcessHeap(), 0, titleW );
return ret;
}
/******************************************************************************
* SetConsoleTitleW (kernelbase.@)
*/

View File

@ -19,6 +19,8 @@
@ stdcall AddAuditAccessAce(ptr long long ptr long long)
@ stdcall AddAuditAccessAceEx(ptr long long long ptr long long)
@ stdcall AddAuditAccessObjectAce(ptr long long long ptr ptr ptr long long)
@ stdcall AddConsoleAliasA(str str str)
@ stdcall AddConsoleAliasW(wstr wstr wstr)
@ stdcall AddDllDirectory(wstr)
@ stdcall AddMandatoryAce(ptr long long long ptr)
@ stdcall AddRefActCtx(ptr)
@ -343,6 +345,8 @@
@ stdcall ExitThread(long) ntdll.RtlExitUserThread
@ stdcall ExpandEnvironmentStringsA(str ptr long)
@ stdcall ExpandEnvironmentStringsW(wstr ptr long)
@ stdcall ExpungeConsoleCommandHistoryA(str)
@ stdcall ExpungeConsoleCommandHistoryW(wstr)
@ stdcall FatalAppExitA(long str)
@ stdcall FatalAppExitW(long wstr)
@ stdcall FileTimeToLocalFileTime(ptr ptr)
@ -441,19 +445,40 @@
@ stdcall GetCompressedFileSizeW(wstr ptr)
@ stdcall GetComputerNameExA(long ptr ptr)
@ stdcall GetComputerNameExW(long ptr ptr)
@ stdcall GetConsoleAliasA(str ptr long str)
#@ stub GetConsoleAliasExesA
@ stdcall GetConsoleAliasExesLengthA()
@ stdcall GetConsoleAliasExesLengthW()
#@ stub GetConsoleAliasExesW
@ stdcall GetConsoleAliasW(wstr ptr long wstr)
#@ stub GetConsoleAliasesA
@ stdcall GetConsoleAliasesLengthA(str)
@ stdcall GetConsoleAliasesLengthW(wstr)
#@ stub GetConsoleAliasesW
@ stdcall GetConsoleCP()
@ stdcall GetConsoleCommandHistoryA(ptr long str)
@ stdcall GetConsoleCommandHistoryLengthA(str)
@ stdcall GetConsoleCommandHistoryLengthW(wstr)
@ stdcall GetConsoleCommandHistoryW(ptr long wstr)
@ stdcall GetConsoleCursorInfo(long ptr)
@ stdcall GetConsoleDisplayMode(ptr)
@ stdcall GetConsoleFontSize(long long)
@ stdcall GetConsoleInputExeNameA(long ptr)
@ stdcall GetConsoleInputExeNameW(long ptr)
@ stdcall GetConsoleMode(long ptr)
@ stdcall GetConsoleOutputCP()
@ stdcall GetConsoleProcessList(ptr long)
@ stdcall GetConsoleScreenBufferInfo(long ptr)
@ stdcall GetConsoleScreenBufferInfoEx(long ptr)
@ stdcall GetConsoleTitleA(ptr long)
@ stdcall GetConsoleTitleW(ptr long)
@ stdcall GetConsoleWindow()
@ stdcall GetCurrencyFormatEx(wstr long wstr ptr ptr long) kernel32.GetCurrencyFormatEx
@ stdcall GetCurrencyFormatW(long long wstr ptr ptr long) kernel32.GetCurrencyFormatW
@ stdcall GetCurrentActCtx(ptr)
# @ stub GetCurrentApplicationUserModelId
@ stdcall GetCurrentConsoleFont(long long ptr)
@ stdcall GetCurrentConsoleFontEx(long long ptr)
@ stdcall GetCurrentDirectoryA(long ptr)
@ stdcall GetCurrentDirectoryW(long ptr)
# @ stub GetCurrentPackageApplicationContext
@ -582,6 +607,7 @@
@ stdcall GetNumberFormatEx(wstr long wstr ptr ptr long) kernel32.GetNumberFormatEx
@ stdcall GetNumberFormatW(long long wstr ptr ptr long) kernel32.GetNumberFormatW
@ stdcall GetNumberOfConsoleInputEvents(long ptr)
@ stdcall GetNumberOfConsoleMouseButtons(ptr)
@ stdcall GetOEMCP()
# @ stub GetOsManufacturingMode
# @ stub GetOsSafeBootMode
@ -1412,6 +1438,7 @@
@ stdcall SetConsoleCtrlHandler(ptr long)
@ stdcall SetConsoleCursorInfo(long ptr)
@ stdcall SetConsoleCursorPosition(long long)
@ stdcall SetConsoleDisplayMode(long long ptr)
@ stdcall SetConsoleInputExeNameA(str)
@ stdcall SetConsoleInputExeNameW(wstr)
@ stdcall SetConsoleMode(long long)
@ -1419,6 +1446,7 @@
@ stdcall SetConsoleScreenBufferInfoEx(long ptr)
@ stdcall SetConsoleScreenBufferSize(long long)
@ stdcall SetConsoleTextAttribute(long long)
@ stdcall SetConsoleTitleA(str)
@ stdcall SetConsoleTitleW(wstr)
@ stdcall SetConsoleWindowInfo(long long ptr)
@ stdcall SetCriticalSectionSpinCount(ptr long) ntdll.RtlSetCriticalSectionSpinCount

View File

@ -214,6 +214,7 @@ my @dll_groups =
"api-ms-win-core-console-l1-1-0",
"api-ms-win-core-console-l1-2-0",
"api-ms-win-core-console-l2-1-0",
"api-ms-win-core-console-l3-2-0",
"api-ms-win-core-datetime-l1-1-0",
"api-ms-win-core-datetime-l1-1-1",
"api-ms-win-core-debug-l1-1-0",
@ -333,7 +334,6 @@ my @dll_groups =
[
"kernel32",
"api-ms-win-core-appinit-l1-1-0",
"api-ms-win-core-console-l3-2-0",
"api-ms-win-core-heap-obsolete-l1-1-0",
"api-ms-win-core-io-l1-1-0",
"api-ms-win-core-io-l1-1-1",