Skip to content

Commit 24e88af

Browse files
committed
[VIDEOPRT][DDK] services.c: Reformat; update/fix SAL annotations (reactos#8450)
NOTA: 2nd parameter `AgpServices` of `VideoPortGetAgpServices()` is documented as "In", but should be "Out" as it receives information.
1 parent 267e3d8 commit 24e88af

File tree

3 files changed

+80
-74
lines changed

3 files changed

+80
-74
lines changed

sdk/include/ddk/video.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,9 +1067,9 @@ VPAPI
10671067
VP_STATUS
10681068
NTAPI
10691069
VideoPortQueryServices(
1070-
IN PVOID HwDeviceExtension,
1071-
IN VIDEO_PORT_SERVICES ServicesType,
1072-
IN OUT PINTERFACE Interface);
1070+
_In_ PVOID HwDeviceExtension,
1071+
_In_ VIDEO_PORT_SERVICES ServicesType,
1072+
_Inout_ PINTERFACE Interface);
10731073

10741074
VPAPI
10751075
BOOLEAN

sdk/include/ddk/videoagp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ typedef struct _VIDEO_PORT_AGP_SERVICES {
111111
BOOLEAN
112112
NTAPI
113113
VideoPortGetAgpServices(
114-
IN PVOID HwDeviceExtension,
115-
IN PVIDEO_PORT_AGP_SERVICES AgpServices);
114+
_In_ PVOID HwDeviceExtension,
115+
_Out_ PVIDEO_PORT_AGP_SERVICES AgpServices);
116116

117117
#ifdef __cplusplus
118118
}

win32ss/drivers/videoprt/services.c

Lines changed: 75 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -24,95 +24,101 @@
2424
#define NDEBUG
2525
#include <debug.h>
2626

27-
VOID NTAPI
28-
IntInterfaceReference(PVOID Context)
27+
VOID
28+
NTAPI
29+
IntInterfaceReference(
30+
_In_ PVOID Context)
2931
{
30-
/* Do nothing */
32+
/* Do nothing */
3133
}
3234

33-
VOID NTAPI
34-
IntInterfaceDereference(PVOID Context)
35+
VOID
36+
NTAPI
37+
IntInterfaceDereference(
38+
_In_ PVOID Context)
3539
{
36-
/* Do nothing */
40+
/* Do nothing */
3741
}
3842

39-
VP_STATUS NTAPI
43+
VP_STATUS
44+
NTAPI
4045
VideoPortQueryServices(
41-
IN PVOID HwDeviceExtension,
42-
IN VIDEO_PORT_SERVICES ServicesType,
43-
IN OUT PINTERFACE Interface)
46+
_In_ PVOID HwDeviceExtension,
47+
_In_ VIDEO_PORT_SERVICES ServicesType,
48+
_Inout_ PINTERFACE Interface)
4449
{
45-
TRACE_(VIDEOPRT, "VideoPortQueryServices - ServicesType: 0x%x\n", ServicesType);
46-
47-
switch (ServicesType)
48-
{
49-
case VideoPortServicesInt10:
50-
if (Interface->Version >= VIDEO_PORT_INT10_INTERFACE_VERSION_1 ||
51-
Interface->Size >= sizeof(VIDEO_PORT_INT10_INTERFACE))
52-
{
53-
VIDEO_PORT_INT10_INTERFACE *Int10Interface =
54-
(VIDEO_PORT_INT10_INTERFACE *)Interface;
55-
56-
Interface->InterfaceReference = IntInterfaceReference;
57-
Interface->InterfaceDereference = IntInterfaceDereference;
58-
Int10Interface->Int10AllocateBuffer = IntInt10AllocateBuffer;
59-
Int10Interface->Int10FreeBuffer = IntInt10FreeBuffer;
60-
Int10Interface->Int10ReadMemory = IntInt10ReadMemory;
61-
Int10Interface->Int10WriteMemory = IntInt10WriteMemory;
62-
Int10Interface->Int10CallBios = IntInt10CallBios;
63-
return NO_ERROR;
64-
}
65-
break;
66-
67-
case VideoPortServicesAGP:
68-
if ((Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_2 &&
69-
Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE_2)) ||
70-
(Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_1 &&
71-
Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE)))
72-
{
73-
if (NT_SUCCESS(IntAgpGetInterface(HwDeviceExtension, Interface)))
50+
TRACE_(VIDEOPRT, "VideoPortQueryServices - ServicesType: 0x%x\n", ServicesType);
51+
52+
switch (ServicesType)
53+
{
54+
case VideoPortServicesInt10:
55+
if (Interface->Version >= VIDEO_PORT_INT10_INTERFACE_VERSION_1 ||
56+
Interface->Size >= sizeof(VIDEO_PORT_INT10_INTERFACE))
57+
{
58+
PVIDEO_PORT_INT10_INTERFACE Int10Interface =
59+
(PVIDEO_PORT_INT10_INTERFACE)Interface;
60+
61+
Interface->InterfaceReference = IntInterfaceReference;
62+
Interface->InterfaceDereference = IntInterfaceDereference;
63+
Int10Interface->Int10AllocateBuffer = IntInt10AllocateBuffer;
64+
Int10Interface->Int10FreeBuffer = IntInt10FreeBuffer;
65+
Int10Interface->Int10ReadMemory = IntInt10ReadMemory;
66+
Int10Interface->Int10WriteMemory = IntInt10WriteMemory;
67+
Int10Interface->Int10CallBios = IntInt10CallBios;
68+
return NO_ERROR;
69+
}
70+
break;
71+
72+
case VideoPortServicesAGP:
73+
if ((Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_2 &&
74+
Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE_2)) ||
75+
(Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_1 &&
76+
Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE)))
7477
{
75-
return NO_ERROR;
78+
if (NT_SUCCESS(IntAgpGetInterface(HwDeviceExtension, Interface)))
79+
{
80+
return NO_ERROR;
81+
}
7682
}
77-
}
78-
break;
83+
break;
7984

80-
case VideoPortServicesI2C:
81-
UNIMPLEMENTED;
82-
return ERROR_INVALID_FUNCTION;
85+
case VideoPortServicesI2C:
86+
UNIMPLEMENTED;
87+
return ERROR_INVALID_FUNCTION;
8388

84-
case VideoPortServicesHeadless:
85-
UNIMPLEMENTED;
86-
return ERROR_INVALID_FUNCTION;
89+
case VideoPortServicesHeadless:
90+
UNIMPLEMENTED;
91+
return ERROR_INVALID_FUNCTION;
8792

88-
default:
89-
break;
90-
}
93+
default:
94+
break;
95+
}
9196

92-
return ERROR_INVALID_FUNCTION;
97+
return ERROR_INVALID_FUNCTION;
9398
}
9499

95-
BOOLEAN NTAPI
100+
BOOLEAN
101+
NTAPI
96102
VideoPortGetAgpServices(
97-
IN PVOID HwDeviceExtension,
98-
OUT PVIDEO_PORT_AGP_SERVICES AgpServices)
103+
_In_ PVOID HwDeviceExtension,
104+
_Out_ PVIDEO_PORT_AGP_SERVICES AgpServices)
99105
{
100-
VIDEO_PORT_AGP_INTERFACE Interface;
101-
VP_STATUS Status;
106+
VIDEO_PORT_AGP_INTERFACE Interface;
107+
VP_STATUS Status;
102108

103-
TRACE_(VIDEOPRT, "VideoPortGetAgpServices\n");
109+
TRACE_(VIDEOPRT, "VideoPortGetAgpServices\n");
104110

105-
Interface.Size = sizeof(Interface);
106-
Interface.Version = VIDEO_PORT_AGP_INTERFACE_VERSION_1;
111+
Interface.Size = sizeof(Interface);
112+
Interface.Version = VIDEO_PORT_AGP_INTERFACE_VERSION_1;
107113

108-
Status = VideoPortQueryServices(HwDeviceExtension, VideoPortServicesAGP,
109-
(PINTERFACE)&Interface);
110-
if (Status != NO_ERROR)
111-
{
112-
WARN_(VIDEOPRT, "VideoPortQueryServices() failed!\n");
113-
return FALSE;
114-
}
114+
Status = VideoPortQueryServices(HwDeviceExtension, VideoPortServicesAGP,
115+
(PINTERFACE)&Interface);
116+
if (Status != NO_ERROR)
117+
{
118+
WARN_(VIDEOPRT, "VideoPortQueryServices() failed!\n");
119+
return FALSE;
120+
}
115121

116-
RtlCopyMemory(AgpServices, &Interface.AgpReservePhysical, sizeof(VIDEO_PORT_AGP_SERVICES));
117-
return TRUE;
122+
RtlCopyMemory(AgpServices, &Interface.AgpReservePhysical, sizeof(*AgpServices));
123+
return TRUE;
118124
}

0 commit comments

Comments
 (0)