diff --git a/reactos/include/internal/port.h b/reactos/include/internal/port.h new file mode 100644 index 00000000000..18c8618b6fe --- /dev/null +++ b/reactos/include/internal/port.h @@ -0,0 +1,151 @@ +#ifndef __INCLUDE_INTERNAL_PORT_H +#define __INCLUDE_INTERNAL_PORT_H + +#include + +typedef +struct _EPORT +{ + KSPIN_LOCK Lock; + KEVENT Event; + + ULONG State; + + struct _EPORT * OtherPort; + + ULONG QueueLength; + LIST_ENTRY QueueListHead; + + ULONG ConnectQueueLength; + LIST_ENTRY ConnectQueueListHead; + + ULONG MaxDataLength; + ULONG MaxConnectInfoLength; + +} EPORT, * PEPORT; + + +typedef struct _EPORT_TERMINATION_REQUEST +{ + LIST_ENTRY ThreadListEntry; + PEPORT Port; + +} EPORT_TERMINATION_REQUEST, *PEPORT_TERMINATION_REQUEST; + + +NTSTATUS +STDCALL +LpcRequestPort ( + PEPORT Port, + PLPC_MESSAGE LpcMessage + ); +NTSTATUS +STDCALL +LpcSendTerminationPort ( + PEPORT Port, + TIME CreationTime + ); + + +/* Port Object Access */ + +#define PORT_ALL_ACCESS (0x1) + + +/* EPORT.State */ + +#define EPORT_INACTIVE (0) +#define EPORT_WAIT_FOR_CONNECT (1) +#define EPORT_WAIT_FOR_ACCEPT (2) +#define EPORT_WAIT_FOR_COMPLETE_SRV (3) +#define EPORT_WAIT_FOR_COMPLETE_CLT (4) +#define EPORT_CONNECTED_CLIENT (5) +#define EPORT_CONNECTED_SERVER (6) +#define EPORT_DISCONNECTED (7) + +typedef +struct _QUEUEDMESSAGE +{ + PEPORT Sender; + LIST_ENTRY QueueListEntry; + LPC_MESSAGE Message; + UCHAR MessageData [MAX_MESSAGE_DATA]; + +} QUEUEDMESSAGE, *PQUEUEDMESSAGE; + +/* Code in ntoskrnl/lpc/close.c */ + +VOID +NiClosePort ( + PVOID ObjectBody, + ULONG HandleCount + ); +VOID +NiDeletePort ( + IN PVOID ObjectBody + ); + + +/* Code in ntoskrnl/lpc/queue.c */ + +VOID +STDCALL +EiEnqueueConnectMessagePort ( + IN OUT PEPORT Port, + IN PQUEUEDMESSAGE Message + ); +VOID +STDCALL +EiEnqueueMessagePort ( + IN OUT PEPORT Port, + IN PQUEUEDMESSAGE Message + ); +PQUEUEDMESSAGE +STDCALL +EiDequeueConnectMessagePort ( + IN OUT PEPORT Port + ); +PQUEUEDMESSAGE +STDCALL +EiDequeueMessagePort ( + IN OUT PEPORT Port + ); + +/* Code in ntoskrnl/lpc/create.c */ + +NTSTATUS +NiCreatePort ( + PVOID ObjectBody, + PVOID Parent, + PWSTR RemainingPath, + POBJECT_ATTRIBUTES ObjectAttributes + ); + +/* Code in ntoskrnl/lpc/port.c */ + +NTSTATUS +STDCALL +NiInitializePort ( + IN OUT PEPORT Port + ); +NTSTATUS +NiInitPort ( + VOID + ); + +extern POBJECT_TYPE ExPortType; +extern ULONG EiNextLpcMessageId; + +/* Code in ntoskrnl/lpc/reply.c */ + +NTSTATUS +STDCALL +EiReplyOrRequestPort ( + IN PEPORT Port, + IN PLPC_MESSAGE LpcReply, + IN ULONG MessageType, + IN PEPORT Sender + ); + + +#endif /* __INCLUDE_INTERNAL_PORT_H */ diff --git a/reactos/include/kernel32/kernel32.h b/reactos/include/kernel32/kernel32.h index b397c241e4a..770dbf3ef14 100644 --- a/reactos/include/kernel32/kernel32.h +++ b/reactos/include/kernel32/kernel32.h @@ -1,3 +1,6 @@ +#ifndef _INCLUDE_KERNEL32_KERNEL32_H +#define _INCLUDE_KERNEL32_KERNEL32_H + #include #define UNIMPLEMENTED DbgPrint("%s at %s:%d is unimplemented\n",__FUNCTION__,__FILE__,__LINE__); @@ -39,6 +42,8 @@ BOOL KERNEL32_AnsiToUnicode(PWSTR DestStr, ULONG MaxLen); PWSTR InternalAnsiToUnicode(PWSTR Out, LPCSTR In, ULONG MaxLength); -BOOLEAN IsConsoleHandle(HANDLE Handle); +BOOLEAN STDCALL IsConsoleHandle(HANDLE Handle); WINBOOL STDCALL CloseConsoleHandle(HANDLE Handle); + +#endif /* ndef _INCLUDE_KERNEL32_KERNEL32_H */ diff --git a/reactos/include/ntdll/ldr.h b/reactos/include/ntdll/ldr.h index fa67afe0357..fd56e68954c 100644 --- a/reactos/include/ntdll/ldr.h +++ b/reactos/include/ntdll/ldr.h @@ -33,3 +33,10 @@ LdrGetExportByOrdinal (PDLL Module, ULONG Ordinal ); PVOID LdrGetExportByName (PDLL Module, PUCHAR SymbolName ); + +NTSTATUS +STDCALL +LdrDisableThreadCalloutsForDll ( + PVOID IN ImageBase, + BOOLEAN IN Disable + ); diff --git a/reactos/lib/kernel32/mem/global.c b/reactos/lib/kernel32/mem/global.c index d335869dde4..45e12ee6da9 100644 --- a/reactos/lib/kernel32/mem/global.c +++ b/reactos/lib/kernel32/mem/global.c @@ -1,4 +1,5 @@ -/* +/* $Id: global.c,v 1.4 2000/07/01 17:07:00 ea Exp $ + * * Win32 Global/Local heap functions (GlobalXXX, LocalXXX). * These functions included in Win32 for compatibility with 16 bit Windows * Especially the moveable blocks and handles are oldish. @@ -321,3 +322,4 @@ UINT WINAPI GlobalFlags(HGLOBAL hmem) return LocalFlags( (HLOCAL) hmem); } +/* EOF */ diff --git a/reactos/lib/kernel32/mem/local.c b/reactos/lib/kernel32/mem/local.c index 295e31cbe44..0b9bf367457 100644 --- a/reactos/lib/kernel32/mem/local.c +++ b/reactos/lib/kernel32/mem/local.c @@ -1,4 +1,5 @@ -/* +/* $Id: local.c,v 1.4 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * Copyright (C) 1996, Onno Hovers, All rights reserved * PROJECT: ReactOS system libraries @@ -124,3 +125,5 @@ UINT WINAPI LocalShrink(HLOCAL hmem, UINT newsize) { return (__ProcessHeap->End - (LPVOID) __ProcessHeap); } + +/* EOF */ diff --git a/reactos/lib/kernel32/mem/mem.c b/reactos/lib/kernel32/mem/mem.c index db969b42de5..e1869b4cf92 100644 --- a/reactos/lib/kernel32/mem/mem.c +++ b/reactos/lib/kernel32/mem/mem.c @@ -1,4 +1,5 @@ -/* +/* $Id: mem.c,v 1.2 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user mode libraries * FILE: kernel32/mem/utils.cc @@ -21,3 +22,4 @@ VOID CopyMemory(PVOID Destination, CONST VOID* Source, DWORD Length) } +/* EOF */ diff --git a/reactos/lib/kernel32/mem/procmem.c b/reactos/lib/kernel32/mem/procmem.c index f087ad70cf5..a780bb63505 100644 --- a/reactos/lib/kernel32/mem/procmem.c +++ b/reactos/lib/kernel32/mem/procmem.c @@ -1,4 +1,5 @@ -/* +/* $Id: procmem.c,v 1.2 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: lib/kernel32/mem/procmem.c @@ -10,6 +11,7 @@ #include +#include #include /* FUNCTIONS *****************************************************************/ @@ -32,7 +34,7 @@ ReadProcessMemory ( if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } return TRUE; @@ -57,8 +59,11 @@ WriteProcessMemory ( if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } return TRUE; -} \ No newline at end of file +} + + +/* EOF */ diff --git a/reactos/lib/kernel32/mem/section.c b/reactos/lib/kernel32/mem/section.c index 9792a108dea..54d69fd6644 100644 --- a/reactos/lib/kernel32/mem/section.c +++ b/reactos/lib/kernel32/mem/section.c @@ -1,4 +1,4 @@ -/* $Id: section.c,v 1.11 2000/06/29 23:35:25 dwelch Exp $ +/* $Id: section.c,v 1.12 2000/07/01 17:07:00 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -10,6 +10,7 @@ /* INCLUDES ******************************************************************/ #include +#include #include /* FUNCTIONS *****************************************************************/ @@ -59,7 +60,7 @@ HANDLE STDCALL CreateFileMappingA ( RtlFreeUnicodeString (&UnicodeName); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } @@ -111,7 +112,7 @@ CreateFileMappingW ( hFile); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } @@ -168,7 +169,7 @@ LPVOID STDCALL MapViewOfFileEx(HANDLE hFileMappingObject, if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } @@ -201,7 +202,7 @@ UnmapViewOfFile ( if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } @@ -243,7 +244,7 @@ OpenFileMappingA ( RtlFreeUnicodeString (&UnicodeName); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } @@ -280,7 +281,7 @@ OpenFileMappingW ( &ObjectAttributes); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } @@ -304,7 +305,7 @@ FlushViewOfFile ( if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } return TRUE; diff --git a/reactos/lib/kernel32/mem/utils.c b/reactos/lib/kernel32/mem/utils.c index 10987d05780..cff7da3f7bb 100644 --- a/reactos/lib/kernel32/mem/utils.c +++ b/reactos/lib/kernel32/mem/utils.c @@ -1,3 +1,7 @@ +/* $Id: utils.c,v 1.5 2000/07/01 17:07:00 ea Exp $ + * + * FILE: lib/kernel32/mem/utils.c + */ #include #include @@ -10,3 +14,6 @@ VOID CopyMemory(PVOID Destination, CONST VOID* Source, DWORD Length) ((PCH)Destination)[i] = ((PCH)Source)[i]; } } + + +/* EOF */ diff --git a/reactos/lib/kernel32/mem/virtual.c b/reactos/lib/kernel32/mem/virtual.c index 8c918adb58d..2d87adb1f5e 100644 --- a/reactos/lib/kernel32/mem/virtual.c +++ b/reactos/lib/kernel32/mem/virtual.c @@ -1,4 +1,5 @@ -/* +/* $Id: virtual.c,v 1.6 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: lib/kernel32/mem/virtual.c @@ -9,6 +10,7 @@ /* INCLUDES ******************************************************************/ #include +#include #include /* FUNCTIONS *****************************************************************/ @@ -29,7 +31,7 @@ LPVOID STDCALL VirtualAllocEx(HANDLE hProcess, flProtect); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return(NULL); } return(lpAddress); @@ -57,7 +59,7 @@ WINBOOL STDCALL VirtualFreeEx(HANDLE hProcess, dwFreeType); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return(FALSE); } return(TRUE); @@ -96,7 +98,7 @@ WINBOOL STDCALL VirtualProtectEx(HANDLE hProcess, (PULONG)lpflOldProtect); if (Status != STATUS_SUCCESS) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return(FALSE); } return(TRUE); @@ -115,7 +117,7 @@ VirtualLock ( Status = NtLockVirtualMemory(NtCurrentProcess(),lpAddress,dwSize, &BytesLocked); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } return TRUE; @@ -154,7 +156,7 @@ VirtualQueryEx ( if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return ResultLength; } return ResultLength; @@ -173,8 +175,10 @@ VirtualUnlock ( Status = NtUnlockVirtualMemory(NtCurrentProcess(),lpAddress,dwSize, &BytesLocked); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } return TRUE; } + +/* EOF */ diff --git a/reactos/lib/kernel32/misc/atom.c b/reactos/lib/kernel32/misc/atom.c index d7174a6bebc..7273118c2c2 100644 --- a/reactos/lib/kernel32/misc/atom.c +++ b/reactos/lib/kernel32/misc/atom.c @@ -1,4 +1,5 @@ -/* +/* $Id: atom.c,v 1.9 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/kernel32/misc/atom.c diff --git a/reactos/lib/kernel32/misc/console.c b/reactos/lib/kernel32/misc/console.c index f35e6ac3f8f..d8c35ed5d91 100644 --- a/reactos/lib/kernel32/misc/console.c +++ b/reactos/lib/kernel32/misc/console.c @@ -1,4 +1,5 @@ -/* +/* $Id: console.c,v 1.24 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/kernel32/misc/console.c @@ -23,14 +24,28 @@ #define NDEBUG #include +#include /* FUNCTIONS *****************************************************************/ +/*-------------------------------------------------------------- + * CloseConsoleHandle + */ WINBOOL STDCALL CloseConsoleHandle(HANDLE Handle) -{ +{ + if (FALSE == IsConsoleHandle (Handle)) + { + SetLastError (ERROR_INVALID_PARAMETER); + return FALSE; + } + /* FIXME: call CSRSS */ + return FALSE; } -BOOLEAN IsConsoleHandle(HANDLE Handle) +/*-------------------------------------------------------------- + * IsConsoleHandle + */ +BOOLEAN STDCALL IsConsoleHandle(HANDLE Handle) { if ((((ULONG)Handle) & 0x10000003) == 0x3) { @@ -146,7 +161,7 @@ WINBOOL STDCALL WriteConsoleA(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Reply.Status ) ) { HeapFree( GetProcessHeap(), 0, Request ); - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus (Status); return(FALSE); } nNumberOfCharsToWrite -= Size; @@ -191,7 +206,7 @@ WINBOOL STDCALL ReadConsoleA(HANDLE hConsoleInput, if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Reply->Status )) { DbgPrint( "CSR returned error in ReadConsole\n" ); - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); HeapFree( GetProcessHeap(), 0, Reply ); return(FALSE); } @@ -208,7 +223,7 @@ WINBOOL STDCALL ReadConsoleA(HANDLE hConsoleInput, Status = CsrClientCallServer( &Request, Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) + nNumberOfCharsToRead ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply->Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); HeapFree( GetProcessHeap(), 0, Reply ); return FALSE; } @@ -239,7 +254,7 @@ WINBOOL STDCALL AllocConsole(VOID) Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } SetStdHandle( STD_INPUT_HANDLE, Reply.Data.AllocConsoleReply.ConsoleHandle ); @@ -278,7 +293,7 @@ GetConsoleScreenBufferInfo( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } *lpConsoleScreenBufferInfo = Reply.Data.ScreenBufferInfoReply.Info; @@ -306,7 +321,7 @@ SetConsoleCursorPosition( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } return TRUE; @@ -338,7 +353,7 @@ FillConsoleOutputCharacterA( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } *lpNumberOfCharsWritten = nLength; @@ -422,7 +437,7 @@ ReadConsoleInputA( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } while( Status == STATUS_PENDING ) @@ -430,13 +445,13 @@ ReadConsoleInputA( Status = NtWaitForSingleObject( Reply.Data.ReadInputReply.Event, FALSE, 0 ); if( !NT_SUCCESS( Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } } @@ -664,7 +679,7 @@ WriteConsoleOutputCharacterA( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } nLength -= Size; @@ -729,7 +744,7 @@ WriteConsoleOutputAttribute( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } nLength -= Size; @@ -766,7 +781,7 @@ FillConsoleOutputAttribute( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } if( lpNumberOfAttrsWritten ) @@ -846,7 +861,7 @@ GetConsoleCursorInfo( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } *lpConsoleCursorInfo = Reply.Data.GetCursorInfoReply.Info; @@ -951,7 +966,7 @@ SetConsoleCursorInfo( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } return TRUE; @@ -1034,7 +1049,7 @@ SetConsoleTextAttribute( Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) ) { - SetLastError( RtlNtStatusToDosError( Status ) ); + SetLastErrorByStatus ( Status ); return FALSE; } return TRUE; diff --git a/reactos/lib/kernel32/misc/debug.c b/reactos/lib/kernel32/misc/debug.c index c5c4e64b85b..9ed37fbf666 100644 --- a/reactos/lib/kernel32/misc/debug.c +++ b/reactos/lib/kernel32/misc/debug.c @@ -1,4 +1,4 @@ -/* $Id: debug.c,v 1.2 2000/04/14 01:49:40 ekohl Exp $ +/* $Id: debug.c,v 1.3 2000/07/01 17:07:00 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ ContinueDebugEvent ( dwContinueStatus); if (!NT_SUCCESS(Status)) { - SetLastError (RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } return TRUE; diff --git a/reactos/lib/kernel32/misc/env.c b/reactos/lib/kernel32/misc/env.c index a14b0420863..3d5831be639 100644 --- a/reactos/lib/kernel32/misc/env.c +++ b/reactos/lib/kernel32/misc/env.c @@ -1,4 +1,4 @@ -/* $Id: env.c,v 1.10 2000/02/18 00:49:56 ekohl Exp $ +/* $Id: env.c,v 1.11 2000/07/01 17:07:00 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -17,6 +17,7 @@ #define NDEBUG #include +#include /* FUNCTIONS ******************************************************************/ @@ -68,7 +69,7 @@ GetEnvironmentVariableA ( /* free unicode variable name string */ RtlFreeUnicodeString (&VarNameU); - SetLastError (RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return 0; } @@ -113,7 +114,7 @@ GetEnvironmentVariableW ( &VarValue); if (!NT_SUCCESS(Status)) { - SetLastError (RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return 0; } @@ -155,7 +156,7 @@ SetEnvironmentVariableA ( if (!NT_SUCCESS(Status)) { - SetLastError (RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } @@ -185,7 +186,7 @@ SetEnvironmentVariableW ( &VarValue); if (!NT_SUCCESS(Status)) { - SetLastError (RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return FALSE; } @@ -393,7 +394,7 @@ ExpandEnvironmentStringsA ( RtlFreeHeap (RtlGetProcessHeap (), 0, DestinationU.Buffer); - SetLastError (RtlNtStatusToDosError (Status)); + SetLastErrorByStatus (Status); return 0; } @@ -435,11 +436,11 @@ ExpandEnvironmentStringsW ( &Length); if (!NT_SUCCESS(Status)) { - SetLastError (RtlNtStatusToDosError (Status)); + SetLastErrorByStatus (Status); return 0; } return (Length / sizeof(WCHAR)); } -/* EOF */ \ No newline at end of file +/* EOF */ diff --git a/reactos/lib/kernel32/misc/handle.c b/reactos/lib/kernel32/misc/handle.c index 9cf13369077..dc43a11c3c2 100644 --- a/reactos/lib/kernel32/misc/handle.c +++ b/reactos/lib/kernel32/misc/handle.c @@ -1,4 +1,5 @@ -/* +/* $Id: handle.c,v 1.5 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/kernel32/misc/handle.c @@ -15,6 +16,7 @@ #define NDEBUG #include +#include /* FUNCTIONS *****************************************************************/ @@ -31,7 +33,7 @@ WINBOOL WINAPI GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags) &BytesWritten); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } if ( HandleInfo.bInheritHandle ) @@ -57,7 +59,7 @@ WINBOOL STDCALL SetHandleInformation(HANDLE hObject, &BytesWritten); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } if (dwMask & HANDLE_FLAG_INHERIT) @@ -75,7 +77,7 @@ WINBOOL STDCALL SetHandleInformation(HANDLE hObject, sizeof(OBJECT_DATA_INFORMATION)); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } @@ -102,7 +104,7 @@ WINBOOL STDCALL CloseHandle(HANDLE hObject) errCode = NtClose(hObject); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } @@ -129,7 +131,7 @@ WINBOOL STDCALL DuplicateHandle(HANDLE hSourceProcessHandle, dwOptions); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } @@ -140,3 +142,6 @@ UINT STDCALL SetHandleCount(UINT nCount) { return(nCount); } + + +/* EOF */ diff --git a/reactos/lib/kernel32/misc/ldr.c b/reactos/lib/kernel32/misc/ldr.c index d977dc3df5f..2f0f8e79bab 100644 --- a/reactos/lib/kernel32/misc/ldr.c +++ b/reactos/lib/kernel32/misc/ldr.c @@ -1,4 +1,4 @@ -/* $Id: ldr.c,v 1.5 2000/04/14 01:49:40 ekohl Exp $ +/* $Id: ldr.c,v 1.6 2000/07/01 17:07:00 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT : ReactOS user mode libraries @@ -13,6 +13,7 @@ #define NDEBUG #include +#include /* FUNCTIONS ****************************************************************/ @@ -116,7 +117,7 @@ LoadLibraryExW ( HeapFree(GetProcessHeap(),0,lpDllName); if ( !NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } diff --git a/reactos/lib/kernel32/misc/res.c b/reactos/lib/kernel32/misc/res.c index b653b63e501..a55747f4608 100644 --- a/reactos/lib/kernel32/misc/res.c +++ b/reactos/lib/kernel32/misc/res.c @@ -1,4 +1,4 @@ -/* $Id: res.c,v 1.4 2000/04/14 01:50:38 ekohl Exp $ +/* $Id: res.c,v 1.5 2000/07/01 17:07:00 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT : ReactOS user mode libraries @@ -11,6 +11,7 @@ #include #include #include +#include HRSRC @@ -141,7 +142,7 @@ FindResourceExW ( Status = LdrFindResource_U(hModule,&ResourceDataEntry,lpName, nType,wLanguage); if ( !NT_SUCCESS(Status ) ) { - SetLastError(RtlNtStatusToDosError(Status)); + SetLastErrorByStatus (Status); return NULL; } return ResourceDataEntry; diff --git a/reactos/lib/kernel32/misc/rtl.c b/reactos/lib/kernel32/misc/rtl.c index c3fb2353cc4..db7b7c2268c 100644 --- a/reactos/lib/kernel32/misc/rtl.c +++ b/reactos/lib/kernel32/misc/rtl.c @@ -1,4 +1,5 @@ -/* +/* $Id: rtl.c,v 1.3 2000/07/01 17:07:00 ea Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: lib/kernel32/misc/rtl.c @@ -94,4 +95,7 @@ RtlUnwind ( if ( Unwind == NULL ) return -1; return Unwind(Unknown0, Unknown1, Unknown2, Unknown3); -} \ No newline at end of file +} + + +/* EOF */ diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index 587105c00a1..2ff6ed1e832 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.18 2000/05/14 13:09:59 dwelch Exp $ +/* $Id: stubs.c,v 1.19 2000/07/01 17:07:01 ea Exp $ * * KERNEL32.DLL stubs (unimplemented functions) * Remove from this file, if you implement them. @@ -412,17 +412,6 @@ DeleteAtom ( } -WINBOOL -STDCALL -DisableThreadLibraryCalls ( - HMODULE hLibModule - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - WINBOOL STDCALL DisconnectNamedPipe ( diff --git a/reactos/lib/kernel32/synch/event.c b/reactos/lib/kernel32/synch/event.c index a47eea2cdd4..60ea9dcb6bd 100644 --- a/reactos/lib/kernel32/synch/event.c +++ b/reactos/lib/kernel32/synch/event.c @@ -1,4 +1,4 @@ -/* $Id: event.c,v 1.7 2000/03/16 21:50:11 ekohl Exp $ +/* $Id: event.c,v 1.8 2000/07/01 17:07:02 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -14,6 +14,7 @@ #define NDEBUG #include +#include WINBOOL STDCALL SetEvent(HANDLE hEvent) { @@ -23,7 +24,7 @@ WINBOOL STDCALL SetEvent(HANDLE hEvent) errCode = NtSetEvent(hEvent,&Count); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } return TRUE; @@ -37,7 +38,7 @@ WINBOOL STDCALL ResetEvent(HANDLE hEvent) errCode = NtResetEvent(hEvent, &Count); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } return TRUE; @@ -91,7 +92,7 @@ CreateEventW ( DPRINT( "Called\n" ); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return INVALID_HANDLE_VALUE; } @@ -130,7 +131,7 @@ OpenEventW ( errCode = NtOpenEvent(hEvent,dwDesiredAccess,&ObjectAttributes); if ( !NT_SUCCESS(errCode) ) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return NULL; } @@ -218,7 +219,7 @@ PulseEvent ( NTSTATUS errCode; errCode = NtPulseEvent(hEvent,&Count); if ( !NT_SUCCESS(errCode) ) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } return TRUE; diff --git a/reactos/lib/kernel32/synch/timer.c b/reactos/lib/kernel32/synch/timer.c index d7547b203fe..6836189f5ec 100644 --- a/reactos/lib/kernel32/synch/timer.c +++ b/reactos/lib/kernel32/synch/timer.c @@ -1,4 +1,4 @@ -/* $Id: timer.c,v 1.4 2000/03/16 21:50:11 ekohl Exp $ +/* $Id: timer.c,v 1.5 2000/07/01 17:07:02 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -10,6 +10,7 @@ /* INCLUDES ******************************************************************/ #include +#include #include /* FUNCTIONS *****************************************************************/ @@ -154,7 +155,7 @@ WINBOOL SetWaitableTimer( lpArgToCompletionRoutine, fResume, lPeriod, &pState); if ( !NT_SUCCESS(errCode) ) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } return TRUE; @@ -170,7 +171,7 @@ WINBOOL CancelWaitableTimer(HANDLE hTimer) &CurrentState ); if ( !NT_SUCCESS(errCode) ) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return FALSE; } return TRUE; diff --git a/reactos/lib/kernel32/synch/wait.c b/reactos/lib/kernel32/synch/wait.c index 30a689e36b8..07df1f73477 100644 --- a/reactos/lib/kernel32/synch/wait.c +++ b/reactos/lib/kernel32/synch/wait.c @@ -1,4 +1,4 @@ -/* $Id: wait.c,v 1.11 2000/03/18 02:39:12 ekohl Exp $ +/* $Id: wait.c,v 1.12 2000/07/01 17:07:02 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -10,6 +10,7 @@ */ #include +#include #include #include @@ -84,7 +85,7 @@ CreateSemaphoreW( ); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return NULL; } @@ -153,7 +154,7 @@ CreateMutexW ( errCode = NtCreateMutant(&MutantHandle,GENERIC_ALL, &ObjectAttributes,(BOOLEAN)bInitialOwner); if (!NT_SUCCESS(errCode)) { - SetLastError(RtlNtStatusToDosError(errCode)); + SetLastErrorByStatus (errCode); return NULL; } @@ -182,7 +183,6 @@ WaitForSingleObjectEx(HANDLE hHandle, NTSTATUS errCode; PLARGE_INTEGER TimePtr; LARGE_INTEGER Time; - DWORD retCode; if (dwMilliseconds == INFINITE) { @@ -206,8 +206,7 @@ WaitForSingleObjectEx(HANDLE hHandle, return WAIT_OBJECT_0; } - retCode = RtlNtStatusToDosError(errCode); - SetLastError(retCode); + SetLastErrorByStatus (errCode); return 0xFFFFFFFF; } @@ -235,7 +234,6 @@ WaitForMultipleObjectsEx(DWORD nCount, NTSTATUS errCode; LARGE_INTEGER Time; PLARGE_INTEGER TimePtr; - DWORD retCode; if (dwMilliseconds == INFINITE) { @@ -263,8 +261,7 @@ WaitForMultipleObjectsEx(DWORD nCount, return errCode; } - retCode = RtlNtStatusToDosError(errCode); - SetLastError(retCode); + SetLastErrorByStatus (errCode); return 0xFFFFFFFF; } diff --git a/reactos/lib/kernel32/thread/thread.c b/reactos/lib/kernel32/thread/thread.c index edf949df3e0..3a71d2e4e11 100644 --- a/reactos/lib/kernel32/thread/thread.c +++ b/reactos/lib/kernel32/thread/thread.c @@ -1,4 +1,4 @@ -/* $Id: thread.c,v 1.16 2000/06/29 23:35:26 dwelch Exp $ +/* $Id: thread.c,v 1.17 2000/07/01 17:07:02 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -363,4 +364,28 @@ int STDCALL GetThreadPriority(HANDLE hThread) return ThreadBasic.BasePriority; } + +/* FIXME */ +WINBOOL +STDCALL +DisableThreadLibraryCalls ( + HMODULE hLibModule + ) +{ + NTSTATUS Status; + + Status = LdrDisableThreadCalloutsForDll ( + (PVOID) hLibModule, + TRUE + ); + if (!NT_SUCCESS (Status)) + { + SetLastErrorByStatus (Status); + return FALSE; + } + return TRUE; +} + + + /* EOF */ diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index 5601a9b4bad..77c39a8174b 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,4 +1,4 @@ -; $Id: ntdll.def,v 1.55 2000/05/25 15:51:05 ekohl Exp $ +; $Id: ntdll.def,v 1.56 2000/07/01 17:06:22 ea Exp $ ; ; ReactOS Operating System ; @@ -33,7 +33,7 @@ DbgUserBreakPoint@0 ;KiUserCallbackDispatcher ;KiUserExceptionDispatcher LdrAccessResource -;LdrDisableThreadCalloutsForDll +LdrDisableThreadCalloutsForDll@8 ;LdrEnumResources ;LdrFindResourceDirectory_U LdrFindResource_U diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index 7f76667efad..1060ea0bfc4 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,4 +1,4 @@ -; $Id: ntdll.edf,v 1.44 2000/05/25 15:51:05 ekohl Exp $ +; $Id: ntdll.edf,v 1.45 2000/07/01 17:06:22 ea Exp $ ; ; ReactOS Operating System ; @@ -33,7 +33,7 @@ DbgUserBreakPoint=DbgUserBreakPoint@0 ;KiUserCallbackDispatcher ;KiUserExceptionDispatcher LdrAccessResource -;LdrDisableThreadCalloutsForDll +LdrDisableThreadCalloutsForDll=LdrDisableThreadCalloutsForDll@8 ;LdrEnumResources ;LdrFindResourceDirectory_U LdrFindResource_U diff --git a/reactos/lib/ntdll/ldr/utils.c b/reactos/lib/ntdll/ldr/utils.c index b68100172fd..f141068e1ab 100644 --- a/reactos/lib/ntdll/ldr/utils.c +++ b/reactos/lib/ntdll/ldr/utils.c @@ -1,4 +1,4 @@ -/* $Id: utils.c,v 1.26 2000/06/29 23:35:27 dwelch Exp $ +/* $Id: utils.c,v 1.27 2000/07/01 17:06:22 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1079,4 +1079,16 @@ NTSTATUS LdrAccessResource(DLL *Dll, IMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntr return STATUS_SUCCESS; } + +NTSTATUS +STDCALL +LdrDisableThreadCalloutsForDll ( + PVOID IN ImageBase, + BOOLEAN IN Disable + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + + /* EOF */ diff --git a/reactos/lib/ntdll/stubs/stubs.c b/reactos/lib/ntdll/stubs/stubs.c index 95c51a9f94c..63dc7975ea4 100644 --- a/reactos/lib/ntdll/stubs/stubs.c +++ b/reactos/lib/ntdll/stubs/stubs.c @@ -28,7 +28,6 @@ STUB(CsrSetPriorityClass) STUB(KiRaiseUserExceptionDispatcher) STUB(KiUserExceptionDispatcher) -STUB(LdrDisableThreadCalloutsForDll) STUB(LdrEnumResources) STUB(LdrFindEntryForAddress) STUB(LdrFindResourceDirectory_U)