Author: greatlrd
Date: Wed Nov 28 00:32:59 2007
New Revision: 30826
URL:
http://svn.reactos.org/svn/reactos?rev=30826&view=rev
Log:
Fix ddraw start in windows again and activate the debug msg again.
Added:
trunk/reactos/dll/directx/ddraw/resource.h (with props)
Modified:
trunk/reactos/dll/directx/ddraw/ddraw.rc
trunk/reactos/dll/directx/ddraw/main.c
trunk/reactos/dll/directx/ddraw/rosdraw.h
Modified: trunk/reactos/dll/directx/ddraw/ddraw.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/ddraw.rc…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/ddraw.rc (original)
+++ trunk/reactos/dll/directx/ddraw/ddraw.rc Wed Nov 28 00:32:59 2007
@@ -1,4 +1,6 @@
/* $Id$ */
+
+#include "resource.h"
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/Win32 - DDraw\0"
@@ -11,3 +13,9 @@
#define REACTOS_STR_PRODUCT_VERSION "5.3.2600.2180"
#include <reactos/version.rc>
+
+STRINGTABLE DISCARDABLE
+{
+STR_PRIMARY_DISPLAY, "Primary Display Driver"
+}
+
Modified: trunk/reactos/dll/directx/ddraw/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?r…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main.c Wed Nov 28 00:32:59 2007
@@ -11,7 +11,7 @@
#include "rosdraw.h"
-
+HMODULE hDllModule = 0;
/* PSEH for SEH Support */
#include <pseh/pseh.h>
@@ -220,28 +220,51 @@
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);
+ CHAR strMsg[RC_STRING_MAX_SIZE];
+ HRESULT retVal = DDERR_INVALIDPARAMS;
+
+ DX_WINDBG_trace();
+
+ if ((IsBadCodePtr((LPVOID)lpCallback) == 0) &&
+ ((dwFlags & ~(DDENUM_NONDISPLAYDEVICES |
+ DDENUM_DETACHEDSECONDARYDEVICES |
+ DDENUM_ATTACHEDSECONDARYDEVICES)) == 0))
+ {
+ LoadStringA(hDllModule, STR_PRIMARY_DISPLAY, (LPSTR)&strMsg,
RC_STRING_MAX_SIZE);
+
+ rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, REGSTR_PATH_DDHW, &hKey);
if (rc == ERROR_SUCCESS)
{
- if (Value != 0)
- {
- EnumerateAttachedSecondaries = TRUE;
- privateDWFlags = DDENUM_ATTACHEDSECONDARYDEVICES;
- }
- }
- RegCloseKey(hKey);
- }
-
- // not finish
- return DDERR_UNSUPPORTED;
+ /* 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);
+ }
+
+ /* Call the user supplyed callback function */
+ rc = lpCallback(NULL, strMsg, "display", lpContext, NULL);
+
+ /* If the callback function returns DDENUMRET_CANCEL, we will stop enumerating
devices now */
+ if(rc == DDENUMRET_CANCEL)
+ {
+ retVal = DD_OK;
+ }
+ else
+ {
+ // not finish
+ retVal = DDERR_UNSUPPORTED;
+ }
+ }
+
+ return retVal;
}
HRESULT
@@ -249,6 +272,8 @@
DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback,
LPVOID lpContext)
{
+ DX_WINDBG_trace();
+
return DDERR_UNSUPPORTED;
}
@@ -258,6 +283,8 @@
LPVOID lpContext,
DWORD dwFlags)
{
+ DX_WINDBG_trace();
+
return DDERR_UNSUPPORTED;
}
@@ -339,6 +366,8 @@
DWORD retCode = DD_OK;
LPD3DHAL_DP2COMMAND dp2command = lpCmd;
+ DX_WINDBG_trace();
+
/* prevent it crash if null pointer are being sent */
if ( (lpCmd == NULL) || (lpRetCmd == NULL) )
{
@@ -388,39 +417,46 @@
WINAPI
AcquireDDThreadLock()
{
- EnterCriticalSection(&ddcs);
+ DX_WINDBG_trace();
+
+ EnterCriticalSection(&ddcs);
}
VOID
WINAPI
ReleaseDDThreadLock()
{
- LeaveCriticalSection(&ddcs);
-}
+ DX_WINDBG_trace();
+
+ LeaveCriticalSection(&ddcs);
+}
+
BOOL APIENTRY
DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
- BOOL retStatus;
+
+ hDllModule = hModule;
+
+ DX_WINDBG_trace();
+
+
switch(ul_reason_for_call)
{
case DLL_PROCESS_DETACH:
- //DeleteCriticalSection( &ddcs );
- retStatus = TRUE;
+ DeleteCriticalSection( &ddcs );
break;
case DLL_PROCESS_ATTACH:
- //DisableThreadLibraryCalls( hModule );
- //InitializeCriticalSection( &ddcs );
- //EnterCriticalSection( &ddcs );
- //LeaveCriticalSection( &ddcs );
- retStatus = FALSE;
+ DisableThreadLibraryCalls( hModule );
+ InitializeCriticalSection( &ddcs );
+ EnterCriticalSection( &ddcs );
+ LeaveCriticalSection( &ddcs );
break;
default:
- retStatus = TRUE;
break;
}
- return retStatus;
-
-}
+
+ return TRUE;
+}
Added: trunk/reactos/dll/directx/ddraw/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/resource…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/resource.h (added)
+++ trunk/reactos/dll/directx/ddraw/resource.h Wed Nov 28 00:32:59 2007
@@ -1,0 +1,8 @@
+
+
+#define RC_STRING_MAX_SIZE 512
+
+#define STR_PRIMARY_DISPLAY 100
+
+
+/* EOF */
Propchange: trunk/reactos/dll/directx/ddraw/resource.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Wed Nov 28 00:32:59 2007
@@ -12,6 +12,8 @@
#include "Ddraw/ddraw.h"
#include "Surface/surface.h"
#include "Clipper/clipper.h"
+
+#include "resource.h"
/* DirectDraw startup code only internal use */
extern DDRAWI_DIRECTDRAW_GBL ddgbl;
@@ -234,7 +236,7 @@
return DD_OK;
-#if 0
+#if 1
#define DX_STUB_str(x) \
{ \
char buffer[1024]; \