Author: greatlrd Date: Thu Nov 22 22:11:43 2007 New Revision: 30681
URL: http://svn.reactos.org/svn/reactos?rev=30681&view=rev Log: Implement DirectDrawEnumerateA the DirectDrawEnumerateProcData struct are from wine. rest of the code are writen by me. the DirectDrawEnumerateExA are not finish but it is a start.
Modified: trunk/reactos/dll/directx/ddraw/main.c
Modified: trunk/reactos/dll/directx/ddraw/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?re... ============================================================================== --- trunk/reactos/dll/directx/ddraw/main.c (original) +++ trunk/reactos/dll/directx/ddraw/main.c Thu Nov 22 22:11:43 2007 @@ -12,6 +12,7 @@
#include "rosdraw.h"
+ /* PSEH for SEH Support */ #include <pseh/pseh.h>
@@ -19,7 +20,23 @@
// This function is exported by the dll
- +typedef struct +{ + LPVOID lpCallback; + LPVOID lpContext; +} DirectDrawEnumerateProcData; + +BOOL +CALLBACK +TranslateCallbackA(GUID *lpGUID, + LPSTR lpDriverDescription, + LPSTR lpDriverName, + LPVOID lpContext, + HMONITOR hm) +{ + DirectDrawEnumerateProcData *pEPD = (DirectDrawEnumerateProcData*)lpContext; + return ((LPDDENUMCALLBACKA) pEPD->lpCallback)(lpGUID, lpDriverDescription, lpDriverName, pEPD->lpContext); +}
/*++ * @name DirectDrawCreateClipper @@ -163,28 +180,79 @@ return retVal; }
+HRESULT +WINAPI +DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, + LPVOID lpContext) +{ + 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; +} + + /* * UNIMPLEMENT */
-HRESULT -WINAPI -DirectDrawEnumerateA( - LPDDENUMCALLBACKA lpCallback, - LPVOID lpContext) +HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback, + LPVOID lpContext) { DX_STUB; } -
/* * UNIMPLEMENT */
-HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback, - LPVOID lpContext) -{ - DX_STUB; +HRESULT +WINAPI +DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback, + LPVOID lpContext, + DWORD dwFlags) +{ + HKEY hKey; + DWORD cbData = 0; + DWORD Value = 0; + LONG rc; + BOOL EnumerateAttachedSecondaries = FALSE; + DWORD privateDWFlags = 0; + + DX_WINDBG_trace(); + + rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, REGSTR_PATH_DDHW, &hKey); + if (rc == ERROR_SUCCESS) + { + /* 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); + } + + // not finish + return DDERR_UNSUPPORTED; }
/* @@ -193,23 +261,11 @@
HRESULT WINAPI -DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback, - LPVOID lpContext, - DWORD dwFlags) -{ - DX_STUB; -} - -/* - * UNIMPLEMENT - */ - -HRESULT -WINAPI DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags) { + /* Note this function are not longer supported in ddraw in windows 2003 */ DX_STUB; }