ReactOS 0.4.15-dev-6068-g8061a6f
enable.c
Go to the documentation of this file.
1/*
2 * ReactOS Generic Framebuffer display driver
3 *
4 * Copyright (C) 2004 Filip Navara
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include "framebufacc.h"
22
24{
35
36};
37
38/*
39 * DrvEnableDriver
40 *
41 * Initial driver entry point exported by the driver DLL. It fills in a
42 * DRVENABLEDATA structure with the driver's DDI version number and the
43 * calling addresses of all DDI functions supported by the driver.
44 *
45 * Status
46 * @implemented
47 */
48
51 ULONG iEngineVersion,
52 ULONG cj,
53 PDRVENABLEDATA pded)
54{
55 if (cj >= sizeof(DRVENABLEDATA))
56 {
57 pded->c = sizeof(DrvFunctionTable) / sizeof(DRVFN);
60 return TRUE;
61 }
62 else
63 {
64 return FALSE;
65 }
66}
67
68/*
69 * DrvEnablePDEV
70 *
71 * Returns a description of the physical device's characteristics to GDI.
72 *
73 * Status
74 * @implemented
75 */
76
79 IN DEVMODEW *pdm,
82 OUT HSURF *phsurfPatterns,
84 OUT ULONG *pdevcaps,
87 IN HDEV hdev,
90{
91 PPDEV ppdev;
92 GDIINFO GdiInfo;
93 DEVINFO DevInfo;
94 ULONG returnedDataLength = 0;
95
96 ppdev = EngAllocMem(FL_ZERO_MEMORY, sizeof(PDEV), ALLOC_TAG);
97 if (ppdev == NULL)
98 {
99 return NULL;
100 }
101
102 ppdev->hDriver = hDriver;
103
104 if (!IntInitScreenInfo(ppdev, pdm, &GdiInfo, &DevInfo))
105 {
106 EngFreeMem(ppdev);
107 return NULL;
108 }
109
110 /* hw mouse pointer */
111
112 ppdev->pPointerAttributes = NULL;
113 ppdev->PointerAttributesSize = 0;
114
115 /* Test see if the driver support hw mouse or not */
116 if (!EngDeviceIoControl(ppdev->hDriver,
118 NULL,
119 sizeof(PVIDEO_MODE),
120 &ppdev->PointerCapabilities,
122 &returnedDataLength))
123 {
124 /* Test see if we got a hw mouse or not */
127 {
128 /* determent the hw mouse mode */
130 {
131 DevInfo.flGraphicsCaps &= ~GCAPS_ASYNCMOVE;
132 }
133 else
134 {
136 }
137 }
138 }
139
140 /* setup paletted */
141 if (!IntInitDefaultPalette(ppdev, &DevInfo))
142 {
143 EngFreeMem(ppdev);
144 return NULL;
145 }
146
147 memcpy(pdi, &DevInfo, min(sizeof(DEVINFO), cjDevInfo));
148 memcpy(pdevcaps, &GdiInfo, min(sizeof(GDIINFO), cjCaps));
149
150 return (DHPDEV)ppdev;
151}
152
153/*
154 * DrvCompletePDEV
155 *
156 * Stores the GDI handle (hdev) of the physical device in dhpdev. The driver
157 * should retain this handle for use when calling GDI services.
158 *
159 * Status
160 * @implemented
161 */
162
165 IN DHPDEV dhpdev,
166 IN HDEV hdev)
167{
168 ((PPDEV)dhpdev)->hDevEng = hdev;
169}
170
171/*
172 * DrvDisablePDEV
173 *
174 * Release the resources allocated in DrvEnablePDEV. If a surface has been
175 * enabled DrvDisableSurface will have already been called.
176 *
177 * Status
178 * @implemented
179 */
180
183 IN DHPDEV dhpdev)
184{
185 if (((PPDEV)dhpdev)->DefaultPalette)
186 {
188 }
189
190 if (((PPDEV)dhpdev)->PaletteEntries != NULL)
191 {
192 EngFreeMem(((PPDEV)dhpdev)->PaletteEntries);
193 }
194
195 EngFreeMem(dhpdev);
196}
static const UCHAR DefaultPalette[]
Definition: blue.c:69
#define ALLOC_TAG
Definition: btrfs_drv.h:87
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL IntInitScreenInfo(PPDEV ppdev, LPDEVMODEW pDevMode, PGDIINFO pGdiInfo, PDEVINFO pDevInfo)
Definition: screen.c:120
struct _PDEV * PPDEV
BOOL IntInitDefaultPalette(PPDEV ppdev, PDEVINFO pDevInfo)
Definition: palette.c:60
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define min(a, b)
Definition: monoChain.cc:55
#define VIDEO_MODE_MONO_POINTER
Definition: ntddvdeo.h:455
#define IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES
Definition: ntddvdeo.h:128
#define VIDEO_MODE_ASYNC_POINTER
Definition: ntddvdeo.h:454
#define VIDEO_MODE_COLOR_POINTER
Definition: ntddvdeo.h:456
#define EngFreeMem
Definition: polytest.cpp:56
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
FLONG flGraphicsCaps
Definition: winddi.h:390
Definition: winddi.h:529
Definition: framebuf.h:34
VIDEO_POINTER_CAPABILITIES PointerCapabilities
Definition: driver.h:44
ULONG PointerAttributesSize
Definition: framebufacc.h:64
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes
Definition: driver.h:45
HANDLE hDriver
Definition: framebuf.h:35
ULONG iDriverVersion
Definition: winddi.h:542
DRVFN * pdrvfn
Definition: winddi.h:544
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
static DRVFN DrvFunctionTable[]
Definition: enable.c:23
#define INDEX_DrvSetPointerShape
Definition: winddi.h:445
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG cjDevInfo
Definition: winddi.h:3553
LONG_PTR(APIENTRY * PFN)()
Definition: winddi.h:133
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm
FN_DrvSetPalette DrvSetPalette
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3554
#define INDEX_DrvDisableSurface
Definition: winddi.h:420
#define INDEX_DrvMovePointer
Definition: winddi.h:446
_In_ HDEV hdev
Definition: winddi.h:3449
_In_ LPWSTR pwszLogAddress
Definition: winddi.h:3548
FN_DrvSetPointerShape DrvSetPointerShape
FN_DrvGetModes DrvGetModes
#define INDEX_DrvCompletePDEV
Definition: winddi.h:417
ENGAPI BOOL APIENTRY EngDeletePalette(_In_ _Post_ptr_invalid_ HPALETTE hpal)
#define INDEX_DrvSetPalette
Definition: winddi.h:438
_In_ ULONG cj
Definition: winddi.h:3540
FN_DrvEnableSurface DrvEnableSurface
_In_ LPWSTR _In_ ULONG _In_ ULONG cjCaps
Definition: winddi.h:3551
_In_ LPWSTR _In_ ULONG cPat
Definition: winddi.h:3549
#define INDEX_DrvEnablePDEV
Definition: winddi.h:416
FN_DrvMovePointer DrvMovePointer
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
FN_DrvCompletePDEV DrvCompletePDEV
#define DDI_DRIVER_VERSION_NT5
Definition: winddi.h:537
#define INDEX_DrvAssertMode
Definition: winddi.h:421
#define GCAPS_ASYNCMOVE
Definition: winddi.h:335
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR pwszDeviceName
Definition: winddi.h:3556
FN_DrvEnablePDEV DrvEnablePDEV
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3557
FN_DrvEnableDriver DrvEnableDriver
FN_DrvAssertMode DrvAssertMode
FN_DrvDisableSurface DrvDisableSurface
FN_DrvDisablePDEV DrvDisablePDEV
#define INDEX_DrvEnableSurface
Definition: winddi.h:419
#define INDEX_DrvDisablePDEV
Definition: winddi.h:418
#define INDEX_DrvGetModes
Definition: winddi.h:457
WCHAR * LPWSTR
Definition: xmlstorage.h:184