Create a branch for working on csrss and co.
[reactos.git] / win32ss / reactx / dxg / dxg_int.h
1 #include <ntifs.h>
2
3 /* Win32 Headers */
4 #define WINBASEAPI
5 #define STARTF_USESIZE 2
6 #define STARTF_USEPOSITION 4
7 #define INTERNAL_CALL NTAPI
8 #define NT_BUILD_ENVIRONMENT
9
10 #include <windef.h>
11 #include <winerror.h>
12 #include <wingdi.h>
13 #include <winddi.h>
14
15 /* DXG treats this as opaque */
16 typedef PVOID PDC;
17 typedef PVOID PW32THREAD;
18
19 typedef struct _DD_BASEOBJECT
20 {
21 HGDIOBJ hHmgr;
22 ULONG ulShareCount;
23 USHORT cExclusiveLock;
24 USHORT BaseFlags;
25 PW32THREAD Tid;
26 } DD_BASEOBJECT, *PDD_BASEOBJECT;
27
28 #include <drivers/directx/directxint.h>
29 #include <drivers/directx/dxg.h>
30 #include <drivers/directx/dxeng.h>
31
32 #include "tags.h"
33
34 #define ObjType_DDSURFACE_TYPE 2
35 #define ObjType_DDVIDEOPORT_TYPE 4
36 #define ObjType_DDMOTIONCOMP_TYPE 5
37
38 typedef struct _DD_ENTRY
39 {
40 union
41 {
42 PDD_BASEOBJECT pobj;
43 HANDLE hFree;
44 };
45 union
46 {
47 ULONG ulObj;
48 struct
49 {
50 USHORT Count;
51 USHORT Lock;
52 HANDLE Pid;
53 };
54 } ObjectOwner;
55 USHORT FullUnique;
56 UCHAR Objt;
57 UCHAR Flags;
58 PVOID pUser;
59 } DD_ENTRY, *PDD_ENTRY;
60
61 typedef struct _EDD_SURFACE_LOCAL
62 {
63 DD_BASEOBJECT Object;
64 DD_SURFACE_LOCAL Surfacelcl;
65 } EDD_SURFACE_LOCAL, *PEDD_SURFACE_LOCAL;
66
67 /* exported functions */
68 NTSTATUS NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2);
69 NTSTATUS NTAPI GsDriverEntry(IN PVOID Context1, IN PVOID Context2);
70 NTSTATUS APIENTRY DxDdCleanupDxGraphics(VOID);
71
72 /* Global pointers */
73 extern ULONG gcSizeDdHmgr;
74 extern PDD_ENTRY gpentDdHmgr;
75 extern ULONG gcMaxDdHmgr;
76 extern PDD_ENTRY gpentDdHmgrLast;
77 extern HANDLE ghFreeDdHmgr;
78 extern HSEMAPHORE ghsemHmgr;
79 extern LONG gcDummyPageRefCnt;
80 extern HSEMAPHORE ghsemDummyPage;
81 extern VOID *gpDummyPage;
82 extern PEPROCESS gpepSession;
83 extern PLARGE_INTEGER gpLockShortDelay;
84
85 /* Driver list export functions */
86 DWORD NTAPI DxDxgGenericThunk(ULONG_PTR ulIndex, ULONG_PTR ulHandle, SIZE_T *pdwSizeOfPtr1, PVOID pvPtr1, SIZE_T *pdwSizeOfPtr2, PVOID pvPtr2);
87 DWORD NTAPI DxDdIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize);
88 PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface);
89 BOOL NTAPI DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface);
90
91 /* Internal functions */
92 BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry);
93 BOOL FASTCALL DdHmgCreate(VOID);
94 BOOL FASTCALL DdHmgDestroy(VOID);
95 PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned);
96
97 /* define stuff */
98 #define drvDxEngLockDC gpEngFuncs[DXENG_INDEX_DxEngLockDC]
99 #define drvDxEngGetDCState gpEngFuncs[DXENG_INDEX_DxEngGetDCState]
100 #define drvDxEngGetHdevData gpEngFuncs[DXENG_INDEX_DxEngGetHdevData]
101 #define drvDxEngUnlockDC gpEngFuncs[DXENG_INDEX_DxEngUnlockDC]
102 #define drvDxEngUnlockHdev gpEngFuncs[DXENG_INDEX_DxEngUnlockHdev]
103 #define drvDxEngLockHdev gpEngFuncs[DXENG_INDEX_DxEngLockHdev]