diff --git a/reactos/include/ddk/rtl.h b/reactos/include/ddk/rtl.h index b59230add4d..a77c3f985fa 100644 --- a/reactos/include/ddk/rtl.h +++ b/reactos/include/ddk/rtl.h @@ -1,4 +1,4 @@ -/* $Id: rtl.h,v 1.18 1999/11/20 21:44:09 ekohl Exp $ +/* $Id: rtl.h,v 1.19 1999/11/27 03:29:20 ekohl Exp $ * */ @@ -122,6 +122,15 @@ extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG; /* + * VOID + * InitializeObjectAttributes ( + * POBJECT_ATTRIBUTES InitializedAttributes, + * PUNICODE_STRING ObjectName, + * ULONG Attributes, + * HANDLE RootDirectory, + * PSECURITY_DESCRIPTOR SecurityDescriptor + * ); + * * FUNCTION: Sets up a parameter of type OBJECT_ATTRIBUTES for a * subsequent call to ZwCreateXXX or ZwOpenXXX * ARGUMENTS: @@ -132,14 +141,17 @@ extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG; * RootDirectory = Where the object should be placed or NULL * SecurityDescriptor = Ignored */ -VOID -InitializeObjectAttributes ( - POBJECT_ATTRIBUTES InitializedAttributes, - PUNICODE_STRING ObjectName, - ULONG Attributes, - HANDLE RootDirectory, - PSECURITY_DESCRIPTOR SecurityDescriptor - ); + +#define InitializeObjectAttributes(p,n,a,r,s) \ +{ \ + (p)->Length = sizeof(OBJECT_ATTRIBUTES); \ + (p)->ObjectName = n; \ + (p)->Attributes = a; \ + (p)->RootDirectory = r; \ + (p)->SecurityDescriptor = s; \ + (p)->SecurityQualityOfService = NULL; \ +} + VOID InitializeListHead ( @@ -226,7 +238,7 @@ RtlAppendAsciizToString( NTSTATUS STDCALL -RtlAppendStringToString( +RtlAppendStringToString ( PSTRING Destination, PSTRING Source ); @@ -285,11 +297,13 @@ RtlCompareUnicodeString ( ); LARGE_INTEGER +STDCALL RtlConvertLongToLargeInteger ( LONG SignedInteger ); LARGE_INTEGER +STDCALL RtlConvertUlongToLargeInteger ( ULONG UnsignedInteger ); @@ -366,12 +380,14 @@ RtlDowncaseUnicodeString ( ); LARGE_INTEGER +STDCALL RtlEnlargedIntegerMultiply ( LONG Multiplicand, LONG Multiplier ); ULONG +STDCALL RtlEnlargedUnsignedDivide ( ULARGE_INTEGER Dividend, ULONG Divisor, @@ -379,6 +395,7 @@ RtlEnlargedUnsignedDivide ( ); LARGE_INTEGER +STDCALL RtlEnlargedUnsignedMultiply ( ULONG Multiplicand, ULONG Multiplier @@ -408,12 +425,14 @@ RtlEraseUnicodeString ( ); LARGE_INTEGER +STDCALL RtlExtendedIntegerMultiply ( LARGE_INTEGER Multiplicand, LONG Multiplier ); LARGE_INTEGER +STDCALL RtlExtendedLargeIntegerDivide ( LARGE_INTEGER Dividend, ULONG Divisor, @@ -421,6 +440,7 @@ RtlExtendedLargeIntegerDivide ( ); LARGE_INTEGER +STDCALL RtlExtendedMagicDivide ( LARGE_INTEGER Dividend, LARGE_INTEGER MagicDivisor, @@ -475,6 +495,16 @@ RtlInitAnsiString ( PCSZ SourceString ); +NTSTATUS +STDCALL +RtlInitializeContext ( + IN HANDLE ProcessHandle, + IN PCONTEXT Context, + IN PVOID Parameter, + IN PTHREAD_START_ROUTINE StartAddress, + IN OUT PINITIAL_TEB InitialTeb + ); + VOID STDCALL RtlInitString ( @@ -507,115 +537,182 @@ RtlIntegerToUnicodeString ( ); LARGE_INTEGER +STDCALL RtlLargeIntegerAdd ( LARGE_INTEGER Addend1, LARGE_INTEGER Addend2 ); +#define RtlLargeIntegerAnd(Result, Source, Mask) \ +{ \ + Result.HighPart = Source.HighPart & Mask.HighPart; \ + Result.LowPart = Source.LowPart & Mask.LowPart; \ +} +/* VOID RtlLargeIntegerAnd ( PLARGE_INTEGER Result, LARGE_INTEGER Source, LARGE_INTEGER Mask ); +*/ LARGE_INTEGER +STDCALL RtlLargeIntegerArithmeticShift ( LARGE_INTEGER LargeInteger, CCHAR ShiftCount ); LARGE_INTEGER +STDCALL RtlLargeIntegerDivide ( LARGE_INTEGER Dividend, LARGE_INTEGER Divisor, PLARGE_INTEGER Remainder ); +#define RtlLargeIntegerEqualTo(X,Y) \ + (!(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart))) +/* BOOLEAN RtlLargeIntegerEqualTo ( LARGE_INTEGER Operand1, LARGE_INTEGER Operand2 ); +*/ +#define RtlLargeIntegerEqualToZero(X) \ + (!((X).LowPart | (X).HighPart)) +/* BOOLEAN RtlLargeIntegerEqualToZero ( LARGE_INTEGER Operand ); +*/ +#define RtlLargeIntegerGreaterThan(X,Y) \ + ((((X).HighPart == (Y).HighPart) && ((X).LowPart > (Y).LowPart)) || \ + ((X).HighPart > (Y).HighPart)) +/* BOOLEAN RtlLargeIntegerGreaterThan ( LARGE_INTEGER Operand1, LARGE_INTEGER Operand2 ); +*/ +#define RtlLargeIntegerGreaterThanOrEqualTo(X,Y) \ + ((((X).HighPart == (Y).HighPart) && ((X).LowPart >= (Y).LowPart)) || \ + ((X).HighPart > (Y).HighPart)) +/* BOOLEAN RtlLargeIntegerGreaterThanOrEqualTo ( LARGE_INTEGER Operand1, LARGE_INTEGER Operand2 ); +*/ +#define RtlLargeIntegerGreaterOrEqualToZero(X) \ + ((X).HighPart >= 0) +/* BOOLEAN RtlLargeIntegerGreaterThanOrEqualToZero ( LARGE_INTEGER Operand1 ); +*/ +#define RtlLargeIntegerGreaterThanZero(X) \ + ((((X).HighPart == 0) && ((X).LowPart > 0)) || \ + ((X).HighPart > 0 )) +/* BOOLEAN RtlLargeIntegerGreaterThanZero ( LARGE_INTEGER Operand1 ); +*/ +#define RtlLargeIntegerLessThan(X,Y) \ + ((((X).HighPart == (Y).HighPart) && ((X).LowPart < (Y).LowPart)) || \ + ((X).HighPart < (Y).HighPart)) +/* BOOLEAN RtlLargeIntegerLessThan ( LARGE_INTEGER Operand1, LARGE_INTEGER Operand2 ); +*/ +#define RtlLargeIntegerLessThanOrEqualTo(X,Y) \ + ((((X).HighPart == (Y).HighPart) && ((X).LowPart <= (Y).LowPart)) || \ + ((X).HighPart < (Y).HighPart)) +/* BOOLEAN RtlLargeIntegerLessThanOrEqualTo ( LARGE_INTEGER Operand1, LARGE_INTEGER Operand2 ); +*/ +#define RtlLargeIntegerLessOrEqualToZero(X) \ + (((X).HighPart < 0) || !((X).LowPart | (X).HighPart)) +/* BOOLEAN RtlLargeIntegerLessThanOrEqualToZero ( LARGE_INTEGER Operand ); +*/ +#define RtlLargeIntegerLessThanZero(X) \ + (((X).HighPart < 0)) +/* BOOLEAN RtlLargeIntegerLessThanZero ( LARGE_INTEGER Operand ); +*/ LARGE_INTEGER +STDCALL RtlLargeIntegerNegate ( LARGE_INTEGER Subtrahend ); +#define RtlLargeIntegerNotEqualTo(X,Y) \ + ((((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart))) +/* BOOLEAN RtlLargeIntegerNotEqualTo ( LARGE_INTEGER Operand1, LARGE_INTEGER Operand2 ); +*/ +#define RtlLargeIntegerNotEqualToZero(X) \ + (((X).LowPart | (X).HighPart)) +/* BOOLEAN RtlLargeIntegerNotEqualToZero ( LARGE_INTEGER Operand ); +*/ LARGE_INTEGER +STDCALL RtlLargeIntegerShiftLeft ( LARGE_INTEGER LargeInteger, CCHAR ShiftCount ); LARGE_INTEGER +STDCALL RtlLargeIntegerShiftRight ( LARGE_INTEGER LargeInteger, CCHAR ShiftCount ); LARGE_INTEGER +STDCALL RtlLargeIntegerSubtract ( LARGE_INTEGER Minuend, LARGE_INTEGER Subtrahend @@ -934,7 +1031,7 @@ RtlNtStatusToDosError ( BOOL -WINAPI +STDCALL RtlDestroyHeap ( HANDLE hheap ); @@ -949,11 +1046,11 @@ RtlReAllocateHeap ( ); HANDLE -WINAPI +STDCALL RtlGetProcessHeap (VOID); BOOL -WINAPI +STDCALL RtlLockHeap ( HANDLE hheap ); @@ -987,6 +1084,31 @@ RtlValidateHeap ( PVOID pmem ); +ULONG +STDCALL +RtlxAnsiStringToUnicodeSize ( + IN PANSI_STRING AnsiString + ); + +ULONG +STDCALL +RtlxOemStringToUnicodeSize ( + IN POEM_STRING OemString + ); + +ULONG +STDCALL +RtlxUnicodeStringToAnsiSize ( + IN PUNICODE_STRING UnicodeString + ); + +ULONG +STDCALL +RtlxUnicodeStringToOemSize ( + IN PUNICODE_STRING UnicodeString + ); + + /* NtProcessStartup */ VOID @@ -1001,14 +1123,6 @@ RtlDenormalizeProcessParams ( ); -NTSTATUS STDCALL -RtlInitializeContext( - IN HANDLE ProcessHandle, - IN PCONTEXT Context, - IN PVOID Parameter, - IN PTHREAD_START_ROUTINE StartAddress, - IN OUT PINITIAL_TEB InitialTeb - ); NTSTATUS STDCALL diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index 498abc271f7..47abef55986 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,11 +1,10 @@ -; $Id: ntdll.def,v 1.24 1999/11/25 23:45:29 ekohl Exp $ +; $Id: ntdll.def,v 1.25 1999/11/27 03:32:17 ekohl Exp $ ; ; ReactOS Operating System ; LIBRARY ntdll.dll EXPORTS -InitializeObjectAttributes NlsAnsiCodePage NlsMbCodePageTag NlsMbOemCodePageTag @@ -446,21 +445,21 @@ RtlCreateUserThread@40 RtlCompactHeap@8 RtlCompareString@12 RtlCompareUnicodeString@12 -RtlConvertLongToLargeInteger -RtlConvertUlongToLargeInteger +RtlConvertLongToLargeInteger@4 +RtlConvertUlongToLargeInteger@4 RtlCopyString@8 RtlCopyUnicodeString@8 RtlDestroyHeap@4 RtlDowncaseUnicodeString@12 -RtlEnlargedIntegerMultiply -RtlEnlargedUnsignedDivide -RtlEnlargedUnsignedMultiply +RtlEnlargedIntegerMultiply@8 +RtlEnlargedUnsignedDivide@16 +RtlEnlargedUnsignedMultiply@8 RtlEqualString@12 RtlEqualUnicodeString@12 RtlEraseUnicodeString@4 -RtlExtendedIntegerMultiply -RtlExtendedLargeIntegerDivide -RtlExtendedMagicDivide +RtlExtendedIntegerMultiply@12 +RtlExtendedLargeIntegerDivide@16 +RtlExtendedMagicDivide@20 RtlFillMemory@12 RtlFreeAnsiString@4 RtlFreeHeap@12 @@ -473,13 +472,13 @@ RtlInitString@8 RtlInitUnicodeString@8 RtlIntegerToChar@16 RtlIntegerToUnicodeString@12 -RtlLargeIntegerAdd -RtlLargeIntegerArithmeticShift -RtlLargeIntegerDivide -RtlLargeIntegerNegate -RtlLargeIntegerShiftLeft -RtlLargeIntegerShiftRight -RtlLargeIntegerSubtract +RtlLargeIntegerAdd@16 +RtlLargeIntegerArithmeticShift@12 +RtlLargeIntegerDivide@20 +RtlLargeIntegerNegate@8 +RtlLargeIntegerShiftLeft@12 +RtlLargeIntegerShiftRight@12 +RtlLargeIntegerSubtract@16 RtlLengthSecurityDescriptor RtlLockHeap@4 RtlMoveMemory@12 diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index 689667d6477..2174793c5c2 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,11 +1,10 @@ -; $Id: ntdll.edf,v 1.14 1999/11/25 23:45:30 ekohl Exp $ +; $Id: ntdll.edf,v 1.15 1999/11/27 03:32:17 ekohl Exp $ ; ; ReactOS Operating System ; LIBRARY ntdll.dll EXPORTS -InitializeObjectAttributes NlsAnsiCodePage NlsMbCodePageTag NlsMbOemCodePageTag @@ -444,21 +443,21 @@ RtlCreateUserThread=RtlCreateUserThread@40 RtlCompactHeap=RtlCompactHeap@8 RtlCompareString=RtlCompareString@12 RtlCompareUnicodeString=RtlCompareUnicodeString@12 -RtlConvertLongToLargeInteger -RtlConvertUlongToLargeInteger +RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4 +RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4 RtlCopyString=RtlCopyString@8 RtlCopyUnicodeString=RtlCopyUnicodeString@8 RtlDestroyHeap=RtlDestroyHeap@4 RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12 -RtlEnlargedIntegerMultiply -RtlEnlargedUnsignedDivide -RtlEnlargedUnsignedMultiply +RtlEnlargedIntegerMultiply=RtlEnlargedIntegerMultiply@8 +RtlEnlargedUnsignedDivide=RtlEnlargedUnsignedDivide@16 +RtlEnlargedUnsignedMultiply=RtlEnlargedUnsignedMultiply@8 RtlEqualString=RtlEqualString@12 RtlEqualUnicodeString=RtlEqualUnicodeString@12 RtlEraseUnicodeString=RtlEraseUnicodeString@4 -RtlExtendedIntegerMultiply -RtlExtendedLargeIntegerDivide -RtlExtendedMagicDivide +RtlExtendedIntegerMultiply=RtlExtendedIntegerMultiply@12 +RtlExtendedLargeIntegerDivide=RtlExtendedLargeIntegerDivide@16 +RtlExtendedMagicDivide=RtlExtendedMagicDivide@20 RtlFillMemory=RtlFillMemory@12 RtlFreeAnsiString=RtlFreeAnsiString@4 RtlFreeHeap=RtlFreeHeap@12 @@ -470,13 +469,13 @@ RtlInitString=RtlInitString@8 RtlInitUnicodeString=RtlInitUnicodeString@8 RtlIntegerToChar=RtlIntegerToChar@16 RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12 -RtlLargeIntegerAdd -RtlLargeIntegerArithmeticShift -RtlLargeIntegerDivide -RtlLargeIntegerNegate -RtlLargeIntegerShiftLeft -RtlLargeIntegerShiftRight -RtlLargeIntegerSubtract +RtlLargeIntegerAdd=RtlLargeIntegerAdd@16 +RtlLargeIntegerArithmeticShift=RtlLargeIntegerArithmeticShift@12 +RtlLargeIntegerDivide=RtlLargeIntegerDivide@20 +RtlLargeIntegerNegate=RtlLargeIntegerNegate@8 +RtlLargeIntegerShiftLeft=RtlLargeIntegerShiftLeft@12 +RtlLargeIntegerShiftRight=RtlLargeIntegerShiftRight@12 +RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16 RtlLengthSecurityDescriptor RtlLockHeap=RtlLockHeap@4 RtlMoveMemory=RtlMoveMemory@12 diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 8a354e59965..2c360d13437 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.26 1999/11/15 15:57:27 ekohl Exp $ +# $Id: makefile,v 1.27 1999/11/27 03:31:43 ekohl Exp $ # # ReactOS Operating System # @@ -24,8 +24,8 @@ endif all: $(DLLTARGET) RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \ - rtl/mem.o rtl/namespc.o rtl/security.o rtl/unicode.o \ - rtl/thread.o rtl/process.o rtl/nls.o + rtl/mem.o rtl/nls.o rtl/process.o rtl/security.o \ + rtl/thread.o rtl/unicode.o STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \ stdlib/strtol.o stdlib/strtoul.o diff --git a/reactos/lib/ntdll/rtl/largeint.c b/reactos/lib/ntdll/rtl/largeint.c index 2707c304a7b..7d7f008b5f8 100644 --- a/reactos/lib/ntdll/rtl/largeint.c +++ b/reactos/lib/ntdll/rtl/largeint.c @@ -1,4 +1,4 @@ -/* $Id: largeint.c,v 1.6 1999/11/15 16:00:19 ekohl Exp $ +/* $Id: largeint.c,v 1.7 1999/11/27 03:32:55 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -19,276 +19,232 @@ /* FUNCTIONS *****************************************************************/ -LARGE_INTEGER -RtlConvertLongToLargeInteger(LONG SignedInteger) +LARGE_INTEGER +STDCALL +RtlConvertLongToLargeInteger ( + LONG SignedInteger + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = SignedInteger; + RC.QuadPart = SignedInteger; - return RC; + return RC; } -LARGE_INTEGER -RtlConvertUlongToLargeInteger(ULONG UnsignedInteger) +LARGE_INTEGER +STDCALL +RtlConvertUlongToLargeInteger ( + ULONG UnsignedInteger + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = UnsignedInteger; + RC.QuadPart = UnsignedInteger; - return RC; + return RC; } -LARGE_INTEGER -RtlEnlargedIntegerMultiply(LONG Multiplicand, - LONG Multiplier) +LARGE_INTEGER +STDCALL +RtlEnlargedIntegerMultiply ( + LONG Multiplicand, + LONG Multiplier + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = (LONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (LONGLONG) Multiplicand * Multiplier; - return RC; + return RC; } ULONG -RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend, - ULONG Divisor, - PULONG Remainder) +STDCALL +RtlEnlargedUnsignedDivide ( + ULARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder + ) { - if (Remainder) - *Remainder = Dividend.QuadPart % Divisor; + if (Remainder) + *Remainder = Dividend.QuadPart % Divisor; - return (ULONG)(Dividend.QuadPart / Divisor); + return (ULONG)(Dividend.QuadPart / Divisor); } LARGE_INTEGER -RtlEnlargedUnsignedMultiply(ULONG Multiplicand, - ULONG Multiplier) +STDCALL +RtlEnlargedUnsignedMultiply ( + ULONG Multiplicand, + ULONG Multiplier + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = (ULONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (ULONGLONG) Multiplicand * Multiplier; - return RC; -} - -LARGE_INTEGER -RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand, - LONG Multiplier) -{ - LARGE_INTEGER RC; - - RC.QuadPart = Multiplicand.QuadPart * Multiplier; - - return RC; + return RC; } LARGE_INTEGER -RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend, - ULONG Divisor, - PULONG Remainder) +STDCALL +RtlExtendedIntegerMultiply ( + LARGE_INTEGER Multiplicand, + LONG Multiplier + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - if (Remainder) - *Remainder = Dividend.QuadPart % Divisor; + RC.QuadPart = Multiplicand.QuadPart * Multiplier; - RC.QuadPart = Dividend.QuadPart / Divisor; - - return RC; + return RC; } LARGE_INTEGER -RtlExtendedMagicDivide(LARGE_INTEGER Dividend, - LARGE_INTEGER MagicDivisor, - CCHAR ShiftCount) +STDCALL +RtlExtendedLargeIntegerDivide ( + LARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder + ) { - UNIMPLEMENTED; -} + LARGE_INTEGER RC; -LARGE_INTEGER -RtlLargeIntegerAdd(LARGE_INTEGER Addend1, - LARGE_INTEGER Addend2) -{ - LARGE_INTEGER RC; + if (Remainder) + *Remainder = Dividend.QuadPart % Divisor; - RC.QuadPart = Addend1.QuadPart + Addend2.QuadPart; + RC.QuadPart = Dividend.QuadPart / Divisor; - return RC; -} - -VOID -RtlLargeIntegerAnd(PLARGE_INTEGER Result, - LARGE_INTEGER Source, - LARGE_INTEGER Mask) -{ - Result->QuadPart = Source.QuadPart & Mask.QuadPart; + return RC; } LARGE_INTEGER -RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger, - CCHAR ShiftCount) +STDCALL +RtlExtendedMagicDivide ( + LARGE_INTEGER Dividend, + LARGE_INTEGER MagicDivisor, + CCHAR ShiftCount + ) { - LARGE_INTEGER RC; - CHAR Shift; - - Shift = ShiftCount % 64; - - if (Shift < 32) - { - RC.QuadPart = LargeInteger.QuadPart >> Shift; - } - else - { - /* copy the sign bit */ - RC.u.HighPart |= (LargeInteger.u.HighPart & 0x80000000); - RC.u.LowPart = LargeInteger.u.HighPart >> Shift; - } - - return RC; + UNIMPLEMENTED; } LARGE_INTEGER -RtlLargeIntegerDivide(LARGE_INTEGER Dividend, - LARGE_INTEGER Divisor, - PLARGE_INTEGER Remainder) +STDCALL +RtlLargeIntegerAdd ( + LARGE_INTEGER Addend1, + LARGE_INTEGER Addend2 + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - if (Remainder) - Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart; + RC.QuadPart = Addend1.QuadPart + Addend2.QuadPart; - - RC.QuadPart = Dividend.QuadPart / Divisor.QuadPart; - - return RC; -} - -BOOLEAN -RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart == Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerEqualToZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart == 0 ; -} - -BOOLEAN -RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart > Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart >= Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1) -{ - return Operand1.QuadPart > 0; -} - -BOOLEAN -RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1) -{ - return Operand1.QuadPart >= 0; -} - -BOOLEAN -RtlLargeIntegerLessThan(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart < Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart <= Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart <= 0; -} - -BOOLEAN -RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart < 0; + return RC; } LARGE_INTEGER -RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend) +STDCALL +RtlLargeIntegerArithmeticShift ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; + CHAR Shift; - RC.QuadPart = - Subtrahend.QuadPart; + Shift = ShiftCount % 64; - return RC; -} + if (Shift < 32) + { + RC.QuadPart = LargeInteger.QuadPart >> Shift; + } + else + { + /* copy the sign bit */ + RC.u.HighPart |= (LargeInteger.u.HighPart & 0x80000000); + RC.u.LowPart = LargeInteger.u.HighPart >> Shift; + } -BOOLEAN -RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart != Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart != 0; + return RC; } LARGE_INTEGER -RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger, - CCHAR ShiftCount) +STDCALL +RtlLargeIntegerDivide ( + LARGE_INTEGER Dividend, + LARGE_INTEGER Divisor, + PLARGE_INTEGER Remainder + ) { - LARGE_INTEGER RC; - CCHAR Shift; + LARGE_INTEGER RC; - Shift = ShiftCount % 64; + if (Remainder) + Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart; - RC.QuadPart = LargeInteger.QuadPart << Shift; + RC.QuadPart = Dividend.QuadPart / Divisor.QuadPart; - return RC; + return RC; } LARGE_INTEGER -RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger, - CCHAR ShiftCount) +STDCALL +RtlLargeIntegerNegate ( + LARGE_INTEGER Subtrahend + ) { - LARGE_INTEGER RC; - CCHAR Shift; + LARGE_INTEGER RC; - Shift = ShiftCount % 64; + RC.QuadPart = - Subtrahend.QuadPart; - RC.QuadPart = LargeInteger.QuadPart >> Shift; - - return RC; + return RC; } LARGE_INTEGER -RtlLargeIntegerSubtract(LARGE_INTEGER Minuend, - LARGE_INTEGER Subtrahend) +STDCALL +RtlLargeIntegerShiftLeft ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; + CCHAR Shift; - RC.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; + Shift = ShiftCount % 64; + RC.QuadPart = LargeInteger.QuadPart << Shift; - return RC; + return RC; +} + +LARGE_INTEGER +STDCALL +RtlLargeIntegerShiftRight ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ) +{ + LARGE_INTEGER RC; + CCHAR Shift; + + Shift = ShiftCount % 64; + RC.QuadPart = LargeInteger.QuadPart >> Shift; + + return RC; +} + +LARGE_INTEGER +STDCALL +RtlLargeIntegerSubtract ( + LARGE_INTEGER Minuend, + LARGE_INTEGER Subtrahend + ) +{ + LARGE_INTEGER RC; + + RC.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; + + return RC; } /* EOF */ diff --git a/reactos/lib/ntdll/rtl/namespc.c b/reactos/lib/ntdll/rtl/namespc.c deleted file mode 100644 index 7adbb791992..00000000000 --- a/reactos/lib/ntdll/rtl/namespc.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $Id: namespc.c,v 1.2 1999/09/29 23:10:25 ekohl Exp $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/lib/ntdll/namespc.c - * PURPOSE: Manages the system namespace - * PROGRAMMER: David Welch (welch@mcmail.com) - * UPDATE HISTORY: - * 24/12/98: Created - */ - -/* INCLUDES ***************************************************************/ - -#include - -/* FUNCTIONS **************************************************************/ - -VOID InitializeObjectAttributes(POBJECT_ATTRIBUTES InitializedAttributes, - PUNICODE_STRING ObjectName, - ULONG Attributes, - HANDLE RootDirectory, - PSECURITY_DESCRIPTOR SecurityDescriptor) -/* - * FUNCTION: Sets up a parameter of type OBJECT_ATTRIBUTES for a - * subsequent call to ZwCreateXXX or ZwOpenXXX - * ARGUMENTS: - * InitializedAttributes (OUT) = Caller supplied storage for the - * object attributes - * ObjectName = Full path name for object - * Attributes = Attributes for the object - * RootDirectory = Where the object should be placed or NULL - * SecurityDescriptor = Ignored - * - * NOTE: - * Either ObjectName is a fully qualified pathname or a path relative - * to RootDirectory - */ -{ - InitializedAttributes->Length=sizeof(OBJECT_ATTRIBUTES); - InitializedAttributes->RootDirectory=RootDirectory; - InitializedAttributes->ObjectName=ObjectName; - InitializedAttributes->Attributes=Attributes; - InitializedAttributes->SecurityDescriptor=SecurityDescriptor; - InitializedAttributes->SecurityQualityOfService=NULL; -} - -/* EOF */ diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 7727ceae018..d68aeee8487 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.28 1999/11/25 23:35:24 ekohl Exp $ +; $Id: ntoskrnl.def,v 1.29 1999/11/27 03:29:46 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -74,7 +74,7 @@ ExReleaseResourceForThreadLite ExSystemTimeToLocalTime ExTryToAcquireResourceExclusiveLite HalRegisterServiceTable -InitializeObjectAttributes +;InitializeObjectAttributes IoAllocateController IoAttachDeviceToDeviceStack IoBuildSynchronousFsdRequest @@ -185,21 +185,21 @@ RtlCharToInteger@12 RtlCompareMemory@12 RtlCompareString@12 RtlCompareUnicodeString@12 -RtlConvertLongToLargeInteger -RtlConvertUlongToLargeInteger +RtlConvertLongToLargeInteger@4 +RtlConvertUlongToLargeInteger@4 RtlCopyMemory RtlCopyString@8 RtlCopyUnicodeString@8 RtlCreateUnicodeString@8 RtlDowncaseUnicodeString@12 -RtlEnlargedIntegerMultiply -RtlEnlargedUnsignedDivide -RtlEnlargedUnsignedMultiply +RtlEnlargedIntegerMultiply@8 +RtlEnlargedUnsignedDivide@16 +RtlEnlargedUnsignedMultiply@8 RtlEqualString@12 RtlEqualUnicodeString@12 -RtlExtendedIntegerMultiply -RtlExtendedLargeIntegerDivide -RtlExtendedMagicDivide +RtlExtendedIntegerMultiply@12 +RtlExtendedLargeIntegerDivide@16 +RtlExtendedMagicDivide@20 RtlFillMemory@12 RtlFillMemoryUlong@12 RtlFreeAnsiString@4 @@ -211,13 +211,13 @@ RtlInitString@8 RtlInitUnicodeString@8 RtlIntegerToChar@16 RtlIntegerToUnicodeString@12 -RtlLargeIntegerAdd -RtlLargeIntegerArithmeticShift -RtlLargeIntegerDivide -RtlLargeIntegerNegate -RtlLargeIntegerShiftLeft -RtlLargeIntegerShiftRight -RtlLargeIntegerSubtract +RtlLargeIntegerAdd@16 +RtlLargeIntegerArithmeticShift@12 +RtlLargeIntegerDivide@20 +RtlLargeIntegerNegate@8 +RtlLargeIntegerShiftLeft@12 +RtlLargeIntegerShiftRight@12 +RtlLargeIntegerSubtract@16 RtlMoveMemory@12 RtlMultiByteToUnicodeN@20 RtlMultiByteToUnicodeSize@12 @@ -359,8 +359,8 @@ _wcsnicmp _wcsnset _wcsrev _wcsupr -;atoi -;atol +atoi +atol isdigit islower isprint diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index 32c43710807..6070d2ae798 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.edf,v 1.15 1999/11/25 23:35:24 ekohl Exp $ +; $Id: ntoskrnl.edf,v 1.16 1999/11/27 03:29:46 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -74,7 +74,7 @@ ExReleaseResourceForThreadLite ExSystemTimeToLocalTime ExTryToAcquireResourceExclusiveLite HalRegisterServiceTable -InitializeObjectAttributes +;InitializeObjectAttributes IoAllocateController IoAttachDeviceToDeviceStack IoBuildSynchronousFsdRequest @@ -185,21 +185,21 @@ RtlCharToInteger=RtlCharToInteger@12 RtlCompareMemory=RtlCompareMemory@12 RtlCompareString=RtlCompareString@12 RtlCompareUnicodeString=RtlCompareUnicodeString@12 -RtlConvertLongToLargeInteger -RtlConvertUlongToLargeInteger +RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4 +RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4 RtlCopyMemory RtlCopyString=RtlCopyString@8 RtlCopyUnicodeString=RtlCopyUnicodeString@8 RtlCreateUnicodeString=RtlCreateUnicodeString@8 RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12 -RtlEnlargedIntegerMultiply -RtlEnlargedUnsignedDivide -RtlEnlargedUnsignedMultiply +RtlEnlargedIntegerMultiply=RtlEnlargedIntegerMultiply@8 +RtlEnlargedUnsignedDivide=RtlEnlargedUnsignedDivide@16 +RtlEnlargedUnsignedMultiply=RtlEnlargedUnsignedMultiply@8 RtlEqualString=RtlEqualString@12 RtlEqualUnicodeString=RtlEqualUnicodeString@12 -RtlExtendedIntegerMultiply -RtlExtendedLargeIntegerDivide -RtlExtendedMagicDivide +RtlExtendedIntegerMultiply=RtlExtendedIntegerMultiply@12 +RtlExtendedLargeIntegerDivide=RtlExtendedLargeIntegerDivide@16 +RtlExtendedMagicDivide=RtlExtendedMagicDivide@20 RtlFillMemory=RtlFillMemory@12 RtlFillMemoryUlong=RtlFillMemoryUlong@12 RtlFreeAnsiString=RtlFreeAnsiString@4 @@ -211,13 +211,13 @@ RtlInitString=RtlInitString@8 RtlInitUnicodeString=RtlInitUnicodeString@8 RtlIntegerToChar=RtlIntegerToChar@16 RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12 -RtlLargeIntegerAdd -RtlLargeIntegerArithmeticShift -RtlLargeIntegerDivide -RtlLargeIntegerNegate -RtlLargeIntegerShiftLeft -RtlLargeIntegerShiftRight -RtlLargeIntegerSubtract +RtlLargeIntegerAdd=RtlLargeIntegerAdd@16 +RtlLargeIntegerArithmeticShift=RtlLargeIntegerArithmeticShift@12 +RtlLargeIntegerDivide=RtlLargeIntegerDivide@20 +RtlLargeIntegerNegate=RtlLargeIntegerNegate@8 +RtlLargeIntegerShiftLeft=RtlLargeIntegerShiftLeft@12 +RtlLargeIntegerShiftRight=RtlLargeIntegerShiftRight@12 +RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16 RtlMoveMemory=RtlMoveMemory@12 RtlMultiByteToUnicodeN=RtlMultiByteToUnicodeN@20 RtlMultiByteToUnicodeSize=RtlMultiByteToUnicodeSize@12 @@ -357,8 +357,8 @@ _wcsnicmp _wcsnset _wcsrev _wcsupr -;atoi -;atol +atoi +atol isdigit islower isprint diff --git a/reactos/ntoskrnl/ob/dirobj.c b/reactos/ntoskrnl/ob/dirobj.c index 58818118d83..c573f2ad2d7 100644 --- a/reactos/ntoskrnl/ob/dirobj.c +++ b/reactos/ntoskrnl/ob/dirobj.c @@ -1,4 +1,4 @@ -/* $Id: dirobj.c,v 1.5 1999/08/29 06:59:10 ea Exp $ +/* $Id: dirobj.c,v 1.6 1999/11/27 03:31:08 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -57,9 +57,9 @@ NtOpenDirectoryObject ( { PVOID Object; NTSTATUS Status; - + *DirectoryHandle = 0; - + Status = ObReferenceObjectByName( ObjectAttributes->ObjectName, ObjectAttributes->Attributes, @@ -74,7 +74,7 @@ NtOpenDirectoryObject ( { return Status; } - + Status = ObCreateHandle( PsGetCurrentProcess(), Object, @@ -152,9 +152,9 @@ NtQueryDirectoryObject ( dir, HEADER_TO_BODY(&(namespc_root.hdr)) ); - + // assert_irql(PASSIVE_LEVEL); - + Status = ObReferenceObjectByHandle( DirObjHandle, DIRECTORY_QUERY, @@ -170,11 +170,11 @@ NtQueryDirectoryObject ( EntriesToRead = BufferLength / sizeof (OBJDIR_INFORMATION); *DataWritten = 0; - + DPRINT("EntriesToRead %d\n",EntriesToRead); - + current_entry = dir->head.Flink; - + /* * Optionally, skip over some entries at the start of the directory */ @@ -188,9 +188,9 @@ NtQueryDirectoryObject ( current_entry = current_entry->Flink; } } - + DPRINT("DirObjInformation %x\n",DirObjInformation); - + /* * Read the maximum entries possible into the buffer */ @@ -232,7 +232,7 @@ NtQueryDirectoryObject ( CHECKPOINT; } CHECKPOINT; - + /* * Optionally, count the number of entries in the directory */ @@ -285,7 +285,7 @@ NtCreateDirectoryObject ( ) { PDIRECTORY_OBJECT dir; - + dir = ObCreateObject( DirectoryHandle, DesiredAccess, @@ -295,65 +295,4 @@ NtCreateDirectoryObject ( return STATUS_SUCCESS; } - -/********************************************************************** - * NAME (MACRO in DDK) - * InitializeObjectAttributes - * - * DESCRIPTION - * Sets up a parameter of type OBJECT_ATTRIBUTES for a - * subsequent call to ZwCreateXXX or ZwOpenXXX. - * - * ARGUMENTS - * InitializedAttributes (OUT) - * Caller supplied storage for the object attributes. - * - * ObjectName - * Full path name for object. - * - * Attributes - * Attributes for the object. - * - * RootDirectory - * Where the object should be placed or NULL. - * - * SecurityDescriptor - * Ignored. - * - * NOTE - * Either ObjectName is a fully qualified pathname or a path - * relative to RootDirectory. - */ -VOID -InitializeObjectAttributes ( - POBJECT_ATTRIBUTES InitializedAttributes, - PUNICODE_STRING ObjectName, - ULONG Attributes, - HANDLE RootDirectory, - PSECURITY_DESCRIPTOR SecurityDescriptor - ) -{ - DPRINT( - "InitializeObjectAttributes(InitializedAttributes %x " - "ObjectName %x Attributes %x RootDirectory %x)\n", - InitializedAttributes, - ObjectName, - Attributes, - RootDirectory - ); - InitializedAttributes->Length = - sizeof (OBJECT_ATTRIBUTES); - InitializedAttributes->RootDirectory = - RootDirectory; - InitializedAttributes->ObjectName = - ObjectName; - InitializedAttributes->Attributes = - Attributes; - InitializedAttributes->SecurityDescriptor = - SecurityDescriptor; - InitializedAttributes->SecurityQualityOfService = - NULL; -} - - /* EOF */ diff --git a/reactos/ntoskrnl/rtl/largeint.c b/reactos/ntoskrnl/rtl/largeint.c index 64ab289f7aa..70262773977 100644 --- a/reactos/ntoskrnl/rtl/largeint.c +++ b/reactos/ntoskrnl/rtl/largeint.c @@ -1,4 +1,4 @@ -/* $Id: largeint.c,v 1.8 1999/11/09 18:01:43 ekohl Exp $ +/* $Id: largeint.c,v 1.9 1999/11/27 03:31:20 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -19,275 +19,232 @@ /* FUNCTIONS *****************************************************************/ -LARGE_INTEGER -RtlConvertLongToLargeInteger(LONG SignedInteger) +LARGE_INTEGER +STDCALL +RtlConvertLongToLargeInteger ( + LONG SignedInteger + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = SignedInteger; + RC.QuadPart = SignedInteger; - return RC; + return RC; } -LARGE_INTEGER -RtlConvertUlongToLargeInteger(ULONG UnsignedInteger) +LARGE_INTEGER +STDCALL +RtlConvertUlongToLargeInteger ( + ULONG UnsignedInteger + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = UnsignedInteger; + RC.QuadPart = UnsignedInteger; - return RC; + return RC; } -LARGE_INTEGER -RtlEnlargedIntegerMultiply(LONG Multiplicand, - LONG Multiplier) +LARGE_INTEGER +STDCALL +RtlEnlargedIntegerMultiply ( + LONG Multiplicand, + LONG Multiplier + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = (LONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (LONGLONG) Multiplicand * Multiplier; - return RC; + return RC; } ULONG -RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend, - ULONG Divisor, - PULONG Remainder) +STDCALL +RtlEnlargedUnsignedDivide ( + ULARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder + ) { - if (Remainder) - *Remainder = Dividend.QuadPart % Divisor; + if (Remainder) + *Remainder = Dividend.QuadPart % Divisor; - return (ULONG)(Dividend.QuadPart / Divisor); + return (ULONG)(Dividend.QuadPart / Divisor); } LARGE_INTEGER -RtlEnlargedUnsignedMultiply(ULONG Multiplicand, - ULONG Multiplier) +STDCALL +RtlEnlargedUnsignedMultiply ( + ULONG Multiplicand, + ULONG Multiplier + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - RC.QuadPart = (ULONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (ULONGLONG) Multiplicand * Multiplier; - return RC; -} - -LARGE_INTEGER -RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand, - LONG Multiplier) -{ - LARGE_INTEGER RC; - - RC.QuadPart = Multiplicand.QuadPart * Multiplier; - - return RC; + return RC; } LARGE_INTEGER -RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend, - ULONG Divisor, - PULONG Remainder) +STDCALL +RtlExtendedIntegerMultiply ( + LARGE_INTEGER Multiplicand, + LONG Multiplier + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - if (Remainder) - *Remainder = Dividend.QuadPart % Divisor; + RC.QuadPart = Multiplicand.QuadPart * Multiplier; - RC.QuadPart = Dividend.QuadPart / Divisor; - - return RC; + return RC; } LARGE_INTEGER -RtlExtendedMagicDivide(LARGE_INTEGER Dividend, - LARGE_INTEGER MagicDivisor, - CCHAR ShiftCount) +STDCALL +RtlExtendedLargeIntegerDivide ( + LARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder + ) { - UNIMPLEMENTED; -} + LARGE_INTEGER RC; -LARGE_INTEGER -RtlLargeIntegerAdd(LARGE_INTEGER Addend1, - LARGE_INTEGER Addend2) -{ - LARGE_INTEGER RC; + if (Remainder) + *Remainder = Dividend.QuadPart % Divisor; - RC.QuadPart = Addend1.QuadPart + Addend2.QuadPart; + RC.QuadPart = Dividend.QuadPart / Divisor; - return RC; -} - -VOID -RtlLargeIntegerAnd(PLARGE_INTEGER Result, - LARGE_INTEGER Source, - LARGE_INTEGER Mask) -{ - Result->QuadPart = Source.QuadPart & Mask.QuadPart; + return RC; } LARGE_INTEGER -RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger, - CCHAR ShiftCount) +STDCALL +RtlExtendedMagicDivide ( + LARGE_INTEGER Dividend, + LARGE_INTEGER MagicDivisor, + CCHAR ShiftCount + ) { - LARGE_INTEGER RC; - CHAR Shift; - - Shift = ShiftCount % 64; - - if (Shift < 32) - { - RC.QuadPart = LargeInteger.QuadPart >> Shift; - } - else - { - /* copy the sign bit */ - RC.u.HighPart |= (LargeInteger.u.HighPart & 0x80000000); - RC.u.LowPart = LargeInteger.u.HighPart >> Shift; - } - - return RC; + UNIMPLEMENTED; } LARGE_INTEGER -RtlLargeIntegerDivide(LARGE_INTEGER Dividend, - LARGE_INTEGER Divisor, - PLARGE_INTEGER Remainder) +STDCALL +RtlLargeIntegerAdd ( + LARGE_INTEGER Addend1, + LARGE_INTEGER Addend2 + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; - if (Remainder) - Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart; + RC.QuadPart = Addend1.QuadPart + Addend2.QuadPart; - RC.QuadPart = Dividend.QuadPart / Divisor.QuadPart; - - return RC; -} - -BOOLEAN -RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart == Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerEqualToZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart == 0 ; -} - -BOOLEAN -RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart > Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart >= Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1) -{ - return Operand1.QuadPart >= 0; -} - -BOOLEAN -RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1) -{ - return Operand1.QuadPart > 0; -} - -BOOLEAN -RtlLargeIntegerLessThan(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart < Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart <= Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart <= 0; -} - -BOOLEAN -RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart < 0; + return RC; } LARGE_INTEGER -RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend) +STDCALL +RtlLargeIntegerArithmeticShift ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; + CHAR Shift; - RC.QuadPart = - Subtrahend.QuadPart; + Shift = ShiftCount % 64; - return RC; -} + if (Shift < 32) + { + RC.QuadPart = LargeInteger.QuadPart >> Shift; + } + else + { + /* copy the sign bit */ + RC.u.HighPart |= (LargeInteger.u.HighPart & 0x80000000); + RC.u.LowPart = LargeInteger.u.HighPart >> Shift; + } -BOOLEAN -RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1, - LARGE_INTEGER Operand2) -{ - return Operand1.QuadPart != Operand2.QuadPart; -} - -BOOLEAN -RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand) -{ - return Operand.QuadPart != 0; + return RC; } LARGE_INTEGER -RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger, - CCHAR ShiftCount) +STDCALL +RtlLargeIntegerDivide ( + LARGE_INTEGER Dividend, + LARGE_INTEGER Divisor, + PLARGE_INTEGER Remainder + ) { - LARGE_INTEGER RC; - CHAR Shift; + LARGE_INTEGER RC; - Shift = ShiftCount % 64; + if (Remainder) + Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart; - RC.QuadPart = LargeInteger.QuadPart << Shift; + RC.QuadPart = Dividend.QuadPart / Divisor.QuadPart; - return RC; + return RC; } LARGE_INTEGER -RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger, - CCHAR ShiftCount) +STDCALL +RtlLargeIntegerNegate ( + LARGE_INTEGER Subtrahend + ) { - LARGE_INTEGER RC; - CHAR Shift; + LARGE_INTEGER RC; - Shift = ShiftCount % 64; + RC.QuadPart = - Subtrahend.QuadPart; - RC.QuadPart = LargeInteger.QuadPart >> ShiftCount; - - return RC; + return RC; } LARGE_INTEGER -RtlLargeIntegerSubtract(LARGE_INTEGER Minuend, - LARGE_INTEGER Subtrahend) +STDCALL +RtlLargeIntegerShiftLeft ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ) { - LARGE_INTEGER RC; + LARGE_INTEGER RC; + CHAR Shift; - RC.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; + Shift = ShiftCount % 64; + RC.QuadPart = LargeInteger.QuadPart << Shift; - return RC; + return RC; +} + +LARGE_INTEGER +STDCALL +RtlLargeIntegerShiftRight ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ) +{ + LARGE_INTEGER RC; + CHAR Shift; + + Shift = ShiftCount % 64; + RC.QuadPart = LargeInteger.QuadPart >> ShiftCount; + + return RC; +} + +LARGE_INTEGER +STDCALL +RtlLargeIntegerSubtract ( + LARGE_INTEGER Minuend, + LARGE_INTEGER Subtrahend + ) +{ + LARGE_INTEGER RC; + + RC.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; + + return RC; } /* EOF */