NTSTATUS
+WriteConsoleOutputCharactersW(LPCWSTR lpCharacter,
+ ULONG nLength,
+ COORD dwWriteCoord)
+{
+ IO_STATUS_BLOCK IoStatusBlock;
+ PCHAR Buffer;
+ COORD *pCoord;
+ PCHAR pText;
+ NTSTATUS Status;
+ ULONG i;
+
+ Buffer = RtlAllocateHeap(ProcessHeap,
+ 0,
+ nLength + sizeof(COORD));
+ pCoord = (COORD *)Buffer;
+ pText = (PCHAR)(pCoord + 1);
+
+ *pCoord = dwWriteCoord;
+
+ /* FIXME: use real unicode->oem conversion */
+ for (i = 0; i < nLength; i++)
+ pText[i] = (CHAR)lpCharacter[i];
+ pText[i] = 0;
+
+ Status = NtDeviceIoControlFile(StdOutput,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER,
+ NULL,
+ 0,
+ Buffer,
+ nLength + sizeof(COORD));
+ if (Status == STATUS_PENDING)
+ {
+ NtWaitForSingleObject(StdOutput,
+ FALSE,
+ NULL);
+ Status = IoStatusBlock.Status;
+ }
+
+ RtlFreeHeap(ProcessHeap,
+ 0,
+ Buffer);
+
+ return(Status);
+}
+
+
+NTSTATUS
WriteConsoleOutputAttributes(CONST USHORT *lpAttribute,
ULONG nLength,
COORD dwWriteCoord,
VOID
-SetInputTextXY(SHORT x, SHORT y, SHORT len, PCHAR Text)
+SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text)
{
COORD coPos;
ULONG Length;
coPos.X = x;
coPos.Y = y;
- Length = strlen(Text);
+ Length = wcslen(Text);
+ if (Length > len - 1)
+ {
+ Length = len - 1;
+ }
FillConsoleOutputAttribute(0x70,
len,
coPos,
&Written);
- WriteConsoleOutputCharacters(Text,
- Length,
- coPos);
+ WriteConsoleOutputCharactersW(Text,
+ Length,
+ coPos);
coPos.X += Length;
FillConsoleOutputCharacter('_',
VOID
-PrintTextXY(SHORT x, SHORT y, char* fmt,...)
+PrintTextXY(SHORT x, SHORT y, char* fmt, ...)
{
char buffer[512];
va_list ap;
coPos);
}
+
+VOID
+PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...)
+{
+ char buffer[512];
+ va_list ap;
+ COORD coPos;
+ ULONG Length;
+ ULONG Written;
+
+ va_start(ap, fmt);
+ vsprintf(buffer, fmt, ap);
+ va_end(ap);
+
+ coPos.X = x;
+ coPos.Y = y;
+
+ Length = strlen(buffer);
+ if (Length > len - 1)
+ {
+ Length = len - 1;
+ }
+
+ WriteConsoleOutputCharacters(buffer,
+ Length,
+ coPos);
+
+ coPos.X += Length;
+
+ if (len > Length)
+ {
+ FillConsoleOutputCharacter(' ',
+ len - Length,
+ coPos,
+ &Written);
+ }
+}
+
+
/* EOF */