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);
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);
}
}
}

View file

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

View file

@ -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;
}
}

View file

@ -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

View file

@ -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);
}

View file

@ -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

View file

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

View file

@ -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);
}

View file

@ -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(&current_entry,KDPC,DpcListEntry);
}
KeReleaseSpinLockFromDpcLevel(&DpcQueueLock);
// DPRINT("Finished KeDrainDpcQueue()\n",0);
}
BOOLEAN KeRemoveQueueDpc(PKDPC Dpc)