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 #define SystemTimeZoneInformation 44
// memory information
#define MemoryBasicInformation 0
// shutdown action // shutdown action
typedef enum SHUTDOWN_ACTION_TAG { typedef enum SHUTDOWN_ACTION_TAG {
@ -143,7 +147,12 @@ typedef enum SHUTDOWN_ACTION_TAG {
#define WaitAll 0 #define WaitAll 0
#define WaitAny 1 #define WaitAny 1
// number of wait objects
#define THREAD_WAIT_OBJECTS 3
//#define MAXIMUM_WAIT_OBJECTS 64
// key restore flags // key restore flags
#define REG_WHOLE_HIVE_VOLATILE 1 #define REG_WHOLE_HIVE_VOLATILE 1
@ -737,4 +746,4 @@ struct _LPC_PORT_BASIC_INFORMATION
} LPC_PORT_BASIC_INFORMATION, * PLPC_PORT_BASIC_INFORMATION; } LPC_PORT_BASIC_INFORMATION, * PLPC_PORT_BASIC_INFORMATION;
#endif #endif

View file

@ -363,6 +363,17 @@ typedef struct _DISK_GEOMETRY {
DWORD BytesPerSector; DWORD BytesPerSector;
} DISK_GEOMETRY ; } 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 { typedef struct _SYSTEMTIME {
WORD wYear; WORD wYear;
WORD wMonth; WORD wMonth;
@ -2700,17 +2711,6 @@ typedef struct tagMEASUREITEMSTRUCT {
DWORD itemData; DWORD itemData;
} MEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT; } 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 { typedef struct _MEMORYSTATUS {
DWORD dwLength; DWORD dwLength;
DWORD dwMemoryLoad; DWORD dwMemoryLoad;

View file

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

View file

@ -4,18 +4,18 @@
* FILE: lib/kernel32/misc/except.c * FILE: lib/kernel32/misc/except.c
* PURPOSE: Exception functions * PURPOSE: Exception functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl) * 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: * UPDATE HISTORY:
* Created 01/11/98 * Created 01/11/98
*/ */
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <windows.h>
typedef LONG (STDCALL *LPTOP_LEVEL_EXCEPTION_FILTER)( typedef LONG (STDCALL *LPTOP_LEVEL_EXCEPTION_FILTER)(
struct _EXCEPTION_POINTERS *ExceptionInfo struct _EXCEPTION_POINTERS *ExceptionInfo
); );
UINT GlobalErrMode; UINT GlobalErrMode;
LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter; LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter;
@ -51,17 +51,7 @@ SetUnhandledExceptionFilter(
} }
LONG
LONG
STDCALL STDCALL
UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo) UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
{ {
@ -69,20 +59,18 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
HANDLE DebugPort; HANDLE DebugPort;
NTSTATUS errCode; NTSTATUS errCode;
if(ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION) { if(ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION) {
// might check read only resource // might check read only resource
// Is there a debugger running ? // Is there a debugger running ?
errCode = NtQueryInformationProcess(NtCurrentProcess(),ProcessDebugPort,&DebugPort,sizeof(HANDLE),NULL); errCode = NtQueryInformationProcess(NtCurrentProcess(),ProcessDebugPort,&DebugPort,sizeof(HANDLE),NULL);
if ( !NT_SUCCESS(errCode) ) { if ( !NT_SUCCESS(errCode) ) {
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }
if ( DebugPort ) { if ( DebugPort ) {
//return EXCEPTION_CONTINUE_SEARCH; //return EXCEPTION_CONTINUE_SEARCH;
} }
if(GlobalTopLevelExceptionFilter != NULL) { if(GlobalTopLevelExceptionFilter != NULL) {
dbgRet = GlobalTopLevelExceptionFilter(ExceptionInfo); dbgRet = GlobalTopLevelExceptionFilter(ExceptionInfo);
if(dbgRet == EXCEPTION_EXECUTE_HANDLER) if(dbgRet == EXCEPTION_EXECUTE_HANDLER)
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
@ -91,7 +79,7 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
} }
} }
//if ( GetErrorMode() & SEM_NOGPFAULTERRORBOX == SEM_NOGPFAULTERRORBOX ) { //if ( GetErrorMode() & SEM_NOGPFAULTERRORBOX == SEM_NOGPFAULTERRORBOX ) {
// produce a stack trace or pop a message // produce a stack trace or pop a message
//sprintf( message, "Unhandled exception 0x%08lx at address 0x%08lx.", //sprintf( message, "Unhandled exception 0x%08lx at address 0x%08lx.",
@ -107,10 +95,3 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,8 +11,8 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h> #include <wchar.h>
#include <string.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -11,9 +11,9 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <windows.h> #include <windows.h>
#include <wchar.h> #include <wchar.h>
#include <ddk/ntddk.h>
#include <string.h> #include <string.h>
#define NDEBUG #define NDEBUG

View file

@ -8,34 +8,34 @@
* Created 01/11/98 * Created 01/11/98
*/ */
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h> #include <wchar.h>
typedef struct _FILE_COMPLETION_INFORMATION { typedef struct _FILE_COMPLETION_INFORMATION {
HANDLE CompletionPort; HANDLE CompletionPort;
ULONG CompletionKey; ULONG CompletionKey;
} FILE_COMPLETION_INFORMATION; } FILE_COMPLETION_INFORMATION;
typedef FILE_COMPLETION_INFORMATION *PFILE_COMPLETION_INFORMATION; typedef FILE_COMPLETION_INFORMATION *PFILE_COMPLETION_INFORMATION;
VOID VOID
STDCALL STDCALL
FileIOCompletionRoutine( FileIOCompletionRoutine(
DWORD dwErrorCode, DWORD dwErrorCode,
DWORD dwNumberOfBytesTransfered, DWORD dwNumberOfBytesTransfered,
LPOVERLAPPED lpOverlapped LPOVERLAPPED lpOverlapped
); );
HANDLE HANDLE
STDCALL STDCALL
CreateIoCompletionPort( CreateIoCompletionPort(
HANDLE FileHandle, HANDLE FileHandle,
HANDLE ExistingCompletionPort, HANDLE ExistingCompletionPort,
DWORD CompletionKey, DWORD CompletionKey,
DWORD NumberOfConcurrentThreads DWORD NumberOfConcurrentThreads
) )
{ {
HANDLE CompletionPort = NULL; HANDLE CompletionPort = NULL;
@ -48,7 +48,7 @@ CreateIoCompletionPort(
return FALSE; return FALSE;
} }
if ( ExistingCompletionPort != NULL ) { if ( ExistingCompletionPort != NULL ) {
CompletionPort = ExistingCompletionPort; CompletionPort = ExistingCompletionPort;
} }
else { else {
@ -57,27 +57,26 @@ CreateIoCompletionPort(
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));
return FALSE; return FALSE;
} }
} }
if ( FileHandle != INVALID_HANDLE_VALUE ) { if ( FileHandle != INVALID_HANDLE_VALUE ) {
CompletionInformation.CompletionPort = CompletionPort; CompletionInformation.CompletionPort = CompletionPort;
CompletionInformation.CompletionKey = CompletionKey; CompletionInformation.CompletionKey = CompletionKey;
errCode = NtSetInformationFile(FileHandle, &IoStatusBlock,&CompletionInformation,sizeof(FILE_COMPLETION_INFORMATION),FileCompletionInformation); errCode = NtSetInformationFile(FileHandle, &IoStatusBlock,&CompletionInformation,sizeof(FILE_COMPLETION_INFORMATION),FileCompletionInformation);
if ( !NT_SUCCESS(errCode) ) { if ( !NT_SUCCESS(errCode) ) {
if ( ExistingCompletionPort == NULL ) if ( ExistingCompletionPort == NULL )
NtClose(CompletionPort); NtClose(CompletionPort);
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));
return FALSE; return FALSE;
} }
} }
return CompletionPort; return CompletionPort;
} }
WINBOOL WINBOOL
STDCALL STDCALL
GetQueuedCompletionStatus( GetQueuedCompletionStatus(
@ -88,7 +87,6 @@ GetQueuedCompletionStatus(
DWORD dwMilliseconds DWORD dwMilliseconds
) )
{ {
NTSTATUS errCode; NTSTATUS errCode;
ULONG CompletionStatus; ULONG CompletionStatus;
LARGE_INTEGER TimeToWait; LARGE_INTEGER TimeToWait;
@ -99,50 +97,38 @@ GetQueuedCompletionStatus(
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
WINBOOL
WINBOOL
STDCALL STDCALL
PostQueuedCompletionStatus( PostQueuedCompletionStatus(
HANDLE CompletionPort, HANDLE CompletionPort,
DWORD dwNumberOfBytesTransferred, DWORD dwNumberOfBytesTransferred,
DWORD dwCompletionKey, DWORD dwCompletionKey,
LPOVERLAPPED lpOverlapped LPOVERLAPPED lpOverlapped
) )
{ {
NTSTATUS errCode;
errCode = NtSetIoCompletion(CompletionPort, dwCompletionKey, (PIO_STATUS_BLOCK)lpOverlapped , 0, (PULONG)&dwNumberOfBytesTransferred );
NTSTATUS errCode; if ( !NT_SUCCESS(errCode) ) {
errCode = NtSetIoCompletion(CompletionPort, dwCompletionKey, (PIO_STATUS_BLOCK)lpOverlapped , 0, (PULONG)&dwNumberOfBytesTransferred );
if ( !NT_SUCCESS(errCode) ) {
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
// this should be a place holder ?????????????????? // this should be a place holder ??????????????????
VOID VOID
STDCALL STDCALL
FileIOCompletionRoutine( FileIOCompletionRoutine(
DWORD dwErrorCode, DWORD dwErrorCode,
DWORD dwNumberOfBytesTransfered, DWORD dwNumberOfBytesTransfered,
LPOVERLAPPED lpOverlapped LPOVERLAPPED lpOverlapped
) )
{ {
return; return;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h> #include <stdarg.h>
BOOL KERNEL32_AnsiToUnicode(PWSTR DestStr, 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -9,7 +9,6 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -31,7 +30,17 @@ CreateFileMappingA (
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
ANSI_STRING AnsiName; ANSI_STRING AnsiName;
UNICODE_STRING UnicodeName; UNICODE_STRING UnicodeName;
PSECURITY_DESCRIPTOR SecurityDescriptor;
if (lpFileMappingAttributes)
{
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
}
else
{
SecurityDescriptor = NULL;
}
MaximumSize.u.LowPart = dwMaximumSizeLow; MaximumSize.u.LowPart = dwMaximumSizeLow;
MaximumSize.u.HighPart = dwMaximumSizeHigh; MaximumSize.u.HighPart = dwMaximumSizeHigh;
RtlInitAnsiString(&AnsiName, (LPSTR)lpName); RtlInitAnsiString(&AnsiName, (LPSTR)lpName);
@ -40,8 +49,8 @@ CreateFileMappingA (
&UnicodeName, &UnicodeName,
0, 0,
NULL, NULL,
lpFileMappingAttributes); SecurityDescriptor);
Status = ZwCreateSection(&SectionHandle, Status = NtCreateSection(&SectionHandle,
SECTION_ALL_ACCESS, SECTION_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&MaximumSize, &MaximumSize,
@ -74,7 +83,17 @@ CreateFileMappingW (
LARGE_INTEGER MaximumSize; LARGE_INTEGER MaximumSize;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeName; UNICODE_STRING UnicodeName;
PSECURITY_DESCRIPTOR SecurityDescriptor;
if (lpFileMappingAttributes)
{
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
}
else
{
SecurityDescriptor = NULL;
}
MaximumSize.u.LowPart = dwMaximumSizeLow; MaximumSize.u.LowPart = dwMaximumSizeLow;
MaximumSize.u.HighPart = dwMaximumSizeHigh; MaximumSize.u.HighPart = dwMaximumSizeHigh;
RtlInitUnicodeString(&UnicodeName, lpName); RtlInitUnicodeString(&UnicodeName, lpName);
@ -82,8 +101,8 @@ CreateFileMappingW (
&UnicodeName, &UnicodeName,
0, 0,
NULL, NULL,
lpFileMappingAttributes); SecurityDescriptor);
Status = ZwCreateSection(&SectionHandle, Status = NtCreateSection(&SectionHandle,
SECTION_ALL_ACCESS, SECTION_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&MaximumSize, &MaximumSize,
@ -112,10 +131,6 @@ MapViewOfFileEx (
) )
{ {
NTSTATUS Status; NTSTATUS Status;
LARGE_INTEGER SectionOffset; LARGE_INTEGER SectionOffset;
ULONG ViewSize; ULONG ViewSize;
ULONG Protect; ULONG Protect;
@ -124,23 +139,17 @@ MapViewOfFileEx (
SectionOffset.u.LowPart = dwFileOffsetLow; SectionOffset.u.LowPart = dwFileOffsetLow;
SectionOffset.u.HighPart = dwFileOffsetHigh; SectionOffset.u.HighPart = dwFileOffsetHigh;
if ( ( dwDesiredAccess & FILE_MAP_WRITE ) == FILE_MAP_WRITE )
if ( ( dwDesiredAccess & FILE_MAP_WRITE ) == FILE_MAP_WRITE )
Protect = PAGE_READWRITE; Protect = PAGE_READWRITE;
else if ( ( dwDesiredAccess & FILE_MAP_READ ) == FILE_MAP_READ ) else if ( ( dwDesiredAccess & FILE_MAP_READ ) == FILE_MAP_READ )
Protect = PAGE_READONLY; Protect = PAGE_READONLY;
else if ( ( dwDesiredAccess & FILE_MAP_ALL_ACCESS ) == FILE_MAP_ALL_ACCESS ) else if ( ( dwDesiredAccess & FILE_MAP_ALL_ACCESS ) == FILE_MAP_ALL_ACCESS )
Protect = PAGE_READWRITE; Protect = PAGE_READWRITE;
else if ( ( dwDesiredAccess & FILE_MAP_COPY ) == FILE_MAP_COPY ) else if ( ( dwDesiredAccess & FILE_MAP_COPY ) == FILE_MAP_COPY )
Protect = PAGE_WRITECOPY; Protect = PAGE_WRITECOPY;
else else
Protect = PAGE_READWRITE; Protect = PAGE_READWRITE;
Status = ZwMapViewOfSection(hFileMappingObject, Status = ZwMapViewOfSection(hFileMappingObject,
NtCurrentProcess(), NtCurrentProcess(),
&BaseAddress, &BaseAddress,
@ -154,14 +163,13 @@ MapViewOfFileEx (
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return NULL; return NULL;
} }
return BaseAddress; return BaseAddress;
} }
LPVOID LPVOID
@ -188,7 +196,7 @@ UnmapViewOfFile (
NTSTATUS Status; NTSTATUS Status;
Status = NtUnmapViewOfSection(NtCurrentProcess(),lpBaseAddress); Status = NtUnmapViewOfSection(NtCurrentProcess(),lpBaseAddress);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return FALSE; return FALSE;
@ -202,8 +210,8 @@ HANDLE
STDCALL STDCALL
OpenFileMappingA ( OpenFileMappingA (
DWORD dwDesiredAccess, DWORD dwDesiredAccess,
WINBOOL bInheritHandle, WINBOOL bInheritHandle,
LPCSTR lpName LPCSTR lpName
) )
{ {
NTSTATUS Status; NTSTATUS Status;
@ -211,12 +219,12 @@ OpenFileMappingA (
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
ANSI_STRING AnsiName; ANSI_STRING AnsiName;
UNICODE_STRING UnicodeName; UNICODE_STRING UnicodeName;
ULONG Attributes = 0; ULONG Attributes = 0;
if ( bInheritHandle ) if ( bInheritHandle )
Attributes = OBJ_INHERIT; Attributes = OBJ_INHERIT;
RtlInitAnsiString(&AnsiName, lpName); RtlInitAnsiString(&AnsiName, lpName);
RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
@ -226,7 +234,7 @@ OpenFileMappingA (
Attributes, Attributes,
NULL, NULL,
NULL); NULL);
Status = ZwOpenSection(&SectionHandle, Status = NtOpenSection(&SectionHandle,
SECTION_ALL_ACCESS, SECTION_ALL_ACCESS,
&ObjectAttributes &ObjectAttributes
); );
@ -244,20 +252,20 @@ HANDLE
STDCALL STDCALL
OpenFileMappingW ( OpenFileMappingW (
DWORD dwDesiredAccess, DWORD dwDesiredAccess,
WINBOOL bInheritHandle, WINBOOL bInheritHandle,
LPCWSTR lpName LPCWSTR lpName
) )
{ {
NTSTATUS Status; NTSTATUS Status;
HANDLE SectionHandle; HANDLE SectionHandle;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeName; UNICODE_STRING UnicodeName;
ULONG Attributes = 0; ULONG Attributes = 0;
if ( bInheritHandle ) if ( bInheritHandle )
Attributes = OBJ_INHERIT; Attributes = OBJ_INHERIT;
RtlInitUnicodeString(&UnicodeName, lpName); RtlInitUnicodeString(&UnicodeName, lpName);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&UnicodeName, &UnicodeName,
@ -276,5 +284,4 @@ OpenFileMappingW (
return SectionHandle; return SectionHandle;
} }
/* EOF */ /* EOF */

View file

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

View file

@ -4,11 +4,12 @@
* FILE: lib/kernel32/misc/atom.c * FILE: lib/kernel32/misc/atom.c
* PURPOSE: Atom functions * PURPOSE: Atom functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl) * 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: * UPDATE HISTORY:
* Created 01/11/98 * Created 01/11/98
*/ */
#include <ddk/ntddk.h>
#include <kernel32/atom.h> #include <kernel32/atom.h>
#include <kernel32/proc.h> #include <kernel32/proc.h>
#include <kernel32/thread.h> #include <kernel32/thread.h>

View file

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

View file

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

View file

@ -8,8 +8,8 @@
* Created 01/11/98 * Created 01/11/98
*/ */
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <windows.h>
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
@ -18,7 +18,7 @@
#define MAX_ENVIRONMENT_VARS 255 #define MAX_ENVIRONMENT_VARS 255
#define MAX_VALUE 1024 #define MAX_VALUE 1024
typedef struct _ENV_ELEMENT typedef struct _ENV_ELEMENT
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
UNICODE_STRING Value; UNICODE_STRING Value;
@ -66,7 +66,7 @@ GetEnvironmentVariableW(
while (i < nEnvVar) 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))); lstrcpynW(lpBuffer,Environment[i].Value.Buffer,min(nSize,Environment[i].Value.Length/sizeof(WCHAR)));
return lstrlenW(Environment[i].Value.Buffer); return lstrlenW(Environment[i].Value.Buffer);
@ -92,27 +92,26 @@ SetEnvironmentVariableA(
int i=0; int i=0;
while ((*lpName)!=0 && i < MAX_PATH) while ((*lpName)!=0 && i < MAX_PATH)
{ {
NameW[i] = *lpName; NameW[i] = *lpName;
lpName++; lpName++;
i++; i++;
} }
NameW[i] = 0; NameW[i] = 0;
i = 0; i = 0;
while ((*lpValue)!=0 && i < MAX_PATH) while ((*lpValue)!=0 && i < MAX_PATH)
{ {
ValueW[i] = *lpValue; ValueW[i] = *lpValue;
lpValue++; lpValue++;
i++; i++;
} }
ValueW[i] = 0; ValueW[i] = 0;
return SetEnvironmentVariableW(NameW,ValueW); return SetEnvironmentVariableW(NameW,ValueW);
} }
WINBOOL WINBOOL
STDCALL STDCALL
SetEnvironmentVariableW( SetEnvironmentVariableW(
@ -130,7 +129,7 @@ SetEnvironmentVariableW(
while (i < nEnvVar) 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 ) { if ( lpValue != NULL ) {
lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,Environment[i].Value.MaximumLength/sizeof(WCHAR))); lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,Environment[i].Value.MaximumLength/sizeof(WCHAR)));
return TRUE; return TRUE;
@ -141,9 +140,6 @@ SetEnvironmentVariableW(
Environment[i].Name.Length = 0; Environment[i].Name.Length = 0;
return FALSE; return FALSE;
} }
} }
i++; i++;
} }
@ -151,9 +147,9 @@ SetEnvironmentVariableW(
if ( nEnvVar >= MAX_ENVIRONMENT_VARS ) if ( nEnvVar >= MAX_ENVIRONMENT_VARS )
return FALSE; return FALSE;
while (i < nEnvVar) while (i < nEnvVar)
{ {
if ( Environment[i].Valid == FALSE ) if ( Environment[i].Valid == FALSE )
break; break;
i++; i++;
} }
@ -173,36 +169,31 @@ SetEnvironmentVariableW(
lstrcpynW(Environment[i].Name.Buffer,lpValue,min(NameLen,(Environment[i].Name.MaximumLength-sizeof(WCHAR))/sizeof(WCHAR))); lstrcpynW(Environment[i].Name.Buffer,lpValue,min(NameLen,(Environment[i].Name.MaximumLength-sizeof(WCHAR))/sizeof(WCHAR)));
Environment[i].Name.Length = NameLen*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)); lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,(Environment[i].Value.MaximumLength-sizeof(WCHAR)))/sizeof(WCHAR));
Environment[i].Value.Length = ValueLen*sizeof(WCHAR); Environment[i].Value.Length = ValueLen*sizeof(WCHAR);
return TRUE;
return TRUE;
} }
DWORD DWORD
STDCALL STDCALL
GetVersion(VOID) GetVersion(VOID)
{ {
DWORD Version = 0; DWORD Version = 0;
OSVERSIONINFO VersionInformation; OSVERSIONINFO VersionInformation;
GetVersionExW(&VersionInformation); GetVersionExW(&VersionInformation);
Version |= ( VersionInformation.dwMajorVersion << 8 ); Version |= ( VersionInformation.dwMajorVersion << 8 );
Version |= VersionInformation.dwMinorVersion; Version |= VersionInformation.dwMinorVersion;
Version |= ( VersionInformation.dwPlatformId << 16 ); Version |= ( VersionInformation.dwPlatformId << 16 );
return Version; return Version;
} }
WINBOOL WINBOOL
STDCALL STDCALL
GetVersionExW( GetVersionExW(
LPOSVERSIONINFO lpVersionInformation LPOSVERSIONINFO lpVersionInformation
@ -217,7 +208,7 @@ GetVersionExW(
return TRUE; return TRUE;
} }
WINBOOL WINBOOL
STDCALL STDCALL
GetVersionExA( GetVersionExA(
LPOSVERSIONINFO lpVersionInformation LPOSVERSIONINFO lpVersionInformation
@ -233,10 +224,9 @@ GetVersionExA(
} }
LPSTR
STDCALL
GetEnvironmentStringsA(VOID)
LPSTR STDCALL GetEnvironmentStringsA(VOID)
{ {
#if 0 #if 0
WCHAR *EnvironmentStringsW; WCHAR *EnvironmentStringsW;
@ -271,7 +261,9 @@ LPSTR STDCALL GetEnvironmentStringsA(VOID)
} }
LPWSTR STDCALL GetEnvironmentStringsW(VOID) LPWSTR
STDCALL
GetEnvironmentStringsW(VOID)
{ {
#if 0 #if 0
int size = 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 * reactos/lib/kernel32/misc/error.c
* *
*/ */
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <ddk/ntddbeep.h> #include <ddk/ntddbeep.h>

View file

@ -7,17 +7,16 @@
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 01/11/98 * Created 01/11/98
*/ */
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <windows.h>
WINBOOL
WINBOOL WINAPI
WINAPI GetHandleInformation(
GetHandleInformation( HANDLE hObject,
HANDLE hObject, LPDWORD lpdwFlags
LPDWORD lpdwFlags
) )
{ {
OBJECT_DATA_INFORMATION HandleInfo; OBJECT_DATA_INFORMATION HandleInfo;
@ -34,18 +33,17 @@ GetHandleInformation(
if ( HandleInfo.bProtectFromClose ) if ( HandleInfo.bProtectFromClose )
*lpdwFlags &= HANDLE_FLAG_PROTECT_FROM_CLOSE; *lpdwFlags &= HANDLE_FLAG_PROTECT_FROM_CLOSE;
return TRUE; return TRUE;
}
}
WINBOOL
WINBOOL STDCALL
STDCALL SetHandleInformation(
SetHandleInformation( HANDLE hObject,
HANDLE hObject, DWORD dwMask,
DWORD dwMask, DWORD dwFlags
DWORD dwFlags
) )
{ {
OBJECT_DATA_INFORMATION HandleInfo; OBJECT_DATA_INFORMATION HandleInfo;
NTSTATUS errCode; NTSTATUS errCode;
ULONG BytesWritten; ULONG BytesWritten;
@ -70,53 +68,45 @@ SetHandleInformation(
return TRUE; return TRUE;
} }
WINBOOL WINBOOL
STDCALL STDCALL
CloseHandle( HANDLE hObject ) CloseHandle( HANDLE hObject )
{ {
NTSTATUS errCode; NTSTATUS errCode;
errCode = NtClose(hObject); errCode = NtClose(hObject);
if(!NT_SUCCESS(errCode)) { if(!NT_SUCCESS(errCode)) {
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
WINBOOL WINBOOL
STDCALL STDCALL
DuplicateHandle( DuplicateHandle(
HANDLE hSourceProcessHandle, HANDLE hSourceProcessHandle,
HANDLE hSourceHandle, HANDLE hSourceHandle,
HANDLE hTargetProcessHandle, HANDLE hTargetProcessHandle,
LPHANDLE lpTargetHandle, LPHANDLE lpTargetHandle,
DWORD dwDesiredAccess, DWORD dwDesiredAccess,
BOOL bInheritHandle, BOOL bInheritHandle,
DWORD dwOptions DWORD dwOptions
) )
{ {
NTSTATUS errCode; NTSTATUS errCode;
errCode = NtDuplicateObject(hSourceProcessHandle,hSourceHandle,hTargetProcessHandle,lpTargetHandle, dwDesiredAccess, (BOOLEAN)bInheritHandle,dwOptions); errCode = NtDuplicateObject(hSourceProcessHandle,hSourceHandle,hTargetProcessHandle,lpTargetHandle, dwDesiredAccess, (BOOLEAN)bInheritHandle,dwOptions);
if ( !NT_SUCCESS(errCode) ) { if ( !NT_SUCCESS(errCode) ) {
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
UINT STDCALL UINT STDCALL
@ -124,10 +114,3 @@ SetHandleCount(UINT nCount)
{ {
return 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) * KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them. * Remove from this file, if you implement them.
@ -815,8 +815,6 @@ ExitVDM (
} }
DWORD DWORD
STDCALL STDCALL
ExpungeConsoleCommandHistoryW ( ExpungeConsoleCommandHistoryW (
@ -985,12 +983,11 @@ FindResourceExA (
} }
WINBOOL WINBOOL
STDCALL STDCALL
FlushViewOfFile ( FlushViewOfFile(
LPCVOID lpBaseAddress, LPCVOID lpBaseAddress,
DWORD dwNumberOfBytesToFlush DWORD dwNumberOfBytesToFlush
) )
{ {
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
@ -1013,7 +1010,6 @@ FoldStringW (
} }
int int
STDCALL STDCALL
FoldStringA ( FoldStringA (
@ -1029,7 +1025,6 @@ FoldStringA (
} }
DWORD DWORD
STDCALL STDCALL
FormatMessageW ( FormatMessageW (
@ -2713,8 +2708,6 @@ InitAtomTable (
} }
DWORD DWORD
STDCALL STDCALL
InvalidateConsoleDIBits ( InvalidateConsoleDIBits (
@ -2727,8 +2720,6 @@ InvalidateConsoleDIBits (
} }
WINBOOL WINBOOL
STDCALL STDCALL
IsDBCSLeadByte ( IsDBCSLeadByte (
@ -2991,7 +2982,6 @@ LockResource (
} }
int int
STDCALL STDCALL
MulDiv ( MulDiv (
@ -3815,8 +3805,6 @@ TrimVirtualBuffer (
} }
WINBOOL WINBOOL
STDCALL STDCALL
UpdateResourceA ( UpdateResourceA (
@ -3922,9 +3910,6 @@ VirtualBufferExceptionHandler (
} }
WINBOOL WINBOOL
STDCALL STDCALL
WaitCommEvent ( WaitCommEvent (
@ -4020,9 +4005,6 @@ WriteConsoleInputVDMW (
} }
WINBOOL WINBOOL
STDCALL STDCALL
WritePrivateProfileSectionA ( WritePrivateProfileSectionA (

View file

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

View file

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

View file

@ -11,6 +11,7 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#define WIN32_NO_PEHDR #define WIN32_NO_PEHDR
#include <ddk/ntddk.h>
#include <windows.h> #include <windows.h>
#include <kernel32/proc.h> #include <kernel32/proc.h>
#include <kernel32/thread.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -12,6 +12,7 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#define UNICODE #define UNICODE
#include <ddk/ntddk.h>
#include <windows.h> #include <windows.h>
#include <kernel32/proc.h> #include <kernel32/proc.h>
#include <kernel32/thread.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -12,6 +12,7 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#define UNICODE #define UNICODE
#include <ddk/ntddk.h>
#include <windows.h> #include <windows.h>
#include <kernel32/proc.h> #include <kernel32/proc.h>
#include <kernel32/thread.h> #include <kernel32/thread.h>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,3 @@
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#define STUB(x) void x(void) { UNICODE_STRING UnicodeString; \ #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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -11,7 +11,6 @@
*/ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <wchar.h> #include <wchar.h>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,8 +10,8 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <internal/ke.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/debug.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -11,8 +11,7 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <windows.h> #include <ddk/ntddk.h>
#include <internal/ntoskrnl.h> #include <internal/ntoskrnl.h>
#include <internal/version.h> #include <internal/version.h>
#include <internal/mm.h> #include <internal/mm.h>

View file

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

View file

@ -17,8 +17,7 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <windows.h> #include <ddk/ntddk.h>
#include <internal/i386/segment.h> #include <internal/i386/segment.h>
#include <internal/linkage.h> #include <internal/linkage.h>
#include <internal/module.h> #include <internal/module.h>
@ -29,7 +28,6 @@
#include <internal/string.h> #include <internal/string.h>
#include <internal/symbol.h> #include <internal/symbol.h>
#include <internal/teb.h> #include <internal/teb.h>
#include <ddk/ntddk.h>
//#define NDEBUG //#define NDEBUG
#include <internal/debug.h> #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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -17,8 +17,7 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <windows.h> #include <ddk/ntddk.h>
#include <internal/i386/segment.h> #include <internal/i386/segment.h>
#include <internal/linkage.h> #include <internal/linkage.h>
#include <internal/module.h> #include <internal/module.h>
@ -30,8 +29,6 @@
#include <internal/string.h> #include <internal/string.h>
#include <internal/symbol.h> #include <internal/symbol.h>
#include <ddk/ntddk.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -11,10 +11,9 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <windows.h> #include <ddk/ntddk.h>
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <ddk/ntddk.h>
/********************************************************************** /**********************************************************************

View file

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

View file

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

View file

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

View file

@ -12,6 +12,7 @@
/* INCLUDE *****************************************************************/ /* INCLUDE *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/mm.h> #include <internal/mm.h>
#include <internal/mmhal.h> #include <internal/mmhal.h>
#include <internal/ob.h> #include <internal/ob.h>
@ -416,7 +417,82 @@ NtQueryVirtualMemory (
OUT PULONG ResultLength 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -11,7 +11,6 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <string.h> #include <string.h>

View file

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

View file

@ -8,7 +8,6 @@
/* INCLUDES **************************************************************/ /* INCLUDES **************************************************************/
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ps.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -19,7 +19,6 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/ob.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 NTSTATUS
STDCALL STDCALL
NtCreateThread ( NtCreateThread (
@ -412,6 +544,7 @@ NtCreateThread (
) )
{ {
PETHREAD Thread; PETHREAD Thread;
PNT_TEB TebBase;
NTSTATUS Status; NTSTATUS Status;
DPRINT("NtCreateThread(ThreadHandle %x, PCONTEXT %x)\n", DPRINT("NtCreateThread(ThreadHandle %x, PCONTEXT %x)\n",
@ -429,6 +562,19 @@ NtCreateThread (
{ {
return(Status); 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; Thread->StartAddress=NULL;
if (Client!=NULL) if (Client!=NULL)

View file

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

View file

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

View file

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

View file

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