mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Export MmCopyFrom/ToCaller from ntoskrnl. Added MulDiv.
svn path=/trunk/; revision=3261
This commit is contained in:
parent
76e2e2e22f
commit
52102e72fc
6 changed files with 96 additions and 46 deletions
|
@ -1204,11 +1204,15 @@ EngMapFontFile
|
||||||
EngMapModule
|
EngMapModule
|
||||||
EngMarkBandingSurface
|
EngMarkBandingSurface
|
||||||
EngMovePointer
|
EngMovePointer
|
||||||
EngMulDiv
|
|
||||||
EngMultiByteToUnicodeN
|
EngMultiByteToUnicodeN
|
||||||
EngMultiByteToWideChar
|
EngMultiByteToWideChar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
INT STDCALL EngMulDiv(
|
||||||
|
INT nMultiplicand,
|
||||||
|
INT nMultiplier,
|
||||||
|
INT nDivisor);
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
EngPaint(IN SURFOBJ *Surface,
|
EngPaint(IN SURFOBJ *Surface,
|
||||||
IN CLIPOBJ *ClipRegion,
|
IN CLIPOBJ *ClipRegion,
|
||||||
|
|
|
@ -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)
|
* KERNEL32.DLL stubs (unimplemented functions)
|
||||||
* Remove from this file, if you implement them.
|
* Remove from this file, if you implement them.
|
||||||
|
@ -872,16 +872,58 @@ LoadModule (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
/***********************************************************************
|
||||||
STDCALL
|
* MulDiv (KERNEL32.@)
|
||||||
MulDiv (
|
* RETURNS
|
||||||
int nNumber,
|
* Result of multiplication and division
|
||||||
int nNumerator,
|
* -1: Overflow occurred or Divisor was 0
|
||||||
int nDenominator
|
*/
|
||||||
)
|
|
||||||
|
//FIXME! move to correct file
|
||||||
|
INT STDCALL MulDiv(
|
||||||
|
INT nMultiplicand,
|
||||||
|
INT nMultiplier,
|
||||||
|
INT nDivisor)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
#if SIZEOF_LONG_LONG >= 8
|
||||||
return 0;
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
||||||
NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
MmCopyFromCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
MmCopyFromCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -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
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -474,6 +474,8 @@ MmAllocateContiguousMemory@12
|
||||||
MmAllocateNonCachedMemory@4
|
MmAllocateNonCachedMemory@4
|
||||||
MmBuildMdlForNonPagedPool@4
|
MmBuildMdlForNonPagedPool@4
|
||||||
MmCanFileBeTruncated@8
|
MmCanFileBeTruncated@8
|
||||||
|
MmCopyFromCaller@12
|
||||||
|
MmCopyToCaller@12
|
||||||
MmCreateMdl@12
|
MmCreateMdl@12
|
||||||
MmCreateSection@32
|
MmCreateSection@32
|
||||||
MmDbgTranslatePhysicalAddress@8
|
MmDbgTranslatePhysicalAddress@8
|
||||||
|
|
|
@ -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
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -474,6 +474,8 @@ MmAllocateContiguousMemory=MmAllocateContiguousMemory@12
|
||||||
MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4
|
MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4
|
||||||
MmBuildMdlForNonPagedPool=MmBuildMdlForNonPagedPool@4
|
MmBuildMdlForNonPagedPool=MmBuildMdlForNonPagedPool@4
|
||||||
MmCanFileBeTruncated=MmCanFileBeTruncated@8
|
MmCanFileBeTruncated=MmCanFileBeTruncated@8
|
||||||
|
MmCopyFromCaller=MmCopyFromCaller@12
|
||||||
|
MmCopyToCaller=MmCopyToCaller@12
|
||||||
MmCreateMdl=MmCreateMdl@12
|
MmCreateMdl=MmCreateMdl@12
|
||||||
MmCreateSection=MmCreateSection@32
|
MmCreateSection=MmCreateSection@32
|
||||||
MmDbgTranslatePhysicalAddress=MmDbgTranslatePhysicalAddress@8
|
MmDbgTranslatePhysicalAddress=MmDbgTranslatePhysicalAddress@8
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
|
MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -40,7 +40,7 @@ MmCopyToCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
MmCopyFromCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
|
MmCopyFromCaller(PVOID Dest, PVOID Src, ULONG NumberOfBytes)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
Loading…
Reference in a new issue