ReactOS 0.4.15-dev-8058-ga7cbb60
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 "framebuf.h"
22
24{
37
38};
39
40/*
41 * DrvEnableDirectDraw
42 */
43
46 DHPDEV dhpdev,
47 DD_CALLBACKS *pCallbacks,
48 DD_SURFACECALLBACKS *pSurfaceCallbacks,
49 DD_PALETTECALLBACKS *pPaletteCallbacks)
50{
51 RtlZeroMemory(pCallbacks, sizeof(*pCallbacks));
52 RtlZeroMemory(pSurfaceCallbacks, sizeof(*pSurfaceCallbacks));
53 RtlZeroMemory(pPaletteCallbacks, sizeof(*pPaletteCallbacks));
54
55 pCallbacks->dwSize = sizeof(*pCallbacks);
56 pSurfaceCallbacks->dwSize = sizeof(*pSurfaceCallbacks);
57 pPaletteCallbacks->dwSize = sizeof(*pPaletteCallbacks);
58
59 /* We don't support any optional callback */
60
61 return TRUE;
62}
63
64/*
65 * DrvDisableDirectDraw
66 */
67
70 DHPDEV dhpdev)
71{
72}
73
74/*
75 * DrvEnableDriver
76 *
77 * Initial driver entry point exported by the driver DLL. It fills in a
78 * DRVENABLEDATA structure with the driver's DDI version number and the
79 * calling addresses of all DDI functions supported by the driver.
80 *
81 * Status
82 * @implemented
83 */
84
87 ULONG iEngineVersion,
88 ULONG cj,
89 PDRVENABLEDATA pded)
90{
91 if (cj >= sizeof(DRVENABLEDATA))
92 {
93 pded->c = sizeof(DrvFunctionTable) / sizeof(DRVFN);
96 return TRUE;
97 }
98 else
99 {
100 return FALSE;
101 }
102}
103
104/*
105 * DrvEnablePDEV
106 *
107 * Returns a description of the physical device's characteristics to GDI.
108 *
109 * Status
110 * @implemented
111 */
112
115 IN DEVMODEW *pdm,
117 IN ULONG cPat,
118 OUT HSURF *phsurfPatterns,
120 OUT ULONG *pdevcaps,
122 OUT DEVINFO *pdi,
123 IN HDEV hdev,
126{
127 PPDEV ppdev;
128 GDIINFO GdiInfo;
129 DEVINFO DevInfo;
130
131 ppdev = EngAllocMem(FL_ZERO_MEMORY, sizeof(PDEV), ALLOC_TAG);
132 if (ppdev == NULL)
133 {
134 return NULL;
135 }
136
137 ppdev->hDriver = hDriver;
138
139 if (!IntInitScreenInfo(ppdev, pdm, &GdiInfo, &DevInfo))
140 {
141 EngFreeMem(ppdev);
142 return NULL;
143 }
144
145 if (!IntInitDefaultPalette(ppdev, &DevInfo))
146 {
147 EngFreeMem(ppdev);
148 return NULL;
149 }
150
151 memcpy(pdi, &DevInfo, min(sizeof(DEVINFO), cjDevInfo));
152 memcpy(pdevcaps, &GdiInfo, min(sizeof(GDIINFO), cjCaps));
153
154 return (DHPDEV)ppdev;
155}
156
157/*
158 * DrvCompletePDEV
159 *
160 * Stores the GDI handle (hdev) of the physical device in dhpdev. The driver
161 * should retain this handle for use when calling GDI services.
162 *
163 * Status
164 * @implemented
165 */
166
169 IN DHPDEV dhpdev,
170 IN HDEV hdev)
171{
172 ((PPDEV)dhpdev)->hDevEng = hdev;
173}
174
175/*
176 * DrvDisablePDEV
177 *
178 * Release the resources allocated in DrvEnablePDEV. If a surface has been
179 * enabled DrvDisableSurface will have already been called.
180 *
181 * Status
182 * @implemented
183 */
184
187 IN DHPDEV dhpdev)
188{
189 if (((PPDEV)dhpdev)->DefaultPalette)
190 {
192 }
193
194 if (((PPDEV)dhpdev)->PaletteEntries != NULL)
195 {
196 EngFreeMem(((PPDEV)dhpdev)->PaletteEntries);
197 }
198
199 EngFreeMem(dhpdev);
200}
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 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
DWORD dwSize
Definition: ddrawint.h:498
Definition: winddi.h:529
Definition: framebuf.h:34
HANDLE hDriver
Definition: framebuf.h:35
ULONG iDriverVersion
Definition: winddi.h:542
DRVFN * pdrvfn
Definition: winddi.h:544
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#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_DrvDisableDirectDraw DrvDisableDirectDraw
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_DrvEnableDirectDraw
Definition: winddi.h:476
#define INDEX_DrvMovePointer
Definition: winddi.h:446
_In_ HDEV hdev
Definition: winddi.h:3449
#define INDEX_DrvDisableDirectDraw
Definition: winddi.h:477
_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
FN_DrvEnableDirectDraw DrvEnableDirectDraw
_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