From 4bc75819a375d789f2fc1944cdd8c4e64d56db34 Mon Sep 17 00:00:00 2001 From: David Welch Date: Tue, 8 Dec 1998 16:51:47 +0000 Subject: [PATCH] Corrected a number of bugs, including the keyboard one svn path=/trunk/; revision=115 --- reactos/apps/utils/shell/shell.c | 14 +++++++------- reactos/iface/native/sysfuncs.lst | 1 - reactos/lib/kernel32/file/file.c | 17 +++++++++++++---- reactos/lib/kernel32/internal/dprintf.c | 5 ++++- reactos/ntoskrnl/hal/x86/printk.c | 1 + reactos/ntoskrnl/hal/x86/usercall.asm | 8 ++++++++ reactos/ntoskrnl/io/create.c | 2 +- reactos/ntoskrnl/io/rw.c | 17 +---------------- reactos/ntoskrnl/ke/dpc.c | 7 +++++-- 9 files changed, 40 insertions(+), 32 deletions(-) diff --git a/reactos/apps/utils/shell/shell.c b/reactos/apps/utils/shell/shell.c index 6141078cafa..f8dd684c80f 100644 --- a/reactos/apps/utils/shell/shell.c +++ b/reactos/apps/utils/shell/shell.c @@ -11,7 +11,7 @@ void debug_printf(char* fmt, ...) va_start(args,fmt); vsprintf(buffer,fmt,args); - OutputDebugString(buffer); + OutputDebugStringA(buffer); va_end(args); } @@ -36,18 +36,18 @@ void main() 0, NULL); -NtDisplayString("#1\n"); + debug_printf("C:\\"); -NtDisplayString("#2\n"); for(;;) { ReadFile(FileHandle, &KeyEvent, - sizeof(KeyEvent), + sizeof(KEY_EVENT_RECORD), &Result, NULL); -NtDisplayString("#3\n"); - debug_printf("%c",KeyEvent[0].AsciiChar); -NtDisplayString("#4\n"); + if (KeyEvent[0].bKeyDown) + { + debug_printf("%c",KeyEvent[0].AsciiChar); + } } } diff --git a/reactos/iface/native/sysfuncs.lst b/reactos/iface/native/sysfuncs.lst index 89dbd4c9e7f..1fc29b533c0 100644 --- a/reactos/iface/native/sysfuncs.lst +++ b/reactos/iface/native/sysfuncs.lst @@ -226,4 +226,3 @@ wcsspn Rtlwcsspn 8 wcsstr Rtlwcsstr 8 wcstok Rtlwcstok 8 wstrlen Rtlwstrlen 4 - diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c index 465ad8af9bf..5b1be11ed53 100644 --- a/reactos/lib/kernel32/file/file.c +++ b/reactos/lib/kernel32/file/file.c @@ -70,7 +70,9 @@ HANDLE STDCALL CreateFileA(LPCSTR lpFileName, WCHAR FileNameW[MAX_PATH]; ULONG i = 0; - + + OutputDebugStringA("CreateFileA\n"); + while ((*lpFileName)!=0 && i < MAX_PATH) { FileNameW[i] = *lpFileName; @@ -103,12 +105,14 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName, WCHAR *FilePart; UINT Len = 0; + OutputDebugStringA("CreateFileW\n"); + if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) { Flags |= FILE_SYNCHRONOUS_IO_ALERT; } - + #if 0 if ( ( ( dwCreationDisposition & OPEN_EXISTING ) == OPEN_EXISTING ) || ( ( dwCreationDisposition & TRUNCATE_EXISTING ) == TRUNCATE_EXISTING ) ) @@ -135,7 +139,12 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName, FileNameString.Buffer = (WCHAR *)PathNameW; FileNameString.MaximumLength = FileNameString.Length; - + #endif + + FileNameString.Buffer = lpFileName; + FileNameString.Length = + FileNameString.MaximumLength = lstrlenW(lpFileName) * sizeof(WCHAR); + ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); ObjectAttributes.RootDirectory = NULL; ObjectAttributes.ObjectName = &FileNameString; @@ -1411,4 +1420,4 @@ SetFileTime( } return TRUE; -} \ No newline at end of file +} diff --git a/reactos/lib/kernel32/internal/dprintf.c b/reactos/lib/kernel32/internal/dprintf.c index 705ff845d06..820a7fd4b4c 100644 --- a/reactos/lib/kernel32/internal/dprintf.c +++ b/reactos/lib/kernel32/internal/dprintf.c @@ -4,6 +4,8 @@ VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString) { + NtDisplayString(lpOutputString); + #if 0 WCHAR DebugStringW[161]; int i,j; i = 0; @@ -21,7 +23,8 @@ VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString) j = 0; } - return; + return; + #endif } VOID diff --git a/reactos/ntoskrnl/hal/x86/printk.c b/reactos/ntoskrnl/hal/x86/printk.c index d74c05ec469..89f519f7359 100644 --- a/reactos/ntoskrnl/hal/x86/printk.c +++ b/reactos/ntoskrnl/hal/x86/printk.c @@ -138,6 +138,7 @@ NTSTATUS STDCALL NtDisplayString(IN PUNICODE_STRING DisplayString) { // DbgPrint("DisplayString %x\n",DisplayString); DbgPrint("%s",DisplayString); +// DbgPrint("Returning from NtDisplayString()\n"); return(STATUS_SUCCESS); } diff --git a/reactos/ntoskrnl/hal/x86/usercall.asm b/reactos/ntoskrnl/hal/x86/usercall.asm index 84f79dc89c8..0002db2a967 100644 --- a/reactos/ntoskrnl/hal/x86/usercall.asm +++ b/reactos/ntoskrnl/hal/x86/usercall.asm @@ -13,10 +13,14 @@ _interrupt_handler2e: push es push esi push edi + push ebp + push ebx mov bx,KERNEL_DS mov es,bx + mov ebp,esp + mov esi,edx mov ecx,[es:__SystemServiceTable+eax*8] sub esp,ecx @@ -28,6 +32,10 @@ _interrupt_handler2e: mov eax,[__SystemServiceTable+4+eax*8] call eax + mov esp,ebp + + pop ebx + pop ebp pop edi pop esi pop es diff --git a/reactos/ntoskrnl/io/create.c b/reactos/ntoskrnl/io/create.c index 32021103fbd..0e5483a6648 100644 --- a/reactos/ntoskrnl/io/create.c +++ b/reactos/ntoskrnl/io/create.c @@ -17,7 +17,7 @@ #include #include -#define NDEBUG +//#define NDEBUG #include /* FUNCTIONS *************************************************************/ diff --git a/reactos/ntoskrnl/io/rw.c b/reactos/ntoskrnl/io/rw.c index c45d729f5af..74e568ec418 100644 --- a/reactos/ntoskrnl/io/rw.c +++ b/reactos/ntoskrnl/io/rw.c @@ -115,23 +115,8 @@ NTSTATUS ZwReadFile(HANDLE FileHandle, if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) { KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); - Status = Irp->IoStatus.Status; - if (NT_SUCCESS(Status)) - { - if (FileObject->DeviceObject->Flags&DO_BUFFERED_IO) - { - memcpy(Buffer,Irp->AssociatedIrp.SystemBuffer,Length); - } - } - } - else if (NT_SUCCESS(Status)) - { - if (FileObject->DeviceObject->Flags&DO_BUFFERED_IO) - { - memcpy(Buffer,Irp->AssociatedIrp.SystemBuffer,Length); - } + return(IoStatusBlock->Status); } - return(Status); } diff --git a/reactos/ntoskrnl/ke/dpc.c b/reactos/ntoskrnl/ke/dpc.c index 179bc8f90cc..8b280c7e244 100644 --- a/reactos/ntoskrnl/ke/dpc.c +++ b/reactos/ntoskrnl/ke/dpc.c @@ -52,10 +52,12 @@ void KeDrainDpcQueue(void) { PLIST_ENTRY current_entry; PKDPC current; - + KIRQL oldlvl; KeAcquireSpinLockAtDpcLevel(&DpcQueueLock); + KeRaiseIrql(HIGH_LEVEL,&oldlvl); current_entry = RemoveHeadList(&DpcQueueHead); + KeLowerIrql(oldlvl); current = CONTAINING_RECORD(current_entry,KDPC,DpcListEntry); while (current_entry!=(&DpcQueueHead)) { @@ -64,11 +66,12 @@ void KeDrainDpcQueue(void) current->SystemArgument1, current->SystemArgument2); current->Lock=FALSE; + KeRaiseIrql(HIGH_LEVEL,&oldlvl); current_entry = RemoveHeadList(&DpcQueueHead); + KeLowerIrql(oldlvl); current = CONTAINING_RECORD(¤t_entry,KDPC,DpcListEntry); } KeReleaseSpinLockFromDpcLevel(&DpcQueueLock); -// DPRINT("Finished KeDrainDpcQueue()\n",0); } BOOLEAN KeRemoveQueueDpc(PKDPC Dpc)