reactos/reactos/apps/utils/shell/shell.c
David Welch 4bc75819a3 Corrected a number of bugs, including the keyboard one
svn path=/trunk/; revision=115
1998-12-08 16:51:47 +00:00

53 lines
907 B
C

#include <internal/mmhal.h>
#include <ddk/ntddk.h>
#include <stdarg.h>
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
OutputDebugStringA(buffer);
va_end(args);
}
void main()
{
KEY_EVENT_RECORD KeyEvent[2];
HANDLE FileHandle;
DWORD Result;
HANDLE DefaultHeap;
PVOID Buffer;
NtDisplayString("Simple Shell Starting...\n");
// DefaultHeap = HeapCreate(0,1024*1024,1024*1024);
// Buffer = HeapAlloc(DefaultHeap,0,1024);
FileHandle = CreateFile("\\Device\\Keyboard",
FILE_GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
debug_printf("C:\\");
for(;;)
{
ReadFile(FileHandle,
&KeyEvent,
sizeof(KEY_EVENT_RECORD),
&Result,
NULL);
if (KeyEvent[0].bKeyDown)
{
debug_printf("%c",KeyEvent[0].AsciiChar);
}
}
}