diff --git a/reactos/drivers/video/videoprt/funclist.c b/reactos/drivers/video/videoprt/funclist.c new file mode 100644 index 00000000000..6a5b0288bcb --- /dev/null +++ b/reactos/drivers/video/videoprt/funclist.c @@ -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; +} diff --git a/reactos/drivers/video/videoprt/videoprt.c b/reactos/drivers/video/videoprt/videoprt.c index 29e324e3480..34b12946550 100644 --- a/reactos/drivers/video/videoprt/videoprt.c +++ b/reactos/drivers/video/videoprt/videoprt.c @@ -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, diff --git a/reactos/drivers/video/videoprt/videoprt.h b/reactos/drivers/video/videoprt/videoprt.h index 16a3c418623..90d87941b3f 100644 --- a/reactos/drivers/video/videoprt/videoprt.h +++ b/reactos/drivers/video/videoprt/videoprt.h @@ -34,7 +34,7 @@ #include #include -#define NDEBUG +//#define NDEBUG #include #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 diff --git a/reactos/drivers/video/videoprt/videoprt.rbuild b/reactos/drivers/video/videoprt/videoprt.rbuild index bab519de5e1..cac639803a7 100644 --- a/reactos/drivers/video/videoprt/videoprt.rbuild +++ b/reactos/drivers/video/videoprt/videoprt.rbuild @@ -14,6 +14,7 @@ dispatch.c dma.c event.c + funclist.c int10.c interrupt.c resource.c