- Fixed prototypes of NtAddAtom, NtFindAtom, NtProtectVirtualMemory and KeQueryInterruptTime.

svn path=/trunk/; revision=9660
This commit is contained in:
Filip Navara 2004-06-13 10:35:53 +00:00
parent 25ae3e20a7
commit ebb7ad1e4a
13 changed files with 111 additions and 83 deletions

View file

@ -1,7 +1,7 @@
NtAcceptConnectPort ZwAcceptConnectPort 6 NtAcceptConnectPort ZwAcceptConnectPort 6
NtAccessCheck ZwAccessCheck 8 NtAccessCheck ZwAccessCheck 8
NtAccessCheckAndAuditAlarm ZwAccessCheckAndAuditAlarm 11 NtAccessCheckAndAuditAlarm ZwAccessCheckAndAuditAlarm 11
NtAddAtom ZwAddAtom 2 NtAddAtom ZwAddAtom 3
NtAdjustGroupsToken ZwAdjustGroupsToken 6 NtAdjustGroupsToken ZwAdjustGroupsToken 6
NtAdjustPrivilegesToken ZwAdjustPrivilegesToken 6 NtAdjustPrivilegesToken ZwAdjustPrivilegesToken 6
NtAlertResumeThread ZwAlertResumeThread 2 NtAlertResumeThread ZwAlertResumeThread 2
@ -51,7 +51,7 @@ NtDuplicateToken ZwDuplicateToken 6
NtEnumerateKey ZwEnumerateKey 6 NtEnumerateKey ZwEnumerateKey 6
NtEnumerateValueKey ZwEnumerateValueKey 6 NtEnumerateValueKey ZwEnumerateValueKey 6
NtExtendSection ZwExtendSection 2 NtExtendSection ZwExtendSection 2
NtFindAtom ZwFindAtom 2 NtFindAtom ZwFindAtom 3
NtFlushBuffersFile ZwFlushBuffersFile 2 NtFlushBuffersFile ZwFlushBuffersFile 2
NtFlushInstructionCache ZwFlushInstructionCache 3 NtFlushInstructionCache ZwFlushInstructionCache 3
NtFlushKey ZwFlushKey 1 NtFlushKey ZwFlushKey 1

View file

@ -1,5 +1,5 @@
/* $Id: zw.h,v 1.24 2004/05/01 19:22:49 ekohl Exp $ /* $Id: zw.h,v 1.25 2004/06/13 10:35:51 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -4878,8 +4878,8 @@ NTSTATUS
STDCALL STDCALL
NtProtectVirtualMemory( NtProtectVirtualMemory(
IN HANDLE ProcessHandle, IN HANDLE ProcessHandle,
IN PVOID BaseAddress, IN PVOID *BaseAddress,
IN ULONG NumberOfBytesToProtect, IN ULONG *NumberOfBytesToProtect,
IN ULONG NewAccessProtection, IN ULONG NewAccessProtection,
OUT PULONG OldAccessProtection OUT PULONG OldAccessProtection
); );
@ -5235,8 +5235,9 @@ ZwAccessCheckAndAuditAlarm(
/* /*
* FUNCTION: Adds an atom to the global atom table * FUNCTION: Adds an atom to the global atom table
* ARGUMENTS: * ARGUMENTS:
* AtomString = The string to add to the atom table. * AtomName = The string to add to the atom table.
* Atom (OUT) = Caller supplies storage for the resulting atom. * AtomNameLength = Length of the atom name
* Atom (OUT) = Caller supplies storage for the resulting atom.
* REMARKS: The arguments map to the win32 add GlobalAddAtom. * REMARKS: The arguments map to the win32 add GlobalAddAtom.
* RETURNS: Status * RETURNS: Status
*/ */
@ -5244,6 +5245,7 @@ NTSTATUS
STDCALL STDCALL
NtAddAtom( NtAddAtom(
IN PWSTR AtomName, IN PWSTR AtomName,
IN ULONG AtomNameLength,
IN OUT PRTL_ATOM Atom IN OUT PRTL_ATOM Atom
); );
@ -5252,6 +5254,7 @@ NTSTATUS
STDCALL STDCALL
ZwAddAtom( ZwAddAtom(
IN PWSTR AtomName, IN PWSTR AtomName,
IN ULONG AtomNameLength,
IN OUT PRTL_ATOM Atom IN OUT PRTL_ATOM Atom
); );
@ -5350,6 +5353,7 @@ ZwDuplicateToken(
* FUNCTION: Finds a atom * FUNCTION: Finds a atom
* ARGUMENTS: * ARGUMENTS:
* AtomName = Name to search for. * AtomName = Name to search for.
* AtomNameLength = Length of the atom name
* Atom = Caller supplies storage for the resulting atom * Atom = Caller supplies storage for the resulting atom
* RETURNS: Status * RETURNS: Status
* REMARKS: * REMARKS:
@ -5359,6 +5363,7 @@ NTSTATUS
STDCALL STDCALL
NtFindAtom( NtFindAtom(
IN PWSTR AtomName, IN PWSTR AtomName,
IN ULONG AtomNameLength,
OUT PRTL_ATOM Atom OPTIONAL OUT PRTL_ATOM Atom OPTIONAL
); );
@ -5366,6 +5371,7 @@ NTSTATUS
STDCALL STDCALL
ZwFindAtom( ZwFindAtom(
IN PWSTR AtomName, IN PWSTR AtomName,
IN ULONG AtomNameLength,
OUT PRTL_ATOM Atom OPTIONAL OUT PRTL_ATOM Atom OPTIONAL
); );
@ -5491,8 +5497,8 @@ NTSTATUS
STDCALL STDCALL
ZwProtectVirtualMemory( ZwProtectVirtualMemory(
IN HANDLE ProcessHandle, IN HANDLE ProcessHandle,
IN PVOID BaseAddress, IN PVOID *BaseAddress,
IN ULONG NumberOfBytesToProtect, IN ULONG *NumberOfBytesToProtect,
IN ULONG NewAccessProtection, IN ULONG NewAccessProtection,
OUT PULONG OldAccessProtection OUT PULONG OldAccessProtection
); );

View file

@ -1,4 +1,4 @@
/* $Id: virtual.c,v 1.12 2004/01/23 17:13:36 ekohl Exp $ /* $Id: virtual.c,v 1.13 2004/06/13 10:35:52 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -126,8 +126,8 @@ VirtualProtectEx(HANDLE hProcess,
NTSTATUS Status; NTSTATUS Status;
Status = NtProtectVirtualMemory(hProcess, Status = NtProtectVirtualMemory(hProcess,
(PVOID)lpAddress, &lpAddress,
dwSize, &dwSize,
flNewProtect, flNewProtect,
(PULONG)lpflOldProtect); (PULONG)lpflOldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: atom.c,v 1.19 2004/01/23 21:16:03 ekohl Exp $ /* $Id: atom.c,v 1.20 2004/06/13 10:35:52 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -49,6 +49,7 @@ GlobalAddAtomA(LPCSTR lpString)
(LPSTR)lpString); (LPSTR)lpString);
Status = NtAddAtom(AtomName.Buffer, Status = NtAddAtom(AtomName.Buffer,
AtomName.Length,
&Atom); &Atom);
RtlFreeUnicodeString(&AtomName); RtlFreeUnicodeString(&AtomName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -81,6 +82,7 @@ GlobalAddAtomW(LPCWSTR lpString)
} }
Status = NtAddAtom((LPWSTR)lpString, Status = NtAddAtom((LPWSTR)lpString,
wcslen(lpString),
&Atom); &Atom);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -139,6 +141,7 @@ GlobalFindAtomA(LPCSTR lpString)
RtlCreateUnicodeStringFromAsciiz(&AtomName, RtlCreateUnicodeStringFromAsciiz(&AtomName,
(LPSTR)lpString); (LPSTR)lpString);
Status = NtFindAtom(AtomName.Buffer, Status = NtFindAtom(AtomName.Buffer,
AtomName.Length,
&Atom); &Atom);
RtlFreeUnicodeString(&AtomName); RtlFreeUnicodeString(&AtomName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -171,6 +174,7 @@ GlobalFindAtomW(LPCWSTR lpString)
} }
Status = NtFindAtom((LPWSTR)lpString, Status = NtFindAtom((LPWSTR)lpString,
wcslen(lpString),
&Atom); &Atom);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.120 2004/05/13 21:01:14 navaraf Exp $ ; $Id: ntdll.def,v 1.121 2004/06/13 10:35:52 navaraf Exp $
; ;
; ReactOS Operating System ; ReactOS Operating System
; ;
@ -64,7 +64,7 @@ NlsMbOemCodePageTag DATA
NtAcceptConnectPort@24 NtAcceptConnectPort@24
NtAccessCheck@32 NtAccessCheck@32
NtAccessCheckAndAuditAlarm@44 NtAccessCheckAndAuditAlarm@44
NtAddAtom@8 NtAddAtom@12
NtAdjustGroupsToken@24 NtAdjustGroupsToken@24
NtAdjustPrivilegesToken@24 NtAdjustPrivilegesToken@24
NtAlertResumeThread@8 NtAlertResumeThread@8
@ -116,7 +116,7 @@ NtDuplicateToken@24
NtEnumerateKey@24 NtEnumerateKey@24
NtEnumerateValueKey@24 NtEnumerateValueKey@24
NtExtendSection@8 NtExtendSection@8
NtFindAtom@8 NtFindAtom@12
NtFlushBuffersFile@8 NtFlushBuffersFile@8
NtFlushInstructionCache@12 NtFlushInstructionCache@12
NtFlushKey@4 NtFlushKey@4
@ -654,7 +654,7 @@ RtlxUnicodeStringToOemSize@4
ZwAcceptConnectPort@24 ZwAcceptConnectPort@24
ZwAccessCheck@32 ZwAccessCheck@32
ZwAccessCheckAndAuditAlarm@44 ZwAccessCheckAndAuditAlarm@44
ZwAddAtom@8 ZwAddAtom@12
ZwAdjustGroupsToken@24 ZwAdjustGroupsToken@24
ZwAdjustPrivilegesToken@24 ZwAdjustPrivilegesToken@24
ZwAlertResumeThread@8 ZwAlertResumeThread@8
@ -704,7 +704,7 @@ ZwDuplicateToken@24
ZwEnumerateKey@24 ZwEnumerateKey@24
ZwEnumerateValueKey@24 ZwEnumerateValueKey@24
ZwExtendSection@8 ZwExtendSection@8
ZwFindAtom@8 ZwFindAtom@12
ZwFlushBuffersFile@8 ZwFlushBuffersFile@8
ZwFlushInstructionCache@12 ZwFlushInstructionCache@12
ZwFlushKey@4 ZwFlushKey@4

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.110 2004/05/13 21:01:14 navaraf Exp $ ; $Id: ntdll.edf,v 1.111 2004/06/13 10:35:52 navaraf Exp $
; ;
; ReactOS Operating System ; ReactOS Operating System
; ;
@ -64,7 +64,7 @@ NlsMbOemCodePageTag DATA
NtAcceptConnectPort=NtAcceptConnectPort@24 NtAcceptConnectPort=NtAcceptConnectPort@24
NtAccessCheck=NtAccessCheck@32 NtAccessCheck=NtAccessCheck@32
NtAccessCheckAndAuditAlarm=NtAccessCheckAndAuditAlarm@44 NtAccessCheckAndAuditAlarm=NtAccessCheckAndAuditAlarm@44
NtAddAtom=NtAddAtom@8 NtAddAtom=NtAddAtom@12
NtAdjustGroupsToken=NtAdjustGroupsToken@24 NtAdjustGroupsToken=NtAdjustGroupsToken@24
NtAdjustPrivilegesToken=NtAdjustPrivilegesToken@24 NtAdjustPrivilegesToken=NtAdjustPrivilegesToken@24
NtAlertResumeThread=NtAlertResumeThread@8 NtAlertResumeThread=NtAlertResumeThread@8
@ -116,7 +116,7 @@ NtDuplicateToken=NtDuplicateToken@24
NtEnumerateKey=NtEnumerateKey@24 NtEnumerateKey=NtEnumerateKey@24
NtEnumerateValueKey=NtEnumerateValueKey@24 NtEnumerateValueKey=NtEnumerateValueKey@24
NtExtendSection=NtExtendSection@8 NtExtendSection=NtExtendSection@8
NtFindAtom=NtFindAtom@8 NtFindAtom=NtFindAtom@12
NtFlushBuffersFile=NtFlushBuffersFile@8 NtFlushBuffersFile=NtFlushBuffersFile@8
NtFlushInstructionCache=NtFlushInstructionCache@12 NtFlushInstructionCache=NtFlushInstructionCache@12
NtFlushKey=NtFlushKey@4 NtFlushKey=NtFlushKey@4
@ -656,7 +656,7 @@ RtlxUnicodeStringToOemSize=RtlxUnicodeStringToOemSize@4
ZwAcceptConnectPort=ZwAcceptConnectPort@24 ZwAcceptConnectPort=ZwAcceptConnectPort@24
ZwAccessCheck=ZwAccessCheck@32 ZwAccessCheck=ZwAccessCheck@32
ZwAccessCheckAndAuditAlarm=ZwAccessCheckAndAuditAlarm@44 ZwAccessCheckAndAuditAlarm=ZwAccessCheckAndAuditAlarm@44
ZwAddAtom=ZwAddAtom@8 ZwAddAtom=ZwAddAtom@12
ZwAdjustGroupsToken=ZwAdjustGroupsToken@24 ZwAdjustGroupsToken=ZwAdjustGroupsToken@24
ZwAdjustPrivilegesToken=ZwAdjustPrivilegesToken@24 ZwAdjustPrivilegesToken=ZwAdjustPrivilegesToken@24
ZwAlertResumeThread=ZwAlertResumeThread@8 ZwAlertResumeThread=ZwAlertResumeThread@8
@ -706,7 +706,7 @@ ZwDuplicateToken=ZwDuplicateToken@24
ZwEnumerateKey=ZwEnumerateKey@24 ZwEnumerateKey=ZwEnumerateKey@24
ZwEnumerateValueKey=ZwEnumerateValueKey@24 ZwEnumerateValueKey=ZwEnumerateValueKey@24
ZwExtendSection=ZwExtendSection@8 ZwExtendSection=ZwExtendSection@8
ZwFindAtom=ZwFindAtom@8 ZwFindAtom=ZwFindAtom@12
ZwFlushBuffersFile=ZwFlushBuffersFile@8 ZwFlushBuffersFile=ZwFlushBuffersFile@8
ZwFlushInstructionCache=ZwFlushInstructionCache@12 ZwFlushInstructionCache=ZwFlushInstructionCache@12
ZwFlushKey=ZwFlushKey@4 ZwFlushKey=ZwFlushKey@4

View file

@ -1,4 +1,4 @@
/* $Id: utils.c,v 1.87 2004/06/02 18:26:58 gvg Exp $ /* $Id: utils.c,v 1.88 2004/06/13 10:35:52 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1235,7 +1235,11 @@ static NTSTATUS LdrPerformRelocations (PIMAGE_NT_HEADERS NTHeaders,
int i; int i;
PIMAGE_DATA_DIRECTORY RelocationDDir; PIMAGE_DATA_DIRECTORY RelocationDDir;
ULONG OldProtect; ULONG OldProtect;
PVOID ProtectBase;
ULONG ProtectSize;
ULONG OldProtect2; ULONG OldProtect2;
PVOID ProtectBase2;
ULONG ProtectSize2;
NTSTATUS Status; NTSTATUS Status;
PIMAGE_SECTION_HEADER Sections; PIMAGE_SECTION_HEADER Sections;
ULONG MaxExtend; ULONG MaxExtend;
@ -1286,10 +1290,11 @@ static NTSTATUS LdrPerformRelocations (PIMAGE_NT_HEADERS NTHeaders,
RelocationDir->SizeOfBlock - sizeof (RELOCATION_DIRECTORY); RelocationDir->SizeOfBlock - sizeof (RELOCATION_DIRECTORY);
NumberOfEntries = NumberOfEntries / sizeof (RELOCATION_ENTRY); NumberOfEntries = NumberOfEntries / sizeof (RELOCATION_ENTRY);
ProtectBase = ImageBase + RelocationDir->VirtualAddress;
ProtectSize = PAGE_SIZE;
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
ImageBase + &ProtectBase,
RelocationDir->VirtualAddress, &ProtectSize,
PAGE_SIZE,
PAGE_READWRITE, PAGE_READWRITE,
&OldProtect); &OldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1300,21 +1305,21 @@ static NTSTATUS LdrPerformRelocations (PIMAGE_NT_HEADERS NTHeaders,
if (RelocationDir->VirtualAddress + PAGE_SIZE < MaxExtend) if (RelocationDir->VirtualAddress + PAGE_SIZE < MaxExtend)
{ {
ProtectBase2 = ImageBase + RelocationDir->VirtualAddress + PAGE_SIZE;
ProtectSize2 = PAGE_SIZE;
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
ImageBase + &ProtectBase2,
RelocationDir->VirtualAddress + PAGE_SIZE, &ProtectSize2,
PAGE_SIZE,
PAGE_READWRITE, PAGE_READWRITE,
&OldProtect2); &OldProtect2);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("Failed to unprotect relocation target (2).\n"); DPRINT1("Failed to unprotect relocation target (2).\n");
NtProtectVirtualMemory(NtCurrentProcess(), NtProtectVirtualMemory(NtCurrentProcess(),
ImageBase + &ProtectBase,
RelocationDir->VirtualAddress, &ProtectSize,
PAGE_SIZE, OldProtect,
OldProtect, &OldProtect);
&OldProtect);
return(Status); return(Status);
} }
} }
@ -1360,9 +1365,8 @@ static NTSTATUS LdrPerformRelocations (PIMAGE_NT_HEADERS NTHeaders,
} }
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
ImageBase + &ProtectBase,
RelocationDir->VirtualAddress, &ProtectSize,
PAGE_SIZE,
OldProtect, OldProtect,
&OldProtect); &OldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1374,9 +1378,8 @@ static NTSTATUS LdrPerformRelocations (PIMAGE_NT_HEADERS NTHeaders,
if (RelocationDir->VirtualAddress + PAGE_SIZE < MaxExtend) if (RelocationDir->VirtualAddress + PAGE_SIZE < MaxExtend)
{ {
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
ImageBase + &ProtectBase2,
RelocationDir->VirtualAddress + PAGE_SIZE, &ProtectSize2,
PAGE_SIZE,
OldProtect2, OldProtect2,
&OldProtect2); &OldProtect2);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1468,11 +1471,12 @@ LdrpProcessImportDirectoryEntry(
/* Unprotect the region we are about to write into. */ /* Unprotect the region we are about to write into. */
IATBase = (PVOID)ImportAddressList; IATBase = (PVOID)ImportAddressList;
IATSize *= sizeof(PVOID*);
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
IATBase, &IATBase,
IATSize * sizeof(PVOID*), &IATSize,
PAGE_READWRITE, PAGE_READWRITE,
&OldProtect); &OldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("Failed to unprotect IAT.\n"); DPRINT1("Failed to unprotect IAT.\n");
@ -1509,8 +1513,8 @@ LdrpProcessImportDirectoryEntry(
/* Protect the region we are about to write into. */ /* Protect the region we are about to write into. */
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
IATBase, &IATBase,
IATSize * sizeof(PVOID*), &IATSize,
OldProtect, OldProtect,
&OldProtect); &OldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1626,9 +1630,10 @@ LdrpAdjustImportDirectory(PLDR_MODULE Module,
/* Unprotect the region we are about to write into. */ /* Unprotect the region we are about to write into. */
IATBase = (PVOID)ImportAddressList; IATBase = (PVOID)ImportAddressList;
IATSize *= sizeof(PVOID*);
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
IATBase, &IATBase,
IATSize * sizeof(PVOID*), &IATSize,
PAGE_READWRITE, PAGE_READWRITE,
&OldProtect); &OldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1655,8 +1660,8 @@ LdrpAdjustImportDirectory(PLDR_MODULE Module,
/* Protect the region we are about to write into. */ /* Protect the region we are about to write into. */
Status = NtProtectVirtualMemory(NtCurrentProcess(), Status = NtProtectVirtualMemory(NtCurrentProcess(),
IATBase, &IATBase,
IATSize * sizeof(PVOID*), &IATSize,
OldProtect, OldProtect,
&OldProtect); &OldProtect);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: sysinfo.c,v 1.35 2004/05/26 19:56:35 navaraf Exp $ /* $Id: sysinfo.c,v 1.36 2004/06/13 10:35:52 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -28,7 +28,7 @@
#include <internal/debug.h> #include <internal/debug.h>
extern ULONG NtGlobalFlag; /* FIXME: it should go in a ddk/?.h */ extern ULONG NtGlobalFlag; /* FIXME: it should go in a ddk/?.h */
VOID STDCALL KeQueryInterruptTime(PLARGE_INTEGER CurrentTime); ULONGLONG STDCALL KeQueryInterruptTime(VOID);
VOID MmPrintMemoryStatistic(VOID); VOID MmPrintMemoryStatistic(VOID);
@ -647,7 +647,7 @@ QSI_DEF(SystemProcessorPerformanceInformation)
PsLookupProcessByProcessId((PVOID) 1, &TheIdleProcess); PsLookupProcessByProcessId((PVOID) 1, &TheIdleProcess);
KeQueryInterruptTime((PLARGE_INTEGER) &CurrentTime); CurrentTime.QuadPart = KeQueryInterruptTime();
Spi->TotalProcessorRunTime.QuadPart = Spi->TotalProcessorRunTime.QuadPart =
TheIdleProcess->Pcb.KernelTime * 100000; // IdleTime TheIdleProcess->Pcb.KernelTime * 100000; // IdleTime

View file

@ -1,4 +1,4 @@
/* $Id: timer.c,v 1.72 2004/04/20 20:38:41 jimtabor Exp $ /* $Id: timer.c,v 1.73 2004/06/13 10:35:52 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -224,16 +224,19 @@ KeQuerySystemTime(PLARGE_INTEGER CurrentTime)
while (CurrentTime->u.HighPart != SharedUserData->SystemTime.High2Part); while (CurrentTime->u.HighPart != SharedUserData->SystemTime.High2Part);
} }
VOID STDCALL ULONGLONG STDCALL
KeQueryInterruptTime(PLARGE_INTEGER CurrentTime) KeQueryInterruptTime(VOID)
{ {
LARGE_INTEGER CurrentTime;
do do
{ {
CurrentTime->u.HighPart = SharedUserData->InterruptTime.High1Part; CurrentTime.u.HighPart = SharedUserData->InterruptTime.High1Part;
CurrentTime->u.LowPart = SharedUserData->InterruptTime.LowPart; CurrentTime.u.LowPart = SharedUserData->InterruptTime.LowPart;
} }
while (CurrentTime->u.HighPart != SharedUserData->InterruptTime.High2Part); while (CurrentTime.u.HighPart != SharedUserData->InterruptTime.High2Part);
return CurrentTime.QuadPart;
} }
/* /*
@ -305,9 +308,8 @@ KeSetTimerEx (PKTIMER Timer,
Timer->Dpc = Dpc; Timer->Dpc = Dpc;
if (DueTime.QuadPart < 0) if (DueTime.QuadPart < 0)
{ {
KeQueryInterruptTime(&Time);
Timer->Header.Absolute = 0; Timer->Header.Absolute = 0;
Timer->DueTime.QuadPart = Time.QuadPart - DueTime.QuadPart; Timer->DueTime.QuadPart = KeQueryInterruptTime() - DueTime.QuadPart;
} }
else else
{ {
@ -542,7 +544,7 @@ KeExpireTimers(PKDPC Dpc,
KeAcquireSpinLockAtDpcLevel(&TimerListLock); KeAcquireSpinLockAtDpcLevel(&TimerListLock);
KeQueryInterruptTime(&InterruptTime); InterruptTime.QuadPart = KeQueryInterruptTime();
KeQuerySystemTime(&SystemTime); KeQuerySystemTime(&SystemTime);
current_entry = RelativeTimerListHead.Flink; current_entry = RelativeTimerListHead.Flink;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: virtual.c,v 1.74 2004/05/29 11:53:43 navaraf Exp $ /* $Id: virtual.c,v 1.75 2004/06/13 10:35:52 navaraf Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/virtual.c * FILE: ntoskrnl/mm/virtual.c
@ -206,8 +206,8 @@ NtQueryVirtualMemory (IN HANDLE ProcessHandle,
NTSTATUS STDCALL NTSTATUS STDCALL
NtProtectVirtualMemory(IN HANDLE ProcessHandle, NtProtectVirtualMemory(IN HANDLE ProcessHandle,
IN PVOID BaseAddress, IN PVOID *UnsafeBaseAddress,
IN ULONG NumberOfBytesToProtect, IN ULONG *UnsafeNumberOfBytesToProtect,
IN ULONG NewAccessProtection, IN ULONG NewAccessProtection,
OUT PULONG UnsafeOldAccessProtection) OUT PULONG UnsafeOldAccessProtection)
{ {
@ -216,6 +216,15 @@ NtProtectVirtualMemory(IN HANDLE ProcessHandle,
NTSTATUS Status; NTSTATUS Status;
PMADDRESS_SPACE AddressSpace; PMADDRESS_SPACE AddressSpace;
ULONG OldAccessProtection; ULONG OldAccessProtection;
PVOID BaseAddress;
ULONG NumberOfBytesToProtect;
Status = MmCopyFromCaller(&BaseAddress, UnsafeBaseAddress, sizeof(PVOID));
if (!NT_SUCCESS(Status))
return Status;
Status = MmCopyFromCaller(&NumberOfBytesToProtect, UnsafeNumberOfBytesToProtect, sizeof(ULONG));
if (!NT_SUCCESS(Status))
return Status;
NumberOfBytesToProtect = NumberOfBytesToProtect =
PAGE_ROUND_UP(BaseAddress + NumberOfBytesToProtect) - PAGE_ROUND_UP(BaseAddress + NumberOfBytesToProtect) -
@ -228,7 +237,7 @@ NtProtectVirtualMemory(IN HANDLE ProcessHandle,
UserMode, UserMode,
(PVOID*)(&Process), (PVOID*)(&Process),
NULL); NULL);
if (Status != STATUS_SUCCESS) if (!NT_SUCCESS(Status))
{ {
DPRINT("NtProtectVirtualMemory() = %x\n",Status); DPRINT("NtProtectVirtualMemory() = %x\n",Status);
return(Status); return(Status);
@ -263,8 +272,9 @@ NtProtectVirtualMemory(IN HANDLE ProcessHandle,
MmUnlockAddressSpace(AddressSpace); MmUnlockAddressSpace(AddressSpace);
ObDereferenceObject(Process); ObDereferenceObject(Process);
MmCopyToCaller(UnsafeOldAccessProtection, &OldAccessProtection, MmCopyToCaller(UnsafeOldAccessProtection, &OldAccessProtection, sizeof(ULONG));
sizeof(ULONG)); MmCopyToCaller(UnsafeBaseAddress, &BaseAddress, sizeof(PVOID));
MmCopyToCaller(UnsafeNumberOfBytesToProtect, &NumberOfBytesToProtect, sizeof(ULONG));
return(Status); return(Status);
} }

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.183 2004/05/28 21:16:27 royce Exp $ ; $Id: ntoskrnl.def,v 1.184 2004/06/13 10:35:53 navaraf Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -559,7 +559,7 @@ NlsLeadByteInfo DATA
NlsMbCodePageTag DATA NlsMbCodePageTag DATA
NlsMbOemCodePageTag DATA NlsMbOemCodePageTag DATA
NlsOemLeadByteInfo DATA NlsOemLeadByteInfo DATA
NtAddAtom@8 NtAddAtom@12
NtAdjustPrivilegesToken@24 NtAdjustPrivilegesToken@24
NtAlertThread@4 NtAlertThread@4
NtAllocateLocallyUniqueId@4 NtAllocateLocallyUniqueId@4
@ -578,7 +578,7 @@ NtDeleteFile@4
NtDeviceIoControlFile@40 NtDeviceIoControlFile@40
NtDuplicateObject@28 NtDuplicateObject@28
NtDuplicateToken@24 NtDuplicateToken@24
NtFindAtom@8 NtFindAtom@12
NtFreeVirtualMemory@16 NtFreeVirtualMemory@16
NtFsControlFile@40 NtFsControlFile@40
NtGlobalFlag DATA NtGlobalFlag DATA

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.169 2004/05/28 21:16:27 royce Exp $ ; $Id: ntoskrnl.edf,v 1.170 2004/06/13 10:35:53 navaraf Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -560,7 +560,7 @@ NlsLeadByteInfo DATA
NlsMbCodePageTag DATA NlsMbCodePageTag DATA
NlsMbOemCodePageTag DATA NlsMbOemCodePageTag DATA
NlsOemLeadByteInfo DATA NlsOemLeadByteInfo DATA
NtAddAtom=NtAddAtom@8 NtAddAtom=NtAddAtom@12
NtAdjustPrivilegesToken=NtAdjustPrivilegesToken@24 NtAdjustPrivilegesToken=NtAdjustPrivilegesToken@24
NtAlertThread=NtAlertThread@4 NtAlertThread=NtAlertThread@4
NtAllocateLocallyUniqueId=NtAllocateLocallyUniqueId@4 NtAllocateLocallyUniqueId=NtAllocateLocallyUniqueId@4
@ -579,7 +579,7 @@ NtDeleteFile=NtDeleteFile@4
NtDeviceIoControlFile=NtDeviceIoControlFile@40 NtDeviceIoControlFile=NtDeviceIoControlFile@40
NtDuplicateObject=NtDuplicateObject@28 NtDuplicateObject=NtDuplicateObject@28
NtDuplicateToken=NtDuplicateToken@24 NtDuplicateToken=NtDuplicateToken@24
NtFindAtom=NtFindAtom@8 NtFindAtom=NtFindAtom@12
NtFreeVirtualMemory=NtFreeVirtualMemory@16 NtFreeVirtualMemory=NtFreeVirtualMemory@16
NtFsControlFile=NtFsControlFile@40 NtFsControlFile=NtFsControlFile@40
NtGlobalFlag DATA NtGlobalFlag DATA

View file

@ -1,4 +1,4 @@
/* $Id: atom.c,v 1.9 2004/02/27 23:11:32 gvg Exp $ /* $Id: atom.c,v 1.10 2004/06/13 10:35:53 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -67,18 +67,18 @@ static PRTL_ATOM_TABLE GlobalAtomTable = NULL;
* @implemented * @implemented
*/ */
NTSTATUS STDCALL NTSTATUS STDCALL
NtAddAtom(IN PWSTR AtomName, NtAddAtom(
OUT PRTL_ATOM Atom) IN PWSTR AtomName,
IN ULONG AtomNameLength,
OUT PRTL_ATOM Atom)
{ {
PRTL_ATOM_TABLE AtomTable; PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable(); AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL) if (AtomTable == NULL)
return STATUS_ACCESS_DENIED; return STATUS_ACCESS_DENIED;
return (RtlAddAtomToAtomTable(AtomTable, return RtlAddAtomToAtomTable(AtomTable, AtomName, Atom);
AtomName,
Atom));
} }
@ -104,6 +104,7 @@ NtDeleteAtom(IN RTL_ATOM Atom)
*/ */
NTSTATUS STDCALL NTSTATUS STDCALL
NtFindAtom(IN PWSTR AtomName, NtFindAtom(IN PWSTR AtomName,
IN ULONG AtomNameLength,
OUT PRTL_ATOM Atom) OUT PRTL_ATOM Atom)
{ {
PRTL_ATOM_TABLE AtomTable; PRTL_ATOM_TABLE AtomTable;