Skip to content

Commit 824a51e

Browse files
committed
[VIDEOPRT] Minor maintenance for IntVideoPortGetProcAddress() (reactos#8444)
- SAL-ify `IntVideoPortGetProcAddress()`. Sadly its 2nd parameter needs to stay `PUCHAR` to comply with the `PVIDEO_PORT_GET_PROC_ADDRESS` type. - Append `VideoPortQuerySystemTime` to the array of exports (Vista+ compatibility). Note that probably because of a copy-pasta error, Windows' VideoPrt duplicates the `VideoPortMapDmaMemory` entry in between those of `VideoPortFreeCommonBuffer` and `VideoPortReleaseBuffer`.
1 parent 44931d7 commit 824a51e

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

win32ss/drivers/videoprt/funclist.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@
2424
#define NDEBUG
2525
#include <debug.h>
2626

27-
typedef struct _VIDEO_PORT_FUNCTION_TABLE {
28-
PVOID Address;
27+
typedef struct _VIDEO_PORT_FUNCTION_TABLE
28+
{
2929
PCSZ Name;
30-
} *PVIDEO_PORT_FUNCTION_TABLE, VIDEO_PORT_FUNCTION_TABLE;
30+
PVOID Address;
31+
} VIDEO_PORT_FUNCTION_TABLE, *PVIDEO_PORT_FUNCTION_TABLE;
3132

3233
/* GLOBAL VARIABLES ***********************************************************/
3334

34-
/* Create an array of entries with pfn, psz, for IntVideoPortGetProcAddress */
35-
#define MAKE_ENTRY(FUNCTIONNAME) { FUNCTIONNAME, #FUNCTIONNAME }
36-
const VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] = {
35+
/* Create an array of entries {Name, Address} for IntVideoPortGetProcAddress */
36+
#define MAKE_ENTRY(FUNCTIONNAME) { #FUNCTIONNAME, FUNCTIONNAME }
37+
const VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] =
38+
{
3739
MAKE_ENTRY(VideoPortDDCMonitorHelper),
3840
MAKE_ENTRY(VideoPortDoDma),
3941
MAKE_ENTRY(VideoPortGetCommonBuffer),
@@ -93,28 +95,29 @@ const VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] = {
9395
MAKE_ENTRY(VideoPortQueryPerformanceCounter),
9496
MAKE_ENTRY(VideoPortGetVersion),
9597
MAKE_ENTRY(VideoPortRegisterBugcheckCallback),
98+
#if (NTDDI_VERSION >= NTDDI_VISTA)
99+
MAKE_ENTRY(VideoPortQuerySystemTime),
100+
#endif
96101
};
97102
#undef MAKE_ENTRY
98103

99-
PVOID NTAPI
104+
PVOID
105+
NTAPI
100106
IntVideoPortGetProcAddress(
101-
IN PVOID HwDeviceExtension,
102-
IN PUCHAR FunctionName)
107+
_In_ PVOID HwDeviceExtension,
108+
_In_ PUCHAR FunctionName)
103109
{
104110
ULONG i;
105111

106112
TRACE_(VIDEOPRT, "VideoPortGetProcAddress(%s)\n", FunctionName);
107113

108-
/* Search by name */
114+
/* Search by name */
109115
for (i = 0; i < ARRAYSIZE(VideoPortExports); i++)
110116
{
111117
if (!strcmp((PCHAR)FunctionName, VideoPortExports[i].Name))
112-
{
113-
return (PVOID)VideoPortExports[i].Address;
114-
}
118+
return VideoPortExports[i].Address;
115119
}
116120

117121
ERR_(VIDEOPRT, "VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
118-
119122
return NULL;
120123
}

win32ss/drivers/videoprt/videoprt.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,11 @@ IntVideoPortFindAdapter(
279279
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
280280
IN PDEVICE_OBJECT DeviceObject);
281281

282-
PVOID NTAPI
282+
PVOID
283+
NTAPI
283284
IntVideoPortGetProcAddress(
284-
IN PVOID HwDeviceExtension,
285-
IN PUCHAR FunctionName);
285+
_In_ PVOID HwDeviceExtension,
286+
_In_ PUCHAR FunctionName);
286287

287288
NTSTATUS NTAPI
288289
IntVideoPortEnumerateChildren(

0 commit comments

Comments
 (0)