2005-08-08 13:29:50 +00:00
|
|
|
|
|
|
|
/* $Id$
|
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: lib/ddraw/ddraw.c
|
2007-10-19 23:21:45 +00:00
|
|
|
* PURPOSE: DirectDraw Library
|
2005-08-08 13:29:50 +00:00
|
|
|
* PROGRAMMER: Magnus Olsen (greatlrd)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2005-08-08 13:29:50 +00:00
|
|
|
#include "rosdraw.h"
|
2007-11-27 21:32:59 +00:00
|
|
|
HMODULE hDllModule = 0;
|
2007-11-22 19:11:43 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
CRITICAL_SECTION ddcs;
|
2005-08-08 13:29:50 +00:00
|
|
|
|
2006-07-24 22:02:13 +00:00
|
|
|
// This function is exported by the dll
|
2007-06-17 21:49:35 +00:00
|
|
|
|
2007-11-22 19:11:43 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LPVOID lpCallback;
|
|
|
|
LPVOID lpContext;
|
|
|
|
} DirectDrawEnumerateProcData;
|
2007-06-17 21:49:35 +00:00
|
|
|
|
2008-11-30 05:49:18 +00:00
|
|
|
BOOL
|
|
|
|
CALLBACK
|
2007-11-22 19:11:43 +00:00
|
|
|
TranslateCallbackA(GUID *lpGUID,
|
|
|
|
LPSTR lpDriverDescription,
|
|
|
|
LPSTR lpDriverName,
|
|
|
|
LPVOID lpContext,
|
|
|
|
HMONITOR hm)
|
|
|
|
{
|
|
|
|
DirectDrawEnumerateProcData *pEPD = (DirectDrawEnumerateProcData*)lpContext;
|
|
|
|
return ((LPDDENUMCALLBACKA) pEPD->lpCallback)(lpGUID, lpDriverDescription, lpDriverName, pEPD->lpContext);
|
|
|
|
}
|
2007-06-17 21:49:35 +00:00
|
|
|
|
|
|
|
/*++
|
|
|
|
* @name DirectDrawCreateClipper
|
|
|
|
*
|
|
|
|
* The DirectDrawCreateClipper routine <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param dwFlags
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lplpDDClipper
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param pUnkOuter
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @return <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
2007-10-19 23:21:45 +00:00
|
|
|
HRESULT WINAPI DirectDrawCreateClipper (DWORD dwFlags,
|
2006-07-24 22:02:13 +00:00
|
|
|
LPDIRECTDRAWCLIPPER* lplpDDClipper, LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
return Main_DirectDraw_CreateClipper(NULL, dwFlags, lplpDDClipper, pUnkOuter);
|
|
|
|
}
|
|
|
|
|
2007-06-17 21:49:35 +00:00
|
|
|
/*++
|
|
|
|
* @name DirectDrawCreate
|
|
|
|
*
|
|
|
|
* The DirectDrawCreate routine <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lpGUID
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lplpDD
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param pUnkOuter
|
2008-02-10 20:45:56 +00:00
|
|
|
* Always set to NULL otherwise DirectDrawCreate will fail and return
|
|
|
|
* error code CLASS_E_NOAGGREGATION
|
2007-06-17 21:49:35 +00:00
|
|
|
*
|
|
|
|
* @return <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
2006-04-01 19:12:56 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
|
|
|
DirectDrawCreate (LPGUID lpGUID,
|
|
|
|
LPDIRECTDRAW* lplpDD,
|
|
|
|
LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
2007-06-16 16:42:50 +00:00
|
|
|
HRESULT retVal = DDERR_GENERIC;
|
2007-10-19 23:21:45 +00:00
|
|
|
/*
|
2008-02-10 20:45:56 +00:00
|
|
|
remove this when UML diagram is in place
|
|
|
|
this api is finished and is working as it should
|
2007-04-22 13:54:34 +00:00
|
|
|
*/
|
|
|
|
|
2007-05-23 19:48:54 +00:00
|
|
|
DX_WINDBG_trace();
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2007-06-16 16:42:50 +00:00
|
|
|
{
|
2008-02-10 20:45:56 +00:00
|
|
|
/* check if pUnkOuter is null or not */
|
2007-06-16 16:42:50 +00:00
|
|
|
if (pUnkOuter)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
retVal = CLASS_E_NOAGGREGATION;
|
2007-06-16 16:42:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-06-16 18:18:04 +00:00
|
|
|
retVal = Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, &IID_IDirectDraw, FALSE);
|
2007-06-16 16:42:50 +00:00
|
|
|
}
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2007-06-16 16:42:50 +00:00
|
|
|
{
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2007-06-16 16:42:50 +00:00
|
|
|
|
|
|
|
return retVal;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
2006-04-01 19:12:56 +00:00
|
|
|
|
2007-06-17 21:49:35 +00:00
|
|
|
/*++
|
|
|
|
* @name DirectDrawCreateEx
|
|
|
|
*
|
|
|
|
* The DirectDrawCreateEx routine <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lpGUID
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lplpDD
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param pUnkOuter
|
2008-02-10 20:45:56 +00:00
|
|
|
* Always set to NULL otherwise DirectDrawCreateEx will fail and return
|
|
|
|
* error code CLASS_E_NOAGGREGATION
|
2007-06-17 21:49:35 +00:00
|
|
|
*
|
|
|
|
* @return <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
2007-10-19 23:21:45 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
2007-04-22 13:54:34 +00:00
|
|
|
DirectDrawCreateEx(LPGUID lpGUID,
|
|
|
|
LPVOID* lplpDD,
|
2007-10-19 23:21:45 +00:00
|
|
|
REFIID id,
|
2007-04-22 13:54:34 +00:00
|
|
|
LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
2007-06-02 13:26:33 +00:00
|
|
|
HRESULT retVal = DDERR_GENERIC;
|
2007-10-19 23:21:45 +00:00
|
|
|
/*
|
2008-02-10 20:45:56 +00:00
|
|
|
remove this when UML diagram is in place
|
|
|
|
this api is finished and is working as it should
|
2007-04-22 13:54:34 +00:00
|
|
|
*/
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2007-04-22 13:54:34 +00:00
|
|
|
{
|
2007-06-02 13:26:33 +00:00
|
|
|
/* check see if pUnkOuter is null or not */
|
|
|
|
if (pUnkOuter)
|
|
|
|
{
|
|
|
|
/* we are using same error code as MS*/
|
2007-10-19 23:21:45 +00:00
|
|
|
retVal = CLASS_E_NOAGGREGATION;
|
2007-06-03 13:06:32 +00:00
|
|
|
}/* Is it a DirectDraw 7 Request or not */
|
2007-10-19 23:21:45 +00:00
|
|
|
else if (!IsEqualGUID(id, &IID_IDirectDraw7))
|
2007-06-03 13:06:32 +00:00
|
|
|
{
|
|
|
|
retVal = DDERR_INVALIDPARAMS;
|
2007-06-02 13:26:33 +00:00
|
|
|
}
|
2007-06-03 13:06:32 +00:00
|
|
|
else
|
2007-06-02 13:26:33 +00:00
|
|
|
{
|
2007-06-16 18:18:04 +00:00
|
|
|
retVal = Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, FALSE);
|
2007-06-02 13:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create our DirectDraw interface */
|
2007-04-22 13:54:34 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2007-04-22 13:54:34 +00:00
|
|
|
{
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2007-04-22 13:54:34 +00:00
|
|
|
|
2007-06-02 13:26:33 +00:00
|
|
|
return retVal;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2008-11-30 05:49:18 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
2007-11-22 19:11:43 +00:00
|
|
|
DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback,
|
2006-04-01 19:12:56 +00:00
|
|
|
LPVOID lpContext)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2007-11-22 19:11:43 +00:00
|
|
|
HRESULT retValue;
|
|
|
|
DirectDrawEnumerateProcData epd;
|
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
epd.lpCallback = (LPVOID) lpCallback;
|
|
|
|
epd.lpContext = lpContext;
|
|
|
|
|
|
|
|
if (!IsBadCodePtr((LPVOID)lpCallback))
|
|
|
|
{
|
|
|
|
return DirectDrawEnumerateExA((LPDDENUMCALLBACKEXA)TranslateCallbackA, &epd, DDENUM_NONDISPLAYDEVICES);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
retValue = DDERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
return retValue;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2006-04-01 19:12:56 +00:00
|
|
|
/*
|
2007-10-19 23:21:45 +00:00
|
|
|
* UNIMPLEMENT
|
2006-04-01 19:12:56 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
|
|
|
DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback,
|
|
|
|
LPVOID lpContext,
|
2006-04-01 19:12:56 +00:00
|
|
|
DWORD dwFlags)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2007-11-22 19:11:43 +00:00
|
|
|
HKEY hKey;
|
|
|
|
DWORD cbData = 0;
|
|
|
|
DWORD Value = 0;
|
|
|
|
LONG rc;
|
|
|
|
BOOL EnumerateAttachedSecondaries = FALSE;
|
|
|
|
DWORD privateDWFlags = 0;
|
2007-11-29 15:14:19 +00:00
|
|
|
CHAR strMsg[RC_STRING_MAX_SIZE];
|
|
|
|
HRESULT retVal = DDERR_INVALIDPARAMS;
|
2007-11-22 19:11:43 +00:00
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-11-29 15:14:19 +00:00
|
|
|
if ((IsBadCodePtr((LPVOID)lpCallback) == 0) &&
|
|
|
|
((dwFlags & ~(DDENUM_NONDISPLAYDEVICES |
|
|
|
|
DDENUM_DETACHEDSECONDARYDEVICES |
|
|
|
|
DDENUM_ATTACHEDSECONDARYDEVICES)) == 0))
|
2007-11-22 19:11:43 +00:00
|
|
|
{
|
2007-11-29 15:14:19 +00:00
|
|
|
LoadStringA(hDllModule, STR_PRIMARY_DISPLAY, (LPSTR)&strMsg, RC_STRING_MAX_SIZE);
|
|
|
|
|
|
|
|
rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, REGSTR_PATH_DDHW, &hKey);
|
2007-11-22 19:11:43 +00:00
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
2007-11-29 15:14:19 +00:00
|
|
|
/* Enumerate Attached Secondaries */
|
|
|
|
cbData = sizeof(DWORD);
|
|
|
|
rc = RegQueryValueExA(hKey, "EnumerateAttachedSecondaries", NULL, NULL, (LPBYTE)&Value, &cbData);
|
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
if (Value != 0)
|
|
|
|
{
|
|
|
|
EnumerateAttachedSecondaries = TRUE;
|
|
|
|
privateDWFlags = DDENUM_ATTACHEDSECONDARYDEVICES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
|
2008-02-10 20:45:56 +00:00
|
|
|
/* Call the user supplied callback function */
|
2007-11-29 15:14:19 +00:00
|
|
|
rc = lpCallback(NULL, strMsg, "display", lpContext, NULL);
|
|
|
|
|
2008-02-10 20:45:56 +00:00
|
|
|
/* If the callback function returns DDENUMRET_CANCEL, we will stop enumerating devices */
|
2007-11-29 15:14:19 +00:00
|
|
|
if(rc == DDENUMRET_CANCEL)
|
|
|
|
{
|
|
|
|
retVal = DD_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-10 20:45:56 +00:00
|
|
|
// not finished
|
2007-11-29 15:14:19 +00:00
|
|
|
retVal = DDERR_UNSUPPORTED;
|
2007-11-22 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-29 15:14:19 +00:00
|
|
|
return retVal;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2007-11-22 19:36:16 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
|
|
|
DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback,
|
|
|
|
LPVOID lpContext)
|
|
|
|
{
|
2007-11-27 21:32:59 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-11-22 19:36:16 +00:00
|
|
|
return DDERR_UNSUPPORTED;
|
|
|
|
}
|
2006-04-01 19:12:56 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
HRESULT
|
|
|
|
WINAPI
|
|
|
|
DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback,
|
|
|
|
LPVOID lpContext,
|
2006-04-01 19:12:56 +00:00
|
|
|
DWORD dwFlags)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2007-11-27 21:32:59 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-11-22 19:36:16 +00:00
|
|
|
return DDERR_UNSUPPORTED;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
2006-02-26 20:23:25 +00:00
|
|
|
|
2007-11-22 19:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-02-26 20:23:25 +00:00
|
|
|
/*
|
|
|
|
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
|
|
|
|
Display_d/hh/Display_d/d3d_21ac30ea-9803-401e-b541-6b08af79653d.xml.asp
|
|
|
|
|
2008-02-10 20:45:56 +00:00
|
|
|
for more info about this command see msdn documentation
|
2006-10-23 17:37:51 +00:00
|
|
|
|
2008-11-30 05:49:18 +00:00
|
|
|
The buffer start with D3DHAL_DP2COMMAND struct afer that follows either one struct or
|
2008-02-10 20:45:56 +00:00
|
|
|
no struct at at all
|
2006-10-23 17:37:51 +00:00
|
|
|
example for command D3DDP2OP_VIEWPORTINFO
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
then lpCmd will look like this
|
2006-10-23 17:37:51 +00:00
|
|
|
----------------------------------------
|
|
|
|
| struct | Pos |
|
|
|
|
----------------------------------------
|
|
|
|
| D3DHAL_DP2COMMAND | 0x00 - 0x03 |
|
|
|
|
---------------------------------------
|
|
|
|
| D3DHAL_DP2VIEWPORTINFO | 0x04 - xxxx |
|
|
|
|
---------------------------------------
|
|
|
|
|
2008-02-10 20:45:56 +00:00
|
|
|
to calculate the end of the lpCmd buffer in this exmaple
|
2006-10-23 17:37:51 +00:00
|
|
|
D3DHAL_DP2COMMAND->wStateCount * sizeof(D3DHAL_DP2VIEWPORTINFO);
|
2008-02-10 20:45:56 +00:00
|
|
|
now you got number of bytes but we need to add the size of D3DHAL_DP2COMMAND
|
2007-10-19 23:21:45 +00:00
|
|
|
to get this right. the end should be
|
2006-10-23 17:37:51 +00:00
|
|
|
sizeof(D3DHAL_DP2COMMAND) + ( D3DHAL_DP2COMMAND->wStateCount * sizeof(D3DHAL_DP2VIEWPORTINFO));
|
2007-10-19 23:21:45 +00:00
|
|
|
to get the xxxx end positions.
|
2006-04-01 19:12:56 +00:00
|
|
|
*/
|
|
|
|
|
2007-06-17 21:49:35 +00:00
|
|
|
/*++
|
|
|
|
* @name D3DParseUnknownCommand
|
|
|
|
*
|
|
|
|
* The D3DParseUnknownCommand routine <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lpCmd
|
2007-10-19 23:21:45 +00:00
|
|
|
* Is a typcast to LPD3DHAL_DP2COMMAND struct
|
2007-06-17 21:49:35 +00:00
|
|
|
* typedef struct _D3DHAL_DP2COMMAND
|
|
|
|
* {
|
|
|
|
* BYTE bCommand;
|
|
|
|
* BYTE bReserved;
|
|
|
|
* union
|
|
|
|
* {
|
|
|
|
* WORD wPrimitiveCount;
|
|
|
|
* WORD wStateCount;
|
|
|
|
* };
|
|
|
|
* } D3DHAL_DP2COMMAND, *LPD3DHAL_DP2COMMAND;
|
2007-10-19 23:21:45 +00:00
|
|
|
*
|
|
|
|
* lpCmd->bCommand
|
2008-02-10 20:45:56 +00:00
|
|
|
* only accept D3DDP2OP_VIEWPORTINFO, and undocumented command 0x0D
|
|
|
|
* anything else will result in an error
|
2007-06-17 21:49:35 +00:00
|
|
|
*
|
|
|
|
Command 0x0D
|
2007-10-19 23:21:45 +00:00
|
|
|
* dp2command->bReserved
|
2008-02-10 20:45:56 +00:00
|
|
|
* is the size of the struct we got in wStateCount or how many wStateCount we got
|
2007-06-17 21:49:35 +00:00
|
|
|
* do not known more about it, no info in msdn about it either.
|
|
|
|
*
|
|
|
|
* Command D3DDP2OP_VIEWPORTINFO
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @param lpRetCmd
|
|
|
|
* <FILLMEIN>.
|
|
|
|
*
|
|
|
|
* @return <FILLMEIN>.
|
|
|
|
*
|
2007-10-19 23:21:45 +00:00
|
|
|
* @remarks
|
|
|
|
|
2007-06-17 21:49:35 +00:00
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
HRESULT WINAPI
|
|
|
|
D3DParseUnknownCommand( LPVOID lpCmd,
|
2006-10-22 10:01:46 +00:00
|
|
|
LPVOID *lpRetCmd)
|
2006-02-26 20:23:25 +00:00
|
|
|
{
|
2006-10-23 17:37:51 +00:00
|
|
|
DWORD retCode = DD_OK;
|
2006-10-22 10:01:46 +00:00
|
|
|
LPD3DHAL_DP2COMMAND dp2command = lpCmd;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2007-11-27 21:32:59 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2006-10-22 10:01:46 +00:00
|
|
|
/* prevent it crash if null pointer are being sent */
|
2006-10-22 10:43:36 +00:00
|
|
|
if ( (lpCmd == NULL) || (lpRetCmd == NULL) )
|
2006-02-26 20:23:25 +00:00
|
|
|
{
|
2006-10-22 10:01:46 +00:00
|
|
|
return E_FAIL;
|
2006-02-26 20:23:25 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-10-22 10:01:46 +00:00
|
|
|
*lpRetCmd = lpCmd;
|
2006-10-23 17:37:51 +00:00
|
|
|
|
|
|
|
switch (dp2command->bCommand)
|
|
|
|
{
|
2008-02-10 20:45:56 +00:00
|
|
|
/* check for vaild command, only 3 commands are vaild */
|
2006-10-23 17:37:51 +00:00
|
|
|
case D3DDP2OP_VIEWPORTINFO:
|
|
|
|
*(PBYTE)lpRetCmd += ((dp2command->wStateCount * sizeof(D3DHAL_DP2VIEWPORTINFO)) + sizeof(D3DHAL_DP2COMMAND));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case D3DDP2OP_WINFO:
|
|
|
|
*(PBYTE)lpRetCmd += (dp2command->wStateCount * sizeof(D3DHAL_DP2WINFO)) + sizeof(D3DHAL_DP2COMMAND);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0d: /* Undocumented in MSDN */
|
|
|
|
*(PBYTE)lpRetCmd += ((dp2command->wStateCount * dp2command->bReserved) + sizeof(D3DHAL_DP2COMMAND));
|
|
|
|
break;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-10-23 17:37:51 +00:00
|
|
|
/* set the error code */
|
|
|
|
default:
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-10-23 17:37:51 +00:00
|
|
|
if ( (dp2command->bCommand <= D3DDP2OP_INDEXEDTRIANGLELIST) || // dp2command->bCommand <= with 0 to 3
|
2006-10-22 10:01:46 +00:00
|
|
|
(dp2command->bCommand == D3DDP2OP_RENDERSTATE) || // dp2command->bCommand == with 8
|
|
|
|
(dp2command->bCommand >= D3DDP2OP_LINELIST) ) // dp2command->bCommand >= with 15 to 255
|
2006-10-23 17:37:51 +00:00
|
|
|
{
|
|
|
|
/* set error code for command 0 to 3, 8 and 15 to 255 */
|
2007-11-22 19:36:16 +00:00
|
|
|
retCode = DDERR_INVALIDPARAMS;
|
2006-10-23 17:37:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* set error code for 4 - 7, 9 - 12, 14 */
|
2007-10-19 23:21:45 +00:00
|
|
|
retCode = D3DERR_COMMAND_UNPARSED;
|
2006-10-23 17:37:51 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-02-26 20:23:25 +00:00
|
|
|
}
|
2006-10-23 17:37:51 +00:00
|
|
|
|
2006-02-26 20:23:25 +00:00
|
|
|
return retCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
VOID
|
|
|
|
WINAPI
|
2006-11-05 21:19:53 +00:00
|
|
|
AcquireDDThreadLock()
|
2007-04-22 13:54:34 +00:00
|
|
|
{
|
2007-11-27 21:32:59 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
EnterCriticalSection(&ddcs);
|
2006-11-05 21:19:53 +00:00
|
|
|
}
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
VOID
|
|
|
|
WINAPI
|
2006-11-05 21:19:53 +00:00
|
|
|
ReleaseDDThreadLock()
|
|
|
|
{
|
2007-11-27 21:32:59 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
LeaveCriticalSection(&ddcs);
|
2006-11-05 21:19:53 +00:00
|
|
|
}
|
|
|
|
|
2007-11-27 21:32:59 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
BOOL APIENTRY
|
2006-11-05 21:19:53 +00:00
|
|
|
DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
|
|
|
|
{
|
2007-11-27 21:32:59 +00:00
|
|
|
|
|
|
|
hDllModule = hModule;
|
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
switch(ul_reason_for_call)
|
|
|
|
{
|
2007-04-22 13:54:34 +00:00
|
|
|
case DLL_PROCESS_DETACH:
|
2007-11-27 21:32:59 +00:00
|
|
|
DeleteCriticalSection( &ddcs );
|
2006-11-05 21:19:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2007-11-27 21:32:59 +00:00
|
|
|
DisableThreadLibraryCalls( hModule );
|
|
|
|
InitializeCriticalSection( &ddcs );
|
|
|
|
EnterCriticalSection( &ddcs );
|
|
|
|
LeaveCriticalSection( &ddcs );
|
2007-04-22 13:54:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-11-05 21:19:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-11-27 21:32:59 +00:00
|
|
|
return TRUE;
|
2006-11-05 21:19:53 +00:00
|
|
|
}
|