From 56c73282c2eff547f392f2b06da1861aa2ecbc23 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sun, 5 Aug 2007 11:27:39 +0000 Subject: [PATCH] - More MSVC fixes svn path=/trunk/; revision=28174 --- reactos/include/ndk/halfuncs.h | 4 ++-- reactos/ntoskrnl/ex/init.c | 2 +- reactos/ntoskrnl/include/internal/mm.h | 6 +++--- reactos/ntoskrnl/include/ntoskrnl.h | 12 ++++++------ reactos/ntoskrnl/io/iomgr/controller.c | 2 +- reactos/ntoskrnl/io/iomgr/device.c | 2 +- reactos/ntoskrnl/io/iomgr/driver.c | 4 +++- reactos/ntoskrnl/io/iomgr/error.c | 4 ++-- reactos/ntoskrnl/mm/freelist.c | 10 +++++----- reactos/ntoskrnl/mm/i386/page.c | 2 +- reactos/ntoskrnl/mm/iospace.c | 2 +- reactos/ntoskrnl/mm/mm.c | 2 +- reactos/ntoskrnl/mm/section.c | 2 +- 13 files changed, 28 insertions(+), 26 deletions(-) diff --git a/reactos/include/ndk/halfuncs.h b/reactos/include/ndk/halfuncs.h index a4fece2f555..1c7ffa1e442 100644 --- a/reactos/include/ndk/halfuncs.h +++ b/reactos/include/ndk/halfuncs.h @@ -55,8 +55,8 @@ Author: // The DDK steals these away from you. // #ifdef _MSC_VER -//void _enable(void); -//void _disable(void); +void _enable(void); +void _disable(void); #pragma intrinsic(_enable) #pragma intrinsic(_disable) #endif diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index 2a5584db8d8..99585770d1a 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -1094,7 +1094,7 @@ ExpInitializeExecutive(IN ULONG Cpu, } /* Update length */ - CmCSDVersionString.MaximumLength = (USHORT)sizeof(Buffer) - Remaining; + CmCSDVersionString.MaximumLength = sizeof(Buffer) - (USHORT)Remaining; } /* Check if we have an RC number */ diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index cac7c7468f8..3d770131ac5 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -165,7 +165,7 @@ typedef struct typedef struct _MM_SECTION_SEGMENT { - LONGLONG FileOffset; /* start offset into the file for image sections */ + LONG FileOffset; /* start offset into the file for image sections */ ULONG_PTR VirtualAddress; /* dtart offset into the address range for image sections */ ULONG RawLength; /* length of the segment which is part of the mapped file */ ULONG Length; /* absolute length of the segment */ @@ -184,8 +184,8 @@ typedef struct _MM_IMAGE_SECTION_OBJECT ULONG_PTR StackReserve; ULONG_PTR StackCommit; ULONG_PTR EntryPoint; - ULONG Subsystem; - ULONG ImageCharacteristics; + USHORT Subsystem; + USHORT ImageCharacteristics; USHORT MinorSubsystemVersion; USHORT MajorSubsystemVersion; USHORT Machine; diff --git a/reactos/ntoskrnl/include/ntoskrnl.h b/reactos/ntoskrnl/include/ntoskrnl.h index a8f3a0cbcd1..12e9eb8a898 100644 --- a/reactos/ntoskrnl/include/ntoskrnl.h +++ b/reactos/ntoskrnl/include/ntoskrnl.h @@ -12,15 +12,14 @@ #include #define _WIN32_WINNT _WIN32_WINNT_WS03 #define NTDDI_VERSION NTDDI_WS03SP1 -#define NTKERNELAPI -#define NOEXTAPI /* DDK/IFS/NDK Headers */ -#define NTKERNELAPI -#define NOEXTAPI +#ifdef _MSC_VER +#include +#undef DECLSPEC_IMPORT +#define DECLSPEC_IMPORT +#endif #include -#undef _KPROCESS -#undef _EPROCESS #include #include #include @@ -55,6 +54,7 @@ #include /* KD Support */ +#define NOEXTAPI #include #include #include diff --git a/reactos/ntoskrnl/io/iomgr/controller.c b/reactos/ntoskrnl/io/iomgr/controller.c index a27f25ad979..8616926b4d2 100644 --- a/reactos/ntoskrnl/io/iomgr/controller.c +++ b/reactos/ntoskrnl/io/iomgr/controller.c @@ -92,7 +92,7 @@ IoCreateController(IN ULONG Size) /* Zero the Object and set its data */ RtlZeroMemory(Controller, sizeof(CONTROLLER_OBJECT) + Size); Controller->Type = IO_TYPE_CONTROLLER; - Controller->Size = (CSHORT)sizeof(CONTROLLER_OBJECT) + Size; + Controller->Size = sizeof(CONTROLLER_OBJECT) + (CSHORT)Size; Controller->ControllerExtension = (Controller + 1); /* Initialize its Queue */ diff --git a/reactos/ntoskrnl/io/iomgr/device.c b/reactos/ntoskrnl/io/iomgr/device.c index 2a5012523ba..9bcaf13a0c9 100644 --- a/reactos/ntoskrnl/io/iomgr/device.c +++ b/reactos/ntoskrnl/io/iomgr/device.c @@ -765,7 +765,7 @@ IoCreateDevice(IN PDRIVER_OBJECT DriverObject, * because that's only padding for the DevObjExt and not part of the Object. */ CreatedDeviceObject->Type = IO_TYPE_DEVICE; - CreatedDeviceObject->Size = (USHORT)sizeof(DEVICE_OBJECT) + DeviceExtensionSize; + CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + (USHORT)DeviceExtensionSize; /* The kernel extension is after the driver internal extension */ DeviceObjectExtension = (PDEVOBJ_EXTENSION) diff --git a/reactos/ntoskrnl/io/iomgr/driver.c b/reactos/ntoskrnl/io/iomgr/driver.c index bc0d07e5694..8ecb5e9c5da 100644 --- a/reactos/ntoskrnl/io/iomgr/driver.c +++ b/reactos/ntoskrnl/io/iomgr/driver.c @@ -1126,7 +1126,9 @@ try_again: if (!DriverName) { /* Create a random name and set up the string*/ - NameLength = swprintf(NameBuffer, L"\\Driver\\%08u", KeTickCount); + NameLength = (USHORT)swprintf(NameBuffer, + L"\\Driver\\%08u", + KeTickCount); LocalDriverName.Length = NameLength * sizeof(WCHAR); LocalDriverName.MaximumLength = LocalDriverName.Length + sizeof(UNICODE_NULL); LocalDriverName.Buffer = NameBuffer; diff --git a/reactos/ntoskrnl/io/iomgr/error.c b/reactos/ntoskrnl/io/iomgr/error.c index a72db5fa8eb..b6899d3a95c 100644 --- a/reactos/ntoskrnl/io/iomgr/error.c +++ b/reactos/ntoskrnl/io/iomgr/error.c @@ -338,8 +338,8 @@ IopLogWorker(IN PVOID Parameter) if (NT_SUCCESS(Status)) { /* Success, update the information */ - ObjectNameInfo->Name.Length = (USHORT)100 - - DriverNameLength; + ObjectNameInfo->Name.Length = + 100 - (USHORT)DriverNameLength; } } } diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index cf1cd761277..4f65af0b3ac 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -183,8 +183,8 @@ MmGetContinuousPages(ULONG NumberOfBytes, KeAcquireSpinLock(&PageListLock, &oldIrql); - last = min(HighestAcceptableAddress.QuadPart / PAGE_SIZE, MmPageArraySize - 1); - boundary = BoundaryAddressMultiple.QuadPart / PAGE_SIZE; + last = min(HighestAcceptableAddress.LowPart / PAGE_SIZE, MmPageArraySize - 1); + boundary = BoundaryAddressMultiple.LowPart / PAGE_SIZE; for (j = 0; j < 2; j++) { @@ -195,7 +195,7 @@ MmGetContinuousPages(ULONG NumberOfBytes, * pages above the 16MB area because the caller has specify an upper limit. * The second try uses the specified lower limit. */ - for (i = j == 0 ? 0x100000 / PAGE_SIZE : LowestAcceptableAddress.QuadPart / PAGE_SIZE; i <= last; ) + for (i = j == 0 ? 0x100000 / PAGE_SIZE : LowestAcceptableAddress.LowPart / PAGE_SIZE; i <= last; ) { if (MmPageArray[i].Flags.Type == MM_PHYSICAL_PAGE_FREE) { @@ -1017,8 +1017,8 @@ MmAllocPagesSpecifyRange(ULONG Consumer, if (NumberOfPages == 0) return 0; - LowestPage = LowestAddress.QuadPart / PAGE_SIZE; - HighestPage = HighestAddress.QuadPart / PAGE_SIZE; + LowestPage = LowestAddress.LowPart / PAGE_SIZE; + HighestPage = HighestAddress.LowPart / PAGE_SIZE; if ((HighestAddress.u.LowPart % PAGE_SIZE) != 0) HighestPage++; diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index cdf1119e369..ba37f8115ac 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -625,7 +625,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess()) { - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); + PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.LowPart)); if (PageDir == NULL) { KEBUGCHECK(0); diff --git a/reactos/ntoskrnl/mm/iospace.c b/reactos/ntoskrnl/mm/iospace.c index fbccd727279..511e9ec4a21 100644 --- a/reactos/ntoskrnl/mm/iospace.c +++ b/reactos/ntoskrnl/mm/iospace.c @@ -95,7 +95,7 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress, DPRINT("MmMapIoSpace failed (%lx)\n", Status); return (NULL); } - Pfn = PhysicalAddress.QuadPart >> PAGE_SHIFT; + Pfn = PhysicalAddress.LowPart >> PAGE_SHIFT; for (i = 0; i < PAGE_ROUND_UP(NumberOfBytes); i += PAGE_SIZE, Pfn++) { Status = MmCreateVirtualMappingForKernel((char*)Result + i, diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index 0711646f4fd..7c846da94b8 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -273,7 +273,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode, break; case MEMORY_AREA_SHARED_DATA: - Pfn = MmSharedDataPagePhysicalAddress.QuadPart >> PAGE_SHIFT; + Pfn = MmSharedDataPagePhysicalAddress.LowPart >> PAGE_SHIFT; Status = MmCreateVirtualMapping(PsGetCurrentProcess(), (PVOID)PAGE_ROUND_DOWN(Address), diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index db31e6a7407..31b57e1c40f 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -611,7 +611,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, * Retrieve the page from the cache segment that we actually want. */ (*Page) = MmGetPhysicalAddress((char*)BaseAddress + - FileOffset - BaseOffset).QuadPart >> PAGE_SHIFT; + FileOffset - BaseOffset).LowPart >> PAGE_SHIFT; CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, TRUE); }