Fix a memory leak if VideoPortInitialize is called more than once from
the same miniport.
Replace STDCALL with NTAPI.
Modified: trunk/reactos/drivers/video/videoprt/agp.c
Modified: trunk/reactos/drivers/video/videoprt/ddc.c
Modified: trunk/reactos/drivers/video/videoprt/dispatch.c
Modified: trunk/reactos/drivers/video/videoprt/dma.c
Modified: trunk/reactos/drivers/video/videoprt/event.c
Modified: trunk/reactos/drivers/video/videoprt/int10.c
Modified: trunk/reactos/drivers/video/videoprt/interrupt.c
Modified: trunk/reactos/drivers/video/videoprt/resource.c
Modified: trunk/reactos/drivers/video/videoprt/services.c
Modified: trunk/reactos/drivers/video/videoprt/spinlock.c
Modified: trunk/reactos/drivers/video/videoprt/timer.c
Modified: trunk/reactos/drivers/video/videoprt/videoprt.c
Modified: trunk/reactos/drivers/video/videoprt/videoprt.h
_____
Modified: trunk/reactos/drivers/video/videoprt/agp.c
--- trunk/reactos/drivers/video/videoprt/agp.c 2005-08-24 20:34:50 UTC
(rev 17519)
+++ trunk/reactos/drivers/video/videoprt/agp.c 2005-08-24 21:29:24 UTC
(rev 17520)
@@ -91,7 +91,7 @@
}
-BOOLEAN STDCALL
+BOOLEAN NTAPI
IntAgpCommitPhysical(
IN PVOID HwDeviceExtension,
IN PVOID PhysicalContext,
@@ -123,7 +123,7 @@
return NT_SUCCESS(Status);
}
-VOID STDCALL
+VOID NTAPI
IntAgpFreePhysical(
IN PVOID HwDeviceExtension,
IN PVOID PhysicalContext,
@@ -151,7 +151,7 @@
}
}
-VOID STDCALL
+VOID NTAPI
IntAgpReleasePhysical(
IN PVOID HwDeviceExtension,
IN PVOID PhysicalContext)
@@ -180,7 +180,7 @@
ExFreePool(AgpMapping);
}
-PHYSICAL_ADDRESS STDCALL
+PHYSICAL_ADDRESS NTAPI
IntAgpReservePhysical(
IN PVOID HwDeviceExtension,
IN ULONG Pages,
@@ -245,7 +245,7 @@
}
-PVOID STDCALL
+PVOID NTAPI
IntAgpCommitVirtual(
IN PVOID HwDeviceExtension,
IN PVOID VirtualContext,
@@ -327,7 +327,7 @@
return BaseAddress;
}
-VOID STDCALL
+VOID NTAPI
IntAgpFreeVirtual(
IN PVOID HwDeviceExtension,
IN PVOID VirtualContext,
@@ -381,7 +381,7 @@
}
}
-VOID STDCALL
+VOID NTAPI
IntAgpReleaseVirtual(
IN PVOID HwDeviceExtension,
IN PVOID VirtualContext)
@@ -415,7 +415,7 @@
ExFreePool(VirtualMapping);
}
-PVOID STDCALL
+PVOID NTAPI
IntAgpReserveVirtual(
IN PVOID HwDeviceExtension,
IN HANDLE ProcessHandle,
@@ -475,7 +475,7 @@
}
-BOOLEAN STDCALL
+BOOLEAN NTAPI
IntAgpSetRate(
IN PVOID HwDeviceExtension,
IN ULONG Rate)
@@ -492,7 +492,7 @@
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntAgpGetInterface(
IN PVOID HwDeviceExtension,
IN OUT PINTERFACE Interface)
_____
Modified: trunk/reactos/drivers/video/videoprt/ddc.c
--- trunk/reactos/drivers/video/videoprt/ddc.c 2005-08-24 20:34:50 UTC
(rev 17519)
+++ trunk/reactos/drivers/video/videoprt/ddc.c 2005-08-24 21:29:24 UTC
(rev 17520)
@@ -168,7 +168,7 @@
* @implemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
VideoPortDDCMonitorHelper(
PVOID HwDeviceExtension,
PVOID I2CFunctions,
_____
Modified: trunk/reactos/drivers/video/videoprt/dispatch.c
--- trunk/reactos/drivers/video/videoprt/dispatch.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/dispatch.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -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 @@
* Reset display to blue screen
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows)
{
PVIDEO_PORT_DRIVER_EXTENSION DriverExtension;
@@ -63,7 +63,7 @@
return FALSE;
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject)
@@ -96,7 +96,7 @@
* PASSIVE_LEVEL
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortDispatchOpen(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -166,7 +166,7 @@
* PASSIVE_LEVEL
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortDispatchClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -198,7 +198,7 @@
* PASSIVE_LEVEL
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortDispatchDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -264,7 +264,7 @@
return Status;
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortPnPStartDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -352,7 +352,7 @@
NTSTATUS
-STDCALL
+NTAPI
IntVideoPortForwardIrpAndWaitCompletionRoutine(
PDEVICE_OBJECT Fdo,
PIRP Irp,
@@ -368,7 +368,7 @@
NTSTATUS
-STDCALL
+NTAPI
IntVideoPortForwardIrpAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
KEVENT Event;
@@ -390,7 +390,7 @@
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortDispatchPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -442,7 +442,7 @@
return Status;
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortDispatchCleanup(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -459,7 +459,7 @@
return STATUS_SUCCESS;
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortDispatchPower(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
@@ -467,7 +467,7 @@
return STATUS_NOT_IMPLEMENTED;
}
-VOID STDCALL
+VOID NTAPI
IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
{
}
_____
Modified: trunk/reactos/drivers/video/videoprt/dma.c
--- trunk/reactos/drivers/video/videoprt/dma.c 2005-08-24 20:34:50 UTC
(rev 17519)
+++ trunk/reactos/drivers/video/videoprt/dma.c 2005-08-24 21:29:24 UTC
(rev 17520)
@@ -29,7 +29,7 @@
* @implemented
*/
-PVOID STDCALL
+PVOID NTAPI
VideoPortAllocateCommonBuffer(
IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
@@ -49,7 +49,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortReleaseCommonBuffer(
IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
@@ -70,7 +70,7 @@
* @unimplemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortPutDmaAdapter(
IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter)
@@ -82,7 +82,7 @@
* @unimplemented
*/
-PVP_DMA_ADAPTER STDCALL
+PVP_DMA_ADAPTER NTAPI
VideoPortGetDmaAdapter(
IN PVOID HwDeviceExtension,
IN PVP_DEVICE_DESCRIPTION VpDeviceExtension)
_____
Modified: trunk/reactos/drivers/video/videoprt/event.c
--- trunk/reactos/drivers/video/videoprt/event.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/event.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -29,7 +29,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortCreateEvent(
IN PVOID HwDeviceExtension,
IN ULONG EventFlag,
@@ -59,7 +59,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortDeleteEvent(
IN PVOID HwDeviceExtension,
IN PEVENT Event)
@@ -72,7 +72,7 @@
* @implemented
*/
-LONG STDCALL
+LONG NTAPI
VideoPortSetEvent(
IN PVOID HwDeviceExtension,
IN PEVENT Event)
@@ -84,7 +84,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortClearEvent(
IN PVOID HwDeviceExtension,
IN PEVENT Event)
@@ -96,7 +96,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortWaitForSingleObject(
IN PVOID HwDeviceExtension,
IN PVOID Object,
_____
Modified: trunk/reactos/drivers/video/videoprt/int10.c
--- trunk/reactos/drivers/video/videoprt/int10.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/int10.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -26,7 +26,7 @@
/* PRIVATE FUNCTIONS
**********************************************************/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
IntInt10AllocateBuffer(
IN PVOID Context,
OUT PUSHORT Seg,
@@ -74,7 +74,7 @@
return NO_ERROR;
}
-VP_STATUS STDCALL
+VP_STATUS NTAPI
IntInt10FreeBuffer(
IN PVOID Context,
IN USHORT Seg,
@@ -97,7 +97,7 @@
return Status;
}
-VP_STATUS STDCALL
+VP_STATUS NTAPI
IntInt10ReadMemory(
IN PVOID Context,
IN USHORT Seg,
@@ -121,7 +121,7 @@
return NO_ERROR;
}
-VP_STATUS STDCALL
+VP_STATUS NTAPI
IntInt10WriteMemory(
IN PVOID Context,
IN USHORT Seg,
@@ -145,7 +145,7 @@
return NO_ERROR;
}
-VP_STATUS STDCALL
+VP_STATUS NTAPI
IntInt10CallBios(
IN PVOID Context,
IN OUT PINT10_BIOS_ARGUMENTS BiosArguments)
@@ -200,7 +200,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortInt10(
IN PVOID HwDeviceExtension,
IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
_____
Modified: trunk/reactos/drivers/video/videoprt/interrupt.c
--- trunk/reactos/drivers/video/videoprt/interrupt.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/interrupt.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -25,7 +25,7 @@
/* PRIVATE FUNCTIONS
**********************************************************/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
IntVideoPortInterruptRoutine(
IN struct _KINTERRUPT *Interrupt,
IN PVOID ServiceContext)
@@ -38,7 +38,7 @@
&DeviceExtension->MiniPortDeviceExtension);
}
-BOOLEAN STDCALL
+BOOLEAN NTAPI
IntVideoPortSetupInterrupt(
IN PDEVICE_OBJECT DeviceObject,
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
@@ -105,7 +105,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortEnableInterrupt(IN PVOID HwDeviceExtension)
{
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
@@ -127,7 +127,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortDisableInterrupt(IN PVOID HwDeviceExtension)
{
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
_____
Modified: trunk/reactos/drivers/video/videoprt/resource.c
--- trunk/reactos/drivers/video/videoprt/resource.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/resource.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -25,7 +25,7 @@
/* PRIVATE FUNCTIONS
**********************************************************/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortMapPhysicalMemory(
IN HANDLE Process,
IN PHYSICAL_ADDRESS PhysicalAddress,
@@ -76,7 +76,7 @@
}
-PVOID STDCALL
+PVOID NTAPI
IntVideoPortMapMemory(
IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
IN PHYSICAL_ADDRESS IoAddress,
@@ -231,7 +231,7 @@
return NULL;
}
-VOID STDCALL
+VOID NTAPI
IntVideoPortUnmapMemory(
IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
IN PVOID MappedAddress)
@@ -283,7 +283,7 @@
* @implemented
*/
-PVOID STDCALL
+PVOID NTAPI
VideoPortGetDeviceBase(
IN PVOID HwDeviceExtension,
IN PHYSICAL_ADDRESS IoAddress,
@@ -304,7 +304,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortFreeDeviceBase(
IN PVOID HwDeviceExtension,
IN PVOID MappedAddress)
@@ -319,7 +319,7 @@
* @unimplemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortMapBankedMemory(
IN PVOID HwDeviceExtension,
IN PHYSICAL_ADDRESS PhysicalAddress,
@@ -341,7 +341,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortMapMemory(
IN PVOID HwDeviceExtension,
IN PHYSICAL_ADDRESS PhysicalAddress,
@@ -371,7 +371,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortUnmapMemory(
IN PVOID HwDeviceExtension,
IN PVOID VirtualAddress,
@@ -390,7 +390,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortGetAccessRanges(
IN PVOID HwDeviceExtension,
IN ULONG NumRequestedResources,
@@ -579,7 +579,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortVerifyAccessRanges(
IN PVOID HwDeviceExtension,
IN ULONG NumAccessRanges,
@@ -659,7 +659,7 @@
* @unimplemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortGetDeviceData(
IN PVOID HwDeviceExtension,
IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
@@ -675,7 +675,7 @@
* @implemented
*/
-PVOID STDCALL
+PVOID NTAPI
VideoPortAllocatePool(
IN PVOID HwDeviceExtension,
IN VP_POOL_TYPE PoolType,
@@ -690,7 +690,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortFreePool(
IN PVOID HwDeviceExtension,
IN PVOID Ptr)
@@ -702,7 +702,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortAllocateBuffer(
IN PVOID HwDeviceExtension,
IN ULONG Size,
@@ -717,7 +717,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortReleaseBuffer(
IN PVOID HwDeviceExtension,
IN PVOID Ptr)
@@ -730,7 +730,7 @@
* @unimplemented
*/
-PVOID STDCALL
+PVOID NTAPI
VideoPortLockBuffer(
IN PVOID HwDeviceExtension,
IN PVOID BaseAddress,
@@ -745,7 +745,7 @@
* @unimplemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortUnlockBuffer(
IN PVOID HwDeviceExtension,
IN PVOID Mdl)
@@ -757,7 +757,7 @@
* @unimplemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortSetTrappedEmulatorPorts(
IN PVOID HwDeviceExtension,
IN ULONG NumAccessRanges,
@@ -772,7 +772,7 @@
* @implemented
*/
-ULONG STDCALL
+ULONG NTAPI
VideoPortGetBusData(
IN PVOID HwDeviceExtension,
IN BUS_DATA_TYPE BusDataType,
@@ -807,7 +807,7 @@
* @implemented
*/
-ULONG STDCALL
+ULONG NTAPI
VideoPortSetBusData(
IN PVOID HwDeviceExtension,
IN BUS_DATA_TYPE BusDataType,
_____
Modified: trunk/reactos/drivers/video/videoprt/services.c
--- trunk/reactos/drivers/video/videoprt/services.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/services.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -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 @@
return ERROR_INVALID_FUNCTION;
}
-BOOLEAN STDCALL
+BOOLEAN NTAPI
VideoPortGetAgpServices(
IN PVOID HwDeviceExtension,
OUT PVIDEO_PORT_AGP_SERVICES AgpServices)
_____
Modified: trunk/reactos/drivers/video/videoprt/spinlock.c
--- trunk/reactos/drivers/video/videoprt/spinlock.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/spinlock.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -27,7 +27,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortCreateSpinLock(
IN PVOID HwDeviceExtension,
OUT PSPIN_LOCK *SpinLock)
@@ -44,7 +44,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortDeleteSpinLock(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock)
@@ -58,7 +58,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortAcquireSpinLock(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock,
@@ -72,7 +72,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortAcquireSpinLockAtDpcLevel(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock)
@@ -85,7 +85,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortReleaseSpinLock(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock,
@@ -99,7 +99,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortReleaseSpinLockFromDpcLevel(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock)
_____
Modified: trunk/reactos/drivers/video/videoprt/timer.c
--- trunk/reactos/drivers/video/videoprt/timer.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/timer.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -25,7 +25,7 @@
/* PRIVATE FUNCTIONS
**********************************************************/
-VOID STDCALL
+VOID NTAPI
IntVideoPortTimerRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID ServiceContext)
@@ -38,7 +38,7 @@
&DeviceExtension->MiniPortDeviceExtension);
}
-BOOLEAN STDCALL
+BOOLEAN NTAPI
IntVideoPortSetupTimer(
IN PDEVICE_OBJECT DeviceObject,
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
@@ -73,7 +73,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortStartTimer(IN PVOID HwDeviceExtension)
{
DPRINT("VideoPortStartTimer\n");
@@ -84,7 +84,7 @@
* @implemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortStopTimer(IN PVOID HwDeviceExtension)
{
DPRINT("VideoPortStopTimer\n");
_____
Modified: trunk/reactos/drivers/video/videoprt/videoprt.c
--- trunk/reactos/drivers/video/videoprt/videoprt.c 2005-08-24
20:34:50 UTC (rev 17519)
+++ trunk/reactos/drivers/video/videoprt/videoprt.c 2005-08-24
21:29:24 UTC (rev 17520)
@@ -30,7 +30,7 @@
/* PRIVATE FUNCTIONS
**********************************************************/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
@@ -38,7 +38,7 @@
return STATUS_SUCCESS;
}
-PVOID STDCALL
+PVOID NTAPI
IntVideoPortImageDirectoryEntryToData(
PVOID BaseAddress,
ULONG Directory)
@@ -60,7 +60,7 @@
return (PVOID)((ULONG_PTR)BaseAddress + Va);
}
-PVOID STDCALL
+PVOID NTAPI
IntVideoPortGetProcAddress(
IN PVOID HwDeviceExtension,
IN PUCHAR FunctionName)
@@ -116,7 +116,7 @@
return NULL;
}
-VOID STDCALL
+VOID NTAPI
IntVideoPortDeferredRoutine(
IN PKDPC Dpc,
IN PVOID DeferredContext,
@@ -128,7 +128,7 @@
((PMINIPORT_DPC_ROUTINE)SystemArgument1)(HwDeviceExtension,
SystemArgument2);
}
-ULONG STDCALL
+ULONG NTAPI
IntVideoPortAllocateDeviceNumber(VOID)
{
NTSTATUS Status;
@@ -163,7 +163,7 @@
return DeviceNumber;
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
IntVideoPortCreateAdapterDeviceObject(
IN PDRIVER_OBJECT DriverObject,
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
@@ -308,7 +308,7 @@
/* 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 @@
* @implemented
*/
-ULONG STDCALL
+ULONG NTAPI
VideoPortInitialize(
IN PVOID Context1,
IN PVOID Context2,
@@ -534,10 +534,26 @@
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 @@
{
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 @@
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 @@
}
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 @@
* @unimplemented
*/
-VOID STDCALL
+VOID NTAPI
VideoPortLogError(
IN PVOID HwDeviceExtension,
IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL,
@@ -694,7 +717,7 @@
* @implemented
*/
-UCHAR STDCALL
+UCHAR NTAPI
VideoPortGetCurrentIrql(VOID)
{
return KeGetCurrentIrql();
@@ -707,7 +730,7 @@
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 @@
* @unimplemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortGetRegistryParameters(
IN PVOID HwDeviceExtension,
IN PWSTR ParameterName,
@@ -780,7 +803,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortSetRegistryParameters(
IN PVOID HwDeviceExtension,
IN PWSTR ValueName,
@@ -802,7 +825,7 @@
* @implemented
*/
-VP_STATUS STDCALL
+VP_STATUS NTAPI
VideoPortGetVgaStatus(
IN PVOID HwDeviceExtension,
OUT PULONG VgaStatus)
@@ -830,7 +853,7 @@
* @implemented
*/
-PVOID STDCALL
+PVOID NTAPI
VideoPortGetRomImage(
IN PVOID HwDeviceExtension,
IN PVOID Unused1,
@@ -888,7 +911,7 @@
* @implemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
VideoPortScanRom(
IN PVOID HwDeviceExtension,
IN PUCHAR RomBase,
@@ -922,7 +945,7 @@
* @implemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
VideoPortSynchronizeExecution(
IN PVOID HwDeviceExtension,
IN VIDEO_SYNCHRONIZE_PRIORITY Priority,
@@ -972,7 +995,7 @@
* @implemented
*/
[truncated at 1000 lines; 261 more skipped]