Implement EngQueryPerformanceFrequency, EngQueryPerformanceCounter and

partly Eng(Un)SecureMem

svn path=/trunk/; revision=4928
This commit is contained in:
Gé van Geldorp 2003-06-19 17:13:28 +00:00
parent 86d2a51a17
commit 9ad6e7c184
7 changed files with 101 additions and 25 deletions

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_MMFUNCS_H
#define _INCLUDE_DDK_MMFUNCS_H
/* $Id: mmfuncs.h,v 1.15 2003/05/14 10:51:26 ekohl Exp $ */
/* $Id: mmfuncs.h,v 1.16 2003/06/19 17:13:27 gvg Exp $ */
/* MEMORY MANAGMENT ******************************************************/
@ -455,12 +455,12 @@ MmResetDriverPaging (
PVOID AddressWithinSection
);
DWORD
PVOID
STDCALL
MmSecureVirtualMemory (
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2
PVOID Address,
SIZE_T Length,
ULONG Mode
);
BOOLEAN
STDCALL
@ -548,6 +548,6 @@ MmUnmapViewOfSection (
VOID
STDCALL
MmUnsecureVirtualMemory (
DWORD Unknown0
PVOID SecureMem
);
#endif

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: virtual.c,v 1.65 2003/04/28 10:37:40 gvg Exp $
/* $Id: virtual.c,v 1.66 2003/06/19 17:13:28 gvg Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/virtual.c
@ -344,19 +344,31 @@ NtWriteVirtualMemory(IN HANDLE ProcessHandle,
return(STATUS_SUCCESS);
}
DWORD STDCALL
MmSecureVirtualMemory (DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2)
PVOID STDCALL
MmSecureVirtualMemory (PVOID Address,
SIZE_T Length,
ULONG Mode)
{
/* Only works for user space */
if (MmHighestUserAddress < Address)
{
return NULL;
}
UNIMPLEMENTED;
return 0;
}
VOID STDCALL
MmUnsecureVirtualMemory (DWORD Unknown0)
MmUnsecureVirtualMemory(PVOID SecureMem)
{
if (NULL == SecureMem)
{
return;
}
UNIMPLEMENTED;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: mem.c,v 1.9 2003/06/06 10:17:44 gvg Exp $
/* $Id: mem.c,v 1.10 2003/06/19 17:13:28 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -30,6 +30,10 @@
#include <ddk/ntddk.h>
#include <ddk/winddi.h>
#define NDEBUG
#include <win32k/debug1.h>
#include <debug.h>
typedef struct _USERMEMHEADER
{
ULONG Tag;
@ -90,4 +94,17 @@ EngFreeUserMem(PVOID pv)
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &Header, &MemSize, MEM_DECOMMIT);
}
HANDLE STDCALL
EngSecureMem(PVOID Address, ULONG Length)
{
return MmSecureVirtualMemory(Address, Length, PAGE_READWRITE);
}
VOID STDCALL
EngUnsecureMem(HANDLE Mem)
{
return MmUnsecureVirtualMemory((PVOID) Mem);
}
/* EOF */

View file

@ -0,0 +1,51 @@
/*
* ReactOS W32 Subsystem
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: perfcnt.c,v 1.1 2003/06/19 17:13:28 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: GDI Driver Performance Counter Functions
* FILE: subsys/win32k/eng/perfcnt.c
* PROGRAMER: Ge van Geldorp
*/
#include <ddk/ntddk.h>
#define NDEBUG
#include <win32k/debug1.h>
#include <debug.h>
VOID STDCALL
EngQueryPerformanceFrequency(LONGLONG *Frequency)
{
LARGE_INTEGER Freq;
__asm__("int $3\n");
KeQueryPerformanceCounter(&Freq);
*Frequency = Freq.QuadPart;
}
VOID STDCALL
EngQueryPerformanceCounter(LONGLONG *Count)
{
LARGE_INTEGER PerfCount;
PerfCount = KeQueryPerformanceCounter(NULL);
*Count = PerfCount.QuadPart;
}

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.65 2003/06/05 22:47:47 gdalsnes Exp $
# $Id: makefile,v 1.66 2003/06/19 17:13:28 gvg Exp $
PATH_TO_TOP = ../..
@ -35,8 +35,8 @@ TARGET_LFLAGS =\
ENG_OBJECTS= eng/debug.o eng/mem.o eng/brush.o eng/bitblt.o eng/clip.o \
eng/copybits.o eng/device.o eng/handle.o eng/lineto.o eng/paint.o \
eng/palette.o eng/surface.o eng/xlate.o eng/transblt.o eng/mouse.o \
eng/misc.o
eng/palette.o eng/perfcnt.o eng/surface.o eng/xlate.o eng/transblt.o \
eng/mouse.o eng/misc.o
MAIN_OBJECTS = main/dllmain.o main/svctabm.o

View file

@ -52,12 +52,9 @@ STUB(EngProbeForRead)
STUB(EngProbeForReadAndWrite)
STUB(EngQueryLocalTime)
STUB(EngQueryPalette)
STUB(EngQueryPerformanceCounter)
STUB(EngQueryPerformanceFrequency)
STUB(EngReleaseSemaphore)
STUB(EngRestoreFloatingPointState)
STUB(EngSaveFloatingPointState)
STUB(EngSecureMem)
STUB(EngSetEvent)
STUB(EngSetLastError)
STUB(EngSetPointerShape)
@ -73,7 +70,6 @@ STUB(EngUnloadImage)
STUB(EngUnlockDriverObj)
STUB(EngUnmapEvent)
STUB(EngUnmapFontFile)
STUB(EngUnsecureMem)
STUB(EngWaitForSingleObject)
STUB(EngWideCharToMultiByte)
STUB(EngWritePrinter)

View file

@ -1,4 +1,4 @@
; $Id: win32k.edf,v 1.8 2003/02/15 19:16:33 gvg Exp $
; $Id: win32k.edf,v 1.9 2003/06/19 17:13:28 gvg Exp $
;
; win32k.def
;
@ -81,12 +81,12 @@ EngProbeForRead
EngProbeForReadAndWrite
EngQueryLocalTime
EngQueryPalette
EngQueryPerformanceCounter
EngQueryPerformanceFrequency
EngQueryPerformanceCounter=EngQueryPerformanceCounter@4
EngQueryPerformanceFrequency=EngQueryPerformanceFrequency@4
EngReleaseSemaphore
EngRestoreFloatingPointState
EngSaveFloatingPointState
EngSecureMem
EngSecureMem=EngSecureMem@8
EngSetEvent
EngSetLastError
EngSetPointerShape
@ -105,7 +105,7 @@ EngUnlockSurface=EngUnlockSurface@4
EngUnmapEvent
EngUnmapFontFile
; EngUnsecureMem = NTOSKRNL.MmUnsecureVirtualMemory
EngUnsecureMem
EngUnsecureMem=EngUnsecureMem@4
EngWaitForSingleObject
EngWideCharToMultiByte
EngWritePrinter