Export MmCopyFrom/ToCaller from ntoskrnl. Added MulDiv.

svn path=/trunk/; revision=3261
This commit is contained in:
Eugene Ingerman 2002-07-18 21:49:59 +00:00
parent 76e2e2e22f
commit 52102e72fc
6 changed files with 96 additions and 46 deletions

View file

@ -1204,11 +1204,15 @@ EngMapFontFile
EngMapModule
EngMarkBandingSurface
EngMovePointer
EngMulDiv
EngMultiByteToUnicodeN
EngMultiByteToWideChar
*/
INT STDCALL EngMulDiv(
INT nMultiplicand,
INT nMultiplier,
INT nDivisor);
BOOL STDCALL
EngPaint(IN SURFOBJ *Surface,
IN CLIPOBJ *ClipRegion,

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.28 2001/05/03 06:13:05 ekohl Exp $
/* $Id: stubs.c,v 1.29 2002/07/18 21:49:58 ei Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
@ -872,16 +872,58 @@ LoadModule (
}
int
STDCALL
MulDiv (
int nNumber,
int nNumerator,
int nDenominator
)
/***********************************************************************
* MulDiv (KERNEL32.@)
* RETURNS
* Result of multiplication and division
* -1: Overflow occurred or Divisor was 0
*/
//FIXME! move to correct file
INT STDCALL MulDiv(
INT nMultiplicand,
INT nMultiplier,
INT nDivisor)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
#if SIZEOF_LONG_LONG >= 8
long long ret;
if (!nDivisor) return -1;
/* We want to deal with a positive divisor to simplify the logic. */
if (nDivisor < 0)
{
nMultiplicand = - nMultiplicand;
nDivisor = -nDivisor;
}
/* If the result is positive, we "add" to round. else, we subtract to round. */
if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
else
ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
if ((ret > 2147483647) || (ret < -2147483647)) return -1;
return ret;
#else
if (!nDivisor) return -1;
/* We want to deal with a positive divisor to simplify the logic. */
if (nDivisor < 0)
{
nMultiplicand = - nMultiplicand;
nDivisor = -nDivisor;
}
/* If the result is positive, we "add" to round. else, we subtract to round. */
if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
#endif
}

View file

@ -4,9 +4,9 @@
NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
NTSTATUS
NTSTATUS STDCALL
MmCopyFromCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
NTSTATUS
NTSTATUS STDCALL
MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
NTSTATUS

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.136 2002/07/18 18:15:09 ekohl Exp $
; $Id: ntoskrnl.def,v 1.137 2002/07/18 21:49:59 ei Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -474,6 +474,8 @@ MmAllocateContiguousMemory@12
MmAllocateNonCachedMemory@4
MmBuildMdlForNonPagedPool@4
MmCanFileBeTruncated@8
MmCopyFromCaller@12
MmCopyToCaller@12
MmCreateMdl@12
MmCreateSection@32
MmDbgTranslatePhysicalAddress@8

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.122 2002/07/18 18:15:09 ekohl Exp $
; $Id: ntoskrnl.edf,v 1.123 2002/07/18 21:49:59 ei Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -474,6 +474,8 @@ MmAllocateContiguousMemory=MmAllocateContiguousMemory@12
MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4
MmBuildMdlForNonPagedPool=MmBuildMdlForNonPagedPool@4
MmCanFileBeTruncated=MmCanFileBeTruncated@8
MmCopyFromCaller=MmCopyFromCaller@12
MmCopyToCaller=MmCopyToCaller@12
MmCreateMdl=MmCreateMdl@12
MmCreateSection=MmCreateSection@32
MmDbgTranslatePhysicalAddress=MmDbgTranslatePhysicalAddress@8

View file

@ -1,4 +1,4 @@
/* $Id: mem.c,v 1.13 2002/05/14 21:19:21 dwelch Exp $
/* $Id: mem.c,v 1.14 2002/07/18 21:49:59 ei Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -19,7 +19,7 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS
NTSTATUS STDCALL
MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
{
NTSTATUS Status;
@ -40,7 +40,7 @@ MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
}
}
NTSTATUS
NTSTATUS STDCALL
MmCopyFromCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
{
NTSTATUS Status;