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
December
November
October
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
March 2009
----- 2024 -----
December 2024
November 2024
October 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
28 participants
483 discussions
Start a n
N
ew thread
[cwittich] 40226: sync DDE to wine 1.1.17
by cwittich@svn.reactos.org
Author: cwittich Date: Wed Mar 25 16:57:58 2009 New Revision: 40226 URL:
http://svn.reactos.org/svn/reactos?rev=40226&view=rev
Log: sync DDE to wine 1.1.17 Modified: trunk/reactos/dll/win32/user32/include/dde_private.h trunk/reactos/dll/win32/user32/misc/dde.c trunk/reactos/dll/win32/user32/misc/ddeclient.c trunk/reactos/dll/win32/user32/misc/ddeserver.c Modified: trunk/reactos/dll/win32/user32/include/dde_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/d…
============================================================================== --- trunk/reactos/dll/win32/user32/include/dde_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/dde_private.h [iso-8859-1] Wed Mar 25 16:57:58 2009 @@ -232,9 +232,9 @@ extern BOOL WDML_UnQueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct); extern void WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt); extern WDML_XACT* WDML_FindTransaction(WDML_CONV* pConv, DWORD tid); -extern HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, - BOOL fDeferUpd, BOOL dAckReq); -extern HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* da); +extern HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, + BOOL fDeferUpd, BOOL fAckReq); +extern HDDEDATA WDML_Global2DataHandle(WDML_CONV* pConv, HGLOBAL hMem, WINE_DDEHEAD* p); extern BOOL WDML_IsAppOwned(HDDEDATA hDdeData); extern WDML_INSTANCE* WDML_GetInstance(DWORD InstId); extern WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd); Modified: trunk/reactos/dll/win32/user32/misc/dde.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/dde.…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/dde.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/dde.c [iso-8859-1] Wed Mar 25 16:57:58 2009 @@ -336,8 +336,8 @@ UINT ret; WNDCLASSEXW wndclass; - TRACE("(%p,%p,0x%x,%d)\n", - pidInst, pfnCallback, afCmd, ulRes); + TRACE("(%p,%p,0x%x,%d,0x%x)\n", + pidInst, pfnCallback, afCmd, ulRes, bUnicode); if (ulRes) { @@ -503,7 +503,6 @@ ret = DMLERR_INVALIDPARAMETER; goto theError; } - HeapFree(GetProcessHeap(), 0, pInstance); /* finished - release heap space used as work store */ /* can't reinitialise if we have initialised nothing !! */ reference_inst = WDML_InstanceList; /* must first check if we have been given a valid instance to re-initialise !! how do we do that ? */ @@ -559,6 +558,9 @@ reference_inst->CBFflags = pInstance->CBFflags; reference_inst->clientOnly = pInstance->clientOnly; reference_inst->monitorFlags = pInstance->monitorFlags; + + HeapFree(GetProcessHeap(), 0, pInstance); /* finished - release heap space used as work store */ + LeaveCriticalSection(&WDML_CritSect); } @@ -795,6 +797,25 @@ } return error_code; +} + +/****************************************************************** + * WDML_SetAllLastError + * + * + */ +static void WDML_SetAllLastError(DWORD lastError) +{ + DWORD threadID; + WDML_INSTANCE* pInstance; + threadID = GetCurrentThreadId(); + pInstance = WDML_InstanceList; + while (pInstance) + { + if (pInstance->threadID == threadID) + pInstance->lastError = lastError; + pInstance = pInstance->next; + } } /* ================================================================ @@ -979,6 +1000,14 @@ cchMax = MAX_BUFFER_LEN; } + /* if there is no input windows returns a NULL string */ + if (hsz == NULL) + { + CHAR *t_ptr = ptr; + *t_ptr = '\0'; + return 1; + } + switch (codepage) { case CP_WINANSI: @@ -1081,7 +1110,9 @@ TRACE("(%d,%s,%d)\n", idInst, debugstr_a(psz), codepage); pInstance = WDML_GetInstance(idInst); - if (pInstance) + if (pInstance == NULL) + WDML_SetAllLastError(DMLERR_INVALIDPARAMETER); + else { if (codepage == 0) codepage = CP_WINANSI; hsz = WDML_CreateString(pInstance, psz, codepage); @@ -1108,7 +1139,9 @@ HSZ hsz = 0; pInstance = WDML_GetInstance(idInst); - if (pInstance) + if (pInstance == NULL) + WDML_SetAllLastError(DMLERR_INVALIDPARAMETER); + else { if (codepage == 0) codepage = CP_WINUNICODE; hsz = WDML_CreateString(pInstance, psz, codepage); @@ -1239,15 +1272,24 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd) { - /* For now, we ignore idInst, hszItem. + + /* Other than check for validity we will ignore for now idInst, hszItem. * The purpose of these arguments still need to be investigated. */ + WDML_INSTANCE* pInstance; HGLOBAL hMem; LPBYTE pByte; DDE_DATAHANDLE_HEAD* pDdh; WCHAR psz[MAX_BUFFER_LEN]; + pInstance = WDML_GetInstance(idInst); + if (pInstance == NULL) + { + WDML_SetAllLastError(DMLERR_INVALIDPARAMETER); + return NULL; + } + if (!GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN)) { psz[0] = HSZ2ATOM(hszItem); @@ -1267,7 +1309,7 @@ return 0; } - pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hMem); + pDdh = GlobalLock(hMem); if (!pDdh) { GlobalFree(hMem); @@ -1285,7 +1327,7 @@ GlobalUnlock(hMem); TRACE("=> %p\n", hMem); - return (HDDEDATA)hMem; + return hMem; } /***************************************************************** @@ -1381,7 +1423,7 @@ TRACE("(%p,%p)\n", hData, pcbDataSize); - pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hMem); + pDdh = GlobalLock(hMem); if (pDdh == NULL) { ERR("Failed on GlobalLock(%p)\n", hMem); @@ -1429,7 +1471,7 @@ DDE_DATAHANDLE_HEAD* pDdh; BOOL ret = FALSE; - pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hData); + pDdh = GlobalLock(hData); if (pDdh != NULL) { ret = pDdh->bAppOwned; @@ -1451,7 +1493,7 @@ * 2 16 clipboard format * 4 ? data to be used */ -HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* p) +HDDEDATA WDML_Global2DataHandle(WDML_CONV* pConv, HGLOBAL hMem, WINE_DDEHEAD* p) { DDEDATA* pDd; HDDEDATA ret = 0; @@ -1472,7 +1514,7 @@ /* fall thru */ case 0: case CF_TEXT: - ret = DdeCreateDataHandle(0, pDd->Value, size, 0, 0, pDd->cfFormat, 0); + ret = DdeCreateDataHandle(pConv->instance->instanceID, pDd->Value, size, 0, 0, pDd->cfFormat, 0); break; case CF_BITMAP: if (size >= sizeof(BITMAP)) @@ -1487,7 +1529,7 @@ bmp->bmPlanes, bmp->bmBitsPixel, pDd->Value + sizeof(BITMAP)))) { - ret = DdeCreateDataHandle(0, (LPBYTE)&hbmp, sizeof(hbmp), + ret = DdeCreateDataHandle(pConv->instance->instanceID, (LPBYTE)&hbmp, sizeof(hbmp), 0, 0, CF_BITMAP, 0); } else ERR("Can't create bmp\n"); @@ -1517,8 +1559,8 @@ DWORD dwSize; HGLOBAL hMem = 0; - dwSize = GlobalSize((HGLOBAL)hDdeData) - sizeof(DDE_DATAHANDLE_HEAD); - pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock((HGLOBAL)hDdeData); + dwSize = GlobalSize(hDdeData) - sizeof(DDE_DATAHANDLE_HEAD); + pDdh = GlobalLock(hDdeData); if (dwSize && pDdh) { WINE_DDEHEAD* wdh = NULL; @@ -1568,7 +1610,7 @@ wdh->cfFormat = pDdh->cfFormat; GlobalUnlock(hMem); } - GlobalUnlock((HGLOBAL)hDdeData); + GlobalUnlock(hDdeData); } return hMem; @@ -1638,9 +1680,10 @@ pConvNext = pConv->next; if (DdeCmpStringHandles(pConv->hszService, hszService) == 0) { + HWND client = pConv->hwndClient, server = pConv->hwndServer; WDML_RemoveConv(pConv, WDML_SERVER_SIDE); /* don't care about return code (whether client window is present or not) */ - PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0); + PostMessageW(client, WM_DDE_TERMINATE, (WPARAM)server, 0); } } if (pServer == pInstance->servers) @@ -1731,7 +1774,7 @@ pConv->next = pInstance->convs[side]; pInstance->convs[side] = pConv; - TRACE("pConv->wStatus %04x\n", pConv->wStatus); + TRACE("pConv->wStatus %04x pInstance(%p)\n", pConv->wStatus, pInstance); return pConv; } Modified: trunk/reactos/dll/win32/user32/misc/ddeclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/ddec…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/ddeclient.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/ddeclient.c [iso-8859-1] Wed Mar 25 16:57:58 2009 @@ -50,7 +50,7 @@ HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic, HCONVLIST hConvList, PCONVCONTEXT pCC) { - FIXME("(%ld,%p,%p,%p,%p): stub\n", idInst, hszService, hszTopic, hConvList, pCC); + FIXME("(%d,%p,%p,%p,%p): stub\n", idInst, hszService, hszTopic, hConvList, pCC); return (HCONVLIST)1; } @@ -91,22 +91,18 @@ WDML_CONV* pConv = NULL; ATOM aSrv = 0, aTpc = 0; - TRACE("(0x%lx,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC); - - EnterCriticalSection(&WDML_CritSect); + TRACE("(0x%x,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC); pInstance = WDML_GetInstance(idInst); if (!pInstance) - { - goto theEnd; - } + return NULL; /* make sure this conv is never created */ pConv = WDML_FindConv(pInstance, WDML_CLIENT_SIDE, hszService, hszTopic); if (pConv != NULL) { ERR("This Conv already exists: (%p)\n", pConv); - goto theEnd; + return NULL; } /* we need to establish a conversation with @@ -114,7 +110,7 @@ if (pInstance->unicode) { - WNDCLASSEXW wndclass; + WNDCLASSEXW wndclass; wndclass.cbSize = sizeof(wndclass); wndclass.style = 0; @@ -135,7 +131,7 @@ } else { - WNDCLASSEXA wndclass; + WNDCLASSEXA wndclass; wndclass.cbSize = sizeof(wndclass); wndclass.style = 0; @@ -168,13 +164,9 @@ if (!aTpc) goto theEnd; } - LeaveCriticalSection(&WDML_CritSect); - /* note: sent messages shall not use packing */ SendMessageTimeoutW( HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndClient, MAKELPARAM(aSrv, aTpc), SMTO_ABORTIFHUNG, 2000, NULL ); - - EnterCriticalSection(&WDML_CritSect); pInstance = WDML_GetInstance(idInst); if (!pInstance) @@ -190,6 +182,7 @@ { WARN("Done with INITIATE, but no Server window available\n"); pConv = NULL; + pInstance->lastError = DMLERR_NO_CONV_ESTABLISHED; goto theEnd; } TRACE("Connected to Server window (%p)\n", pConv->hwndServer); @@ -208,7 +201,6 @@ } theEnd: - LeaveCriticalSection(&WDML_CritSect); if (aSrv) GlobalDeleteAtom(aSrv); if (aTpc) GlobalDeleteAtom(aTpc); @@ -227,14 +219,13 @@ TRACE("(%p)\n", hConv); - EnterCriticalSection(&WDML_CritSect); pConv = WDML_GetConv(hConv, FALSE); if (pConv != NULL && (pConv->wStatus & ST_CLIENT)) { BOOL ret; - /* to reestablist a connection, we have to make sure that: - * 1/ pConv is the converstation attached to the client window (it wouldn't be + /* to reestablish a connection, we have to make sure that: + * 1/ pConv is the conversation attached to the client window (it wouldn't be * if a call to DdeReconnect would have already been done...) * FIXME: is this really an error ??? * 2/ the pConv conversation had really been deconnected @@ -244,7 +235,6 @@ { HWND hwndClient = pConv->hwndClient; HWND hwndServer = pConv->hwndServer; - ATOM aSrv, aTpc; SetWindowLongPtrW(pConv->hwndClient, GWL_WDML_CONVERSATION, 0); @@ -252,13 +242,9 @@ aTpc = WDML_MakeAtomFromHsz(pConv->hszTopic); if (!aSrv || !aTpc) goto theEnd; - LeaveCriticalSection(&WDML_CritSect); - /* note: sent messages shall not use packing */ ret = SendMessageW(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient, MAKELPARAM(aSrv, aTpc)); - - EnterCriticalSection(&WDML_CritSect); pConv = WDML_GetConv(hConv, FALSE); if (pConv == NULL) @@ -291,7 +277,6 @@ } theEnd: - LeaveCriticalSection(&WDML_CritSect); if (aSrv) GlobalDeleteAtom(aSrv); if (aTpc) GlobalDeleteAtom(aTpc); @@ -326,7 +311,7 @@ /* FIXME: hMem is unfreed for now... should be deleted in server */ /* pack DdeAdvise */ - pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem); + pDdeAdvise = GlobalLock(pXAct->hMem); pDdeAdvise->fAckReq = (wType & XTYPF_ACKREQ) ? TRUE : FALSE; pDdeAdvise->fDeferUpd = (wType & XTYPF_NODATA) ? TRUE : FALSE; pDdeAdvise->cfFormat = wFmt; @@ -348,7 +333,7 @@ UINT_PTR uiLo, uiHi; HSZ hsz; - if (msg->message != WM_DDE_ACK || (HWND)msg->wParam != pConv->hwndServer) + if (msg->message != WM_DDE_ACK || WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer) { return WDML_QS_PASS; } @@ -434,7 +419,7 @@ UINT_PTR uiLo, uiHi; HSZ hsz; - if (msg->message != WM_DDE_ACK || (HWND)msg->wParam != pConv->hwndServer) + if (msg->message != WM_DDE_ACK || WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer) { return WDML_QS_PASS; } @@ -507,7 +492,7 @@ UINT_PTR uiLo, uiHi; HSZ hsz; - if ((HWND)msg->wParam != pConv->hwndServer) + if (WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer) return WDML_QS_PASS; switch (msg->message) @@ -533,14 +518,14 @@ if (DdeCmpStringHandles(hsz, pXAct->hszItem) != 0) return WDML_QS_PASS; - pXAct->hDdeData = WDML_Global2DataHandle((HGLOBAL)uiLo, &wdh); + pXAct->hDdeData = WDML_Global2DataHandle(pConv, (HGLOBAL)uiLo, &wdh); if (wdh.fRelease) { GlobalFree((HGLOBAL)uiLo); } if (wdh.fAckReq) { - WDML_PostAck(pConv, WDML_CLIENT_SIDE, 0, FALSE, TRUE, uiHi, msg->lParam, WM_DDE_DATA); + pConv->instance->lastError = DMLERR_MEMORY_ERROR; } else { @@ -583,7 +568,7 @@ { if (clientUnicode) { - memSize = WideCharToMultiByte( CP_ACP, 0, pData, cbData, NULL, 0, NULL, NULL); + memSize = WideCharToMultiByte( CP_ACP, 0, pData, cbData / sizeof(WCHAR), NULL, 0, NULL, NULL); } else { @@ -608,7 +593,7 @@ { if (clientUnicode) { - WideCharToMultiByte( CP_ACP, 0, pData, cbData, pDst, memSize, NULL, NULL); + WideCharToMultiByte( CP_ACP, 0, pData, cbData / sizeof(WCHAR), pDst, memSize, NULL, NULL); } else { @@ -632,11 +617,20 @@ * * */ -static WDML_XACT* WDML_ClientQueueExecute(WDML_CONV* pConv, LPCVOID pData, DWORD cbData) +static WDML_XACT* WDML_ClientQueueExecute(WDML_CONV* pConv, LPVOID pData, DWORD cbData) { WDML_XACT* pXAct; TRACE("XTYP_EXECUTE transaction\n"); + + if (pData == NULL) + { + if (cbData == (DWORD)-1) + pConv->instance->lastError = DMLERR_INVALIDPARAMETER; + else + pConv->instance->lastError = DMLERR_MEMORY_ERROR; + return NULL; + } pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_EXECUTE, 0, 0); if (!pXAct) @@ -644,7 +638,7 @@ if (cbData == (DWORD)-1) { - HDDEDATA hDdeData = (HDDEDATA)pData; + HDDEDATA hDdeData = pData; pData = DdeAccessData(hDdeData, &cbData); if (pData) @@ -673,7 +667,7 @@ DDEACK ddeAck; UINT_PTR uiLo, uiHi; - if (msg->message != WM_DDE_ACK || (HWND)msg->wParam != pConv->hwndServer) + if (msg->message != WM_DDE_ACK || WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer) { return WDML_QS_PASS; } @@ -701,11 +695,14 @@ * * */ -static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPCVOID pData, DWORD cbData, +static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPVOID pData, DWORD cbData, UINT wFmt, HSZ hszItem) { - WDML_XACT* pXAct; - ATOM atom; + DDE_DATAHANDLE_HEAD *dh; + WDML_XACT *pXAct; + DDEPOKE *ddePoke; + HGLOBAL hglobal; + ATOM atom; TRACE("XTYP_POKE transaction\n"); @@ -715,28 +712,32 @@ pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_POKE, wFmt, hszItem); if (!pXAct) { - GlobalDeleteAtom(atom); - return NULL; + GlobalDeleteAtom(atom); + return NULL; } if (cbData == (DWORD)-1) { - pXAct->hMem = (HDDEDATA)pData; - } - else - { - DDEPOKE* ddePoke; - - pXAct->hMem = GlobalAlloc(GHND | GMEM_DDESHARE, sizeof(DDEPOKE) + cbData); - ddePoke = GlobalLock(pXAct->hMem); - if (ddePoke) - { - memcpy(ddePoke->Value, pData, cbData); - ddePoke->fRelease = FALSE; /* FIXME: app owned ? */ - ddePoke->cfFormat = wFmt; - GlobalUnlock(pXAct->hMem); - } - } + hglobal = pData; + dh = GlobalLock(hglobal); + cbData = GlobalSize(hglobal) - sizeof(DDE_DATAHANDLE_HEAD); + pData = dh + 1; + GlobalUnlock(hglobal); + } + + pXAct->hMem = GlobalAlloc(GHND | GMEM_DDESHARE, FIELD_OFFSET(DDEPOKE, Value[cbData])); + ddePoke = GlobalLock(pXAct->hMem); + if (!ddePoke) + { + pConv->instance->lastError = DMLERR_MEMORY_ERROR; + return NULL; + } + + ddePoke->unused = 0; + ddePoke->fRelease = TRUE; + ddePoke->cfFormat = wFmt; + memcpy(ddePoke->Value, pData, cbData); + GlobalUnlock(pXAct->hMem); pXAct->lParam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)pXAct->hMem, atom); @@ -753,7 +754,7 @@ UINT_PTR uiLo, uiHi; HSZ hsz; - if (msg->message != WM_DDE_ACK && (HWND)msg->wParam != pConv->hwndServer) + if (msg->message != WM_DDE_ACK && WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer) { return WDML_QS_PASS; } @@ -798,7 +799,7 @@ * * handles the reply to a terminate request */ -static WDML_QUEUE_STATE WDML_HandleTerminateReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct) +static WDML_QUEUE_STATE WDML_HandleTerminateReply(WDML_CONV* pConv, MSG* msg) { if (msg->message != WM_DDE_TERMINATE) { @@ -806,7 +807,7 @@ return WDML_QS_SWALLOWED; } - if ((HWND)msg->wParam != pConv->hwndServer) + if (WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer) { FIXME("hmmm shouldn't happen\n"); return WDML_QS_PASS; @@ -821,7 +822,7 @@ } /****************************************************************** - * WDML_HandleReplyData + * WDML_HandleIncomingData * * */ @@ -840,7 +841,7 @@ UnpackDDElParam(WM_DDE_DATA, msg->lParam, &uiLo, &uiHi); hsz = WDML_MakeHszFromAtom(pConv->instance, uiHi); - hDdeDataIn = WDML_Global2DataHandle((HGLOBAL)uiLo, &wdh); + hDdeDataIn = WDML_Global2DataHandle(pConv, (HGLOBAL)uiLo, &wdh); /* billx: * For hot link, data should be passed to its callback with @@ -890,15 +891,10 @@ */ static WDML_QUEUE_STATE WDML_HandleIncomingTerminate(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd) { - if (pConv->hwndServer != (HWND)msg->wParam) + if (pConv->hwndServer != WIN_GetFullHandle((HWND)msg->wParam)) return WDML_QS_PASS; pConv->wStatus |= ST_TERMINATED; - if (!(pConv->instance->CBFflags & CBF_SKIP_DISCONNECTS)) - { - WDML_InvokeCallback(pConv->instance, XTYP_DISCONNECT, 0, (HCONV)pConv, - 0, 0, 0, 0, (pConv->wStatus & ST_ISSELF) ? 1 : 0); - } if (pConv->wStatus & ST_CONNECTED) { /* don't care about result code (if server exists or not) */ @@ -921,6 +917,7 @@ if (pConv->transactions) { + if (ack) *ack = DDE_FNOTPROCESSED; /* first check message against a pending transaction, if any */ switch (pXAct->ddeMsg) { @@ -940,7 +937,7 @@ qs = WDML_HandlePokeReply(pConv, msg, pXAct, ack); break; case WM_DDE_TERMINATE: - qs = WDML_HandleTerminateReply(pConv, msg, pXAct); + qs = WDML_HandleTerminateReply(pConv, msg); break; default: qs = WDML_QS_ERROR; @@ -961,9 +958,8 @@ break; case WDML_QS_HANDLED: /* ok, we have resolved a pending transaction - * notify callback if asynchronous, and remove it in any case + * notify callback if asynchronous. */ - WDML_UnQueueTransaction(pConv, pXAct); if (pXAct->dwTimeout == TIMEOUT_ASYNC && pXAct->ddeMsg != WM_DDE_TERMINATE) { WDML_InvokeCallback(pConv->instance, XTYP_XACT_COMPLETE, pXAct->wFmt, @@ -975,7 +971,6 @@ { *hdd = pXAct->hDdeData; } - WDML_FreeTransaction(pConv->instance, pXAct, TRUE); break; case WDML_QS_PASS: /* no pending transaction found, try a warm/hot link or a termination request */ @@ -987,6 +982,14 @@ case WM_DDE_TERMINATE: qs = WDML_HandleIncomingTerminate(pConv, msg, hdd); break; + case WM_DDE_ACK: + /* This happens at end of DdeClientTransaction XTYP_EXECUTE + * Without this assignment, DdeClientTransaction's return value is undefined + */ + *hdd = (HDDEDATA)TRUE; + if (ack) + *ack = DDE_FACK; + break; } break; case WDML_QS_BLOCK: @@ -1003,13 +1006,13 @@ * waits until an answer for a sent request is received * time out is also handled. only used for synchronous transactions */ -static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML_XACT* pXAct, DWORD *ack) +static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, const WDML_XACT* pXAct, DWORD *ack) { DWORD dwTime; DWORD err; WDML_CONV* pConv; - TRACE("Starting wait for a timeout of %ld ms\n", dwTimeout); + TRACE("Starting wait for a timeout of %d ms\n", dwTimeout); /* FIXME: time 32 bit wrap around */ dwTimeout += GetCurrentTime(); @@ -1026,15 +1029,11 @@ while (PeekMessageW(&msg, 0, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE)) { - WDML_CONV *pConv; - HDDEDATA hdd; - - EnterCriticalSection(&WDML_CritSect); + HDDEDATA hdd = NULL; pConv = WDML_GetConv(hConv, FALSE); if (pConv == NULL) { - LeaveCriticalSection(&WDML_CritSect); /* conversation no longer available... return failure */ return 0; } @@ -1053,13 +1052,11 @@ if (ret) { pConv->instance->lastError = hdd ? DMLERR_NO_ERROR : DMLERR_NOTPROCESSED; - LeaveCriticalSection(&WDML_CritSect); return hdd; } } else { - LeaveCriticalSection(&WDML_CritSect); DispatchMessageW(&msg); } } @@ -1067,8 +1064,6 @@ } TRACE("Timeout !!\n"); - - EnterCriticalSection(&WDML_CritSect); pConv = WDML_GetConv(hConv, FALSE); if (pConv != NULL) @@ -1088,10 +1083,10 @@ pConv->instance->lastError = err; } } - LeaveCriticalSection(&WDML_CritSect); return 0; } + /***************************************************************** * WDML_ClientHandle @@ -1124,6 +1119,7 @@ return hDdeData; } + /***************************************************************** * DdeClientTransaction (USER32.@) */ @@ -1134,7 +1130,7 @@ WDML_XACT* pXAct; HDDEDATA hDdeData = 0; - TRACE("(%p,%ld,%p,%p,%x,%x,%ld,%p)\n", + TRACE("(%p,%d,%p,%p,%x,%x,%d,%p)\n", pData, cbData, hConv, hszItem, wFmt, wType, dwTimeout, pdwResult); if (hConv == 0) @@ -1143,24 +1139,29 @@ return 0; } - EnterCriticalSection(&WDML_CritSect); - pConv = WDML_GetConv(hConv, TRUE); if (pConv == NULL) { /* cannot set error... cannot get back to DDE instance */ - goto theError; + return 0; } switch (wType) { case XTYP_EXECUTE: - /* Windows simply ignores hszItem and wFmt in this case */ + /* Windows simply ignores hszItem and wFmt in this case */ pXAct = WDML_ClientQueueExecute(pConv, pData, cbData); + if (pXAct == NULL) + return 0; break; case XTYP_POKE: - pXAct = WDML_ClientQueuePoke(pConv, pData, cbData, wFmt, hszItem); - break; + if (!hszItem) + { + pConv->instance->lastError = DMLERR_INVALIDPARAMETER; + return 0; + } + pXAct = WDML_ClientQueuePoke(pConv, pData, cbData, wFmt, hszItem); + break; case XTYP_ADVSTART|XTYPF_NODATA: case XTYP_ADVSTART|XTYPF_NODATA|XTYPF_ACKREQ: case XTYP_ADVSTART: @@ -1168,7 +1169,7 @@ if (pData) { pConv->instance->lastError = DMLERR_INVALIDPARAMETER; - goto theError; + return 0; } pXAct = WDML_ClientQueueAdvise(pConv, wType, wFmt, hszItem); break; @@ -1176,70 +1177,49 @@ if (pData) { pConv->instance->lastError = DMLERR_INVALIDPARAMETER; - goto theError; + return 0; } pXAct = WDML_ClientQueueUnadvise(pConv, wFmt, hszItem); break; case XTYP_REQUEST: - if (pData) + if (pData || !hszItem) { pConv->instance->lastError = DMLERR_INVALIDPARAMETER; - goto theError; + return 0; } pXAct = WDML_ClientQueueRequest(pConv, wFmt, hszItem); break; default: - FIXME("Unknown transation\n"); + FIXME("Unknown transaction type %04x\n", wType); /* unknown transaction type */ pConv->instance->lastError = DMLERR_INVALIDPARAMETER; - goto theError; + return 0; } if (pXAct == NULL) { pConv->instance->lastError = DMLERR_MEMORY_ERROR; - goto theError; + return 0; } WDML_QueueTransaction(pConv, pXAct); - if (!PostMessageW(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam)) - { - WARN("Failed posting message %x to %p (error=0x%lx)\n", - pXAct->ddeMsg, pConv->hwndServer, GetLastError()); - pConv->wStatus &= ~ST_CONNECTED; - WDML_UnQueueTransaction(pConv, pXAct); - WDML_FreeTransaction(pConv->instance, pXAct, TRUE); - goto theError; - } - pXAct->dwTimeout = dwTimeout; - /* FIXME: should set the app bits on *pdwResult */ - - if (dwTimeout == TIMEOUT_ASYNC) - { - if (pdwResult) - { - *pdwResult = MAKELONG(0, pXAct->xActID); - } - hDdeData = (HDDEDATA)1; - } - else - { - DWORD count, i; - - count = WDML_CritSect.RecursionCount; - for (i = 0; i < count; i++) - LeaveCriticalSection(&WDML_CritSect); - hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct, pdwResult); - for (i = 0; i < count; i++) - EnterCriticalSection(&WDML_CritSect); - } - LeaveCriticalSection(&WDML_CritSect); + TRACE("pConv->wStatus %04x\n", pConv->wStatus); + + if (pConv->wStatus & ST_BLOCKED) + { + TRACE("Transactions are blocked, add to the queue and exit\n"); + return (HDDEDATA)1; + } + + hDdeData = WDML_ClientHandle(pConv, pXAct, dwTimeout, pdwResult); + if (dwTimeout != TIMEOUT_ASYNC) + { + WDML_UnQueueTransaction(pConv, pXAct); + WDML_FreeTransaction(pConv->instance, pXAct, TRUE); + } return hDdeData; - theError: - LeaveCriticalSection(&WDML_CritSect); - return 0; } /***************************************************************** @@ -1251,9 +1231,6 @@ WDML_CONV* pConv; WDML_XACT* pXAct; - TRACE("(%08lx,%p,%08lx);\n", idInst, hConv, idTransaction); - - EnterCriticalSection(&WDML_CritSect); if ((pInstance = WDML_GetInstance(idInst))) { if (hConv) @@ -1287,7 +1264,6 @@ } } } - LeaveCriticalSection(&WDML_CritSect); return TRUE; } @@ -1347,8 +1323,6 @@ pConv->wStatus |= ST_ISLOCAL; } - WDML_BroadcastDDEWindows(WDML_szEventClass, WM_WDML_CONNECT_CONFIRM, (WPARAM)hwnd, wParam); - GlobalDeleteAtom(uiLo); GlobalDeleteAtom(uiHi); @@ -1358,8 +1332,6 @@ if (iMsg >= WM_DDE_FIRST && iMsg <= WM_DDE_LAST) { - EnterCriticalSection(&WDML_CritSect); - pConv = WDML_GetConvFromWnd(hwnd); if (pConv) @@ -1375,7 +1347,6 @@ WDML_HandleReply(pConv, &msg, &hdd, NULL); } - LeaveCriticalSection(&WDML_CritSect); return 0; } @@ -1390,7 +1361,6 @@ { WDML_CONV* pConv = NULL; WDML_XACT* pXAct; - DWORD count, i; BOOL ret = FALSE; TRACE("(%p)\n", hConv); @@ -1401,7 +1371,6 @@ return FALSE; } - EnterCriticalSection(&WDML_CritSect); pConv = WDML_GetConv(hConv, TRUE); if (pConv != NULL) { @@ -1411,17 +1380,17 @@ pXAct = WDML_ClientQueueTerminate(pConv); if (pXAct != NULL) { - count = WDML_CritSect.RecursionCount; - for (i = 0; i < count; i++) - LeaveCriticalSection(&WDML_CritSect); if (PostMessageW(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam)) + { WDML_SyncWaitTransactionReply(hConv, 10000, pXAct, NULL); - for (i = 0; i < count; i++) - EnterCriticalSection(&WDML_CritSect); - ret = TRUE; + ret = TRUE; + } + else + pConv->instance->lastError = DMLERR_POSTMSG_FAILED; + WDML_FreeTransaction(pConv->instance, pXAct, TRUE); - /* still have to destroy data assosiated with conversation */ + /* still have to destroy data associated with conversation */ WDML_RemoveConv(pConv, WDML_CLIENT_SIDE); } else @@ -1430,7 +1399,6 @@ } } } - LeaveCriticalSection(&WDML_CritSect); return ret; } @@ -1445,12 +1413,10 @@ TRACE("(%p)\n", hConv); - EnterCriticalSection(&WDML_CritSect); pConv = WDML_GetConv(hConv, TRUE); if (pConv) { ret = ImpersonateDdeClientWindow(pConv->hwndClient, pConv->hwndServer); } - LeaveCriticalSection(&WDML_CritSect); return ret; } Modified: trunk/reactos/dll/win32/user32/misc/ddeserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/ddes…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/ddeserver.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/ddeserver.c [iso-8859-1] Wed Mar 25 16:57:58 2009 @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <user32.h> @@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddeml); static const WCHAR szServerNameClass[] = {'D','d','e','S','e','r','v','e','r','N','a','m','e',0}; -const char WDML_szServerConvClassA[] = "DdeServerConvAnsi"; +const char WDML_szServerConvClassA[] = "DdeServerConvAnsi"; const WCHAR WDML_szServerConvClassW[] = {'D','d','e','S','e','r','v','e','r','C','o','n','v','U','n','i','c','o','d','e',0}; static LRESULT CALLBACK WDML_ServerNameProc(HWND, UINT, WPARAM, LPARAM); @@ -58,19 +58,15 @@ ATOM atom = 0; UINT count; - TRACE("(%ld,%p,%p)\n", idInst, hszTopic, hszItem); - - EnterCriticalSection(&WDML_CritSect); + TRACE("(%d,%p,%p)\n", idInst, hszTopic, hszItem); pInstance = WDML_GetInstance(idInst); if (pInstance == NULL || pInstance->links == NULL) - { - goto theError; - } + return FALSE; atom = WDML_MakeAtomFromHsz(hszItem); - if (!atom) goto theError; + if (!atom) return FALSE; /* first compute the number of links which will trigger a message */ count = 0; @@ -94,7 +90,7 @@ hDdeData = WDML_InvokeCallback(pInstance, XTYP_ADVREQ, pLink->uFmt, pLink->hConv, hszTopic, hszItem, 0, --count, 0); - if (hDdeData == (HDDEDATA)CBR_BLOCK) + if (hDdeData == CBR_BLOCK) { /* MS doc is not consistent here */ FIXME("CBR_BLOCK returned for ADVREQ\n"); @@ -127,6 +123,7 @@ { ERR("post message failed\n"); pConv->wStatus &= ~ST_CONNECTED; + pConv->instance->lastError = DMLERR_POSTMSG_FAILED; if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData); GlobalFree(hItemData); goto theError; @@ -135,10 +132,9 @@ } } } - LeaveCriticalSection(&WDML_CritSect); return TRUE; + theError: - LeaveCriticalSection(&WDML_CritSect); if (atom) GlobalDeleteAtom(atom); return FALSE; } @@ -161,15 +157,10 @@ { WDML_SERVER* pServer; WDML_INSTANCE* pInstance; - HDDEDATA hDdeData; HWND hwndServer; WNDCLASSEXW wndclass; - hDdeData = NULL; - - TRACE("(%ld,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd); - - EnterCriticalSection(&WDML_CritSect); + TRACE("(%d,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd); /* First check instance */ @@ -178,7 +169,7 @@ { TRACE("Instance not found as initialised\n"); /* Nothing has been initialised - exit now ! can return TRUE since effect is the same */ - goto theError; + return NULL; } if (hsz2 != 0L) @@ -187,7 +178,7 @@ */ pInstance->lastError = DMLERR_INVALIDPARAMETER; WARN("Reserved parameter no-zero !!\n"); - goto theError; + return NULL; } if (hsz1 == 0 && !(afCmd & DNS_UNREGISTER)) { @@ -196,7 +187,7 @@ */ TRACE("General unregister unexpected flags\n"); pInstance->lastError = DMLERR_INVALIDPARAMETER; - goto theError; + return NULL; } switch (afCmd & (DNS_REGISTER | DNS_UNREGISTER)) @@ -207,7 +198,7 @@ { ERR("Trying to register already registered service!\n"); pInstance->lastError = DMLERR_DLL_USAGE; - goto theError; + return NULL; } TRACE("Adding service name\n"); @@ -234,15 +225,13 @@ RegisterClassExW(&wndclass); - LeaveCriticalSection(&WDML_CritSect); hwndServer = CreateWindowW(szServerNameClass, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0); - EnterCriticalSection(&WDML_CritSect); SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance); SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer); - TRACE("Created nameServer=%p for instance=%08lx\n", hwndServer, idInst); + TRACE("Created nameServer=%p for instance=%08x\n", hwndServer, idInst); pServer->hwndServer = hwndServer; break; @@ -275,19 +264,14 @@ /* trying to filter where no service names !! */ pInstance->lastError = DMLERR_DLL_USAGE; - goto theError; + return NULL; } else { pServer->filterOn = (afCmd & DNS_FILTERON) != 0; } } - LeaveCriticalSection(&WDML_CritSect); return (HDDEDATA)TRUE; - - theError: - LeaveCriticalSection(&WDML_CritSect); - return FALSE; } /****************************************************************** @@ -303,53 +287,53 @@ if (pInstance->unicode) { - WNDCLASSEXW wndclass; - - wndclass.cbSize = sizeof(wndclass); - wndclass.style = 0; - wndclass.lpfnWndProc = WDML_ServerConvProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); - wndclass.hInstance = 0; - wndclass.hIcon = 0; - wndclass.hCursor = 0; - wndclass.hbrBackground = 0; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = WDML_szServerConvClassW; - wndclass.hIconSm = 0; - - RegisterClassExW(&wndclass); - - hwndServerConv = CreateWindowW(WDML_szServerConvClassW, 0, + WNDCLASSEXW wndclass; + + wndclass.cbSize = sizeof(wndclass); + wndclass.style = 0; + wndclass.lpfnWndProc = WDML_ServerConvProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); + wndclass.hInstance = 0; + wndclass.hIcon = 0; + wndclass.hCursor = 0; + wndclass.hbrBackground = 0; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = WDML_szServerConvClassW; + wndclass.hIconSm = 0; + + RegisterClassExW(&wndclass); + + hwndServerConv = CreateWindowW(WDML_szServerConvClassW, 0, WS_CHILD, 0, 0, 0, 0, hwndServerName, 0, 0, 0); } else { - WNDCLASSEXA wndclass; - - wndclass.cbSize = sizeof(wndclass); - wndclass.style = 0; - wndclass.lpfnWndProc = WDML_ServerConvProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); - wndclass.hInstance = 0; - wndclass.hIcon = 0; - wndclass.hCursor = 0; - wndclass.hbrBackground = 0; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = WDML_szServerConvClassA; - wndclass.hIconSm = 0; - - RegisterClassExA(&wndclass); - - hwndServerConv = CreateWindowA(WDML_szServerConvClassA, 0, - WS_CHILD, 0, 0, 0, 0, - hwndServerName, 0, 0, 0); - } - - TRACE("Created convServer=%p (nameServer=%p) for instance=%08lx\n", - hwndServerConv, hwndServerName, pInstance->instanceID); + WNDCLASSEXA wndclass; + + wndclass.cbSize = sizeof(wndclass); + wndclass.style = 0; + wndclass.lpfnWndProc = WDML_ServerConvProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); + wndclass.hInstance = 0; + wndclass.hIcon = 0; + wndclass.hCursor = 0; + wndclass.hbrBackground = 0; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = WDML_szServerConvClassA; + wndclass.hIconSm = 0; + + RegisterClassExA(&wndclass); + + hwndServerConv = CreateWindowA(WDML_szServerConvClassA, 0, + WS_CHILD, 0, 0, 0, 0, + hwndServerName, 0, 0, 0); + } + + TRACE("Created convServer=%p (nameServer=%p) for instance=%08x unicode=%d\n", + hwndServerConv, hwndServerName, pInstance->instanceID, pInstance->unicode); pConv = WDML_AddConv(pInstance, WDML_SERVER_SIDE, hszApp, hszTopic, hwndClient, hwndServerConv); @@ -400,7 +384,7 @@ hwndClient = (HWND)wParam; pInstance = WDML_GetInstanceFromWnd(hwndServer); - TRACE("idInst=%ld, threadID=0x%lx\n", pInstance->instanceID, GetCurrentThreadId()); + TRACE("idInst=%d, threadID=0x%x\n", pInstance->instanceID, GetCurrentThreadId()); if (!pInstance) return 0; /* don't free DDEParams, since this is a broadcast */ @@ -425,9 +409,9 @@ /* FIXME: so far, we don't grab distant convcontext, so only check if remote is * handled under DDEML, and if so build a default context */ - if ((GetClassNameA(hwndClient, buf, sizeof(buf)) && + if ((GetClassNameA(hwndClient, buf, sizeof(buf)) && lstrcmpiA(buf, WDML_szClientConvClassA) == 0) || - (GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) && + (GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) && lstrcmpiW((LPWSTR)buf, WDML_szClientConvClassW) == 0)) { pcc = &cc; @@ -468,7 +452,7 @@ hDdeData = WDML_InvokeCallback(pInstance, XTYP_WILDCONNECT, 0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self); - if (hDdeData == (HDDEDATA)CBR_BLOCK) + if (hDdeData == CBR_BLOCK) { /* MS doc is not consistent here */ FIXME("CBR_BLOCK returned for WILDCONNECT\n"); @@ -578,6 +562,7 @@ ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA, (UINT_PTR)hMem, (UINT_PTR)pXAct->atom))) { + pConv->instance->lastError = DMLERR_POSTMSG_FAILED; DdeFreeDataHandle(hDdeData); GlobalFree(hMem); fAck = FALSE; @@ -632,7 +617,7 @@ HDDEDATA hDdeData = 0; BOOL fAck = TRUE; - pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem); + pDdeAdvise = GlobalLock(pXAct->hMem); uType = XTYP_ADVSTART | (pDdeAdvise->fDeferUpd ? XTYPF_NODATA : 0) | (pDdeAdvise->fAckReq ? XTYPF_ACKREQ : 0); @@ -779,7 +764,7 @@ if (ptr) { - hDdeData = DdeCreateDataHandle(0, ptr, GlobalSize(pXAct->hMem), + hDdeData = DdeCreateDataHandle(pConv->instance->instanceID, ptr, GlobalSize(pXAct->hMem), 0, 0, CF_TEXT, 0); GlobalUnlock(pXAct->hMem); } @@ -804,7 +789,7 @@ case DDE_FNOTPROCESSED: break; } - WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, fBusy, fAck, (UINT)pXAct->hMem, 0, 0); + WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, fBusy, fAck, (UINT_PTR)pXAct->hMem, 0, 0); return WDML_QS_HANDLED; } @@ -842,7 +827,7 @@ HDDEDATA hDdeData; BOOL fBusy = FALSE, fAck = FALSE; - pDdePoke = (DDEPOKE*)GlobalLock(pXAct->hMem); + pDdePoke = GlobalLock(pXAct->hMem); if (!pDdePoke) { return WDML_QS_ERROR; @@ -851,7 +836,7 @@ if (!(pConv->instance->CBFflags & CBF_FAIL_POKES)) { hDdeData = DdeCreateDataHandle(pConv->instance->instanceID, pDdePoke->Value, - GlobalSize(pXAct->hMem) - sizeof(DDEPOKE) + 1, + GlobalSize(pXAct->hMem) - FIELD_OFFSET(DDEPOKE, Value), 0, 0, pDdePoke->cfFormat, 0); if (hDdeData) { @@ -983,25 +968,21 @@ WDML_CONV* pConv; WDML_XACT* pXAct = NULL; - TRACE("%p %04x %08lx %08lx\n", hwndServer, iMsg, wParam , lParam); + TRACE("%p %04x %08lx %08lx\n", hwndServer, iMsg, wParam, lParam); if (iMsg == WM_DESTROY) { - EnterCriticalSection(&WDML_CritSect); pConv = WDML_GetConvFromWnd(hwndServer); if (pConv && !(pConv->wStatus & ST_TERMINATED)) { WDML_ServerHandleTerminate(pConv, NULL); } - LeaveCriticalSection(&WDML_CritSect); } if (iMsg < WM_DDE_FIRST || iMsg > WM_DDE_LAST) { - return IsWindowUnicode(hwndServer) ? DefWindowProcW(hwndServer, iMsg, wParam, lParam) : + return IsWindowUnicode(hwndServer) ? DefWindowProcW(hwndServer, iMsg, wParam, lParam) : DefWindowProcA(hwndServer, iMsg, wParam, lParam); } - - EnterCriticalSection(&WDML_CritSect); pInstance = WDML_GetInstanceFromWnd(hwndServer); pConv = WDML_GetConvFromWnd(hwndServer); @@ -1009,17 +990,17 @@ if (!pConv) { ERR("Got a message (%x) on a not known conversation, dropping request\n", iMsg); - goto theError; - } - if (pConv->hwndClient != (HWND)wParam || pConv->hwndServer != hwndServer) - { - ERR("mismatch between C/S windows and converstation\n"); - goto theError; + return 0; + } + if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer) + { + ERR("mismatch between C/S windows and conversation\n"); + return 0; } if (pConv->instance != pInstance || pConv->instance == NULL) { ERR("mismatch in instances\n"); - goto theError; + return 0; } switch (iMsg) @@ -1058,13 +1039,16 @@ default: FIXME("Unsupported message %x\n", iMsg); + break; } if (pXAct) { pXAct->lParam = lParam; - if (WDML_ServerHandle(pConv, pXAct) == WDML_QS_BLOCK) - { + + if ((pConv->wStatus & ST_BLOCKED) || WDML_ServerHandle(pConv, pXAct) == WDML_QS_BLOCK) + { + TRACE("Transactions are blocked, add to the queue and exit\n"); WDML_QueueTransaction(pConv, pXAct); } else @@ -1072,7 +1056,8 @@ WDML_FreeTransaction(pInstance, pXAct, TRUE); } } - theError: - LeaveCriticalSection(&WDML_CritSect); + else + pConv->instance->lastError = DMLERR_MEMORY_ERROR; + return 0; }
15 years, 9 months
1
0
0
0
[cfinck] 40225: Oops, that was rather dedicated to this tree
by cfinck@svn.reactos.org
Author: cfinck Date: Wed Mar 25 16:03:35 2009 New Revision: 40225 URL:
http://svn.reactos.org/svn/reactos?rev=40225&view=rev
Log: Oops, that was rather dedicated to this tree Modified:
branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregato…
Modified:
branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregato…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/te…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregato…
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregato…
[iso-8859-1] Wed Mar 25 16:03:35 2009 @@ -34,7 +34,7 @@ die("The script already processed this build before!"); // Read the Buildslave test log - $fp = @fopen("
http://reactos.org:8010/builders/
" . $_GET["slavename"] . "/builds/" . $_GET["build"] . "/steps/test/logs/stdio/text", "r"); + $fp = @fopen("
http://build.reactos.org:8010/builders/
" . $_GET["slavename"] . "/builds/" . $_GET["build"] . "/steps/test/logs/stdio/text", "r"); if(!$fp) die("Could not open the test log!");
15 years, 9 months
1
0
0
0
[cfinck] 40224: Switch to the new BuildBot URL
by cfinck@svn.reactos.org
Author: cfinck Date: Wed Mar 25 16:01:53 2009 New Revision: 40224 URL:
http://svn.reactos.org/svn/reactos?rev=40224&view=rev
Log: Switch to the new BuildBot URL Modified:
trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php
Modified:
trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/web…
============================================================================== ---
trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php
[iso-8859-1] (original) +++
trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php
[iso-8859-1] Wed Mar 25 16:01:53 2009 @@ -33,7 +33,7 @@ die("The script already processed this build before!"); // Read the Buildslave test log - $fp = @fopen("
http://reactos.org:8010/builders/
" . $_GET["slavename"] . "/builds/" . $_GET["build"] . "/steps/test/logs/stdio/text", "r"); + $fp = @fopen("
http://build.reactos.org:8010/builders/
" . $_GET["slavename"] . "/builds/" . $_GET["build"] . "/steps/test/logs/stdio/text", "r"); if(!$fp) die("Could not open the test log!");
15 years, 9 months
1
0
0
0
[cwittich] 40223: GetConsoleProcessist -> GetConsoleProcessList
by cwittich@svn.reactos.org
Author: cwittich Date: Wed Mar 25 13:11:53 2009 New Revision: 40223 URL:
http://svn.reactos.org/svn/reactos?rev=40223&view=rev
Log: GetConsoleProcessist -> GetConsoleProcessList Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] Wed Mar 25 13:11:53 2009 @@ -322,7 +322,7 @@ @ stdcall GetConsoleMode(long ptr) @ stdcall GetConsoleNlsMode(long ptr) @ stdcall GetConsoleOutputCP() -@ stub GetConsoleProcess # missing in XP SP3 +@ stub GetConsoleProcessList # missing in XP SP3 @ stdcall GetConsoleScreenBufferInfo(long ptr) @ stdcall GetConsoleSelectionInfo(ptr) @ stdcall GetConsoleTitleA(ptr long)
15 years, 9 months
1
0
0
0
[cwittich] 40222: fix some more typos...
by cwittich@svn.reactos.org
Author: cwittich Date: Wed Mar 25 13:10:17 2009 New Revision: 40222 URL:
http://svn.reactos.org/svn/reactos?rev=40222&view=rev
Log: fix some more typos... Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] Wed Mar 25 13:10:17 2009 @@ -10,7 +10,7 @@ #@ stdcall AddRefActCtx(ptr) @ stdcall AddVectoredExceptionHandler(long ptr) ntdll.RtlAddVectoredExceptionHandler @ stdcall AllocConsole() -@ stub AllocLSCallback # missed in XP SP3 +@ stub AllocLSCallback # missing in XP SP3 @ stdcall AllocateUserPhysicalPages(long ptr ptr) @ stdcall AreFileApisANSI() @ stdcall AssignProcessToJobObject(ptr ptr) @@ -29,7 +29,7 @@ @ stdcall BaseQueryModuleData(str str ptr ptr ptr) #check @ stdcall BaseUpdateAppcompatCache(long long long) @ stub BasepCheckWinSaferRestrictions -@ stub BasepDebugDump # missed in XP SP3 +@ stub BasepDebugDump # missing in XP SP3 @ stdcall Beep(long long) @ stdcall BeginUpdateResourceA(str long) @ stdcall BeginUpdateResourceW(wstr long) @@ -55,7 +55,7 @@ @ stdcall CloseConsoleHandle(long) @ stdcall CloseHandle(long) @ stdcall CloseProfileUserMapping() -@ stub CloseSystemHandle # missed in XP SP3 +@ stub CloseSystemHandle # missing in XP SP3 @ stdcall CmdBatNotification(long) @ stdcall CommConfigDialogA(str long ptr) @ stdcall CommConfigDialogW(wstr long ptr) @@ -64,7 +64,7 @@ @ stdcall CompareStringW(long long wstr long wstr long) @ stdcall ConnectNamedPipe(long ptr) @ stdcall ConsoleMenuControl(long long long) -@ stub ConsoleSubst # missed in XP SP3 +@ stub ConsoleSubst # missing in XP SP3 @ stdcall ContinueDebugEvent(long long long) @ stdcall ConvertDefaultLocale (long) @ stdcall ConvertFiberToThread() @@ -96,7 +96,7 @@ @ stdcall CreateJobObjectA(ptr str) @ stdcall CreateJobObjectW(ptr wstr) @ stdcall CreateJobSet(long ptr long) -@ stub CreateKernelThread # missed in XP SP3 +@ stub CreateKernelThread # missing in XP SP3 @ stdcall CreateMailslotA(ptr long long ptr) @ stdcall CreateMailslotW(ptr long long ptr) @ stdcall CreateMemoryResourceNotification(ptr) @@ -244,10 +244,10 @@ @ stdcall FindResourceW(long wstr wstr) @ stdcall FindVolumeClose(ptr) @ stdcall FindVolumeMountPointClose(ptr) -#@ stdcall FlsAlloc(ptr) # missed in XP SP3 -#@ stdcall FlsFree(long) # missed in XP SP3 -#@ stdcall FlsGetValue(long) # missed in XP SP3 -#@ stdcall FlsSetValue(long ptr) # missed in XP SP3 +#@ stdcall FlsAlloc(ptr) # missing in XP SP3 +#@ stdcall FlsFree(long) # missing in XP SP3 +#@ stdcall FlsGetValue(long) # missing in XP SP3 +#@ stdcall FlsSetValue(long ptr) # missing in XP SP3 @ stdcall FlushConsoleInputBuffer(long) @ stdcall FlushFileBuffers(long) @ stdcall FlushInstructionCache(long long long) @@ -322,7 +322,7 @@ @ stdcall GetConsoleMode(long ptr) @ stdcall GetConsoleNlsMode(long ptr) @ stdcall GetConsoleOutputCP() -@ stub GetConsoleProcessist # missed in XP SP3 +@ stub GetConsoleProcess # missing in XP SP3 @ stdcall GetConsoleScreenBufferInfo(long ptr) @ stdcall GetConsoleSelectionInfo(ptr) @ stdcall GetConsoleTitleA(ptr long) @@ -340,7 +340,7 @@ @ stdcall GetCurrentThreadId() @ stdcall GetDateFormatA(long long ptr str ptr long) @ stdcall GetDateFormatW(long long ptr wstr ptr long) -@ stub GetDaylightFlag # missed in XP SP3 +@ stub GetDaylightFlag # missing in XP SP3 @ stdcall GetDefaultCommConfigA(str ptr long) @ stdcall GetDefaultCommConfigW(wstr ptr long) @ stdcall GetDefaultSortkeySize(ptr) @@ -384,8 +384,8 @@ @ stdcall GetGeoInfoW(long long ptr long long) @ stdcall GetHandleContext(long) @ stdcall GetHandleInformation(long ptr) -@ stub GetSCallbackTarget # missed in XP SP3 -@ stub GetSCallbackTemplate # missed in XP SP3 +@ stub GetSCallbackTarget # missing in XP SP3 +@ stub GetSCallbackTemplate # missing in XP SP3 @ stdcall GetLargePageMinimum() @ stdcall GetLargestConsoleWindowSize(long) @ stdcall GetLastError() @@ -448,7 +448,7 @@ @ stdcall GetProcessTimes(long ptr ptr ptr ptr) @ stdcall GetProcessVersion(long) @ stdcall GetProcessWorkingSetSize(long ptr ptr) -@ stub GetProductName # missed in XP SP3 +@ stub GetProductName # missing in XP SP3 @ stdcall GetProfileIntA(str str long) @ stdcall GetProfileIntW(wstr wstr long) @ stdcall GetProfileSectionA(str ptr long) @@ -456,8 +456,8 @@ @ stdcall GetProfileStringA(str str str ptr long) @ stdcall GetProfileStringW(wstr wstr wstr ptr long) @ stdcall GetQueuedCompletionStatus(long ptr ptr ptr long) -@ stub GetLSCallbackTarget # missed in XP SP3 -@ stub GetLSCallbackTemplate # missed in XP SP3 +@ stub GetLSCallbackTarget # missing in XP SP3 +@ stub GetLSCallbackTemplate # missing in XP SP3 @ stdcall GetShortPathNameA(str ptr long) @ stdcall GetShortPathNameW(wstr ptr long) @ stdcall GetStartupInfoA(ptr) @@ -559,7 +559,7 @@ @ stdcall HeapQueryInformation(long long ptr long ptr) @ stdcall HeapQueryTagW(long long long long ptr) @ stdcall HeapReAlloc(long long ptr long) ntdll.RtlReAllocateHeap -@ stub HeapSetFlags # missed in XP SP3 +@ stub HeapSetFlags # missing in XP SP3 @ stdcall HeapSetInformation(ptr long ptr long) @ stdcall HeapSize(long long ptr) ntdll.RtlSizeHeap @ stdcall HeapSummary(long long ptr) @@ -570,7 +570,7 @@ @ stdcall InitAtomTable(long) @ stdcall InitializeCriticalSection(ptr) @ stdcall InitializeCriticalSectionAndSpinCount(ptr long) -#@ stdcall InitializeCriticalSectionEx(ptr long long) # missed in XP SP3 +#@ stdcall InitializeCriticalSectionEx(ptr long long) # missing in XP SP3 @ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead @ stdcall InitializeSRWLock(ptr) ntdll.RtlInitializeSRWLock @ stdcall InterlockedCompareExchange (ptr long long) @@ -582,7 +582,7 @@ @ stdcall InterlockedPopEntrySList(ptr) ntdll.RtlInterlockedPopEntrySList @ stdcall InterlockedPushEntrySList(ptr ptr) ntdll.RtlInterlockedPushEntrySList @ stdcall InvalidateConsoleDIBits(long long) -@ stub InvalidateNSCache # missed in XP SP3 +@ stub InvalidateNSCache # missing in XP SP3 @ stdcall IsBadCodePtr(ptr) @ stdcall IsBadHugeReadPtr(ptr long) @ stdcall IsBadHugeWritePtr(ptr long) @@ -601,7 +601,7 @@ @ stdcall IsValidLocale(long long) @ stdcall IsValidUILanguage(long) @ stdcall IsWow64Process(ptr ptr) -@ stdcall LCIDToLocaleName(long wstr long long) # needed for wine gecko; missed in XP SP3 +@ stdcall LCIDToLocaleName(long wstr long long) # needed for wine gecko; missing in XP SP3 @ stdcall LCMapStringA(long long str long ptr long) @ stdcall LCMapStringW(long long wstr long ptr long) @ stdcall LeaveCriticalSection(ptr) ntdll.RtlLeaveCriticalSection @@ -622,7 +622,7 @@ @ stdcall LocalShrink(long long) @ stdcall LocalSize(long) @ stdcall LocalUnlock(long) -@ stub LocaleNameToLCID # missed in XP SP3 +@ stub LocaleNameToLCID # missing in XP SP3 @ stdcall LockFile(long long long long long) @ stdcall LockFileEx(long long long long long ptr) @ stdcall LockResource(long) @@ -655,8 +655,8 @@ @ stdcall NeedCurrentDirectoryForExePathW(wstr) @ stdcall NlsConvertIntegerToString(double double double wstr double) @ stdcall NlsGetCacheUpdateCount() -@ stub NlsResetProcessocale # missed in XP SP3 -@ stub NotifyNLSUserCache # missed in XP SP3 +@ stub NlsResetProcessLocale # missing in XP SP3 +@ stub NotifyNLSUserCache # missing in XP SP3 @ stdcall NumaVirtualQueryNode(long long long long) @ stdcall OpenConsoleW(wstr long long long) @ stdcall OpenDataFile(long long) @@ -698,8 +698,8 @@ @ stdcall QueryDosDeviceW(wstr ptr long) @ stdcall QueryInformationJobObject(long long ptr long ptr) @ stdcall QueryMemoryResourceNotification(long ptr) -@ stub QueryNumberOfEventogRecords # missed in XP SP3 -@ stub QueryOldestEventogRecord # missed in XP SP3 +@ stub QueryNumberOfEventLogRecords # missing in XP SP3 +@ stub QueryOldestEventLogRecord # missing in XP SP3 @ stdcall QueryPerformanceCounter(ptr) @ stdcall QueryPerformanceFrequency(ptr) @ stdcall QueryWin31IniFilesMappedToRegistry(long long long long) @@ -726,8 +726,8 @@ @ stdcall RegisterConsoleIME(ptr ptr) @ stdcall RegisterConsoleOS2(long) @ stdcall RegisterConsoleVDM(long long long long long long long long long long long) -@ stub RegisterServiceProcess # missed in XP SP3 -@ stub RegisterSysMsgHandler # missed in XP SP3 +@ stub RegisterServiceProcess # missing in XP SP3 +@ stub RegisterSysMsgHandler # missing in XP SP3 @ stdcall RegisterWaitForInputIdle(ptr) @ stdcall RegisterWaitForSingleObject(ptr long ptr ptr long long) @ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) @@ -811,7 +811,7 @@ @ stdcall SetCriticalSectionSpinCount(ptr long) ntdll.RtlSetCriticalSectionSpinCount @ stdcall SetCurrentDirectoryA(str) @ stdcall SetCurrentDirectoryW(wstr) -@ stub SetDaylightFlag # missed in XP SP3 +@ stub SetDaylightFlag # missing in XP SP3 @ stdcall SetDefaultCommConfigA(str ptr long) @ stdcall SetDefaultCommConfigW(wstr ptr long) @ stdcall SetDllDirectoryA(str) @@ -895,9 +895,9 @@ @ stdcall Thread32First(long ptr) @ stdcall Thread32Next(long ptr) @ stdcall TlsAlloc() -@ stub TlsAllocInternal # missed in XP SP3 +@ stub TlsAllocInternal # missing in XP SP3 @ stdcall TlsFree(long) -@ stub TlsFreeInternal # missed in XP SP3 +@ stub TlsFreeInternal # missing in XP SP3 @ stdcall TlsGetValue(long) @ stdcall TlsSetValue(long ptr) @ stdcall Toolhelp32ReadProcessMemory(long ptr ptr long ptr) @@ -919,8 +919,8 @@ @ stdcall UpdateResourceW(long wstr wstr long ptr long) @ stdcall VDMConsoleOperation(long long) @ stdcall VDMOperationStarted(long) -@ stub ValidateCType # missed in XP SP3 -@ stub ValidatLeocale # missed in XP SP3 +@ stub ValidateCType # missing in XP SP3 +@ stub ValidateLocale # missing in XP SP3 @ stdcall VerLanguageNameA(long str long) @ stdcall VerLanguageNameW(long wstr long) @ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask @@ -981,8 +981,8 @@ @ stdcall WriteTapemark(ptr long long long) @ stdcall WTSGetActiveConsoleSessionId() #@ stdcall ZombifyActCtx(ptr) -@ stub _DebugOut # missed in XP SP3 -@ stub _DebugPrintf # missed in XP SP3 +@ stub _DebugOut # missing in XP SP3 +@ stub _DebugPrintf # missing in XP SP3 @ stdcall _hread(long ptr long) @ stdcall _hwrite(long ptr long) @ stdcall _lclose(long) @@ -991,7 +991,7 @@ @ stdcall _lopen(str long) @ stdcall _lread(long ptr long) _hread @ stdcall _lwrite(long ptr long) _hwrite -@ stub dprintf # missed in XP SP3 +@ stub dprintf # missing in XP SP3 @ stdcall lstrcat(str str) lstrcatA @ stdcall lstrcatA(str str) @ stdcall lstrcatW(wstr wstr)
15 years, 9 months
1
0
0
0
[cwittich] 40221: fix some typos
by cwittich@svn.reactos.org
Author: cwittich Date: Wed Mar 25 12:55:31 2009 New Revision: 40221 URL:
http://svn.reactos.org/svn/reactos?rev=40221&view=rev
Log: fix some typos Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] Wed Mar 25 12:55:31 2009 @@ -837,10 +837,10 @@ @ stdcall SetHandleCount(long) @ stdcall SetHandleInformation(long long long) @ stdcall SetInformationJobObject(long long ptr long) -@ stub SetastConsoleEventActive # missed in XP SP3 +@ stub SetLastConsoleEventActive # missing in XP SP3 @ stdcall SetLastError(long) -@ stub SetocalPrimaryComputerNameA # missed in XP SP3 -@ stub SetocalPrimaryComputerNameW # missed in XP SP3 +@ stub SetLocalPrimaryComputerNameA # missing in XP SP3 +@ stub SetLocalPrimaryComputerNameW # missing in XP SP3 @ stdcall SetLocalTime(ptr) @ stdcall SetLocaleInfoA(long long str) @ stdcall SetLocaleInfoW(long long wstr)
15 years, 9 months
1
0
0
0
[tkreuzer] 40220: Add the macro I forgot.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 07:25:39 2009 New Revision: 40220 URL:
http://svn.reactos.org/svn/reactos?rev=40220&view=rev
Log: Add the macro I forgot. Modified: trunk/rostests/apitests/apitest.h Modified: trunk/rostests/apitests/apitest.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apitest.h?rev=40…
============================================================================== --- trunk/rostests/apitests/apitest.h [iso-8859-1] (original) +++ trunk/rostests/apitests/apitest.h [iso-8859-1] Wed Mar 25 07:25:39 2009 @@ -40,7 +40,7 @@ if (x)\ {\ (pti->passed)++;\ - printf("non-rtest succeeded in %s:%d (%s)\n", __FILE__, __LINE__, #x);\ + printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\ } else {\ (pti->failed)++;\ } \ @@ -52,7 +52,30 @@ (pti->passed)++;\ } else {\ (pti->failed)++;\ - printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\ + printf("%s:%d: test failed (%s)\n", __FILE__, __LINE__, #x);\ + } \ + } + +#define TESTX(x, format, ...) \ + if (pti->bRegress) \ + { \ + if (x)\ + {\ + (pti->passed)++;\ + printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\ + } else {\ + (pti->failed)++;\ + } \ + } \ + else \ + { \ + if (x)\ + {\ + (pti->passed)++;\ + } else {\ + (pti->failed)++;\ + printf("%s:%d: test failed (%s) ", __FILE__, __LINE__, #x);\ + printf(format, __VA_ARGS__); \ } \ }
15 years, 9 months
1
0
0
0
[tkreuzer] 40219: Rewrite the dc state saving implementation. We were doing it wrong and ugly. Now it should work correctly. It's also much fewer and cleaner code.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 07:20:59 2009 New Revision: 40219 URL:
http://svn.reactos.org/svn/reactos?rev=40219&view=rev
Log: Rewrite the dc state saving implementation. We were doing it wrong and ugly. Now it should work correctly. It's also much fewer and cleaner code. Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/objects/dclife.c trunk/reactos/subsystems/win32/win32k/objects/dcstate.c Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Wed Mar 25 07:20:59 2009 @@ -237,18 +237,15 @@ VOID FASTCALL DC_AllocateDcAttr(HDC); VOID FASTCALL DC_FreeDcAttr(HDC); BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody); -HDC FASTCALL DC_GetNextDC (PDC pDC); -VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC); BOOL FASTCALL DC_SetOwnership(HDC DC, PEPROCESS Owner); VOID FASTCALL DC_LockDisplay(HDC); VOID FASTCALL DC_UnlockDisplay(HDC); -VOID FASTCALL IntGdiCopyFromSaveState(PDC, PDC, HDC); -VOID FASTCALL IntGdiCopyToSaveState(PDC, PDC); BOOL FASTCALL IntGdiDeleteDC(HDC, BOOL); VOID FASTCALL DC_UpdateXforms(PDC dc); BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest); VOID FASTCALL DC_vUpdateViewportExt(PDC pdc); +VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst); BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC); BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Wed Mar 25 07:20:59 2009 @@ -2,7 +2,7 @@ * PROJECT: ReactOS Kernel * LICENSE: GPL - See COPYING in the top level directory * FILE: subsystems/win32/win32k/ntuser/windc.c - * PURPOSE: Keyboard layout management + * PURPOSE: Window DC management * COPYRIGHT: Copyright 2007 ReactOS * */ @@ -45,7 +45,7 @@ defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC); RtlZeroMemory(defaultDCstate, sizeof(DC)); defaultDCstate->pdcattr = &defaultDCstate->dcattr; - IntGdiCopyToSaveState(dc, defaultDCstate); + DC_vCopyState(dc, defaultDCstate); DC_UnlockDc( dc ); } return hDC; Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Wed Mar 25 07:20:59 2009 @@ -112,6 +112,8 @@ NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE); NewDC->dclevel.laPath.eMiterLimit = 10.0; + + NewDC->dclevel.lSaveDepth = 1; return NewDC; } @@ -419,7 +421,7 @@ } RtlZeroMemory(defaultDCstate, sizeof(DC)); defaultDCstate->pdcattr = &defaultDCstate->dcattr; - IntGdiCopyToSaveState(dc, defaultDCstate); + DC_vCopyState(dc, defaultDCstate); DC_UnlockDc(dc); } return hDC; @@ -448,7 +450,7 @@ } /* First delete all saved DCs */ - while (DCToDelete->dclevel.lSaveDepth) + while (DCToDelete->dclevel.lSaveDepth > 1) { PDC savedDC; HDC savedHDC; Modified: trunk/reactos/subsystems/win32/win32k/objects/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] Wed Mar 25 07:20:59 2009 @@ -11,231 +11,73 @@ #define NDEBUG #include <debug.h> - VOID FASTCALL -IntGdiCopyToSaveState(PDC dc, PDC newdc) -{ - PDC_ATTR pdcattr, nDc_Attr; - - pdcattr = dc->pdcattr; - nDc_Attr = newdc->pdcattr; - - newdc->dclevel.flPath = dc->dclevel.flPath | DCPATH_SAVESTATE; - - nDc_Attr->dwLayout = pdcattr->dwLayout; - nDc_Attr->hpen = pdcattr->hpen; - nDc_Attr->hbrush = pdcattr->hbrush; - nDc_Attr->hlfntNew = pdcattr->hlfntNew; - newdc->rosdc.hBitmap = dc->rosdc.hBitmap; - newdc->dclevel.hpal = dc->dclevel.hpal; - newdc->rosdc.bitsPerPixel = dc->rosdc.bitsPerPixel; - nDc_Attr->jROP2 = pdcattr->jROP2; - nDc_Attr->jFillMode = pdcattr->jFillMode; - nDc_Attr->jStretchBltMode = pdcattr->jStretchBltMode; - nDc_Attr->lRelAbs = pdcattr->lRelAbs; - nDc_Attr->jBkMode = pdcattr->jBkMode; - nDc_Attr->lBkMode = pdcattr->lBkMode; - nDc_Attr->crBackgroundClr = pdcattr->crBackgroundClr; - nDc_Attr->crForegroundClr = pdcattr->crForegroundClr; - nDc_Attr->ulBackgroundClr = pdcattr->ulBackgroundClr; - nDc_Attr->ulForegroundClr = pdcattr->ulForegroundClr; - nDc_Attr->ptlBrushOrigin = pdcattr->ptlBrushOrigin; - nDc_Attr->lTextAlign = pdcattr->lTextAlign; - nDc_Attr->lTextExtra = pdcattr->lTextExtra; - nDc_Attr->cBreak = pdcattr->cBreak; - nDc_Attr->lBreakExtra = pdcattr->lBreakExtra; - nDc_Attr->iMapMode = pdcattr->iMapMode; - nDc_Attr->iGraphicsMode = pdcattr->iGraphicsMode; -#if 0 - /* Apparently, the DC origin is not changed by [GS]etDCState */ - newdc->ptlDCOrig.x = dc->ptlDCOrig.x; - newdc->ptlDCOrig.y = dc->ptlDCOrig.y; -#endif - nDc_Attr->ptlCurrent = pdcattr->ptlCurrent; - nDc_Attr->ptfxCurrent = pdcattr->ptfxCurrent; - newdc->dclevel.mxWorldToDevice = dc->dclevel.mxWorldToDevice; - newdc->dclevel.mxDeviceToWorld = dc->dclevel.mxDeviceToWorld; - newdc->dclevel.mxWorldToPage = dc->dclevel.mxWorldToPage; - nDc_Attr->flXform = pdcattr->flXform; - nDc_Attr->ptlWindowOrg = pdcattr->ptlWindowOrg; - nDc_Attr->szlWindowExt = pdcattr->szlWindowExt; - nDc_Attr->ptlViewportOrg = pdcattr->ptlViewportOrg; - nDc_Attr->szlViewportExt = pdcattr->szlViewportExt; - - newdc->dclevel.lSaveDepth = 0; - newdc->dctype = dc->dctype; - -#if 0 - PATH_InitGdiPath(&newdc->dclevel.hPath); -#endif +DC_vCopyState(PDC pdcSrc, PDC pdcDst) +{ + /* Copy full DC attribute */ + *pdcDst->pdcattr = *pdcSrc->pdcattr; /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */ - - newdc->rosdc.hGCClipRgn = newdc->rosdc.hVisRgn = 0; - if (dc->rosdc.hClipRgn) - { - newdc->rosdc.hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - NtGdiCombineRgn(newdc->rosdc.hClipRgn, dc->rosdc.hClipRgn, 0, RGN_COPY); - } -} - -// FIXME: why 2 different functions that do the same? -VOID -FASTCALL -IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC) -{ - PDC_ATTR pdcattr, sDc_Attr; - - pdcattr = dc->pdcattr; - sDc_Attr = dcs->pdcattr; - - dc->dclevel.flPath = dcs->dclevel.flPath & ~DCPATH_SAVESTATE; - - pdcattr->dwLayout = sDc_Attr->dwLayout; - pdcattr->jROP2 = sDc_Attr->jROP2; - pdcattr->jFillMode = sDc_Attr->jFillMode; - pdcattr->jStretchBltMode = sDc_Attr->jStretchBltMode; - pdcattr->lRelAbs = sDc_Attr->lRelAbs; - pdcattr->jBkMode = sDc_Attr->jBkMode; - pdcattr->crBackgroundClr = sDc_Attr->crBackgroundClr; - pdcattr->crForegroundClr = sDc_Attr->crForegroundClr; - pdcattr->lBkMode = sDc_Attr->lBkMode; - pdcattr->ulBackgroundClr = sDc_Attr->ulBackgroundClr; - pdcattr->ulForegroundClr = sDc_Attr->ulForegroundClr; - pdcattr->ptlBrushOrigin = sDc_Attr->ptlBrushOrigin; - - pdcattr->lTextAlign = sDc_Attr->lTextAlign; - pdcattr->lTextExtra = sDc_Attr->lTextExtra; - pdcattr->cBreak = sDc_Attr->cBreak; - pdcattr->lBreakExtra = sDc_Attr->lBreakExtra; - pdcattr->iMapMode = sDc_Attr->iMapMode; - pdcattr->iGraphicsMode = sDc_Attr->iGraphicsMode; -#if 0 - /* Apparently, the DC origin is not changed by [GS]etDCState */ - dc->ptlDCOrig.x = dcs->ptlDCOrig.x; - dc->ptlDCOrig.y = dcs->ptlDCOrig.y; -#endif - pdcattr->ptlCurrent = sDc_Attr->ptlCurrent; - pdcattr->ptfxCurrent = sDc_Attr->ptfxCurrent; - dc->dclevel.mxWorldToDevice = dcs->dclevel.mxWorldToDevice; - dc->dclevel.mxDeviceToWorld = dcs->dclevel.mxDeviceToWorld; - dc->dclevel.mxWorldToPage = dcs->dclevel.mxWorldToPage; - pdcattr->flXform = sDc_Attr->flXform; - pdcattr->ptlWindowOrg = sDc_Attr->ptlWindowOrg; - pdcattr->szlWindowExt = sDc_Attr->szlWindowExt; - pdcattr->ptlViewportOrg = sDc_Attr->ptlViewportOrg; - pdcattr->szlViewportExt = sDc_Attr->szlViewportExt; + /* The VisRectRegion field needs to be set to a valid state */ + + /* Mark some fields as dirty */ + pdcDst->pdcattr->ulDirty_ |= 0x0012001f; + + /* Copy DC level */ + pdcDst->dclevel.pColorSpace = pdcSrc->dclevel.pColorSpace; + pdcDst->dclevel.lSaveDepth = pdcSrc->dclevel.lSaveDepth; + pdcDst->dclevel.hdcSave = pdcSrc->dclevel.hdcSave; + pdcDst->dclevel.laPath = pdcSrc->dclevel.laPath; + pdcDst->dclevel.ca = pdcSrc->dclevel.ca; + pdcDst->dclevel.mxWorldToDevice = pdcSrc->dclevel.mxWorldToDevice; + pdcDst->dclevel.mxDeviceToWorld = pdcSrc->dclevel.mxDeviceToWorld; + pdcDst->dclevel.mxWorldToPage = pdcSrc->dclevel.mxWorldToPage; + pdcDst->dclevel.efM11PtoD = pdcSrc->dclevel.efM11PtoD; + pdcDst->dclevel.efM22PtoD = pdcSrc->dclevel.efM22PtoD; + pdcDst->dclevel.sizl = pdcSrc->dclevel.sizl; + + /* Handle references here correctly */ + DC_vSelectSurface(pdcDst, pdcSrc->dclevel.pSurface); + + // FIXME: handle refs + pdcDst->dclevel.hpal = pdcSrc->dclevel.hpal; + pdcDst->dclevel.ppal = pdcSrc->dclevel.ppal; + pdcDst->dclevel.pbrFill = pdcSrc->dclevel.pbrFill; + pdcDst->dclevel.pbrLine = pdcSrc->dclevel.pbrLine; + pdcDst->dclevel.plfnt = pdcSrc->dclevel.plfnt; + + /* ROS hacks */ + pdcDst->rosdc.hBitmap = pdcSrc->rosdc.hBitmap; + + if (pdcDst->dctype != DC_TYPE_MEMORY) + { + pdcDst->rosdc.bitsPerPixel = pdcSrc->rosdc.bitsPerPixel; + } + + GdiExtSelectClipRgn(pdcDst, pdcSrc->rosdc.hClipRgn, RGN_COPY); + +} + + +BOOL FASTCALL +IntGdiCleanDC(HDC hDC) +{ + PDC dc; + if (!hDC) return FALSE; + dc = DC_LockDc(hDC); + if (!dc) return FALSE; + // Clean the DC + if (defaultDCstate) DC_vCopyState(defaultDCstate, dc); if (dc->dctype != DC_TYPE_MEMORY) { - dc->rosdc.bitsPerPixel = dcs->rosdc.bitsPerPixel; - } - -#if 0 - if (dcs->rosdc.hClipRgn) - { - if (!dc->rosdc.hClipRgn) - { - dc->rosdc.hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - } - NtGdiCombineRgn(dc->rosdc.hClipRgn, dcs->rosdc.hClipRgn, 0, RGN_COPY); - } - else - { - if (dc->rosdc.hClipRgn) - { - NtGdiDeleteObject(dc->rosdc.hClipRgn); - } - dc->rosdc.hClipRgn = 0; - } - { - int res; - res = CLIPPING_UpdateGCRegion(dc); - ASSERT(res != ERROR); - } + dc->rosdc.bitsPerPixel = defaultDCstate->rosdc.bitsPerPixel; + } + DC_UnlockDc(dc); -#else - GdiExtSelectClipRgn(dc, dcs->rosdc.hClipRgn, RGN_COPY); - DC_UnlockDc(dc); -#endif - if (!hDC) return; // Not a MemoryDC or SaveLevel DC, return. - - NtGdiSelectBitmap(hDC, dcs->rosdc.hBitmap); - NtGdiSelectBrush(hDC, sDc_Attr->hbrush); - NtGdiSelectFont(hDC, sDc_Attr->hlfntNew); - NtGdiSelectPen(hDC, sDc_Attr->hpen); - - IntGdiSetBkColor(hDC, sDc_Attr->crBackgroundClr); - IntGdiSetTextColor(hDC, sDc_Attr->crForegroundClr); - - GdiSelectPalette(hDC, dcs->dclevel.hpal, FALSE); - -#if 0 - GDISelectPalette16(hDC, dcs->dclevel.hpal, FALSE); -#endif -} - -HDC APIENTRY -IntGdiGetDCState(HDC hDC) -{ - PDC pdcNew, pdc; - HDC hdcNew; - - pdc = DC_LockDc(hDC); - if (pdc == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - pdcNew = DC_AllocDC(NULL); - if (pdcNew == NULL) - { - DC_UnlockDc(pdc); - return 0; - } - hdcNew = pdcNew->BaseObject.hHmgr; - - pdcNew->dclevel.hdcSave = hdcNew; - IntGdiCopyToSaveState(pdc, pdcNew); - - DC_UnlockDc(pdcNew); - DC_UnlockDc(pdc); - - return hdcNew; -} - -VOID -APIENTRY -IntGdiSetDCState(HDC hDC, HDC hDCSave) -{ - PDC dc, dcs; - - dc = DC_LockDc(hDC); - if (dc) - { - dcs = DC_LockDc(hDCSave); - if (dcs) - { - if (dcs->dclevel.flPath & DCPATH_SAVESTATE) - { - IntGdiCopyFromSaveState(dc, dcs, dc->dclevel.hdcSave); - } - else - { - DC_UnlockDc(dc); - } - DC_UnlockDc(dcs); - } - else - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_HANDLE); - } - } - else - SetLastWin32Error(ERROR_INVALID_HANDLE); + + return TRUE; } @@ -252,132 +94,157 @@ return 0; } -BOOL APIENTRY + +BOOL +APIENTRY NtGdiRestoreDC( - HDC hDC, - INT SaveLevel) -{ - PDC dc, dcs; - BOOL success; - - DPRINT("NtGdiRestoreDC(%lx, %d)\n", hDC, SaveLevel); - - dc = DC_LockDc(hDC); - if (!dc) + HDC hdc, + INT iSaveLevel) +{ + PDC pdc, pdcSave; + HDC hdcSave; + PEPROCESS pepCurrentProcess; + + DPRINT("NtGdiRestoreDC(%lx, %d)\n", hdc, iSaveLevel); + + /* Lock the original DC */ + pdc = DC_LockDc(hdc); + if (!pdc) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; } - if (SaveLevel < 0) - SaveLevel = dc->dclevel.lSaveDepth + SaveLevel + 1; - - if (SaveLevel < 0 || dc->dclevel.lSaveDepth<SaveLevel) - { - DC_UnlockDc(dc); + ASSERT(pdc->dclevel.lSaveDepth > 0); + + /* Negative values are relative to the stack top */ + if (iSaveLevel < 0) + iSaveLevel = pdc->dclevel.lSaveDepth + iSaveLevel; + + /* Check if we have a valid instance */ + if (iSaveLevel <= 0 || iSaveLevel >= pdc->dclevel.lSaveDepth) + { + DPRINT("Illegal save level, requested: %ld, current: %ld\n", + iSaveLevel, pdc->dclevel.lSaveDepth); + DC_UnlockDc(pdc); + SetLastWin32Error(ERROR_INVALID_PARAMETER); return FALSE; } - success=TRUE; - while (dc->dclevel.lSaveDepth >= SaveLevel) - { - HDC hdcs = dc->hdcNext; - - dcs = DC_LockDc(hdcs); - if (dcs == NULL) + /* Get current process */ + pepCurrentProcess = PsGetCurrentProcess(); + + /* Loop the save levels */ + while (pdc->dclevel.lSaveDepth > iSaveLevel) + { + hdcSave = pdc->dclevel.hdcSave; + + /* Set us as the owner */ + if (!GDIOBJ_SetOwnership(hdcSave, pepCurrentProcess)) { - DC_UnlockDc(dc); + /* Could not get ownership. That's bad! */ + DPRINT1("Could not get ownership of saved DC (%p) for dc %p!\n", + hdcSave, hdc); return FALSE; } - dc->hdcNext = dcs->hdcNext; - dcs->hdcNext = 0; - - if (--dc->dclevel.lSaveDepth < SaveLevel) + /* Lock the saved dc */ + pdcSave = DC_LockDc(hdcSave); + if (!pdcSave) { - DC_UnlockDc(dc); - DC_UnlockDc(dcs); - - IntGdiSetDCState(hDC, hdcs); - - dc = DC_LockDc(hDC); - if (!dc) - { - return FALSE; - } + /* WTF? Internal error! */ + DPRINT1("Could not lock the saved DC (%p) for dc %p!\n", + hdcSave, hdc); + DC_UnlockDc(pdc); + return FALSE; + } + + /* Remove the saved dc from the queue */ + pdc->dclevel.hdcSave = pdcSave->dclevel.hdcSave; + + /* Decrement save level */ + pdc->dclevel.lSaveDepth--; + + /* Is this the state we want? */ + if (pdc->dclevel.lSaveDepth == iSaveLevel) + { + /* Copy the state back */ + DC_vCopyState(pdcSave, pdc); + // Restore Path by removing it, if the Save flag is set. // BeginPath will takecare of the rest. - if (dc->dclevel.hPath && dc->dclevel.flPath & DCPATH_SAVE) + if (pdc->dclevel.hPath && pdc->dclevel.flPath & DCPATH_SAVE) { - PATH_Delete(dc->dclevel.hPath); - dc->dclevel.hPath = 0; - dc->dclevel.flPath &= ~DCPATH_SAVE; + PATH_Delete(pdc->dclevel.hPath); + pdc->dclevel.hPath = 0; + pdc->dclevel.flPath &= ~DCPATH_SAVE; } } - else - { - DC_UnlockDc(dcs); - } - NtGdiDeleteObjectApp(hdcs); - } - DC_UnlockDc(dc); - return success; -} - - -INT APIENTRY + + /* Delete the saved dc */ + DC_FreeDC(hdcSave); + } + + DC_UnlockDc(pdc); + + DPRINT("Leaving NtGdiRestoreDC\n"); + return TRUE; +} + + +INT +APIENTRY NtGdiSaveDC( HDC hDC) { - HDC hdcs; - PDC dc, dcs; - INT ret; + HDC hdcSave; + PDC pdc, pdcSave; + INT lSaveDepth; DPRINT("NtGdiSaveDC(%lx)\n", hDC); - if (!(hdcs = IntGdiGetDCState(hDC))) - { - return 0; - } - - dcs = DC_LockDc(hdcs); - if (dcs == NULL) - { + /* Lock the original dc */ + pdc = DC_LockDc(hDC); + if (pdc == NULL) + { + DPRINT("Could not lock DC\n"); SetLastWin32Error(ERROR_INVALID_HANDLE); return 0; } - dc = DC_LockDc(hDC); - if (dc == NULL) - { - DC_UnlockDc(dcs); - SetLastWin32Error(ERROR_INVALID_HANDLE); + + /* Allocate a new dc */ + pdcSave = DC_AllocDC(NULL); + if (pdcSave == NULL) + { + DPRINT("Could not allocate a new DC\n"); + DC_UnlockDc(pdc); return 0; } - - /* - * Copy path. - */ - dcs->dclevel.hPath = dc->dclevel.hPath; - if (dcs->dclevel.hPath) dcs->dclevel.flPath |= DCPATH_SAVE; - - dcs->hdcNext = dc->hdcNext; - dc->hdcNext = hdcs; - ret = ++dc->dclevel.lSaveDepth; - DC_UnlockDc(dcs); - DC_UnlockDc(dc); - - return ret; -} - -BOOL FASTCALL -IntGdiCleanDC(HDC hDC) -{ - PDC dc; - if (!hDC) return FALSE; - dc = DC_LockDc(hDC); - if (!dc) return FALSE; - // Clean the DC - if (defaultDCstate) IntGdiCopyFromSaveState(dc, defaultDCstate, hDC); - return TRUE; -} - + hdcSave = pdcSave->BaseObject.hHmgr; + + /* Make it a kernel handle + (FIXME: windows handles this different, see wiki)*/ + GDIOBJ_SetOwnership(hdcSave, NULL); + + /* Copy the current state */ + DC_vCopyState(pdc, pdcSave); + + /* Copy path. FIXME: why this way? */ + pdcSave->dclevel.hPath = pdc->dclevel.hPath; + pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE; + if (pdcSave->dclevel.hPath) pdcSave->dclevel.flPath |= DCPATH_SAVE; + + /* Set new dc as save dc */ + pdc->dclevel.hdcSave = hdcSave; + + /* Increase save depth, return old value */ + lSaveDepth = pdc->dclevel.lSaveDepth++; + + /* Cleanup and return */ + DC_UnlockDc(pdcSave); + DC_UnlockDc(pdc); + + DPRINT("Leave NtGdiSaveDC: %ld\n", lSaveDepth); + return lSaveDepth; +} +
15 years, 9 months
1
0
0
0
[tkreuzer] 40218: Fix GetDCBrushColor. It was returning the pen color.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 06:52:11 2009 New Revision: 40218 URL:
http://svn.reactos.org/svn/reactos?rev=40218&view=rev
Log: Fix GetDCBrushColor. It was returning the pen color. 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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Wed Mar 25 06:52:11 2009 @@ -933,7 +933,7 @@ PDC_ATTR Dc_Attr; if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return CLR_INVALID; - return (COLORREF) Dc_Attr->ulPenClr; + return (COLORREF) Dc_Attr->ulBrushClr; } /*
15 years, 9 months
1
0
0
0
[tkreuzer] 40217: Add one test for NtGdiDeleteObjectApp, and a bunch of tests for NtGdiSaveDC and NtGdiRestoreDC.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 06:51:22 2009 New Revision: 40217 URL:
http://svn.reactos.org/svn/reactos?rev=40217&view=rev
Log: Add one test for NtGdiDeleteObjectApp, and a bunch of tests for NtGdiSaveDC and NtGdiRestoreDC. Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiRestoreDC.c (with props) trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c (with props) Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c trunk/rostests/apitests/w32knapi/testlist.c Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
============================================================================== --- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c [iso-8859-1] Wed Mar 25 06:51:22 2009 @@ -11,6 +11,11 @@ SetLastError(0); ret = NtGdiDeleteObjectApp(0); TEST(ret == 0); + TEST(GetLastError() == 0); + + /* Try to delete something with a stockbit */ + SetLastError(0); + TEST(NtGdiDeleteObjectApp((PVOID)(GDI_HANDLE_STOCK_MASK | 0x1234)) == 1); TEST(GetLastError() == 0); /* Delete a DC */ @@ -74,6 +79,7 @@ ASSERT(hbmp); TEST(IsHandleValid(hbmp) == 1); TEST(NtGdiSelectBitmap(hdc, hbmp)); + ret = NtGdiDeleteObjectApp(hbmp); TEST(ret == 1); TEST(GetLastError() == 0); Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiRestoreDC.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
============================================================================== --- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiRestoreDC.c (added) +++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiRestoreDC.c [iso-8859-1] Wed Mar 25 06:51:22 2009 @@ -1,0 +1,192 @@ + + +static HBRUSH hbrush; +static HBITMAP hbitmap; +static HPEN hpen; +static HFONT hfont; +static HRGN hrgn, hrgn2; + +static +void +SetSpecialDCState(HDC hdc) +{ + /* Select spcial Objects */ + SelectObject(hdc, hbrush); + SelectObject(hdc, hpen); + SelectObject(hdc, hbitmap); + SelectObject(hdc, hfont); + SelectObject(hdc, hrgn); + + /* Colors */ + SetDCBrushColor(hdc, RGB(12,34,56)); + SetDCPenColor(hdc, RGB(23,34,45)); + + /* Coordinates */ + SetMapMode(hdc, MM_ANISOTROPIC); + SetGraphicsMode(hdc, GM_ADVANCED); + SetWindowOrgEx(hdc, 12, 34, NULL); + SetViewportOrgEx(hdc, 56, 78, NULL); + SetWindowExtEx(hdc, 123, 456, NULL); + SetViewportExtEx(hdc, 234, 567, NULL); + + + +} + +static +void +SetSpecialDCState2(HDC hdc) +{ + /* Select spcial Objects */ + SelectObject(hdc, GetStockObject(DC_BRUSH)); + SelectObject(hdc, GetStockObject(DC_PEN)); + SelectObject(hdc, GetStockObject(DEFAULT_BITMAP)); + SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); + SelectObject(hdc, hrgn2); + + /* Colors */ + SetDCBrushColor(hdc, RGB(65,43,21)); + SetDCPenColor(hdc, RGB(54,43,32)); + + /* Coordinates */ + SetMapMode(hdc, MM_ISOTROPIC); + SetGraphicsMode(hdc, GM_COMPATIBLE); + SetWindowOrgEx(hdc, 43, 21, NULL); + SetViewportOrgEx(hdc, 87, 65, NULL); + SetWindowExtEx(hdc, 654, 321, NULL); + SetViewportExtEx(hdc, 765, 432, NULL); + + +} + +static +void +Test_IsSpecialState(PTESTINFO pti, HDC hdc, BOOL bMemDC) +{ + POINT pt; + SIZE sz; + + /* Test Objects */ + TEST(SelectObject(hdc, GetStockObject(DC_BRUSH)) == hbrush); + TEST(SelectObject(hdc, GetStockObject(DC_PEN)) == hpen); + TEST(SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)) == hfont); + if (bMemDC) + { + TEST(SelectObject(hdc, GetStockObject(DEFAULT_BITMAP)) == hbitmap); + TEST(SelectObject(hdc, hrgn2) == (PVOID)1); + } + else + { + TEST(SelectObject(hdc, GetStockObject(DEFAULT_BITMAP)) == 0); + TEST(SelectObject(hdc, hrgn2) == (PVOID)2); + } + + /* Test colors */ + TEST(GetDCBrushColor(hdc) == RGB(12,34,56)); + TEST(GetDCPenColor(hdc) == RGB(23,34,45)); + + /* Test coordinates */ + TEST(GetMapMode(hdc) == MM_ANISOTROPIC); + TEST(GetGraphicsMode(hdc) == GM_ADVANCED); + GetWindowOrgEx(hdc, &pt); + TEST(pt.x == 12); + TEST(pt.y == 34); + GetViewportOrgEx(hdc, &pt); + TEST(pt.x == 56); + TEST(pt.y == 78); + GetWindowExtEx(hdc, &sz); + TESTX(sz.cx == 123, "sz.cx == %ld\n", sz.cx); + TESTX(sz.cy == 456, "sz.cy == %ld\n", sz.cy); + GetViewportExtEx(hdc, &sz); + TEST(sz.cx == 234); + TEST(sz.cy == 567); + + +} + + +static +void +Test_SaveRestore(PTESTINFO pti, HDC hdc, BOOL bMemDC) +{ + SetSpecialDCState(hdc); + NtGdiSaveDC(hdc); + SetSpecialDCState2(hdc); + + SetLastError(0); + TEST(NtGdiRestoreDC(hdc, 2) == 0); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + SetLastError(0); + TEST(NtGdiRestoreDC(hdc, 0) == 0); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + SetLastError(0); + TEST(NtGdiRestoreDC(hdc, -2) == 0); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + SetLastError(0); + TEST(NtGdiRestoreDC(hdc, 1) == 1); + TEST(GetLastError() == 0); + + Test_IsSpecialState(pti, hdc, bMemDC); +} + + +INT +Test_NtGdiRestoreDC(PTESTINFO pti) +{ + HDC hdc; + + hdc = CreateCompatibleDC(0); + ASSERT(IsHandleValid(hdc)); + + SetLastError(0); + TEST(NtGdiRestoreDC(0, -10) == 0); + TEST(GetLastError() == ERROR_INVALID_HANDLE); + + SetLastError(0); + TEST(NtGdiRestoreDC(hdc, 0) == 0); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + SetLastError(0); + TEST(NtGdiRestoreDC(hdc, 1) == 0); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + /* Initialize objects */ + hbrush = CreateSolidBrush(12345); + ASSERT(IsHandleValid(hbrush)); + hpen = CreatePen(PS_SOLID, 4, RGB(10,12,32)); + ASSERT(IsHandleValid(hpen)); + hbitmap = CreateBitmap(10, 10, 1, 1, NULL); + ASSERT(IsHandleValid(hbitmap)); + hfont = CreateFont(10, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, + DEFAULT_PITCH, "Arial"); + ASSERT(IsHandleValid(hfont)); + hrgn = CreateRectRgn(12, 14, 14, 17); + ASSERT(IsHandleValid(hrgn)); + hrgn2 = CreateRectRgn(1, 1, 2, 2); + ASSERT(IsHandleValid(hrgn2)); + + /* Test mem dc */ + Test_SaveRestore(pti, hdc, TRUE); + DeleteDC(hdc); + + /* Test screen DC */ + hdc = GetDC(0); + ASSERT(IsHandleValid(hdc)); + Test_SaveRestore(pti, hdc, FALSE); + ReleaseDC(0, hdc); + + /* Test info dc */ + hdc = CreateICW(L"DISPLAY", NULL, NULL, NULL); + ASSERT(IsHandleValid(hdc)); + Test_SaveRestore(pti, hdc, FALSE); + DeleteDC(hdc); + + + + return APISTATUS_NORMAL; +} + Propchange: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiRestoreDC.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
============================================================================== --- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c (added) +++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c [iso-8859-1] Wed Mar 25 06:51:22 2009 @@ -1,0 +1,45 @@ + +INT +Test_NtGdiSaveDC(PTESTINFO pti) +{ + HDC hdc; + HWND hwnd; + + /* Test 0 hdc */ + TEST(NtGdiSaveDC(0) == 0); + + /* Test info dc */ + hdc = CreateICW(L"DISPLAY",NULL,NULL,NULL); + TEST(hdc); + TEST(NtGdiSaveDC(hdc) == 1); + TEST(NtGdiSaveDC(hdc) == 2); + DeleteDC(hdc); + + /* Test display dc */ + hdc = GetDC(0); + TEST(hdc); + TEST(NtGdiSaveDC(hdc) == 1); + TEST(NtGdiSaveDC(hdc) == 2); + ReleaseDC(0, hdc); + + /* Test a mem DC */ + hdc = CreateCompatibleDC(0); + TEST(hdc); + TEST(NtGdiSaveDC(hdc) == 1); + TEST(NtGdiSaveDC(hdc) == 2); + DeleteDC(hdc); + + /* Create a window */ + hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 10, 100, 100, + NULL, NULL, g_hInstance, 0); + hdc = GetDC(hwnd); + TEST(hdc); + TEST(NtGdiSaveDC(hdc) == 1); + NtGdiRestoreDC(hdc, 1); + ReleaseDC(hwnd, hdc); + DestroyWindow(hwnd); + + return APISTATUS_NORMAL; +} + Propchange: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/w32knapi/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/testlis…
============================================================================== --- trunk/rostests/apitests/w32knapi/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/testlist.c [iso-8859-1] Wed Mar 25 06:51:22 2009 @@ -25,6 +25,8 @@ #include "ntgdi/NtGdiGetFontResourceInfoInternalW.c" #include "ntgdi/NtGdiGetRandomRgn.c" #include "ntgdi/NtGdiPolyPolyDraw.c" +#include "ntgdi/NtGdiRestoreDC.c" +#include "ntgdi/NtGdiSaveDC.c" #include "ntgdi/NtGdiSelectBitmap.c" #include "ntgdi/NtGdiSelectBrush.c" #include "ntgdi/NtGdiSelectFont.c" @@ -85,6 +87,8 @@ { L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW }, { L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn }, { L"NtGdiPolyPolyDraw", Test_NtGdiPolyPolyDraw }, + { L"NtGdiRestoreDC", Test_NtGdiRestoreDC }, + { L"NtGdiSaveDC", Test_NtGdiSaveDC }, { L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits }, { L"NtGdiSetDIBitsToDeviceInternal", Test_NtGdiSetDIBitsToDeviceInternal }, { L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
15 years, 9 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
49
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
39
40
41
42
43
44
45
46
47
48
49
Results per page:
10
25
50
100
200