Fixed a bug introduced by a change in ZwAllocateVirtualMemory call

svn path=/trunk/; revision=112
This commit is contained in:
Rex Jolliff 1998-12-06 00:04:04 +00:00
parent 4bc8aa3713
commit bc06faa8cd
3 changed files with 10 additions and 11 deletions

View file

@ -15,9 +15,6 @@ void debug_printf(char* fmt, ...)
va_end(args);
}
#define VIDMEM_BASE 0xb8000
static char* vidmem = (char *)(VIDMEM_BASE + IDMAP_BASE);
void main()
{
KEY_EVENT_RECORD KeyEvent[2];
@ -26,13 +23,11 @@ void main()
HANDLE DefaultHeap;
PVOID Buffer;
vidmem[(80 * 50 - 1) * 2] = '0';
NtDisplayString("Simple Shell Starting...\n");
// DefaultHeap = HeapCreate(0,1024*1024,1024*1024);
// Buffer = HeapAlloc(DefaultHeap,0,1024);
vidmem[(80 * 50 - 1) * 2] = '1';
FileHandle = CreateFile("\\Device\\Keyboard",
FILE_GENERIC_READ,
0,
@ -41,8 +36,9 @@ void main()
0,
NULL);
vidmem[(80 * 50 - 1) * 2] = '2';
NtDisplayString("#1\n");
debug_printf("C:\\");
NtDisplayString("#2\n");
for(;;)
{
ReadFile(FileHandle,
@ -50,6 +46,8 @@ void main()
sizeof(KeyEvent),
&Result,
NULL);
NtDisplayString("#3\n");
debug_printf("%c",KeyEvent[0].AsciiChar);
NtDisplayString("#4\n");
}
}

View file

@ -312,7 +312,7 @@ ZwAllocateVirtualMemory(
DbgPrint("ZwAllocateVirtualMemory(ProcessHandle %x, *BaseAddress %x, "
"ZeroBits %d, RegionSize %d, AllocationType %x, Protect %x)\n",
ProcessHandle,*BaseAddress,ZeroBits,RegionSize,AllocationType,
ProcessHandle,*BaseAddress,ZeroBits,*RegionSize,AllocationType,
Protect);
Status = ObReferenceObjectByHandle(ProcessHandle,

View file

@ -97,7 +97,7 @@ VOID ExExecuteShell(VOID)
ANSI_STRING afilename;
UNICODE_STRING ufilename;
LARGE_INTEGER SectionOffset;
ULONG Size;
ULONG Size, StackSize;
CONTEXT Context;
ZwCreateProcess(&ShellHandle,
@ -130,12 +130,12 @@ VOID ExExecuteShell(VOID)
BaseAddress = (PVOID)0x10000;
SectionOffset.HighPart = 0;
SectionOffset.LowPart = 0;
Size = 0x6000;
Size = 0x8000;
ZwMapViewOfSection(SectionHandle,
ShellHandle,
&BaseAddress,
0,
0x6000,
0x8000,
&SectionOffset,
&Size,
0,
@ -155,10 +155,11 @@ VOID ExExecuteShell(VOID)
Context.SegGs = USER_DS;
BaseAddress = 0x1000;
StackSize = 0x1000;
ZwAllocateVirtualMemory(ShellHandle,
&BaseAddress,
0,
PAGESIZE,
&StackSize,
MEM_COMMIT,
PAGE_READWRITE);