Author: greatlrd
Date: Fri Nov 21 06:42:25 2008
New Revision: 37509
URL: http://svn.reactos.org/svn/reactos?rev=37509&view=rev
Log:
Add Threadlock for DDraw_AddRef
Add Threadlock for DDraw_Release
Add Threadlock for DDraw->Compact
BugFix : Remove wrong zeromemory in StartDirectDrawHel discovery by Pigglesworth
Cleanup : reactivate hal support in DDrawSurface->Lock and DDrawSurface->UnLock
Modified:
branches/reactx/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
branches/reactx/reactos/dll/directx/ddraw/Surface/surface_main.c
branches/reactx/reactos/dll/directx/ddraw/startup.c
Modified: branches/reactx/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddra…
==============================================================================
--- branches/reactx/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c [iso-8859-1] Fri Nov 21 06:42:25 2008
@@ -134,6 +134,19 @@
return retVal;
}
+/*++
+* @name DDraw->AddRef
+* @implemented
+*
+* The function DDraw->AddRef count of all ref counter in the COM object DDraw->
+
+* @return
+* Returns the local Ref counter value for the COM object
+*
+* @remarks.
+* none
+*
+*--*/
ULONG WINAPI
Main_DirectDraw_AddRef (LPDDRAWI_DIRECTDRAW_INT This)
{
@@ -141,13 +154,20 @@
DX_WINDBG_trace();
- _SEH_TRY
- {
+ /* Lock the thread so nothing can change the COM while we updating it */
+ AcquireDDThreadLock();
+
+ _SEH_TRY
+ {
+ /* Count up the internal ref counter */
This->dwIntRefCnt++;
+
+ /* Count up the internal local ref counter */
This->lpLcl->dwLocalRefCnt++;
if (This->lpLcl->lpGbl != NULL)
{
+ /* Count up the internal gobal ref counter */
This->lpLcl->lpGbl->dwRefCnt++;
}
}
@@ -166,6 +186,10 @@
}
_SEH_END;
+ /* Release the thread lock */
+ ReleaseDDThreadLock();
+
+ /* Return the local Ref counter */
return retValue;
}
@@ -178,6 +202,10 @@
ULONG Counter = 0;
DX_WINDBG_trace();
+
+ /* Lock the thread so nothing can change the COM while we updating it */
+ AcquireDDThreadLock();
+
_SEH_TRY
{
if (This!=NULL)
@@ -213,30 +241,48 @@
{
}
_SEH_END;
+
+ /* Release the thread lock */
+ ReleaseDDThreadLock();
+
return Counter;
}
+
HRESULT WINAPI
Main_DirectDraw_Initialize (LPDDRAWI_DIRECTDRAW_INT This, LPGUID lpGUID)
{
return DDERR_ALREADYINITIALIZED;
}
-/*
- * Main_DirectDraw_Compact
- * ms say this one is not implement but it return DDERR_NOEXCLUSIVEMODE
- * when no exclusive owner are set in corpativelevel
- */
+
+/*++
+* @name DDraw->Compact
+* @implemented
+*
+* The function DDraw->Compact only return two diffent return value, they are DD_OK and DERR_NOEXCLUSIVEMODE
+* if we are in Exclusive mode we return DERR_NOEXCLUSIVEMODE, other wise we return DD_OK
+
+* @return
+* Returns only Error code DD_OK or DERR_NOEXCLUSIVEMODE
+*
+* @remarks.
+* Microsoft say Compact is not implement in ddraw.dll, but Compact return DDERR_NOEXCLUSIVEMODE or DD_OK
+*
+*--*/
HRESULT WINAPI
Main_DirectDraw_Compact(LPDDRAWI_DIRECTDRAW_INT This)
{
HRESULT retVal = DD_OK;
DX_WINDBG_trace();
- // EnterCriticalSection(&ddcs);
-
- _SEH_TRY
- {
+
+ /* Lock the thread so nothing can change the COM while we updating it */
+ AcquireDDThreadLock();
+
+ _SEH_TRY
+ {
+ /* Check see if Exclusive mode have been activate */
if (This->lpLcl->lpGbl->lpExclusiveOwner != This->lpLcl)
{
retVal = DDERR_NOEXCLUSIVEMODE;
@@ -246,7 +292,10 @@
{
}
_SEH_END;
- // LeaveCriticalSection(&ddcs);
+
+ /* Release the thread lock */
+ ReleaseDDThreadLock();
+
return retVal;
}
Modified: branches/reactx/reactos/dll/directx/ddraw/Surface/surface_main.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddra…
==============================================================================
--- branches/reactx/reactos/dll/directx/ddraw/Surface/surface_main.c [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/directx/ddraw/Surface/surface_main.c [iso-8859-1] Fri Nov 21 06:42:25 2008
@@ -415,12 +415,6 @@
/* Zero out members in DDHAL_LOCKDATA */
ZeroMemory(&mdLock, sizeof(DDHAL_LOCKDATA));
- if ( (ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
- DDHAL_SURFCB32_UNLOCK) == DDHAL_SURFCB32_UNLOCK)
- {
- ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags -=DDHAL_SURFCB32_UNLOCK;
- ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags -=DDHAL_SURFCB32_LOCK;
- }
/* Check if we got HAL support for this api */
if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
DDHAL_SURFCB32_LOCK) == DDHAL_SURFCB32_LOCK)
@@ -524,12 +518,6 @@
ZeroMemory(&mdUnLock, sizeof(DDHAL_UNLOCKDATA));
/* Check if we got HAL support for this api */
- if ( (This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
- DDHAL_SURFCB32_UNLOCK) == DDHAL_SURFCB32_UNLOCK)
- {
- This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags -=DDHAL_SURFCB32_UNLOCK;
- This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags -=DDHAL_SURFCB32_LOCK;
- }
if (( This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
DDHAL_SURFCB32_UNLOCK) == DDHAL_SURFCB32_UNLOCK)
{
Modified: branches/reactx/reactos/dll/directx/ddraw/startup.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddra…
==============================================================================
--- branches/reactx/reactos/dll/directx/ddraw/startup.c [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/directx/ddraw/startup.c [iso-8859-1] Fri Nov 21 06:42:25 2008
@@ -301,7 +301,7 @@
hel_ret = StartDirectDrawHel(iface, reenable);
break;
}
-DX_STUB_str("here\n");
+
if (hal_ret!=DD_OK)
{
if (hel_ret!=DD_OK)
@@ -367,10 +367,6 @@
return DD_FALSE;
}
}
- }
- else
- {
- RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS));
}
ddgbl.lpDDCBtmp->HELDD.CanCreateSurface = HelDdCanCreateSurface;
Author: greatlrd
Date: Fri Nov 21 04:17:34 2008
New Revision: 37505
URL: http://svn.reactos.org/svn/reactos?rev=37505&view=rev
Log:
>From old code when I started on DCIMAN
Implement DllMain
Implement DCIOpenProvider
Implement DCICloseProvider
Modified:
branches/reactx/reactos/dll/win32/dciman32/dciman32.rbuild
branches/reactx/reactos/dll/win32/dciman32/dciman_main.c
Modified: branches/reactx/reactos/dll/win32/dciman32/dciman32.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
==============================================================================
--- branches/reactx/reactos/dll/win32/dciman32/dciman32.rbuild [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/win32/dciman32/dciman32.rbuild [iso-8859-1] Fri Nov 21 04:17:34 2008
@@ -4,12 +4,11 @@
<module name="dciman32" type="win32dll" baseaddress="${BASEADDRESS_DCIMAN32}" installbase="system32" installname="dciman32.dll" allowwarnings="true">
<importlibrary definition="dciman32.spec" />
<include base="dciman32">.</include>
- <include base="ReactOS">include/reactos/wine</include>
- <define name="__WINESRC__" />
<file>dciman_main.c</file>
<file>dciman32.spec</file>
- <library>wine</library>
<library>kernel32</library>
<library>ntdll</library>
+ <library>gdi32</library>
+ <library>user32</library>
</module>
</group>
Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
==============================================================================
--- branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] Fri Nov 21 04:17:34 2008
@@ -1,70 +1,91 @@
-/*
- * Implementation of DCIMAN32 - DCI Manager
- * "Device Context Interface" ?
- *
- * Copyright 2000 Marcus Meissner
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-#include <stdarg.h>
-#include <stdio.h>
+#include <windows.h>
+#include <dciman.h>
-#include "windows.h"
-#include "dciman.h"
-#include "wine/debug.h"
+CRITICAL_SECTION ddcs;
-WINE_DEFAULT_DEBUG_CHANNEL(dciman);
+BOOL
+WINAPI
+DllMain( HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID reserved )
+{
+ switch(ul_reason_for_call)
+ {
+ case DLL_PROCESS_DETACH:
+ DeleteCriticalSection( &ddcs );
+ break;
-/***********************************************************************
- * DllEntryPoint (DCIMAN32.@)
- *
- * DCIMAN32 initialisation routine.
- */
-BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
-{
- if (reason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls( inst );
+ case DLL_PROCESS_ATTACH:
+ InitializeCriticalSection( &ddcs );
+ break;
+ }
return TRUE;
}
+/*++
+* @name HDC WINAPI DCIOpenProvider(void)
+* @implemented
+*
+* The function DCIOpenProvider are almost same as CreateDC, it is more simple to use,
+* you do not need type which monitor or graphic card you want to use, it will use
+* the current one that the program is running on, so it simple create a hdc, and
+* you can use gdi32 api without any problem
-/***********************************************************************
- * DCIOpenProvider (DCIMAN32.@)
- */
+* @return
+* Returns a hdc that it have create by gdi32.dll CreateDC
+*
+* @remarks.
+* None
+*
+*--*/
HDC WINAPI
-DCIOpenProvider(void) {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return NULL;
+DCIOpenProvider(void)
+{
+ HDC hDC;
+ if (GetSystemMetrics(SM_CMONITORS) > 1)
+ {
+ /* FIXME we need add more that one mointor support for DCIOpenProvider, need exaime how */
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return NULL;
+ }
+ else
+ {
+ /* Note Windows using the word "Display" not with big letter to create the hdc
+ * MS gdi32 does not care if the Display spell with big or small letters */
+
+ /* Note it only create a hDC handle and send it back. */
+ hDC = CreateDCW(L"Display",NULL, NULL, NULL);
+ }
+
+ return hDC;
}
-/***********************************************************************
- * DCICloseProvider (DCIMAN32.@)
- */
+/*++
+* @name void WINAPI DCICloseProvider(HDC hdc)
+* @implemented
+*
+* Same as DeleteDC, it call indirecly to DeleteDC, it simple free and destory the hdc.
+
+* @return
+* None
+*
+* @remarks.
+* None
+*
+*--*/
void WINAPI
-DCICloseProvider(HDC hdc) {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return;
+DCICloseProvider(HDC hDC)
+{
+ /* Note it only delete the hdc */
+ DeleteDC(hDC);
}
-/**************************************************************************
- * DCICreatePrimary (DCIMAN32.@)
- */
+
int WINAPI
DCICreatePrimary(HDC hdc, LPDCISURFACEINFO *pDciSurfaceInfo)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- FIXME("%p %p\n", hdc, pDciSurfaceInfo);
return DCI_FAIL_UNSUPPORTED;
}
+
+
+