mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[FORMATTING]
Fix indentation and coding style. No code changes! svn path=/trunk/; revision=63305
This commit is contained in:
parent
8afc11c2e4
commit
ac2f92611e
5 changed files with 872 additions and 854 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,7 @@
|
||||||
#include <usetup.h>
|
#include <usetup.h>
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NATIVE_InitConsole(
|
NATIVE_InitConsole(VOID)
|
||||||
VOID)
|
|
||||||
{
|
{
|
||||||
return (BOOLEAN)AllocConsole();
|
return (BOOLEAN)AllocConsole();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,30 +2,29 @@
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NATIVE_CreateFileSystemList(
|
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
|
#if 0
|
||||||
FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk);
|
FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk);
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NATIVE_FormatPartition(
|
NATIVE_FormatPartition(
|
||||||
IN PFILE_SYSTEM_ITEM FileSystem,
|
IN PFILE_SYSTEM_ITEM FileSystem,
|
||||||
IN PCUNICODE_STRING DriveRoot,
|
IN PCUNICODE_STRING DriveRoot,
|
||||||
IN PFMIFSCALLBACK Callback)
|
IN PFMIFSCALLBACK Callback)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = FileSystem->FormatFunc(
|
Status = FileSystem->FormatFunc((PUNICODE_STRING)DriveRoot,
|
||||||
(PUNICODE_STRING)DriveRoot,
|
FMIFS_HARDDISK, /* MediaFlag */
|
||||||
FMIFS_HARDDISK, /* MediaFlag */
|
NULL, /* Label */
|
||||||
NULL, /* Label */
|
FileSystem->QuickFormat, /* QuickFormat */
|
||||||
FileSystem->QuickFormat, /* QuickFormat */
|
0, /* ClusterSize */
|
||||||
0, /* ClusterSize */
|
Callback); /* Callback */
|
||||||
Callback); /* Callback */
|
return NT_SUCCESS(Status);
|
||||||
|
|
||||||
return NT_SUCCESS(Status);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,476 +36,481 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
AllocConsole(VOID)
|
AllocConsole(VOID)
|
||||||
{
|
{
|
||||||
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
|
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
|
||||||
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
|
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Open the screen */
|
/* Open the screen */
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ObjectAttributes,
|
&ScreenName,
|
||||||
&ScreenName,
|
0,
|
||||||
0,
|
NULL,
|
||||||
NULL,
|
NULL);
|
||||||
NULL);
|
Status = NtOpenFile(&StdOutput,
|
||||||
Status = NtOpenFile(
|
FILE_ALL_ACCESS,
|
||||||
&StdOutput,
|
&ObjectAttributes,
|
||||||
FILE_ALL_ACCESS,
|
&IoStatusBlock,
|
||||||
&ObjectAttributes,
|
FILE_OPEN,
|
||||||
&IoStatusBlock,
|
FILE_SYNCHRONOUS_IO_ALERT);
|
||||||
FILE_OPEN,
|
if (!NT_SUCCESS(Status))
|
||||||
FILE_SYNCHRONOUS_IO_ALERT);
|
return FALSE;
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Open the keyboard */
|
/* Open the keyboard */
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ObjectAttributes,
|
&KeyboardName,
|
||||||
&KeyboardName,
|
0,
|
||||||
0,
|
NULL,
|
||||||
NULL,
|
NULL);
|
||||||
NULL);
|
Status = NtOpenFile(&StdInput,
|
||||||
Status = NtOpenFile(
|
FILE_ALL_ACCESS,
|
||||||
&StdInput,
|
&ObjectAttributes,
|
||||||
FILE_ALL_ACCESS,
|
&IoStatusBlock,
|
||||||
&ObjectAttributes,
|
FILE_OPEN,
|
||||||
&IoStatusBlock,
|
0);
|
||||||
FILE_OPEN,
|
if (!NT_SUCCESS(Status))
|
||||||
0);
|
return FALSE;
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
AttachConsole(
|
AttachConsole(
|
||||||
IN DWORD dwProcessId)
|
IN DWORD dwProcessId)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
FreeConsole(VOID)
|
FreeConsole(VOID)
|
||||||
{
|
{
|
||||||
if (StdInput != INVALID_HANDLE_VALUE)
|
if (StdInput != INVALID_HANDLE_VALUE)
|
||||||
NtClose(StdInput);
|
NtClose(StdInput);
|
||||||
|
|
||||||
if (StdOutput != INVALID_HANDLE_VALUE)
|
if (StdOutput != INVALID_HANDLE_VALUE)
|
||||||
NtClose(StdOutput);
|
NtClose(StdOutput);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
WriteConsole(
|
WriteConsole(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN const VOID* lpBuffer,
|
IN const VOID *lpBuffer,
|
||||||
IN DWORD nNumberOfCharsToWrite,
|
IN DWORD nNumberOfCharsToWrite,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten,
|
OUT LPDWORD lpNumberOfCharsWritten,
|
||||||
IN LPVOID lpReserved)
|
IN LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = NtWriteFile(
|
Status = NtWriteFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
(PVOID)lpBuffer,
|
||||||
(PVOID)lpBuffer,
|
nNumberOfCharsToWrite,
|
||||||
nNumberOfCharsToWrite,
|
NULL,
|
||||||
NULL,
|
NULL);
|
||||||
NULL);
|
if (!NT_SUCCESS(Status))
|
||||||
if (!NT_SUCCESS(Status))
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
*lpNumberOfCharsWritten = IoStatusBlock.Information;
|
*lpNumberOfCharsWritten = IoStatusBlock.Information;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE WINAPI
|
|
||||||
|
HANDLE
|
||||||
|
WINAPI
|
||||||
GetStdHandle(
|
GetStdHandle(
|
||||||
IN DWORD nStdHandle)
|
IN DWORD nStdHandle)
|
||||||
{
|
{
|
||||||
switch (nStdHandle)
|
switch (nStdHandle)
|
||||||
{
|
{
|
||||||
case STD_INPUT_HANDLE:
|
case STD_INPUT_HANDLE:
|
||||||
return StdInput;
|
return StdInput;
|
||||||
case STD_OUTPUT_HANDLE:
|
case STD_OUTPUT_HANDLE:
|
||||||
return StdOutput;
|
return StdOutput;
|
||||||
default:
|
default:
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
FlushConsoleInputBuffer(
|
FlushConsoleInputBuffer(
|
||||||
IN HANDLE hConsoleInput)
|
IN HANDLE hConsoleInput)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER Offset, Timeout;
|
LARGE_INTEGER Offset, Timeout;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
KEYBOARD_INPUT_DATA InputData;
|
KEYBOARD_INPUT_DATA InputData;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Offset.QuadPart = 0;
|
Offset.QuadPart = 0;
|
||||||
Status = NtReadFile(
|
Status = NtReadFile(hConsoleInput,
|
||||||
hConsoleInput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
&InputData,
|
||||||
&InputData,
|
sizeof(KEYBOARD_INPUT_DATA),
|
||||||
sizeof(KEYBOARD_INPUT_DATA),
|
&Offset,
|
||||||
&Offset,
|
0);
|
||||||
0);
|
if (Status == STATUS_PENDING)
|
||||||
if (Status == STATUS_PENDING)
|
{
|
||||||
{
|
Timeout.QuadPart = -100;
|
||||||
Timeout.QuadPart = -100;
|
Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout);
|
||||||
Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout);
|
if (Status == STATUS_TIMEOUT)
|
||||||
if (Status == STATUS_TIMEOUT)
|
{
|
||||||
{
|
NtCancelIoFile(hConsoleInput, &IoStatusBlock);
|
||||||
NtCancelIoFile(hConsoleInput, &IoStatusBlock);
|
return TRUE;
|
||||||
return TRUE;
|
}
|
||||||
}
|
}
|
||||||
}
|
} while (NT_SUCCESS(Status));
|
||||||
} while (NT_SUCCESS(Status));
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
ReadConsoleInput(
|
ReadConsoleInput(
|
||||||
IN HANDLE hConsoleInput,
|
IN HANDLE hConsoleInput,
|
||||||
OUT PINPUT_RECORD lpBuffer,
|
OUT PINPUT_RECORD lpBuffer,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
OUT LPDWORD lpNumberOfEventsRead)
|
OUT LPDWORD lpNumberOfEventsRead)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
KEYBOARD_INPUT_DATA InputData;
|
KEYBOARD_INPUT_DATA InputData;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Offset.QuadPart = 0;
|
Offset.QuadPart = 0;
|
||||||
Status = NtReadFile(
|
Status = NtReadFile(hConsoleInput,
|
||||||
hConsoleInput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
&InputData,
|
||||||
&InputData,
|
sizeof(KEYBOARD_INPUT_DATA),
|
||||||
sizeof(KEYBOARD_INPUT_DATA),
|
&Offset,
|
||||||
&Offset,
|
0);
|
||||||
0);
|
if (Status == STATUS_PENDING)
|
||||||
if (Status == STATUS_PENDING)
|
{
|
||||||
{
|
Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL);
|
||||||
Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL);
|
Status = IoStatusBlock.Status;
|
||||||
Status = IoStatusBlock.Status;
|
}
|
||||||
}
|
if (!NT_SUCCESS(Status))
|
||||||
if (!NT_SUCCESS(Status))
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
lpBuffer->EventType = KEY_EVENT;
|
lpBuffer->EventType = KEY_EVENT;
|
||||||
Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent);
|
Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*lpNumberOfEventsRead = 1;
|
*lpNumberOfEventsRead = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
WriteConsoleOutputCharacterA(
|
WriteConsoleOutputCharacterA(
|
||||||
HANDLE hConsoleOutput,
|
HANDLE hConsoleOutput,
|
||||||
IN LPCSTR lpCharacter,
|
IN LPCSTR lpCharacter,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten)
|
OUT LPDWORD lpNumberOfCharsWritten)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
PCHAR Buffer;
|
PCHAR Buffer;
|
||||||
COORD *pCoord;
|
COORD *pCoord;
|
||||||
PCHAR pText;
|
PCHAR pText;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Buffer = (CHAR*) RtlAllocateHeap(
|
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
ProcessHeap,
|
0,
|
||||||
0,
|
nLength + sizeof(COORD));
|
||||||
nLength + sizeof(COORD));
|
pCoord = (COORD *)Buffer;
|
||||||
pCoord = (COORD *)Buffer;
|
pText = (PCHAR)(pCoord + 1);
|
||||||
pText = (PCHAR)(pCoord + 1);
|
|
||||||
|
|
||||||
*pCoord = dwWriteCoord;
|
*pCoord = dwWriteCoord;
|
||||||
memcpy(pText, lpCharacter, nLength);
|
memcpy(pText, lpCharacter, nLength);
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
|
||||||
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
|
NULL,
|
||||||
NULL,
|
0,
|
||||||
0,
|
Buffer,
|
||||||
Buffer,
|
nLength + sizeof(COORD));
|
||||||
nLength + sizeof(COORD));
|
|
||||||
|
|
||||||
RtlFreeHeap(
|
RtlFreeHeap(ProcessHeap, 0, Buffer);
|
||||||
ProcessHeap,
|
if (!NT_SUCCESS(Status))
|
||||||
0,
|
return FALSE;
|
||||||
Buffer);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
*lpNumberOfCharsWritten = IoStatusBlock.Information;
|
*lpNumberOfCharsWritten = IoStatusBlock.Information;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
WriteConsoleOutputCharacterW(
|
WriteConsoleOutputCharacterW(
|
||||||
HANDLE hConsoleOutput,
|
HANDLE hConsoleOutput,
|
||||||
IN LPCWSTR lpCharacter,
|
IN LPCWSTR lpCharacter,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten)
|
OUT LPDWORD lpNumberOfCharsWritten)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
PCHAR Buffer;
|
PCHAR Buffer;
|
||||||
COORD *pCoord;
|
COORD *pCoord;
|
||||||
PCHAR pText;
|
PCHAR pText;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
Buffer = (CHAR*) RtlAllocateHeap(
|
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
ProcessHeap,
|
0,
|
||||||
0,
|
nLength + sizeof(COORD));
|
||||||
nLength + sizeof(COORD));
|
pCoord = (COORD *)Buffer;
|
||||||
pCoord = (COORD *)Buffer;
|
pText = (PCHAR)(pCoord + 1);
|
||||||
pText = (PCHAR)(pCoord + 1);
|
|
||||||
|
|
||||||
*pCoord = dwWriteCoord;
|
*pCoord = dwWriteCoord;
|
||||||
|
|
||||||
/* FIXME: use real unicode->oem conversion */
|
/* FIXME: use real unicode->oem conversion */
|
||||||
for (i = 0; i < nLength; i++)
|
for (i = 0; i < nLength; i++)
|
||||||
pText[i] = (CHAR)lpCharacter[i];
|
pText[i] = (CHAR)lpCharacter[i];
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
|
||||||
IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
|
NULL,
|
||||||
NULL,
|
0,
|
||||||
0,
|
Buffer,
|
||||||
Buffer,
|
nLength + sizeof(COORD));
|
||||||
nLength + sizeof(COORD));
|
|
||||||
|
|
||||||
RtlFreeHeap(
|
RtlFreeHeap(ProcessHeap, 0, Buffer);
|
||||||
ProcessHeap,
|
if (!NT_SUCCESS(Status))
|
||||||
0,
|
return FALSE;
|
||||||
Buffer);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
*lpNumberOfCharsWritten = IoStatusBlock.Information;
|
*lpNumberOfCharsWritten = IoStatusBlock.Information;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
FillConsoleOutputAttribute(
|
FillConsoleOutputAttribute(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN WORD wAttribute,
|
IN WORD wAttribute,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfAttrsWritten)
|
OUT LPDWORD lpNumberOfAttrsWritten)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
OUTPUT_ATTRIBUTE Buffer;
|
OUTPUT_ATTRIBUTE Buffer;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Buffer.wAttribute = wAttribute;
|
Buffer.wAttribute = wAttribute;
|
||||||
Buffer.nLength = nLength;
|
Buffer.nLength = nLength;
|
||||||
Buffer.dwCoord = dwWriteCoord;
|
Buffer.dwCoord = dwWriteCoord;
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE,
|
||||||
IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE,
|
&Buffer,
|
||||||
&Buffer,
|
sizeof(OUTPUT_ATTRIBUTE),
|
||||||
sizeof(OUTPUT_ATTRIBUTE),
|
&Buffer,
|
||||||
&Buffer,
|
sizeof(OUTPUT_ATTRIBUTE));
|
||||||
sizeof(OUTPUT_ATTRIBUTE));
|
if (!NT_SUCCESS(Status))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
*lpNumberOfAttrsWritten = Buffer.dwTransfered;
|
||||||
return FALSE;
|
return TRUE;
|
||||||
|
|
||||||
*lpNumberOfAttrsWritten = Buffer.dwTransfered;
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
FillConsoleOutputCharacterA(
|
FillConsoleOutputCharacterA(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN CHAR cCharacter,
|
IN CHAR cCharacter,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten)
|
OUT LPDWORD lpNumberOfCharsWritten)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
OUTPUT_CHARACTER Buffer;
|
OUTPUT_CHARACTER Buffer;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Buffer.cCharacter = cCharacter;
|
Buffer.cCharacter = cCharacter;
|
||||||
Buffer.nLength = nLength;
|
Buffer.nLength = nLength;
|
||||||
Buffer.dwCoord = dwWriteCoord;
|
Buffer.dwCoord = dwWriteCoord;
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER,
|
||||||
IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER,
|
&Buffer,
|
||||||
&Buffer,
|
sizeof(OUTPUT_CHARACTER),
|
||||||
sizeof(OUTPUT_CHARACTER),
|
&Buffer,
|
||||||
&Buffer,
|
sizeof(OUTPUT_CHARACTER));
|
||||||
sizeof(OUTPUT_CHARACTER));
|
if (!NT_SUCCESS(Status))
|
||||||
if (!NT_SUCCESS(Status))
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
*lpNumberOfCharsWritten = Buffer.dwTransfered;
|
*lpNumberOfCharsWritten = Buffer.dwTransfered;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
GetConsoleScreenBufferInfo(
|
GetConsoleScreenBufferInfo(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
|
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO,
|
||||||
IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO,
|
NULL,
|
||||||
NULL,
|
0,
|
||||||
0,
|
lpConsoleScreenBufferInfo,
|
||||||
lpConsoleScreenBufferInfo,
|
sizeof(CONSOLE_SCREEN_BUFFER_INFO));
|
||||||
sizeof(CONSOLE_SCREEN_BUFFER_INFO));
|
return NT_SUCCESS(Status);
|
||||||
return NT_SUCCESS(Status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleCursorInfo(
|
SetConsoleCursorInfo(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo)
|
IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_SET_CURSOR_INFO,
|
||||||
IOCTL_CONSOLE_SET_CURSOR_INFO,
|
(PCONSOLE_CURSOR_INFO)lpConsoleCursorInfo,
|
||||||
(PCONSOLE_CURSOR_INFO)lpConsoleCursorInfo,
|
sizeof(CONSOLE_CURSOR_INFO),
|
||||||
sizeof(CONSOLE_CURSOR_INFO),
|
NULL,
|
||||||
NULL,
|
0);
|
||||||
0);
|
return NT_SUCCESS(Status);
|
||||||
return NT_SUCCESS(Status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleCursorPosition(
|
SetConsoleCursorPosition(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN COORD dwCursorPosition)
|
IN COORD dwCursorPosition)
|
||||||
{
|
{
|
||||||
CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;
|
CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo);
|
Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X;
|
ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X;
|
||||||
ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y;
|
ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y;
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO,
|
||||||
IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO,
|
&ConsoleScreenBufferInfo,
|
||||||
&ConsoleScreenBufferInfo,
|
sizeof(CONSOLE_SCREEN_BUFFER_INFO),
|
||||||
sizeof(CONSOLE_SCREEN_BUFFER_INFO),
|
NULL,
|
||||||
NULL,
|
0);
|
||||||
0);
|
return NT_SUCCESS(Status);
|
||||||
|
|
||||||
return NT_SUCCESS(Status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleTextAttribute(
|
SetConsoleTextAttribute(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN WORD wAttributes)
|
IN WORD wAttributes)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE,
|
||||||
IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE,
|
&wAttributes,
|
||||||
&wAttributes,
|
sizeof(USHORT),
|
||||||
sizeof(USHORT),
|
NULL,
|
||||||
NULL,
|
0);
|
||||||
0);
|
return NT_SUCCESS(Status);
|
||||||
return NT_SUCCESS(Status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleOutputCP(
|
SetConsoleOutputCP(
|
||||||
IN UINT wCodepage)
|
IN UINT wCodepage)
|
||||||
{
|
{
|
||||||
HANDLE hConsoleOutput;
|
HANDLE hConsoleOutput;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
Status = NtDeviceIoControlFile(
|
Status = NtDeviceIoControlFile(hConsoleOutput,
|
||||||
hConsoleOutput,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&IoStatusBlock,
|
||||||
&IoStatusBlock,
|
IOCTL_CONSOLE_LOADFONT,
|
||||||
IOCTL_CONSOLE_LOADFONT,
|
&wCodepage,
|
||||||
&wCodepage,
|
sizeof(ULONG),
|
||||||
sizeof(ULONG),
|
NULL,
|
||||||
NULL,
|
0);
|
||||||
0);
|
return NT_SUCCESS(Status);
|
||||||
return NT_SUCCESS(Status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,90 +26,105 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
AllocConsole(VOID);
|
AllocConsole(VOID);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
AttachConsole(
|
AttachConsole(
|
||||||
IN DWORD dwProcessId);
|
IN DWORD dwProcessId);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
FillConsoleOutputAttribute(
|
FillConsoleOutputAttribute(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN WORD wAttribute,
|
IN WORD wAttribute,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfAttrsWritten);
|
OUT LPDWORD lpNumberOfAttrsWritten);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
FillConsoleOutputCharacterA(
|
FillConsoleOutputCharacterA(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN CHAR cCharacter,
|
IN CHAR cCharacter,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten);
|
OUT LPDWORD lpNumberOfCharsWritten);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
FreeConsole(VOID);
|
FreeConsole(VOID);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
GetConsoleScreenBufferInfo(
|
GetConsoleScreenBufferInfo(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
|
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
|
||||||
|
|
||||||
HANDLE WINAPI
|
HANDLE
|
||||||
|
WINAPI
|
||||||
GetStdHandle(
|
GetStdHandle(
|
||||||
IN DWORD nStdHandle);
|
IN DWORD nStdHandle);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
ReadConsoleInput(
|
ReadConsoleInput(
|
||||||
IN HANDLE hConsoleInput,
|
IN HANDLE hConsoleInput,
|
||||||
OUT PINPUT_RECORD lpBuffer,
|
OUT PINPUT_RECORD lpBuffer,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
OUT LPDWORD lpNumberOfEventsRead);
|
OUT LPDWORD lpNumberOfEventsRead);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleCursorInfo(
|
SetConsoleCursorInfo(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo);
|
IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleCursorPosition(
|
SetConsoleCursorPosition(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN COORD dwCursorPosition);
|
IN COORD dwCursorPosition);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleTextAttribute(
|
SetConsoleTextAttribute(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN WORD wAttributes);
|
IN WORD wAttributes);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
WriteConsole(
|
WriteConsole(
|
||||||
IN HANDLE hConsoleOutput,
|
IN HANDLE hConsoleOutput,
|
||||||
IN const VOID* lpBuffer,
|
IN const VOID *lpBuffer,
|
||||||
IN DWORD nNumberOfCharsToWrite,
|
IN DWORD nNumberOfCharsToWrite,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten,
|
OUT LPDWORD lpNumberOfCharsWritten,
|
||||||
IN LPVOID lpReserved);
|
IN LPVOID lpReserved);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
WriteConsoleOutputCharacterA(
|
WriteConsoleOutputCharacterA(
|
||||||
HANDLE hConsoleOutput,
|
HANDLE hConsoleOutput,
|
||||||
IN LPCSTR lpCharacter,
|
IN LPCSTR lpCharacter,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten);
|
OUT LPDWORD lpNumberOfCharsWritten);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
WriteConsoleOutputCharacterW(
|
WriteConsoleOutputCharacterW(
|
||||||
HANDLE hConsoleOutput,
|
HANDLE hConsoleOutput,
|
||||||
IN LPCSTR lpCharacter,
|
IN LPCSTR lpCharacter,
|
||||||
IN DWORD nLength,
|
IN DWORD nLength,
|
||||||
IN COORD dwWriteCoord,
|
IN COORD dwWriteCoord,
|
||||||
OUT LPDWORD lpNumberOfCharsWritten);
|
OUT LPDWORD lpNumberOfCharsWritten);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
SetConsoleOutputCP(
|
SetConsoleOutputCP(
|
||||||
IN UINT wCodePageID
|
IN UINT wCodePageID
|
||||||
);
|
);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue