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

View file

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

View file

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