From 95f0ca7fdb0ce8e1df21deb85ea20d4f3d412a64 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sat, 25 Jun 2005 14:04:56 +0000 Subject: [PATCH] Build ntoskrnl with NDK, and don't use rosrtl svn path=/trunk/; revision=16266 --- reactos/include/ntos/ps.h | 12 +- reactos/include/ntos/security.h | 3 +- reactos/ntoskrnl/ex/sysinfo.c | 182 +++++++++---------- reactos/ntoskrnl/ex/win32k.c | 29 ++- reactos/ntoskrnl/inbv/inbv.c | 3 +- reactos/ntoskrnl/include/internal/ke.h | 12 ++ reactos/ntoskrnl/include/internal/mm.h | 2 + reactos/ntoskrnl/include/internal/ntoskrnl.h | 35 ++++ reactos/ntoskrnl/include/internal/port.h | 55 ++++++ reactos/ntoskrnl/include/internal/ps.h | 2 +- reactos/ntoskrnl/include/ntoskrnl.h | 77 ++------ reactos/ntoskrnl/io/arcname.c | 5 +- reactos/ntoskrnl/io/driver.c | 7 +- reactos/ntoskrnl/io/file.c | 5 +- reactos/ntoskrnl/io/iomgr.c | 16 +- reactos/ntoskrnl/io/pnpmgr.c | 4 - reactos/ntoskrnl/io/resource.c | 8 +- reactos/ntoskrnl/kdbg/kdb_symbols.c | 2 +- reactos/ntoskrnl/ke/i386/kernel.c | 9 +- reactos/ntoskrnl/ldr/init.c | 61 +------ reactos/ntoskrnl/ldr/loader.c | 12 -- reactos/ntoskrnl/ldr/sysdll.c | 2 +- reactos/ntoskrnl/lpc/port.c | 2 +- reactos/ntoskrnl/mm/pagefile.c | 3 +- reactos/ntoskrnl/mm/section.c | 2 +- reactos/ntoskrnl/ob/wait.c | 4 +- reactos/ntoskrnl/ps/locale.c | 44 ++--- reactos/ntoskrnl/ps/query.c | 4 +- reactos/ntoskrnl/ps/thread.c | 2 +- reactos/ntoskrnl/rtl/libsupp.c | 4 - reactos/ntoskrnl/rtl/rangelist.c | 4 - reactos/ntoskrnl/rtl/sprintf.c | 4 +- reactos/ntoskrnl/rtl/stdlib.c | 4 +- reactos/ntoskrnl/rtl/swprintf.c | 4 +- 34 files changed, 284 insertions(+), 340 deletions(-) diff --git a/reactos/include/ntos/ps.h b/reactos/include/ntos/ps.h index 57fa017ec9f..d2e93d04f4e 100644 --- a/reactos/include/ntos/ps.h +++ b/reactos/include/ntos/ps.h @@ -136,7 +136,7 @@ typedef NTSTATUS (STDCALL *PW32_THREAD_CALLBACK)(struct _ETHREAD *Thread, BOOLEAN Create); -typedef struct _EJOB *PEJOB; +struct _EJOB; NTSTATUS STDCALL PsCreateSystemProcess (PHANDLE ProcessHandle, @@ -189,19 +189,19 @@ STDCALL PsGetCurrentThreadStackLimit ( PVOID STDCALL PsGetJobLock( - PEJOB Job + struct _EJOB* Job ); PVOID STDCALL PsGetJobSessionId( - PEJOB Job + struct _EJOB* Job ); ULONG STDCALL PsGetJobUIRestrictionsClass( - PEJOB Job + struct _EJOB* Job ); @@ -247,7 +247,7 @@ STDCALL PsGetProcessInheritedFromUniqueProcessId( ); -PEJOB +struct _EJOB* STDCALL PsGetProcessJob( PEPROCESS Process ); @@ -378,7 +378,7 @@ PsRevertThreadToSelf( VOID STDCALL PsSetJobUIRestrictionsClass( - PEJOB Job, + struct _EJOB* Job, ULONG UIRestrictionsClass ); diff --git a/reactos/include/ntos/security.h b/reactos/include/ntos/security.h index 37a4cd08372..f7ec10716fc 100644 --- a/reactos/include/ntos/security.h +++ b/reactos/include/ntos/security.h @@ -4,6 +4,7 @@ #include #include +#ifndef __USE_W32API /* Privileges */ #define SE_MIN_WELL_KNOWN_PRIVILEGE (2L) #define SE_CREATE_TOKEN_PRIVILEGE (2L) @@ -31,7 +32,7 @@ #define SE_CHANGE_NOTIFY_PRIVILEGE (23L) #define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L) #define SE_MAX_WELL_KNOWN_PRIVILEGE SE_REMOTE_SHUTDOWN_PRIVILEGE - +#endif /* TOKEN_GROUPS structure */ #ifndef SE_GROUP_MANDATORY #define SE_GROUP_MANDATORY (0x1L) diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 7a59fee0b78..27c11f2c293 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -97,7 +97,7 @@ ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature) NTSTATUS STDCALL NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName, - OUT PWCHAR ValueBuffer, + OUT PWSTR ValueBuffer, IN ULONG ValueBufferLength, IN OUT PULONG ReturnLength OPTIONAL) { @@ -353,17 +353,17 @@ QSI_DEF(SystemBasicInformation) { return (STATUS_INFO_LENGTH_MISMATCH); } - Sbi->Unknown = 0; - Sbi->MaximumIncrement = KeMaximumIncrement; - Sbi->PhysicalPageSize = PAGE_SIZE; + Sbi->Reserved = 0; + Sbi->TimerResolution = KeMaximumIncrement; + Sbi->PageSize = PAGE_SIZE; Sbi->NumberOfPhysicalPages = MmStats.NrTotalPages; - Sbi->LowestPhysicalPage = 0; /* FIXME */ - Sbi->HighestPhysicalPage = MmStats.NrTotalPages; /* FIXME */ + Sbi->LowestPhysicalPageNumber = 0; /* FIXME */ + Sbi->HighestPhysicalPageNumber = MmStats.NrTotalPages; /* FIXME */ Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */ - Sbi->LowestUserAddress = 0x10000; /* Top of 64k */ - Sbi->HighestUserAddress = (ULONG_PTR)MmHighestUserAddress; - Sbi->ActiveProcessors = KeActiveProcessors; - Sbi->NumberProcessors = KeNumberProcessors; + Sbi->MinimumUserModeAddress = 0x10000; /* Top of 64k */ + Sbi->MaximumUserModeAddress = (ULONG_PTR)MmHighestUserAddress; + Sbi->ActiveProcessorsAffinityMask = KeActiveProcessors; + Sbi->NumberOfProcessors = KeNumberProcessors; return (STATUS_SUCCESS); } @@ -385,8 +385,8 @@ QSI_DEF(SystemProcessorInformation) Spi->ProcessorArchitecture = 0; /* Intel Processor */ Spi->ProcessorLevel = Prcb->CpuType; Spi->ProcessorRevision = Prcb->CpuStep; - Spi->Unknown = 0; - Spi->FeatureBits = Prcb->FeatureBits; + Spi->Reserved = 0; + Spi->ProcessorFeatureBits = Prcb->FeatureBits; DPRINT("Arch %d Level %d Rev 0x%x\n", Spi->ProcessorArchitecture, Spi->ProcessorLevel, Spi->ProcessorRevision); @@ -413,21 +413,21 @@ QSI_DEF(SystemPerformanceInformation) TheIdleProcess = PsIdleProcess; - Spi->IdleTime.QuadPart = TheIdleProcess->Pcb.KernelTime * 100000LL; + Spi->IdleProcessTime.QuadPart = TheIdleProcess->Pcb.KernelTime * 100000LL; - Spi->ReadTransferCount = IoReadTransferCount; - Spi->WriteTransferCount = IoWriteTransferCount; - Spi->OtherTransferCount = IoOtherTransferCount; - Spi->ReadOperationCount = IoReadOperationCount; - Spi->WriteOperationCount = IoWriteOperationCount; - Spi->OtherOperationCount = IoOtherOperationCount; + Spi->IoReadTransferCount = IoReadTransferCount; + Spi->IoWriteTransferCount = IoWriteTransferCount; + Spi->IoOtherTransferCount = IoOtherTransferCount; + Spi->IoReadOperationCount = IoReadOperationCount; + Spi->IoWriteOperationCount = IoWriteOperationCount; + Spi->IoOtherOperationCount = IoOtherOperationCount; Spi->AvailablePages = MmStats.NrFreePages; /* Add up all the used "Commitied" memory + pagefile. Not sure this is right. 8^\ */ - Spi->TotalCommittedPages = MiMemoryConsumers[MC_PPOOL].PagesUsed + + Spi->CommittedPages = MiMemoryConsumers[MC_PPOOL].PagesUsed + MiMemoryConsumers[MC_NPPOOL].PagesUsed+ MiMemoryConsumers[MC_CACHE].PagesUsed+ MiMemoryConsumers[MC_USER].PagesUsed+ @@ -437,79 +437,79 @@ QSI_DEF(SystemPerformanceInformation) All this make Taskmgr happy but not sure it is the right numbers. This too, fixes some of GlobalMemoryStatusEx numbers. */ - Spi->TotalCommitLimit = MmStats.NrTotalPages + MiFreeSwapPages + + Spi->CommitLimit = MmStats.NrTotalPages + MiFreeSwapPages + MiUsedSwapPages; Spi->PeakCommitment = 0; /* FIXME */ - Spi->PageFaults = 0; /* FIXME */ - Spi->WriteCopyFaults = 0; /* FIXME */ - Spi->TransitionFaults = 0; /* FIXME */ - Spi->CacheTransitionFaults = 0; /* FIXME */ - Spi->DemandZeroFaults = 0; /* FIXME */ - Spi->PagesRead = 0; /* FIXME */ - Spi->PageReadIos = 0; /* FIXME */ - Spi->CacheReads = 0; /* FIXME */ - Spi->CacheIos = 0; /* FIXME */ - Spi->PagefilePagesWritten = 0; /* FIXME */ - Spi->PagefilePageWriteIos = 0; /* FIXME */ - Spi->MappedFilePagesWritten = 0; /* FIXME */ - Spi->MappedFilePageWriteIos = 0; /* FIXME */ + Spi->PageFaultCount = 0; /* FIXME */ + Spi->CopyOnWriteCount = 0; /* FIXME */ + Spi->TransitionCount = 0; /* FIXME */ + Spi->CacheTransitionCount = 0; /* FIXME */ + Spi->DemandZeroCount = 0; /* FIXME */ + Spi->PageReadCount = 0; /* FIXME */ + Spi->PageReadIoCount = 0; /* FIXME */ + Spi->CacheReadCount = 0; /* FIXME */ + Spi->CacheIoCount = 0; /* FIXME */ + Spi->DirtyPagesWriteCount = 0; /* FIXME */ + Spi->DirtyWriteIoCount = 0; /* FIXME */ + Spi->MappedPagesWriteCount = 0; /* FIXME */ + Spi->MappedWriteIoCount = 0; /* FIXME */ - Spi->PagedPoolUsage = MiMemoryConsumers[MC_PPOOL].PagesUsed; + Spi->PagedPoolPages = MiMemoryConsumers[MC_PPOOL].PagesUsed; Spi->PagedPoolAllocs = 0; /* FIXME */ Spi->PagedPoolFrees = 0; /* FIXME */ - Spi->NonPagedPoolUsage = MiMemoryConsumers[MC_NPPOOL].PagesUsed; + Spi->NonPagedPoolPages = MiMemoryConsumers[MC_NPPOOL].PagesUsed; Spi->NonPagedPoolAllocs = 0; /* FIXME */ Spi->NonPagedPoolFrees = 0; /* FIXME */ - Spi->TotalFreeSystemPtes = 0; /* FIXME */ + Spi->FreeSystemPtes = 0; /* FIXME */ - Spi->SystemCodePage = MmStats.NrSystemPages; /* FIXME */ + Spi->ResidentSystemCodePage = MmStats.NrSystemPages; /* FIXME */ Spi->TotalSystemDriverPages = 0; /* FIXME */ Spi->TotalSystemCodePages = 0; /* FIXME */ - Spi->SmallNonPagedLookasideListAllocateHits = 0; /* FIXME */ - Spi->SmallPagedLookasideListAllocateHits = 0; /* FIXME */ - Spi->Reserved3 = 0; /* FIXME */ + Spi->NonPagedPoolLookasideHits = 0; /* FIXME */ + Spi->PagedPoolLookasideHits = 0; /* FIXME */ + Spi->Spare3Count = 0; /* FIXME */ - Spi->MmSystemCachePage = MiMemoryConsumers[MC_CACHE].PagesUsed; - Spi->PagedPoolPage = MmPagedPoolSize; /* FIXME */ + Spi->ResidentSystemCachePage = MiMemoryConsumers[MC_CACHE].PagesUsed; + Spi->ResidentPagedPoolPage = MmPagedPoolSize; /* FIXME */ - Spi->SystemDriverPage = 0; /* FIXME */ - Spi->FastReadNoWait = 0; /* FIXME */ - Spi->FastReadWait = 0; /* FIXME */ - Spi->FastReadResourceMiss = 0; /* FIXME */ - Spi->FastReadNotPossible = 0; /* FIXME */ + Spi->ResidentSystemDriverPage = 0; /* FIXME */ + Spi->CcFastReadNoWait = 0; /* FIXME */ + Spi->CcFastReadWait = 0; /* FIXME */ + Spi->CcFastReadResourceMiss = 0; /* FIXME */ + Spi->CcFastReadNotPossible = 0; /* FIXME */ - Spi->FastMdlReadNoWait = 0; /* FIXME */ - Spi->FastMdlReadWait = 0; /* FIXME */ - Spi->FastMdlReadResourceMiss = 0; /* FIXME */ - Spi->FastMdlReadNotPossible = 0; /* FIXME */ + Spi->CcFastMdlReadNoWait = 0; /* FIXME */ + Spi->CcFastMdlReadWait = 0; /* FIXME */ + Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */ + Spi->CcFastMdlReadNotPossible = 0; /* FIXME */ - Spi->MapDataNoWait = 0; /* FIXME */ - Spi->MapDataWait = 0; /* FIXME */ - Spi->MapDataNoWaitMiss = 0; /* FIXME */ - Spi->MapDataWaitMiss = 0; /* FIXME */ + Spi->CcMapDataNoWait = 0; /* FIXME */ + Spi->CcMapDataWait = 0; /* FIXME */ + Spi->CcMapDataNoWaitMiss = 0; /* FIXME */ + Spi->CcMapDataWaitMiss = 0; /* FIXME */ - Spi->PinMappedDataCount = 0; /* FIXME */ - Spi->PinReadNoWait = 0; /* FIXME */ - Spi->PinReadWait = 0; /* FIXME */ - Spi->PinReadNoWaitMiss = 0; /* FIXME */ - Spi->PinReadWaitMiss = 0; /* FIXME */ - Spi->CopyReadNoWait = 0; /* FIXME */ - Spi->CopyReadWait = 0; /* FIXME */ - Spi->CopyReadNoWaitMiss = 0; /* FIXME */ - Spi->CopyReadWaitMiss = 0; /* FIXME */ + Spi->CcPinMappedDataCount = 0; /* FIXME */ + Spi->CcPinReadNoWait = 0; /* FIXME */ + Spi->CcPinReadWait = 0; /* FIXME */ + Spi->CcPinReadNoWaitMiss = 0; /* FIXME */ + Spi->CcPinReadWaitMiss = 0; /* FIXME */ + Spi->CcCopyReadNoWait = 0; /* FIXME */ + Spi->CcCopyReadWait = 0; /* FIXME */ + Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */ + Spi->CcCopyReadWaitMiss = 0; /* FIXME */ - Spi->MdlReadNoWait = 0; /* FIXME */ - Spi->MdlReadWait = 0; /* FIXME */ - Spi->MdlReadNoWaitMiss = 0; /* FIXME */ - Spi->MdlReadWaitMiss = 0; /* FIXME */ - Spi->ReadAheadIos = 0; /* FIXME */ - Spi->LazyWriteIos = 0; /* FIXME */ - Spi->LazyWritePages = 0; /* FIXME */ - Spi->DataFlushes = 0; /* FIXME */ - Spi->DataPages = 0; /* FIXME */ + Spi->CcMdlReadNoWait = 0; /* FIXME */ + Spi->CcMdlReadWait = 0; /* FIXME */ + Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */ + Spi->CcMdlReadWaitMiss = 0; /* FIXME */ + Spi->CcReadAheadIos = 0; /* FIXME */ + Spi->CcLazyWriteIos = 0; /* FIXME */ + Spi->CcLazyWritePages = 0; /* FIXME */ + Spi->CcDataFlushes = 0; /* FIXME */ + Spi->CcDataPages = 0; /* FIXME */ Spi->ContextSwitches = 0; /* FIXME */ Spi->FirstLevelTbFills = 0; /* FIXME */ Spi->SecondLevelTbFills = 0; /* FIXME */ @@ -1100,39 +1100,39 @@ QSI_DEF(SystemFullMemoryInformation) /* Class 26 - Load Image */ SSI_DEF(SystemLoadImage) { - PSYSTEM_LOAD_IMAGE Sli = (PSYSTEM_LOAD_IMAGE)Buffer; + PSYSTEM_GDI_DRIVER_INFORMATION Sli = (PSYSTEM_GDI_DRIVER_INFORMATION)Buffer; - if (sizeof(SYSTEM_LOAD_IMAGE) != Size) + if (sizeof(SYSTEM_GDI_DRIVER_INFORMATION) != Size) { return(STATUS_INFO_LENGTH_MISMATCH); } - return(LdrpLoadImage(&Sli->ModuleName, - &Sli->ModuleBase, + return(LdrpLoadImage(&Sli->DriverName, + &Sli->ImageAddress, &Sli->SectionPointer, &Sli->EntryPoint, - &Sli->ExportDirectory)); + (PVOID)&Sli->ExportSectionPointer)); } /* Class 27 - Unload Image */ SSI_DEF(SystemUnloadImage) { - PSYSTEM_UNLOAD_IMAGE Sui = (PSYSTEM_UNLOAD_IMAGE)Buffer; + PVOID Sui = (PVOID)Buffer; - if (sizeof(SYSTEM_UNLOAD_IMAGE) != Size) + if (sizeof(PVOID) != Size) { return(STATUS_INFO_LENGTH_MISMATCH); } - return(LdrpUnloadImage(Sui->ModuleBase)); + return(LdrpUnloadImage(Sui)); } /* Class 28 - Time Adjustment Information */ QSI_DEF(SystemTimeAdjustmentInformation) { - if (sizeof (SYSTEM_SET_TIME_ADJUSTMENT) > Size) + if (sizeof (SYSTEM_SET_TIME_ADJUST_INFORMATION) > Size) { - * ReqSize = sizeof (SYSTEM_SET_TIME_ADJUSTMENT); + * ReqSize = sizeof (SYSTEM_SET_TIME_ADJUST_INFORMATION); return (STATUS_INFO_LENGTH_MISMATCH); } /* FIXME: */ @@ -1142,7 +1142,7 @@ QSI_DEF(SystemTimeAdjustmentInformation) SSI_DEF(SystemTimeAdjustmentInformation) { - if (sizeof (SYSTEM_SET_TIME_ADJUSTMENT) > Size) + if (sizeof (SYSTEM_SET_TIME_ADJUST_INFORMATION) > Size) { return (STATUS_INFO_LENGTH_MISMATCH); } @@ -1229,7 +1229,7 @@ QSI_DEF(SystemRegistryQuotaInformation) DPRINT1("Faking max registry size of 32 MB\n"); srqi->RegistryQuotaAllowed = 0x2000000; srqi->RegistryQuotaUsed = 0x200000; - srqi->Reserved1 = (void*)0x200000; + srqi->PagedPoolSize = 0x200000; return STATUS_SUCCESS; } @@ -1244,14 +1244,14 @@ SSI_DEF(SystemRegistryQuotaInformation) /* Class 38 - Load And Call Image */ SSI_DEF(SystemLoadAndCallImage) { - PSYSTEM_LOAD_AND_CALL_IMAGE Slci = (PSYSTEM_LOAD_AND_CALL_IMAGE)Buffer; + PUNICODE_STRING Slci = (PUNICODE_STRING)Buffer; - if (sizeof(SYSTEM_LOAD_AND_CALL_IMAGE) != Size) + if (sizeof(UNICODE_STRING) != Size) { return(STATUS_INFO_LENGTH_MISMATCH); } - return(LdrpLoadAndCallImage(&Slci->ModuleName)); + return(LdrpLoadAndCallImage(Slci)); } /* Class 39 - Priority Separation */ @@ -1532,7 +1532,7 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass, /* * Check the request is valid. */ - if ((SystemInformationClass >= SystemInformationClassMin) && + if ((SystemInformationClass >= SystemBasicInformation) && (SystemInformationClass < SystemInformationClassMax)) { if (NULL != CallQS [SystemInformationClass].Query) @@ -1609,7 +1609,7 @@ NtSetSystemInformation ( /* * Check the request is valid. */ - if ( (SystemInformationClass >= SystemInformationClassMin) + if ( (SystemInformationClass >= SystemBasicInformation) && (SystemInformationClass < SystemInformationClassMax) ) { diff --git a/reactos/ntoskrnl/ex/win32k.c b/reactos/ntoskrnl/ex/win32k.c index 04b56f6820c..a5dd22a83b1 100644 --- a/reactos/ntoskrnl/ex/win32k.c +++ b/reactos/ntoskrnl/ex/win32k.c @@ -18,25 +18,20 @@ POBJECT_TYPE EXPORTED ExWindowStationObjectType = NULL; POBJECT_TYPE EXPORTED ExDesktopObjectType = NULL; -static GENERIC_MAPPING ExpWindowStationMapping = { - - STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_READSCREEN, - STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES, - STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS, - STANDARD_RIGHTS_REQUIRED | WINSTA_ACCESSCLIPBOARD | WINSTA_ACCESSGLOBALATOMS | WINSTA_CREATEDESKTOP | - WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_EXITWINDOWS | - WINSTA_READATTRIBUTES | WINSTA_READSCREEN | WINSTA_WRITEATTRIBUTES +static GENERIC_MAPPING ExpWindowStationMapping = +{ + STANDARD_RIGHTS_READ, + STANDARD_RIGHTS_WRITE, + STANDARD_RIGHTS_EXECUTE, + STANDARD_RIGHTS_REQUIRED }; -static GENERIC_MAPPING ExpDesktopMapping = { - - STANDARD_RIGHTS_READ | DESKTOP_ENUMERATE | DESKTOP_READOBJECTS, - STANDARD_RIGHTS_WRITE | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_HOOKCONTROL | - DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | DESKTOP_WRITEOBJECTS, - STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP, - STANDARD_RIGHTS_REQUIRED | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | - DESKTOP_HOOKCONTROL | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | - DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS +static GENERIC_MAPPING ExpDesktopMapping = +{ + STANDARD_RIGHTS_READ, + STANDARD_RIGHTS_WRITE, + STANDARD_RIGHTS_EXECUTE, + STANDARD_RIGHTS_REQUIRED }; OB_OPEN_METHOD ExpWindowStationObjectOpen = NULL; diff --git a/reactos/ntoskrnl/inbv/inbv.c b/reactos/ntoskrnl/inbv/inbv.c index a9ef354b720..9a35850dc67 100755 --- a/reactos/ntoskrnl/inbv/inbv.c +++ b/reactos/ntoskrnl/inbv/inbv.c @@ -37,9 +37,8 @@ InbvCheckBootVid(VOID) { NTSTATUS Status; OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING BootVidName; + UNICODE_STRING BootVidName = RTL_CONSTANT_STRING(L"\\Device\\BootVid"); - RtlRosInitUnicodeStringFromLiteral(&BootVidName, L"\\Device\\BootVid"); InitializeObjectAttributes(&ObjectAttributes, &BootVidName, 0, diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index df4664257d6..9be2541a67a 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -576,6 +576,18 @@ VOID STDCALL KeFlushCurrentTb(VOID); +/* REACTOS SPECIFIC */ + +VOID STDCALL +KeRosDumpStackFrames( + PULONG Frame, + ULONG FrameCount); + +ULONG STDCALL +KeRosGetStackFrames( + PULONG Frames, + ULONG FrameCount); + VOID KiSetSystemTime(PLARGE_INTEGER NewSystemTime); diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 154c4ad2944..5c8a8f052db 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -85,6 +85,8 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE; #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000 #endif +#define TEB_BASE (0x7FFDE000) + #define MM_VIRTMEM_GRANULARITY (64 * 1024) /* Although Microsoft says this isn't hardcoded anymore, they won't be able to change it. Stuff depends on it */ diff --git a/reactos/ntoskrnl/include/internal/ntoskrnl.h b/reactos/ntoskrnl/include/internal/ntoskrnl.h index 74fb7d2a228..1033e9a2145 100644 --- a/reactos/ntoskrnl/include/internal/ntoskrnl.h +++ b/reactos/ntoskrnl/include/internal/ntoskrnl.h @@ -15,6 +15,40 @@ #define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") +#ifdef _NTOSKRNL_ + +#include "ke.h" +#include "i386/segment.h" +#include "i386/mm.h" +#include "i386/fpu.h" +#include "module.h" +#include "pool.h" +#include "ob.h" +#include "mm.h" +#include "ps.h" +#include "cc.h" +#include "io.h" +#include "po.h" +#include "se.h" +#include "ldr.h" +#include "kd.h" +#include "ex.h" +#include "xhal.h" +#include "v86m.h" +#include "ifs.h" +#include "port.h" +#include "nls.h" +#ifdef KDBG +#include "kdb.h" +#endif +#include "dbgk.h" +#include "trap.h" +#include "safe.h" +#include "tag.h" +#include "test.h" +#include "inbv.h" + + #include /* * Defines a descriptor as it appears in the processor tables @@ -62,6 +96,7 @@ RtlpCreateUnicodeString( IN PCWSTR Source, IN POOL_TYPE PoolType); +#endif #endif /* __ASM__ */ /* diff --git a/reactos/ntoskrnl/include/internal/port.h b/reactos/ntoskrnl/include/internal/port.h index 4c6f8464742..606f1505b62 100644 --- a/reactos/ntoskrnl/include/internal/port.h +++ b/reactos/ntoskrnl/include/internal/port.h @@ -95,6 +95,61 @@ typedef struct _QUEUEDMESSAGE UCHAR MessageData [MAX_MESSAGE_DATA]; } QUEUEDMESSAGE, *PQUEUEDMESSAGE; +typedef struct _LPC_DBG_MESSAGE +{ + LPC_MESSAGE Header; + ULONG Type; + ULONG Status; + union + { + struct + { + EXCEPTION_RECORD ExceptionRecord; + ULONG FirstChance; + } Exception; + struct + { + ULONG Reserved; + PVOID StartAddress; + } CreateThread; + struct + { + ULONG Reserved; + HANDLE FileHandle; + PVOID Base; + ULONG PointerToSymbolTable; + ULONG NumberOfSymbols; + ULONG Reserved2; + PVOID EntryPoint; + } CreateProcess; + struct + { + ULONG ExitCode; + } ExitThread; + struct + { + ULONG ExitCode; + } ExitProcess; + struct + { + HANDLE FileHandle; + PVOID Base; + ULONG PointerToSymbolTable; + ULONG NumberOfSymbols; + } LoadDll; + struct + { + PVOID Base; + } UnloadDll; + } Data; +} LPC_DBG_MESSAGE, *PLPC_DBG_MESSAGE; + +typedef struct _LPC_TERMINATION_MESSAGE +{ + LPC_MESSAGE Header; + LARGE_INTEGER CreationTime; +} LPC_TERMINATION_MESSAGE, *PLPC_TERMINATION_MESSAGE; + /* Code in ntoskrnl/lpc/close.h */ VOID STDCALL diff --git a/reactos/ntoskrnl/include/internal/ps.h b/reactos/ntoskrnl/include/internal/ps.h index e0392dc5815..678d772bff5 100644 --- a/reactos/ntoskrnl/include/internal/ps.h +++ b/reactos/ntoskrnl/include/internal/ps.h @@ -542,7 +542,7 @@ typedef struct _EJOB UINT PeakJobMemoryUsed; UINT CurrentJobMemoryUsed; FAST_MUTEX MemoryLimitsLock; -} EJOB; +} EJOB, *PEJOB; #include VOID INIT_FUNCTION PsInitJobManagment(VOID); diff --git a/reactos/ntoskrnl/include/ntoskrnl.h b/reactos/ntoskrnl/include/ntoskrnl.h index 2e09ea5bf09..fc41ac84666 100755 --- a/reactos/ntoskrnl/include/ntoskrnl.h +++ b/reactos/ntoskrnl/include/ntoskrnl.h @@ -5,76 +5,37 @@ /* include the ntoskrnl config.h file */ #include "config.h" - -#include +#include + +/* DDK/IFS/NDK Headers */ #include #include #include - +#include #undef IO_TYPE_FILE #define IO_TYPE_FILE 0x0F5L /* Temp Hack */ + +/* FIXME: Add to ndk, or at least move somewhere else */ +#include +#include -#include +/* ReactOS Headers */ #include #include #include #include -#include -#include -#include -#include + +/* C Headers */ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "internal/xhal.h" -#include -#include -#include -#include -#ifdef KDBG -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef TAG -#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24)) -#endif +/* SEH support with PSEH */ +#include + +/* Helper Header */ +#include + +/* Internal Headers */ +#include "internal/ntoskrnl.h" #endif /* INCLUDE_NTOSKRNL_H */ diff --git a/reactos/ntoskrnl/io/arcname.c b/reactos/ntoskrnl/io/arcname.c index a317cec0bce..cff2b2419fa 100644 --- a/reactos/ntoskrnl/io/arcname.c +++ b/reactos/ntoskrnl/io/arcname.c @@ -311,7 +311,7 @@ IoCreateSystemRootLink(PCHAR ParameterLine) { OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; - UNICODE_STRING LinkName; + UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot"); UNICODE_STRING DeviceName; UNICODE_STRING ArcName; UNICODE_STRING BootPath; @@ -445,9 +445,6 @@ IoCreateSystemRootLink(PCHAR ParameterLine) DPRINT("DeviceName: %wZ\n", &DeviceName); /* create the '\SystemRoot' link */ - RtlRosInitUnicodeStringFromLiteral(&LinkName, - L"\\SystemRoot"); - Status = IoCreateSymbolicLink(&LinkName, &DeviceName); ExFreePool(DeviceName.Buffer); diff --git a/reactos/ntoskrnl/io/driver.c b/reactos/ntoskrnl/io/driver.c index 73d010638cf..a859dbeec66 100644 --- a/reactos/ntoskrnl/io/driver.c +++ b/reactos/ntoskrnl/io/driver.c @@ -72,7 +72,7 @@ static LIST_ENTRY GroupListHead = {NULL, NULL}; static LIST_ENTRY ServiceListHead = {NULL, NULL}; static UNICODE_STRING IopHardwareDatabaseKey = - ROS_STRING_INITIALIZER(L"\\REGISTRY\\MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM"); + RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM"); POBJECT_TYPE EXPORTED IoDriverObjectType = NULL; @@ -1019,7 +1019,7 @@ IoCreateDriverList(VOID) RTL_QUERY_REGISTRY_TABLE QueryTable[2]; PKEY_BASIC_INFORMATION KeyInfo = NULL; OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ServicesKeyName; + UNICODE_STRING ServicesKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services"); UNICODE_STRING SubKeyName; HANDLE KeyHandle; NTSTATUS Status; @@ -1050,9 +1050,6 @@ IoCreateDriverList(VOID) return(Status); /* Enumerate services and create the service list */ - RtlRosInitUnicodeStringFromLiteral(&ServicesKeyName, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Services"); - InitializeObjectAttributes(&ObjectAttributes, &ServicesKeyName, OBJ_CASE_INSENSITIVE, diff --git a/reactos/ntoskrnl/io/file.c b/reactos/ntoskrnl/io/file.c index ea4dca54f5e..f4b70f86744 100644 --- a/reactos/ntoskrnl/io/file.c +++ b/reactos/ntoskrnl/io/file.c @@ -14,9 +14,6 @@ #define NDEBUG #include -/* FIXME: Header mess */ -#undef CreateMailslot - /* GLOBALS *******************************************************************/ extern GENERIC_MAPPING IopFileMapping; @@ -3004,7 +3001,7 @@ NTSTATUS STDCALL NtSetQuotaInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, - PFILE_USER_QUOTA_INFORMATION Buffer, + PFILE_QUOTA_INFORMATION Buffer, ULONG BufferLength) { UNIMPLEMENTED; diff --git a/reactos/ntoskrnl/io/iomgr.c b/reactos/ntoskrnl/io/iomgr.c index b5615aa5124..4653c874e39 100644 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@ -182,7 +182,7 @@ IoInit (VOID) UNICODE_STRING Name; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING DirName; - UNICODE_STRING LinkName; + UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\DosDevices"); HANDLE Handle; IopInitDriverImplementation(); @@ -222,7 +222,7 @@ IoInit (VOID) /* * Create the '\Driver' object directory */ - RtlRosInitUnicodeStringFromLiteral(&DirName, L"\\Driver"); + RtlInitUnicodeString(&DirName, L"\\Driver"); InitializeObjectAttributes(&ObjectAttributes, &DirName, 0, @@ -235,7 +235,7 @@ IoInit (VOID) /* * Create the '\FileSystem' object directory */ - RtlRosInitUnicodeStringFromLiteral(&DirName, + RtlInitUnicodeString(&DirName, L"\\FileSystem"); InitializeObjectAttributes(&ObjectAttributes, &DirName, @@ -249,7 +249,7 @@ IoInit (VOID) /* * Create the '\Device' directory */ - RtlRosInitUnicodeStringFromLiteral(&DirName, + RtlInitUnicodeString(&DirName, L"\\Device"); InitializeObjectAttributes(&ObjectAttributes, &DirName, @@ -263,7 +263,7 @@ IoInit (VOID) /* * Create the '\??' directory */ - RtlRosInitUnicodeStringFromLiteral(&DirName, + RtlInitUnicodeString(&DirName, L"\\??"); InitializeObjectAttributes(&ObjectAttributes, &DirName, @@ -277,7 +277,7 @@ IoInit (VOID) /* * Create the '\ArcName' directory */ - RtlRosInitUnicodeStringFromLiteral(&DirName, + RtlInitUnicodeString(&DirName, L"\\ArcName"); InitializeObjectAttributes(&ObjectAttributes, &DirName, @@ -304,9 +304,7 @@ IoInit (VOID) /* * Create link from '\DosDevices' to '\??' directory */ - RtlRosInitUnicodeStringFromLiteral(&LinkName, - L"\\DosDevices"); - RtlRosInitUnicodeStringFromLiteral(&DirName, + RtlInitUnicodeString(&DirName, L"\\??"); IoCreateSymbolicLink(&LinkName, &DirName); diff --git a/reactos/ntoskrnl/io/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr.c index 3776ccae898..4a5a006f1aa 100644 --- a/reactos/ntoskrnl/io/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr.c @@ -10,14 +10,10 @@ /* INCLUDES ******************************************************************/ #include -#include #define NDEBUG #include -/* FIXME: Header mess */ -#undef DeviceCapabilities - /* GLOBALS *******************************************************************/ PDEVICE_NODE IopRootDeviceNode; diff --git a/reactos/ntoskrnl/io/resource.c b/reactos/ntoskrnl/io/resource.c index a87fa5ac0c1..e6e0dc0b6a0 100644 --- a/reactos/ntoskrnl/io/resource.c +++ b/reactos/ntoskrnl/io/resource.c @@ -827,7 +827,7 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription, HANDLE DescriptionKey; /* Open/Create 'RESOURCEMAP' key. */ - RtlRosInitUnicodeStringFromLiteral(&Name, + RtlInitUnicodeString(&Name, L"\\Registry\\Machine\\HARDWARE\\RESOURCEMAP"); InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -845,7 +845,7 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription, return(Status); /* Open/Create 'Hardware Abstraction Layer' key */ - RtlRosInitUnicodeStringFromLiteral(&Name, + RtlInitUnicodeString(&Name, L"Hardware Abstraction Layer"); InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -881,7 +881,7 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription, return(Status); /* Add '.Raw' value. */ - RtlRosInitUnicodeStringFromLiteral(&Name, + RtlInitUnicodeString(&Name, L".Raw"); Status = ZwSetValueKey(DescriptionKey, &Name, @@ -896,7 +896,7 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription, } /* Add '.Translated' value. */ - RtlRosInitUnicodeStringFromLiteral(&Name, + RtlInitUnicodeString(&Name, L".Translated"); Status = ZwSetValueKey(DescriptionKey, &Name, diff --git a/reactos/ntoskrnl/kdbg/kdb_symbols.c b/reactos/ntoskrnl/kdbg/kdb_symbols.c index 617f106a341..4a465fdea67 100644 --- a/reactos/ntoskrnl/kdbg/kdb_symbols.c +++ b/reactos/ntoskrnl/kdbg/kdb_symbols.c @@ -508,7 +508,7 @@ KdbSymLoadUserModuleSymbols(IN PLDR_DATA_TABLE_ENTRY LdrModule) LdrModule->FullDllName.Length); KernelName.Buffer[KernelName.Length / sizeof(WCHAR)] = L'\0'; - KdbpSymLoadModuleSymbols(&KernelName, &LdrModule->RosSymInfo); + KdbpSymLoadModuleSymbols(&KernelName, (PROSSYM_INFO*)&LdrModule->RosSymInfo); ExFreePool(KernelName.Buffer); } diff --git a/reactos/ntoskrnl/ke/i386/kernel.c b/reactos/ntoskrnl/ke/i386/kernel.c index 65e054fb210..17433c37b26 100644 --- a/reactos/ntoskrnl/ke/i386/kernel.c +++ b/reactos/ntoskrnl/ke/i386/kernel.c @@ -456,8 +456,9 @@ Ki386SetProcessorFeatures(VOID) { PKIPCR Pcr = (PKIPCR)KeGetCurrentKPCR(); OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; + UNICODE_STRING KeyName = + RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager\\Kernel"); + UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"FastSystemCallDisable"); HANDLE KeyHandle; ULONG ResultLength; KEY_VALUE_PARTIAL_INFORMATION ValueData; @@ -488,10 +489,6 @@ Ki386SetProcessorFeatures(VOID) /* FIXME: Check for Family == 6, Model < 3 and Stepping < 3 and disable */ /* Make sure it's not disabled in registry */ - RtlRosInitUnicodeStringFromLiteral(&KeyName, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager\\Kernel"); - RtlRosInitUnicodeStringFromLiteral(&ValueName, - L"FastSystemCallDisable"); InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, diff --git a/reactos/ntoskrnl/ldr/init.c b/reactos/ntoskrnl/ldr/init.c index ff9d849a628..dcbad0e31fe 100644 --- a/reactos/ntoskrnl/ldr/init.c +++ b/reactos/ntoskrnl/ldr/init.c @@ -17,78 +17,19 @@ #define NDEBUG #include - -/* - * HACK! No matter what i did, i couldnt get it working when i put these into ntos\rtl.h - * (got redefinition problems, since ntdll\rtl.h somehow include ntos\rtl.h). - * We need to merge ntos\rtl.h and ntdll\rtl.h to get this working. -Gunnar - */ -typedef struct _RTL_PROCESS_INFO -{ - ULONG Size; - HANDLE ProcessHandle; - HANDLE ThreadHandle; - CLIENT_ID ClientId; - SECTION_IMAGE_INFORMATION ImageInfo; -} RTL_PROCESS_INFO, *PRTL_PROCESS_INFO; - -NTSTATUS -STDCALL -RtlCreateUserProcess ( - IN PUNICODE_STRING ImageFileName, - IN ULONG Attributes, - IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters, - IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL, - IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL, - IN HANDLE ParentProcess OPTIONAL, - IN BOOLEAN CurrentDirectory, - IN HANDLE DebugPort OPTIONAL, - IN HANDLE ExceptionPort OPTIONAL, - OUT PRTL_PROCESS_INFO ProcessInfo - ); - -NTSTATUS -STDCALL -RtlCreateProcessParameters ( - OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters, - IN PUNICODE_STRING ImagePathName OPTIONAL, - IN PUNICODE_STRING DllPath OPTIONAL, - IN PUNICODE_STRING CurrentDirectory OPTIONAL, - IN PUNICODE_STRING CommandLine OPTIONAL, - IN PWSTR Environment OPTIONAL, - IN PUNICODE_STRING WindowTitle OPTIONAL, - IN PUNICODE_STRING DesktopInfo OPTIONAL, - IN PUNICODE_STRING ShellInfo OPTIONAL, - IN PUNICODE_STRING RuntimeInfo OPTIONAL - ); -NTSTATUS -STDCALL -RtlDestroyProcessParameters ( - IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters - ); - - - /* FUNCTIONS *****************************************************************/ - - INIT_FUNCTION NTSTATUS LdrLoadInitialProcess(PHANDLE ProcessHandle, PHANDLE ThreadHandle) { - UNICODE_STRING ImagePath; + UNICODE_STRING ImagePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\smss.exe"); HANDLE SystemProcessHandle; NTSTATUS Status; PRTL_USER_PROCESS_PARAMETERS Params=NULL; RTL_PROCESS_INFO Info; - /* Get the absolute path to smss.exe. */ - RtlRosInitUnicodeStringFromLiteral(&ImagePath, - L"\\SystemRoot\\system32\\smss.exe"); - - Status = ObpCreateHandle( PsGetCurrentProcess(), PsInitialSystemProcess, diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 6a5d6b16f13..bfd49cf1dd9 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -46,18 +46,6 @@ STATIC MODULE_TEXT_SECTION NtoskrnlTextSection; STATIC MODULE_TEXT_SECTION LdrHalTextSection; ULONG_PTR LdrHalBase; -#define OPTHDROFFSET(a) ((LPVOID)((BYTE *)a + \ - ((PIMAGE_DOS_HEADER)a)->e_lfanew + \ - IMAGE_SIZEOF_NT_OPTIONAL_HEADER + \ - sizeof (IMAGE_FILE_HEADER))) - -#ifndef HIWORD -#define HIWORD(X) ((WORD) (((DWORD) (X) >> 16) & 0xFFFF)) -#endif -#ifndef LOWORD -#define LOWORD(X) ((WORD) (X)) -#endif - /* FORWARD DECLARATIONS ******************************************************/ NTSTATUS diff --git a/reactos/ntoskrnl/ldr/sysdll.c b/reactos/ntoskrnl/ldr/sysdll.c index d75db35b0d6..44e69896660 100644 --- a/reactos/ntoskrnl/ldr/sysdll.c +++ b/reactos/ntoskrnl/ldr/sysdll.c @@ -173,7 +173,7 @@ STDCALL INIT_FUNCTION LdrpInitializeSystemDll(VOID) { - UNICODE_STRING DllPathname = ROS_STRING_INITIALIZER(L"\\SystemRoot\\system32\\ntdll.dll"); + UNICODE_STRING DllPathname = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll"); OBJECT_ATTRIBUTES FileObjectAttributes; IO_STATUS_BLOCK Iosb; HANDLE FileHandle; diff --git a/reactos/ntoskrnl/lpc/port.c b/reactos/ntoskrnl/lpc/port.c index a3917529898..51f57518718 100644 --- a/reactos/ntoskrnl/lpc/port.c +++ b/reactos/ntoskrnl/lpc/port.c @@ -90,7 +90,7 @@ LpcpInitializePort (IN OUT PEPORT Port, } memset (Port, 0, sizeof(EPORT)); KeInitializeSpinLock (& Port->Lock); - KeInitializeSemaphore( &Port->Semaphore, 0, LONG_MAX ); + KeInitializeSemaphore( &Port->Semaphore, 0, MAXLONG ); Port->RequestPort = Parent; Port->OtherPort = NULL; Port->QueueLength = 0; diff --git a/reactos/ntoskrnl/mm/pagefile.c b/reactos/ntoskrnl/mm/pagefile.c index 1a5f69c3e10..6544bf12909 100644 --- a/reactos/ntoskrnl/mm/pagefile.c +++ b/reactos/ntoskrnl/mm/pagefile.c @@ -648,7 +648,7 @@ MmInitializeCrashDump(HANDLE PageFileHandle, ULONG PageFileNum) PIRP Irp; KEVENT Event; IO_STATUS_BLOCK Iosb; - UNICODE_STRING DiskDumpName; + UNICODE_STRING DiskDumpName = RTL_CONSTANT_STRING(L"DiskDump"); ANSI_STRING ProcName; PIO_STACK_LOCATION StackPtr; PMODULE_OBJECT ModuleObject; @@ -724,7 +724,6 @@ MmInitializeCrashDump(HANDLE PageFileHandle, ULONG PageFileNum) } /* Load the diskdump driver. */ - RtlRosInitUnicodeStringFromLiteral(&DiskDumpName, L"DiskDump"); ModuleObject = LdrGetModuleObject(&DiskDumpName); if (ModuleObject == NULL) { diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index fa26807f834..e8bab05c9c8 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -2093,7 +2093,7 @@ MmCreatePhysicalMemorySection(VOID) PSECTION_OBJECT PhysSection; NTSTATUS Status; OBJECT_ATTRIBUTES Obj; - UNICODE_STRING Name = ROS_STRING_INITIALIZER(L"\\Device\\PhysicalMemory"); + UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory"); LARGE_INTEGER SectionSize; /* diff --git a/reactos/ntoskrnl/ob/wait.c b/reactos/ntoskrnl/ob/wait.c index 470f928b046..3c8f7408d46 100644 --- a/reactos/ntoskrnl/ob/wait.c +++ b/reactos/ntoskrnl/ob/wait.c @@ -92,7 +92,7 @@ NtWaitForMultipleObjects(IN ULONG ObjectCount, { DPRINT1("Waiting for object type '%wZ' is not supported\n", &BODY_TO_HEADER(ObjectPtrArray[i])->Type->Name); - Status = STATUS_HANDLE_NOT_WAITABLE; + Status = STATUS_INVALID_HANDLE; i++; } /* dereference all referenced objects */ @@ -179,7 +179,7 @@ NtWaitForSingleObject(IN HANDLE ObjectHandle, { DPRINT1("Waiting for object type '%wZ' is not supported\n", &BODY_TO_HEADER(ObjectPtr)->Type->Name); - Status = STATUS_HANDLE_NOT_WAITABLE; + Status = STATUS_INVALID_HANDLE; } else { diff --git a/reactos/ntoskrnl/ps/locale.c b/reactos/ntoskrnl/ps/locale.c index 839bded03ec..65e4183cf1f 100644 --- a/reactos/ntoskrnl/ps/locale.c +++ b/reactos/ntoskrnl/ps/locale.c @@ -44,7 +44,7 @@ VOID INIT_FUNCTION PiInitDefaultLocale(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Language"); UNICODE_STRING ValueName; HANDLE KeyHandle; ULONG ValueLength; @@ -56,9 +56,6 @@ PiInitDefaultLocale(VOID) ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION)ValueBuffer; - RtlRosInitUnicodeStringFromLiteral(&KeyName, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Language"); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, @@ -70,7 +67,7 @@ PiInitDefaultLocale(VOID) if (NT_SUCCESS(Status)) { /* Read system locale */ - RtlRosInitUnicodeStringFromLiteral(&ValueName, + RtlInitUnicodeString(&ValueName, L"Default"); Status = ZwQueryValueKey(KeyHandle, &ValueName, @@ -95,7 +92,7 @@ PiInitDefaultLocale(VOID) } /* Read install language id */ - RtlRosInitUnicodeStringFromLiteral(&ValueName, + RtlInitUnicodeString(&ValueName, L"InstallLanguage"); Status = ZwQueryValueKey(KeyHandle, &ValueName, @@ -137,8 +134,8 @@ VOID STDCALL PiInitThreadLocale(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\User\\.Default\\Control Panel\\International"); + UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"Locale"); HANDLE KeyHandle; ULONG ValueLength; UCHAR ValueBuffer[VALUE_BUFFER_SIZE]; @@ -150,11 +147,6 @@ PiInitThreadLocale(VOID) ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION)ValueBuffer; /* read default thread locale */ - RtlRosInitUnicodeStringFromLiteral(&KeyName, - L"\\Registry\\User\\.Default\\Control Panel\\International"); - RtlRosInitUnicodeStringFromLiteral(&ValueName, - L"Locale"); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, @@ -264,17 +256,17 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile, &UserKey); if (!NT_SUCCESS(Status)) return(Status); - RtlRosInitUnicodeStringFromLiteral(&KeyName, + RtlInitUnicodeString(&KeyName, L"Control Panel\\International"); - RtlRosInitUnicodeStringFromLiteral(&ValueName, + RtlInitUnicodeString(&ValueName, L"Locale"); } else { /* system locale */ - RtlRosInitUnicodeStringFromLiteral(&KeyName, + RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Language"); - RtlRosInitUnicodeStringFromLiteral(&ValueName, + RtlInitUnicodeString(&ValueName, L"Default"); } @@ -354,8 +346,8 @@ NtQueryDefaultUILanguage(OUT PLANGID LanguageId) UCHAR ValueBuffer[VALUE_BUFFER_SIZE]; PKEY_VALUE_PARTIAL_INFORMATION ValueInfo; OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"Control Panel\\International"); + UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"MultiUILanguageId"); UNICODE_STRING ValueString; ULONG ValueLength; ULONG Value; @@ -373,11 +365,6 @@ NtQueryDefaultUILanguage(OUT PLANGID LanguageId) return STATUS_SUCCESS; } - RtlRosInitUnicodeStringFromLiteral(&KeyName, - L"Control Panel\\International"); - RtlRosInitUnicodeStringFromLiteral(&ValueName, - L"MultiUILanguageId"); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, @@ -452,8 +439,8 @@ NTSTATUS STDCALL NtSetDefaultUILanguage(IN LANGID LanguageId) { OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"Control Panel\\Desktop"); + UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"MultiUILanguageId"); WCHAR ValueBuffer[8]; ULONG ValueLength; HANDLE UserHandle; @@ -469,11 +456,6 @@ NtSetDefaultUILanguage(IN LANGID LanguageId) return Status; } - RtlRosInitUnicodeStringFromLiteral(&KeyName, - L"Control Panel\\Desktop"); - RtlRosInitUnicodeStringFromLiteral(&ValueName, - L"MultiUILanguageId"); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, diff --git a/reactos/ntoskrnl/ps/query.c b/reactos/ntoskrnl/ps/query.c index 58f52ba60e8..cae8caef2e6 100644 --- a/reactos/ntoskrnl/ps/query.c +++ b/reactos/ntoskrnl/ps/query.c @@ -190,9 +190,9 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle, ProcessBasicInformationP->PebBaseAddress = Process->Peb; ProcessBasicInformationP->AffinityMask = Process->Pcb.Affinity; ProcessBasicInformationP->UniqueProcessId = - Process->UniqueProcessId; + (ULONG)Process->UniqueProcessId; ProcessBasicInformationP->InheritedFromUniqueProcessId = - Process->InheritedFromUniqueProcessId; + (ULONG)Process->InheritedFromUniqueProcessId; ProcessBasicInformationP->BasePriority = Process->Pcb.BasePriority; diff --git a/reactos/ntoskrnl/ps/thread.c b/reactos/ntoskrnl/ps/thread.c index 6bfb29e7376..763ea5fbef8 100644 --- a/reactos/ntoskrnl/ps/thread.c +++ b/reactos/ntoskrnl/ps/thread.c @@ -196,7 +196,7 @@ PspCreateThread(OUT PHANDLE ThreadHandle, /* Initialize LPC */ DPRINT("Initialliazing Thread Semaphore\n"); - KeInitializeSemaphore(&Thread->LpcReplySemaphore, 0, LONG_MAX); + KeInitializeSemaphore(&Thread->LpcReplySemaphore, 0, MAXLONG); /* Allocate Stack for non-GUI Thread */ DPRINT("Initialliazing Thread Stack\n"); diff --git a/reactos/ntoskrnl/rtl/libsupp.c b/reactos/ntoskrnl/rtl/libsupp.c index 944a1a54fd2..acb7fa7f952 100644 --- a/reactos/ntoskrnl/rtl/libsupp.c +++ b/reactos/ntoskrnl/rtl/libsupp.c @@ -11,13 +11,9 @@ /* INCLUDES ******************************************************************/ #include -#include #define NDEBUG #include -//FIXME: sort this out somehow. IAI: Sorted in new header branch -#define PRTL_CRITICAL_SECTION PVOID - /* FUNCTIONS *****************************************************************/ diff --git a/reactos/ntoskrnl/rtl/rangelist.c b/reactos/ntoskrnl/rtl/rangelist.c index 788886c76f6..95965486531 100644 --- a/reactos/ntoskrnl/rtl/rangelist.c +++ b/reactos/ntoskrnl/rtl/rangelist.c @@ -14,16 +14,12 @@ #define NDEBUG #include - -#define ROUND_DOWN(N, S) ((N) - ((N) % (S))) - typedef struct _RTL_RANGE_ENTRY { LIST_ENTRY Entry; RTL_RANGE Range; } RTL_RANGE_ENTRY, *PRTL_RANGE_ENTRY; - /* FUNCTIONS ***************************************************************/ /********************************************************************** diff --git a/reactos/ntoskrnl/rtl/sprintf.c b/reactos/ntoskrnl/rtl/sprintf.c index 504ef8fc271..d2c8c376736 100644 --- a/reactos/ntoskrnl/rtl/sprintf.c +++ b/reactos/ntoskrnl/rtl/sprintf.c @@ -558,7 +558,7 @@ int sprintf(char * buf, const char *fmt, ...) int i; va_start(args, fmt); - i=_vsnprintf(buf,INT_MAX,fmt,args); + i=_vsnprintf(buf,MAXLONG,fmt,args); va_end(args); return i; } @@ -584,7 +584,7 @@ int _snprintf(char * buf, size_t cnt, const char *fmt, ...) */ int vsprintf(char *buf, const char *fmt, va_list args) { - return _vsnprintf(buf,INT_MAX,fmt,args); + return _vsnprintf(buf,MAXLONG,fmt,args); } /* EOF */ diff --git a/reactos/ntoskrnl/rtl/stdlib.c b/reactos/ntoskrnl/rtl/stdlib.c index a27402a210c..92b0da7df12 100644 --- a/reactos/ntoskrnl/rtl/stdlib.c +++ b/reactos/ntoskrnl/rtl/stdlib.c @@ -73,7 +73,7 @@ long atol(const char *str) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutoff = neg ? -(unsigned long)MINLONG : MAXLONG; cutlim = cutoff % (unsigned long)10; cutoff /= (unsigned long)10; for (acc = 0, any = 0;; c = *s++) @@ -95,7 +95,7 @@ long atol(const char *str) } if (any < 0) { - acc = neg ? LONG_MIN : LONG_MAX; + acc = neg ? MINLONG : MAXLONG; } else if (neg) acc = -acc; diff --git a/reactos/ntoskrnl/rtl/swprintf.c b/reactos/ntoskrnl/rtl/swprintf.c index 9c9cc7d6d65..7d231446992 100644 --- a/reactos/ntoskrnl/rtl/swprintf.c +++ b/reactos/ntoskrnl/rtl/swprintf.c @@ -546,7 +546,7 @@ int swprintf(wchar_t *buf, const wchar_t *fmt, ...) int i; va_start(args, fmt); - i=_vsnwprintf(buf,INT_MAX,fmt,args); + i=_vsnwprintf(buf,MAXLONG,fmt,args); va_end(args); return i; } @@ -569,7 +569,7 @@ int _snwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, ...) int vswprintf(wchar_t *buf, const wchar_t *fmt, va_list args) { - return _vsnwprintf(buf,INT_MAX,fmt,args); + return _vsnwprintf(buf,MAXLONG,fmt,args); } /* EOF */