[VIDEOPRT]
[reactos.git] / reactos / win32ss / drivers / videoprt / funclist.c
1 /*
2 * VideoPort driver
3 *
4 * Copyright (C) 2007 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #include "videoprt.h"
23
24 #define NDEBUG
25 #include <debug.h>
26
27 typedef struct _VIDEO_PORT_FUNCTION_TABLE {
28 PVOID Address;
29 PCSZ Name;
30 } *PVIDEO_PORT_FUNCTION_TABLE, VIDEO_PORT_FUNCTION_TABLE;
31
32 /* GLOBAL VARIABLES ***********************************************************/
33
34 #define VP_EXPORTED_FUNCS (sizeof(VideoPortExports) / sizeof(*VideoPortExports))
35
36 /* Create an array of entries with pfn, psz, for IntVideoPortGetProcAddress */
37 #define MAKE_ENTRY(FUNCTIONNAME) { FUNCTIONNAME, #FUNCTIONNAME }
38 const VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] = {
39 MAKE_ENTRY(VideoPortQueueDpc),
40 MAKE_ENTRY(VideoPortAllocatePool),
41 MAKE_ENTRY(VideoPortFreePool),
42 MAKE_ENTRY(VideoPortReleaseCommonBuffer),
43 MAKE_ENTRY(VideoPortAllocateCommonBuffer),
44 MAKE_ENTRY(VideoPortCreateSecondaryDisplay),
45 MAKE_ENTRY(VideoPortGetDmaAdapter),
46 MAKE_ENTRY(VideoPortGetVersion),
47 MAKE_ENTRY(VideoPortLockBuffer),
48 MAKE_ENTRY(VideoPortUnlockBuffer),
49 MAKE_ENTRY(VideoPortSetEvent),
50 MAKE_ENTRY(VideoPortClearEvent),
51 MAKE_ENTRY(VideoPortReadStateEvent),
52 MAKE_ENTRY(VideoPortRegisterBugcheckCallback),
53 MAKE_ENTRY(VideoPortCreateEvent),
54 MAKE_ENTRY(VideoPortDeleteEvent),
55 MAKE_ENTRY(VideoPortWaitForSingleObject),
56 MAKE_ENTRY(VideoPortCheckForDeviceExistence),
57 MAKE_ENTRY(VideoPortFlushRegistry),
58 MAKE_ENTRY(VideoPortQueryPerformanceCounter),
59 };
60 #undef MAKE_ENTRY
61
62 PVOID NTAPI
63 IntVideoPortGetProcAddress(
64 IN PVOID HwDeviceExtension,
65 IN PUCHAR FunctionName)
66 {
67 ULONG i = 0;
68
69 TRACE_(VIDEOPRT, "VideoPortGetProcAddress(%s)\n", FunctionName);
70
71 /* Search by name */
72
73 for (i = 0; i < VP_EXPORTED_FUNCS; i++)
74 {
75 if (!strcmp((PCHAR)FunctionName, VideoPortExports[i].Name))
76 {
77 return (PVOID)VideoPortExports[i].Address;
78 }
79 }
80
81 ERR_(VIDEOPRT, "VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
82
83 return NULL;
84 }