[FORMATTING]

Fix indentation and coding style. No code changes!

svn path=/trunk/; revision=63305
This commit is contained in:
Eric Kohl 2014-05-15 16:32:30 +00:00
parent 8afc11c2e4
commit ac2f92611e
5 changed files with 872 additions and 854 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,7 @@
#include <usetup.h>
BOOLEAN
NATIVE_InitConsole(
VOID)
NATIVE_InitConsole(VOID)
{
return (BOOLEAN)AllocConsole();
return (BOOLEAN)AllocConsole();
}

View file

@ -2,30 +2,29 @@
BOOLEAN
NATIVE_CreateFileSystemList(
IN PFILE_SYSTEM_LIST List)
IN PFILE_SYSTEM_LIST List)
{
FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk);
FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk);
#if 0
FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk);
FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk);
#endif
return TRUE;
return TRUE;
}
BOOLEAN
NATIVE_FormatPartition(
IN PFILE_SYSTEM_ITEM FileSystem,
IN PCUNICODE_STRING DriveRoot,
IN PFMIFSCALLBACK Callback)
IN PFILE_SYSTEM_ITEM FileSystem,
IN PCUNICODE_STRING DriveRoot,
IN PFMIFSCALLBACK Callback)
{
NTSTATUS Status;
NTSTATUS Status;
Status = FileSystem->FormatFunc(
(PUNICODE_STRING)DriveRoot,
FMIFS_HARDDISK, /* MediaFlag */
NULL, /* Label */
FileSystem->QuickFormat, /* QuickFormat */
0, /* ClusterSize */
Callback); /* Callback */
return NT_SUCCESS(Status);
Status = FileSystem->FormatFunc((PUNICODE_STRING)DriveRoot,
FMIFS_HARDDISK, /* MediaFlag */
NULL, /* Label */
FileSystem->QuickFormat, /* QuickFormat */
0, /* ClusterSize */
Callback); /* Callback */
return NT_SUCCESS(Status);
}

View file

@ -36,476 +36,481 @@
/* FUNCTIONS *****************************************************************/
BOOL WINAPI
BOOL
WINAPI
AllocConsole(VOID)
{
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
/* Open the screen */
InitializeObjectAttributes(
&ObjectAttributes,
&ScreenName,
0,
NULL,
NULL);
Status = NtOpenFile(
&StdOutput,
FILE_ALL_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
return FALSE;
/* Open the screen */
InitializeObjectAttributes(&ObjectAttributes,
&ScreenName,
0,
NULL,
NULL);
Status = NtOpenFile(&StdOutput,
FILE_ALL_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
return FALSE;
/* Open the keyboard */
InitializeObjectAttributes(
&ObjectAttributes,
&KeyboardName,
0,
NULL,
NULL);
Status = NtOpenFile(
&StdInput,
FILE_ALL_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
FILE_OPEN,
0);
if (!NT_SUCCESS(Status))
return FALSE;
/* Open the keyboard */
InitializeObjectAttributes(&ObjectAttributes,
&KeyboardName,
0,
NULL,
NULL);
Status = NtOpenFile(&StdInput,
FILE_ALL_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
FILE_OPEN,
0);
if (!NT_SUCCESS(Status))
return FALSE;
return TRUE;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
AttachConsole(
IN DWORD dwProcessId)
IN DWORD dwProcessId)
{
return FALSE;
return FALSE;
}
BOOL WINAPI
BOOL
WINAPI
FreeConsole(VOID)
{
if (StdInput != INVALID_HANDLE_VALUE)
NtClose(StdInput);
if (StdInput != INVALID_HANDLE_VALUE)
NtClose(StdInput);
if (StdOutput != INVALID_HANDLE_VALUE)
NtClose(StdOutput);
if (StdOutput != INVALID_HANDLE_VALUE)
NtClose(StdOutput);
return TRUE;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
WriteConsole(
IN HANDLE hConsoleOutput,
IN const VOID* lpBuffer,
IN DWORD nNumberOfCharsToWrite,
OUT LPDWORD lpNumberOfCharsWritten,
IN LPVOID lpReserved)
IN HANDLE hConsoleOutput,
IN const VOID *lpBuffer,
IN DWORD nNumberOfCharsToWrite,
OUT LPDWORD lpNumberOfCharsWritten,
IN LPVOID lpReserved)
{
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
Status = NtWriteFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
(PVOID)lpBuffer,
nNumberOfCharsToWrite,
NULL,
NULL);
if (!NT_SUCCESS(Status))
return FALSE;
Status = NtWriteFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
(PVOID)lpBuffer,
nNumberOfCharsToWrite,
NULL,
NULL);
if (!NT_SUCCESS(Status))
return FALSE;
*lpNumberOfCharsWritten = IoStatusBlock.Information;
return TRUE;
*lpNumberOfCharsWritten = IoStatusBlock.Information;
return TRUE;
}
HANDLE WINAPI
HANDLE
WINAPI
GetStdHandle(
IN DWORD nStdHandle)
IN DWORD nStdHandle)
{
switch (nStdHandle)
{
case STD_INPUT_HANDLE:
return StdInput;
case STD_OUTPUT_HANDLE:
return StdOutput;
default:
return INVALID_HANDLE_VALUE;
}
switch (nStdHandle)
{
case STD_INPUT_HANDLE:
return StdInput;
case STD_OUTPUT_HANDLE:
return StdOutput;
default:
return INVALID_HANDLE_VALUE;
}
}
BOOL WINAPI
BOOL
WINAPI
FlushConsoleInputBuffer(
IN HANDLE hConsoleInput)
IN HANDLE hConsoleInput)
{
LARGE_INTEGER Offset, Timeout;
IO_STATUS_BLOCK IoStatusBlock;
KEYBOARD_INPUT_DATA InputData;
NTSTATUS Status;
LARGE_INTEGER Offset, Timeout;
IO_STATUS_BLOCK IoStatusBlock;
KEYBOARD_INPUT_DATA InputData;
NTSTATUS Status;
do
{
Offset.QuadPart = 0;
Status = NtReadFile(
hConsoleInput,
NULL,
NULL,
NULL,
&IoStatusBlock,
&InputData,
sizeof(KEYBOARD_INPUT_DATA),
&Offset,
0);
if (Status == STATUS_PENDING)
{
Timeout.QuadPart = -100;
Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout);
if (Status == STATUS_TIMEOUT)
{
NtCancelIoFile(hConsoleInput, &IoStatusBlock);
return TRUE;
}
}
} while (NT_SUCCESS(Status));
return FALSE;
do
{
Offset.QuadPart = 0;
Status = NtReadFile(hConsoleInput,
NULL,
NULL,
NULL,
&IoStatusBlock,
&InputData,
sizeof(KEYBOARD_INPUT_DATA),
&Offset,
0);
if (Status == STATUS_PENDING)
{
Timeout.QuadPart = -100;
Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout);
if (Status == STATUS_TIMEOUT)
{
NtCancelIoFile(hConsoleInput, &IoStatusBlock);
return TRUE;
}
}
} while (NT_SUCCESS(Status));
return FALSE;
}
BOOL WINAPI
BOOL
WINAPI
ReadConsoleInput(
IN HANDLE hConsoleInput,
OUT PINPUT_RECORD lpBuffer,
IN DWORD nLength,
OUT LPDWORD lpNumberOfEventsRead)
IN HANDLE hConsoleInput,
OUT PINPUT_RECORD lpBuffer,
IN DWORD nLength,
OUT LPDWORD lpNumberOfEventsRead)
{
LARGE_INTEGER Offset;
IO_STATUS_BLOCK IoStatusBlock;
KEYBOARD_INPUT_DATA InputData;
NTSTATUS Status;
LARGE_INTEGER Offset;
IO_STATUS_BLOCK IoStatusBlock;
KEYBOARD_INPUT_DATA InputData;
NTSTATUS Status;
Offset.QuadPart = 0;
Status = NtReadFile(
hConsoleInput,
NULL,
NULL,
NULL,
&IoStatusBlock,
&InputData,
sizeof(KEYBOARD_INPUT_DATA),
&Offset,
0);
if (Status == STATUS_PENDING)
{
Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL);
Status = IoStatusBlock.Status;
}
if (!NT_SUCCESS(Status))
return FALSE;
Offset.QuadPart = 0;
Status = NtReadFile(hConsoleInput,
NULL,
NULL,
NULL,
&IoStatusBlock,
&InputData,
sizeof(KEYBOARD_INPUT_DATA),
&Offset,
0);
if (Status == STATUS_PENDING)
{
Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL);
Status = IoStatusBlock.Status;
}
if (!NT_SUCCESS(Status))
return FALSE;
lpBuffer->EventType = KEY_EVENT;
Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent);
if (!NT_SUCCESS(Status))
return FALSE;
lpBuffer->EventType = KEY_EVENT;
Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent);
if (!NT_SUCCESS(Status))
return FALSE;
*lpNumberOfEventsRead = 1;
return TRUE;
*lpNumberOfEventsRead = 1;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
WriteConsoleOutputCharacterA(
HANDLE hConsoleOutput,
IN LPCSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten)
HANDLE hConsoleOutput,
IN LPCSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten)
{
IO_STATUS_BLOCK IoStatusBlock;
PCHAR Buffer;
COORD *pCoord;
PCHAR pText;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
PCHAR Buffer;
COORD *pCoord;
PCHAR pText;
NTSTATUS Status;
Buffer = (CHAR*) RtlAllocateHeap(
ProcessHeap,
0,
nLength + sizeof(COORD));
pCoord = (COORD *)Buffer;
pText = (PCHAR)(pCoord + 1);
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
0,
nLength + sizeof(COORD));
pCoord = (COORD *)Buffer;
pText = (PCHAR)(pCoord + 1);
*pCoord = dwWriteCoord;
memcpy(pText, lpCharacter, nLength);
*pCoord = dwWriteCoord;
memcpy(pText, lpCharacter, nLength);
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
NULL,
0,
Buffer,
nLength + sizeof(COORD));
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
NULL,
0,
Buffer,
nLength + sizeof(COORD));
RtlFreeHeap(
ProcessHeap,
0,
Buffer);
if (!NT_SUCCESS(Status))
return FALSE;
RtlFreeHeap(ProcessHeap, 0, Buffer);
if (!NT_SUCCESS(Status))
return FALSE;
*lpNumberOfCharsWritten = IoStatusBlock.Information;
return TRUE;
*lpNumberOfCharsWritten = IoStatusBlock.Information;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
WriteConsoleOutputCharacterW(
HANDLE hConsoleOutput,
IN LPCWSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten)
HANDLE hConsoleOutput,
IN LPCWSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten)
{
IO_STATUS_BLOCK IoStatusBlock;
PCHAR Buffer;
COORD *pCoord;
PCHAR pText;
NTSTATUS Status;
ULONG i;
IO_STATUS_BLOCK IoStatusBlock;
PCHAR Buffer;
COORD *pCoord;
PCHAR pText;
NTSTATUS Status;
ULONG i;
Buffer = (CHAR*) RtlAllocateHeap(
ProcessHeap,
0,
nLength + sizeof(COORD));
pCoord = (COORD *)Buffer;
pText = (PCHAR)(pCoord + 1);
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
0,
nLength + sizeof(COORD));
pCoord = (COORD *)Buffer;
pText = (PCHAR)(pCoord + 1);
*pCoord = dwWriteCoord;
*pCoord = dwWriteCoord;
/* FIXME: use real unicode->oem conversion */
for (i = 0; i < nLength; i++)
pText[i] = (CHAR)lpCharacter[i];
/* FIXME: use real unicode->oem conversion */
for (i = 0; i < nLength; i++)
pText[i] = (CHAR)lpCharacter[i];
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
NULL,
0,
Buffer,
nLength + sizeof(COORD));
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
NULL,
0,
Buffer,
nLength + sizeof(COORD));
RtlFreeHeap(
ProcessHeap,
0,
Buffer);
if (!NT_SUCCESS(Status))
return FALSE;
RtlFreeHeap(ProcessHeap, 0, Buffer);
if (!NT_SUCCESS(Status))
return FALSE;
*lpNumberOfCharsWritten = IoStatusBlock.Information;
return TRUE;
*lpNumberOfCharsWritten = IoStatusBlock.Information;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
FillConsoleOutputAttribute(
IN HANDLE hConsoleOutput,
IN WORD wAttribute,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfAttrsWritten)
IN HANDLE hConsoleOutput,
IN WORD wAttribute,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfAttrsWritten)
{
IO_STATUS_BLOCK IoStatusBlock;
OUTPUT_ATTRIBUTE Buffer;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
OUTPUT_ATTRIBUTE Buffer;
NTSTATUS Status;
Buffer.wAttribute = wAttribute;
Buffer.nLength = nLength;
Buffer.dwCoord = dwWriteCoord;
Buffer.wAttribute = wAttribute;
Buffer.nLength = nLength;
Buffer.dwCoord = dwWriteCoord;
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE,
&Buffer,
sizeof(OUTPUT_ATTRIBUTE),
&Buffer,
sizeof(OUTPUT_ATTRIBUTE));
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE,
&Buffer,
sizeof(OUTPUT_ATTRIBUTE),
&Buffer,
sizeof(OUTPUT_ATTRIBUTE));
if (!NT_SUCCESS(Status))
return FALSE;
if (!NT_SUCCESS(Status))
return FALSE;
*lpNumberOfAttrsWritten = Buffer.dwTransfered;
return TRUE;
*lpNumberOfAttrsWritten = Buffer.dwTransfered;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
FillConsoleOutputCharacterA(
IN HANDLE hConsoleOutput,
IN CHAR cCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten)
IN HANDLE hConsoleOutput,
IN CHAR cCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten)
{
IO_STATUS_BLOCK IoStatusBlock;
OUTPUT_CHARACTER Buffer;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
OUTPUT_CHARACTER Buffer;
NTSTATUS Status;
Buffer.cCharacter = cCharacter;
Buffer.nLength = nLength;
Buffer.dwCoord = dwWriteCoord;
Buffer.cCharacter = cCharacter;
Buffer.nLength = nLength;
Buffer.dwCoord = dwWriteCoord;
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER,
&Buffer,
sizeof(OUTPUT_CHARACTER),
&Buffer,
sizeof(OUTPUT_CHARACTER));
if (!NT_SUCCESS(Status))
return FALSE;
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER,
&Buffer,
sizeof(OUTPUT_CHARACTER),
&Buffer,
sizeof(OUTPUT_CHARACTER));
if (!NT_SUCCESS(Status))
return FALSE;
*lpNumberOfCharsWritten = Buffer.dwTransfered;
return TRUE;
*lpNumberOfCharsWritten = Buffer.dwTransfered;
return TRUE;
}
BOOL WINAPI
BOOL
WINAPI
GetConsoleScreenBufferInfo(
IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
{
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO,
NULL,
0,
lpConsoleScreenBufferInfo,
sizeof(CONSOLE_SCREEN_BUFFER_INFO));
return NT_SUCCESS(Status);
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO,
NULL,
0,
lpConsoleScreenBufferInfo,
sizeof(CONSOLE_SCREEN_BUFFER_INFO));
return NT_SUCCESS(Status);
}
BOOL WINAPI
BOOL
WINAPI
SetConsoleCursorInfo(
IN HANDLE hConsoleOutput,
IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo)
IN HANDLE hConsoleOutput,
IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo)
{
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_SET_CURSOR_INFO,
(PCONSOLE_CURSOR_INFO)lpConsoleCursorInfo,
sizeof(CONSOLE_CURSOR_INFO),
NULL,
0);
return NT_SUCCESS(Status);
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_SET_CURSOR_INFO,
(PCONSOLE_CURSOR_INFO)lpConsoleCursorInfo,
sizeof(CONSOLE_CURSOR_INFO),
NULL,
0);
return NT_SUCCESS(Status);
}
BOOL WINAPI
BOOL
WINAPI
SetConsoleCursorPosition(
IN HANDLE hConsoleOutput,
IN COORD dwCursorPosition)
IN HANDLE hConsoleOutput,
IN COORD dwCursorPosition)
{
CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo);
if (!NT_SUCCESS(Status))
return FALSE;
Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo);
if (!NT_SUCCESS(Status))
return FALSE;
ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X;
ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y;
ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X;
ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y;
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO,
&ConsoleScreenBufferInfo,
sizeof(CONSOLE_SCREEN_BUFFER_INFO),
NULL,
0);
return NT_SUCCESS(Status);
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO,
&ConsoleScreenBufferInfo,
sizeof(CONSOLE_SCREEN_BUFFER_INFO),
NULL,
0);
return NT_SUCCESS(Status);
}
BOOL WINAPI
BOOL
WINAPI
SetConsoleTextAttribute(
IN HANDLE hConsoleOutput,
IN WORD wAttributes)
IN HANDLE hConsoleOutput,
IN WORD wAttributes)
{
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE,
&wAttributes,
sizeof(USHORT),
NULL,
0);
return NT_SUCCESS(Status);
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE,
&wAttributes,
sizeof(USHORT),
NULL,
0);
return NT_SUCCESS(Status);
}
BOOL WINAPI
BOOL
WINAPI
SetConsoleOutputCP(
IN UINT wCodepage)
IN UINT wCodepage)
{
HANDLE hConsoleOutput;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
HANDLE hConsoleOutput;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
Status = NtDeviceIoControlFile(
hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_LOADFONT,
&wCodepage,
sizeof(ULONG),
NULL,
0);
return NT_SUCCESS(Status);
Status = NtDeviceIoControlFile(hConsoleOutput,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_CONSOLE_LOADFONT,
&wCodepage,
sizeof(ULONG),
NULL,
0);
return NT_SUCCESS(Status);
}

View file

@ -26,90 +26,105 @@
#pragma once
BOOL WINAPI
BOOL
WINAPI
AllocConsole(VOID);
BOOL WINAPI
BOOL
WINAPI
AttachConsole(
IN DWORD dwProcessId);
IN DWORD dwProcessId);
BOOL WINAPI
BOOL
WINAPI
FillConsoleOutputAttribute(
IN HANDLE hConsoleOutput,
IN WORD wAttribute,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfAttrsWritten);
IN HANDLE hConsoleOutput,
IN WORD wAttribute,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfAttrsWritten);
BOOL WINAPI
BOOL
WINAPI
FillConsoleOutputCharacterA(
IN HANDLE hConsoleOutput,
IN CHAR cCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
IN HANDLE hConsoleOutput,
IN CHAR cCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
BOOL WINAPI
BOOL
WINAPI
FreeConsole(VOID);
BOOL WINAPI
BOOL
WINAPI
GetConsoleScreenBufferInfo(
IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
HANDLE WINAPI
HANDLE
WINAPI
GetStdHandle(
IN DWORD nStdHandle);
IN DWORD nStdHandle);
BOOL WINAPI
BOOL
WINAPI
ReadConsoleInput(
IN HANDLE hConsoleInput,
OUT PINPUT_RECORD lpBuffer,
IN DWORD nLength,
OUT LPDWORD lpNumberOfEventsRead);
IN HANDLE hConsoleInput,
OUT PINPUT_RECORD lpBuffer,
IN DWORD nLength,
OUT LPDWORD lpNumberOfEventsRead);
BOOL WINAPI
BOOL
WINAPI
SetConsoleCursorInfo(
IN HANDLE hConsoleOutput,
IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo);
IN HANDLE hConsoleOutput,
IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo);
BOOL WINAPI
BOOL
WINAPI
SetConsoleCursorPosition(
IN HANDLE hConsoleOutput,
IN COORD dwCursorPosition);
IN HANDLE hConsoleOutput,
IN COORD dwCursorPosition);
BOOL WINAPI
BOOL
WINAPI
SetConsoleTextAttribute(
IN HANDLE hConsoleOutput,
IN WORD wAttributes);
IN HANDLE hConsoleOutput,
IN WORD wAttributes);
BOOL WINAPI
BOOL
WINAPI
WriteConsole(
IN HANDLE hConsoleOutput,
IN const VOID* lpBuffer,
IN DWORD nNumberOfCharsToWrite,
OUT LPDWORD lpNumberOfCharsWritten,
IN LPVOID lpReserved);
IN HANDLE hConsoleOutput,
IN const VOID *lpBuffer,
IN DWORD nNumberOfCharsToWrite,
OUT LPDWORD lpNumberOfCharsWritten,
IN LPVOID lpReserved);
BOOL WINAPI
BOOL
WINAPI
WriteConsoleOutputCharacterA(
HANDLE hConsoleOutput,
IN LPCSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
HANDLE hConsoleOutput,
IN LPCSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
BOOL WINAPI
BOOL
WINAPI
WriteConsoleOutputCharacterW(
HANDLE hConsoleOutput,
IN LPCSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
HANDLE hConsoleOutput,
IN LPCSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
BOOL WINAPI
BOOL
WINAPI
SetConsoleOutputCP(
IN UINT wCodePageID
IN UINT wCodePageID
);
/* EOF */