mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 21:02:36 +00:00
rewrote NtGdiDdQueryDirectDrawObject for I must have been drunk when I wrote it frist time.
Now we manger getting gdientry2 working more or less here is a log how far I have come I have not implement create surface for the drv yet. But it showing lest how far dxhaltest comes. as u all can see it is not far before we getting dx hal working out of the box from win32k and gdi32. I will thank all people that have been invlove in this, DrFred to helping debug betwin ddraw.dll gdi32.dll with his sniffer apps, Alex for GdiEntry2, and some other help, W3seek, Filip, GvG help me to understand how our win32k how it works and some other info. to make so far posible, it is now posible to load a graphic driver directx hal support in ros. But I do not known how well it works yet, after it is the frist public version that working so far. ddraw.c:60) NtGdiDdCreateDirectDrawObject ddraw.c:140) DirectDraw return handler 0x3b6001e4 ddraw.c:170) NtGdiDdQueryDirectDrawObject ddraw.c:247) Found DirectDraw CallBack for 2D and 3D Hal ddraw.c:170) NtGdiDdQueryDirectDrawObject ddraw.c:247) Found DirectDraw CallBack for 2D and 3D Hal ddraw.c:432) NtGdiDdCanCreateSurface ddraw.c:348) NtGdiDdCreateSurface svn path=/trunk/; revision=23160
This commit is contained in:
parent
b1863c2944
commit
8fdd3538a9
1 changed files with 81 additions and 157 deletions
|
@ -30,9 +30,8 @@ BOOL INTERNAL_CALL
|
|||
DD_Cleanup(PVOID ObjectBody)
|
||||
{
|
||||
PDD_DIRECTDRAW pDirectDraw = (PDD_DIRECTDRAW) ObjectBody;
|
||||
#ifdef DX_DEBUG
|
||||
|
||||
DPRINT1("DD_Cleanup\n");
|
||||
#endif
|
||||
|
||||
if (!pDirectDraw)
|
||||
return FALSE;
|
||||
|
@ -47,9 +46,8 @@ DD_Cleanup(PVOID ObjectBody)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
||||
HDC hdc
|
||||
)
|
||||
HANDLE STDCALL
|
||||
NtGdiDdCreateDirectDrawObject(HDC hdc)
|
||||
{
|
||||
DD_CALLBACKS callbacks;
|
||||
DD_SURFACECALLBACKS surface_callbacks;
|
||||
|
@ -85,6 +83,11 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
|||
if (pDC->DriverFunctions.EnableDirectDraw == NULL)
|
||||
{
|
||||
/* Driver doesn't support DirectDraw */
|
||||
|
||||
/*
|
||||
Warring ReactOS complain that pDC are not right owner
|
||||
when DC_UnlockDc(pDC) hit, why ?
|
||||
*/
|
||||
DC_UnlockDc(pDC);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -134,17 +137,14 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
|||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||
DC_UnlockDc(pDC);
|
||||
|
||||
DPRINT1("DirectDraw return handler\n");
|
||||
DPRINT1("DirectDraw return handler 0x%x\n",hDirectDraw);
|
||||
return hDirectDraw;
|
||||
}
|
||||
|
||||
BOOL STDCALL NtGdiDdDeleteDirectDrawObject(
|
||||
HANDLE hDirectDrawLocal
|
||||
)
|
||||
BOOL STDCALL
|
||||
NtGdiDdDeleteDirectDrawObject( HANDLE hDirectDrawLocal)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("NtGdiDdDeleteDirectDrawObject\n");
|
||||
#endif
|
||||
return GDIOBJ_FreeObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
|
||||
}
|
||||
|
||||
|
@ -162,59 +162,42 @@ BOOL STDCALL NtGdiDdQueryDirectDrawObject(
|
|||
DWORD *puFourCC
|
||||
)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DD_HALINFO HalInfo;
|
||||
PDD_DIRECTDRAW pDirectDraw;
|
||||
BOOL success;
|
||||
|
||||
|
||||
DPRINT1("NtGdiDdQueryDirectDrawObject\n");
|
||||
#endif
|
||||
|
||||
/* Check for NULL pointer to prevent any one doing a mistake */
|
||||
|
||||
if (hDirectDrawLocal == NULL)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("warning hDirectDraw handler is NULL, the handler is DDRAWI_DIRECTDRAW_GBL.hDD\n");
|
||||
DPRINT1("and it is NtGdiDdCreateDirectDrawObject return value\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (pHalInfo == NULL)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("warning pHalInfo buffer is NULL \n");
|
||||
#endif
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( pCallBackFlags == NULL)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("warning pCallBackFlags s NULL, the size must be 3*DWORD in follow order \n");
|
||||
DPRINT1("pCallBackFlags[0] = flags in DD_CALLBACKS\n");
|
||||
DPRINT1("pCallBackFlags[1] = flags in DD_SURFACECALLBACKS\n");
|
||||
DPRINT1("pCallBackFlags[2] = flags in DD_PALETTECALLBACKS\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
|
||||
|
||||
|
||||
|
||||
if (!pDirectDraw)
|
||||
{
|
||||
/* Fail to Lock DirectDraw handle */
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1(" Fail to Lock DirectDraw handle \n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pHalInfo->dwSize = 0;
|
||||
|
||||
success = pDirectDraw->DrvGetDirectDrawInfo(
|
||||
pDirectDraw->Global.dhpdev,
|
||||
pHalInfo,
|
||||
&HalInfo,
|
||||
puNumHeaps,
|
||||
puvmList,
|
||||
puNumFourCC,
|
||||
|
@ -222,136 +205,77 @@ BOOL STDCALL NtGdiDdQueryDirectDrawObject(
|
|||
|
||||
if (!success)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1(" Fail to get DirectDraw driver info \n");
|
||||
#endif
|
||||
DPRINT1("Driver does not fill the Fail to get DirectDraw driver info \n");
|
||||
|
||||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (HalInfo.dwSize == 0)
|
||||
{
|
||||
DPRINT1(" Fail for driver does not fill the DD_HALINFO struct \n");
|
||||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (HalInfo.dwSize != sizeof(DD_HALINFO))
|
||||
{
|
||||
if (HalInfo.dwSize == sizeof(DD_HALINFO_V4))
|
||||
{
|
||||
/* NT4 Compatible */
|
||||
DPRINT1("Got DD_HALINFO_V4 sturct we convert it to DD_HALINFO \n");
|
||||
HalInfo.dwSize = sizeof(DD_HALINFO);
|
||||
HalInfo.lpD3DGlobalDriverData = NULL;
|
||||
HalInfo.lpD3DHALCallbacks = NULL;
|
||||
HalInfo.lpD3DBufCallbacks = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1(" Fail : did not get DD_HALINFO size \n");
|
||||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
RtlMoveMemory(pHalInfo, &HalInfo, sizeof(DD_HALINFO));
|
||||
|
||||
/* rest the flag so we do not need do it later */
|
||||
pCallBackFlags[0]=0;
|
||||
pCallBackFlags[1]=0;
|
||||
pCallBackFlags[2]=0;
|
||||
pCallBackFlags[0]=pDirectDraw->DD.dwFlags;
|
||||
pCallBackFlags[1]=pDirectDraw->Surf.dwFlags;
|
||||
pCallBackFlags[2]=pDirectDraw->Pal.dwFlags;
|
||||
|
||||
if (pHalInfo)
|
||||
{
|
||||
|
||||
{
|
||||
DDHALINFO* pHalInfo2 = ((DDHALINFO*) pHalInfo);
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 2D and 3D Hal\n");
|
||||
#endif
|
||||
RtlMoveMemory(&pDirectDraw->Hal, pHalInfo2, sizeof(DDHALINFO));
|
||||
DPRINT1("Found DirectDraw CallBack for 2D and 3D Hal\n");
|
||||
|
||||
if (pHalInfo2->lpDDExeBufCallbacks)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal Bufffer \n");
|
||||
#endif
|
||||
/* msdn DDHAL_D3DBUFCALLBACKS = DD_D3DBUFCALLBACKS */
|
||||
RtlMoveMemory(puD3dBufferCallbacks, pHalInfo2->lpDDExeBufCallbacks, sizeof(DD_D3DBUFCALLBACKS));
|
||||
}
|
||||
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Do not support CallBack for 3D Hal\n");
|
||||
#endif
|
||||
/* FIXME we need D3DHAL be include
|
||||
RtlMoveMemory(&pDirectDraw->Hal, pHalInfo, sizeof(DD_HALINFO));
|
||||
|
||||
if (pHalInfo2->lpD3DHALCallbacks )
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal\n");
|
||||
#endif
|
||||
RtlMoveMemory(puD3dCallbacks, (ULONG *)pHalInfo2->lpD3DHALCallbacks, sizeof( D3DHAL_CALLBACKS ));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* msdn say D3DHAL_GLOBALDRIVERDATA and D3DNTHAL_GLOBALDRIVERDATA are not same
|
||||
but if u compare these in msdn it is exacly same */
|
||||
|
||||
if (pHalInfo->lpD3DGlobalDriverData)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal Private \n");
|
||||
#endif
|
||||
RtlMoveMemory(puD3dDriverData, (ULONG *)pHalInfo2->lpD3DGlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA));
|
||||
}
|
||||
|
||||
/* build the flag */
|
||||
|
||||
if (pHalInfo2->lpDDCallbacks!=NULL)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Dectect DirectDraw lpDDCallbacks for 2D Hal flag = %d\n",pHalInfo2->lpDDCallbacks->dwFlags);
|
||||
#endif
|
||||
pCallBackFlags[0] = pHalInfo2->lpDDCallbacks->dwFlags;
|
||||
}
|
||||
|
||||
if (pHalInfo2->lpDDCallbacks!=NULL)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Dectect DirectDraw lpDDSurfaceCallbacks for 2D Hal flag = %d\n",pHalInfo2->lpDDSurfaceCallbacks->dwFlags);
|
||||
#endif
|
||||
pCallBackFlags[1] = pHalInfo2->lpDDSurfaceCallbacks->dwFlags;
|
||||
}
|
||||
|
||||
if (pHalInfo2->lpDDCallbacks!=NULL)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Dectect DirectDraw lpDDCallbacks for 2D Hal flag = %d\n",pHalInfo2->lpDDPaletteCallbacks->dwFlags);
|
||||
#endif
|
||||
pCallBackFlags[2] = pHalInfo2->lpDDPaletteCallbacks->dwFlags;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal\n");
|
||||
#endif
|
||||
RtlMoveMemory(&pDirectDraw->Hal, pHalInfo, sizeof(DD_HALINFO));
|
||||
|
||||
if (pHalInfo->lpD3DBufCallbacks)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal Bufffer \n");
|
||||
#endif
|
||||
RtlMoveMemory(puD3dBufferCallbacks, pHalInfo->lpD3DBufCallbacks, sizeof(DD_D3DBUFCALLBACKS));
|
||||
}
|
||||
|
||||
if (pHalInfo->lpD3DHALCallbacks)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal\n");
|
||||
#endif
|
||||
RtlMoveMemory(puD3dCallbacks, pHalInfo->lpD3DHALCallbacks, sizeof(D3DNTHAL_CALLBACKS));
|
||||
}
|
||||
|
||||
if (pHalInfo->lpD3DGlobalDriverData)
|
||||
{
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal Private \n");
|
||||
#endif
|
||||
RtlMoveMemory(puD3dDriverData, pHalInfo->lpD3DGlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA));
|
||||
}
|
||||
|
||||
#ifdef DX_DEBUG
|
||||
DPRINT1("Unkown DirectX driver interface\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef DX_DEBUG
|
||||
else
|
||||
{
|
||||
DPRINT1("No DirectDraw Hal info have been found, it did not fail, it did gather some other info \n");
|
||||
if (pHalInfo->lpD3DGlobalDriverData)
|
||||
{
|
||||
/*
|
||||
msdn say D3DHAL_GLOBALDRIVERDATA and D3DNTHAL_GLOBALDRIVERDATA are not same
|
||||
but if u compare these in msdn it is exacly same
|
||||
*/
|
||||
DPRINT1("Found DirectDraw Global DriverData \n");
|
||||
RtlMoveMemory(puD3dDriverData, pHalInfo->lpD3DGlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA));
|
||||
}
|
||||
#endif
|
||||
|
||||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||
/* FIXME
|
||||
* we missing D3DHAL_CALLBACKS in the headers
|
||||
*
|
||||
|
||||
if (pHalInfo->lpD3DHALCallbacks )
|
||||
{
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal\n");
|
||||
RtlMoveMemory(puD3dCallbacks, (ULONG *)pHalInfo->lpD3DHALCallbacks, sizeof( D3DHAL_CALLBACKS ));
|
||||
}
|
||||
|
||||
*/
|
||||
if (pHalInfo->lpD3DBufCallbacks)
|
||||
{
|
||||
DPRINT1("Found DirectDraw CallBack for 3D Hal Bufffer \n");
|
||||
/* msdn DDHAL_D3DBUFCALLBACKS = DD_D3DBUFCALLBACKS */
|
||||
RtlMoveMemory(puD3dBufferCallbacks, pHalInfo->lpD3DBufCallbacks, sizeof(DD_D3DBUFCALLBACKS));
|
||||
}
|
||||
|
||||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue