From 98d9c65720266a679a973c50fc295a79dde8b45b Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Wed, 24 Aug 2005 21:29:24 +0000 Subject: [PATCH] Fix a memory leak if VideoPortInitialize is called more than once from the same miniport. Replace STDCALL with NTAPI. svn path=/trunk/; revision=17520 --- reactos/drivers/video/videoprt/agp.c | 20 ++-- reactos/drivers/video/videoprt/ddc.c | 2 +- reactos/drivers/video/videoprt/dispatch.c | 28 ++--- reactos/drivers/video/videoprt/dma.c | 8 +- reactos/drivers/video/videoprt/event.c | 10 +- reactos/drivers/video/videoprt/int10.c | 12 +- reactos/drivers/video/videoprt/interrupt.c | 8 +- reactos/drivers/video/videoprt/resource.c | 40 +++---- reactos/drivers/video/videoprt/services.c | 8 +- reactos/drivers/video/videoprt/spinlock.c | 12 +- reactos/drivers/video/videoprt/timer.c | 8 +- reactos/drivers/video/videoprt/videoprt.c | 129 ++++++++++++--------- reactos/drivers/video/videoprt/videoprt.h | 44 +++---- 13 files changed, 176 insertions(+), 153 deletions(-) diff --git a/reactos/drivers/video/videoprt/agp.c b/reactos/drivers/video/videoprt/agp.c index 58fe3db83c0..a67bd1ac148 100644 --- a/reactos/drivers/video/videoprt/agp.c +++ b/reactos/drivers/video/videoprt/agp.c @@ -91,7 +91,7 @@ IopInitiatePnpIrp( } -BOOLEAN STDCALL +BOOLEAN NTAPI IntAgpCommitPhysical( IN PVOID HwDeviceExtension, IN PVOID PhysicalContext, @@ -123,7 +123,7 @@ IntAgpCommitPhysical( return NT_SUCCESS(Status); } -VOID STDCALL +VOID NTAPI IntAgpFreePhysical( IN PVOID HwDeviceExtension, IN PVOID PhysicalContext, @@ -151,7 +151,7 @@ IntAgpFreePhysical( } } -VOID STDCALL +VOID NTAPI IntAgpReleasePhysical( IN PVOID HwDeviceExtension, IN PVOID PhysicalContext) @@ -180,7 +180,7 @@ IntAgpReleasePhysical( ExFreePool(AgpMapping); } -PHYSICAL_ADDRESS STDCALL +PHYSICAL_ADDRESS NTAPI IntAgpReservePhysical( IN PVOID HwDeviceExtension, IN ULONG Pages, @@ -245,7 +245,7 @@ IntAgpReservePhysical( } -PVOID STDCALL +PVOID NTAPI IntAgpCommitVirtual( IN PVOID HwDeviceExtension, IN PVOID VirtualContext, @@ -327,7 +327,7 @@ IntAgpCommitVirtual( return BaseAddress; } -VOID STDCALL +VOID NTAPI IntAgpFreeVirtual( IN PVOID HwDeviceExtension, IN PVOID VirtualContext, @@ -381,7 +381,7 @@ IntAgpFreeVirtual( } } -VOID STDCALL +VOID NTAPI IntAgpReleaseVirtual( IN PVOID HwDeviceExtension, IN PVOID VirtualContext) @@ -415,7 +415,7 @@ IntAgpReleaseVirtual( ExFreePool(VirtualMapping); } -PVOID STDCALL +PVOID NTAPI IntAgpReserveVirtual( IN PVOID HwDeviceExtension, IN HANDLE ProcessHandle, @@ -475,7 +475,7 @@ IntAgpReserveVirtual( } -BOOLEAN STDCALL +BOOLEAN NTAPI IntAgpSetRate( IN PVOID HwDeviceExtension, IN ULONG Rate) @@ -492,7 +492,7 @@ IntAgpSetRate( } -NTSTATUS STDCALL +NTSTATUS NTAPI IntAgpGetInterface( IN PVOID HwDeviceExtension, IN OUT PINTERFACE Interface) diff --git a/reactos/drivers/video/videoprt/ddc.c b/reactos/drivers/video/videoprt/ddc.c index da4283ec650..ed65b3cfee3 100644 --- a/reactos/drivers/video/videoprt/ddc.c +++ b/reactos/drivers/video/videoprt/ddc.c @@ -168,7 +168,7 @@ I2CRepStart(PVOID HwDeviceExtension, PI2C_CALLBACKS i2c, UCHAR Address) * @implemented */ -BOOLEAN STDCALL +BOOLEAN NTAPI VideoPortDDCMonitorHelper( PVOID HwDeviceExtension, PVOID I2CFunctions, diff --git a/reactos/drivers/video/videoprt/dispatch.c b/reactos/drivers/video/videoprt/dispatch.c index fe0544b68d8..e6982d22000 100644 --- a/reactos/drivers/video/videoprt/dispatch.c +++ b/reactos/drivers/video/videoprt/dispatch.c @@ -25,8 +25,8 @@ /* EXTERNAL FUNCTIONS *********************************************************/ -VOID STDCALL HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters); -VOID STDCALL HalReleaseDisplayOwnership(); +VOID NTAPI HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters); +VOID NTAPI HalReleaseDisplayOwnership(); /* GLOBAL VARIABLES ***********************************************************/ @@ -38,7 +38,7 @@ PVIDEO_PORT_DEVICE_EXTENSION ResetDisplayParametersDeviceExtension = NULL; * Reset display to blue screen */ -BOOLEAN STDCALL +BOOLEAN NTAPI IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows) { PVIDEO_PORT_DRIVER_EXTENSION DriverExtension; @@ -63,7 +63,7 @@ IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows) return FALSE; } -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortAddDevice( IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject) @@ -96,7 +96,7 @@ IntVideoPortAddDevice( * PASSIVE_LEVEL */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchOpen( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -166,7 +166,7 @@ IntVideoPortDispatchOpen( * PASSIVE_LEVEL */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchClose( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -198,7 +198,7 @@ IntVideoPortDispatchClose( * PASSIVE_LEVEL */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchDeviceControl( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -264,7 +264,7 @@ IntVideoPortDispatchDeviceControl( return Status; } -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortPnPStartDevice( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -352,7 +352,7 @@ IntVideoPortPnPStartDevice( NTSTATUS -STDCALL +NTAPI IntVideoPortForwardIrpAndWaitCompletionRoutine( PDEVICE_OBJECT Fdo, PIRP Irp, @@ -368,7 +368,7 @@ IntVideoPortForwardIrpAndWaitCompletionRoutine( NTSTATUS -STDCALL +NTAPI IntVideoPortForwardIrpAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp) { KEVENT Event; @@ -390,7 +390,7 @@ IntVideoPortForwardIrpAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp) } -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchPnp( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -442,7 +442,7 @@ IntVideoPortDispatchPnp( return Status; } -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchCleanup( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -459,7 +459,7 @@ IntVideoPortDispatchCleanup( return STATUS_SUCCESS; } -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchPower( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) @@ -467,7 +467,7 @@ IntVideoPortDispatchPower( return STATUS_NOT_IMPLEMENTED; } -VOID STDCALL +VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject) { } diff --git a/reactos/drivers/video/videoprt/dma.c b/reactos/drivers/video/videoprt/dma.c index 6c22b6af536..546c9d75e52 100644 --- a/reactos/drivers/video/videoprt/dma.c +++ b/reactos/drivers/video/videoprt/dma.c @@ -29,7 +29,7 @@ * @implemented */ -PVOID STDCALL +PVOID NTAPI VideoPortAllocateCommonBuffer( IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, @@ -49,7 +49,7 @@ VideoPortAllocateCommonBuffer( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortReleaseCommonBuffer( IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, @@ -70,7 +70,7 @@ VideoPortReleaseCommonBuffer( * @unimplemented */ -VOID STDCALL +VOID NTAPI VideoPortPutDmaAdapter( IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter) @@ -82,7 +82,7 @@ VideoPortPutDmaAdapter( * @unimplemented */ -PVP_DMA_ADAPTER STDCALL +PVP_DMA_ADAPTER NTAPI VideoPortGetDmaAdapter( IN PVOID HwDeviceExtension, IN PVP_DEVICE_DESCRIPTION VpDeviceExtension) diff --git a/reactos/drivers/video/videoprt/event.c b/reactos/drivers/video/videoprt/event.c index 70b38704c3d..259059657c2 100644 --- a/reactos/drivers/video/videoprt/event.c +++ b/reactos/drivers/video/videoprt/event.c @@ -29,7 +29,7 @@ * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortCreateEvent( IN PVOID HwDeviceExtension, IN ULONG EventFlag, @@ -59,7 +59,7 @@ VideoPortCreateEvent( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortDeleteEvent( IN PVOID HwDeviceExtension, IN PEVENT Event) @@ -72,7 +72,7 @@ VideoPortDeleteEvent( * @implemented */ -LONG STDCALL +LONG NTAPI VideoPortSetEvent( IN PVOID HwDeviceExtension, IN PEVENT Event) @@ -84,7 +84,7 @@ VideoPortSetEvent( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortClearEvent( IN PVOID HwDeviceExtension, IN PEVENT Event) @@ -96,7 +96,7 @@ VideoPortClearEvent( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortWaitForSingleObject( IN PVOID HwDeviceExtension, IN PVOID Object, diff --git a/reactos/drivers/video/videoprt/int10.c b/reactos/drivers/video/videoprt/int10.c index 4ef34c1a270..644cb1aeed1 100644 --- a/reactos/drivers/video/videoprt/int10.c +++ b/reactos/drivers/video/videoprt/int10.c @@ -26,7 +26,7 @@ /* PRIVATE FUNCTIONS **********************************************************/ -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10AllocateBuffer( IN PVOID Context, OUT PUSHORT Seg, @@ -74,7 +74,7 @@ IntInt10AllocateBuffer( return NO_ERROR; } -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10FreeBuffer( IN PVOID Context, IN USHORT Seg, @@ -97,7 +97,7 @@ IntInt10FreeBuffer( return Status; } -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10ReadMemory( IN PVOID Context, IN USHORT Seg, @@ -121,7 +121,7 @@ IntInt10ReadMemory( return NO_ERROR; } -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10WriteMemory( IN PVOID Context, IN USHORT Seg, @@ -145,7 +145,7 @@ IntInt10WriteMemory( return NO_ERROR; } -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10CallBios( IN PVOID Context, IN OUT PINT10_BIOS_ARGUMENTS BiosArguments) @@ -200,7 +200,7 @@ IntInt10CallBios( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortInt10( IN PVOID HwDeviceExtension, IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments) diff --git a/reactos/drivers/video/videoprt/interrupt.c b/reactos/drivers/video/videoprt/interrupt.c index 04fa84a7849..b53838da441 100644 --- a/reactos/drivers/video/videoprt/interrupt.c +++ b/reactos/drivers/video/videoprt/interrupt.c @@ -25,7 +25,7 @@ /* PRIVATE FUNCTIONS **********************************************************/ -BOOLEAN STDCALL +BOOLEAN NTAPI IntVideoPortInterruptRoutine( IN struct _KINTERRUPT *Interrupt, IN PVOID ServiceContext) @@ -38,7 +38,7 @@ IntVideoPortInterruptRoutine( &DeviceExtension->MiniPortDeviceExtension); } -BOOLEAN STDCALL +BOOLEAN NTAPI IntVideoPortSetupInterrupt( IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, @@ -105,7 +105,7 @@ IntVideoPortSetupInterrupt( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortEnableInterrupt(IN PVOID HwDeviceExtension) { PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; @@ -127,7 +127,7 @@ VideoPortEnableInterrupt(IN PVOID HwDeviceExtension) * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortDisableInterrupt(IN PVOID HwDeviceExtension) { PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; diff --git a/reactos/drivers/video/videoprt/resource.c b/reactos/drivers/video/videoprt/resource.c index 594d1733a0e..8bddb213678 100644 --- a/reactos/drivers/video/videoprt/resource.c +++ b/reactos/drivers/video/videoprt/resource.c @@ -25,7 +25,7 @@ /* PRIVATE FUNCTIONS **********************************************************/ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortMapPhysicalMemory( IN HANDLE Process, IN PHYSICAL_ADDRESS PhysicalAddress, @@ -76,7 +76,7 @@ IntVideoPortMapPhysicalMemory( } -PVOID STDCALL +PVOID NTAPI IntVideoPortMapMemory( IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PHYSICAL_ADDRESS IoAddress, @@ -231,7 +231,7 @@ IntVideoPortMapMemory( return NULL; } -VOID STDCALL +VOID NTAPI IntVideoPortUnmapMemory( IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress) @@ -283,7 +283,7 @@ IntVideoPortUnmapMemory( * @implemented */ -PVOID STDCALL +PVOID NTAPI VideoPortGetDeviceBase( IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS IoAddress, @@ -304,7 +304,7 @@ VideoPortGetDeviceBase( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortFreeDeviceBase( IN PVOID HwDeviceExtension, IN PVOID MappedAddress) @@ -319,7 +319,7 @@ VideoPortFreeDeviceBase( * @unimplemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortMapBankedMemory( IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, @@ -341,7 +341,7 @@ VideoPortMapBankedMemory( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortMapMemory( IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, @@ -371,7 +371,7 @@ VideoPortMapMemory( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortUnmapMemory( IN PVOID HwDeviceExtension, IN PVOID VirtualAddress, @@ -390,7 +390,7 @@ VideoPortUnmapMemory( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortGetAccessRanges( IN PVOID HwDeviceExtension, IN ULONG NumRequestedResources, @@ -579,7 +579,7 @@ VideoPortGetAccessRanges( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortVerifyAccessRanges( IN PVOID HwDeviceExtension, IN ULONG NumAccessRanges, @@ -659,7 +659,7 @@ VideoPortVerifyAccessRanges( * @unimplemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortGetDeviceData( IN PVOID HwDeviceExtension, IN VIDEO_DEVICE_DATA_TYPE DeviceDataType, @@ -675,7 +675,7 @@ VideoPortGetDeviceData( * @implemented */ -PVOID STDCALL +PVOID NTAPI VideoPortAllocatePool( IN PVOID HwDeviceExtension, IN VP_POOL_TYPE PoolType, @@ -690,7 +690,7 @@ VideoPortAllocatePool( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortFreePool( IN PVOID HwDeviceExtension, IN PVOID Ptr) @@ -702,7 +702,7 @@ VideoPortFreePool( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortAllocateBuffer( IN PVOID HwDeviceExtension, IN ULONG Size, @@ -717,7 +717,7 @@ VideoPortAllocateBuffer( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortReleaseBuffer( IN PVOID HwDeviceExtension, IN PVOID Ptr) @@ -730,7 +730,7 @@ VideoPortReleaseBuffer( * @unimplemented */ -PVOID STDCALL +PVOID NTAPI VideoPortLockBuffer( IN PVOID HwDeviceExtension, IN PVOID BaseAddress, @@ -745,7 +745,7 @@ VideoPortLockBuffer( * @unimplemented */ -VOID STDCALL +VOID NTAPI VideoPortUnlockBuffer( IN PVOID HwDeviceExtension, IN PVOID Mdl) @@ -757,7 +757,7 @@ VideoPortUnlockBuffer( * @unimplemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortSetTrappedEmulatorPorts( IN PVOID HwDeviceExtension, IN ULONG NumAccessRanges, @@ -772,7 +772,7 @@ VideoPortSetTrappedEmulatorPorts( * @implemented */ -ULONG STDCALL +ULONG NTAPI VideoPortGetBusData( IN PVOID HwDeviceExtension, IN BUS_DATA_TYPE BusDataType, @@ -807,7 +807,7 @@ VideoPortGetBusData( * @implemented */ -ULONG STDCALL +ULONG NTAPI VideoPortSetBusData( IN PVOID HwDeviceExtension, IN BUS_DATA_TYPE BusDataType, diff --git a/reactos/drivers/video/videoprt/services.c b/reactos/drivers/video/videoprt/services.c index c313649a514..d107fc6ea88 100644 --- a/reactos/drivers/video/videoprt/services.c +++ b/reactos/drivers/video/videoprt/services.c @@ -23,19 +23,19 @@ #include "videoprt.h" -VOID STDCALL +VOID NTAPI IntInterfaceReference(PVOID Context) { /* Do nothing */ } -VOID STDCALL +VOID NTAPI IntInterfaceDereference(PVOID Context) { /* Do nothing */ } -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortQueryServices( IN PVOID HwDeviceExtension, IN VIDEO_PORT_SERVICES ServicesType, @@ -89,7 +89,7 @@ VideoPortQueryServices( return ERROR_INVALID_FUNCTION; } -BOOLEAN STDCALL +BOOLEAN NTAPI VideoPortGetAgpServices( IN PVOID HwDeviceExtension, OUT PVIDEO_PORT_AGP_SERVICES AgpServices) diff --git a/reactos/drivers/video/videoprt/spinlock.c b/reactos/drivers/video/videoprt/spinlock.c index c02769680b2..3b11e2c14cc 100644 --- a/reactos/drivers/video/videoprt/spinlock.c +++ b/reactos/drivers/video/videoprt/spinlock.c @@ -27,7 +27,7 @@ * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortCreateSpinLock( IN PVOID HwDeviceExtension, OUT PSPIN_LOCK *SpinLock) @@ -44,7 +44,7 @@ VideoPortCreateSpinLock( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortDeleteSpinLock( IN PVOID HwDeviceExtension, IN PSPIN_LOCK SpinLock) @@ -58,7 +58,7 @@ VideoPortDeleteSpinLock( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortAcquireSpinLock( IN PVOID HwDeviceExtension, IN PSPIN_LOCK SpinLock, @@ -72,7 +72,7 @@ VideoPortAcquireSpinLock( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortAcquireSpinLockAtDpcLevel( IN PVOID HwDeviceExtension, IN PSPIN_LOCK SpinLock) @@ -85,7 +85,7 @@ VideoPortAcquireSpinLockAtDpcLevel( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortReleaseSpinLock( IN PVOID HwDeviceExtension, IN PSPIN_LOCK SpinLock, @@ -99,7 +99,7 @@ VideoPortReleaseSpinLock( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortReleaseSpinLockFromDpcLevel( IN PVOID HwDeviceExtension, IN PSPIN_LOCK SpinLock) diff --git a/reactos/drivers/video/videoprt/timer.c b/reactos/drivers/video/videoprt/timer.c index 154f534b654..4c727fe25f9 100644 --- a/reactos/drivers/video/videoprt/timer.c +++ b/reactos/drivers/video/videoprt/timer.c @@ -25,7 +25,7 @@ /* PRIVATE FUNCTIONS **********************************************************/ -VOID STDCALL +VOID NTAPI IntVideoPortTimerRoutine( IN PDEVICE_OBJECT DeviceObject, IN PVOID ServiceContext) @@ -38,7 +38,7 @@ IntVideoPortTimerRoutine( &DeviceExtension->MiniPortDeviceExtension); } -BOOLEAN STDCALL +BOOLEAN NTAPI IntVideoPortSetupTimer( IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension) @@ -73,7 +73,7 @@ IntVideoPortSetupTimer( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortStartTimer(IN PVOID HwDeviceExtension) { DPRINT("VideoPortStartTimer\n"); @@ -84,7 +84,7 @@ VideoPortStartTimer(IN PVOID HwDeviceExtension) * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortStopTimer(IN PVOID HwDeviceExtension) { DPRINT("VideoPortStopTimer\n"); diff --git a/reactos/drivers/video/videoprt/videoprt.c b/reactos/drivers/video/videoprt/videoprt.c index 7b0e93b0a95..1028e8b42e3 100644 --- a/reactos/drivers/video/videoprt/videoprt.c +++ b/reactos/drivers/video/videoprt/videoprt.c @@ -30,7 +30,7 @@ PKPROCESS Csrss = NULL; /* PRIVATE FUNCTIONS **********************************************************/ -NTSTATUS STDCALL +NTSTATUS NTAPI DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) @@ -38,7 +38,7 @@ DriverEntry( return STATUS_SUCCESS; } -PVOID STDCALL +PVOID NTAPI IntVideoPortImageDirectoryEntryToData( PVOID BaseAddress, ULONG Directory) @@ -60,7 +60,7 @@ IntVideoPortImageDirectoryEntryToData( return (PVOID)((ULONG_PTR)BaseAddress + Va); } -PVOID STDCALL +PVOID NTAPI IntVideoPortGetProcAddress( IN PVOID HwDeviceExtension, IN PUCHAR FunctionName) @@ -116,7 +116,7 @@ IntVideoPortGetProcAddress( return NULL; } -VOID STDCALL +VOID NTAPI IntVideoPortDeferredRoutine( IN PKDPC Dpc, IN PVOID DeferredContext, @@ -128,7 +128,7 @@ IntVideoPortDeferredRoutine( ((PMINIPORT_DPC_ROUTINE)SystemArgument1)(HwDeviceExtension, SystemArgument2); } -ULONG STDCALL +ULONG NTAPI IntVideoPortAllocateDeviceNumber(VOID) { NTSTATUS Status; @@ -163,7 +163,7 @@ IntVideoPortAllocateDeviceNumber(VOID) return DeviceNumber; } -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject( IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, @@ -308,7 +308,7 @@ IntVideoPortCreateAdapterDeviceObject( /* FIXME: we have to detach the device object in IntVideoPortFindAdapter if it fails */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortFindAdapter( IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, @@ -518,7 +518,7 @@ IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState) * @implemented */ -ULONG STDCALL +ULONG NTAPI VideoPortInitialize( IN PVOID Context1, IN PVOID Context2, @@ -533,11 +533,27 @@ VideoPortInitialize( DPRINT("VideoPortInitialize\n"); + /* + * As a first thing do parameter checks. + */ + + if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA)) + { + return STATUS_REVISON_MISMATCH; + } + + if (HwInitializationData->HwFindAdapter == NULL || + HwInitializationData->HwInitialize == NULL || + HwInitializationData->HwStartIO == NULL) + { + return STATUS_INVALID_PARAMETER; + } + /* * NOTE: * The driver extension can be already allocated in case that we were * called by legacy driver and failed detecting device. Some miniport - * drivers in that case adjust parameters and calls VideoPortInitialize + * drivers in that case adjust parameters and call VideoPortInitialize * again. */ @@ -554,6 +570,34 @@ VideoPortInitialize( { return Status; } + + /* + * Save the registry path. This should be done only once even if + * VideoPortInitialize is called multiple times. + */ + + if (RegistryPath->Length != 0) + { + DriverExtension->RegistryPath.Length = 0; + DriverExtension->RegistryPath.MaximumLength = + RegistryPath->Length + sizeof(UNICODE_NULL); + DriverExtension->RegistryPath.Buffer = + ExAllocatePoolWithTag( + PagedPool, + DriverExtension->RegistryPath.MaximumLength, + TAG('U', 'S', 'T', 'R')); + if (DriverExtension->RegistryPath.Buffer == NULL) + { + RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL); + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlCopyUnicodeString(&DriverExtension->RegistryPath, RegistryPath); + } + else + { + RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL); + } } /* @@ -563,9 +607,9 @@ VideoPortInitialize( RtlCopyMemory( &DriverExtension->InitializationData, HwInitializationData, - min(sizeof(VIDEO_HW_INITIALIZATION_DATA), - HwInitializationData->HwInitDataSize)); - if (sizeof(VIDEO_HW_INITIALIZATION_DATA) > HwInitializationData->HwInitDataSize) + HwInitializationData->HwInitDataSize); + if (HwInitializationData->HwInitDataSize < + sizeof(VIDEO_HW_INITIALIZATION_DATA)) { RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData + HwInitializationData->HwInitDataSize), @@ -574,27 +618,6 @@ VideoPortInitialize( } DriverExtension->HwContext = HwContext; - /* we can't use RtlDuplicateUnicodeString because only ntdll exposes it... */ - if (RegistryPath->Length != 0) - { - DriverExtension->RegistryPath.Length = 0; - DriverExtension->RegistryPath.MaximumLength = RegistryPath->Length + sizeof(UNICODE_NULL); - DriverExtension->RegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool, - DriverExtension->RegistryPath.MaximumLength, - TAG('U', 'S', 'T', 'R')); - if (DriverExtension->RegistryPath.Buffer == NULL) - { - RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL); - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlCopyUnicodeString(&DriverExtension->RegistryPath, RegistryPath); - } - else - { - RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL); - } - switch (HwInitializationData->HwInitDataSize) { /* @@ -675,7 +698,7 @@ VideoPortDebugPrint( * @unimplemented */ -VOID STDCALL +VOID NTAPI VideoPortLogError( IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL, @@ -694,7 +717,7 @@ VideoPortLogError( * @implemented */ -UCHAR STDCALL +UCHAR NTAPI VideoPortGetCurrentIrql(VOID) { return KeGetCurrentIrql(); @@ -707,7 +730,7 @@ typedef struct QueryRegistryCallbackContext PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine; } QUERY_REGISTRY_CALLBACK_CONTEXT, *PQUERY_REGISTRY_CALLBACK_CONTEXT; -static NTSTATUS STDCALL +static NTSTATUS NTAPI QueryRegistryCallback( IN PWSTR ValueName, IN ULONG ValueType, @@ -732,7 +755,7 @@ QueryRegistryCallback( * @unimplemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortGetRegistryParameters( IN PVOID HwDeviceExtension, IN PWSTR ParameterName, @@ -780,7 +803,7 @@ VideoPortGetRegistryParameters( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortSetRegistryParameters( IN PVOID HwDeviceExtension, IN PWSTR ValueName, @@ -802,7 +825,7 @@ VideoPortSetRegistryParameters( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortGetVgaStatus( IN PVOID HwDeviceExtension, OUT PULONG VgaStatus) @@ -830,7 +853,7 @@ VideoPortGetVgaStatus( * @implemented */ -PVOID STDCALL +PVOID NTAPI VideoPortGetRomImage( IN PVOID HwDeviceExtension, IN PVOID Unused1, @@ -888,7 +911,7 @@ VideoPortGetRomImage( * @implemented */ -BOOLEAN STDCALL +BOOLEAN NTAPI VideoPortScanRom( IN PVOID HwDeviceExtension, IN PUCHAR RomBase, @@ -922,7 +945,7 @@ VideoPortScanRom( * @implemented */ -BOOLEAN STDCALL +BOOLEAN NTAPI VideoPortSynchronizeExecution( IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, @@ -972,7 +995,7 @@ VideoPortSynchronizeExecution( * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortEnumerateChildren( IN PVOID HwDeviceExtension, IN PVOID Reserved) @@ -1060,7 +1083,7 @@ VideoPortEnumerateChildren( * @unimplemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortCreateSecondaryDisplay( IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, @@ -1074,7 +1097,7 @@ VideoPortCreateSecondaryDisplay( * @implemented */ -BOOLEAN STDCALL +BOOLEAN NTAPI VideoPortQueueDpc( IN PVOID HwDeviceExtension, IN PMINIPORT_DPC_ROUTINE CallbackRoutine, @@ -1090,7 +1113,7 @@ VideoPortQueueDpc( * @unimplemented */ -PVOID STDCALL +PVOID NTAPI VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject) { DPRINT1("VideoPortGetAssociatedDeviceExtension: Unimplemented.\n"); @@ -1101,7 +1124,7 @@ VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject) * @implemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortGetVersion( IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo) @@ -1139,7 +1162,7 @@ VideoPortGetVersion( * @unimplemented */ -BOOLEAN STDCALL +BOOLEAN NTAPI VideoPortCheckForDeviceExistence( IN PVOID HwDeviceExtension, IN USHORT VendorId, @@ -1157,7 +1180,7 @@ VideoPortCheckForDeviceExistence( * @unimplemented */ -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortRegisterBugcheckCallback( IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, @@ -1172,7 +1195,7 @@ VideoPortRegisterBugcheckCallback( * @implemented */ -LONGLONG STDCALL +LONGLONG NTAPI VideoPortQueryPerformanceCounter( IN PVOID HwDeviceExtension, OUT PLONGLONG PerformanceFrequency OPTIONAL) @@ -1188,7 +1211,7 @@ VideoPortQueryPerformanceCounter( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortAcquireDeviceLock( IN PVOID HwDeviceExtension) { @@ -1207,7 +1230,7 @@ VideoPortAcquireDeviceLock( * @implemented */ -VOID STDCALL +VOID NTAPI VideoPortReleaseDeviceLock( IN PVOID HwDeviceExtension) { @@ -1225,7 +1248,7 @@ VideoPortReleaseDeviceLock( * @unimplemented */ -VOID STDCALL +VOID NTAPI VpNotifyEaData( IN PDEVICE_OBJECT DeviceObject, IN PVOID Data) diff --git a/reactos/drivers/video/videoprt/videoprt.h b/reactos/drivers/video/videoprt/videoprt.h index da886d50700..62e680c7ffa 100644 --- a/reactos/drivers/video/videoprt/videoprt.h +++ b/reactos/drivers/video/videoprt/videoprt.h @@ -106,61 +106,61 @@ typedef struct _VIDEO_PORT_DEVICE_EXTENSTION /* agp.c */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntAgpGetInterface( IN PVOID HwDeviceExtension, IN OUT PINTERFACE Interface); /* dispatch.c */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortAddDevice( IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchOpen( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchClose( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchCleanup( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchDeviceControl( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchPnp( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortDispatchPower( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -VOID STDCALL +VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject); /* timer.c */ -BOOLEAN STDCALL +BOOLEAN NTAPI IntVideoPortSetupTimer( IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension); /* interrupt.c */ -BOOLEAN STDCALL +BOOLEAN NTAPI IntVideoPortSetupInterrupt( IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, @@ -168,7 +168,7 @@ IntVideoPortSetupInterrupt( /* resource.c */ -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortMapPhysicalMemory( IN HANDLE Process, IN PHYSICAL_ADDRESS PhysicalAddress, @@ -181,12 +181,12 @@ IntVideoPortMapPhysicalMemory( extern ULONG CsrssInitialized; extern PKPROCESS Csrss; -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortEnumerateChildren( IN PVOID HwDeviceExtension, IN PVOID Reserved); -PVOID STDCALL +PVOID NTAPI VideoPortGetProcAddress( IN PVOID HwDeviceExtension, IN PUCHAR FunctionName); @@ -197,14 +197,14 @@ IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState); VOID FASTCALL IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject( IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, OUT PDEVICE_OBJECT *DeviceObject OPTIONAL); -NTSTATUS STDCALL +NTSTATUS NTAPI IntVideoPortFindAdapter( IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, @@ -212,20 +212,20 @@ IntVideoPortFindAdapter( /* int10.c */ -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10AllocateBuffer( IN PVOID Context, OUT PUSHORT Seg, OUT PUSHORT Off, IN OUT PULONG Length); -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10FreeBuffer( IN PVOID Context, IN USHORT Seg, IN USHORT Off); -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10ReadMemory( IN PVOID Context, IN USHORT Seg, @@ -233,7 +233,7 @@ IntInt10ReadMemory( OUT PVOID Buffer, IN ULONG Length); -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10WriteMemory( IN PVOID Context, IN USHORT Seg, @@ -241,12 +241,12 @@ IntInt10WriteMemory( IN PVOID Buffer, IN ULONG Length); -VP_STATUS STDCALL +VP_STATUS NTAPI IntInt10CallBios( IN PVOID Context, IN OUT PINT10_BIOS_ARGUMENTS BiosArguments); -VP_STATUS STDCALL +VP_STATUS NTAPI VideoPortInt10( IN PVOID HwDeviceExtension, IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments); -- 2.17.1