ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2007
----- 2024 -----
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
380 discussions
Start a n
N
ew thread
[dgorbachev] 26463: Fix Polish translation (bug #2194).
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Sun Apr 22 18:35:02 2007 New Revision: 26463 URL:
http://svn.reactos.org/svn/reactos?rev=26463&view=rev
Log: Fix Polish translation (bug #2194). Modified: trunk/reactos/dll/cpl/main/lang/pl-PL.rc Modified: trunk/reactos/dll/cpl/main/lang/pl-PL.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/pl-PL.rc…
============================================================================== --- trunk/reactos/dll/cpl/main/lang/pl-PL.rc (original) +++ trunk/reactos/dll/cpl/main/lang/pl-PL.rc Sun Apr 22 18:35:02 2007 @@ -1,8 +1,9 @@ /* -* translated by xrogers -* xxrogers(a)users.sourceforge.net -*
https://sourceforge.net/projects/reactospl
-*/ + * translated by xrogers + * xxrogers(a)users.sourceforge.net + *
https://sourceforge.net/projects/reactospl
+ */ + LANGUAGE LANG_POLISH, SUBLANG_NEUTRAL IDD_KEYBSPEED DIALOGEX 0, 0, 246, 228 @@ -135,12 +136,12 @@ FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Przewijanie", -1, 5, 5, 230, 80 + ICON -1, IDC_ICON_WHEEL, 20, 35, 15, 15 LTEXT "Obrócenie kó³kiem o jeden skok powoduje przewiniêcie:", -1, 60, 15, 150, 10 - CONTROL "&O tyle linii naraz:", IDC_RADIO_WHEEL_SCROLL_LINES, "Button", 0x50010009, 60, 30, 150, 10 - EDITTEXT IDC_EDIT_WHEEL_SCROLL_LINES, 60, 45, 60, 15,ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WHEEL_SCROLL_LINES, UPDOWN_CLASS,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 45, 12, 12 - CONTROL "O jeden &ekran", IDC_RADIO_WHEEL_SCROLL_PAGE, "Button", 0x50010009, 60, 65, 90, 10 - ICON -1, IDC_ICON_WHEEL, 20, 35, 15, 15 + RADIOBUTTON "&O tyle linii naraz:", IDC_RADIO_WHEEL_SCROLL_LINES, 60, 30, 150, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP + RADIOBUTTON "O jeden &ekran", IDC_RADIO_WHEEL_SCROLL_PAGE, 60, 65, 90, 10 + EDITTEXT IDC_EDIT_WHEEL_SCROLL_LINES, 60, 45, 60, 15, ES_RIGHT | WS_VISIBLE | WS_GROUP | WS_TABSTOP + CONTROL "", IDC_UPDOWN_WHEEL_SCROLL_LINES, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER, 115, 45, 12, 12 END STRINGTABLE
17 years, 5 months
1
0
0
0
[greatlrd] 26462: fixing a small bug in startup.c
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Apr 22 18:02:37 2007 New Revision: 26462 URL:
http://svn.reactos.org/svn/reactos?rev=26462&view=rev
Log: fixing a small bug in startup.c Modified: trunk/reactos/dll/directx/ddraw/startup.c Modified: trunk/reactos/dll/directx/ddraw/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
============================================================================== --- trunk/reactos/dll/directx/ddraw/startup.c (original) +++ trunk/reactos/dll/directx/ddraw/startup.c Sun Apr 22 18:02:37 2007 @@ -88,7 +88,7 @@ DWORD hal_ret = DD_FALSE; DWORD hel_ret = DD_FALSE; DWORD devicetypes = 0; - DWORD dwFlags; + DWORD dwFlags = 0; DX_WINDBG_trace(); @@ -218,8 +218,10 @@ } /* Fill some basic info for Surface */ - - This->lpLcl->hDD = ddgbl.hDD; + This->lpLcl->lpGbl->dwFlags = dwFlags | DDRAWI_ATTACHEDTODESKTOP; + This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp; + This->lpLcl->hDD = This->lpLcl->lpGbl->hDD; + ddgbl.hDD = This->lpLcl->lpGbl->hDD; return DD_OK; }
17 years, 5 months
1
0
0
0
[greatlrd] 26461: This commit break ddraw.dll it does not working any longer can not execlute a program. it is part of cleanup of the startup process of dx interface.
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Apr 22 17:54:34 2007 New Revision: 26461 URL:
http://svn.reactos.org/svn/reactos?rev=26461&view=rev
Log: This commit break ddraw.dll it does not working any longer can not execlute a program. it is part of cleanup of the startup process of dx interface. Modified: trunk/reactos/dll/directx/ddraw/iface_clipper.c trunk/reactos/dll/directx/ddraw/iface_color.c trunk/reactos/dll/directx/ddraw/iface_gamma.c trunk/reactos/dll/directx/ddraw/iface_kernel.c trunk/reactos/dll/directx/ddraw/iface_palette.c trunk/reactos/dll/directx/ddraw/iface_videoport.c trunk/reactos/dll/directx/ddraw/main.c trunk/reactos/dll/directx/ddraw/main/ddraw_main.c trunk/reactos/dll/directx/ddraw/rosdraw.h trunk/reactos/dll/directx/ddraw/startup.c Modified: trunk/reactos/dll/directx/ddraw/iface_clipper.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/iface_cl…
============================================================================== --- trunk/reactos/dll/directx/ddraw/iface_clipper.c (original) +++ trunk/reactos/dll/directx/ddraw/iface_clipper.c Sun Apr 22 17:54:34 2007 @@ -14,34 +14,17 @@ ULONG WINAPI DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) { - LPDDRAWI_DDRAWCLIPPER_INT This = (LPDDRAWI_DDRAWCLIPPER_INT)iface; - - DX_WINDBG_trace(); - /* FIXME - This is not right exiame how it should be done - */ - DX_STUB_str("FIXME This is not right exiame how it should be done\n"); - return This->dwIntRefCnt; + DX_WINDBG_trace(); + + DX_STUB; } ULONG WINAPI DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface) { - LPDDRAWI_DDRAWCLIPPER_INT This = (LPDDRAWI_DDRAWCLIPPER_INT)iface; + DX_WINDBG_trace(); - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - This->lpLcl->dwLocalRefCnt++; - - if (This->lpLcl->lpGbl != NULL) - { - This->lpLcl->lpGbl->dwRefCnt++; - } - } - return This->dwIntRefCnt; + DX_STUB; } HRESULT WINAPI Modified: trunk/reactos/dll/directx/ddraw/iface_color.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/iface_co…
============================================================================== --- trunk/reactos/dll/directx/ddraw/iface_color.c (original) +++ trunk/reactos/dll/directx/ddraw/iface_color.c Sun Apr 22 17:54:34 2007 @@ -13,22 +13,9 @@ ULONG WINAPI DirectDrawColorControl_AddRef( LPDIRECTDRAWCOLORCONTROL iface) { - LPDDRAWI_DDCOLORCONTROL_INT This = (LPDDRAWI_DDCOLORCONTROL_INT)iface; + DX_WINDBG_trace(); - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - // This->lpLcl->dwLocalRefCnt++; - - - //if (This->lpLcl->lpGbl != NULL) - //{ - // This->lpLcl->lpGbl->dwRefCnt++; - //} - } - return This->dwIntRefCnt; + DX_STUB; } ULONG WINAPI Modified: trunk/reactos/dll/directx/ddraw/iface_gamma.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/iface_ga…
============================================================================== --- trunk/reactos/dll/directx/ddraw/iface_gamma.c (original) +++ trunk/reactos/dll/directx/ddraw/iface_gamma.c Sun Apr 22 17:54:34 2007 @@ -13,21 +13,9 @@ ULONG WINAPI DirectDrawGammaControl_AddRef( LPDIRECTDRAWGAMMACONTROL iface) { - LPDDRAWI_DDGAMMACONTROL_INT This = (LPDDRAWI_DDGAMMACONTROL_INT)iface; - - DX_WINDBG_trace(); + DX_WINDBG_trace(); - if (iface!=NULL) - { - This->dwIntRefCnt++; - //This->lpLcl->dwLocalRefCnt++; - - //if (This->lpLcl->lpGbl != NULL) - //{ - // This->lpLcl->lpGbl->dwRefCnt++; - //} - } - return This->dwIntRefCnt; + DX_STUB; } ULONG WINAPI Modified: trunk/reactos/dll/directx/ddraw/iface_kernel.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/iface_ke…
============================================================================== --- trunk/reactos/dll/directx/ddraw/iface_kernel.c (original) +++ trunk/reactos/dll/directx/ddraw/iface_kernel.c Sun Apr 22 17:54:34 2007 @@ -16,47 +16,17 @@ ULONG WINAPI DirectDrawKernel_AddRef ( LPDIRECTDRAWKERNEL iface) { - - LPDDRAWI_KERNEL_INT This = (LPDDRAWI_KERNEL_INT)iface; - - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - ref = This->dwIntRefCnt; - } - return ref; + DX_WINDBG_trace(); + + DX_STUB; } ULONG WINAPI DirectDrawKernel_Release ( LPDIRECTDRAWKERNEL iface) { - LPDDRAWI_KERNEL_INT This = (LPDDRAWI_KERNEL_INT)iface; - ULONG ref=0; + DX_WINDBG_trace(); - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt--; - - if (This->dwIntRefCnt == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - HeapFree(GetProcessHeap(), 0, This); - } - } - - ref = This->dwIntRefCnt; - } - return ref; + DX_STUB; } HRESULT WINAPI Modified: trunk/reactos/dll/directx/ddraw/iface_palette.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/iface_pa…
============================================================================== --- trunk/reactos/dll/directx/ddraw/iface_palette.c (original) +++ trunk/reactos/dll/directx/ddraw/iface_palette.c Sun Apr 22 17:54:34 2007 @@ -13,34 +13,17 @@ ULONG WINAPI DirectDrawPalette_Release( LPDIRECTDRAWPALETTE iface) { - LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; + DX_WINDBG_trace(); - DX_WINDBG_trace(); - /* FIXME - This is not right exiame how it should be done - */ - DX_STUB_str("FIXME This is not right exiame how it should be done\n"); - return This->dwIntRefCnt; + DX_STUB; } ULONG WINAPI DirectDrawPalette_AddRef( LPDIRECTDRAWPALETTE iface) { - LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; + DX_WINDBG_trace(); - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - This->lpLcl->dwLocalRefCnt++; - - if (This->lpLcl->lpGbl != NULL) - { - This->lpLcl->lpGbl->dwRefCnt++; - } - } - return This->dwIntRefCnt; + DX_STUB; } HRESULT WINAPI Modified: trunk/reactos/dll/directx/ddraw/iface_videoport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/iface_vi…
============================================================================== --- trunk/reactos/dll/directx/ddraw/iface_videoport.c (original) +++ trunk/reactos/dll/directx/ddraw/iface_videoport.c Sun Apr 22 17:54:34 2007 @@ -24,40 +24,24 @@ ULONG WINAPI Main_DirectDrawVideoPort_AddRef (LPDIRECTDRAWVIDEOPORT iface) { - LPDDRAWI_DDVIDEOPORT_INT This = (LPDDRAWI_DDVIDEOPORT_INT)iface; - - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - //This->lpLcl->dwLocalRefCnt++; - - //if (This->lpLcl->lpGbl != NULL) - //{ - // This->lpLcl->lpGbl->dwRefCnt++; - //} - } - return This->dwIntRefCnt; + DX_WINDBG_trace(); + + DX_STUB; } ULONG WINAPI Main_DirectDrawVideoPort_Release (LPDIRECTDRAWVIDEOPORT iface) { - LPDDRAWI_DDVIDEOPORT_INT This = (LPDDRAWI_DDVIDEOPORT_INT)iface; - - DX_WINDBG_trace(); - /* FIXME - This is not right exiame how it should be done - */ - DX_STUB_str("FIXME This is not right exiame how it should be done\n"); - return This->dwIntRefCnt; + DX_WINDBG_trace(); + + DX_STUB; } HRESULT WINAPI Main_DirectDrawVideoPort_Flip (LPDIRECTDRAWVIDEOPORT iface, LPDIRECTDRAWSURFACE lpDDSurface, DWORD dwFlags) { - DX_WINDBG_trace(); + DX_WINDBG_trace(); + DX_STUB; } 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 Sun Apr 22 17:54:34 2007 @@ -31,30 +31,30 @@ HRESULT WINAPI DirectDrawCreate (LPGUID lpGUID, - LPDIRECTDRAW* lplpDD, - LPUNKNOWN pUnkOuter) -{ - /* - remove this when UML digram are in place - this api is finish and is working as it should - */ - DX_WINDBG_trace(); - - /* check the pointer if it vaild to read from */ - if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) - { - return DDERR_INVALIDPARAMS; - } - - /* check see if pUnkOuter is null or not */ - if (pUnkOuter) - { - /* we are using same error code as MS*/ - return CLASS_E_NOAGGREGATION; - } - - /* Create our DirectDraw interface */ - return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw7, FALSE); + LPDIRECTDRAW* lplpDD, + LPUNKNOWN pUnkOuter) +{ + /* + remove this when UML digram are in place + this api is finish and is working as it should + */ + DX_WINDBG_trace(); + + /* check the pointer if it vaild to read from */ + if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) + { + return DDERR_INVALIDPARAMS; + } + + /* check see if pUnkOuter is null or not */ + if (pUnkOuter) + { + /* we are using same error code as MS*/ + return CLASS_E_NOAGGREGATION; + } + + /* Create our DirectDraw interface */ + return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw7, FALSE); } /* @@ -64,37 +64,37 @@ HRESULT WINAPI -DirectDrawCreateEx(LPGUID lpGUID, - LPVOID* lplpDD, - REFIID id, - LPUNKNOWN pUnkOuter) -{ - /* - remove this when UML digram are in place - this api is finish and is working as it should - */ - DX_WINDBG_trace(); - - /* check the pointer if it vaild to read from */ - if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) - { - return DDERR_INVALIDPARAMS; - } - - /* check see if pUnkOuter is null or not */ - if (pUnkOuter) - { - /* we are using same error code as MS*/ - return CLASS_E_NOAGGREGATION; - } - - /* Is it a DirectDraw 7 Request or not */ - if (!IsEqualGUID(id, &IID_IDirectDraw7)) - { - return DDERR_INVALIDPARAMS; - } - - /* Create our DirectDraw interface */ +DirectDrawCreateEx(LPGUID lpGUID, + LPVOID* lplpDD, + REFIID id, + LPUNKNOWN pUnkOuter) +{ + /* + remove this when UML digram are in place + this api is finish and is working as it should + */ + DX_WINDBG_trace(); + + /* check the pointer if it vaild to read from */ + if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) + { + return DDERR_INVALIDPARAMS; + } + + /* check see if pUnkOuter is null or not */ + if (pUnkOuter) + { + /* we are using same error code as MS*/ + return CLASS_E_NOAGGREGATION; + } + + /* Is it a DirectDraw 7 Request or not */ + if (!IsEqualGUID(id, &IID_IDirectDraw7)) + { + return DDERR_INVALIDPARAMS; + } + + /* Create our DirectDraw interface */ return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE); } @@ -231,15 +231,15 @@ VOID WINAPI AcquireDDThreadLock() -{ - EnterCriticalSection(&ddcs); +{ + EnterCriticalSection(&ddcs); } VOID WINAPI ReleaseDDThreadLock() { - LeaveCriticalSection(&ddcs); + LeaveCriticalSection(&ddcs); } BOOL APIENTRY @@ -248,21 +248,21 @@ BOOL retStatus; switch(ul_reason_for_call) { - case DLL_PROCESS_DETACH: - DeleteCriticalSection( &ddcs ); - retStatus = TRUE; + case DLL_PROCESS_DETACH: + DeleteCriticalSection( &ddcs ); + retStatus = TRUE; break; case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( hModule ); - InitializeCriticalSection( &ddcs ); - EnterCriticalSection( &ddcs ); - LeaveCriticalSection( &ddcs ); - retStatus = FALSE; - break; - - default: - retStatus = TRUE; + DisableThreadLibraryCalls( hModule ); + InitializeCriticalSection( &ddcs ); + EnterCriticalSection( &ddcs ); + LeaveCriticalSection( &ddcs ); + retStatus = FALSE; + break; + + default: + retStatus = TRUE; break; } return retStatus; Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/ddr…
============================================================================== --- trunk/reactos/dll/directx/ddraw/main/ddraw_main.c (original) +++ trunk/reactos/dll/directx/ddraw/main/ddraw_main.c Sun Apr 22 17:54:34 2007 @@ -124,29 +124,9 @@ LPDIRECTDRAWCLIPPER *ppClipper, IUnknown *pUnkOuter) { - //LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - LPDDRAWI_DDRAWCLIPPER_INT That; - - DX_WINDBG_trace(); - - if (pUnkOuter!=NULL) - { - return CLASS_E_NOAGGREGATION; - } - - That = (LPDDRAWI_DDRAWCLIPPER_INT) DxHeapMemAlloc(sizeof(DDRAWI_DDRAWCLIPPER_INT)); - if (That == NULL) - { - return DDERR_OUTOFMEMORY; //E_OUTOFMEMORY; - } - - That->lpVtbl = &DirectDrawClipper_Vtable; - - *ppClipper = (LPDIRECTDRAWCLIPPER)That; - - DirectDrawClipper_AddRef((LPDIRECTDRAWCLIPPER)That); - - return DirectDrawClipper_Initialize((LPDIRECTDRAWCLIPPER)That, (LPDIRECTDRAW)iface, dwFlags); + DX_WINDBG_trace(); + + DX_STUB; } HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags, @@ -166,182 +146,9 @@ LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - LPDDRAWI_DDRAWSURFACE_INT *That = NULL; - LPDDRAWI_DDRAWSURFACE_LCL *lpLcl; - DWORD dwHowManySurface = 1; - DWORD i; - //LPDDRAWI_DDRAWSURFACE_LCL *xlpLcl; - - if (pUnkOuter!=NULL) - { - return CLASS_E_NOAGGREGATION; - } - if (IsBadWritePtr( ppSurf, sizeof( LPDIRECTDRAWSURFACE7 )) ) - { - return DDERR_INVALIDPARAMS; - } - if (IsBadWritePtr( pDDSD, sizeof( LPDDSURFACEDESC2 )) ) - { - return DDERR_INVALIDPARAMS; - } - if (IsBadReadPtr(pDDSD, sizeof( LPDDSURFACEDESC2 )) ) - { - return DDERR_INVALIDPARAMS; - } - if (sizeof(DDSURFACEDESC2)!=pDDSD->dwSize) - { - return DDERR_UNSUPPORTED; - } - if( (pDDSD->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) && - (pDDSD->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY ) ) - { - return DDERR_INVALIDCAPS; - } - - - /* this two line should be move to startup code */ - ddSurfGbl.lpDD = &ddgbl; - ddSurfGbl.lpDDHandle = &ddgbl; - - /* Detecte if we are in fullscreen or not and extract thuse data */ - if (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN) - { - ddSurfGbl.wWidth = This->lpLcl->lpGbl->vmiData.dwDisplayWidth; - ddSurfGbl.wHeight = This->lpLcl->lpGbl->vmiData.dwDisplayHeight; - ddSurfGbl.lPitch = This->lpLcl->lpGbl->vmiData.lDisplayPitch; - } - else - { - RECT rect; - if(GetWindowRect((HWND)This->lpLcl->hWnd, &rect)) - { - ddSurfGbl.wWidth = rect.right - rect.left; - ddSurfGbl.wHeight = rect.bottom - rect.top; - ddSurfGbl.lPitch = This->lpLcl->lpGbl->vmiData.lDisplayPitch; - } - } - - /* setup diffent pixel format */ - if (pDDSD->dwFlags & DDSD_PIXELFORMAT) - { - if (pDDSD->ddpfPixelFormat.dwSize != sizeof(DDPIXELFORMAT)) - { - return DDERR_INVALIDPIXELFORMAT; - } - memcpy(&ddSurfGbl.ddpfSurface,&pDDSD->ddpfPixelFormat, sizeof(DDPIXELFORMAT)); - } - - /* Calc how many surface we need setup */ - if (pDDSD->ddsCaps.dwCaps & DDSD_BACKBUFFERCOUNT) - { - /* One primary + xx backbuffer */ - dwHowManySurface |= pDDSD->dwBackBufferCount; - } - - /* Alloc all memory we need for all createsurface here */ - lpLcl = DxHeapMemAlloc(sizeof(LPDDRAWI_DDRAWSURFACE_LCL) * dwHowManySurface); - if (lpLcl == NULL) - { - return DDERR_OUTOFMEMORY; - } - - That = DxHeapMemAlloc(sizeof(LPDDRAWI_DDRAWSURFACE_INT) * dwHowManySurface); - if (That == NULL) - { - return DDERR_OUTOFMEMORY; - } - - for (i=0;i<dwHowManySurface+1;i++) - { - That[i] = (LPDDRAWI_DDRAWSURFACE_INT) DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_INT)); - lpLcl[i] = (LPDDRAWI_DDRAWSURFACE_LCL) DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_LCL)); - if ( (lpLcl[i] == NULL) || - (That[i] == NULL)) - { - return DDERR_OUTOFMEMORY; - } - That[i]->lpLcl = lpLcl[i]; - - That[i]->lpLcl->lpGbl = &ddSurfGbl; - //That[i]->lpLcl->lpGbl = (LPDDRAWI_DDRAWSURFACE_GBL) DxHeapMemAlloc(sizeof(LPDDRAWI_DDRAWSURFACE_GBL)); - //if (That[i]->lpLcl->lpGbl == NULL) - //{ - // return DDERR_OUTOFMEMORY; - //} - - //That[i]->lpLcl->lpGbl->lpDD = &ddgbl; - //That[i]->lpLcl->lpGbl->lpDDHandle = This->lpLcl->lpGbl; - //memmove(That[i]->lpLcl->lpGbl,&ddSurfGbl,sizeof(LPDDRAWI_DDRAWSURFACE_GBL)); - } - - - - /* here we need start fixing bugs - * the code above is 100% correct behovir - * checked how ms ddraw behivor - */ - - - - /* Create the surface */ - if (((pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)) - && (!(pDDSD->ddsCaps.dwCaps & DDSCAPS_BACKBUFFER))) - { - CreatePrimarySurface(This,That,lpLcl,pDDSD); - } - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_OVERLAY) - { - CreateOverlaySurface(This, That, pDDSD); - } - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_BACKBUFFER) - { - This->lpLcl->lpGbl->dsList = NULL; - DX_STUB_str( "ok"); - - if (pDDSD->dwFlags & DDSD_BACKBUFFERCOUNT) - { - HRESULT retValue; - DX_STUB_str( "ok"); - - if (! pDDSD->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_COMPLEX)) - { - return DDERR_INVALIDPARAMS; - } - - if (pDDSD->dwBackBufferCount != 0) - { - This->lpLcl->lpGbl->dsList = This->lpLcl->lpPrimary; - } - else - { - return DDERR_INVALIDSURFACETYPE; - } - retValue = CreateBackBufferSurface(This,That,lpLcl,pDDSD); - //CreatePrimarySurface(This,That,lpLcl,pDDSD); - if (retValue != DD_OK) - { - DX_STUB_str( "Fail to create backbuffer surface"); - return retValue; - } - } - } - - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_TEXTURE) - { - DX_STUB_str( "Can not create texture surface"); - } - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) - { - DX_STUB_str( "Can not create zbuffer surface"); - } - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_OFFSCREENPLAIN) - { - DX_STUB_str( "Can not create offscreenplain surface"); - } - - *ppSurf = (LPDIRECTDRAWSURFACE7)That[0]; - return DD_OK; + DX_WINDBG_trace(); + + DX_STUB; } @@ -365,150 +172,9 @@ LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback) { - DX_STUB_DD_OK; - - // IDirectDrawImpl* This = (IDirectDrawImpl*)iface; - // DDSURFACEDESC2 desc_callback; - // DEVMODE DevMode; - // int iMode=0; - // - //RtlZeroMemory(&desc_callback, sizeof(DDSURFACEDESC2)); - // - // desc_callback.dwSize = sizeof(DDSURFACEDESC2); - - // desc_callback.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH; - - // if (dwFlags & DDEDM_REFRESHRATES) - // { - // desc_callback.dwFlags |= DDSD_REFRESHRATE; - // desc_callback.dwRefreshRate = This->lpLcl->lpGbl->dwMonitorFrequency; - // } - - // - // /* FIXME check if the mode are suppretd before sending it back */ - - //memset(&DevMode,0,sizeof(DEVMODE)); - //DevMode.dmSize = (WORD)sizeof(DEVMODE); - //DevMode.dmDriverExtra = 0; - - // while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0)) - // { - // - // if (pDDSD) - // { - // if ((pDDSD->dwFlags & DDSD_WIDTH) && (pDDSD->dwWidth != DevMode.dmPelsWidth)) - // continue; - // if ((pDDSD->dwFlags & DDSD_HEIGHT) && (pDDSD->dwHeight != DevMode.dmPelsHeight)) - // continue; - // if ((pDDSD->dwFlags & DDSD_PIXELFORMAT) && (pDDSD->ddpfPixelFormat.dwFlags & DDPF_RGB) && - // (pDDSD->ddpfPixelFormat.dwRGBBitCount != DevMode.dmBitsPerPel)) - // continue; - // } - // - // desc_callback.dwHeight = DevMode.dmPelsHeight; - // desc_callback.dwWidth = DevMode.dmPelsWidth; - // - // if (DevMode.dmFields & DM_DISPLAYFREQUENCY) - // { - // desc_callback.dwRefreshRate = DevMode.dmDisplayFrequency; - // } - - // if (desc_callback.dwRefreshRate == 0) - // { - // DX_STUB_str("dwRefreshRate = 0, we hard code it to value 60"); - // desc_callback.dwRefreshRate = 60; /* Maybe the valye should be biger */ - // } - - // /* above same as wine */ - // if ((pDDSD->dwFlags & DDSD_PIXELFORMAT) && (pDDSD->ddpfPixelFormat.dwFlags & DDPF_RGB) ) - // { - // switch(DevMode.dmBitsPerPel) - // { - // case 8: - // desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - // desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB; - // desc_callback.ddpfPixelFormat.dwFourCC = 0; - // desc_callback.ddpfPixelFormat.dwRGBBitCount=8; - // /* FIXME right value */ - // desc_callback.ddpfPixelFormat.dwRBitMask = 0xFF0000; /* red bitmask */ - // desc_callback.ddpfPixelFormat.dwGBitMask = 0; /* Green bitmask */ - // desc_callback.ddpfPixelFormat.dwBBitMask = 0; /* Blue bitmask */ - // break; - - // case 15: - // desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - // desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB; - // desc_callback.ddpfPixelFormat.dwFourCC = 0; - // desc_callback.ddpfPixelFormat.dwRGBBitCount=15; - // /* FIXME right value */ - // desc_callback.ddpfPixelFormat.dwRBitMask = 0x7C00; /* red bitmask */ - // desc_callback.ddpfPixelFormat.dwGBitMask = 0x3E0; /* Green bitmask */ - // desc_callback.ddpfPixelFormat.dwBBitMask = 0x1F; /* Blue bitmask */ - // break; - - // case 16: - // desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - // desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB; - // desc_callback.ddpfPixelFormat.dwFourCC = 0; - // desc_callback.ddpfPixelFormat.dwRGBBitCount=16; - // /* FIXME right value */ - // desc_callback.ddpfPixelFormat.dwRBitMask = 0xF800; /* red bitmask */ - // desc_callback.ddpfPixelFormat.dwGBitMask = 0x7E0; /* Green bitmask */ - // desc_callback.ddpfPixelFormat.dwBBitMask = 0x1F; /* Blue bitmask */ - // break; - - // case 24: - // desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - // desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB; - // desc_callback.ddpfPixelFormat.dwFourCC = 0; - // desc_callback.ddpfPixelFormat.dwRGBBitCount=24; - // /* FIXME right value */ - // desc_callback.ddpfPixelFormat.dwRBitMask = 0xFF0000; /* red bitmask */ - // desc_callback.ddpfPixelFormat.dwGBitMask = 0x00FF00; /* Green bitmask */ - // desc_callback.ddpfPixelFormat.dwBBitMask = 0x0000FF; /* Blue bitmask */ - // break; - - // case 32: - // desc_callback.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - // desc_callback.ddpfPixelFormat.dwFlags = DDPF_RGB; - // desc_callback.ddpfPixelFormat.dwFourCC = 0; - // desc_callback.ddpfPixelFormat.dwRGBBitCount=8; - // /* FIXME right value */ - // desc_callback.ddpfPixelFormat.dwRBitMask = 0xFF0000; /* red bitmask */ - // desc_callback.ddpfPixelFormat.dwGBitMask = 0x00FF00; /* Green bitmask */ - // desc_callback.ddpfPixelFormat.dwBBitMask = 0x0000FF; /* Blue bitmask */ - // break; - - // default: - // break; - // } - // desc_callback.ddsCaps.dwCaps = 0; - // if (desc_callback.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) - // { - // /* FIXME srt DDCS Caps flag */ - // desc_callback.ddsCaps.dwCaps |= DDSCAPS_PALETTE; - // } - // } - // - // if (DevMode.dmBitsPerPel==15) - // { - // desc_callback.lPitch = DevMode.dmPelsWidth + (8 - ( DevMode.dmPelsWidth % 8)) % 8; - // } - // else - // { - // desc_callback.lPitch = DevMode.dmPelsWidth * (DevMode.dmBitsPerPel / 8); - // desc_callback.lPitch = desc_callback.lPitch + (8 - (desc_callback.lPitch % 8)) % 8; - // } - // - // if (callback(&desc_callback, context) == DDENUMRET_CANCEL) - // { - // return DD_OK; - // } - // - // iMode++; - // } - - // return DD_OK; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -531,27 +197,9 @@ HRESULT WINAPI Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - DDHAL_FLIPTOGDISURFACEDATA mDdFlipToGDISurface; - - DX_WINDBG_trace(); - - mDdFlipToGDISurface.ddRVal = DDERR_NOTINITIALIZED; - mDdFlipToGDISurface.dwReserved = 0; - mDdFlipToGDISurface.dwToGDI = TRUE; - mDdFlipToGDISurface.FlipToGDISurface = This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface; - - if (mDdFlipToGDISurface.FlipToGDISurface == NULL) - { - return DDERR_NODRIVERSUPPORT; - } - - if (mDdFlipToGDISurface.FlipToGDISurface(&mDdFlipToGDISurface)==DDHAL_DRIVER_HANDLED); - { - return mDdFlipToGDISurface.ddRVal; - } - - return DDERR_NODRIVERSUPPORT; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -563,36 +211,9 @@ LPDDCAPS pHELCaps) { - DDSCAPS2 ddscaps = {0}; - DWORD status = DD_FALSE; - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DX_WINDBG_trace(); - - if (pDriverCaps != NULL) - { - Main_DirectDraw_GetAvailableVidMem(iface, - &ddscaps, - &This->lpLcl->lpGbl->ddCaps.dwVidMemTotal, - &This->lpLcl->lpGbl->ddCaps.dwVidMemFree); - - RtlCopyMemory(pDriverCaps,&This->lpLcl->lpGbl->ddCaps,sizeof(DDCORECAPS)); - pDriverCaps->dwSize=sizeof(DDCAPS); - - status = DD_OK; - } - - if (pHELCaps != NULL) - { - Main_DirectDraw_GetAvailableVidMem(iface, - &ddscaps, - &This->lpLcl->lpGbl->ddHELCaps.dwVidMemTotal, - &This->lpLcl->lpGbl->ddHELCaps.dwVidMemFree); - - RtlCopyMemory(pDriverCaps,&This->lpLcl->lpGbl->ddHELCaps,sizeof(DDCORECAPS)); - status = DD_OK; - } - return status; + DX_WINDBG_trace(); + + DX_STUB; } @@ -602,38 +223,11 @@ */ HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DX_WINDBG_trace(); - - if (pDDSD == NULL) - { - return DD_FALSE; - } - - pDDSD->dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_REFRESHRATE | DDSD_WIDTH; - pDDSD->dwHeight = This->lpLcl->lpGbl->vmiData.dwDisplayHeight; - pDDSD->dwWidth = This->lpLcl->lpGbl->vmiData.dwDisplayWidth; - pDDSD->lPitch = This->lpLcl->lpGbl->vmiData.lDisplayPitch; - pDDSD->dwRefreshRate = This->lpLcl->lpGbl->dwMonitorFrequency; - pDDSD->dwAlphaBitDepth = This->lpLcl->lpGbl->vmiData.ddpfDisplay.dwAlphaBitDepth; - - RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->lpLcl->lpGbl->vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT)); - RtlCopyMemory(&pDDSD->ddsCaps,&This->lpLcl->lpGbl->ddCaps,sizeof(DDCORECAPS)); - - RtlCopyMemory(&pDDSD->ddckCKDestOverlay,&This->lpLcl->lpGbl->ddckCKDestOverlay,sizeof(DDCOLORKEY)); - RtlCopyMemory(&pDDSD->ddckCKSrcOverlay,&This->lpLcl->lpGbl->ddckCKSrcOverlay,sizeof(DDCOLORKEY)); - - /* have not check where I should get hold of this info yet - DWORD dwBackBufferCount; - DWORD dwReserved; - LPVOID lpSurface; - DDCOLORKEY ddckCKDestBlt; - DDCOLORKEY ddckCKSrcBlt; - DWORD dwTextureStage; - */ - - return DD_OK; + //LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; + + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -666,17 +260,9 @@ HRESULT WINAPI Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DX_WINDBG_trace(); - - if (freq == NULL) - { - return DD_FALSE; - } - - *freq = This->lpLcl->lpGbl->dwMonitorFrequency; - return DD_OK; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -686,33 +272,9 @@ HRESULT WINAPI Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - DDHAL_GETSCANLINEDATA mDdGetScanLine; - - DX_WINDBG_trace(); - - *lpdwScanLine = 0; - - mDdGetScanLine.ddRVal = DDERR_NOTINITIALIZED; - mDdGetScanLine.dwScanLine = 0; - mDdGetScanLine.GetScanLine = This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine; - mDdGetScanLine.lpDD = This->lpLcl->lpGbl; - - if (mDdGetScanLine.GetScanLine == NULL) - { - return DDERR_NODRIVERSUPPORT; - } - - mDdGetScanLine.ddRVal = DDERR_NOTPALETTIZED; - mDdGetScanLine.dwScanLine = 0; - - if (mDdGetScanLine.GetScanLine(&mDdGetScanLine)==DDHAL_DRIVER_HANDLED); - { - *lpdwScanLine = mDdGetScanLine.dwScanLine; - return mDdGetScanLine.ddRVal; - } - - return DDERR_NODRIVERSUPPORT; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -734,16 +296,9 @@ WINAPI Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID) { - //LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DX_WINDBG_trace(); - - if (iface==NULL) - { - return DDERR_NOTINITIALIZED; - } - - return DDERR_ALREADYINITIALIZED; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -753,9 +308,9 @@ HRESULT WINAPI Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface) { - DX_WINDBG_trace(); - - ChangeDisplaySettings(NULL, 0); + DX_WINDBG_trace(); + + DX_STUB; return DD_OK; } @@ -766,76 +321,9 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DX_WINDBG_trace(); - - if (cooplevel & DDSCL_FULLSCREEN) - { - This->lpLcl->dwLocalFlags |= DDRAWILCL_ISFULLSCREEN; - } - - if (cooplevel & DDSCL_EXCLUSIVE) - { - This->lpLcl->lpGbl->lpExclusiveOwner = This->lpLcl; - } - - - /* This code should be a callback */ - This->lpLcl->hWnd = hwnd; - This->lpLcl->hFocusWnd = hwnd; - ReCreateDirectDraw((LPDIRECTDRAW*)iface); - - // TODO: - // - create a scaner that check which driver we should get the HDC from - // for now we always asume it is the active dirver that should be use. - // - allow more Flags - - - - // - // DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode; - - //DX_WINDBG_trace(); - // - // - // // check the parameters - // if ((HWND)This->lpLcl->lpGbl->lpExclusiveOwner->hWnd == hwnd) - // return DD_OK; - // - // - - // if ((cooplevel&DDSCL_EXCLUSIVE) && !(cooplevel&DDSCL_FULLSCREEN)) - // return DDERR_INVALIDPARAMS; - - // if (cooplevel&DDSCL_NORMAL && cooplevel&DDSCL_FULLSCREEN) - // return DDERR_INVALIDPARAMS; - - // // set the data - // This->lpLcl->lpGbl->lpExclusiveOwner->hWnd = (ULONG_PTR) hwnd; - // This->lpLcl->lpGbl->lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(hwnd); - - // - ///* FIXME : fill the mDDrawGlobal.lpExclusiveOwner->dwLocalFlags right */ - ////mDDrawGlobal.lpExclusiveOwner->dwLocalFlags - - - // SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED; - //if ((This->lpLcl->lpGbl->lpDDCBtmp->cbDDCallbacks.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)) - // { - // - // SetExclusiveMode.SetExclusiveMode = This->lpLcl->lpGbl->lpDDCBtmp->cbDDCallbacks.SetExclusiveMode; - // SetExclusiveMode.lpDD = This->lpLcl->lpGbl; - // SetExclusiveMode.dwEnterExcl = cooplevel; - - // if (SetExclusiveMode.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED) - // { - // return DDERR_NODRIVERSUPPORT; - // } - // } - // - // return SetExclusiveMode.ddRVal; - DX_STUB_DD_OK; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -846,76 +334,9 @@ Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) { - - - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - BOOL dummy = TRUE; - DEVMODE DevMode; - int iMode=0; - int Width=0; - int Height=0; - int BPP=0; - DDHAL_SETMODEDATA mDdSetMode; - - DX_WINDBG_trace(); - - /* FIXME check the refresrate if it same if it not same do the mode switch */ - - if ((This->lpLcl->lpGbl->vmiData.dwDisplayHeight == dwHeight) && - (This->lpLcl->lpGbl->vmiData.dwDisplayWidth == dwWidth) && - (This->lpLcl->lpGbl->vmiData.ddpfDisplay.dwRGBBitCount == dwBPP)) - { - return DD_OK; - } - - mDdSetMode.ddRVal = DDERR_NOTINITIALIZED; - mDdSetMode.dwModeIndex = 0; - mDdSetMode.inexcl = 0; - mDdSetMode.lpDD = This->lpLcl->lpGbl; - mDdSetMode.useRefreshRate = FALSE; - mDdSetMode.SetMode = This->lpLcl->lpDDCB->cbDDCallbacks.SetMode; - - if (mDdSetMode.SetMode == NULL) - { - return DDERR_NODRIVERSUPPORT; - } - - /* Check use the Hal or Hel for SetMode */ - // this only for exclusive mode - /*if(!(This->cooperative_level & DDSCL_EXCLUSIVE)) - { - return DDERR_NOEXCLUSIVEMODE; - }*/ - - DevMode.dmSize = (WORD)sizeof(DEVMODE); - DevMode.dmDriverExtra = 0; - - while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0 ) != 0) - { - - if ((dwWidth == DevMode.dmPelsWidth) && (dwHeight == DevMode.dmPelsHeight) && ( dwBPP == DevMode.dmBitsPerPel)) - { - Width = DevMode.dmPelsWidth; - Height = DevMode.dmPelsHeight; - BPP = DevMode.dmBitsPerPel; - break; - } - iMode++; - } - - if ((dwWidth != DevMode.dmPelsWidth) || (dwHeight != DevMode.dmPelsHeight) || ( dwBPP != DevMode.dmBitsPerPel)) - { - return DDERR_UNSUPPORTEDMODE; - } - - mDdSetMode.dwModeIndex = iMode; - mDdSetMode.SetMode(&mDdSetMode); - - DdReenableDirectDrawObject(This->lpLcl->lpGbl, &dummy); - - /* FIXME fill the This->DirectDrawGlobal.vmiData right */ - //This->lpLcl->lpGbl->lpExclusiveOwner->hDC = (ULONG_PTR)GetDC( (HWND)This->lpLcl->lpGbl->lpExclusiveOwner->hWnd); - return mDdSetMode.ddRVal; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -927,36 +348,9 @@ HANDLE h) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - DDHAL_WAITFORVERTICALBLANKDATA mDdWaitForVerticalBlank; - - DX_WINDBG_trace(); - - if (!(This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)) - { - return DDERR_NODRIVERSUPPORT; - } - - if (mDdWaitForVerticalBlank.WaitForVerticalBlank == NULL) - { - return DDERR_NODRIVERSUPPORT; - } - - mDdWaitForVerticalBlank.bIsInVB = DDWAITVB_BLOCKBEGIN ; /* return begin ? */ - mDdWaitForVerticalBlank.ddRVal = DDERR_NOTINITIALIZED; - mDdWaitForVerticalBlank.dwFlags = dwFlags; - mDdWaitForVerticalBlank.hEvent = (DWORD)h; - mDdWaitForVerticalBlank.lpDD = This->lpLcl->lpGbl; - mDdWaitForVerticalBlank.WaitForVerticalBlank = This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank; - - if (mDdWaitForVerticalBlank.WaitForVerticalBlank(&mDdWaitForVerticalBlank) - != DDHAL_DRIVER_HANDLED) - { - return DDERR_NODRIVERSUPPORT; - } - - - return mDdWaitForVerticalBlank.ddRVal; + DX_WINDBG_trace(); + + DX_STUB; } /* @@ -967,38 +361,9 @@ Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free) { - DDHAL_GETAVAILDRIVERMEMORYDATA mem; - - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DX_WINDBG_trace(); - - - /* Only Hal version exists acodring msdn */ - if (!(This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)) - { - return DDERR_NODRIVERSUPPORT; - } - - mem.lpDD = This->lpLcl->lpGbl; - mem.ddRVal = DDERR_NOTPALETTIZED; - mem.DDSCaps.dwCaps = ddscaps->dwCaps; - mem.ddsCapsEx.dwCaps2 = ddscaps->dwCaps2; - mem.ddsCapsEx.dwCaps3 = ddscaps->dwCaps3; - mem.ddsCapsEx.dwCaps4 = ddscaps->dwCaps4; - - if (This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks.GetAvailDriverMemory(&mem) == DDHAL_DRIVER_HANDLED); - { - if (total !=NULL) - { - *total = mem.dwTotal; - } - - *free = mem.dwFree; - return mem.ddRVal; - } - - return DDERR_NODRIVERSUPPORT; + DX_WINDBG_trace(); + + DX_STUB; } /* 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 Sun Apr 22 17:54:34 2007 @@ -21,6 +21,7 @@ extern DDRAWI_DIRECTDRAW_GBL ddgbl; extern DDRAWI_DDRAWSURFACE_GBL ddSurfGbl; + HRESULT WINAPI StartDirectDraw(LPDIRECTDRAW* iface, LPGUID pGUID, BOOL reenable); HRESULT WINAPI StartDirectDrawHal(LPDIRECTDRAW* iface, BOOL reenable); HRESULT WINAPI StartDirectDrawHel(LPDIRECTDRAW* iface, BOOL reenable); @@ -32,7 +33,7 @@ VOID Cleanup(LPDIRECTDRAW7 iface); /* own macro to alloc memmory */ -#define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m) +#define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m) #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \ p = NULL; @@ -45,15 +46,15 @@ HRESULT WINAPI Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 , REFIID , LPVOID *); ULONG WINAPI Main_DirectDraw_AddRef(LPDIRECTDRAW7 ); ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 ); -HRESULT WINAPI Main_DirectDraw_Compact(LPDIRECTDRAW7 ); +HRESULT WINAPI Main_DirectDraw_Compact(LPDIRECTDRAW7 ); HRESULT WINAPI Main_DirectDraw_CreateClipper(LPDIRECTDRAW7, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown *); HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDIRECTDRAW7, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE*, LPUNKNOWN); HRESULT WINAPI Main_DirectDraw_CreateSurface(LPDIRECTDRAW7, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7 *, IUnknown *); -HRESULT WINAPI Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7, LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7*); +HRESULT WINAPI Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7, LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7*); HRESULT WINAPI Main_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7, LPDDDEVICEIDENTIFIER2, DWORD); -HRESULT WINAPI Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7, DWORD, LPDDSURFACEDESC2, LPVOID, - LPDDENUMSURFACESCALLBACK7); +HRESULT WINAPI Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7, DWORD, LPDDSURFACEDESC2, LPVOID, + LPDDENUMSURFACESCALLBACK7); HRESULT WINAPI Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7); HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7, LPDDSURFACEDESC2); @@ -118,7 +119,7 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7, LPDIRECTDRAW, LPDDSURFACEDESC2); HRESULT WINAPI Main_DDrawSurface_Lock (LPDIRECTDRAWSURFACE7, LPRECT, LPDDSURFACEDESC2, DWORD, HANDLE); HRESULT WINAPI Main_DDrawSurface_Restore(LPDIRECTDRAWSURFACE7); -HRESULT WINAPI Main_DDrawSurface_UpdateOverlay (LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, +HRESULT WINAPI Main_DDrawSurface_UpdateOverlay (LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDOVERLAYFX); @@ -131,24 +132,24 @@ HRESULT CreateBackBufferSurface(LPDDRAWI_DIRECTDRAW_INT This, LPDDRAWI_DDRAWSURFACE_INT *That, LPDDRAWI_DDRAWSURFACE_LCL *lpLcl, LPDDSURFACEDESC2 pDDSD); HRESULT CreatePrimarySurface(LPDDRAWI_DIRECTDRAW_INT This, LPDDRAWI_DDRAWSURFACE_INT *That,LPDDRAWI_DDRAWSURFACE_LCL *lpLcl, LPDDSURFACEDESC2 pDDSD); -/* DirectDraw Object struct - - DDRAWI_DIRECTDRAW_INT +/* DirectDraw Object struct + + DDRAWI_DIRECTDRAW_INT it is the the return pointer from ddraw.dll to the program - + DDRAWI_DIRECTDRAW_LCL - It is the program own private data + It is the program own private data DDRAWI_DIRECTDRAW_GBL This struct is gboal for whole ddraw.dll for all program - it is static in ddraw if it change it change for all - program - - The struct - - from
http://msdn2.microsoft.com/en-us/library/ms898267.aspx
- it was not document for windows 2000/xp/2003 but ms did document it - for windows ce 5.0 the link are to windows ce 5.0 arch + it is static in ddraw if it change it change for all + program + + The struct + + from
http://msdn2.microsoft.com/en-us/library/ms898267.aspx
+ it was not document for windows 2000/xp/2003 but ms did document it + for windows ce 5.0 the link are to windows ce 5.0 arch typedef struct _DDRAWI_DIRECTDRAW_INT { LPVOID lpVtbl; @@ -157,7 +158,7 @@ DWORD dwIntRefCnt; } DDRAWI_DIRECTDRAW_INT; - rest of the struct are from msdn for windows 2000/xp/2003 + rest of the struct are from msdn for windows 2000/xp/2003 typedef struct _DDRAWI_DIRECTDRAW_LCL { DWORD lpDDMore; LPDDRAWI_DIRECTDRAW_GBL lpGbl; // fill it from function Create_DirectDraw with static pointer ddgbl @@ -168,9 +169,9 @@ IUnknown FAR *pUnkOuter; DWORD dwObsolete1; ULONG_PTR hWnd; - ULONG_PTR hDC; // create HDC and save it to this pointer + ULONG_PTR hDC; // create HDC and save it to this pointer DWORD dwErrorMode; - LPDDRAWI_DDRAWSURFACE_INT lpPrimary; + LPDDRAWI_DDRAWSURFACE_INT lpPrimary; LPDDRAWI_DDRAWSURFACE_INT lpCB; DWORD dwPreferredMode; HINSTANCE hD3DInstance; @@ -182,9 +183,9 @@ DWORD dwHotTracking; DWORD dwIMEState; ULONG_PTR hWndPopup; - ULONG_PTR hDD; + ULONG_PTR hDD; ULONG_PTR hGammaCalibrator; - LPDDGAMMACALIBRATORPROC lpGammaCalibrator; + LPDDGAMMACALIBRATORPROC lpGammaCalibrator; } DDRAWI_DIRECTDRAW_LCL; @@ -203,7 +204,7 @@ DWORD dwMaxOverlays; DWORD dwCurrOverlays; DWORD dwMonitorFrequency; - DDCORECAPS ddHELCaps; + DDCORECAPS ddHELCaps; DWORD dwUnused2[50]; DDCOLORKEY ddckCKDestOverlay; DDCOLORKEY ddckCKSrcOverlay; @@ -220,7 +221,7 @@ DWORD dwSurfaceLockCount; DWORD dwAliasedLockCnt; ULONG_PTR dwReserved3; - ULONG_PTR hDD; // GdiEntry1 are filling this pointer + ULONG_PTR hDD; // GdiEntry1 are filling this pointer char cObsolete[12]; DWORD dwReserved1; DWORD dwReserved2; @@ -252,7 +253,7 @@ ULONG_PTR lpD3DExtendedCaps; DWORD dwDOSBoxEvent; RECT rectDesktop; - char cDriverName[MAX_DRIVER_NAME]; + char cDriverName[MAX_DRIVER_NAME]; ULONG_PTR lpD3DHALCallbacks3; DWORD dwNumZPixelFormats; LPDDPIXELFORMAT lpZPixelFormats; @@ -262,22 +263,22 @@ } DDRAWI_DIRECTDRAW_GBL; -*/ - - -/* Clipper Object struct - DDRAWI_DDRAWCLIPPER_INT +*/ + + +/* Clipper Object struct + DDRAWI_DDRAWCLIPPER_INT it is the the return pointer from ddraw.dll to the program - + DDRAWI_DDRAWCLIPPER_LCL - It is the program own private data + It is the program own private data DDRAWI_DDRAWCLIPPER_GBL This struct is gboal for whole ddraw.dll for all program - it is static in ddraw if it change it change for all - program - - The struct + it is static in ddraw if it change it change for all + program + + The struct typedef struct _DDRAWI_DDRAWCLIPPER_INT { LPVOID lpVtbl; @@ -413,7 +414,7 @@ */ -/* This comment info maybe is wrong +/* This comment info maybe is wrong bare in mind I am using logic thinking for follow info does not exists in MSDN so I am drawing clude how previews stuffs @@ -434,13 +435,13 @@ DDRAWI_DDKERNELSURFACE_LCL DDRAWI_DDKERNELSURFACE_GBL -follow struct can be easy create +follow struct can be easy create DDRAWI_DDGAMMACONTROL_INT DDRAWI_DDCOLORCONTROL_INT DDRAWI_KERNEL_INT the DDRAWI_DDGAMMACONTROL_INT should looking like this -typedef struct _DDRAWI_DDGAMMACONTROL_INT +typedef struct _DDRAWI_DDGAMMACONTROL_INT { LPVOID lpVtbl; LPDDRAWI_DDGAMMACONTROL_LCL lpLcl; @@ -448,11 +449,11 @@ DWORD dwIntRefCnt; } DDRAWI_DDGAMMACONTROL_INT, *LPDDRAWI_DDGAMMACONTROL_INT -how did I got this struct I looked at all other INT struct how they where +how did I got this struct I looked at all other INT struct how they where build. But it is not 100% sure this one is right untill I/we known how the DDRAWI_DDGAMMACONTROL_LCL works and DDRAWI_DDCOLORCONTROL_GBL our internal struct will look like this -typedef struct _DDRAWI_DDGAMMACONTROL_INT +typedef struct _DDRAWI_DDGAMMACONTROL_INT { LPVOID lpVtbl; LPVOID lpLcl; @@ -462,7 +463,7 @@ same goes for DDRAWI_DDCOLORCONTROL_INT -typedef struct DDRAWI_DDCOLORCONTROL_INT +typedef struct DDRAWI_DDCOLORCONTROL_INT { LPVOID lpVtbl; LPVOID lpLcl; @@ -471,7 +472,7 @@ } DDRAWI_DDCOLORCONTROL_INT, *LPDDRAWI_DDCOLORCONTROL_INT */ -typedef struct DDRAWI_DDCOLORCONTROL_INT +typedef struct DDRAWI_DDCOLORCONTROL_INT { LPVOID lpVtbl; LPVOID lpLcl; @@ -480,7 +481,7 @@ } DDRAWI_DDCOLORCONTROL_INT, *LPDDRAWI_DDCOLORCONTROL_INT; -typedef struct _DDRAWI_DDGAMMACONTROL_INT +typedef struct _DDRAWI_DDGAMMACONTROL_INT { LPVOID lpVtbl; LPVOID lpLcl; @@ -488,7 +489,7 @@ DWORD dwIntRefCnt; } DDRAWI_DDGAMMACONTROL_INT, *LPDDRAWI_DDGAMMACONTROL_INT; -typedef struct _DDRAWI_DDKERNEL_INT +typedef struct _DDRAWI_DDKERNEL_INT { LPVOID lpVtbl; LPVOID lpLcl; @@ -496,7 +497,7 @@ DWORD dwIntRefCnt; } DDRAWI_KERNEL_INT, *LPDDRAWI_KERNEL_INT; -typedef struct _DDRAWI_DDKERNELSURFACE_INT +typedef struct _DDRAWI_DDKERNELSURFACE_INT { LPVOID lpVtbl; LPVOID lpLcl; @@ -535,28 +536,28 @@ HRESULT WINAPI Main_DDrawSurface_SetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface, DDSURFACEDESC2 *DDSD, DWORD Flags); -HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free); +HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free); VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 ); -HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7, LPDDSCAPS2, LPDWORD, LPDWORD ); -HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7, DWORD, HANDLE ); +HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7, LPDDSCAPS2, LPDWORD, LPDWORD ); +HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7, DWORD, HANDLE ); HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 , LPDWORD ); -HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 ); +HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 ); HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7, DWORD, DWORD, DWORD, DWORD, DWORD ); HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX ); HRESULT Hal_DDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect, LPDDSURFACEDESC2 pDDSD, DWORD flags, HANDLE event); HRESULT Hal_DDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAWSURFACE7 override, DWORD dwFlags); HRESULT Hal_DDrawSurface_SetColorKey (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags, LPDDCOLORKEY pCKey); -HRESULT Hal_DDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect); +HRESULT Hal_DDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect); HRESULT Hal_DDrawSurface_GetBltStatus(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags); HRESULT Hal_DDrawSurface_UpdateOverlayDisplay (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags); HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 ); HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 ); VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 ); -HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 , LPDDSCAPS2 ddsaps, LPDWORD , LPDWORD ); -HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7, DWORD, HANDLE ); +HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 , LPDDSCAPS2 ddsaps, LPDWORD , LPDWORD ); +HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7, DWORD, HANDLE ); HRESULT Hel_DirectDraw_GetScanLine(LPDIRECTDRAW7 , LPDWORD ); HRESULT Hel_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 ); HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 , DWORD , DWORD ,DWORD , DWORD , DWORD ); @@ -605,22 +606,22 @@ /*********** Macros ***********/ -/* - use this macro to close - down the debuger text complete +/* + use this macro to close + down the debuger text complete no debuging at all, it will - crash ms debuger in VS + crash ms debuger in VS */ -//#define DX_WINDBG_trace() +//#define DX_WINDBG_trace() //#define DX_STUB -//#define DX_STUB_DD_OK return DD_OK; -//#define DX_STUB_str(x) +//#define DX_STUB_DD_OK return DD_OK; +//#define DX_STUB_str(x) //#define DX_WINDBG_trace_res -/* - Use this macro if you want deboug in visual studio or +/* + Use this macro if you want deboug in visual studio or if you have a program to look at the _INT struct from ReactOS ddraw.dll or ms ddraw.dll, so you can see what value ms are being setup. @@ -629,16 +630,16 @@ */ -//#define DX_WINDBG_trace() +//#define DX_WINDBG_trace() //#define DX_STUB -//#define DX_STUB_DD_OK return DD_OK; +//#define DX_STUB_DD_OK return DD_OK; //#define DX_STUB_str(x) printf("%s",x); //#define DX_WINDBG_trace_res -/* +/* use this if want doing a trace from a program like a game and ReactOS ddraw.dll in windows - so you can figout what going wrong and what + so you can figout what going wrong and what api are being call or if it hel or is it hal This marco does not create warings when you compile @@ -655,8 +656,8 @@ firstcall = FALSE; \ } \ } \ - return DDERR_UNSUPPORTED; - + return DDERR_UNSUPPORTED; + #define DX_STUB_DD_OK \ @@ -670,8 +671,8 @@ firstcall = FALSE; \ } \ } \ - return DD_OK; - + return DD_OK; + #define DX_STUB_str(x) \ { \ Modified: trunk/reactos/dll/directx/ddraw/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
============================================================================== --- trunk/reactos/dll/directx/ddraw/startup.c (original) +++ trunk/reactos/dll/directx/ddraw/startup.c Sun Apr 22 17:54:34 2007 @@ -3,7 +3,7 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: lib/ddraw/ddraw.c - * PURPOSE: DirectDraw Library + * PURPOSE: DirectDraw Library * PROGRAMMER: Magnus Olsen (greatlrd) * */ @@ -13,27 +13,95 @@ #include "d3dhal.h" #include "ddrawgdi.h" +#include "ddrawi.h" DDRAWI_DIRECTDRAW_GBL ddgbl; DDRAWI_DDRAWSURFACE_GBL ddSurfGbl; -HRESULT WINAPI + +HRESULT +WINAPI +Create_DirectDraw (LPGUID pGUID, + LPDIRECTDRAW* pIface, + REFIID id, + BOOL ex) +{ + LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; + + DX_WINDBG_trace(); + + if (This == NULL) + { + /* We do not have a DirectDraw interface, we need alloc it*/ + LPDDRAWI_DIRECTDRAW_INT memThis; + + memThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); + This = memThis; + if (This == NULL) + { + if (memThis != NULL) DxHeapMemFree(memThis); + return DDERR_OUTOFMEMORY; + } + } + else + { + /* We got the DirectDraw interface alloc and we need create the link */ + LPDDRAWI_DIRECTDRAW_INT newThis; + newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); + if (newThis == NULL) + return DDERR_OUTOFMEMORY; + /* we need check the GUID lpGUID what type it is */ + if (pGUID != (LPGUID)DDCREATE_HARDWAREONLY) + { + if (pGUID !=NULL) + { + This = newThis; + return DDERR_INVALIDDIRECTDRAWGUID; + } + } + newThis->lpLink = This; + This = newThis; + } + + /* Fixme release memory alloc if we fail */ + This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); + if (This->lpLcl == NULL) + return DDERR_OUTOFMEMORY; + + *pIface = (LPDIRECTDRAW)This; + + /* Get right interface we whant */ + if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface)) + { + if (StartDirectDraw((LPDIRECTDRAW*)This, pGUID, FALSE) == DD_OK); + return DD_OK; + } + + return DDERR_INVALIDPARAMS; +} + + +HRESULT WINAPI StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable) { LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; DWORD hal_ret = DD_FALSE; DWORD hel_ret = DD_FALSE; - DEVMODE devmode; - HBITMAP hbmp; - const UINT bmiSize = sizeof(BITMAPINFOHEADER) + 0x10; - UCHAR *pbmiData; - BITMAPINFO *pbmi; - DWORD *pMasks; - INT devicetypes = 0; - DWORD dwFlags = 0; - + DWORD devicetypes = 0; + DWORD dwFlags; + DX_WINDBG_trace(); - + + /* + * ddgbl.dwPDevice is not longer in use in windows 2000 and higher + * I am using it for device type + * devicetypes = 1 : both hal and hel are enable + * devicetypes = 2 : both hal are enable + * devicetypes = 3 : both hel are enable + * devicetypes = 4 :loading a guid drv from the register + */ + + if (reenable == FALSE) { if (This->lpLink == NULL) @@ -42,7 +110,7 @@ This->lpLcl->lpGbl->dwRefCnt++; if (ddgbl.lpDDCBtmp == NULL) { - ddgbl.lpDDCBtmp = (LPDDHAL_CALLBACKS) DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); + ddgbl.lpDDCBtmp = (LPDDHAL_CALLBACKS) DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); if (ddgbl.lpDDCBtmp == NULL) { DX_STUB_str("Out of memmory"); @@ -52,79 +120,48 @@ } } - /* - Visual studio think this code is a break point if we call - second time to this function, press on continue in visual - studio the program will work. No real bug. gcc 3.4.5 genreate - code that look like MS visual studio break point. - */ - - This->lpLcl->lpDDCB = ddgbl.lpDDCBtmp; - - /* Same for HEL and HAL */ - - if (ddgbl.lpModeInfo == NULL) - { - ddgbl.lpModeInfo = (DDHALMODEINFO*) DxHeapMemAlloc(1 * sizeof(DDHALMODEINFO)); - if (ddgbl.lpModeInfo == NULL) - { - DX_STUB_str("DD_FALSE"); - return DD_FALSE; - } - } - - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode); - - This->lpLcl->lpGbl->lpModeInfo[0].dwWidth = devmode.dmPelsWidth; - This->lpLcl->lpGbl->lpModeInfo[0].dwHeight = devmode.dmPelsHeight; - This->lpLcl->lpGbl->lpModeInfo[0].dwBPP = devmode.dmBitsPerPel; - This->lpLcl->lpGbl->lpModeInfo[0].lPitch = (devmode.dmPelsWidth*devmode.dmBitsPerPel)/8; - This->lpLcl->lpGbl->lpModeInfo[0].wRefreshRate = (WORD)devmode.dmDisplayFrequency; - - if (reenable == FALSE) { if (lpGuid == NULL) { - devicetypes = 1; + devicetypes= 1; /* Create HDC for default, hal and hel driver */ - This->lpLcl->hDC = (ULONG_PTR) CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL); - - /* cObsolete is undoc in msdn it being use in CreateDCA */ - RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7); - RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7); - - dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV; - } - else if (lpGuid == (LPGUID) DDCREATE_HARDWAREONLY) - { - devicetypes = 2; - /* Create HDC for default, hal and hel driver */ - This->lpLcl->hDC = (ULONG_PTR)CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL); + This->lpLcl->hDC = (ULONG_PTR) GetDC(GetActiveWindow()); /* cObsolete is undoc in msdn it being use in CreateDCA */ RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7); RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7); dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV; } - else if (lpGuid == (LPGUID) DDCREATE_EMULATIONONLY) - { - devicetypes = 3; - - /* Create HDC for default, hal and hel driver */ - This->lpLcl->hDC = (ULONG_PTR) CreateDCW(L"DISPLAY",L"DISPLAY",NULL,NULL); + else if (lpGuid == (LPGUID) DDCREATE_HARDWAREONLY) + { + devicetypes = 2; + /* Create HDC for default, hal driver */ + This->lpLcl->hDC = (ULONG_PTR) GetDC(GetActiveWindow()); /* cObsolete is undoc in msdn it being use in CreateDCA */ RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7); RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7); - dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV; } + else if (lpGuid == (LPGUID) DDCREATE_EMULATIONONLY) + { + devicetypes = 3; + + /* Create HDC for default, hal and hel driver */ + This->lpLcl->hDC = (ULONG_PTR) GetDC(GetActiveWindow()); + + /* cObsolete is undoc in msdn it being use in CreateDCA */ + RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7); + RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7); + + dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV; + } else { /* FIXME : need getting driver from the GUID that have been pass in from - * the register. we do not support that yet + * the register. we do not support that yet */ devicetypes = 4; This->lpLcl->hDC = (ULONG_PTR) NULL ; @@ -137,50 +174,12 @@ } } - hbmp = CreateCompatibleBitmap((HDC) This->lpLcl->hDC, 1, 1); - if (hbmp==NULL) - { - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC) This->lpLcl->hDC); - DX_STUB_str("DDERR_OUTOFMEMORY"); - return DDERR_OUTOFMEMORY; - } - - pbmiData = (UCHAR *) DxHeapMemAlloc(bmiSize); - pbmi = (BITMAPINFO*)pbmiData; - - if (pbmiData==NULL) - { - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC) This->lpLcl->hDC); - DeleteObject(hbmp); - DX_STUB_str("DDERR_OUTOFMEMORY"); - return DDERR_OUTOFMEMORY; - } - - pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biBitCount = (WORD)devmode.dmBitsPerPel; - pbmi->bmiHeader.biCompression = BI_BITFIELDS; - pbmi->bmiHeader.biWidth = 1; - pbmi->bmiHeader.biHeight = 1; - - GetDIBits((HDC) This->lpLcl->hDC, hbmp, 0, 0, NULL, pbmi, 0); - DeleteObject(hbmp); - - pMasks = (DWORD*)(pbmiData + sizeof(BITMAPINFOHEADER)); - This->lpLcl->lpGbl->lpModeInfo[0].dwRBitMask = pMasks[0]; - This->lpLcl->lpGbl->lpModeInfo[0].dwGBitMask = pMasks[1]; - This->lpLcl->lpGbl->lpModeInfo[0].dwBBitMask = pMasks[2]; - This->lpLcl->lpGbl->lpModeInfo[0].dwAlphaBitMask = pMasks[3]; - - DxHeapMemFree(pbmiData); + This->lpLcl->lpDDCB = ddgbl.lpDDCBtmp; /* Startup HEL and HAL */ - // RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL)); - This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp; This->lpLcl->dwProcessId = GetCurrentProcessId(); - + switch (devicetypes) { case 2: @@ -203,7 +202,7 @@ if (hel_ret!=DD_OK) { DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT"); - return DDERR_NODIRECTDRAWSUPPORT; + return DDERR_NODIRECTDRAWSUPPORT; } dwFlags |= DDRAWI_NOHARDWARE; } @@ -218,595 +217,20 @@ dwFlags |= DDRAWI_EMULATIONINITIALIZED; } - This->lpLcl->lpGbl->dwFlags = dwFlags | DDRAWI_ATTACHEDTODESKTOP; - - This->lpLcl->hDD = This->lpLcl->lpGbl->hDD; - - /* Mix the DDCALLBACKS */ - This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp; - - This->lpLcl->lpDDCB->cbDDCallbacks.dwSize = sizeof(This->lpLcl->lpDDCB->cbDDCallbacks); - - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CANCREATESURFACE; - This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface = This->lpLcl->lpDDCB->HALDD.CanCreateSurface; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CANCREATESURFACE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CANCREATESURFACE; - This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface = This->lpLcl->lpDDCB->HELDD.CanCreateSurface; - } - - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATESURFACE; - This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface = This->lpLcl->lpDDCB->HALDD.CreateSurface; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CREATESURFACE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATESURFACE; - This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface = This->lpLcl->lpDDCB->HELDD.CreateSurface; - } - - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CREATEPALETTE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATEPALETTE; - This->lpLcl->lpDDCB->cbDDCallbacks.CreatePalette = This->lpLcl->lpDDCB->HALDD.CreatePalette; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CREATEPALETTE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATEPALETTE; - This->lpLcl->lpDDCB->cbDDCallbacks.CreatePalette = This->lpLcl->lpDDCB->HELDD.CreatePalette; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_DESTROYDRIVER) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_DESTROYDRIVER; - This->lpLcl->lpDDCB->cbDDCallbacks.DestroyDriver = This->lpLcl->lpDDCB->HALDD.DestroyDriver; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_DESTROYDRIVER) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_DESTROYDRIVER; - This->lpLcl->lpDDCB->cbDDCallbacks.DestroyDriver = This->lpLcl->lpDDCB->HELDD.DestroyDriver; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_FLIPTOGDISURFACE; - This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface = This->lpLcl->lpDDCB->HALDD.FlipToGDISurface; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_FLIPTOGDISURFACE; - This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface = This->lpLcl->lpDDCB->HELDD.FlipToGDISurface; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_GETSCANLINE; - This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine = This->lpLcl->lpDDCB->HALDD.GetScanLine; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_GETSCANLINE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_GETSCANLINE; - This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine = This->lpLcl->lpDDCB->HELDD.GetScanLine; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETCOLORKEY) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETCOLORKEY; - This->lpLcl->lpDDCB->cbDDCallbacks.SetColorKey = This->lpLcl->lpDDCB->HALDD.SetColorKey; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETCOLORKEY) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETCOLORKEY; - This->lpLcl->lpDDCB->cbDDCallbacks.SetColorKey = This->lpLcl->lpDDCB->HELDD.SetColorKey; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETEXCLUSIVEMODE; - This->lpLcl->lpDDCB->cbDDCallbacks.SetExclusiveMode = This->lpLcl->lpDDCB->HALDD.SetExclusiveMode; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETEXCLUSIVEMODE; - This->lpLcl->lpDDCB->cbDDCallbacks.SetExclusiveMode = This->lpLcl->lpDDCB->HELDD.SetExclusiveMode; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETMODE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETMODE; - This->lpLcl->lpDDCB->cbDDCallbacks.SetMode = This->lpLcl->lpDDCB->HALDD.SetMode; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETMODE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETMODE; - This->lpLcl->lpDDCB->cbDDCallbacks.SetMode = This->lpLcl->lpDDCB->HELDD.SetMode; - } - if ((This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_WAITFORVERTICALBLANK; - This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank = - This->lpLcl->lpDDCB->HALDD.WaitForVerticalBlank; - } - else if ((This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_WAITFORVERTICALBLANK; - This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank = - This->lpLcl->lpDDCB->HELDD.WaitForVerticalBlank; - } - - /* Mix the DDSURFACE CALLBACKS */ - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwSize = sizeof(This->lpLcl->lpDDCB->cbDDSurfaceCallbacks); - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_ADDATTACHEDSURFACE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_ADDATTACHEDSURFACE; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.AddAttachedSurface = - This->lpLcl->lpDDCB->HALDDSurface.AddAttachedSurface; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_ADDATTACHEDSURFACE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_ADDATTACHEDSURFACE; - - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.AddAttachedSurface = - This->lpLcl->lpDDCB->HELDDSurface.AddAttachedSurface; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_BLT; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Blt = This->lpLcl->lpDDCB->HALDDSurface.Blt; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_BLT) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_BLT; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Blt = This->lpLcl->lpDDCB->HELDDSurface.Blt; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_DESTROYSURFACE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.DestroySurface = This->lpLcl->lpDDCB->HALDDSurface.DestroySurface; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_DESTROYSURFACE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.DestroySurface = This->lpLcl->lpDDCB->HELDDSurface.DestroySurface; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_FLIP) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_FLIP; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Flip = This->lpLcl->lpDDCB->HALDDSurface.Flip; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_FLIP) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_FLIP; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Flip = This->lpLcl->lpDDCB->HELDDSurface.Flip; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_GETBLTSTATUS) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETBLTSTATUS; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetBltStatus = - This->lpLcl->lpDDCB->HALDDSurface.GetBltStatus; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_GETBLTSTATUS) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETBLTSTATUS; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetBltStatus = This->lpLcl->lpDDCB->HELDDSurface.GetBltStatus; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_GETFLIPSTATUS) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETFLIPSTATUS; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetFlipStatus = This->lpLcl->lpDDCB->HALDDSurface.GetFlipStatus; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_GETFLIPSTATUS) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_GETFLIPSTATUS; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.GetFlipStatus = This->lpLcl->lpDDCB->HELDDSurface.GetFlipStatus; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_LOCK) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_LOCK; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Lock = This->lpLcl->lpDDCB->HALDDSurface.Lock; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_LOCK) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_LOCK; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Lock = This->lpLcl->lpDDCB->HELDDSurface.Lock; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_RESERVED4) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_RESERVED4; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.reserved4 = This->lpLcl->lpDDCB->HALDDSurface.reserved4; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_RESERVED4) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_RESERVED4; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.reserved4 = This->lpLcl->lpDDCB->HELDDSurface.reserved4; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETCLIPLIST) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCLIPLIST; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetClipList = This->lpLcl->lpDDCB->HALDDSurface.SetClipList; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETCLIPLIST) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCLIPLIST; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetClipList = This->lpLcl->lpDDCB->HELDDSurface.SetClipList; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETCOLORKEY) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCOLORKEY; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetColorKey = This->lpLcl->lpDDCB->HALDDSurface.SetColorKey; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETCOLORKEY) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETCOLORKEY; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetColorKey = This->lpLcl->lpDDCB->HELDDSurface.SetColorKey; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETOVERLAYPOSITION; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetOverlayPosition = - This->lpLcl->lpDDCB->HALDDSurface.SetOverlayPosition; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETOVERLAYPOSITION; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetOverlayPosition = - This->lpLcl->lpDDCB->HELDDSurface.SetOverlayPosition; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_SETPALETTE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETPALETTE; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetPalette = This->lpLcl->lpDDCB->HALDDSurface.SetPalette; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_SETPALETTE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_SETPALETTE; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.SetPalette = This->lpLcl->lpDDCB->HELDDSurface.SetPalette; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_UNLOCK) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UNLOCK; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Unlock = This->lpLcl->lpDDCB->HALDDSurface.Unlock; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_UNLOCK) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UNLOCK; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.Unlock = This->lpLcl->lpDDCB->HELDDSurface.Unlock; - } - - if ((This->lpLcl->lpDDCB->HALDDSurface.dwFlags & DDHAL_SURFCB32_UPDATEOVERLAY) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UPDATEOVERLAY; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.UpdateOverlay = This->lpLcl->lpDDCB->HALDDSurface.UpdateOverlay; - } - else if ((This->lpLcl->lpDDCB->HELDDSurface.dwFlags & DDHAL_SURFCB32_UPDATEOVERLAY) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.dwFlags |= DDHAL_SURFCB32_UPDATEOVERLAY; - This->lpLcl->lpDDCB->cbDDSurfaceCallbacks.UpdateOverlay = This->lpLcl->lpDDCB->HELDDSurface.UpdateOverlay; - } - - /* Mix the DDPALETTE CALLBACKS */ - This->lpLcl->lpDDCB->HALDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HALDDPalette); - - if ((This->lpLcl->lpDDCB->HALDDPalette.dwFlags & DDHAL_PALCB32_DESTROYPALETTE) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_SETENTRIES; - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.DestroyPalette = - This->lpLcl->lpDDCB->HALDDPalette.DestroyPalette; - } - else if ((This->lpLcl->lpDDCB->HELDDPalette.dwFlags & DDHAL_PALCB32_DESTROYPALETTE) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_DESTROYPALETTE; - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.DestroyPalette = - This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette; - } - - if ((This->lpLcl->lpDDCB->HALDDPalette.dwFlags & DDHAL_PALCB32_SETENTRIES) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_SETENTRIES; - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.SetEntries = - This->lpLcl->lpDDCB->HALDDPalette.SetEntries; - } - else if ((This->lpLcl->lpDDCB->HELDDPalette.dwFlags & DDHAL_PALCB32_SETENTRIES) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.dwFlags |= DDHAL_PALCB32_SETENTRIES; - This->lpLcl->lpDDCB->cbDDPaletteCallbacks.SetEntries = - This->lpLcl->lpDDCB->HELDDPalette.SetEntries; - } - - /* Mix the DDExeBuf CALLBACKS */ - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwSize = sizeof(This->lpLcl->lpDDCB->cbDDExeBufCallbacks); - - if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CANCREATEEXEBUF) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CanCreateExecuteBuffer = - This->lpLcl->lpDDCB->HALDDExeBuf.CanCreateExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CANCREATEEXEBUF; - } - else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CANCREATEEXEBUF) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CanCreateExecuteBuffer = - This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CANCREATEEXEBUF; - } - - if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CREATEEXEBUF) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CreateExecuteBuffer = - This->lpLcl->lpDDCB->HALDDExeBuf.CreateExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CREATEEXEBUF; - } - else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_CREATEEXEBUF) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CreateExecuteBuffer = - This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_CREATEEXEBUF; - } - - if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_DESTROYEXEBUF) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.DestroyExecuteBuffer = - This->lpLcl->lpDDCB->HALDDExeBuf.DestroyExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_DESTROYEXEBUF; - } - else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_DESTROYEXEBUF) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.DestroyExecuteBuffer = - This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_DESTROYEXEBUF; - } - - if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_LOCKEXEBUF) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.LockExecuteBuffer = - This->lpLcl->lpDDCB->HALDDExeBuf.LockExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_LOCKEXEBUF; - } - else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_LOCKEXEBUF) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.LockExecuteBuffer = - This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_LOCKEXEBUF; - } - - if ((This->lpLcl->lpDDCB->HALDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_UNLOCKEXEBUF) && (devicetypes !=3)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.UnlockExecuteBuffer = - This->lpLcl->lpDDCB->HALDDExeBuf.UnlockExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_UNLOCKEXEBUF; - } - else if ((This->lpLcl->lpDDCB->HELDDExeBuf.dwFlags & DDHAL_EXEBUFCB32_UNLOCKEXEBUF) && (devicetypes !=2)) - { - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.UnlockExecuteBuffer = - This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer; - This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |= DDHAL_EXEBUFCB32_UNLOCKEXEBUF; - } - /* Fill some basic info for Surface */ - - /* FIXME - We need setup this also - This->lpLcl->lpDDCB->cbDDColorControlCallbacks - This->lpLcl->lpDDCB->cbDDKernelCallbacks - This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks - This->lpLcl->lpDDCB->cbDDMotionCompCallbacks - This->lpLcl->lpDDCB->cbDDVideoPortCallbacks - */ This->lpLcl->hDD = ddgbl.hDD; return DD_OK; } - -HRESULT WINAPI -StartDirectDrawHal(LPDIRECTDRAW* iface, BOOL reenable) -{ - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - DDHAL_GETDRIVERINFODATA DriverInfo; - - DDHALINFO mHALInfo; - DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks; - D3DHAL_CALLBACKS mD3dCallbacks; - D3DHAL_GLOBALDRIVERDATA mD3dDriverData; - UINT mcvmList; - VIDMEM *mpvmList; - - UINT mcFourCC; - DWORD *mpFourCC; - UINT mcTextures; - DDSURFACEDESC *mpTextures; - - /* HAL Startup process */ - BOOL newmode = FALSE; - RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO)); - - if (reenable == FALSE) - { - ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); - if ( ddgbl.lpDDCBtmp == NULL) - { - return DD_FALSE; - } - } - else - { - RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS)); - } - - /* - Startup DX HAL step one of three - */ - if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC)) - { - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - return DD_FALSE; - } - - // Do not relase HDC it have been map in kernel mode - // DeleteDC(hdc); - - if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode)) - { - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - return DD_FALSE; - } - - - /* - Startup DX HAL step two of three - */ - - if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl, - &mHALInfo, - &ddgbl.lpDDCBtmp->HALDD, - &ddgbl.lpDDCBtmp->HALDDSurface, - &ddgbl.lpDDCBtmp->HALDDPalette, - &mD3dCallbacks, - &mD3dDriverData, - &mD3dBufferCallbacks, - NULL, - NULL, - NULL)) - { - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - // FIXME Close DX fristcall and second call - return DD_FALSE; - } - - mcvmList = mHALInfo.vmiData.dwNumHeaps; - mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * mcvmList); - if (mpvmList == NULL) - { - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - // FIXME Close DX fristcall and second call - return DD_FALSE; - } - - mcFourCC = mHALInfo.ddCaps.dwNumFourCCCodes; - mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mcFourCC); - if (mpFourCC == NULL) - { - DxHeapMemFree(mpvmList); - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - // FIXME Close DX fristcall and second call - return DD_FALSE; - } - - mcTextures = mD3dDriverData.dwNumTextureFormats; - mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mcTextures); - if (mpTextures == NULL) - { - DxHeapMemFree( mpFourCC); - DxHeapMemFree( mpvmList); - DxHeapMemFree( This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - // FIXME Close DX fristcall and second call - return DD_FALSE; - } - - mHALInfo.vmiData.pvmList = mpvmList; - mHALInfo.lpdwFourCC = mpFourCC; - mD3dDriverData.lpTextureFormats = (DDSURFACEDESC*) mpTextures; - - if (!DdQueryDirectDrawObject( - This->lpLcl->lpGbl, - &mHALInfo, - &ddgbl.lpDDCBtmp->HALDD, - &ddgbl.lpDDCBtmp->HALDDSurface, - &ddgbl.lpDDCBtmp->HALDDPalette, - &mD3dCallbacks, - &mD3dDriverData, - &ddgbl.lpDDCBtmp->HALDDExeBuf, - (DDSURFACEDESC*)mpTextures, - mpFourCC, - mpvmList)) - - { - DxHeapMemFree(mpTextures); - DxHeapMemFree(mpFourCC); - DxHeapMemFree(mpvmList); - DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); - DeleteDC((HDC)This->lpLcl->hDC); - // FIXME Close DX fristcall and second call - return DD_FALSE; - } - - - /* - Copy over from HalInfo to DirectDrawGlobal - */ - - // this is wrong, cDriverName need be in ASC code not UNICODE - //memcpy(mDDrawGlobal.cDriverName, mDisplayAdapter, sizeof(wchar)*MAX_DRIVER_NAME); - - memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO)); - memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS)); - - mHALInfo.dwNumModes = 1; - mHALInfo.lpModeInfo = This->lpLcl->lpGbl->lpModeInfo; - mHALInfo.dwMonitorFrequency = This->lpLcl->lpGbl->lpModeInfo[0].wRefreshRate; - - This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency; - This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex; - This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes; - This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo; - This->lpLcl->lpGbl->hInstance = mHALInfo.hInstance; - - This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl; - - - memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA)); - DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA); - DriverInfo.dwContext = This->lpLcl->lpGbl->hDD; - - /* Get the MiscellaneousCallbacks */ - DriverInfo.guidInfo = GUID_MiscellaneousCallbacks; - DriverInfo.lpvData = &ddgbl.lpDDCBtmp->HALDDMiscellaneous; - DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); - mHALInfo.GetDriverInfo(&DriverInfo); - - - /* FIXME - The 3d and private data are not save at moment - - we need lest the private data being setup - for some driver are puting kmode memory there - the memory often contain the private struct + - surface, see MS DDK how MS example driver using - it - - the 3d interface are not so improten if u do not - want the 3d, and we are not writing 3d code yet - so we be okay for now. - */ - - - return DD_OK; -} - -HRESULT WINAPI +HRESULT WINAPI StartDirectDrawHel(LPDIRECTDRAW* iface, BOOL reenable) { LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CanCreateSurface = HelDdCanCreateSurface; - This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreateSurface = HelDdCreateSurface; + This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CanCreateSurface = HelDdCanCreateSurface; + This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreateSurface = HelDdCreateSurface; This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreatePalette = HelDdCreatePalette; This->lpLcl->lpGbl->lpDDCBtmp->HELDD.DestroyDriver = HelDdDestroyDriver; This->lpLcl->lpGbl->lpDDCBtmp->HELDD.FlipToGDISurface = HelDdFlipToGDISurface; @@ -861,7 +285,7 @@ This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDSurface); /* - This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette; + This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette; This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries; This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette); */ @@ -877,152 +301,142 @@ return DD_OK; } -HRESULT -WINAPI -Create_DirectDraw (LPGUID pGUID, - LPDIRECTDRAW* pIface, - REFIID id, - BOOL ex) -{ - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; - - DX_WINDBG_trace(); - - if (!IsEqualGUID(&IID_IDirectDraw7, id)) - { - return DDERR_INVALIDDIRECTDRAWGUID; - } - - if (This == NULL) - { - LPDDRAWI_DIRECTDRAW_INT memThis; - - /* We do not have any DirectDraw interface alloc - * or a idot send in pIface as NULL - */ - memThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); - This = memThis; - if (This == NULL) - { - if (memThis != NULL) - { - /* do not create memmory leak if some - * idot send in pIface as NULL - */ - DxHeapMemFree(memThis); - } - return DDERR_OUTOFMEMORY; + +HRESULT WINAPI +StartDirectDrawHal(LPDIRECTDRAW* iface, BOOL reenable) +{ + + + LPDWORD mpFourCC; + DDHALINFO mHALInfo; + BOOL newmode = FALSE; + LPDDSURFACEDESC mpTextures; + D3DHAL_CALLBACKS mD3dCallbacks; + D3DHAL_GLOBALDRIVERDATA mD3dDriverData; + DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks; + LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; + + + RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO)); + RtlZeroMemory(&mD3dCallbacks, sizeof(D3DHAL_CALLBACKS)); + RtlZeroMemory(&mD3dDriverData, sizeof(D3DHAL_GLOBALDRIVERDATA)); + RtlZeroMemory(&mD3dBufferCallbacks, sizeof(DDHAL_DDEXEBUFCALLBACKS)); + + if (reenable == FALSE) + { + ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); + if ( ddgbl.lpDDCBtmp == NULL) + { + return DD_FALSE; } } else { - /* We got the DirectDraw interface alloc and we need create the link */ - - LPDDRAWI_DIRECTDRAW_INT newThis; - newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); - if (newThis == NULL) - { - return DDERR_OUTOFMEMORY; - } - - /* we need check the GUID lpGUID what type it is */ - if (pGUID != (LPGUID)DDCREATE_HARDWAREONLY) - { - if (pGUID !=NULL) - { - This = newThis; - return DDERR_INVALIDDIRECTDRAWGUID; - } - } - - newThis->lpLink = This; - This = newThis; - } - - This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); - - if (This->lpLcl == NULL) - { - /* FIXME cleanup */ - return DDERR_OUTOFMEMORY; + RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS)); } /* - FIXME - read dwAppHackFlags flag from the system register instead for hard code it + * Startup DX HAL step one of three */ - This->lpLcl->dwAppHackFlags = 0; - This->lpLcl->dwHotTracking = 0; - This->lpLcl->dwIMEState = 0; - This->lpLcl->dwLocalFlags = DDRAWILCL_DIRECTDRAW7; - This->lpLcl->dwLocalRefCnt = 0; - /* - do not rest this flag to NULL it need be unistae for some reason other wise - somet thing will crash dwObsolete1 seam being use for something this was a - supriese for me - */ - //This->lpLcl->dwObsolete1 = 0; - This->lpLcl->dwProcessId = 0; - This->lpLcl->dwUnused0 = 0; - This->lpLcl->hD3DInstance = NULL; - This->lpLcl->hDC = 0; - This->lpLcl->hDDVxd = 0; - This->lpLcl->hFocusWnd = 0; - This->lpLcl->hGammaCalibrator = 0; - /* Do mot inistate this value if we do we can not open the HAL interface */ - //This->lpLcl->hWnd = 0; - This->lpLcl->hWndPopup = 0; - This->lpLcl->lpCB = NULL; - This->lpLcl->lpDDCB = NULL; - This->lpLcl->lpDDMore = 0; - This->lpLcl->lpGammaCalibrator = 0; - This->lpLcl->lpGbl = &ddgbl; - - /* Do mot inistate this value if we do we can not open the HAL interface */ - //This->lpLcl->lpPrimary = NULL; - This->lpLcl->pD3DIUnknown = NULL; - This->lpLcl->pUnkOuter = NULL; - - *pIface = (LPDIRECTDRAW)This; - - if(Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) != S_OK) - { - return DDERR_INVALIDPARAMS; - } - - if (StartDirectDraw((LPDIRECTDRAW*)This, pGUID, FALSE) == DD_OK); - { - return DD_OK; - } - return DDERR_INVALIDPARAMS; + if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC)) + { + DxHeapMemFree(ddgbl.lpDDCBtmp); + return DD_FALSE; + } + + /* Some card disable the dx after it have been created so + * we are force reanble it + */ + if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode)) + { + DxHeapMemFree(ddgbl.lpDDCBtmp); + return DD_FALSE; + } + + if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl, + &mHALInfo, + &ddgbl.lpDDCBtmp->HALDD, + &ddgbl.lpDDCBtmp->HALDDSurface, + &ddgbl.lpDDCBtmp->HALDDPalette, + &mD3dCallbacks, + &mD3dDriverData, + &mD3dBufferCallbacks, + NULL, + NULL, + NULL)) + { + DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); + DxHeapMemFree(ddgbl.lpDDCBtmp); + // FIXME Close DX fristcall and second call + return DD_FALSE; + } + + /* Alloc mpFourCC */ + mpFourCC = NULL; + if (mHALInfo.ddCaps.dwNumFourCCCodes) + { + mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mHALInfo.ddCaps.dwNumFourCCCodes); + if (mpFourCC == NULL) + { + DxHeapMemFree(ddgbl.lpDDCBtmp); + // FIXME Close DX fristcall and second call + return DD_FALSE; + } + } + + /* Alloc mpTextures */ + mpTextures = NULL; + + if (mD3dDriverData.dwNumTextureFormats) + { + mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats); + if (mpTextures == NULL) + { + DxHeapMemFree( mpFourCC); + DxHeapMemFree(ddgbl.lpDDCBtmp); + // FIXME Close DX fristcall and second call + } + return DD_FALSE; + } + + + /* Get all basic data from the driver */ + if (!DdQueryDirectDrawObject( + This->lpLcl->lpGbl, + &mHALInfo, + &ddgbl.lpDDCBtmp->HALDD, + &ddgbl.lpDDCBtmp->HALDDSurface, + &ddgbl.lpDDCBtmp->HALDDPalette, + &mD3dCallbacks, + &mD3dDriverData, + &ddgbl.lpDDCBtmp->HALDDExeBuf, + (DDSURFACEDESC*)mpTextures, + mpFourCC, + NULL)) + { + DxHeapMemFree( mpFourCC); + DxHeapMemFree( mpTextures); + DxHeapMemFree(ddgbl.lpDDCBtmp); + // FIXME Close DX fristcall and second call + return DD_FALSE; + } + + memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO)); + memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS)); + + This->lpLcl->lpGbl->dwNumFourCC = mHALInfo.ddCaps.dwNumFourCCCodes; + This->lpLcl->lpGbl->lpdwFourCC = mpFourCC; + + This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency; + This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex; + This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes; + This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo; + This->lpLcl->lpGbl->hInstance = mHALInfo.hInstance; + This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl; + + /* FIXME convert mpTextures to DDHALMODEINFO */ + DxHeapMemFree( mpTextures); + + /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */ + return DD_OK; } - - - -HRESULT WINAPI -ReCreateDirectDraw(LPDIRECTDRAW* iface) -{ - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - DdDeleteDirectDrawObject(This->lpLcl->lpGbl); - - if ((This->lpLcl->lpGbl->dwFlags & DDRAWI_NOHARDWARE) != DDRAWI_NOHARDWARE) - { - if (This->lpLcl->lpGbl->dwFlags & DDRAWI_EMULATIONINITIALIZED) - { - return StartDirectDraw(iface,NULL, TRUE); - } - else - { - return StartDirectDraw(iface,(LPGUID)DDCREATE_HARDWAREONLY, TRUE); - } - } - else - { - return StartDirectDraw(iface,(LPGUID)DDCREATE_EMULATIONONLY, TRUE); - } - - return DD_FALSE; -} - -
17 years, 5 months
1
0
0
0
[jimtabor] 26460: Implement Wine port EnumLogFontExW2A.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Apr 22 16:46:26 2007 New Revision: 26460 URL:
http://svn.reactos.org/svn/reactos?rev=26460&view=rev
Log: Implement Wine port EnumLogFontExW2A. Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h trunk/reactos/dll/win32/gdi32/objects/utils.c Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
============================================================================== --- trunk/reactos/dll/win32/gdi32/include/gdi32p.h (original) +++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h Sun Apr 22 16:46:26 2007 @@ -157,6 +157,12 @@ CONST LOGFONTW *pW ); +VOID +STDCALL +EnumLogFontExW2A( + LPENUMLOGFONTEXA fontA, + CONST ENUMLOGFONTEXW *fontW ); + /* FIXME: Put in some public header */ UINT WINAPI Modified: trunk/reactos/dll/win32/gdi32/objects/utils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/ut…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/utils.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/utils.c Sun Apr 22 16:46:26 2007 @@ -383,3 +383,21 @@ #undef COPYN #undef COPYS } + +VOID +STDCALL +EnumLogFontExW2A( LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW ) +{ + LogFontW2A( (LPLOGFONTA)fontA, (CONST LOGFONTW *)fontW ); + + WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1, + (LPSTR) fontA->elfFullName, LF_FULLFACESIZE, NULL, NULL ); + fontA->elfFullName[LF_FULLFACESIZE-1] = '\0'; + WideCharToMultiByte( CP_ACP, 0, fontW->elfStyle, -1, + (LPSTR) fontA->elfStyle, LF_FACESIZE, NULL, NULL ); + fontA->elfStyle[LF_FACESIZE-1] = '\0'; + WideCharToMultiByte( CP_ACP, 0, fontW->elfScript, -1, + (LPSTR) fontA->elfScript, LF_FACESIZE, NULL, NULL ); + fontA->elfScript[LF_FACESIZE-1] = '\0'; +} +
17 years, 5 months
1
0
0
0
[arty] 26459: Load ntoskrnl as elf from disk. This represents a pretty radical diversion from previous work.
by arty@svn.reactos.org
Author: arty Date: Sun Apr 22 15:05:31 2007 New Revision: 26459 URL:
http://svn.reactos.org/svn/reactos?rev=26459&view=rev
Log: Load ntoskrnl as elf from disk. This represents a pretty radical diversion from previous work. Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s Sun Apr 22 15:05:31 2007 @@ -6,10 +6,9 @@ sync isync - lis %r1,stack@ha - addi %r1,%r1,stack@l - addi %r1,%r1,16384 - 0x10 - + lis %r1,stackend@ha + addi %r1,%r1,stackend@l + /* Store ofw call addr */ mr %r21,%r5 lis %r10,ofw_call_addr@ha @@ -89,12 +88,16 @@ .long 0 .long 0 .long 0 - - .org 0x1000 + + .align 4 stack: .space 0x4000 - +stackend: + .long 0,0,0,0 + .globl _bss .section ".bss" _bss: .long 0 + + .align 4 Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c Sun Apr 22 15:05:31 2007 @@ -19,6 +19,8 @@ */ #include <freeldr.h> +#include <elf/elf.h> +#include <elf/reactos.h> #include <of_call.h> #include "ppcboot.h" #include "mmu.h" @@ -90,6 +92,9 @@ /* Kernel Entrypoint in Physical Memory */ ULONG_PTR KernelEntry; + +/* Dummy to bring in memmove */ +PVOID memmove_dummy = memmove; /* FUNCTIONS *****************************************************************/ @@ -305,6 +310,9 @@ { PCHAR p; + /* Default kernel base at 2GB */ + KernelBase = 0x80000000; + /* Set KernelBase */ LoaderBlock.KernelBase = KernelBase; @@ -400,171 +408,229 @@ NTAPI FrLdrMapKernel(FILE *KernelImage) { - PIMAGE_DOS_HEADER ImageHeader; - PIMAGE_NT_HEADERS NtHeader; + PIMAGE_DOS_HEADER ImageHeader = 0; + PIMAGE_NT_HEADERS NtHeader = 0; PIMAGE_SECTION_HEADER Section; ULONG SectionCount; ULONG ImageSize; - ULONG_PTR SourceSection; - ULONG_PTR TargetSection; - ULONG SectionSize; - INT i; - PIMAGE_DATA_DIRECTORY RelocationDDir; - PIMAGE_BASE_RELOCATION RelocationDir, RelocationEnd; - ULONG Count; - ULONG_PTR Address, MaxAddress; - PUSHORT TypeOffset; - ULONG_PTR Delta; - PUSHORT ShortPtr; - PULONG LongPtr; + INT i, j; PLOADER_MODULE ModuleData; - - /* Allocate 1024 bytes for PE Header */ - ImageHeader = (PIMAGE_DOS_HEADER)MmAllocateMemory(1024); - - /* Make sure it was succesful */ - if (ImageHeader == NULL) { - - return FALSE; - } - - /* Load the first 1024 bytes of the kernel image so we can read the PE header */ - if (!FsReadFile(KernelImage, 1024, NULL, ImageHeader)) { - - /* Fail if we couldn't read */ - MmFreeMemory(ImageHeader); - return FALSE; - } - - /* Now read the MZ header to get the offset to the PE Header */ - NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)ImageHeader + ImageHeader->e_lfanew); + int phsize, phnum, shsize, shnum, relsize, SectionAddr = 0; + PULONG SectionOffsets; + PCHAR sptr; + Elf32_Ehdr ehdr; + Elf32_Shdr *shdr; /* Get Kernel Base */ - KernelBase = NtHeader->OptionalHeader.ImageBase; FrLdrGetKernelBase(); - - /* Save the Image Size */ - ImageSize = NtHeader->OptionalHeader.SizeOfImage; - - /* Free the Header */ - MmFreeMemory(ImageHeader); - - /* Set the file pointer to zero */ - FsSetFilePointer(KernelImage, 0); /* Allocate kernel memory */ KernelMemory = MmAllocateMemory(KernelMemorySize); - printf("Kernel Memory @%x\n", (int)KernelMemory); - /* Save Entrypoint */ - KernelEntry = NtHeader->OptionalHeader.AddressOfEntryPoint; + printf("Loading ntoskrnl (elf at %x)\n", KernelBase); + + /* Load the first 1024 bytes of the kernel image so we can read the PE header */ + if (!FsReadFile(KernelImage, sizeof(ehdr), NULL, &ehdr)) { + + /* Fail if we couldn't read */ + printf("Couldn't read the elf header\n"); + return FALSE; + } + + printf("Elf header: (%c%c%c type %d machine %d version %d entry %x shoff %x shentsize %d shnum %d)\n", + ehdr.e_ident[1], ehdr.e_ident[2], ehdr.e_ident[3], + ehdr.e_type, + ehdr.e_machine, + ehdr.e_version, + ehdr.e_entry, + ehdr.e_shoff, + ehdr.e_shentsize, + ehdr.e_shnum); + + /* Start by getting elf headers */ + phsize = ehdr.e_phentsize; + phnum = ehdr.e_phnum; + shsize = ehdr.e_shentsize; + shnum = ehdr.e_shnum; + sptr = (PCHAR)MmAllocateMemory(shnum * shsize); + SectionOffsets = (PULONG)MmAllocateMemory(shnum * sizeof(ULONG)); + + /* Read section headers */ + FsSetFilePointer(KernelImage, ehdr.e_shoff); + FsReadFile(KernelImage, shsize * shnum, NULL, sptr); + + printf("Loaded section headers\n"); + + /* Now we'll get the PE Header */ + for( i = 0; i < shnum; i++ ) + { + shdr = (Elf32_Shdr*)(sptr + (i * shsize)); + printf("Header %d: type %d flags %x\n", i, shdr->sh_type, shdr->sh_flags); + /* Find the PE Header */ + if (shdr->sh_type == TYPE_PEHEADER) + { + FsSetFilePointer(KernelImage, shdr->sh_offset); + FsReadFile(KernelImage, shdr->sh_size, NULL, KernelMemory); + ImageHeader = (PIMAGE_DOS_HEADER)KernelMemory; + NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)KernelMemory + SWAPD(ImageHeader->e_lfanew)); + printf("NtHeader at %x\n", SWAPD(ImageHeader->e_lfanew)); + SectionOffsets[i] = 0; + printf("SectionAlignment %x\n", + SWAPD(NtHeader->OptionalHeader.SectionAlignment)); + SectionAddr = ROUND_UP + (shdr->sh_size, SWAPD(NtHeader->OptionalHeader.SectionAlignment)); + printf("Header ends at %x\n", SectionAddr); + break; + } + } + + if(i == shnum) + { + printf("No peheader section encountered :-(\n"); + return 0; + } + + /* Save the Image Size */ + NtHeader->OptionalHeader.ImageBase = SWAPD(KernelBase); /* Load the file image */ - FsReadFile(KernelImage, ImageSize, NULL, KernelMemory); - - /* Reload the NT Header */ - NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)KernelMemory + ImageHeader->e_lfanew); - - /* Load the first section */ Section = IMAGE_FIRST_SECTION(NtHeader); SectionCount = NtHeader->FileHeader.NumberOfSections - 1; - /* Now go to the last section */ - Section += SectionCount; - - /* Walk each section backwards */ - for (i=(INT)SectionCount; i >= 0; i--, Section--) { - - /* Get the disk location and the memory location, and the size */ - SourceSection = RaToPa(Section->PointerToRawData); - TargetSection = RaToPa(Section->VirtualAddress); - SectionSize = Section->SizeOfRawData; - - /* If the section is already mapped correctly, go to the next */ - if (SourceSection == TargetSection) continue; - - /* Load it into memory */ - memmove((PVOID)TargetSection, (PVOID)SourceSection, SectionSize); - - /* Check for unitilizated data */ - if (Section->SizeOfRawData < Section->Misc.VirtualSize) { - - /* Zero it out */ - memset((PVOID)RaToPa(Section->VirtualAddress + Section->SizeOfRawData), - 0, - Section->Misc.VirtualSize - Section->SizeOfRawData); + /* Walk each section */ + for (i=0; i < SectionCount; i++, Section++) + { + shdr = (Elf32_Shdr*)(sptr + (i * shsize)); + if ((shdr->sh_type != SHT_PROGBITS) && + (shdr->sh_type != SHT_NOBITS)) continue; + + SectionOffsets[i] = SectionAddr; + + shdr = (Elf32_Shdr*)(sptr + (i * shsize)); + + /* Get the disk location and the memory location, and the size */ + Section->Misc.VirtualSize = SWAPD(shdr->sh_size); + Section->VirtualAddress = SWAPD(SectionAddr); + Section->SizeOfRawData = SWAPD(shdr->sh_size); + Section->PointerToRawData = SWAPD(shdr->sh_offset); + + if (shdr->sh_type == SHT_PROGBITS) + { + /* Content area */ + printf("Loading section %d at %x\n", i, KernelBase + SectionAddr); + FsSetFilePointer(KernelImage, shdr->sh_offset); + FsReadFile(KernelImage, shdr->sh_size, NULL, KernelMemory + SectionAddr); + } + else if (shdr->sh_type == SHT_NOBITS) + { + /* Zero it out */ + printf("BSS section %d at %x\n", i, KernelBase + SectionAddr); + memset(KernelMemory + SectionAddr, 0, + ROUND_UP(shdr->sh_size, + SWAPD(NtHeader->OptionalHeader.SectionAlignment))); } - } - - /* Get the Relocation Data Directory */ - RelocationDDir = &NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; - - /* Get the Relocation Section Start and End*/ - RelocationDir = (PIMAGE_BASE_RELOCATION)(KernelMemory + RelocationDDir->VirtualAddress); - RelocationEnd = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDDir->Size); - - /* Calculate Difference between Real Base and Compiled Base*/ - Delta = KernelBase - NtHeader->OptionalHeader.ImageBase; - - /* Determine how far we shoudl relocate */ - MaxAddress = (ULONG)KernelMemory + ImageSize; - - /* Relocate until we've processed all the blocks */ - while (RelocationDir < RelocationEnd && RelocationDir->SizeOfBlock > 0) { - - /* See how many Relocation Blocks we have */ - Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(USHORT); - - /* Calculate the Address of this Directory */ - Address = (ULONG)KernelMemory + RelocationDir->VirtualAddress; - - /* Calculate the Offset of the Type */ - TypeOffset = (PUSHORT)(RelocationDir + 1); - - for (i = 0; i < (INT)Count; i++) { - - ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF)); - - switch (*TypeOffset >> 12) { - - case IMAGE_REL_BASED_ABSOLUTE: - break; - - case IMAGE_REL_BASED_HIGH: - *ShortPtr += HIWORD(Delta); - break; - - case IMAGE_REL_BASED_HIGHADJ: - *ShortPtr += - HIWORD(Delta) + ((LOWORD(Delta) & 0x8000) ? 1 : 0); - break; - - case IMAGE_REL_BASED_LOW: - *ShortPtr += LOWORD(Delta); - break; - - case IMAGE_REL_BASED_HIGHLOW: - LongPtr = (PULONG)ShortPtr; - *LongPtr += Delta; - break; - - case IMAGE_REL_BASED_MIPS_JMPADDR: - LongPtr = (PULONG)ShortPtr; - *LongPtr = SignExtend24(*LongPtr,Delta); - break; - - default: - //printf("Unknown relocation %d\n", *TypeOffset >> 12); - break; - } - - TypeOffset++; - } - - /* Move to the next Relocation Table */ - RelocationDir = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDir->SizeOfBlock); - } + + SectionAddr += + ROUND_UP + (shdr->sh_size, SWAPD(NtHeader->OptionalHeader.SectionAlignment)); + } + + ImageSize = SectionAddr; + NtHeader->OptionalHeader.SizeOfImage = SWAPD(ImageSize); + printf("Total image size is %x\n", ImageSize); + + /* Handle relocation sections */ + for (Section = IMAGE_FIRST_SECTION(NtHeader), i = 0; + i < SectionCount; + i++, Section++) { + Elf32_Rela reloc = { }; + ULONG *Target32; + USHORT *Target16; + int numreloc, relstart, targetSection; + Elf32_Sym symbol; + + shdr = (Elf32_Shdr*)(sptr + (i * shsize)); + /* Only relocs here */ + if((shdr->sh_type != SHT_REL) && + (shdr->sh_type != SHT_RELA)) continue; + + relstart = shdr->sh_offset; + relsize = shdr->sh_type == SHT_RELA ? 12 : 8; + numreloc = shdr->sh_size / relsize; + targetSection = shdr->sh_info; + + printf("Found reloc section %d (symbols %d target %d)\n", + i, shdr->sh_link, shdr->sh_info); + + /* Get the symbol section */ + shdr = (Elf32_Shdr*)(sptr + (shdr->sh_link * shsize)); + + for(j = 0; j < numreloc; j++) + { + ULONG S,A,P; + + /* Get the reloc */ + FsSetFilePointer(KernelImage, relstart + (numreloc * relsize)); + FsReadFile(KernelImage, sizeof(reloc), NULL, &reloc); + + /* Get the symbol */ + FsSetFilePointer(KernelImage, shdr->sh_offset + ELF32_R_SYM(reloc.r_info) * sizeof(Elf32_Sym)); + FsReadFile(KernelImage, sizeof(symbol), NULL, &symbol); + + /* Compute addends */ + S = symbol.st_value + KernelBase + SectionOffsets[symbol.st_shndx]; + A = reloc.r_addend; + P = reloc.r_offset + KernelBase + SectionOffsets[targetSection]; + + Target32 = + (ULONG*)(((PCHAR)KernelMemory) + SectionOffsets[targetSection]); + Target16 = (USHORT *)Target32; + + switch (ELF32_R_TYPE(reloc.r_info)) + { + case R_PPC_NONE: + break; + case R_PPC_ADDR32: + *Target32 = S + A; + break; + case R_PPC_UADDR32: /* Special: Treat as RVA */ + *Target32 = S + A - KernelBase; + break; + case R_PPC_ADDR24: + *Target32 = (ADDR24_MASK & (S+A)) | (*Target32 & ~ADDR24_MASK); + break; + case R_PPC_REL24: + *Target32 = (ADDR24_MASK & (S+A-P)) | (*Target32 & ~ADDR24_MASK); + break; + case R_PPC_ADDR16_LO: + *Target16 = S + A; + break; + case R_PPC_ADDR16_HA: + *Target16 = (S + A + 0x8000) >> 16; + break; + default: + printf("Unknown elf reloc type %x\n", ELF32_R_TYPE(reloc.r_info)); + break; + } + } + } + +#if 0 + printf("-- Dumping ntoskrnl memory --\n"); + for (i = 0; i < ImageSize; i++) { + if(!(i & 0xf)) { + if(i) printf("\n"); + for (j = 0; j < 8; j++) + printf("%x", (((KernelBase + i) << (j * 4)) >> 28) & 0xf); + printf(": "); + } + printf("%x%x ", + (*(((PCHAR)KernelMemory)+i)>>4)&0xf, + *(((PCHAR)KernelMemory)+i)&0xf); + } + printf("-- Dump done --\n"); +#endif ModuleData = &reactos_modules[LoaderBlock.ModsCount]; ModuleData->ModStart = (ULONG)KernelMemory; Modified: branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h Sun Apr 22 15:05:31 2007 @@ -86,6 +86,8 @@ #include <reactos/helper.h> /* Needed if debuging is enabled */ #include <comm.h> +/* endianness utilities */ +#include <bytesex.h> #define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n")
17 years, 5 months
1
0
0
0
[dgorbachev] 26458: Fix bug #2188.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Sun Apr 22 04:25:32 2007 New Revision: 26458 URL:
http://svn.reactos.org/svn/reactos?rev=26458&view=rev
Log: Fix bug #2188. Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/trap.s (original) +++ trunk/reactos/ntoskrnl/ke/i386/trap.s Sun Apr 22 04:25:32 2007 @@ -1076,7 +1076,7 @@ jmp AfterRestore FrRestore: - frstor [esi] + frstor [ecx] AfterRestore: /* Set state loaded */
17 years, 5 months
1
0
0
0
[jimtabor] 26457: Removed NtGdiGetObjectType, use GDI_HANDLE_GET_TYPE.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Apr 22 02:23:19 2007 New Revision: 26457 URL:
http://svn.reactos.org/svn/reactos?rev=26457&view=rev
Log: Removed NtGdiGetObjectType, use GDI_HANDLE_GET_TYPE. Modified: trunk/reactos/include/reactos/win32k/ntgdibad.h trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c trunk/reactos/subsystems/win32/win32k/objects/dc.c trunk/reactos/tools/nci/w32ksvc.db Modified: trunk/reactos/include/reactos/win32k/ntgdibad.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdibad.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdibad.h Sun Apr 22 02:23:19 2007 @@ -640,9 +640,6 @@ HRGN hrgn ); -/* Should be done in user-mode using shared GDI Objects. */ -DWORD STDCALL NtGdiGetObjectType(HGDIOBJ hGDIObj); - /* Use NtGdiGetOutlineTextMetricsInternalW. */ UINT STDCALL Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Sun Apr 22 02:23:19 2007 @@ -1417,7 +1417,7 @@ UserGetSystemMetrics(SM_CYICON) : IconSize.cy); DoFlickerFree = (hbrFlickerFreeDraw && - (NtGdiGetObjectType(hbrFlickerFreeDraw) == OBJ_BRUSH)); + (GDI_HANDLE_GET_TYPE(hbrFlickerFreeDraw) == GDI_OBJECT_TYPE_BRUSH)); if(DoFlickerFree) { Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Sun Apr 22 02:23:19 2007 @@ -1874,71 +1874,6 @@ return Ret; } -DWORD STDCALL -NtGdiGetObjectType(HANDLE handle) -{ - GDIOBJHDR * ptr; - INT result; - DWORD objectType; - - ptr = GDIOBJ_LockObj(GdiHandleTable, handle, GDI_OBJECT_TYPE_DONTCARE); - if (ptr == 0) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - objectType = GDIOBJ_GetObjectType(handle); - switch(objectType) - { - case GDI_OBJECT_TYPE_PEN: - result = OBJ_PEN; - break; - case GDI_OBJECT_TYPE_BRUSH: - result = OBJ_BRUSH; - break; - case GDI_OBJECT_TYPE_BITMAP: - result = OBJ_BITMAP; - break; - case GDI_OBJECT_TYPE_FONT: - result = OBJ_FONT; - break; - case GDI_OBJECT_TYPE_PALETTE: - result = OBJ_PAL; - break; - case GDI_OBJECT_TYPE_REGION: - result = OBJ_REGION; - break; - case GDI_OBJECT_TYPE_DC: - result = OBJ_DC; - break; - case GDI_OBJECT_TYPE_METADC: - result = OBJ_METADC; - break; - case GDI_OBJECT_TYPE_METAFILE: - result = OBJ_METAFILE; - break; - case GDI_OBJECT_TYPE_ENHMETAFILE: - result = OBJ_ENHMETAFILE; - break; - case GDI_OBJECT_TYPE_ENHMETADC: - result = OBJ_ENHMETADC; - break; - case GDI_OBJECT_TYPE_EXTPEN: - result = OBJ_EXTPEN; - break; - case GDI_OBJECT_TYPE_MEMDC: - result = OBJ_MEMDC; - break; - - default: - DPRINT1("Magic 0x%08x not implemented\n", objectType); - result = 0; - break; - } - GDIOBJ_UnlockObjByPtr(GdiHandleTable, ptr); - return result; -} DC_GET_VAL( INT, NtGdiGetRelAbs, w.relAbsMode ) DC_GET_VAL( INT, NtGdiGetROP2, w.ROPmode ) Modified: trunk/reactos/tools/nci/w32ksvc.db URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nci/w32ksvc.db?rev=2…
============================================================================== --- trunk/reactos/tools/nci/w32ksvc.db (original) +++ trunk/reactos/tools/nci/w32ksvc.db Sun Apr 22 02:23:19 2007 @@ -137,7 +137,6 @@ NtGdiGetMiterLimit 2 NtGdiGetNearestColor 2 NtGdiGetNearestPaletteIndex 2 -NtGdiGetObjectType 1 NtGdiGetOutlineTextMetrics 3 NtGdiGetPaletteEntries 4 NtGdiGetPath 4
17 years, 5 months
1
0
0
0
[jimtabor] 26456: GetObjectA/W: - During testing of font objects, I passed ENUM/EXT/LOGFONT/EX/W to NtGdiExtGetObjectW. I think it likes EXTLOGFONTW. More resesrch is required. - Added a helper subroutine GetNonFontObject.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Apr 22 01:56:29 2007 New Revision: 26456 URL:
http://svn.reactos.org/svn/reactos?rev=26456&view=rev
Log: GetObjectA/W: - During testing of font objects, I passed ENUM/EXT/LOGFONT/EX/W to NtGdiExtGetObjectW. I think it likes EXTLOGFONTW. More resesrch is required. - Added a helper subroutine GetNonFontObject. Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/dc.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/dc.c Sun Apr 22 01:56:29 2007 @@ -394,6 +394,29 @@ } +int +GetNonFontObject(HGDIOBJ Handle, int Size, LPVOID Buffer) +{ + INT Type = GDI_HANDLE_GET_TYPE(Handle); + + if (Type == GDI_OBJECT_TYPE_REGION) // Not on the check list, so bye. + { + SetLastError(ERROR_INVALID_HANDLE); + return 0; + } + + if (Buffer == NULL) + { + if (Type == GDI_OBJECT_TYPE_PEN) return sizeof(LOGPEN); + else if (Type == GDI_OBJECT_TYPE_REGION) return sizeof(LOGBRUSH); + } + + //Handle = GdiFixUpHandle(Handle); new system is not ready + + return NtGdiExtGetObjectW(Handle, Size, Buffer); +} + + /* * @unimplemented */ @@ -401,36 +424,51 @@ STDCALL GetObjectA(HGDIOBJ Handle, int Size, LPVOID Buffer) { - LOGFONTW LogFontW; + EXTLOGFONTW ExtLogFontW; DWORD Type; - int Result; - - Type = NtGdiGetObjectType(Handle); - if (0 == Type) + int Result = 0; + + Type = GDI_HANDLE_GET_TYPE(Handle); + + if((Type == GDI_OBJECT_TYPE_DC) || + (Type == GDI_OBJECT_TYPE_METAFILE) || + (Type == GDI_OBJECT_TYPE_ENHMETAFILE)) + { + SetLastError(ERROR_INVALID_HANDLE); + return 0; + } + + if(Type == GDI_OBJECT_TYPE_COLORSPACE) + { + SetLastError(ERROR_NOT_SUPPORTED); + return 0; + } + + if (Type == GDI_OBJECT_TYPE_FONT) { - /* From Wine: GetObject does not SetLastError() on a null object */ - SetLastError(0); - return 0; - } - - if (OBJ_FONT == Type) - { + if ( Buffer == NULL) return sizeof(LOGFONTA); + if (Size < (int)sizeof(LOGFONTA)) { SetLastError(ERROR_BUFFER_OVERFLOW); return 0; } - Result = NtGdiExtGetObjectW(Handle, sizeof(LOGFONTW), &LogFontW); + Result = NtGdiExtGetObjectW(Handle, sizeof(EXTLOGFONTW), &ExtLogFontW); if (0 == Result) { return 0; } - LogFontW2A((LPLOGFONTA) Buffer, &LogFontW); +/* + During testing of font objects, I passed ENUM/EXT/LOGFONT/EX/W to NtGdiExtGetObjectW. + I think it likes EXTLOGFONTW. So,,, How do we handle the rest when a + caller wants to use E/E/L/E/A structures. Check for size? More research~ + */ + LogFontW2A((LPLOGFONTA) Buffer, &ExtLogFontW.elfLogFont); Result = sizeof(LOGFONTA); } else { - Result = NtGdiExtGetObjectW(Handle, Size, Buffer); + Result = GetNonFontObject(Handle, Size, Buffer); } return Result; @@ -444,7 +482,38 @@ STDCALL GetObjectW(HGDIOBJ Handle, int Size, LPVOID Buffer) { - return NtGdiExtGetObjectW(Handle, Size, Buffer); + + INT Type = GDI_HANDLE_GET_TYPE(Handle); +/* + Check List: + MSDN, "This can be a handle to one of the following: logical bitmap, a brush, + a font, a palette, a pen, or a device independent bitmap created by calling + the CreateDIBSection function." + */ + if((Type == GDI_OBJECT_TYPE_DC) || // Yes, can not pass a normal DC! + (Type == GDI_OBJECT_TYPE_METAFILE) || + (Type == GDI_OBJECT_TYPE_ENHMETAFILE)) + { + SetLastError(ERROR_INVALID_HANDLE); + return 0; + } + + if(Type == GDI_OBJECT_TYPE_COLORSPACE) + { + SetLastError(ERROR_NOT_SUPPORTED); // Not supported yet. + return 0; + } + + if(Type == GDI_OBJECT_TYPE_FONT) + { + if(Buffer == NULL) return sizeof(LOGFONTW); + + if(Size > sizeof(EXTLOGFONTW)) Size = sizeof(EXTLOGFONTW); + + return NtGdiExtGetObjectW(Handle, Size, Buffer); + } + else + return GetNonFontObject(Handle, Size, Buffer); }
17 years, 5 months
1
0
0
0
[weiden] 26455: link against powrprof
by weiden@svn.reactos.org
Author: weiden Date: Sun Apr 22 00:16:11 2007 New Revision: 26455 URL:
http://svn.reactos.org/svn/reactos?rev=26455&view=rev
Log: link against powrprof Modified: trunk/reactos/dll/cpl/sysdm/sysdm.rbuild Modified: trunk/reactos/dll/cpl/sysdm/sysdm.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/sysdm.rbuild…
============================================================================== --- trunk/reactos/dll/cpl/sysdm/sysdm.rbuild (original) +++ trunk/reactos/dll/cpl/sysdm/sysdm.rbuild Sun Apr 22 00:16:11 2007 @@ -17,6 +17,7 @@ <library>shell32</library> <library>shlwapi</library> <library>ole32</library> + <library>powrprof</library> <file>advanced.c</file> <file>environment.c</file> <file>general.c</file>
17 years, 5 months
1
0
0
0
[weiden] 26454: Display current CPU speed
by weiden@svn.reactos.org
Author: weiden Date: Sat Apr 21 23:37:11 2007 New Revision: 26454 URL:
http://svn.reactos.org/svn/reactos?rev=26454&view=rev
Log: Display current CPU speed Modified: trunk/reactos/dll/cpl/cpl.rbuild trunk/reactos/dll/cpl/sysdm/general.c trunk/reactos/dll/cpl/sysdm/precomp.h trunk/reactos/include/psdk/winnt.h Modified: trunk/reactos/dll/cpl/cpl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/cpl.rbuild?rev=264…
============================================================================== --- trunk/reactos/dll/cpl/cpl.rbuild (original) +++ trunk/reactos/dll/cpl/cpl.rbuild Sat Apr 21 23:37:11 2007 @@ -25,6 +25,9 @@ <directory name="ncpa"> <xi:include href="ncpa/ncpa.rbuild" /> </directory> +<directory name="odbccp32"> + <xi:include href="odbccp32/odbccp32.rbuild" /> +</directory> <directory name="powercfg"> <xi:include href="powercfg/powercfg.rbuild" /> </directory> Modified: trunk/reactos/dll/cpl/sysdm/general.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/general.c?re…
============================================================================== --- trunk/reactos/dll/cpl/sysdm/general.c (original) +++ trunk/reactos/dll/cpl/sysdm/general.c Sat Apr 21 23:37:11 2007 @@ -205,24 +205,33 @@ { TCHAR szBuf[64]; - DWORD dwBuf; DWORD BufSize = sizeof(DWORD); DWORD Type = REG_SZ; - - if (RegQueryValueEx(hKey, + PROCESSOR_POWER_INFORMATION ppi; + + ZeroMemory(&ppi, + sizeof(ppi)); + + if ((CallNtPowerInformation(ProcessorInformation, + NULL, + 0, + (PVOID)&ppi, + sizeof(ppi)) == STATUS_SUCCESS && + ppi.CurrentMhz != 0) || + RegQueryValueEx(hKey, Value, NULL, &Type, - (PBYTE)&dwBuf, + (PBYTE)&ppi.CurrentMhz, &BufSize) == ERROR_SUCCESS) { - if (dwBuf < 1000) - { - _stprintf(szBuf, _T("%.2f MHz"), dwBuf); + if (ppi.CurrentMhz < 1000) + { + _stprintf(szBuf, _T("%lu MHz"), ppi.CurrentMhz); } else { - double flt = dwBuf / 1000.0; + double flt = ppi.CurrentMhz / 1000.0; _stprintf(szBuf, _T("%.2f GHz"), flt); } Modified: trunk/reactos/dll/cpl/sysdm/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/precomp.h?re…
============================================================================== --- trunk/reactos/dll/cpl/sysdm/precomp.h (original) +++ trunk/reactos/dll/cpl/sysdm/precomp.h Sat Apr 21 23:37:11 2007 @@ -1,8 +1,12 @@ #ifndef __CPL_PRECOMP_H #define __CPL_PRECOMP_H +#include <ntstatus.h> +#define WIN32_NO_STATUS +#include <windows.h> #include <windows.h> #include <commctrl.h> +#include <powrprof.h> #include <tchar.h> #include <stdio.h> #include <cpl.h> Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=2…
============================================================================== --- trunk/reactos/include/psdk/winnt.h (original) +++ trunk/reactos/include/psdk/winnt.h Sat Apr 21 23:37:11 2007 @@ -3667,6 +3667,17 @@ ULONG DefaultAlert2; } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE; +#ifndef __NTDDK_H /* HACK!!! ntddk.h shouldn't include winnt.h! */ +typedef struct _PROCESSOR_POWER_INFORMATION { + ULONG Number; + ULONG MaxMhz; + ULONG CurrentMhz; + ULONG MhzLimit; + ULONG MaxIdleState; + ULONG CurrentIdleState; +} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; +#endif + typedef DWORD EXECUTION_STATE; typedef enum _POWER_INFORMATION_LEVEL { SystemPowerPolicyAc,
17 years, 5 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
38
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Results per page:
10
25
50
100
200