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

@ -65,10 +65,10 @@ enum _BMF_TYPES
BMF_1BPP = 1, BMF_1BPP = 1,
BMF_4BPP, BMF_4BPP,
BMF_8BPP, BMF_8BPP,
BMF_16BPP, BMF_16BPP,
BMF_24BPP, BMF_24BPP,
BMF_32BPP, BMF_32BPP,
BMF_4RLE, BMF_4RLE,
BMF_8RLE BMF_8RLE
}; };
@ -124,7 +124,7 @@ enum _CD_ORDERS
enum _ESCAPE_CODES enum _ESCAPE_CODES
{ {
ESC_PASSTHROUGH, ESC_PASSTHROUGH,
ESC_QUERYESCSUPPORT ESC_QUERYESCSUPPORT
}; };
#define FM_INFO_TECH_TRUETYPE 0x00000001 #define FM_INFO_TECH_TRUETYPE 0x00000001
@ -354,7 +354,7 @@ enum _DRV_HOOK_FUNCS
enum _QUERY_ADVANCE_WIDTH_TYPES enum _QUERY_ADVANCE_WIDTH_TYPES
{ {
QAW_GETWIDTHS = 1, QAW_GETWIDTHS = 1,
QAW_GETEASYWIDTHS QAW_GETEASYWIDTHS
}; };
#define QC_OUTLINES 0x00000001 #define QC_OUTLINES 0x00000001
@ -389,7 +389,7 @@ enum _SPS_RC
enum _SURF_TYPES enum _SURF_TYPES
{ {
STYPE_BITMAP = 1, STYPE_BITMAP = 1,
STYPE_DEVICE, STYPE_DEVICE,
STYPE_DEVBITMAP STYPE_DEVBITMAP
}; };
@ -435,14 +435,14 @@ typedef struct _DRVENABLEDATA
/* FIXME: replace this with correct def for LDECI4 */ /* FIXME: replace this with correct def for LDECI4 */
typedef DWORD LDECI4; typedef DWORD LDECI4;
typedef struct _CIECHROMA typedef struct _CIECHROMA
{ {
LDECI4 x; LDECI4 x;
LDECI4 y; LDECI4 y;
LDECI4 Y; LDECI4 Y;
} CIECHROMA, *PCIECHROMA; } CIECHROMA, *PCIECHROMA;
typedef struct _COLORINFO typedef struct _COLORINFO
{ {
CIECHROMA Red; CIECHROMA Red;
CIECHROMA Green; CIECHROMA Green;
@ -462,7 +462,7 @@ typedef struct _COLORINFO
LDECI4 MagentaInYellowDye; LDECI4 MagentaInYellowDye;
} COLORINFO, *PCOLORINFO; } COLORINFO, *PCOLORINFO;
typedef struct _DEVINFO typedef struct _DEVINFO
{ {
ULONG flGraphicsCaps; ULONG flGraphicsCaps;
LOGFONTW lfDefaultFont; LOGFONTW lfDefaultFont;
@ -475,7 +475,7 @@ typedef struct _DEVINFO
HPALETTE hpalDefault; HPALETTE hpalDefault;
} DEVINFO, *PDEVINFO; } DEVINFO, *PDEVINFO;
typedef struct _GDIINFO typedef struct _GDIINFO
{ {
ULONG ulVersion; ULONG ulVersion;
ULONG ulTechnology; ULONG ulTechnology;
@ -514,7 +514,7 @@ typedef struct _GDIINFO
ULONG ulPanningVertRes; ULONG ulPanningVertRes;
} GDIINFO, *PGDIINFO; } GDIINFO, *PGDIINFO;
typedef struct _BRUSHOBJ typedef struct _BRUSHOBJ
{ {
ULONG iSolidColor; ULONG iSolidColor;
PVOID pvRbrush; PVOID pvRbrush;
@ -523,7 +523,7 @@ typedef struct _BRUSHOBJ
LOGBRUSH logbrush; LOGBRUSH logbrush;
} BRUSHOBJ, *PBRUSHOBJ; } BRUSHOBJ, *PBRUSHOBJ;
typedef struct _CLIPOBJ typedef struct _CLIPOBJ
{ {
ULONG iUniq; ULONG iUniq;
RECTL rclBounds; RECTL rclBounds;
@ -533,27 +533,27 @@ typedef struct _CLIPOBJ
BYTE fjOptions; BYTE fjOptions;
} CLIPOBJ, *PCLIPOBJ; } CLIPOBJ, *PCLIPOBJ;
typedef struct _ENUMRECTS typedef struct _ENUMRECTS
{ {
ULONG c; ULONG c;
RECTL arcl[1]; RECTL arcl[1];
} ENUMRECTS, *PENUMRECTS; } ENUMRECTS, *PENUMRECTS;
typedef struct _FONTOBJ typedef struct _FONTOBJ
{ {
ULONG iUniq; ULONG iUniq;
ULONG iFace; ULONG iFace;
ULONG cxMax; ULONG cxMax;
ULONG flFontType; ULONG flFontType;
ULONG iTTUniq; ULONG iTTUniq;
ULONG iFile; ULONG iFile;
SIZE sizLogResPpi; SIZE sizLogResPpi;
ULONG ulStyleSize; ULONG ulStyleSize;
PVOID pvConsumer; PVOID pvConsumer;
PVOID pvProducer; PVOID pvProducer;
} FONTOBJ, *PFONTOBJ; } FONTOBJ, *PFONTOBJ;
typedef struct _IFIMETRICS typedef struct _IFIMETRICS
{ {
ULONG cjThis; ULONG cjThis;
ULONG ulVersion; ULONG ulVersion;
@ -618,7 +618,7 @@ typedef struct _IFIMETRICS
#define NB_RESERVED_COLORS 20 // number of fixed colors in system palette #define NB_RESERVED_COLORS 20 // number of fixed colors in system palette
typedef struct _XLATEOBJ typedef struct _XLATEOBJ
{ {
ULONG iUniq; ULONG iUniq;
ULONG flXlate; ULONG flXlate;
@ -641,7 +641,7 @@ typedef struct _PATHOBJ
ULONG cCurves; ULONG cCurves;
} PATHOBJ, *PPATHOBJ; } PATHOBJ, *PPATHOBJ;
typedef struct _SURFOBJ typedef struct _SURFOBJ
{ {
DHSURF dhsurf; DHSURF dhsurf;
HSURF hsurf; HSURF hsurf;
@ -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,

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) * KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them. * Remove from this file, if you implement them.
@ -375,7 +375,7 @@ GetComputerNameW (
{ {
WCHAR Name [MAX_COMPUTERNAME_LENGTH + 1]; WCHAR Name [MAX_COMPUTERNAME_LENGTH + 1];
DWORD Size = 0; DWORD Size = 0;
/* /*
* FIXME: get the computer's name from * FIXME: get the computer's name from
* the registry. * the registry.
@ -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
} }
@ -901,17 +943,17 @@ MulDiv (
* MB_COMPOSITE * MB_COMPOSITE
* MB_ERR_INVALID_CHARS * MB_ERR_INVALID_CHARS
* MB_USEGLYPHCHARS * MB_USEGLYPHCHARS
* *
* lpMultiByteStr * lpMultiByteStr
* Input buffer; * Input buffer;
* *
* cchMultiByte * cchMultiByte
* Size of MultiByteStr, or -1 if MultiByteStr is * Size of MultiByteStr, or -1 if MultiByteStr is
* NULL terminated; * NULL terminated;
* *
* lpWideCharStr * lpWideCharStr
* Output buffer; * Output buffer;
* *
* cchWideChar * cchWideChar
* Size (in WCHAR unit) of WideCharStr, or 0 * Size (in WCHAR unit) of WideCharStr, or 0
* if the caller just wants to know how large * if the caller just wants to know how large
@ -924,7 +966,7 @@ MulDiv (
* *
* NOTE * NOTE
* A raw converter for now. It assumes lpMultiByteStr is * A raw converter for now. It assumes lpMultiByteStr is
* NEVER multi-byte (that is each input character is * NEVER multi-byte (that is each input character is
* 8-bit ASCII) and is ALWAYS NULL terminated. * 8-bit ASCII) and is ALWAYS NULL terminated.
* FIXME-FIXME-FIXME-FIXME * FIXME-FIXME-FIXME-FIXME
*/ */
@ -1004,7 +1046,7 @@ MultiByteToWideChar (
for ( cchConverted = 0, for ( cchConverted = 0,
r = (PCHAR) lpMultiByteStr, r = (PCHAR) lpMultiByteStr,
w = (PWCHAR) lpWideCharStr; w = (PWCHAR) lpWideCharStr;
((*r) && (cchConverted < cchWideChar)); ((*r) && (cchConverted < cchWideChar));
r++, r++,

View file

@ -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

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 ; 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

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 ; 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

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 * 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;