mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Rewrite IntVideoPortGetProcAddress() implementation to use a lookup table instead of doing a wrong call to ZwQuerySystemInformation() which always returned STATUS_IMAGE_ALREADY_LOADED (it's supposed to return this). MS's VideoPort seems to do it in a similar way, because it doesn't import neither ZwQSI() nor MmLoadSystemImage().
- VMWare's video driver now calls VideoPortCreateSecondaryDisplay(), without much success though (it's unimplemented). svn path=/trunk/; revision=29323
This commit is contained in:
parent
434c242504
commit
3d024aa55b
4 changed files with 71 additions and 57 deletions
64
reactos/drivers/video/videoprt/funclist.c
Normal file
64
reactos/drivers/video/videoprt/funclist.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* VideoPort driver
|
||||
*
|
||||
* Copyright (C) 2007 ReactOS Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; see the file COPYING.LIB.
|
||||
* If not, write to the Free Software Foundation,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id: videoprt.c 28975 2007-09-09 12:39:11Z fireball $
|
||||
*/
|
||||
|
||||
|
||||
#include "videoprt.h"
|
||||
|
||||
typedef struct _VIDEO_PORT_FUNCTION_TABLE {
|
||||
PVOID Address;
|
||||
PUCHAR Name;
|
||||
} *PVIDEO_PORT_FUNCTION_TABLE, VIDEO_PORT_FUNCTION_TABLE;
|
||||
|
||||
/* GLOBAL VARIABLES ***********************************************************/
|
||||
|
||||
#define VP_EXPORTED_FUNCS 1
|
||||
|
||||
UCHAR FN_VideoPortCreateSecondaryDisplay[] = "VideoPortCreateSecondaryDisplay";
|
||||
|
||||
VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] = {
|
||||
{VideoPortCreateSecondaryDisplay, FN_VideoPortCreateSecondaryDisplay}
|
||||
};
|
||||
|
||||
PVOID NTAPI
|
||||
IntVideoPortGetProcAddress(
|
||||
IN PVOID HwDeviceExtension,
|
||||
IN PUCHAR FunctionName)
|
||||
{
|
||||
ULONG i = 0;
|
||||
|
||||
DPRINT("VideoPortGetProcAddress(%s)\n", FunctionName);
|
||||
|
||||
/* Search by name */
|
||||
for (i = 0; i < VP_EXPORTED_FUNCS; i++)
|
||||
{
|
||||
if (!_strnicmp((PCHAR)FunctionName, (PCHAR)VideoPortExports[i].Name,
|
||||
strlen((PCHAR)FunctionName)))
|
||||
{
|
||||
return (PVOID)VideoPortExports[i].Address;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -63,62 +63,6 @@ IntVideoPortImageDirectoryEntryToData(
|
|||
return (PVOID)((ULONG_PTR)BaseAddress + Va);
|
||||
}
|
||||
|
||||
PVOID NTAPI
|
||||
IntVideoPortGetProcAddress(
|
||||
IN PVOID HwDeviceExtension,
|
||||
IN PUCHAR FunctionName)
|
||||
{
|
||||
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
||||
PVOID BaseAddress;
|
||||
PIMAGE_EXPORT_DIRECTORY ExportDir;
|
||||
PUSHORT OrdinalPtr;
|
||||
PULONG NamePtr;
|
||||
PULONG AddressPtr;
|
||||
ULONG i = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("VideoPortGetProcAddress(%s)\n", FunctionName);
|
||||
|
||||
RtlInitUnicodeString(&GdiDriverInfo.DriverName, L"videoprt");
|
||||
Status = ZwSetSystemInformation(
|
||||
SystemLoadGdiDriverInformation,
|
||||
&GdiDriverInfo,
|
||||
sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Couldn't get our own module handle?\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BaseAddress = GdiDriverInfo.ImageAddress;
|
||||
|
||||
/* Get the pointer to the export directory */
|
||||
ExportDir = (PIMAGE_EXPORT_DIRECTORY)IntVideoPortImageDirectoryEntryToData(
|
||||
BaseAddress,
|
||||
IMAGE_DIRECTORY_ENTRY_EXPORT);
|
||||
|
||||
/* Search by name */
|
||||
AddressPtr = (PULONG)
|
||||
((ULONG_PTR)BaseAddress + (ULONG_PTR)ExportDir->AddressOfFunctions);
|
||||
OrdinalPtr = (PUSHORT)
|
||||
((ULONG_PTR)BaseAddress + (ULONG_PTR)ExportDir->AddressOfNameOrdinals);
|
||||
NamePtr = (PULONG)
|
||||
((ULONG_PTR)BaseAddress + (ULONG_PTR)ExportDir->AddressOfNames);
|
||||
for (i = 0; i < ExportDir->NumberOfNames; i++, NamePtr++, OrdinalPtr++)
|
||||
{
|
||||
if (!_strnicmp((PCHAR)FunctionName, (PCHAR)((ULONG_PTR)BaseAddress + *NamePtr),
|
||||
strlen((PCHAR)FunctionName)))
|
||||
{
|
||||
return (PVOID)((ULONG_PTR)BaseAddress +
|
||||
(ULONG_PTR)AddressPtr[*OrdinalPtr]);
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
IntVideoPortDeferredRoutine(
|
||||
IN PKDPC Dpc,
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <ndk/ntndk.h>
|
||||
#include <reactos/helper.h>
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#define TAG_VIDEO_PORT TAG('V', 'I', 'D', 'P')
|
||||
|
@ -222,6 +222,11 @@ IntVideoPortFindAdapter(
|
|||
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||
IN PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
PVOID NTAPI
|
||||
IntVideoPortGetProcAddress(
|
||||
IN PVOID HwDeviceExtension,
|
||||
IN PUCHAR FunctionName);
|
||||
|
||||
/* int10.c */
|
||||
|
||||
VP_STATUS NTAPI
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<file>dispatch.c</file>
|
||||
<file>dma.c</file>
|
||||
<file>event.c</file>
|
||||
<file>funclist.c</file>
|
||||
<file>int10.c</file>
|
||||
<file>interrupt.c</file>
|
||||
<file>resource.c</file>
|
||||
|
|
Loading…
Reference in a new issue