diff --git a/reactos/ntoskrnl/cc/copy.c b/reactos/ntoskrnl/cc/copy.c index 224564fb4d0..07b1cae84f4 100644 --- a/reactos/ntoskrnl/cc/copy.c +++ b/reactos/ntoskrnl/cc/copy.c @@ -136,7 +136,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length, while (current2 != NULL && !current2->Valid && current_size < MAX_RW_LENGTH) { PVOID address = current2->BaseAddress; - for (i = 0; i < (Bcb->CacheSegmentSize / PAGE_SIZE); i++, address += PAGE_SIZE) + for (i = 0; i < (Bcb->CacheSegmentSize / PAGE_SIZE); i++, address = RVA(address, PAGE_SIZE)) { *MdlPages++ = MmGetPfnForProcess(NULL, address); } diff --git a/reactos/ntoskrnl/cc/fs.c b/reactos/ntoskrnl/cc/fs.c index 170f0616374..bc5f3ba3ae3 100644 --- a/reactos/ntoskrnl/cc/fs.c +++ b/reactos/ntoskrnl/cc/fs.c @@ -39,9 +39,8 @@ CcGetDirtyPages ( IN PVOID Context2 ) { - UNIMPLEMENTED; - LARGE_INTEGER i; + UNIMPLEMENTED; i.QuadPart = 0; return i; } @@ -69,9 +68,8 @@ CcGetLsnForFileObject ( OUT PLARGE_INTEGER OldestLsn OPTIONAL ) { - UNIMPLEMENTED; - LARGE_INTEGER i; + UNIMPLEMENTED; i.QuadPart = 0; return i; } diff --git a/reactos/ntoskrnl/ex/evtpair.c b/reactos/ntoskrnl/ex/evtpair.c index b3fd84f3300..a7467fd95bc 100644 --- a/reactos/ntoskrnl/ex/evtpair.c +++ b/reactos/ntoskrnl/ex/evtpair.c @@ -18,7 +18,7 @@ /* GLOBALS *******************************************************************/ -POBJECT_TYPE EXPORTED ExEventPairObjectType = NULL; +POBJECT_TYPE ExEventPairObjectType = NULL; static GENERIC_MAPPING ExEventPairMapping = { STANDARD_RIGHTS_READ, diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index 765d0f85fed..2faf8a62332 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -496,7 +496,7 @@ ExpInitializeExecutive(VOID) KeCreateApplicationProcessorIdleThread(KeNumberProcessors); /* Allocate a stack for use when booting the processor */ - ProcessorStack = Ki386InitialStackArray[((int)KeNumberProcessors)] + MM_STACK_SIZE; + ProcessorStack = RVA(Ki386InitialStackArray[((int)KeNumberProcessors)], MM_STACK_SIZE); /* Tell HAL a new CPU is being started */ HalStartNextProcessor(0, (ULONG)ProcessorStack - 2*sizeof(FX_SAVE_AREA)); diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 1288081e29c..7a59fee0b78 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -835,6 +835,10 @@ ObpGetNextHandleByProcessCount(PSYSTEM_HANDLE_TABLE_ENTRY_INFO pshi, /* Class 16 - Handle Information */ QSI_DEF(SystemHandleInformation) { + PEPROCESS pr, syspr; + int curSize, i = 0; + ULONG hCount = 0; + PSYSTEM_HANDLE_INFORMATION Shi = (PSYSTEM_HANDLE_INFORMATION) Buffer; @@ -848,10 +852,6 @@ QSI_DEF(SystemHandleInformation) DPRINT("SystemHandleInformation 1\n"); - PEPROCESS pr, syspr; - int curSize, i = 0; - ULONG hCount = 0; - /* First Calc Size from Count. */ syspr = PsGetNextProcess(NULL); pr = syspr; @@ -937,6 +937,7 @@ QSI_DEF(SystemObjectInformation) /* Class 18 - Information */ QSI_DEF(SystemPageFileInformation) { + UNICODE_STRING FileName; /* FIXME */ SYSTEM_PAGEFILE_INFORMATION *Spfi = (SYSTEM_PAGEFILE_INFORMATION *) Buffer; if (Size < sizeof (SYSTEM_PAGEFILE_INFORMATION)) @@ -945,7 +946,6 @@ QSI_DEF(SystemPageFileInformation) return (STATUS_INFO_LENGTH_MISMATCH); } - UNICODE_STRING FileName; /* FIXME */ RtlInitUnicodeString(&FileName, NULL); /* FIXME */ /* FIXME */ diff --git a/reactos/ntoskrnl/fs/name.c b/reactos/ntoskrnl/fs/name.c index 821c1d3fab1..31f54d13675 100644 --- a/reactos/ntoskrnl/fs/name.c +++ b/reactos/ntoskrnl/fs/name.c @@ -149,7 +149,7 @@ static UCHAR LegalAnsiCharacterArray[] = FSRTL_FAT_LEGAL | FSRTL_HPFS_LEGAL | FSRTL_NTFS_LEGAL /* 0x7f */ }; -PUCHAR EXPORTED FsRtlLegalAnsiCharacterArray = LegalAnsiCharacterArray; +PUCHAR FsRtlLegalAnsiCharacterArray = LegalAnsiCharacterArray; /* FUNCTIONS *****************************************************************/ diff --git a/reactos/ntoskrnl/include/internal/arch/ke.h b/reactos/ntoskrnl/include/internal/arch/ke.h index 2973640b691..8cdcf9cde0f 100644 --- a/reactos/ntoskrnl/include/internal/arch/ke.h +++ b/reactos/ntoskrnl/include/internal/arch/ke.h @@ -19,7 +19,7 @@ #ifndef __NTOSKRNL_INCLUDE_INTERNAL_ARCH_KE_H #define __NTOSKRNL_INCLUDE_INTERNAL_ARCH_KE_H -#ifdef i386 +#ifdef _M_IX86 #include "../i386/ke.h" #else #error "Unknown processor" diff --git a/reactos/ntoskrnl/include/internal/arch/mm.h b/reactos/ntoskrnl/include/internal/arch/mm.h index 1622a69621d..aded673559b 100644 --- a/reactos/ntoskrnl/include/internal/arch/mm.h +++ b/reactos/ntoskrnl/include/internal/arch/mm.h @@ -19,7 +19,7 @@ #ifndef __NTOSKRNL_INCLUDE_INTERNAL_ARCH_MM_H #define __NTOSKRNL_INCLUDE_INTERNAL_ARCH_MM_H -#ifdef i386 +#ifdef _M_IX86 #include #else #error "Unknown processor" diff --git a/reactos/ntoskrnl/include/internal/arch/ps.h b/reactos/ntoskrnl/include/internal/arch/ps.h index 028bb8c2679..f4b8bf63eac 100644 --- a/reactos/ntoskrnl/include/internal/arch/ps.h +++ b/reactos/ntoskrnl/include/internal/arch/ps.h @@ -19,7 +19,7 @@ #ifndef __NTOSKRNL_INCLUDE_INTERNAL_ARCH_PS_H #define __NTOSKRNL_INCLUDE_INTERNAL_ARCH_PS_H -#ifdef i386 +#ifdef _M_IX86 #include #define KiArchContextSwitch KiSwapContext #define KiArchInitThreadWithContext Ke386InitThreadWithContext diff --git a/reactos/ntoskrnl/include/internal/i386/ke.h b/reactos/ntoskrnl/include/internal/i386/ke.h index 1d79b32dd42..1d71f299f77 100644 --- a/reactos/ntoskrnl/include/internal/i386/ke.h +++ b/reactos/ntoskrnl/include/internal/i386/ke.h @@ -189,8 +189,7 @@ KeCreateApplicationProcessorIdleThread(ULONG Id); typedef VOID -STDCALL -(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, +(STDCALL*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, PVOID StartContext); VOID @@ -215,7 +214,7 @@ KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine, #define LOCK "lock ; " #else #define LOCK "" -#define KeGetCurrentIrql(X) (((PKPCR)KPCR_BASE)->Irql) +#define KeGetCurrentIrql() (((PKPCR)KPCR_BASE)->Irql) #endif #if defined(__GNUC__) diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index 04847370ce1..df4664257d6 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -224,13 +224,13 @@ struct _KEXCEPTION_FRAME; /* MACROS *************************************************************************/ -#define KeEnterCriticalRegion(X) \ +#define KeEnterCriticalRegion() \ { \ PKTHREAD _Thread = KeGetCurrentThread(); \ if (_Thread) _Thread->KernelApcDisable--; \ } -#define KeLeaveCriticalRegion(X) \ +#define KeLeaveCriticalRegion() \ { \ PKTHREAD _Thread = KeGetCurrentThread(); \ if((_Thread) && (++_Thread->KernelApcDisable == 0)) \ @@ -354,8 +354,8 @@ extern PLOADER_MODULE CachedModules[MaximumCachedModuleType]; VOID STDCALL DbgBreakPointNoBugCheck(VOID); -STDCALL VOID +STDCALL KeInitializeProfile(struct _KPROFILE* Profile, struct _KPROCESS* Process, PVOID ImageBase, @@ -364,21 +364,21 @@ KeInitializeProfile(struct _KPROFILE* Profile, KPROFILE_SOURCE ProfileSource, KAFFINITY Affinity); -STDCALL VOID +STDCALL KeStartProfile(struct _KPROFILE* Profile, PVOID Buffer); -STDCALL VOID +STDCALL KeStopProfile(struct _KPROFILE* Profile); -STDCALL ULONG +STDCALL KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource); -STDCALL VOID +STDCALL KeSetIntervalProfile(KPROFILE_SOURCE ProfileSource, ULONG Interval); diff --git a/reactos/ntoskrnl/include/internal/ps.h b/reactos/ntoskrnl/include/internal/ps.h index 9a74afb3add..e0392dc5815 100644 --- a/reactos/ntoskrnl/include/internal/ps.h +++ b/reactos/ntoskrnl/include/internal/ps.h @@ -160,7 +160,7 @@ typedef struct _ETHREAD ULONG OwnsSessionWorkingSetShared:1; ULONG ApcNeeded:1; }; - ULONG SameThreadPassiveFlags; /* 248 */ + ULONG SameThreadApcFlags; /* 248 */ }; UCHAR ForwardClusterOnly; /* 24C */ UCHAR DisablePageFaultClustering; /* 24D */ diff --git a/reactos/ntoskrnl/io/driver.c b/reactos/ntoskrnl/io/driver.c index ae6e22e2b8e..73d010638cf 100644 --- a/reactos/ntoskrnl/io/driver.c +++ b/reactos/ntoskrnl/io/driver.c @@ -337,8 +337,8 @@ INIT_FUNCTION IopDisplayLoadingMessage(PVOID ServiceName, BOOLEAN Unicode) { - if (SetupMode) return; CHAR TextBuffer[256]; + if (SetupMode) return; if (Unicode) { sprintf(TextBuffer, "Loading %S...\n", (PWCHAR)ServiceName); diff --git a/reactos/ntoskrnl/io/iomgr.c b/reactos/ntoskrnl/io/iomgr.c index 995d79201d3..b5615aa5124 100644 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@ -15,16 +15,16 @@ /* DATA ********************************************************************/ -POBJECT_TYPE EXPORTED IoDeviceObjectType = NULL; -POBJECT_TYPE EXPORTED IoFileObjectType = NULL; +POBJECT_TYPE IoDeviceObjectType = NULL; +POBJECT_TYPE IoFileObjectType = NULL; extern POBJECT_TYPE IoControllerObjectType; -ULONG EXPORTED IoReadOperationCount = 0; -LARGE_INTEGER EXPORTED IoReadTransferCount = {{0, 0}}; -ULONG EXPORTED IoWriteOperationCount = 0; -LARGE_INTEGER EXPORTED IoWriteTransferCount = {{0, 0}}; -ULONG IoOtherOperationCount = 0; -LARGE_INTEGER IoOtherTransferCount = {{0, 0}}; -KSPIN_LOCK EXPORTED IoStatisticsLock = 0; +ULONG IoReadOperationCount = 0; +LARGE_INTEGER IoReadTransferCount = {{0, 0}}; +ULONG IoWriteOperationCount = 0; +LARGE_INTEGER IoWriteTransferCount = {{0, 0}}; +ULONG IoOtherOperationCount = 0; +LARGE_INTEGER IoOtherTransferCount = {{0, 0}}; +KSPIN_LOCK IoStatisticsLock = 0; GENERIC_MAPPING IopFileMapping = { FILE_GENERIC_READ, diff --git a/reactos/ntoskrnl/io/irp.c b/reactos/ntoskrnl/io/irp.c index 2758e353c45..7b675723dfc 100644 --- a/reactos/ntoskrnl/io/irp.c +++ b/reactos/ntoskrnl/io/irp.c @@ -619,13 +619,6 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction, } /* Probe and Lock */ - _SEH_FILTER(FreeAndGoOn) - { - /* Free the IRP and its MDL */ - IoFreeMdl(Irp->MdlAddress); - IoFreeIrp(Irp); - return EXCEPTION_CONTINUE_SEARCH; - } _SEH_TRY { /* Do the probe */ diff --git a/reactos/ntoskrnl/io/wmi.c b/reactos/ntoskrnl/io/wmi.c index 61ff4b3c66c..d1894c4e85b 100644 --- a/reactos/ntoskrnl/io/wmi.c +++ b/reactos/ntoskrnl/io/wmi.c @@ -19,8 +19,8 @@ /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIRegistrationControl( IN PDEVICE_OBJECT DeviceObject, IN ULONG Action @@ -33,8 +33,8 @@ IoWMIRegistrationControl( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIAllocateInstanceIds( IN GUID *Guid, IN ULONG InstanceCount, @@ -48,8 +48,8 @@ IoWMIAllocateInstanceIds( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMISuggestInstanceName( IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN PUNICODE_STRING SymbolicLinkName OPTIONAL, @@ -64,8 +64,8 @@ IoWMISuggestInstanceName( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIWriteEvent( IN PVOID WnodeEventItem ) @@ -77,8 +77,8 @@ IoWMIWriteEvent( /* * @unimplemented */ -STDCALL -NTSTATUS IoWMIOpenBlock( +NTSTATUS +STDCALL IoWMIOpenBlock( IN GUID *DataBlockGuid, IN ULONG DesiredAccess, OUT PVOID *DataBlockObject @@ -91,8 +91,8 @@ NTSTATUS IoWMIOpenBlock( /* * @unimplemented */ -STDCALL -NTSTATUS IoWMIQueryAllData( +NTSTATUS +STDCALL IoWMIQueryAllData( IN PVOID DataBlockObject, IN OUT ULONG *InOutBufferSize, OUT PVOID OutBuffer @@ -105,8 +105,8 @@ NTSTATUS IoWMIQueryAllData( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIQueryAllDataMultiple( IN PVOID *DataBlockObjectList, IN ULONG ObjectCount, @@ -121,8 +121,8 @@ IoWMIQueryAllDataMultiple( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIQuerySingleInstance( IN PVOID DataBlockObject, IN PUNICODE_STRING InstanceName, @@ -137,8 +137,8 @@ IoWMIQuerySingleInstance( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIQuerySingleInstanceMultiple( IN PVOID *DataBlockObjectList, IN PUNICODE_STRING InstanceNames, @@ -154,8 +154,8 @@ IoWMIQuerySingleInstanceMultiple( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMISetSingleInstance( IN PVOID DataBlockObject, IN PUNICODE_STRING InstanceName, @@ -171,8 +171,8 @@ IoWMISetSingleInstance( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMISetSingleItem( IN PVOID DataBlockObject, IN PUNICODE_STRING InstanceName, @@ -189,8 +189,8 @@ IoWMISetSingleItem( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIExecuteMethod( IN PVOID DataBlockObject, IN PUNICODE_STRING InstanceName, @@ -207,8 +207,8 @@ IoWMIExecuteMethod( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMISetNotificationCallback( IN PVOID Object, IN WMI_NOTIFICATION_CALLBACK Callback, @@ -222,8 +222,8 @@ IoWMISetNotificationCallback( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIHandleToInstanceName( IN PVOID DataBlockObject, IN HANDLE FileHandle, @@ -237,8 +237,8 @@ IoWMIHandleToInstanceName( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL IoWMIDeviceObjectToInstanceName( IN PVOID DataBlockObject, IN PDEVICE_OBJECT DeviceObject, diff --git a/reactos/ntoskrnl/ke/ipi.c b/reactos/ntoskrnl/ke/ipi.c index 4aae8a6eab5..1402e204d56 100644 --- a/reactos/ntoskrnl/ke/ipi.c +++ b/reactos/ntoskrnl/ke/ipi.c @@ -89,7 +89,7 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame, #endif } } - ((VOID STDCALL(*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]); + ((VOID (STDCALL*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]); Ke386TestAndClearBit(KeGetCurrentProcessorNumber(), &Prcb->SignalDone->TargetSet); if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0)) { @@ -116,7 +116,7 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame, VOID STDCALL -KiIpiSendPacket(ULONG TargetSet, VOID STDCALL (*WorkerRoutine)(PVOID), PVOID Argument, ULONG Count, BOOLEAN Synchronize) +KiIpiSendPacket(ULONG TargetSet, VOID (STDCALL*WorkerRoutine)(PVOID), PVOID Argument, ULONG Count, BOOLEAN Synchronize) { ULONG i, Processor, CurrentProcessor; PKPRCB Prcb, CurrentPrcb; diff --git a/reactos/ntoskrnl/ke/kqueue.c b/reactos/ntoskrnl/ke/kqueue.c index 1ef6d266a4e..168f465828c 100644 --- a/reactos/ntoskrnl/ke/kqueue.c +++ b/reactos/ntoskrnl/ke/kqueue.c @@ -245,8 +245,8 @@ KeRemoveByKeyDeviceQueue (IN PKDEVICE_QUEUE DeviceQueue, /* * @unimplemented */ -STDCALL PKDEVICE_QUEUE_ENTRY +STDCALL KeRemoveByKeyDeviceQueueIfBusy(IN PKDEVICE_QUEUE DeviceQueue, IN ULONG SortKey) { diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index cb2dba1aba5..75f1a6c30ab 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -82,7 +82,9 @@ KeGetRecommendedSharedDataAlignment(VOID) } VOID +#ifdef __GNUC__ __attribute((noinline)) +#endif KiSystemStartup(BOOLEAN BootProcessor) { DPRINT("KiSystemStartup(%d)\n", BootProcessor); diff --git a/reactos/ntoskrnl/ke/profile.c b/reactos/ntoskrnl/ke/profile.c index 25ba7fc4536..ca79123fe2c 100644 --- a/reactos/ntoskrnl/ke/profile.c +++ b/reactos/ntoskrnl/ke/profile.c @@ -22,8 +22,8 @@ ULONG KiProfileTimeInterval = 78125; /* Default resolution 7.8ms (sysinternals) /* FUNCTIONS *****************************************************************/ -STDCALL VOID +STDCALL KeInitializeProfile(PKPROFILE Profile, PKPROCESS Process, PVOID ImageBase, @@ -40,14 +40,14 @@ KeInitializeProfile(PKPROFILE Profile, Profile->Process = Process; Profile->RegionStart = ImageBase; Profile->BucketShift = BucketSize - 2; /* See ntinternals.net -- Alex */ - Profile->RegionEnd = (PVOID)(ULONG_PTR)ImageBase + ImageSize; + Profile->RegionEnd = (PVOID)((ULONG_PTR)ImageBase + ImageSize); Profile->Active = FALSE; Profile->Source = ProfileSource; Profile->Affinity = Affinity; } -STDCALL VOID +STDCALL KeStartProfile(PKPROFILE Profile, PVOID Buffer) { @@ -133,8 +133,8 @@ KeStartProfile(PKPROFILE Profile, if (!FreeBuffer) ExFreePool(SourceBuffer); } -STDCALL VOID +STDCALL KeStopProfile(PKPROFILE Profile) { KIRQL OldIrql; @@ -178,8 +178,8 @@ KeStopProfile(PKPROFILE Profile) if (CurrentSource) ExFreePool(CurrentSource); } -STDCALL ULONG +STDCALL KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource) { /* Check if this is the timer profile */ @@ -200,8 +200,8 @@ KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource) } } -STDCALL VOID +STDCALL KeSetIntervalProfile(KPROFILE_SOURCE ProfileSource, ULONG Interval) { @@ -224,8 +224,8 @@ KeSetIntervalProfile(KPROFILE_SOURCE ProfileSource, /* * @implemented */ -STDCALL VOID +STDCALL KeProfileInterrupt(PKTRAP_FRAME TrapFrame) { /* Called from HAL for Timer Profiling */ @@ -257,7 +257,7 @@ KiParseProfileList(IN PKTRAP_FRAME TrapFrame, } /* Get the Pointer to the Bucket Value representing this EIP */ - BucketValue = (PULONG)(((ULONG_PTR)(Profile->Buffer + + BucketValue = (PULONG)((((ULONG_PTR)Profile->Buffer + (TrapFrame->Eip - (ULONG_PTR)Profile->RegionStart)) >> Profile->BucketShift) &~ 0x3); @@ -276,8 +276,8 @@ KiParseProfileList(IN PKTRAP_FRAME TrapFrame, * from the trap frame into the buffer, while using buckets and * shifting like we specified. -- Alex */ -STDCALL VOID +STDCALL KeProfileInterruptWithSource(IN PKTRAP_FRAME TrapFrame, IN KPROFILE_SOURCE Source) { @@ -291,8 +291,8 @@ KeProfileInterruptWithSource(IN PKTRAP_FRAME TrapFrame, /* * @implemented */ -STDCALL VOID +STDCALL KeSetProfileIrql(IN KIRQL ProfileIrql) { /* Set the IRQL at which Profiling will run */ diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 416a18c78b0..6a5d6b16f13 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -910,7 +910,7 @@ LdrPEProcessModule( Protect = PAGE_EXECUTE_READWRITE; } #endif - if (PageAddress < DriverBase + DriverSize) + if (PageAddress < RVA(DriverBase, DriverSize)) { MmSetPageProtect(NULL, PageAddress, Protect); } @@ -937,14 +937,14 @@ LdrPEProcessModule( PageAddress = (PVOID)((ULONG_PTR)PageAddress + PAGE_SIZE); while ((ULONG_PTR)PageAddress + PAGE_SIZE < (ULONG_PTR)BaseAddress + Length) { - if (PageAddress < DriverBase + DriverSize) + if (PageAddress < RVA(DriverBase, DriverSize)) { MmSetPageProtect(NULL, PageAddress, Protect); } PageAddress = (PVOID)((ULONG_PTR)PageAddress + PAGE_SIZE); } if (PageAddress < (PVOID)((ULONG_PTR)BaseAddress + Length) && - PageAddress < DriverBase + DriverSize) + PageAddress < RVA(DriverBase, DriverSize)) { Protect = LdrLookupPageProtection(PageAddress, DriverBase, &PENtHeaders->FileHeader, PESectionHeaders); MmSetPageProtect(NULL, PageAddress, Protect); @@ -1214,20 +1214,20 @@ LdrPEPerformRelocations ( Delta = (ULONG_PTR)DriverBase - NtHeaders->OptionalHeader.ImageBase; RelocationDir = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)DriverBase + RelocationDDir->VirtualAddress); RelocationEnd = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDDir->Size); - MaxAddress = DriverBase + DriverSize; + MaxAddress = RVA(DriverBase, DriverSize); while (RelocationDir < RelocationEnd && RelocationDir->SizeOfBlock > 0) { Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(USHORT); - Address = DriverBase + RelocationDir->VirtualAddress; + Address = RVA(DriverBase, RelocationDir->VirtualAddress); TypeOffset = (PUSHORT)(RelocationDir + 1); for (i = 0; i < Count; i++) { Offset = *TypeOffset & 0xFFF; Type = *TypeOffset >> 12; - ShortPtr = (PUSHORT)(Address + Offset); + ShortPtr = (PUSHORT)(RVA(Address, Offset)); /* Don't relocate after the end of the loaded driver */ if ((PVOID)ShortPtr >= MaxAddress) @@ -1276,6 +1276,9 @@ LdrPEPerformRelocations ( return STATUS_SUCCESS; } +#ifndef PATH_MAX +#define PATH_MAX 260 +#endif static NTSTATUS LdrPEGetOrLoadModule ( @@ -1552,16 +1555,16 @@ LdrPEProcessImportDirectoryEntry( } /* Get the import address list. */ - ImportAddressList = (PVOID*)(DriverBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk); + ImportAddressList = (PVOID*)RVA(DriverBase, ImportModuleDirectory->FirstThunk); /* Get the list of functions to import. */ if (ImportModuleDirectory->OriginalFirstThunk != 0) { - FunctionNameList = (PULONG) (DriverBase + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk); + FunctionNameList = (PULONG)RVA(DriverBase, ImportModuleDirectory->OriginalFirstThunk); } else { - FunctionNameList = (PULONG)(DriverBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk); + FunctionNameList = (PULONG)RVA(DriverBase, ImportModuleDirectory->FirstThunk); } /* Walk through function list and fixup addresses. */ diff --git a/reactos/ntoskrnl/ldr/resource.c b/reactos/ntoskrnl/ldr/resource.c index feffb09365b..a4444f6ea67 100644 --- a/reactos/ntoskrnl/ldr/resource.c +++ b/reactos/ntoskrnl/ldr/resource.c @@ -195,8 +195,8 @@ found:; /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL LdrFindResourceDirectory_U( IN PVOID BaseAddress, IN PLDR_RESOURCE_INFO ResourceInfo, @@ -211,8 +211,8 @@ LdrFindResourceDirectory_U( /* * @unimplemented */ -STDCALL NTSTATUS +STDCALL LdrEnumResources( IN PVOID BaseAddress, IN PLDR_RESOURCE_INFO ResourceInfo, diff --git a/reactos/ntoskrnl/ldr/rtl.c b/reactos/ntoskrnl/ldr/rtl.c index af5e2c78053..cd6a5429235 100644 --- a/reactos/ntoskrnl/ldr/rtl.c +++ b/reactos/ntoskrnl/ldr/rtl.c @@ -17,8 +17,6 @@ /* FUNCTIONS ****************************************************************/ -#define RVA(m, b) ((ULONG)b + m) - NTSTATUS STDCALL LdrGetProcedureAddress (IN PVOID BaseAddress, IN PANSI_STRING Name, diff --git a/reactos/ntoskrnl/mm/iospace.c b/reactos/ntoskrnl/mm/iospace.c index 8e12f1c2fec..7e8e4a7b522 100644 --- a/reactos/ntoskrnl/mm/iospace.c +++ b/reactos/ntoskrnl/mm/iospace.c @@ -145,7 +145,7 @@ MmUnmapIoSpace (IN PVOID BaseAddress, PVOID Address = BaseAddress; Offset = (ULONG_PTR)Address % PAGE_SIZE; - Address -= Offset; + Address = RVA(Address, - Offset); NumberOfBytes += Offset; MmLockAddressSpace(MmGetKernelAddressSpace()); diff --git a/reactos/ntoskrnl/mm/process.c b/reactos/ntoskrnl/mm/process.c index b4b4bf856cc..1139e051c4a 100644 --- a/reactos/ntoskrnl/mm/process.c +++ b/reactos/ntoskrnl/mm/process.c @@ -28,8 +28,8 @@ MiCreatePebOrTeb(PEPROCESS Process, PMADDRESS_SPACE ProcessAddressSpace = &Process->AddressSpace; PMEMORY_AREA MemoryArea; PHYSICAL_ADDRESS BoundaryAddressMultiple; - BoundaryAddressMultiple.QuadPart = 0; PVOID AllocatedBase = BaseAddress; + BoundaryAddressMultiple.QuadPart = 0; /* Acquire the Lock */ MmLockAddressSpace(ProcessAddressSpace); @@ -54,7 +54,7 @@ MiCreatePebOrTeb(PEPROCESS Process, TRUE, FALSE, BoundaryAddressMultiple); - AllocatedBase = AllocatedBase - PAGE_SIZE; + AllocatedBase = RVA(AllocatedBase, -PAGE_SIZE); } while (Status != STATUS_SUCCESS); /* Initialize the Region */ @@ -69,7 +69,7 @@ MiCreatePebOrTeb(PEPROCESS Process, /* Unlock Address Space */ DPRINT("Returning\n"); MmUnlockAddressSpace(ProcessAddressSpace); - return AllocatedBase + PAGE_SIZE; + return RVA(AllocatedBase, PAGE_SIZE); } VOID @@ -345,9 +345,9 @@ MmCreateProcessAddressSpace(IN PEPROCESS Process, PVOID BaseAddress; PMEMORY_AREA MemoryArea; PHYSICAL_ADDRESS BoundaryAddressMultiple; - BoundaryAddressMultiple.QuadPart = 0; ULONG ViewSize = 0; PVOID ImageBase = 0; + BoundaryAddressMultiple.QuadPart = 0; /* Initialize the Addresss Space */ MmInitializeAddressSpace(Process, ProcessAddressSpace); diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 82842f82b05..fa26807f834 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -1952,7 +1952,7 @@ MmQuerySectionView(PMEMORY_AREA MemoryArea, if (Section->AllocationAttributes & SEC_IMAGE) { Segment = MemoryArea->Data.SectionData.Segment; - Info->AllocationBase = MemoryArea->StartingAddress - Segment->VirtualAddress; + Info->AllocationBase = (PBYTE)MemoryArea->StartingAddress - Segment->VirtualAddress; Info->Type = MEM_IMAGE; } else diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index 21e7bd741ce..f732cfade0f 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -60,8 +60,8 @@ static VOID ObpDecrementHandleCount(PVOID ObjectBody) { POBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody); - DPRINT("Header: %x\n", ObjectHeader); LONG NewHandleCount = InterlockedDecrement(&ObjectHeader->HandleCount); + DPRINT("Header: %x\n", ObjectHeader); DPRINT("NewHandleCount: %x\n", NewHandleCount); DPRINT("HEADER_TO_OBJECT_NAME: %x\n", HEADER_TO_OBJECT_NAME(ObjectHeader)); @@ -1008,15 +1008,15 @@ ObInsertObject(IN PVOID Object, if (FoundHeader && FoundHeader->Type == ObDirectoryType && RemainingPath.Buffer) { - ObpAddEntryDirectory(FoundObject, Header, NULL); - ObjectAttached = TRUE; - /* The name was changed so let's update it */ /* FIXME: TEMPORARY HACK This will go in ObFindObject in the next commit */ PVOID NewName; PWSTR BufferPos = RemainingPath.Buffer; ULONG Delta = 0; + ObpAddEntryDirectory(FoundObject, Header, NULL); + ObjectAttached = TRUE; + ObjectNameInfo = HEADER_TO_OBJECT_NAME(Header); if (BufferPos[0] == L'\\') diff --git a/reactos/ntoskrnl/ps/kill.c b/reactos/ntoskrnl/ps/kill.c index b4cc3943740..a54252e5620 100644 --- a/reactos/ntoskrnl/ps/kill.c +++ b/reactos/ntoskrnl/ps/kill.c @@ -24,8 +24,8 @@ extern FAST_MUTEX PspActiveProcessMutex; /* FUNCTIONS *****************************************************************/ -STDCALL VOID +STDCALL PspReapRoutine(PVOID Context) { KIRQL OldIrql; diff --git a/reactos/ntoskrnl/ps/psmgr.c b/reactos/ntoskrnl/ps/psmgr.c index a19d8eaa7a1..45d94361c72 100644 --- a/reactos/ntoskrnl/ps/psmgr.c +++ b/reactos/ntoskrnl/ps/psmgr.c @@ -173,8 +173,7 @@ PsInitProcessManagment(VOID) ProcessObject, sizeof(EPROCESS), FALSE); - PsIdleProcess->Pcb.DirectoryTableBase = - (LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory(); + PsIdleProcess->Pcb.DirectoryTableBase.QuadPart = (ULONG_PTR)MmGetPageDirectory(); strcpy(PsIdleProcess->ImageFileName, "Idle"); /* @@ -234,6 +233,7 @@ PsInitProcessManagment(VOID) InitializeListHead(&PsInitialSystemProcess->ThreadListHead); #ifndef SCHED_REWRITE + { PTOKEN BootToken; /* No parent, this is the Initial System Process. Assign Boot Token */ @@ -241,6 +241,7 @@ PsInitProcessManagment(VOID) BootToken->TokenInUse = TRUE; PsInitialSystemProcess->Token.Object = BootToken; /* FIXME */ ObReferenceObject(BootToken); + } #endif } diff --git a/reactos/ntoskrnl/se/acl.c b/reactos/ntoskrnl/se/acl.c index ad725253abf..95ff38e3bcb 100644 --- a/reactos/ntoskrnl/se/acl.c +++ b/reactos/ntoskrnl/se/acl.c @@ -15,8 +15,8 @@ /* GLOBALS ******************************************************************/ -PACL EXPORTED SePublicDefaultDacl = NULL; -PACL EXPORTED SeSystemDefaultDacl = NULL; +PACL SePublicDefaultDacl = NULL; +PACL SeSystemDefaultDacl = NULL; PACL SePublicDefaultUnrestrictedDacl = NULL; PACL SePublicOpenDacl = NULL; diff --git a/reactos/ntoskrnl/se/luid.c b/reactos/ntoskrnl/se/luid.c index a24717421c9..6631c85c9b7 100644 --- a/reactos/ntoskrnl/se/luid.c +++ b/reactos/ntoskrnl/se/luid.c @@ -39,7 +39,7 @@ ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId) /* atomically increment the luid */ do { - PrevLuid = (volatile LARGE_INTEGER)LuidValue; + PrevLuid = LuidValue; NewLuid = RtlLargeIntegerAdd(PrevLuid, LuidIncrement); } while(ExfInterlockedCompareExchange64(&LuidValue.QuadPart, diff --git a/reactos/ntoskrnl/se/semgr.c b/reactos/ntoskrnl/se/semgr.c index f58be6a8232..3278bbce910 100644 --- a/reactos/ntoskrnl/se/semgr.c +++ b/reactos/ntoskrnl/se/semgr.c @@ -16,7 +16,7 @@ /* GLOBALS ******************************************************************/ -PSE_EXPORTS EXPORTED SeExports = NULL; +PSE_EXPORTS SeExports = NULL; SE_EXPORTS SepExports; static ERESOURCE SepSubjectContextLock; diff --git a/reactos/ntoskrnl/se/token.c b/reactos/ntoskrnl/se/token.c index fcf48497e55..ad41dd456a9 100644 --- a/reactos/ntoskrnl/se/token.c +++ b/reactos/ntoskrnl/se/token.c @@ -1820,17 +1820,19 @@ SepCreateSystemProcessToken(VOID) NTSTATUS Status; ULONG uSize; ULONG i; + ULONG uLocalSystemLength; + ULONG uWorldLength; + ULONG uAuthUserLength; + ULONG uAdminsLength; + PTOKEN AccessToken; + PVOID SidArea; PAGED_CODE(); - ULONG uLocalSystemLength = RtlLengthSid(SeLocalSystemSid); - ULONG uWorldLength = RtlLengthSid(SeWorldSid); - ULONG uAuthUserLength = RtlLengthSid(SeAuthenticatedUserSid); - ULONG uAdminsLength = RtlLengthSid(SeAliasAdminsSid); - - PTOKEN AccessToken; - - PVOID SidArea; + uLocalSystemLength = RtlLengthSid(SeLocalSystemSid); + uWorldLength = RtlLengthSid(SeWorldSid); + uAuthUserLength = RtlLengthSid(SeAuthenticatedUserSid); + uAdminsLength = RtlLengthSid(SeAliasAdminsSid); /* * Initialize the token diff --git a/reactos/w32api/include/ddk/batclass.h b/reactos/w32api/include/ddk/batclass.h index 065886c66c4..769bfe92fbd 100644 --- a/reactos/w32api/include/ddk/batclass.h +++ b/reactos/w32api/include/ddk/batclass.h @@ -183,12 +183,12 @@ typedef struct _BATTERY_WAIT_STATUS { CTL_CODE(FILE_DEVICE_BATTERY, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS) -typedef NTSTATUS DDKAPI -(*BCLASS_DISABLE_STATUS_NOTIFY)( +typedef NTSTATUS +(DDKAPI*BCLASS_DISABLE_STATUS_NOTIFY)( IN PVOID Context); -typedef NTSTATUS DDKAPI -(*BCLASS_QUERY_INFORMATION)( +typedef NTSTATUS +(DDKAPI*BCLASS_QUERY_INFORMATION)( IN PVOID Context, IN ULONG BatteryTag, IN BATTERY_QUERY_INFORMATION_LEVEL Level, @@ -197,26 +197,26 @@ typedef NTSTATUS DDKAPI IN ULONG BufferLength, OUT PULONG ReturnedLength); -typedef NTSTATUS DDKAPI -(*BCLASS_QUERY_STATUS)( +typedef NTSTATUS +(DDKAPI*BCLASS_QUERY_STATUS)( IN PVOID Context, IN ULONG BatteryTag, OUT PBATTERY_STATUS BatteryStatus); -typedef NTSTATUS DDKAPI -(*BCLASS_QUERY_TAG)( +typedef NTSTATUS +(DDKAPI*BCLASS_QUERY_TAG)( IN PVOID Context, OUT PULONG BatteryTag); -typedef NTSTATUS DDKAPI -(*BCLASS_SET_INFORMATION)( +typedef NTSTATUS +(DDKAPI*BCLASS_SET_INFORMATION)( IN PVOID Context, IN ULONG BatteryTag, IN BATTERY_SET_INFORMATION_LEVEL Level, IN PVOID Buffer OPTIONAL); -typedef NTSTATUS DDKAPI -(*BCLASS_SET_STATUS_NOTIFY)( +typedef NTSTATUS +(DDKAPI*BCLASS_SET_STATUS_NOTIFY)( IN PVOID Context, IN ULONG BatteryTag, IN PBATTERY_NOTIFY BatteryNotify); diff --git a/reactos/w32api/include/ddk/ntddk.h b/reactos/w32api/include/ddk/ntddk.h index 20a3ac297da..5162debae7e 100644 --- a/reactos/w32api/include/ddk/ntddk.h +++ b/reactos/w32api/include/ddk/ntddk.h @@ -50,11 +50,11 @@ typedef CONST char *PCSZ; #endif #ifndef DECL_IMPORT -#define DECL_IMPORT __attribute__((dllimport)) +#define DECL_IMPORT __declspec(dllimport) #endif #ifndef DECL_EXPORT -#define DECL_EXPORT __attribute__((dllexport)) +#define DECL_EXPORT __declspec(dllexport) #endif /* Windows NT status codes */ diff --git a/reactos/w32api/include/ddk/ntifs.h b/reactos/w32api/include/ddk/ntifs.h index 40a4169411b..305e9bd29f8 100644 --- a/reactos/w32api/include/ddk/ntifs.h +++ b/reactos/w32api/include/ddk/ntifs.h @@ -585,7 +585,7 @@ typedef struct _KAPC_STATE { BOOLEAN KernelApcInProgress; BOOLEAN KernelApcPending; BOOLEAN UserApcPending; -} KAPC_STATE, *PKAPC_STATE, *__restrict PRKAPC_STATE; +} KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE; #if (VER_PRODUCTBUILD >= 2600) @@ -2291,15 +2291,15 @@ FsRtlCheckLockForWriteAccess ( ); typedef -VOID NTAPI -(*POPLOCK_WAIT_COMPLETE_ROUTINE) ( +VOID +(NTAPI*POPLOCK_WAIT_COMPLETE_ROUTINE) ( IN PVOID Context, IN PIRP Irp ); typedef -VOID NTAPI -(*POPLOCK_FS_PREPOST_IRP) ( +VOID +(NTAPI*POPLOCK_FS_PREPOST_IRP) ( IN PVOID Context, IN PIRP Irp ); diff --git a/reactos/w32api/include/ddk/ntpoapi.h b/reactos/w32api/include/ddk/ntpoapi.h index 1e56fd4b0af..3dacf56cb96 100644 --- a/reactos/w32api/include/ddk/ntpoapi.h +++ b/reactos/w32api/include/ddk/ntpoapi.h @@ -43,8 +43,8 @@ typedef struct _PROCESSOR_IDLE_TIMES { ULONG IdleHandlerReserved[4]; } PROCESSOR_IDLE_TIMES, *PPROCESSOR_IDLE_TIMES; -typedef BOOLEAN DDKFASTAPI -(*PPROCESSOR_IDLE_HANDLER)( +typedef BOOLEAN +(DDKFASTAPI*PPROCESSOR_IDLE_HANDLER)( IN OUT PPROCESSOR_IDLE_TIMES IdleTimes); typedef struct _PROCESSOR_IDLE_HANDLER_INFO { @@ -52,12 +52,12 @@ typedef struct _PROCESSOR_IDLE_HANDLER_INFO { PPROCESSOR_IDLE_HANDLER Handler; } PROCESSOR_IDLE_HANDLER_INFO, *PPROCESSOR_IDLE_HANDLER_INFO; -typedef VOID DDKFASTAPI -(*PSET_PROCESSOR_THROTTLE)( +typedef VOID +(DDKFASTAPI*PSET_PROCESSOR_THROTTLE)( IN UCHAR Throttle); -typedef NTSTATUS DDKFASTAPI -(*PSET_PROCESSOR_THROTTLE2)( +typedef NTSTATUS +(DDKFASTAPI*PSET_PROCESSOR_THROTTLE2)( IN UCHAR Throttle); #define MAX_IDLE_HANDLERS 3 @@ -81,12 +81,12 @@ typedef enum _POWER_STATE_HANDLER_TYPE { PowerStateMaximum } POWER_STATE_HANDLER_TYPE, *PPOWER_STATE_HANDLER_TYPE; -typedef NTSTATUS DDKAPI -(*PENTER_STATE_SYSTEM_HANDLER)( +typedef NTSTATUS +(DDKAPI*PENTER_STATE_SYSTEM_HANDLER)( IN PVOID SystemContext); -typedef NTSTATUS DDKAPI -(*PENTER_STATE_HANDLER)( +typedef NTSTATUS +(DDKAPI*PENTER_STATE_HANDLER)( IN PVOID Context, IN PENTER_STATE_SYSTEM_HANDLER SystemHandler OPTIONAL, IN PVOID SystemContext, @@ -101,8 +101,8 @@ typedef struct _POWER_STATE_HANDLER { PVOID Context; } POWER_STATE_HANDLER, *PPOWER_STATE_HANDLER; -typedef NTSTATUS STDCALL -(*PENTER_STATE_NOTIFY_HANDLER)( +typedef NTSTATUS +(STDCALL*PENTER_STATE_NOTIFY_HANDLER)( IN POWER_STATE_HANDLER_TYPE State, IN PVOID Context, IN BOOLEAN Entering); diff --git a/reactos/w32api/include/ddk/winddk.h b/reactos/w32api/include/ddk/winddk.h index 66c6bd545a7..0bb6292aa77 100644 --- a/reactos/w32api/include/ddk/winddk.h +++ b/reactos/w32api/include/ddk/winddk.h @@ -34,9 +34,9 @@ extern "C" { /* ** Definitions specific to this Device Driver Kit */ -#define DDKAPI __attribute__((stdcall)) -#define DDKFASTAPI __attribute__((fastcall)) -#define DDKCDECLAPI __attribute__((cdecl)) +#define DDKAPI __stdcall +#define DDKFASTAPI __fastcall +#define DDKCDECLAPI __cdecl #if defined(_NTOSKRNL_) #ifndef NTOSAPI @@ -128,11 +128,15 @@ static __inline struct _KPCR * KeGetCurrentKPCR( VOID) { ULONG Value; - +#if defined(__GNUC__) __asm__ __volatile__ ("movl %%fs:0x1C, %0\n\t" : "=r" (Value) : /* no inputs */ ); +#elif defined(_MSC_VER) + __asm mov eax, fs:[1Ch] + __asm mov [Value], eax +#endif return (struct _KPCR *) Value; } @@ -140,11 +144,15 @@ static __inline struct _KPRCB * KeGetCurrentPrcb( VOID) { ULONG Value; - +#if defined(__GNUC__) __asm__ __volatile__ ("movl %%fs:0x20, %0\n\t" : "=r" (Value) : /* no inputs */ ); +#elif defined(_MSC_VER) + __asm mov eax, fs:[20h] + __asm mov [Value], eax +#endif return (struct _KPRCB *) Value; } @@ -4331,8 +4339,8 @@ typedef struct _DISK_SIGNATURE { } DUMMYUNIONNAME; } DISK_SIGNATURE, *PDISK_SIGNATURE; -typedef VOID DDKFASTAPI -(*PTIME_UPDATE_NOTIFY_ROUTINE)( +typedef VOID +(DDKFASTAPI*PTIME_UPDATE_NOTIFY_ROUTINE)( IN HANDLE ThreadId, IN KPROCESSOR_MODE Mode); @@ -8088,7 +8096,11 @@ KeMemoryBarrier( VOID) { volatile LONG Barrier; +#if defined(__GNUC__) __asm__ __volatile__ ("xchg %%eax, %0" : : "m" (Barrier) : "%eax"); +#elif defined(_MSC_VER) + __asm xchg [Barrier], eax +#endif } NTOSAPI diff --git a/reactos/w32api/include/ntdef.h b/reactos/w32api/include/ntdef.h index 65792640a44..087e1a393ba 100644 --- a/reactos/w32api/include/ntdef.h +++ b/reactos/w32api/include/ntdef.h @@ -3,6 +3,9 @@ #if __GNUC__ >=3 #pragma GCC system_header #endif + +/* TODO: some compilers support this */ +#define RESTRICTED_POINTER #define NTAPI __stdcall #define OBJ_INHERIT 0x00000002 diff --git a/reactos/w32api/include/windef.h b/reactos/w32api/include/windef.h index 0fc53b6f5ac..9260130ce56 100644 --- a/reactos/w32api/include/windef.h +++ b/reactos/w32api/include/windef.h @@ -118,6 +118,9 @@ extern "C" { #elif defined(__WATCOMC__) #define DECLSPEC_NORETURN #define DECLARE_STDCALL_P( type ) type __stdcall +#elif defined(_MSC_VER) +#define DECLSPEC_NORETURN __declspec(noreturn) +#define DECLARE_STDCALL_P( type ) type __stdcall #endif /* __GNUC__/__WATCOMC__ */ #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) @@ -160,7 +163,7 @@ extern "C" { #endif /* __cplusplus */ #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */ #endif /* NONAMELESSUNION */ -#elif defined(__WATCOMC__) +#elif defined(__WATCOMC__) || defined(_MSC_VER) #define _ANONYMOUS_UNION #define _ANONYMOUS_STRUCT #endif /* __GNUC__/__WATCOMC__ */ diff --git a/reactos/w32api/include/winnt.h b/reactos/w32api/include/winnt.h index 4734ed4e7f4..29d698bf133 100644 --- a/reactos/w32api/include/winnt.h +++ b/reactos/w32api/include/winnt.h @@ -1358,7 +1358,7 @@ typedef struct _GUID { unsigned short Data3; unsigned char Data4[8]; } GUID, *REFGUID, *LPGUID; -#define SYSTEM_LUID { QuadPart:999 } +#define SYSTEM_LUID { 0x3E7, 0x0 } #endif /* GUID_DEFINED */ /* ACE Access Types, also in ntifs.h */ @@ -2039,7 +2039,10 @@ typedef union _ULARGE_INTEGER { #endif /* NONAMELESSUNION */ ULONGLONG QuadPart; } ULARGE_INTEGER, *PULARGE_INTEGER; -typedef LARGE_INTEGER LUID,*PLUID; +typedef struct _LUID { + DWORD LowPart; + LONG HighPart; +} LUID, *PLUID; #pragma pack(push,4) typedef struct _LUID_AND_ATTRIBUTES { LUID Luid; @@ -3413,17 +3416,6 @@ static __inline__ PVOID GetCurrentFiber(void) return ret; } -static __inline__ PVOID GetFiberData(void) -{ - void* ret; - __asm__ __volatile__ ( - "movl %%fs:0x10,%0\n" - "movl (%0),%0" - : "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */ - ); - return ret; -} - static __inline__ struct _TEB * NtCurrentTeb(void) { struct _TEB *ret; @@ -3437,7 +3429,7 @@ static __inline__ struct _TEB * NtCurrentTeb(void) return ret; } -#else +#elif defined(__WATCOMC__) extern PVOID GetCurrentFiber(void); #pragma aux GetCurrentFiber = \ @@ -3445,14 +3437,36 @@ extern PVOID GetCurrentFiber(void); value [eax] \ modify [eax]; -extern PVOID GetFiberData(void); -#pragma aux GetFiberData = \ - "mov eax, dword ptr fs:0x10" \ - "mov eax, [eax]" \ +extern struct _TEB * NtCurrentTeb(void); +#pragma aux NtCurrentTeb = \ + "mov eax, dword ptr fs:0x18" \ value [eax] \ modify [eax]; -#endif /* __GNUC__ */ +#elif defined(_MSC_VER) + +static __inline PVOID GetCurrentFiber(void) +{ + PVOID p; + __asm mov eax, fs:[10h] + __asm mov [p], eax + return p; +} + +static __inline struct _TEB * NtCurrentTeb(void) +{ + struct _TEB *p; + __asm mov eax, fs:[18h] + __asm mov [p], eax + return p; +} + +#endif /* __GNUC__/__WATCOMC__/_MSC_VER */ + +static __inline PVOID GetFiberData(void) +{ + return *((PVOID *)GetCurrentFiber()); +} #endif /* RC_INVOKED */