Fixed header inclusion order.

svn path=/trunk/; revision=687
This commit is contained in:
Eric Kohl 1999-10-07 23:46:27 +00:00
parent 2076e94020
commit 648301897c
77 changed files with 621 additions and 368 deletions

View file

@ -131,6 +131,10 @@ struct _LPC_MESSAGE
#define SystemTimeZoneInformation 44
// memory information
#define MemoryBasicInformation 0
// shutdown action
typedef enum SHUTDOWN_ACTION_TAG {
@ -144,6 +148,11 @@ typedef enum SHUTDOWN_ACTION_TAG {
#define WaitAll 0
#define WaitAny 1
// number of wait objects
#define THREAD_WAIT_OBJECTS 3
//#define MAXIMUM_WAIT_OBJECTS 64
// key restore flags
#define REG_WHOLE_HIVE_VOLATILE 1

View file

@ -363,6 +363,17 @@ typedef struct _DISK_GEOMETRY {
DWORD BytesPerSector;
} DISK_GEOMETRY ;
typedef struct _MEMORY_BASIC_INFORMATION {
PVOID BaseAddress;
PVOID AllocationBase;
DWORD AllocationProtect;
DWORD RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;
} MEMORY_BASIC_INFORMATION;
typedef MEMORY_BASIC_INFORMATION *PMEMORY_BASIC_INFORMATION;
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
@ -2700,17 +2711,6 @@ typedef struct tagMEASUREITEMSTRUCT {
DWORD itemData;
} MEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT;
typedef struct _MEMORY_BASIC_INFORMATION {
PVOID BaseAddress;
PVOID AllocationBase;
DWORD AllocationProtect;
DWORD RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;
} MEMORY_BASIC_INFORMATION;
typedef MEMORY_BASIC_INFORMATION *PMEMORY_BASIC_INFORMATION;
typedef struct _MEMORYSTATUS {
DWORD dwLength;
DWORD dwMemoryLoad;

View file

@ -1,7 +1,5 @@
#include <windows.h>
#include <kernel32/proc.h>
#include <kernel32/heap.h>
#include <crtdll/malloc.h>
int _heapchk (void)

View file

@ -4,18 +4,18 @@
* FILE: lib/kernel32/misc/except.c
* PURPOSE: Exception functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ]
* modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ]
* UPDATE HISTORY:
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
typedef LONG (STDCALL *LPTOP_LEVEL_EXCEPTION_FILTER)(
struct _EXCEPTION_POINTERS *ExceptionInfo
);
);
UINT GlobalErrMode;
LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter;
@ -51,16 +51,6 @@ SetUnhandledExceptionFilter(
}
LONG
STDCALL
UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
@ -69,20 +59,18 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
HANDLE DebugPort;
NTSTATUS errCode;
if(ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION) {
// might check read only resource
// Is there a debugger running ?
errCode = NtQueryInformationProcess(NtCurrentProcess(),ProcessDebugPort,&DebugPort,sizeof(HANDLE),NULL);
if ( !NT_SUCCESS(errCode) ) {
if ( !NT_SUCCESS(errCode) ) {
SetLastError(RtlNtStatusToDosError(errCode));
return EXCEPTION_EXECUTE_HANDLER;
}
if ( DebugPort ) {
//return EXCEPTION_CONTINUE_SEARCH;
}
if(GlobalTopLevelExceptionFilter != NULL) {
if(GlobalTopLevelExceptionFilter != NULL) {
dbgRet = GlobalTopLevelExceptionFilter(ExceptionInfo);
if(dbgRet == EXCEPTION_EXECUTE_HANDLER)
return EXCEPTION_EXECUTE_HANDLER;
@ -107,10 +95,3 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
return EXCEPTION_EXECUTE_HANDLER;
}

View file

@ -11,8 +11,8 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -12,8 +12,8 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -10,8 +10,8 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -8,8 +8,8 @@
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#define NDEBUG
#include <kernel32/kernel32.h>

View file

@ -14,8 +14,8 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <string.h>
#include <wchar.h>

View file

@ -8,8 +8,8 @@
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
WINBOOL
@ -25,27 +25,24 @@ DefineDosDeviceA(
WCHAR DeviceNameW[MAX_PATH];
WCHAR TargetPathW[MAX_PATH];
i = 0;
while ((*lpDeviceName)!=0 && i < MAX_PATH)
{
i = 0;
while ((*lpDeviceName)!=0 && i < MAX_PATH)
{
DeviceNameW[i] = *lpDeviceName;
lpDeviceName++;
i++;
}
DeviceNameW[i] = 0;
}
DeviceNameW[i] = 0;
i = 0;
while ((*lpTargetPath)!=0 && i < MAX_PATH)
{
while ((*lpTargetPath)!=0 && i < MAX_PATH)
{
TargetPathW[i] = *lpTargetPath;
lpTargetPath++;
i++;
}
TargetPathW[i] = 0;
}
TargetPathW[i] = 0;
return DefineDosDeviceW(dwFlags,DeviceNameW,TargetPathW);
}

View file

@ -11,8 +11,8 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* $Id: find.c,v 1.21 1999/08/29 06:59:01 ea Exp $
/* $Id: find.c,v 1.22 1999/10/07 23:43:28 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -11,9 +11,9 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <ddk/ntddk.h>
#include <string.h>
#define NDEBUG

View file

@ -8,8 +8,8 @@
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
@ -48,7 +48,7 @@ CreateIoCompletionPort(
return FALSE;
}
if ( ExistingCompletionPort != NULL ) {
if ( ExistingCompletionPort != NULL ) {
CompletionPort = ExistingCompletionPort;
}
else {
@ -77,7 +77,6 @@ CreateIoCompletionPort(
}
WINBOOL
STDCALL
GetQueuedCompletionStatus(
@ -88,7 +87,6 @@ GetQueuedCompletionStatus(
DWORD dwMilliseconds
)
{
NTSTATUS errCode;
ULONG CompletionStatus;
LARGE_INTEGER TimeToWait;
@ -100,11 +98,9 @@ GetQueuedCompletionStatus(
}
return TRUE;
}
WINBOOL
STDCALL
PostQueuedCompletionStatus(
@ -114,16 +110,14 @@ PostQueuedCompletionStatus(
LPOVERLAPPED lpOverlapped
)
{
NTSTATUS errCode;
errCode = NtSetIoCompletion(CompletionPort, dwCompletionKey, (PIO_STATUS_BLOCK)lpOverlapped , 0, (PULONG)&dwNumberOfBytesTransferred );
NTSTATUS errCode;
errCode = NtSetIoCompletion(CompletionPort, dwCompletionKey, (PIO_STATUS_BLOCK)lpOverlapped , 0, (PULONG)&dwNumberOfBytesTransferred );
if ( !NT_SUCCESS(errCode) ) {
if ( !NT_SUCCESS(errCode) ) {
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
}
return TRUE;
}
return TRUE;
}
@ -138,11 +132,3 @@ FileIOCompletionRoutine(
{
return;
}

View file

@ -13,8 +13,8 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -13,8 +13,8 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -9,8 +9,8 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -10,8 +10,8 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -18,8 +18,8 @@
* Copyright 1996 Alexandre Julliard
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <stdio.h>

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <kernel32/kernel32.h>

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
BOOL KERNEL32_AnsiToUnicode(PWSTR DestStr,

View file

@ -1,4 +1,4 @@
/* $Id: section.c,v 1.4 1999/10/03 23:19:15 ea Exp $
/* $Id: section.c,v 1.5 1999/10/07 23:44:28 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -9,7 +9,6 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
/* FUNCTIONS *****************************************************************/
@ -31,6 +30,16 @@ CreateFileMappingA (
OBJECT_ATTRIBUTES ObjectAttributes;
ANSI_STRING AnsiName;
UNICODE_STRING UnicodeName;
PSECURITY_DESCRIPTOR SecurityDescriptor;
if (lpFileMappingAttributes)
{
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
}
else
{
SecurityDescriptor = NULL;
}
MaximumSize.u.LowPart = dwMaximumSizeLow;
MaximumSize.u.HighPart = dwMaximumSizeHigh;
@ -40,8 +49,8 @@ CreateFileMappingA (
&UnicodeName,
0,
NULL,
lpFileMappingAttributes);
Status = ZwCreateSection(&SectionHandle,
SecurityDescriptor);
Status = NtCreateSection(&SectionHandle,
SECTION_ALL_ACCESS,
&ObjectAttributes,
&MaximumSize,
@ -74,6 +83,16 @@ CreateFileMappingW (
LARGE_INTEGER MaximumSize;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeName;
PSECURITY_DESCRIPTOR SecurityDescriptor;
if (lpFileMappingAttributes)
{
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
}
else
{
SecurityDescriptor = NULL;
}
MaximumSize.u.LowPart = dwMaximumSizeLow;
MaximumSize.u.HighPart = dwMaximumSizeHigh;
@ -82,8 +101,8 @@ CreateFileMappingW (
&UnicodeName,
0,
NULL,
lpFileMappingAttributes);
Status = ZwCreateSection(&SectionHandle,
SecurityDescriptor);
Status = NtCreateSection(&SectionHandle,
SECTION_ALL_ACCESS,
&ObjectAttributes,
&MaximumSize,
@ -112,10 +131,6 @@ MapViewOfFileEx (
)
{
NTSTATUS Status;
LARGE_INTEGER SectionOffset;
ULONG ViewSize;
ULONG Protect;
@ -124,11 +139,6 @@ MapViewOfFileEx (
SectionOffset.u.LowPart = dwFileOffsetLow;
SectionOffset.u.HighPart = dwFileOffsetHigh;
if ( ( dwDesiredAccess & FILE_MAP_WRITE ) == FILE_MAP_WRITE )
Protect = PAGE_READWRITE;
else if ( ( dwDesiredAccess & FILE_MAP_READ ) == FILE_MAP_READ )
@ -140,7 +150,6 @@ MapViewOfFileEx (
else
Protect = PAGE_READWRITE;
Status = ZwMapViewOfSection(hFileMappingObject,
NtCurrentProcess(),
&BaseAddress,
@ -154,14 +163,13 @@ MapViewOfFileEx (
if (!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return NULL;
}
return BaseAddress;
}
LPVOID
@ -188,7 +196,7 @@ UnmapViewOfFile (
NTSTATUS Status;
Status = NtUnmapViewOfSection(NtCurrentProcess(),lpBaseAddress);
if (!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
@ -202,8 +210,8 @@ HANDLE
STDCALL
OpenFileMappingA (
DWORD dwDesiredAccess,
WINBOOL bInheritHandle,
LPCSTR lpName
WINBOOL bInheritHandle,
LPCSTR lpName
)
{
NTSTATUS Status;
@ -226,7 +234,7 @@ OpenFileMappingA (
Attributes,
NULL,
NULL);
Status = ZwOpenSection(&SectionHandle,
Status = NtOpenSection(&SectionHandle,
SECTION_ALL_ACCESS,
&ObjectAttributes
);
@ -244,8 +252,8 @@ HANDLE
STDCALL
OpenFileMappingW (
DWORD dwDesiredAccess,
WINBOOL bInheritHandle,
LPCWSTR lpName
WINBOOL bInheritHandle,
LPCWSTR lpName
)
{
NTSTATUS Status;
@ -276,5 +284,4 @@ OpenFileMappingW (
return SectionHandle;
}
/* EOF */

View file

@ -8,8 +8,8 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
/* FUNCTIONS *****************************************************************/

View file

@ -4,11 +4,12 @@
* FILE: lib/kernel32/misc/atom.c
* PURPOSE: Atom functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ]
* modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ]
* UPDATE HISTORY:
* Created 01/11/98
*/
#include <ddk/ntddk.h>
#include <kernel32/atom.h>
#include <kernel32/proc.h>
#include <kernel32/thread.h>

View file

@ -9,9 +9,9 @@
* 19990204 EA SetConsoleTitleA
* 19990306 EA Stubs
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <ddk/ntddblue.h>
#include <windows.h>
#include <assert.h>
#include <wchar.h>

View file

@ -8,8 +8,8 @@
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <kernel32/proc.h>
#include <internal/teb.h>

View file

@ -8,8 +8,8 @@
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <string.h>
@ -66,7 +66,7 @@ GetEnvironmentVariableW(
while (i < nEnvVar)
{
if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) {
if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) {
lstrcpynW(lpBuffer,Environment[i].Value.Buffer,min(nSize,Environment[i].Value.Length/sizeof(WCHAR)));
return lstrlenW(Environment[i].Value.Buffer);
@ -92,27 +92,26 @@ SetEnvironmentVariableA(
int i=0;
while ((*lpName)!=0 && i < MAX_PATH)
{
{
NameW[i] = *lpName;
lpName++;
i++;
}
NameW[i] = 0;
}
NameW[i] = 0;
i = 0;
while ((*lpValue)!=0 && i < MAX_PATH)
{
{
ValueW[i] = *lpValue;
lpValue++;
i++;
}
ValueW[i] = 0;
}
ValueW[i] = 0;
return SetEnvironmentVariableW(NameW,ValueW);
}
WINBOOL
STDCALL
SetEnvironmentVariableW(
@ -130,7 +129,7 @@ SetEnvironmentVariableW(
while (i < nEnvVar)
{
if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) {
if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) {
if ( lpValue != NULL ) {
lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,Environment[i].Value.MaximumLength/sizeof(WCHAR)));
return TRUE;
@ -141,9 +140,6 @@ SetEnvironmentVariableW(
Environment[i].Name.Length = 0;
return FALSE;
}
}
i++;
}
@ -173,14 +169,10 @@ SetEnvironmentVariableW(
lstrcpynW(Environment[i].Name.Buffer,lpValue,min(NameLen,(Environment[i].Name.MaximumLength-sizeof(WCHAR))/sizeof(WCHAR)));
Environment[i].Name.Length = NameLen*sizeof(WCHAR);
lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,(Environment[i].Value.MaximumLength-sizeof(WCHAR)))/sizeof(WCHAR));
Environment[i].Value.Length = ValueLen*sizeof(WCHAR);
return TRUE;
}
DWORD
@ -197,7 +189,6 @@ GetVersion(VOID)
Version |= ( VersionInformation.dwPlatformId << 16 );
return Version;
}
@ -233,10 +224,9 @@ GetVersionExA(
}
LPSTR STDCALL GetEnvironmentStringsA(VOID)
LPSTR
STDCALL
GetEnvironmentStringsA(VOID)
{
#if 0
WCHAR *EnvironmentStringsW;
@ -271,7 +261,9 @@ LPSTR STDCALL GetEnvironmentStringsA(VOID)
}
LPWSTR STDCALL GetEnvironmentStringsW(VOID)
LPWSTR
STDCALL
GetEnvironmentStringsW(VOID)
{
#if 0
int size = 0;

View file

@ -1,9 +1,8 @@
/* $Id: error.c,v 1.11 1999/08/29 06:59:02 ea Exp $
/* $Id: error.c,v 1.12 1999/10/07 23:45:07 ekohl Exp $
*
* reactos/lib/kernel32/misc/error.c
*
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <ddk/ntddbeep.h>

View file

@ -7,9 +7,8 @@
* UPDATE HISTORY:
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
@ -34,10 +33,9 @@ GetHandleInformation(
if ( HandleInfo.bProtectFromClose )
*lpdwFlags &= HANDLE_FLAG_PROTECT_FROM_CLOSE;
return TRUE;
}
WINBOOL
STDCALL
SetHandleInformation(
@ -72,25 +70,22 @@ SetHandleInformation(
}
WINBOOL
STDCALL
CloseHandle( HANDLE hObject )
{
NTSTATUS errCode;
errCode = NtClose(hObject);
if(!NT_SUCCESS(errCode)) {
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
errCode = NtClose(hObject);
if(!NT_SUCCESS(errCode)) {
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
}
return TRUE;
}
WINBOOL
STDCALL
DuplicateHandle(
@ -103,8 +98,6 @@ DuplicateHandle(
DWORD dwOptions
)
{
NTSTATUS errCode;
errCode = NtDuplicateObject(hSourceProcessHandle,hSourceHandle,hTargetProcessHandle,lpTargetHandle, dwDesiredAccess, (BOOLEAN)bInheritHandle,dwOptions);
@ -113,10 +106,7 @@ DuplicateHandle(
return FALSE;
}
return TRUE;
}
UINT STDCALL
@ -124,10 +114,3 @@ SetHandleCount(UINT nCount)
{
return nCount;
}

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.6 1999/10/03 23:19:15 ea Exp $
/* $Id: stubs.c,v 1.7 1999/10/07 23:45:07 ekohl Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
@ -815,8 +815,6 @@ ExitVDM (
}
DWORD
STDCALL
ExpungeConsoleCommandHistoryW (
@ -985,12 +983,11 @@ FindResourceExA (
}
WINBOOL
STDCALL
FlushViewOfFile (
FlushViewOfFile(
LPCVOID lpBaseAddress,
DWORD dwNumberOfBytesToFlush
DWORD dwNumberOfBytesToFlush
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
@ -1013,7 +1010,6 @@ FoldStringW (
}
int
STDCALL
FoldStringA (
@ -1029,7 +1025,6 @@ FoldStringA (
}
DWORD
STDCALL
FormatMessageW (
@ -2713,8 +2708,6 @@ InitAtomTable (
}
DWORD
STDCALL
InvalidateConsoleDIBits (
@ -2727,8 +2720,6 @@ InvalidateConsoleDIBits (
}
WINBOOL
STDCALL
IsDBCSLeadByte (
@ -2991,7 +2982,6 @@ LockResource (
}
int
STDCALL
MulDiv (
@ -3815,8 +3805,6 @@ TrimVirtualBuffer (
}
WINBOOL
STDCALL
UpdateResourceA (
@ -3922,9 +3910,6 @@ VirtualBufferExceptionHandler (
}
WINBOOL
STDCALL
WaitCommEvent (
@ -4020,9 +4005,6 @@ WriteConsoleInputVDMW (
}
WINBOOL
STDCALL
WritePrivateProfileSectionA (

View file

@ -11,9 +11,8 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <string.h>
#include <windows.h>
#include <internal/string.h>
#include <string.h>

View file

@ -11,6 +11,7 @@
/* INCLUDES ****************************************************************/
#define UNICODE
#include <ddk/ntddk.h>
#include <windows.h>
#include <kernel32/proc.h>
#include <kernel32/thread.h>

View file

@ -11,6 +11,7 @@
/* INCLUDES ****************************************************************/
#define WIN32_NO_PEHDR
#include <ddk/ntddk.h>
#include <windows.h>
#include <kernel32/proc.h>
#include <kernel32/thread.h>

View file

@ -1,4 +1,4 @@
/* $Id: lib.c,v 1.3 1999/08/29 06:59:03 ea Exp $
/* $Id: lib.c,v 1.4 1999/10/07 23:45:25 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -12,6 +12,7 @@
/* INCLUDES ****************************************************************/
#define UNICODE
#include <ddk/ntddk.h>
#include <windows.h>
#include <kernel32/proc.h>
#include <kernel32/thread.h>

View file

@ -1,4 +1,4 @@
/* $Id: proc.c,v 1.20 1999/09/12 20:58:29 ekohl Exp $
/* $Id: proc.c,v 1.21 1999/10/07 23:45:25 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -12,6 +12,7 @@
/* INCLUDES ****************************************************************/
#define UNICODE
#include <ddk/ntddk.h>
#include <windows.h>
#include <kernel32/proc.h>
#include <kernel32/thread.h>

View file

@ -32,6 +32,7 @@ lstrcmpiA(
{
return _stricmp(lpString1,lpString2);
}
LPSTR
STDCALL
lstrcpynA(
@ -75,9 +76,9 @@ lstrlenA(
int
STDCALL
lstrcmpW(
LPCWSTR lpString1,
LPCWSTR lpString2
)
LPCWSTR lpString1,
LPCWSTR lpString2
)
{
return wcscmp(lpString1,lpString2);
}
@ -130,7 +131,6 @@ lstrlenW(
)
{
return wcslen(lpString);
}

View file

@ -8,8 +8,8 @@
* Created 01/11/98
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>

View file

@ -8,8 +8,8 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <windows.h>
/* FUNCTIONS *****************************************************************/

View file

@ -8,9 +8,9 @@
* Created 01/11/98
*/
#include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h>
#include <ddk/ntddk.h>
HANDLE
STDCALL

View file

@ -11,9 +11,9 @@
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <windows.h>
#include <kernel32/thread.h>
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/i386/segment.h>

View file

@ -4,16 +4,16 @@
* FILE: lib/kernel32/thread/tls.c
* PURPOSE: Thread functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
* Tls functions are modified from WINE
* Tls functions are modified from WINE
* UPDATE HISTORY:
* Created 01/11/98
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <windows.h>
#include <kernel32/thread.h>
#include <ddk/ntddk.h>
#include <string.h>
/* FUNCTIONS *****************************************************************/

View file

@ -12,9 +12,6 @@
#define WIN32_NO_PEHDR
#include <ddk/ntddk.h>
//#include <windows.h>
//#include <kernel32/proc.h>
//#include <kernel32/thread.h>
#include <wchar.h>
#include <string.h>
#include <pe.h>
@ -23,7 +20,7 @@
#include <internal/teb.h>
#include <ntdll/base.h>
//#define NDEBUG
#define NDEBUG
#include <ntdll/ntdll.h>
/* FUNCTIONS ****************************************************************/

View file

@ -1,4 +1,3 @@
#include <windows.h>
#include <ddk/ntddk.h>
#define STUB(x) void x(void) { UNICODE_STRING UnicodeString; \

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.18 1999/08/29 06:59:05 ea Exp $
/* $Id: registry.c,v 1.19 1999/10/07 23:33:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,7 +11,6 @@
*/
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <wchar.h>

View file

@ -24,6 +24,7 @@
/* Note: Bias[minutes] = UTC - local time */
TIME_ZONE_INFORMATION SystemTimeZoneInfo;
/* FUNCTIONS ****************************************************************/
VOID
@ -36,6 +37,7 @@ ExInitTimeZoneInfo (VOID)
}
NTSTATUS
STDCALL
NtSetSystemTime (

View file

@ -10,7 +10,6 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/debug.h>

View file

@ -10,7 +10,7 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/ke.h>
#include <internal/symbol.h>

View file

@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/ke.h>
#include <internal/hal.h>

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/ke.h>
#include <internal/symbol.h>

View file

@ -10,7 +10,6 @@
/* INCLUDES ***************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
/* FUNCTIONS *****************************************************************/

View file

@ -14,7 +14,6 @@
/* INCLUDES ***************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
/* FUNCTIONS **************************************************************/

View file

@ -11,22 +11,24 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <string.h>
#include <internal/string.h>
#include <internal/mmhal.h>
#include <internal/halio.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS ******************************************************************/
//#define BOCHS_DEBUGGING 1
//#define SERIAL_DEBUGGING
#define SERIAL_PORT 0x03f8
#define SERIAL_BAUD_RATE 19200
#define SERIAL_LINE_CONTROL (SR_LCR_CS8 | SR_LCR_ST1 | SR_LCR_PNO)
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS ******************************************************************/
#define IDMAP_BASE (0xd0000000)

View file

@ -1,4 +1,15 @@
#include <windows.h>
/* $Id: usercall.c,v 1.4 1999/10/07 23:35:10 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/usercall.c
* PURPOSE: 2E interrupt handler
* PROGRAMMER: ???
* UPDATE HISTORY:
* ???
*/
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/ke.h>
#include <internal/symbol.h>

View file

@ -10,7 +10,6 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/io.h>
#include <string.h>

View file

@ -10,7 +10,6 @@
/* INCLUDES ***************************************************************/
#include <wchar.h>
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <internal/io.h>

View file

@ -10,7 +10,6 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <internal/io.h>

View file

@ -8,7 +8,6 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#define NDEBUG

View file

@ -8,7 +8,6 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/debug.h>

View file

@ -8,7 +8,6 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/ps.h>

View file

@ -10,8 +10,8 @@
/* INCLUDES *****************************************************************/
#include <internal/ke.h>
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/debug.h>

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.22 1999/08/29 06:59:10 ea Exp $
/* $Id: main.c,v 1.23 1999/10/07 23:36:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,8 +11,7 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/version.h>
#include <internal/mm.h>

View file

@ -14,7 +14,6 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ke.h>
@ -73,6 +72,7 @@ static BOOLEAN KeDispatcherObjectWakeAll(DISPATCHER_HEADER* hdr)
{
PKWAIT_BLOCK current;
PLIST_ENTRY current_entry;
PKWAIT_BLOCK PrevBlock;
DPRINT("KeDispatcherObjectWakeAll(hdr %x)\n",hdr);
@ -88,9 +88,42 @@ static BOOLEAN KeDispatcherObjectWakeAll(DISPATCHER_HEADER* hdr)
WaitListEntry);
DPRINT("Waking %x\n",current->Thread);
if (current->NextWaitBlock != NULL)
if (current->WaitType == WaitAny)
{
DbgPrint("DANGLING POINTERS!!! We're in trouble!\n");
DPRINT("WaitAny: Remove all wait blocks.\n");
current->Thread->WaitBlockList = NULL;
}
else
{
DPRINT("WaitAll: Remove the current wait block only.\n");
PrevBlock = current->Thread->WaitBlockList;
if (PrevBlock)
{
if (PrevBlock->NextWaitBlock == current)
{
DPRINT("WaitAll: Current block is list head.\n");
PrevBlock->NextWaitBlock = current->NextWaitBlock;
}
else
{
DPRINT("WaitAll: Current block is list head.\n");
while (PrevBlock &&
PrevBlock->NextWaitBlock != current)
{
PrevBlock = PrevBlock->NextWaitBlock;
}
if (PrevBlock)
{
PrevBlock->NextWaitBlock = current->NextWaitBlock;
}
}
}
else
{
DPRINT("WaitAll: Wait Block List is empty!\n");
}
}
PsResumeThread(CONTAINING_RECORD(current->Thread,ETHREAD,Tcb));
@ -102,6 +135,7 @@ static BOOLEAN KeDispatcherObjectWakeOne(DISPATCHER_HEADER* hdr)
{
PKWAIT_BLOCK current;
PLIST_ENTRY current_entry;
PKWAIT_BLOCK PrevBlock;
DPRINT("KeDispatcherObjectWakeOn(hdr %x)\n",hdr);
DPRINT("hdr->WaitListHead.Flink %x hdr->WaitListHead.Blink %x\n",
@ -114,6 +148,45 @@ static BOOLEAN KeDispatcherObjectWakeOne(DISPATCHER_HEADER* hdr)
current = CONTAINING_RECORD(current_entry,KWAIT_BLOCK,
WaitListEntry);
DPRINT("current_entry %x current %x\n",current_entry,current);
if (current->WaitType == WaitAny)
{
DPRINT("WaitAny: Remove all wait blocks.\n");
current->Thread->WaitBlockList = NULL;
}
else
{
DPRINT("WaitAll: Remove the current wait block only.\n");
PrevBlock = current->Thread->WaitBlockList;
if (PrevBlock)
{
if (PrevBlock->NextWaitBlock == current)
{
DPRINT("WaitAll: Current block is list head.\n");
PrevBlock->NextWaitBlock = current->NextWaitBlock;
}
else
{
DPRINT("WaitAll: Current block is list head.\n");
while (PrevBlock && PrevBlock->NextWaitBlock != current)
{
PrevBlock = PrevBlock->NextWaitBlock;
}
if (PrevBlock)
{
PrevBlock->NextWaitBlock = current->NextWaitBlock;
}
}
}
else
{
DPRINT("WaitAll: Wait Block List is empty!\n");
}
}
DPRINT("Waking %x\n",current->Thread);
if (hdr->Type == SemaphoreType)
hdr->SignalState--;
@ -163,7 +236,7 @@ BOOLEAN KeDispatcherObjectWake(DISPATCHER_HEADER* hdr)
case ID_THREAD_OBJECT:
return(KeDispatcherObjectWakeAll(hdr));
}
DbgPrint("Dispatcher object %x has unknown type\n",hdr);
DPRINT("Dispatcher object %x has unknown type\n",hdr);
KeBugCheck(0);
return(FALSE);
}
@ -190,10 +263,13 @@ NTSTATUS KeWaitForSingleObject(PVOID Object,
{
DISPATCHER_HEADER* hdr = (DISPATCHER_HEADER *)Object;
KWAIT_BLOCK blk;
PKTHREAD CurrentThread;
DPRINT("Entering KeWaitForSingleObject(Object %x) "
"PsGetCurrentThread() %x\n",Object,PsGetCurrentThread());
CurrentThread = KeGetCurrentThread();
KeAcquireDispatcherDatabaseLock(FALSE);
DPRINT("hdr->SignalState %d\n", hdr->SignalState);
@ -225,18 +301,21 @@ NTSTATUS KeWaitForSingleObject(PVOID Object,
}
KeReleaseDispatcherDatabaseLock(FALSE);
return(STATUS_SUCCESS);
return(STATUS_WAIT_0);
}
if (Timeout != NULL)
{
KeAddThreadTimeout(KeGetCurrentThread(),Timeout);
KeAddThreadTimeout(CurrentThread,Timeout);
}
blk.Object=Object;
blk.Thread=KeGetCurrentThread();
/* Append wait block to the KTHREAD wait block list */
CurrentThread->WaitBlockList = &blk;
blk.Object = Object;
blk.Thread = CurrentThread;
blk.WaitKey = 0;
blk.WaitType = WaitAll;
blk.WaitType = WaitAny;
blk.NextWaitBlock = NULL;
InsertTailList(&(hdr->WaitListHead),&(blk.WaitListEntry));
// DPRINT("hdr->WaitListHead.Flink %x hdr->WaitListHead.Blink %x\n",
@ -249,9 +328,11 @@ NTSTATUS KeWaitForSingleObject(PVOID Object,
if (Timeout != NULL)
{
KeCancelTimer(&KeGetCurrentThread()->Timer);
if (KeReadStateTimer(&KeGetCurrentThread()->Timer))
return(STATUS_TIMEOUT);
}
DPRINT("Returning from KeWaitForSingleObject()\n");
return(STATUS_SUCCESS);
return(STATUS_WAIT_0);
}
NTSTATUS KeWaitForMultipleObjects(ULONG Count,
@ -265,24 +346,32 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
{
DISPATCHER_HEADER* hdr;
PKWAIT_BLOCK blk;
PKTHREAD CurrentThread;
ULONG CountSignaled;
ULONG i;
DbgPrint("Entering KeWaitForMultipleObjects(Count %lu Object[] %p) "
DPRINT("Entering KeWaitForMultipleObjects(Count %lu Object[] %p) "
"PsGetCurrentThread() %x\n",Count,Object,PsGetCurrentThread());
CountSignaled = 0;
CurrentThread = KeGetCurrentThread();
if (WaitBlockArray == NULL)
{
DbgPrint("FIXME: Use internal wait blocks!\n");
return STATUS_UNSUCCESSFUL;
if (Count > 3)
{
DbgPrint("(%s:%d) Too many objects!\n",
__FILE__,__LINE__);
return STATUS_UNSUCCESSFUL;
}
blk = &CurrentThread->WaitBlock[1];
}
else
{
if (Count > 64)
{
DbgPrint("Too many objects!\n");
DbgPrint("(%s:%d) Too many objects!\n",
__FILE__,__LINE__);
return STATUS_UNSUCCESSFUL;
}
blk = WaitBlockArray;
@ -294,7 +383,7 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
{
hdr = (DISPATCHER_HEADER *)Object[i];
// DbgPrint("hdr->SignalState %d\n", hdr->SignalState);
DPRINT("hdr->SignalState %d\n", hdr->SignalState);
if (hdr->SignalState > 0)
{
@ -327,8 +416,8 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
if (WaitType == WaitAny)
{
KeReleaseDispatcherDatabaseLock(FALSE);
DbgPrint("One object is already signaled!\n");
return(STATUS_SUCCESS);
DPRINT("One object is already signaled!\n");
return(STATUS_WAIT_0 + i);
}
}
}
@ -336,30 +425,33 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
if ((WaitType == WaitAll) && (CountSignaled == Count))
{
KeReleaseDispatcherDatabaseLock(FALSE);
DbgPrint("All objects are already signaled!\n");
return(STATUS_SUCCESS);
DPRINT("All objects are already signaled!\n");
return(STATUS_WAIT_0);
}
if (Timeout != NULL)
{
KeAddThreadTimeout(KeGetCurrentThread(),Timeout);
KeAddThreadTimeout(CurrentThread,Timeout);
}
/* Append wait block to the KTHREAD wait block list */
CurrentThread->WaitBlockList = blk;
for (i = 0; i < Count; i++)
{
hdr = (DISPATCHER_HEADER *)Object[i];
DbgPrint("hdr->SignalState %d\n", hdr->SignalState);
DPRINT("hdr->SignalState %d\n", hdr->SignalState);
blk->Object=Object[i];
blk->Thread=KeGetCurrentThread();
blk->Object = Object[i];
blk->Thread = CurrentThread;
blk->WaitKey = i;
blk->WaitType = WaitType;
if (i == Count - 1)
blk->NextWaitBlock = NULL;
else
blk->NextWaitBlock = (PVOID)((ULONG)blk+sizeof(KWAIT_BLOCK));
DbgPrint("blk %p blk->NextWaitBlock %p\n",
DPRINT("blk %p blk->NextWaitBlock %p\n",
blk, blk->NextWaitBlock);
InsertTailList(&(hdr->WaitListHead),&(blk->WaitListEntry));
@ -371,18 +463,29 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
KeReleaseDispatcherDatabaseLock(FALSE);
DbgPrint("Waiting at %s:%d with irql %d\n", __FILE__, __LINE__,
KeGetCurrentIrql());
DPRINT("Waiting at %s:%d with irql %d\n", __FILE__, __LINE__,
KeGetCurrentIrql());
PsSuspendThread(PsGetCurrentThread());
if (Timeout != NULL)
{
KeCancelTimer(&KeGetCurrentThread()->Timer);
if (KeReadStateTimer(&KeGetCurrentThread()->Timer))
return(STATUS_TIMEOUT);
}
DbgPrint("Returning from KeWaitForMultipleObjects()\n");
DPRINT("Returning from KeWaitForMultipleObjects()\n");
return STATUS_SUCCESS;
if (WaitType == WaitAny)
{
for (i = 0; i < Count; i++)
{
if (((DISPATCHER_HEADER *)Object[i])->SignalState)
return(STATUS_WAIT_0+i);
}
}
return(STATUS_WAIT_0);
}
VOID KeInitializeDispatcher(VOID)
@ -401,21 +504,16 @@ NtWaitForMultipleObjects (
IN PLARGE_INTEGER Time
)
{
KWAIT_BLOCK WaitBlockArray[64];
PVOID ObjectPtrArray[64];
// KWAIT_BLOCK WaitBlockArray[MAXIMUM_WAIT_OBJECTS];
// PVOID ObjectPtrArray[MAXIMUM_WAIT_OBJECTS];
KWAIT_BLOCK WaitBlockArray[64]; /* FIXME: use MAXIMUM_WAIT_OBJECTS instead */
PVOID ObjectPtrArray[64]; /* FIXME: use MAXIMUM_WAIT_OBJECTS instead */
NTSTATUS Status;
ULONG i, j;
DPRINT("NtWaitForMultipleObjects(Count %lu Object[] %x, Alertable %d, Time %x)\n",
Count,Object,Alertable,Time);
if (Count > 64)
// if (Count > MAXIMUM_WAIT_OBJECTS)
if (Count > 64) /* FIXME: use MAXIMUM_WAIT_OBJECTS instead */
return STATUS_UNSUCCESSFUL;
// return WAIT_FAIL; /* this must be returned by WaitForMultipleObjects */
/* reference all objects */
for (i = 0; i < Count; i++)

View file

@ -17,8 +17,7 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/i386/segment.h>
#include <internal/linkage.h>
#include <internal/module.h>
@ -29,7 +28,6 @@
#include <internal/string.h>
#include <internal/symbol.h>
#include <internal/teb.h>
#include <ddk/ntddk.h>
//#define NDEBUG
#include <internal/debug.h>

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.31 1999/09/05 12:40:20 ekohl Exp $
/* $Id: loader.c,v 1.32 1999/10/07 23:36:24 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,8 +17,7 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/i386/segment.h>
#include <internal/linkage.h>
#include <internal/module.h>
@ -30,8 +29,6 @@
#include <internal/string.h>
#include <internal/symbol.h>
#include <ddk/ntddk.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -1,4 +1,4 @@
/* $Id: syspath.c,v 1.1 1999/07/17 23:10:27 ea Exp $
/* $Id: syspath.c,v 1.2 1999/10/07 23:36:25 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,10 +11,9 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <wchar.h>
#include <string.h>
#include <ddk/ntddk.h>
/**********************************************************************

View file

@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/hal/io.h>
#include <internal/i386/segment.h>
#include <internal/stddef.h>

View file

@ -15,6 +15,7 @@
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#include <internal/stddef.h>
@ -26,7 +27,6 @@
#define NDEBUG
#include <internal/debug.h>
#include <ddk/ntddk.h>
#if 0

View file

@ -8,8 +8,8 @@
/* INCLUDES ****************************************************************/
#include <internal/ntoskrnl.h>
#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/pool.h>
#define NDEBUG

View file

@ -12,6 +12,7 @@
/* INCLUDE *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/mm.h>
#include <internal/mmhal.h>
#include <internal/ob.h>
@ -416,7 +417,82 @@ NtQueryVirtualMemory (
OUT PULONG ResultLength
)
{
UNIMPLEMENTED;
NTSTATUS Status;
PEPROCESS Process;
MEMORY_AREA* MemoryArea;
#if 0
DbgPrint("NtReadVirtualMemory(ProcessHandle %x, Address %x, "
"VirtualMemoryInformationClass %d, VirtualMemoryInformation %x, "
"Length %lu ResultLength %x)\n",ProcessHandle,Address,
VirtualMemoryInformationClass,VirtualMemoryInformation,
Length,ResultLength);
#endif
switch(VirtualMemoryInformationClass)
{
case MemoryBasicInformation:
{
PMEMORY_BASIC_INFORMATION Info =
(PMEMORY_BASIC_INFORMATION)VirtualMemoryInformation;
if (Length < sizeof(MEMORY_BASIC_INFORMATION))
{
ObDereferenceObject(Process);
return(STATUS_INFO_LENGTH_MISMATCH);
}
*ResultLength = sizeof(MEMORY_BASIC_INFORMATION);
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
NULL,
UserMode,
(PVOID*)(&Process),
NULL);
if (!NT_SUCCESS(Status))
{
// DbdPrint("NtQueryVirtualMemory() = %x\n",Status);
return(Status);
}
MemoryArea = MmOpenMemoryAreaByAddress(Process,
Address);
if (MemoryArea == NULL)
{
Info->State = MEM_FREE;
DbgPrint("Virtual memory at %p is free.\n", Address);
ObDereferenceObject(Process);
return (STATUS_SUCCESS);
}
if (MemoryArea->Type == MEMORY_AREA_COMMIT)
{
Info->State = MEM_COMMIT;
}
else
{
Info->State = MEM_RESERVE;
}
Info->BaseAddress = MemoryArea->BaseAddress;
Info->RegionSize = MemoryArea->Length;
DbgPrint("BaseAddress %p, Length %x\n",
Info->BaseAddress, Info->RegionSize);
ObDereferenceObject(Process);
return (STATUS_SUCCESS);
}
break;
}
return(STATUS_INVALID_INFO_CLASS);
// UNIMPLEMENTED;
}

View file

@ -1,4 +1,4 @@
/* $Id: handle.c,v 1.11 1999/08/29 06:59:11 ea Exp $
/* $Id: handle.c,v 1.12 1999/10/07 23:38:08 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,7 +11,6 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <string.h>

View file

@ -44,6 +44,7 @@ VOID PsTerminateCurrentThread(NTSTATUS ExitStatus)
CurrentThread->ThreadsProcess = NULL;
KeRaiseIrql(DISPATCH_LEVEL,&oldlvl);
CurrentThread->Tcb.State = THREAD_STATE_TERMINATED;
CurrentThread->Tcb.DispatcherHeader.SignalState = TRUE;
KeDispatcherObjectWake(&CurrentThread->Tcb.DispatcherHeader);
ZwYieldExecution();
for(;;);
@ -59,6 +60,7 @@ VOID PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus)
PiNrThreads--;
KeRaiseIrql(DISPATCH_LEVEL, &oldlvl);
Thread->Tcb.State = THREAD_STATE_TERMINATED;
Thread->Tcb.DispatcherHeader.SignalState = TRUE;
KeDispatcherObjectWake(&Thread->Tcb.DispatcherHeader);
ObDereferenceObject(Thread->ThreadsProcess);
Thread->ThreadsProcess = NULL;
@ -94,6 +96,7 @@ NtTerminateProcess (
PiTerminateProcessThreads(Process, ExitStatus);
KeRaiseIrql(DISPATCH_LEVEL, &oldlvl);
Process->Pcb.ProcessState = PROCESS_STATE_TERMINATED;
Process->Pcb.DispatcherHeader.SignalState = TRUE;
KeDispatcherObjectWake(&Process->Pcb.DispatcherHeader);
if (PsGetCurrentThread()->ThreadsProcess == Process)
{

View file

@ -8,7 +8,6 @@
/* INCLUDES **************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ps.h>

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.26 1999/09/06 21:28:33 ekohl Exp $
/* $Id: thread.c,v 1.27 1999/10/07 23:38:30 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -19,7 +19,6 @@
/* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/ob.h>
@ -398,6 +397,139 @@ PsInitThreadManagment(VOID)
}
static NTSTATUS
PsCreateTeb (HANDLE ProcessHandle,
PNT_TEB *TebPtr,
PETHREAD Thread,
PINITIAL_TEB InitialTeb)
{
MEMORY_BASIC_INFORMATION Info;
NTSTATUS Status;
ULONG ByteCount;
ULONG RegionSize;
ULONG TebSize;
PVOID TebBase;
NT_TEB Teb;
TebBase = (PVOID)0x7FFDE000;
TebSize = PAGESIZE;
while (TRUE)
{
Status = NtQueryVirtualMemory(ProcessHandle,
TebBase,
MemoryBasicInformation,
&Info,
sizeof(MEMORY_BASIC_INFORMATION),
&ByteCount);
if (!NT_SUCCESS(Status))
{
DbgPrint ("NtQueryVirtualMemory (Status %x)\n",Status);
return Status;
}
if (Info.State == MEM_FREE)
{
DbgPrint("Virtual memory at %p is free.\n",
TebBase);
}
else
{
DbgPrint("Virtual memory at %p is allocated (BaseAddress %p RegionSize %x).\n",
TebBase, Info.BaseAddress, Info.RegionSize);
}
if (Info.State == MEM_FREE)
{
break;
}
TebBase = Info.BaseAddress - TebSize;
}
// if (Info.State != MEM_FREE)
// return STATUS_SUCCESS;
/* The TEB must reside in user space */
Status = NtAllocateVirtualMemory(ProcessHandle,
&TebBase,
0,
&TebSize,
MEM_COMMIT,
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
DbgPrint ("TEB allocation failed!\n");
DbgPrint ("Status %x\n",Status);
return Status;
}
DbgPrint ("TebBase %p TebSize %lu\n", TebBase, TebSize);
/* set all pointers to and from the TEB */
Teb.Tib.Self = TebBase;
if (Thread->ThreadsProcess)
{
Teb.Peb = Thread->ThreadsProcess->Peb; /* No PEB yet!! */
}
/* store stack information from InitialTeb */
if (InitialTeb != NULL)
{
Teb.Tib.StackBase = InitialTeb->StackBase;
Teb.Tib.StackLimit = InitialTeb->StackLimit;
/*
* I don't know if this is really stored in a WNT-TEB,
* but it's needed to free the thread stack. (Eric Kohl)
*/
Teb.StackCommit = InitialTeb->StackCommit;
Teb.StackCommitMax = InitialTeb->StackCommitMax;
Teb.StackReserved = InitialTeb->StackReserved;
}
/* more initialization */
Teb.Cid.UniqueThread = Thread->Cid.UniqueThread;
Teb.Cid.UniqueProcess = Thread->Cid.UniqueProcess;
/* write TEB data into teb page */
Status = NtWriteVirtualMemory(ProcessHandle,
TebBase,
&Teb,
sizeof(NT_TEB),
&ByteCount);
if (!NT_SUCCESS(Status))
{
/* free TEB */
DbgPrint ("Writing TEB failed!\n");
RegionSize = 0;
NtFreeVirtualMemory(ProcessHandle,
TebBase,
&RegionSize,
MEM_RELEASE);
return Status;
}
/* FIXME: fs:[0] = TEB */
if (TebPtr != NULL)
{
// *TebPtr = (PNT_TEB)TebBase;
}
DbgPrint ("TEB allocated at %p\n", TebBase);
return Status;
}
NTSTATUS
STDCALL
NtCreateThread (
@ -412,6 +544,7 @@ NtCreateThread (
)
{
PETHREAD Thread;
PNT_TEB TebBase;
NTSTATUS Status;
DPRINT("NtCreateThread(ThreadHandle %x, PCONTEXT %x)\n",
@ -429,6 +562,19 @@ NtCreateThread (
{
return(Status);
}
Status = PsCreateTeb (ProcessHandle,
&TebBase,
Thread,
InitialTeb);
if (!NT_SUCCESS(Status))
{
return(Status);
}
/* Attention: TebBase is in user memory space */
// Thread->Tcb.Teb = TebBase;
Thread->StartAddress=NULL;
if (Client!=NULL)

View file

@ -10,9 +10,9 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/linkage.h>
#include <ddk/ntddk.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -8,7 +8,6 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#define NDEBUG

View file

@ -10,7 +10,6 @@
/* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <internal/debug.h>

View file

@ -290,7 +290,7 @@ NTSTATUS STDCALL NtAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN HANDLE ClientToken,
IN ACCESS_MASK DesiredAccess,
IN PGENERIC_MAPPING GenericMapping,
OUT PPRIVILEGE_SET PrivilegeSet,
OUT PPRIVILEGE_SET PrivilegeSet,
OUT PULONG ReturnLength,
OUT PULONG GrantedAccess,
OUT PBOOLEAN AccessStatus)