Corrected a number of bugs, including the keyboard one

svn path=/trunk/; revision=115
This commit is contained in:
David Welch 1998-12-08 16:51:47 +00:00
parent 8587170853
commit 4bc75819a3
9 changed files with 40 additions and 32 deletions

View file

@ -11,7 +11,7 @@ void debug_printf(char* fmt, ...)
va_start(args,fmt); va_start(args,fmt);
vsprintf(buffer,fmt,args); vsprintf(buffer,fmt,args);
OutputDebugString(buffer); OutputDebugStringA(buffer);
va_end(args); va_end(args);
} }
@ -36,18 +36,18 @@ void main()
0, 0,
NULL); NULL);
NtDisplayString("#1\n");
debug_printf("C:\\"); debug_printf("C:\\");
NtDisplayString("#2\n");
for(;;) for(;;)
{ {
ReadFile(FileHandle, ReadFile(FileHandle,
&KeyEvent, &KeyEvent,
sizeof(KeyEvent), sizeof(KEY_EVENT_RECORD),
&Result, &Result,
NULL); NULL);
NtDisplayString("#3\n"); if (KeyEvent[0].bKeyDown)
debug_printf("%c",KeyEvent[0].AsciiChar); {
NtDisplayString("#4\n"); debug_printf("%c",KeyEvent[0].AsciiChar);
}
} }
} }

View file

@ -226,4 +226,3 @@ wcsspn Rtlwcsspn 8
wcsstr Rtlwcsstr 8 wcsstr Rtlwcsstr 8
wcstok Rtlwcstok 8 wcstok Rtlwcstok 8
wstrlen Rtlwstrlen 4 wstrlen Rtlwstrlen 4

View file

@ -70,7 +70,9 @@ HANDLE STDCALL CreateFileA(LPCSTR lpFileName,
WCHAR FileNameW[MAX_PATH]; WCHAR FileNameW[MAX_PATH];
ULONG i = 0; ULONG i = 0;
OutputDebugStringA("CreateFileA\n");
while ((*lpFileName)!=0 && i < MAX_PATH) while ((*lpFileName)!=0 && i < MAX_PATH)
{ {
FileNameW[i] = *lpFileName; FileNameW[i] = *lpFileName;
@ -103,12 +105,14 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
WCHAR *FilePart; WCHAR *FilePart;
UINT Len = 0; UINT Len = 0;
OutputDebugStringA("CreateFileW\n");
if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{ {
Flags |= FILE_SYNCHRONOUS_IO_ALERT; Flags |= FILE_SYNCHRONOUS_IO_ALERT;
} }
#if 0
if ( ( ( dwCreationDisposition & OPEN_EXISTING ) == OPEN_EXISTING ) || if ( ( ( dwCreationDisposition & OPEN_EXISTING ) == OPEN_EXISTING ) ||
( ( dwCreationDisposition & TRUNCATE_EXISTING ) == TRUNCATE_EXISTING ) ) ( ( dwCreationDisposition & TRUNCATE_EXISTING ) == TRUNCATE_EXISTING ) )
@ -135,7 +139,12 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
FileNameString.Buffer = (WCHAR *)PathNameW; FileNameString.Buffer = (WCHAR *)PathNameW;
FileNameString.MaximumLength = FileNameString.Length; FileNameString.MaximumLength = FileNameString.Length;
#endif
FileNameString.Buffer = lpFileName;
FileNameString.Length =
FileNameString.MaximumLength = lstrlenW(lpFileName) * sizeof(WCHAR);
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL; ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &FileNameString; ObjectAttributes.ObjectName = &FileNameString;
@ -1411,4 +1420,4 @@ SetFileTime(
} }
return TRUE; return TRUE;
} }

View file

@ -4,6 +4,8 @@
VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString) VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString)
{ {
NtDisplayString(lpOutputString);
#if 0
WCHAR DebugStringW[161]; WCHAR DebugStringW[161];
int i,j; int i,j;
i = 0; i = 0;
@ -21,7 +23,8 @@ VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString)
j = 0; j = 0;
} }
return; return;
#endif
} }
VOID VOID

View file

@ -138,6 +138,7 @@ NTSTATUS STDCALL NtDisplayString(IN PUNICODE_STRING DisplayString)
{ {
// DbgPrint("DisplayString %x\n",DisplayString); // DbgPrint("DisplayString %x\n",DisplayString);
DbgPrint("%s",DisplayString); DbgPrint("%s",DisplayString);
// DbgPrint("Returning from NtDisplayString()\n");
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }

View file

@ -13,10 +13,14 @@ _interrupt_handler2e:
push es push es
push esi push esi
push edi push edi
push ebp
push ebx
mov bx,KERNEL_DS mov bx,KERNEL_DS
mov es,bx mov es,bx
mov ebp,esp
mov esi,edx mov esi,edx
mov ecx,[es:__SystemServiceTable+eax*8] mov ecx,[es:__SystemServiceTable+eax*8]
sub esp,ecx sub esp,ecx
@ -28,6 +32,10 @@ _interrupt_handler2e:
mov eax,[__SystemServiceTable+4+eax*8] mov eax,[__SystemServiceTable+4+eax*8]
call eax call eax
mov esp,ebp
pop ebx
pop ebp
pop edi pop edi
pop esi pop esi
pop es pop es

View file

@ -17,7 +17,7 @@
#include <internal/string.h> #include <internal/string.h>
#include <wstring.h> #include <wstring.h>
#define NDEBUG //#define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* FUNCTIONS *************************************************************/ /* FUNCTIONS *************************************************************/

View file

@ -115,23 +115,8 @@ NTSTATUS ZwReadFile(HANDLE FileHandle,
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO)) if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
{ {
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
Status = Irp->IoStatus.Status; return(IoStatusBlock->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(Status); return(Status);
} }

View file

@ -52,10 +52,12 @@ void KeDrainDpcQueue(void)
{ {
PLIST_ENTRY current_entry; PLIST_ENTRY current_entry;
PKDPC current; PKDPC current;
KIRQL oldlvl;
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock); KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
KeRaiseIrql(HIGH_LEVEL,&oldlvl);
current_entry = RemoveHeadList(&DpcQueueHead); current_entry = RemoveHeadList(&DpcQueueHead);
KeLowerIrql(oldlvl);
current = CONTAINING_RECORD(current_entry,KDPC,DpcListEntry); current = CONTAINING_RECORD(current_entry,KDPC,DpcListEntry);
while (current_entry!=(&DpcQueueHead)) while (current_entry!=(&DpcQueueHead))
{ {
@ -64,11 +66,12 @@ void KeDrainDpcQueue(void)
current->SystemArgument1, current->SystemArgument1,
current->SystemArgument2); current->SystemArgument2);
current->Lock=FALSE; current->Lock=FALSE;
KeRaiseIrql(HIGH_LEVEL,&oldlvl);
current_entry = RemoveHeadList(&DpcQueueHead); current_entry = RemoveHeadList(&DpcQueueHead);
KeLowerIrql(oldlvl);
current = CONTAINING_RECORD(&current_entry,KDPC,DpcListEntry); current = CONTAINING_RECORD(&current_entry,KDPC,DpcListEntry);
} }
KeReleaseSpinLockFromDpcLevel(&DpcQueueLock); KeReleaseSpinLockFromDpcLevel(&DpcQueueLock);
// DPRINT("Finished KeDrainDpcQueue()\n",0);
} }
BOOLEAN KeRemoveQueueDpc(PKDPC Dpc) BOOLEAN KeRemoveQueueDpc(PKDPC Dpc)