Difference between revisions of "Techwiki:NtGdiDdCanCreateD3DBuffer"

From ReactOS Wiki
Jump to: navigation, search
Line 1: Line 1:
 
 
  DWORD
 
  DWORD
 
  STDCALL
 
  STDCALL
Line 7: Line 6:
  
  
The function NtGdiDdCanCreateD3DBuffer checks if you can create a  
+
The function NtGdiDdCanCreateD3DBuffer checks if you can create a surface for DirectX.  It redirects to dxg.sys in Windows XP/2003,  
surface for DirectX.  It redirects to dxg.sys in windows XP/2003,  
+
dxkrnl.sys in Vista and is fully implemented in win32k.sys in Windows 2000 and below.
dxkrnl.sys in vista and is fully implemented in win32k.sys in windows 2000 and below.
 
  
'''Parameters'''
+
==Parameters==
* param HANDLE hDirectDraw
+
* HANDLE hDirectDraw
The handle we got from NtGdiDdCreateDirectDrawObject
+
The handle we receive from NtGdiDdCreateDirectDrawObject
  
* param PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
+
* PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
This contains information to check if the driver can create the buffers,
+
This contains information to check if the driver can create buffers, surfaces, textures and vertexes, and how many of each the driver can create.
surfaces, textures and vertexes, and how many of each the driver can create.
 
  
 +
==Return==
 +
Depending on whether the driver supports this function or not, DDHAL_DRIVER_HANDLED or DDHAL_DRIVER_NOTHANDLED is returned respectively.
  
'''return'''
+
To check if the function has been successful, do a full check by seeing if the return value is DDHAL_DRIVER_HANDLED and puCanCreateSurfaceData->ddRVal is set to DD_OK.
* Depending on if the driver supports this function or not, DDHAL_DRIVER_HANDLED
 
or DDHAL_DRIVER_NOTHANDLED is returned.
 
To check if the function has been successful, do a full check.
 
A full check is done by checking if the return value is DDHAL_DRIVER_HANDLED  
 
and puCanCreateSurfaceData->ddRVal is set to DD_OK.
 
  
'''remarks'''
+
==Remarks==
* dxg.sys NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface calls are redirected to dxg.sys.
+
NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface calls are redirected to the same function in dxg.sys. For proof, examine the memory addresses on the driver list functions table and you will see they are pointed to the same memory address.
Inside the dxg.sys they are redirected to the same function. Examine the memory addresses on the driver list functions
+
 
table and you will see they are pointed to the same memory address.
+
Before calling this function please set the puCanCreateSurfaceData->ddRVal to an error value such as DDERR_NOTSUPPORTED, for the ddRVal will otherwise be unchanged even if an error occurs inside the driver.
  
Before calling this function please set the puCanCreateSurfaceData->ddRVal to an error value such as DDERR_NOTUSPORTED,
 
for the ddRVal will otherwise be unchanged even if an error occurs inside the driver.
 
 
puCanCreateSurfaceData->lpDD  is a pointer to DDRAWI_DIRECTDRAW_GBL, not PDD_DIRECTDRAW_GLOBAL as MSDN claims.
 
puCanCreateSurfaceData->lpDD  is a pointer to DDRAWI_DIRECTDRAW_GBL, not PDD_DIRECTDRAW_GLOBAL as MSDN claims.
puCanCreateSurfaceData->lpDD->hDD also needs be filled in with the handle we got from NtGdiDdCreateDirectDrawObject.
+
 
puCreateSurfaceData->CanCreateSurface is a pointer to the real functions in the HAL or HEL, that you need fill in.
+
puCanCreateSurfaceData->lpDD->hDD also needs be filled in with the handle we receive from NtGdiDdCreateDirectDrawObject.
Do not forget PDD_CANCREATESURFACEDATA is typecast of LPDDHAL_CANCREATESURFACEDATA and thuse two struct are different size,
+
 
the correct struct is LPDDHAL_CANCREATESURFACEDATA.
+
puCreateSurfaceData->CanCreateSurface is a pointer to the real functions in the HAL or HEL that you need to fill in.
 +
 
 +
Do not forget that PDD_CANCREATESURFACEDATA is a typecast of LPDDHAL_CANCREATESURFACEDATA and these two structs are different size. The correct struct is LPDDHAL_CANCREATESURFACEDATA.

Revision as of 21:48, 15 March 2008

DWORD
STDCALL
NtGdiDdCanCreateD3DBuffer(
    HANDLE hDirectDraw,
    PDD_CANCREATESURFACEDATA puCanCreateSurfaceData)


The function NtGdiDdCanCreateD3DBuffer checks if you can create a surface for DirectX. It redirects to dxg.sys in Windows XP/2003, dxkrnl.sys in Vista and is fully implemented in win32k.sys in Windows 2000 and below.

Parameters

  • HANDLE hDirectDraw

The handle we receive from NtGdiDdCreateDirectDrawObject

  • PDD_CANCREATESURFACEDATA puCanCreateSurfaceData

This contains information to check if the driver can create buffers, surfaces, textures and vertexes, and how many of each the driver can create.

Return

Depending on whether the driver supports this function or not, DDHAL_DRIVER_HANDLED or DDHAL_DRIVER_NOTHANDLED is returned respectively.

To check if the function has been successful, do a full check by seeing if the return value is DDHAL_DRIVER_HANDLED and puCanCreateSurfaceData->ddRVal is set to DD_OK.

Remarks

NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface calls are redirected to the same function in dxg.sys. For proof, examine the memory addresses on the driver list functions table and you will see they are pointed to the same memory address.

Before calling this function please set the puCanCreateSurfaceData->ddRVal to an error value such as DDERR_NOTSUPPORTED, for the ddRVal will otherwise be unchanged even if an error occurs inside the driver.

puCanCreateSurfaceData->lpDD is a pointer to DDRAWI_DIRECTDRAW_GBL, not PDD_DIRECTDRAW_GLOBAL as MSDN claims.

puCanCreateSurfaceData->lpDD->hDD also needs be filled in with the handle we receive from NtGdiDdCreateDirectDrawObject.

puCreateSurfaceData->CanCreateSurface is a pointer to the real functions in the HAL or HEL that you need to fill in.

Do not forget that PDD_CANCREATESURFACEDATA is a typecast of LPDDHAL_CANCREATESURFACEDATA and these two structs are different size. The correct struct is LPDDHAL_CANCREATESURFACEDATA.