Fixed bugs in lib/kernel32/file/curdir.c and

lib/kernel32/misc/console.c

svn path=/trunk/; revision=217
This commit is contained in:
David Welch
1999-02-07 00:37:29 +00:00
parent 02e70516ef
commit 70f7c7269c
13 changed files with 236 additions and 370 deletions

View File

@@ -171,6 +171,7 @@ void ReadLine(char* line)
KEY_EVENT_RECORD KeyEvent;
DWORD Result;
UCHAR CurrentDir[255];
char ch;
GetCurrentDirectoryA(255,CurrentDir);
debug_printf(CurrentDir);
@@ -178,26 +179,18 @@ void ReadLine(char* line)
do
{
if (!ReadConsoleA(InputHandle,
&KeyEvent,
sizeof(KEY_EVENT_RECORD),
&Result,
NULL))
&ch,
1,
&Result,
NULL))
{
debug_printf("Failed to read from console\n");
for(;;);
}
if (KeyEvent.bKeyDown && KeyEvent.AsciiChar != 0)
{
debug_printf("%c", KeyEvent.AsciiChar);
*line = KeyEvent.AsciiChar;
line++;
}
} while (!(KeyEvent.bKeyDown && KeyEvent.AsciiChar == '\n'));
ReadFile(InputHandle,
&KeyEvent,
sizeof(KEY_EVENT_RECORD),
&Result,
NULL);
debug_printf("%c", ch);
*line = ch;
line++;
} while (ch != '\n');
line--;
*line = 0;
}

View File

@@ -10,11 +10,6 @@
* Removed use of SearchPath (not used by Windows)
*/
/*
* NOTES: Please don't alter without debugging
*
*/
/* INCLUDES *****************************************************************/
#include <windows.h>
@@ -24,7 +19,7 @@
#include <ddk/li.h>
#include <ddk/rtl.h>
#define NDEBUG
//#define NDEBUG
#include <kernel32/kernel32.h>
/* FUNCTIONS ****************************************************************/
@@ -130,8 +125,7 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
FileNameW[3] = '\\';
FileNameW[4] = 0;
wcscat(FileNameW,PathNameW);
FileNameString.Length = wcslen( FileNameW)*sizeof(WCHAR);
if ( FileNameString.Length == 0 )
@@ -163,8 +157,6 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
Flags,
NULL,
0);
DPRINT("After create file\n");
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -173,82 +165,3 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
return(FileHandle);
}
#if 0
HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile)
{
HANDLE FileHandle;
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING FileNameString;
ULONG Flags = 0;
WCHAR PathNameW[MAX_PATH];
WCHAR *FilePart;
UINT Len = 0;
WCHAR CurrentDir[MAX_PATH];
OutputDebugStringA("CreateFileW\n");
if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{
Flags |= FILE_SYNCHRONOUS_IO_ALERT;
}
// lstrcpyW(PathNameW,L"\\??\\");
PathNameW[0] = '\\';
PathNameW[1] = '?';
PathNameW[2] = '?';
PathNameW[3] = '\\';
PathNameW[4] = 0;
dprintf("Name %w\n",PathNameW);
if (lpFileName[0] != L'\\' && lpFileName[1] != L':')
{
Len = GetCurrentDirectoryW(MAX_PATH,CurrentDir);
dprintf("CurrentDir %w\n",CurrentDir);
lstrcatW(PathNameW,CurrentDir);
dprintf("Name %w\n",PathNameW);
}
lstrcatW(PathNameW,lpFileName);
dprintf("Name %w\n",PathNameW);
FileNameString.Length = lstrlenW( PathNameW)*sizeof(WCHAR);
if ( FileNameString.Length == 0 )
return NULL;
if ( FileNameString.Length > MAX_PATH )
return NULL;
FileNameString.Buffer = (WCHAR *)PathNameW;
FileNameString.MaximumLength = FileNameString.Length+sizeof(WCHAR);
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &FileNameString;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = NULL;
Status = NtCreateFile(&FileHandle,
dwDesiredAccess,
&ObjectAttributes,
&IoStatusBlock,
NULL,
dwFlagsAndAttributes,
dwShareMode,
dwCreationDisposition,
Flags,
NULL,
0);
return(FileHandle);
}
#endif

View File

@@ -11,55 +11,46 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <kernel32/kernel32.h>
//#define NDEBUG
#include <kernel32/kernel32.h>
/* GLOBALS *******************************************************************/
#define MAX_DOS_DRIVES 26
WCHAR CurrentDirectoryW[MAX_PATH] = {0,};
HANDLE hCurrentDirectory = NULL;
int drive= 2;
static HANDLE hCurrentDirectory = NULL;
static ULONG CurrentDrive = 0;
char DriveDirectoryW[MAX_DOS_DRIVES][MAX_PATH] = { {"A:\\"},{"B:\\"},{"C:\\"},{"D:\\"},
{"E:\\"},{"F:\\"},{"G:\\"},{"H:\\"},
{"I:\\"},{"J:\\"},{"K:\\"},{"L:\\"},
{"M:\\"},{"N:\\"},{"O:\\"},{"P:\\"},
{"Q:\\"},{"R:\\"},{"S:\\"},{"T:\\"},
{"U:\\"},{"V:\\"},{"W:\\"},{"X:\\"},
{"Y:\\"},{"Z:\\"} };
static WCHAR DriveDirectoryW[MAX_DOS_DRIVES][MAX_PATH] = {{0}};
WCHAR SystemDirectoryW[MAX_PATH];
static WCHAR SystemDirectoryW[MAX_PATH];
static WCHAR WindowsDirectoryW[MAX_PATH];
WCHAR WindowsDirectoryW[MAX_PATH];
WINBOOL
STDCALL
SetCurrentDirectoryW(
LPCWSTR lpPathName
);
WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName);
/* FUNCTIONS *****************************************************************/
DWORD STDCALL GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer)
{
UINT uSize,i;
WCHAR TempDir[MAX_PATH];
if ( lpBuffer == NULL )
return 0;
uSize = lstrlenW(CurrentDirectoryW);
if ( nBufferLength > uSize ) {
GetCurrentDirectoryW(MAX_PATH, TempDir);
uSize = lstrlenW(TempDir);
if (nBufferLength > uSize)
{
i = 0;
while ((CurrentDirectoryW[i])!=0 && i < MAX_PATH)
while (TempDir[i] != 0)
{
lpBuffer[i] = (unsigned char)CurrentDirectoryW[i];
i++;
lpBuffer[i] = (unsigned char)TempDir[i];
i++;
}
lpBuffer[i] = 0;
}
}
return uSize;
}
@@ -67,16 +58,18 @@ DWORD STDCALL GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
{
UINT uSize;
DPRINT("CurrentDirectoryW %w\n",CurrentDirectoryW);
DPRINT("GetCurrentDirectoryW()\n");
if ( lpBuffer == NULL )
return 0;
uSize = lstrlenW(CurrentDirectoryW);
if ( nBufferLength > uSize )
lstrcpynW(lpBuffer,CurrentDirectoryW,uSize);
uSize = lstrlenW(DriveDirectoryW[CurrentDrive]) + 2;
if (nBufferLength > uSize)
{
lpBuffer[0] = 'A' + CurrentDrive;
lpBuffer[1] = ':';
lstrcpyW(&lpBuffer[2], DriveDirectoryW[CurrentDrive]);
}
DPRINT("GetCurrentDirectoryW() = %w\n",lpBuffer);
return uSize;
}
@@ -85,11 +78,10 @@ WINBOOL STDCALL SetCurrentDirectoryA(LPCSTR lpPathName)
UINT i;
WCHAR PathNameW[MAX_PATH];
if ( lpPathName == NULL )
return FALSE;
if ( strlen(lpPathName) > MAX_PATH )
return FALSE;
return FALSE;
if ( lstrlen(lpPathName) > MAX_PATH )
return FALSE;
i = 0;
while ((lpPathName[i])!=0 && i < MAX_PATH)
{
@@ -101,89 +93,106 @@ WINBOOL STDCALL SetCurrentDirectoryA(LPCSTR lpPathName)
return SetCurrentDirectoryW(PathNameW);
}
WINBOOL
STDCALL
SetCurrentDirectoryW(
LPCWSTR lpPathName
)
WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName)
{
int len;
int i,j;
HANDLE hDirOld = hCurrentDirectory;
ULONG len;
WCHAR PathName[MAX_PATH];
if ( lpPathName == NULL )
return FALSE;
len = lstrlenW(lpPathName);
if ( len > MAX_PATH )
return FALSE;
if ( len == 2 && isalpha(lpPathName[0]) && lpPathName[1] == ':' ) {
len = lstrlenW(CurrentDirectoryW);
for(i=0;i<len+1;i++)
DriveDirectoryW[drive][i] = CurrentDirectoryW[i];
drive = toupper((char)lpPathName[0]) - 'A';
len = lstrlenW(DriveDirectoryW[drive]);
for(i=0;i<len+1;i++)
CurrentDirectoryW[i] = DriveDirectoryW[drive][i];
if ( hDirOld != NULL )
CloseHandle(hDirOld);
return TRUE;
}
if ( lpPathName[0] == '.' && lpPathName[1] == '\\') {
lstrcpyW(PathName,CurrentDirectoryW);
lstrcatW(PathName,&lpPathName[2]);
}
else if ( lpPathName[0] == '.' && lpPathName[1] == '.' ) {
lstrcpyW(PathName,CurrentDirectoryW);
lstrcatW(PathName,lpPathName);
}
else if ( lpPathName[0] != '.' && lpPathName[1] != ':' ) {
lstrcpyW(PathName,CurrentDirectoryW);
lstrcatW(PathName,lpPathName);
}
else
lstrcpyW(PathName,CurrentDirectoryW);
len = lstrlenW(PathName);
for(i=0;i<len+1;i++) {
if ( PathName[i] == '.' && PathName[i+1] == '.' )
if ( i + 2 < len && PathName[i+2] != '\\' && PathName[i+2] != 0 )
PathName[i+2] = 0;
}
if ( len > 0 && PathName[len-1] == L'\\' ) {
PathName[len-1] = 0;
}
len = lstrlenW(PathName);
for(i=3;i<len-2 && PathName[i] != 0;i++) {
if ( PathName[i] == L'\\' && PathName[i+1] == L'.' && PathName[i+2] == L'.' ) {
for(j = i-1;j>=2 && PathName[j] != '\\';j-- ) {}
PathName[j+1] = 0;
if ( i+4 < len ) {
PathName[i+3] = 0;
lstrcatW(PathName,&PathName[i+4]);
}
len = lstrlenW(PathName);
}
}
hCurrentDirectory = CreateFileW(PathName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS|FILE_ATTRIBUTE_DIRECTORY,NULL);
if ( hCurrentDirectory == - 1 ) {
hCurrentDirectory = hDirOld;
DPRINT("%d\n",GetLastError());
return FALSE;
}
else
CloseHandle(hDirOld);
HANDLE hDir;
PWSTR prev, current;
lstrcpyW(CurrentDirectoryW,PathName);
lstrcatW(CurrentDirectoryW,L"\\");
DPRINT("SetCurrentDirectoryW(lpPathName %w\n",lpPathName);
if (lpPathName == NULL)
return FALSE;
len = lstrlenW(lpPathName);
if (len > MAX_PATH)
return FALSE;
hDir = CreateFileW(lpPathName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_DIRECTORY,
NULL);
if (hDir == NULL)
{
DPRINT("Failed to open directory\n");
return(FALSE);
}
if (hCurrentDirectory != NULL)
{
CloseHandle(hCurrentDirectory);
}
hCurrentDirectory = hDir;
if (isalpha(lpPathName[0]) && lpPathName[1] == ':' )
{
DPRINT("lpPathName %w\n",lpPathName);
CurrentDrive = toupper((UCHAR)lpPathName[0]) - 'A';
if (!(lpPathName[2] == '\\' && lpPathName[3] == 0 &&
DriveDirectoryW[CurrentDrive][0] != 0))
{
wcscpy(DriveDirectoryW[CurrentDrive],&lpPathName[2]);
len = lstrlenW(DriveDirectoryW[CurrentDrive]);
if (DriveDirectoryW[CurrentDrive][len-1] != '\\')
{
DriveDirectoryW[CurrentDrive][len] = '\\';
DriveDirectoryW[CurrentDrive][len+1] = 0;
}
}
return(TRUE);
}
if (lpPathName[0] == '\\')
{
wcscpy(DriveDirectoryW[CurrentDrive],lpPathName);
return(TRUE);
}
GetCurrentDirectoryW(MAX_PATH, PathName);
lstrcatW(PathName, lpPathName);
len = lstrlenW(PathName);
if (PathName[len-1] != '\\')
{
PathName[len] = '\\';
PathName[len+1] = 0;
}
DPRINT("PathName %w\n",PathName);
prev = NULL;
current = &PathName[2];
while (current != NULL)
{
if (current[1] == '.' && current[2] == '\\')
{
wcscpy(current, current+2);
}
else if (current[1] == '.' && current[2] == '.' &&
current[3] == '\\' && prev != NULL)
{
wcscpy(prev, current+3);
current = prev;
while (prev > PathName && (*prev) != '\\')
{
prev--;
}
if (prev == PathName)
{
prev = NULL;
}
}
else
{
prev = current;
current = wcschr(current+1, (WCHAR)'\\');
}
}
lstrcpyW(DriveDirectoryW[CurrentDrive], &PathName[2]);
return TRUE;
}

View File

@@ -4,7 +4,7 @@
* FILE: lib/kernel32/file/file.c
* PURPOSE: Directory functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
GetTempFileName is modified from WINE [ Alexandre Juiliard ]
* GetTempFileName is modified from WINE [ Alexandre Juiliard ]
* UPDATE HISTORY:
* Created 01/11/98
*/
@@ -19,6 +19,9 @@
#include <ddk/li.h>
#include <ddk/rtl.h>
#define NDEBUG
#include <kernel32/kernel32.h>
#define LPPROGRESS_ROUTINE void*
@@ -80,11 +83,11 @@ AreFileApisANSI(VOID)
WINBOOL STDCALL WriteFile(HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverLapped)
WINBOOL STDCALL WriteFile(HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverLapped)
{
LARGE_INTEGER Offset;
@@ -92,9 +95,9 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
NTSTATUS errCode;
PIO_STATUS_BLOCK IoStatusBlock;
IO_STATUS_BLOCK IIosb;
DPRINT("WriteFile(hFile %x\n",WriteFile);
if (lpOverLapped != NULL )
{
SET_LARGE_INTEGER_LOW_PART(Offset, lpOverLapped->Offset);
@@ -108,7 +111,10 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
IoStatusBlock = &IIosb;
Offset = NULL;
}
errCode = NtWriteFile(hFile,hEvent,NULL,NULL,
errCode = NtWriteFile(hFile,
hEvent,
NULL,
NULL,
IoStatusBlock,
(PVOID)lpBuffer,
nNumberOfBytesToWrite,
@@ -119,8 +125,10 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
}
if ( !lpNumberOfBytesWritten )
*lpNumberOfBytesWritten = IoStatusBlock->Information;
if (lpNumberOfBytesWritten != NULL )
{
*lpNumberOfBytesWritten = IoStatusBlock->Information;
}
return(TRUE);
}
@@ -137,9 +145,8 @@ WINBOOL STDCALL ReadFile(HANDLE hFile,
NTSTATUS errCode;
PIO_STATUS_BLOCK IoStatusBlock;
IO_STATUS_BLOCK IIosb;
if ( lpOverLapped != NULL )
if (lpOverLapped != NULL)
{
SET_LARGE_INTEGER_LOW_PART(ByteOffset, lpOverLapped->Offset);
SET_LARGE_INTEGER_HIGH_PART(ByteOffset, lpOverLapped->OffsetHigh);
@@ -162,15 +169,18 @@ WINBOOL STDCALL ReadFile(HANDLE hFile,
lpBuffer,
nNumberOfBytesToRead,
Offset,
NULL);
NULL);
if ( !NT_SUCCESS(errCode) )
{
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
}
if ( !lpNumberOfBytesRead )
if (lpNumberOfBytesRead != NULL )
{
*lpNumberOfBytesRead = IoStatusBlock->Information;
}
return TRUE;
}

View File

@@ -985,13 +985,13 @@ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem)
pnextfrag=(PHEAP_FRAGMENT)((LPVOID)pfrag+add);
if(pfrag->Magic!=HEAP_FRAG_MAGIC)
{
dprintf("HeapValidate: fragment %d magic invalid, region 0x%lX,"
DPRINT("HeapValidate: fragment %d magic invalid, region 0x%lX,"
" previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev);
return FALSE;
}
if(pfrag->Number!=i)
{
dprintf("HeapValidate: fragment %d number invalid, region 0x%lX,"
DPRINT("HeapValidate: fragment %d number invalid, region 0x%lX,"
" previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev);
return FALSE;
}
@@ -999,7 +999,7 @@ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem)
number++;
if(pfrag->Sub!=psub)
{
dprintf("HeapValidate: fragment %d suballoc invalid, region 0x%lX,"
DPRINT("HeapValidate: fragment %d suballoc invalid, region 0x%lX,"
" previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev);
return FALSE;
}
@@ -1008,11 +1008,11 @@ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem)
}
if(number!=psub->NumberFree)
{
dprintf("HeapValidate: invalid number of free fragments, region 0x%lX,"
DPRINT("HeapValidate: invalid number of free fragments, region 0x%lX,"
" previous region 0x%lX\n", (ULONG)pcheck, (ULONG)pprev);
return FALSE;
}
dprintf("HeapValidate: [0x%08lX-0x%08lX] suballocated,"
DPRINT("HeapValidate: [0x%08lX-0x%08lX] suballocated,"
" bucket size=%d, bitmap=0x%08lX\n",
(ULONG) pcheck, (ULONG) pnext, pbucket->Size, psub->Bitmap);
}
@@ -1020,22 +1020,22 @@ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem)
{
if(HEAP_RSIZE(pcheck)!=HEAP_SIZE(pcheck))
{
dprintf("HeapValidate: invalid size of free region 0x%lX,"
DPRINT("HeapValidate: invalid size of free region 0x%lX,"
" previous region 0x%lX\n",
(ULONG) pcheck, (ULONG) pprev);
return FALSE;
}
dprintf("HeapValidate: [0x%08lX-0x%08lX] free\n",
DPRINT("HeapValidate: [0x%08lX-0x%08lX] free\n",
(ULONG) pcheck, (ULONG) pnext );
}
else if(HEAP_ISNORMAL(pcheck))
{
dprintf("HeapValidate: [0x%08lX-0x%08lX] allocated\n",
DPRINT("HeapValidate: [0x%08lX-0x%08lX] allocated\n",
(ULONG) pcheck, (ULONG) pnext );
}
else
{
dprintf("HeapValidate: invalid tag %x, region 0x%lX,"
DPRINT("HeapValidate: invalid tag %x, region 0x%lX,"
" previous region 0x%lX\n", pcheck->Size>>28,
(ULONG)pcheck, (ULONG)pprev);
return FALSE;

View File

@@ -47,67 +47,36 @@ WriteConsoleA(
}
WINBOOL
STDCALL
ReadConsoleA(
HANDLE hConsoleInput,
LPVOID lpBuffer,
DWORD nNumberOfCharsToRead,
LPDWORD lpNumberOfCharsRead,
LPVOID lpReserved
)
WINBOOL STDCALL ReadConsoleA(HANDLE hConsoleInput,
LPVOID lpBuffer,
DWORD nNumberOfCharsToRead,
LPDWORD lpNumberOfCharsRead,
LPVOID lpReserved)
{
KEY_EVENT_RECORD *k;
OVERLAPPED Overlapped;
OVERLAPPED * lpOverlapped;
int kSize;
int i,j;
if ( lpReserved == NULL ) {
Overlapped.Internal = 0;
Overlapped.InternalHigh = 0;
Overlapped.Offset = 0;
Overlapped.OffsetHigh = 0;
// Overlapped.hEvent = CreateEvent(NULL,FALSE,TRUE,NULL);
lpOverlapped = &Overlapped;
}
else
lpOverlapped = lpReserved;
kSize = nNumberOfCharsToRead*sizeof(kSize);
k = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,kSize);
if ( k == NULL || kSize == 0 )
return FALSE;
k[0].AsciiChar = 0;
while(k[0].AsciiChar == 0 )
{
ReadFile(hConsoleInput,k,kSize,lpNumberOfCharsRead,lpOverlapped);
}
j = 0;
i = 0;
//if ( k[i].bKeyDown )
{
((char *)lpBuffer)[j] = k[i].AsciiChar;
j++;
}
i++;
while(j < nNumberOfCharsToRead && i < *lpNumberOfCharsRead ) {
//if ( k[i].bKeyDown )
{
((char *)lpBuffer)[j] = k[i].AsciiChar;
j++;
}
i++;
}
HeapFree(GetProcessHeap(),0,k);
//if ( lpReserved == NULL ) {
// CloseHandle(Overlapped.hEvent);
//}
KEY_EVENT_RECORD KeyEventRecord;
int i,j;
BOOL stat;
PCHAR Buffer = (PCHAR)lpBuffer;
DWORD Result;
for (i=0; (stat && i<nNumberOfCharsToRead);)
{
stat = ReadFile(hConsoleInput,
&KeyEventRecord,
sizeof(KeyEventRecord),
&Result,
NULL);
if (stat && KeyEventRecord.bKeyDown && KeyEventRecord.AsciiChar != 0)
{
Buffer[i] = KeyEventRecord.AsciiChar;
i++;
}
}
if (lpNumberOfCharsRead != NULL)
{
*lpNumberOfCharsRead = i;
}
return(stat);
}
WINBOOL
@@ -119,9 +88,9 @@ AllocConsole( VOID )
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0,
NULL);
StdOutput = CreateFile("\\BlueScreen",
FILE_GENERIC_WRITE|FILE_GENERIC_READ,
0,

View File

@@ -39,8 +39,8 @@ WINBOOL STDCALL GetProcessId(HANDLE hProcess, LPDWORD lpProcessId);
VOID InitializePeb(PWSTR CommandLine)
{
DPRINT("InitializePeb(CommandLine %x)\n",CommandLine);
DPRINT("ProcessInfo.CommandLine %x\n",ProcessInfo.CommandLine);
wcscpy(ProcessInfo.CommandLine, CommandLine);
// DPRINT("ProcessInfo.CommandLine %x\n",ProcessInfo.CommandLine);
// wcscpy(ProcessInfo.CommandLine, CommandLine);
CurrentPeb.StartupInfo = &ProcessInfo;
}

View File

@@ -1,7 +1,7 @@
all: ntdll.a
OBJECTS = napi.o stubs/stubs.o string/wstring.o stdio/vsprintf.o \
rtl/unicode.o rtl/namespc.o string/ctype.o
rtl/unicode.o rtl/namespc.o string/ctype.o string/strlen.o
ntdll.a: $(OBJECTS)
$(AR) vcsr ntdll.a $(OBJECTS)

View File

@@ -568,7 +568,6 @@ STUB(strchr)
STUB(strcmp)
STUB(strcpy)
STUB(strcspn)
STUB(strlen)
STUB(strncat)
STUB(strncmp)
STUB(strncpy)

View File

@@ -263,6 +263,14 @@ asmlinkage void exception_handler(unsigned int edi,
else
{
printk("SS:ESP %x:%x\n",ss0,esp0);
stack=(unsigned int *)(esp0);
printk("Stack:\n");
for (i=0;i<16;i=i+4)
{
printk("%.8x %.8x %.8x %.8x\n",stack[i],stack[i+1],stack[i+2],
stack[i+3]);
}
}
for(;;);

View File

@@ -218,6 +218,7 @@ NTSTATUS ZwCreateFile(PHANDLE FileHandle,
(*FileHandle) = 0;
}
DPRINT("(*FileHandle) %x\n",(*FileHandle));
DPRINT("Finished ZwCreateFile()\n");
return(Status);
}

View File

@@ -72,6 +72,7 @@ NTSTATUS ZwReadFile(HANDLE FileHandle,
NULL);
if (Status != STATUS_SUCCESS)
{
DPRINT("ZwReadFile() = %x\n",Status);
return(Status);
}

View File

@@ -1,58 +1,21 @@
* Introduction
DIRECTORIES
These are the sources for the ReactOS kernel, system libraries and
applications. ReactOS is the beginnings of a free clone of Windows NT
(aiming at version 4 right now). ReactOS isn't usuable for anything but
further development, please don't uninstall your existing OSs just yet.
* Compilation
ReactOS currently only compiles using the djgpp compiler for DOS (or a djgpp
cross compiler with some fiddling). This will change in the near future to
using the mingw32 compiler. It also needs the NASM assembler installed.
To compile
1) copy libgcc.a from the djgpp distribution to the ntoskrnl directory
2) make
* Installation
By default ReactOS tries to execute 'c:\reactos\system\shell.bin' on
startup, if you want to see a user program running, copy either
'apps\hello\hello.bin' or 'apps\shell\shell.bin' to
'c:\reactos\system\shell.bin'. 'hello.bin' will write 'hello world' to the
console, 'shell.bin' will allow you to enter simple commands including
'dir', 'cd' and to execute additional processes e.g. 'hello.bin'.
* Running
Type 'boot.bat' from this directory. ReactOS won't start if a DPMI or VCPI
program is running e.g. Windows or EMM386.
* Further information
See the doc subdirectory, and these websites
http://www.sid-dis.com/reactos (main project website)
http://mok.lvcm.com/ (some more information including web based access
to the cvs server)
And also
http://www.delorie.com/djgpp/ (for DJGPP)
http://?? (for NASM)
http://www.microsoft.com/hwdev/ (Information on NT driver development)
http://www.sysinternals.com/ (NT internals)
http://www.osr.com/ (Information on NT internals, also get an NT
insider subscription)
http://www.internals.com/ (Some information)
http://www.winehq.com/ (Windows emulators for Unix)
Competitors
http://www.freedows.org/ (Aiming at an OS able to emulate various
systems including windows, vapourware so far)
http://www.solarmoon.org/ (Makers of a FreeBSD based NT clone, site now
blank)
http://www.genericwindows.com/ (Aiming to make a Windows 3.1 clone
based on FreeBSD and Wine)
system : compiled versions of the various system components and
libraries
ntoskrnl : microkernel source
ntoskrnl/hal : hardware abstraction layer source
ntoskrnl/mm : memory managment subsystem source
ntoskrnl/io : IO manager subsystem source
include : win32 headers
include/internal : kernel private header files
include/ntdll : system library private header files
include/kernel32 : system library private header files
include/user32 : user interface private header files
include/gdi32 : graphics interface private header files
include/ddk : header files for modules
lib/ntdll : NT dll source
lib/kernel32 : kernel32 source
doc : documentation
loaders/dos : DOS based loader
loaders/boot : boot loader
services : various services (device drivers, filesystems etc)