winehq.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
2025
February
January
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
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2016
----- 2025 -----
February 2025
January 2025
----- 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
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
750 discussions
Start a n
N
ew thread
Nikolay Sivov : ieframe: Handle storage opening failure in shortcut Load() .
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: 4302281d51ef8e6bc41be42f7df04d8510d17545 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4302281d51ef8e6bc41be42f7…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 11 22:14:56 2016 +0300 ieframe: Handle storage opening failure in shortcut Load(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ieframe/intshcut.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ieframe/intshcut.c b/dlls/ieframe/intshcut.c index 563cfc2..2376b1b 100644 --- a/dlls/ieframe/intshcut.c +++ b/dlls/ieframe/intshcut.c @@ -483,6 +483,15 @@ static HRESULT WINAPI PersistFile_Load(IPersistFile *pFile, LPCOLESTR pszFileNam return hr; } + hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropStg); + if (FAILED(hr)) + { + CoTaskMemFree(filename); + CoTaskMemFree(url); + return hr; + } + CoTaskMemFree(This->currentFile); This->currentFile = filename; CoTaskMemFree(This->url); @@ -492,8 +501,6 @@ static HRESULT WINAPI PersistFile_Load(IPersistFile *pFile, LPCOLESTR pszFileNam /* Now we're going to read in the iconfile and iconindex. If we don't find them, that's not a failure case -- it's possible that they just aren't in there. */ - hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, - STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropStg); if (get_profile_string(str_header, str_iconfile, pszFileName, &iconfile) == S_OK) {
1
0
0
0
Nikolay Sivov : ieframe: Convert to integer without additional string buffer allocation.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: b771a4a488f4a27ffe6dedabaa9447160a611a03 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b771a4a488f4a27ffe6dedaba…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 11 22:14:55 2016 +0300 ieframe: Convert to integer without additional string buffer allocation. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ieframe/intshcut.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/ieframe/intshcut.c b/dlls/ieframe/intshcut.c index 385b059..563cfc2 100644 --- a/dlls/ieframe/intshcut.c +++ b/dlls/ieframe/intshcut.c @@ -514,9 +514,7 @@ static HRESULT WINAPI PersistFile_Load(IPersistFile *pFile, LPCOLESTR pszFileNam int iconindex; PROPSPEC ps; PROPVARIANT pv; - char *iconindexastring = co_strdupWtoA(iconindexstring); - sscanf(iconindexastring, "%d", &iconindex); - CoTaskMemFree(iconindexastring); + iconindex = strtolW(iconindexstring, NULL, 10); ps.ulKind = PRSPEC_PROPID; ps.u.propid = PID_IS_ICONINDEX; pv.vt = VT_I4;
1
0
0
0
Nikolay Sivov : ieframe: Simplify IPersist_Load, make error handling more straightforward.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: 9de5b114302e62f63427e4e808e61416e0955eb5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9de5b114302e62f63427e4e80…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 11 22:14:54 2016 +0300 ieframe: Simplify IPersist_Load, make error handling more straightforward. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ieframe/intshcut.c | 179 +++++++++++++++++++++--------------------------- 1 file changed, 79 insertions(+), 100 deletions(-) diff --git a/dlls/ieframe/intshcut.c b/dlls/ieframe/intshcut.c index 19b253d..385b059 100644 --- a/dlls/ieframe/intshcut.c +++ b/dlls/ieframe/intshcut.c @@ -420,135 +420,114 @@ static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *pFile) return This->isDirty ? S_OK : S_FALSE; } -/* A helper function: Allocate and fill rString. Return number of bytes read. */ -static DWORD get_profile_string(LPCWSTR lpAppName, LPCWSTR lpKeyName, +/* Returns allocated profile string and a standard return code. */ +static HRESULT get_profile_string(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpFileName, WCHAR **rString ) { DWORD r = 0; DWORD len = 128; WCHAR *buffer; + *rString = NULL; buffer = CoTaskMemAlloc(len * sizeof(*buffer)); - if (buffer != NULL) - { - r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); - while (r == len-1) - { - WCHAR *realloc_buf; + if (!buffer) + return E_OUTOFMEMORY; - len *= 2; - realloc_buf = CoTaskMemRealloc(buffer, len * sizeof(*buffer)); - if (realloc_buf == NULL) - { - CoTaskMemFree(buffer); - *rString = NULL; - return 0; - } - buffer = realloc_buf; + r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); + while (r == len-1) + { + WCHAR *realloc_buf; - r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); + len *= 2; + realloc_buf = CoTaskMemRealloc(buffer, len * sizeof(*buffer)); + if (realloc_buf == NULL) + { + CoTaskMemFree(buffer); + return E_OUTOFMEMORY; } + buffer = realloc_buf; + + r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); } *rString = buffer; - return r; + return r ? S_OK : E_FAIL; } static HRESULT WINAPI PersistFile_Load(IPersistFile *pFile, LPCOLESTR pszFileName, DWORD dwMode) { - WCHAR str_header[] = {'I','n','t','e','r','n','e','t','S','h','o','r','t','c','u','t',0}; - WCHAR str_URL[] = {'U','R','L',0}; - WCHAR str_iconfile[] = {'i','c','o','n','f','i','l','e',0}; - WCHAR str_iconindex[] = {'i','c','o','n','i','n','d','e','x',0}; + InternetShortcut *This = impl_from_IPersistFile(pFile); + static WCHAR str_header[] = {'I','n','t','e','r','n','e','t','S','h','o','r','t','c','u','t',0}; + static WCHAR str_URL[] = {'U','R','L',0}; + static WCHAR str_iconfile[] = {'i','c','o','n','f','i','l','e',0}; + static WCHAR str_iconindex[] = {'i','c','o','n','i','n','d','e','x',0}; WCHAR *filename = NULL; + WCHAR *url; HRESULT hr; - InternetShortcut *This = impl_from_IPersistFile(pFile); + IPropertyStorage *pPropStg; + WCHAR *iconfile; + WCHAR *iconindexstring; + TRACE("(%p, %s, 0x%x)\n", pFile, debugstr_w(pszFileName), dwMode); + if (dwMode != 0) FIXME("ignoring unimplemented mode 0x%x\n", dwMode); + filename = co_strdupW(pszFileName); - if (filename != NULL) - { - DWORD r; - WCHAR *url; + if (!filename) + return E_OUTOFMEMORY; - r = get_profile_string(str_header, str_URL, pszFileName, &url); + if (FAILED(hr = get_profile_string(str_header, str_URL, pszFileName, &url))) + { + CoTaskMemFree(filename); + return hr; + } - if (url == NULL) - { - hr = E_OUTOFMEMORY; - CoTaskMemFree(filename); - } - else if (r == 0) - { - hr = E_FAIL; - CoTaskMemFree(filename); - } - else - { - hr = S_OK; - CoTaskMemFree(This->currentFile); - This->currentFile = filename; - CoTaskMemFree(This->url); - This->url = url; - This->isDirty = FALSE; - } + CoTaskMemFree(This->currentFile); + This->currentFile = filename; + CoTaskMemFree(This->url); + This->url = url; + This->isDirty = FALSE; - /* Now we're going to read in the iconfile and iconindex. - If we don't find them, that's not a failure case -- it's possible - that they just aren't in there. */ - if (SUCCEEDED(hr)) - { - IPropertyStorage *pPropStg; - WCHAR *iconfile; - WCHAR *iconindexstring; - hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, - STGM_READWRITE | STGM_SHARE_EXCLUSIVE, - &pPropStg); - - if (get_profile_string(str_header, str_iconfile, pszFileName, &iconfile)) - { - PROPSPEC ps; - PROPVARIANT pv; - ps.ulKind = PRSPEC_PROPID; - ps.u.propid = PID_IS_ICONFILE; - pv.vt = VT_LPWSTR; - pv.u.pwszVal = iconfile; - hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); - if (FAILED(hr)) - { - TRACE("Failed to store the iconfile to our property storage. hr = 0x%x\n", hr); - } - } - CoTaskMemFree(iconfile); + /* Now we're going to read in the iconfile and iconindex. + If we don't find them, that's not a failure case -- it's possible + that they just aren't in there. */ + hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropStg); - if (get_profile_string(str_header, str_iconindex, pszFileName, &iconindexstring)) - { - int iconindex; - PROPSPEC ps; - PROPVARIANT pv; - char *iconindexastring = co_strdupWtoA(iconindexstring); - sscanf(iconindexastring, "%d", &iconindex); - CoTaskMemFree(iconindexastring); - ps.ulKind = PRSPEC_PROPID; - ps.u.propid = PID_IS_ICONINDEX; - pv.vt = VT_I4; - pv.u.iVal = iconindex; - hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); - if (FAILED(hr)) - { - TRACE("Failed to store the iconindex to our property storage. hr = 0x%x\n", hr); - } - } - CoTaskMemFree(iconindexstring); + if (get_profile_string(str_header, str_iconfile, pszFileName, &iconfile) == S_OK) + { + PROPSPEC ps; + PROPVARIANT pv; + ps.ulKind = PRSPEC_PROPID; + ps.u.propid = PID_IS_ICONFILE; + pv.vt = VT_LPWSTR; + pv.u.pwszVal = iconfile; + hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); + if (FAILED(hr)) + TRACE("Failed to store the iconfile to our property storage. hr = 0x%x\n", hr); + } + CoTaskMemFree(iconfile); - IPropertyStorage_Release(pPropStg); - } - else - hr = E_OUTOFMEMORY; + if (get_profile_string(str_header, str_iconindex, pszFileName, &iconindexstring) == S_OK) + { + int iconindex; + PROPSPEC ps; + PROPVARIANT pv; + char *iconindexastring = co_strdupWtoA(iconindexstring); + sscanf(iconindexastring, "%d", &iconindex); + CoTaskMemFree(iconindexastring); + ps.ulKind = PRSPEC_PROPID; + ps.u.propid = PID_IS_ICONINDEX; + pv.vt = VT_I4; + pv.u.iVal = iconindex; + hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); + if (FAILED(hr)) + TRACE("Failed to store the iconindex to our property storage. hr = 0x%x\n", hr); } - else - hr = E_OUTOFMEMORY; + CoTaskMemFree(iconindexstring); + + IPropertyStorage_Release(pPropStg); return hr; }
1
0
0
0
Piotr Caban : ieframe: Restore closed IOleClientSite in DoVerb.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: 17379dcd083e66539014ab73cade423c22f26128 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=17379dcd083e66539014ab73c…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Apr 11 18:46:09 2016 +0200 ieframe: Restore closed IOleClientSite in DoVerb. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ieframe/ieframe.h | 1 + dlls/ieframe/oleobject.c | 28 +++++++++++++++++++++++++++- dlls/ieframe/tests/webbrowser.c | 24 ++++++++++++++++++------ 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h index 3880354..b586cc9 100644 --- a/dlls/ieframe/ieframe.h +++ b/dlls/ieframe/ieframe.h @@ -190,6 +190,7 @@ struct WebBrowser { INT version; IOleClientSite *client; + IOleClientSite *client_closed; IOleContainer *container; IOleInPlaceSiteEx *inplace; diff --git a/dlls/ieframe/oleobject.c b/dlls/ieframe/oleobject.c index 1076afe..4dcc536 100644 --- a/dlls/ieframe/oleobject.c +++ b/dlls/ieframe/oleobject.c @@ -292,6 +292,11 @@ static void release_client_site(WebBrowser *This) This->client = NULL; } + if(This->client_closed) { + IOleClientSite_Release(This->client_closed); + This->client_closed = NULL; + } + if(This->shell_embedding_hwnd) { DestroyWindow(This->shell_embedding_hwnd); This->shell_embedding_hwnd = NULL; @@ -460,6 +465,11 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE TRACE("(%p)->(%p)\n", This, pClientSite); + if(This->client_closed) { + IOleClientSite_Release(This->client_closed); + This->client_closed = NULL; + } + if(This->client == pClientSite) return S_OK; @@ -549,6 +559,8 @@ static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szCont static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) { WebBrowser *This = impl_from_IOleObject(iface); + IOleClientSite *client; + HRESULT hres; TRACE("(%p)->(%d)\n", This, dwSaveOption); @@ -569,7 +581,13 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) if(This->inplace) IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace); - return IOleObject_SetClientSite(iface, NULL); + /* store old client site - we need to restore it in DoVerb */ + client = This->client; + if(This->client) + IOleClientSite_AddRef(This->client); + hres = IOleObject_SetClientSite(iface, NULL); + This->client_closed = client; + return hres; } static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk) @@ -611,6 +629,14 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag TRACE("(%p)->(%d %p %p %d %p %s)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, wine_dbgstr_rect(lprcPosRect)); + /* restore closed client site if we have one */ + if(!This->client && This->client_closed) { + IOleClientSite *client = This->client_closed; + This->client_closed = NULL; + IOleObject_SetClientSite(iface, client); + IOleClientSite_Release(client); + } + switch (iVerb) { case OLEIVERB_SHOW: diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c index 4d28073..521e2ce 100644 --- a/dlls/ieframe/tests/webbrowser.c +++ b/dlls/ieframe/tests/webbrowser.c @@ -51,7 +51,7 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); static BOOL expect_ ## func = FALSE, called_ ## func = FALSE #define SET_EXPECT(func) \ - expect_ ## func = TRUE + do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0) #define CHECK_EXPECT2(func) \ do { \ @@ -71,6 +71,12 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); expect_ ## func = called_ ## func = FALSE; \ }while(0) +#define CHECK_NOT_CALLED(func) \ + do { \ + ok(!called_ ## func, "unexpected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + #define CLEAR_CALLED(func) \ expect_ ## func = called_ ## func = FALSE @@ -3633,19 +3639,25 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download) hres = IOleObject_DoVerb(oo, OLEIVERB_HIDE, NULL, (IOleClientSite*)0xdeadbeef, 0, (HWND)0xdeadbeef, NULL); ok(hres == S_OK, "DoVerb failed: %08x\n", hres); - todo_wine CHECK_CALLED(GetContainer); - todo_wine CHECK_CALLED(Site_GetWindow); - todo_wine CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED); - todo_wine CHECK_CALLED(Invoke_AMBIENT_SILENT); + CHECK_CALLED(GetContainer); + CHECK_CALLED(Site_GetWindow); + CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED); + CHECK_CALLED(Invoke_AMBIENT_SILENT); hres = IOleObject_GetClientSite(oo, &ocs); ok(hres == S_OK, "hres = %x\n", hres); - todo_wine ok(ocs == &ClientSite, "ocs != &ClientSite\n"); + ok(ocs == &ClientSite, "ocs != &ClientSite\n"); if(ocs) IOleClientSite_Release(ocs); + SET_EXPECT(OnFocus_FALSE); + SET_EXPECT(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE); + SET_EXPECT(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE); hres = IOleObject_Close(oo, OLECLOSE_NOSAVE); ok(hres == S_OK, "OleObject_Close failed: %x\n", hres); + todo_wine CHECK_NOT_CALLED(OnFocus_FALSE); + todo_wine CHECK_NOT_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE); + todo_wine CHECK_NOT_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE); test_close = FALSE; IOleObject_Release(oo);
1
0
0
0
Dmitry Timoshkov : user32/tests: Add some tests for dialog owner disabled state.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: b555f41020b2d3bf2fad98b03d35fd98b541758b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b555f41020b2d3bf2fad98b03…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Apr 12 18:23:54 2016 +0800 user32/tests: Add some tests for dialog owner disabled state. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/win.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 789cf9b..dd5f967 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -4258,6 +4258,74 @@ static INT_PTR WINAPI empty_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM return 0; } +static INT_PTR WINAPI empty_dlg_proc3(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + EndDialog(hwnd, 0); + + return 0; +} + +struct dialog_param +{ + HWND parent, grand_parent; + DLGTEMPLATE *dlg_data; +}; + +static INT_PTR WINAPI empty_dlg_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + { + DWORD style = GetWindowLongA(hwnd, GWL_STYLE); + struct dialog_param *param = (struct dialog_param *)lparam; + BOOL parent_is_child; + HWND disabled_hwnd; + + parent_is_child = (GetWindowLongA(param->parent, GWL_STYLE) & (WS_POPUP | WS_CHILD)) == WS_CHILD; + + ok(IsWindowEnabled(hwnd), "wrong state for %p\n", hwnd); + if (parent_is_child) + { + ok(IsWindowEnabled(param->parent), "wrong state for %08x\n", style); + disabled_hwnd = param->grand_parent; + } + else + { + ok(!IsWindowEnabled(param->parent), "wrong state for %08x\n", style); + disabled_hwnd = param->parent; + } + + if (param->grand_parent) + { + if (parent_is_child) + ok(!IsWindowEnabled(param->grand_parent), "wrong state for %08x\n", style); + else + ok(IsWindowEnabled(param->grand_parent), "wrong state for %08x\n", style); + } + + DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, disabled_hwnd, empty_dlg_proc3, 0); + ok(IsWindowEnabled(disabled_hwnd), "wrong state for %08x\n", style); + + ok(IsWindowEnabled(hwnd), "wrong state for %p\n", hwnd); + ok(IsWindowEnabled(param->parent), "wrong state for %p\n", param->parent); + if (param->grand_parent) + ok(IsWindowEnabled(param->grand_parent), "wrong state for %p (%08x)\n", param->grand_parent, style); + + DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0); + ok(IsWindowEnabled(hwnd), "wrong state for %p\n", hwnd); + ok(IsWindowEnabled(param->parent), "wrong state for %p\n", param->parent); + if (param->grand_parent) + ok(IsWindowEnabled(param->grand_parent), "wrong state for %p (%08x)\n", param->grand_parent, style); + + param->dlg_data->style |= WS_CHILD; + DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0); + ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style); + + EndDialog(hwnd, 0); + } + return 0; +} + static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_out, DWORD ex_style_out) { struct @@ -4269,11 +4337,19 @@ static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_ou WCHAR caption[1]; } dlg_data; DWORD style, ex_style; - HWND hwnd, parent = 0; + HWND hwnd, grand_parent = 0, parent = 0; + struct dialog_param param; if (style_in & WS_CHILD) - parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW, + { + grand_parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, NULL, NULL); + ok(grand_parent != 0, "grand_parent creation failed\n"); + } + + parent = CreateWindowExA(0, "static", NULL, style_in, + 0, 0, 0, 0, grand_parent, NULL, NULL, NULL); + ok(parent != 0, "parent creation failed, style %#x\n", style_in); dlg_data.dt.style = style_in; dlg_data.dt.dwExtendedStyle = ex_style_in; @@ -4297,6 +4373,8 @@ static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_ou ok(style == (style_out | DS_3DLOOK), "got %#x\n", style); ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style); + ok(IsWindowEnabled(parent), "wrong parent state (dialog style %#x)\n", style_in); + /* try setting the styles explicitly */ SetWindowLongA(hwnd, GWL_EXSTYLE, ex_style_in); style = GetWindowLongA(hwnd, GWL_STYLE); @@ -4330,7 +4408,18 @@ static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_ou ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style); DestroyWindow(hwnd); + + param.parent = parent; + param.grand_parent = grand_parent; + param.dlg_data = &dlg_data.dt; + DialogBoxIndirectParamA(GetModuleHandleA(NULL), &dlg_data.dt, parent, empty_dlg_proc2, (LPARAM)¶m); + + ok(IsWindowEnabled(parent), "wrong parent state (dialog style %#x)\n", style_in); + if (grand_parent) + ok(IsWindowEnabled(grand_parent), "wrong grand parent state (dialog style %#x)\n", style_in); + DestroyWindow(parent); + DestroyWindow(grand_parent); } static void test_dialog_styles(void)
1
0
0
0
Huw Davies : oleaut32/tests: Fix the size test in the case of an underflow of Lo.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: 9bb541563a933645aae9e530da6ecbcf3149d060 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9bb541563a933645aae9e530d…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Apr 12 09:17:39 2016 +0100 oleaut32/tests: Fix the size test in the case of an underflow of Lo. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/tests/olefont.c | 74 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index 4f421e4..1536619 100644 --- a/dlls/oleaut32/tests/olefont.c +++ b/dlls/oleaut32/tests/olefont.c @@ -58,9 +58,8 @@ static HRESULT (WINAPI *pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*); /* SetRatio to ratio_logical, ratio_himetric, */ /* check that resulting hfont has height hfont_height. */ /* Various checks along the way. */ -static void test_ifont_size(LONG lo_size, LONG hi_size, - LONG ratio_logical, LONG ratio_himetric, - LONG hfont_height, const char * test_name) +static void test_ifont_size(LONGLONG size, LONG ratio_logical, LONG ratio_himetric, + LONG hfont_height, const char * test_name) { FONTDESC fd; LPVOID pvObj = NULL; @@ -73,8 +72,7 @@ static void test_ifont_size(LONG lo_size, LONG hi_size, fd.cbSizeofstruct = sizeof(FONTDESC); fd.lpstrName = arial_font; /* using scalable instead of bitmap font reduces errors due to font realization */ - S(fd.cySize).Lo = lo_size; - S(fd.cySize).Hi = hi_size; + fd.cySize.int64 = size; fd.sWeight = 0; fd.sCharset = 0; fd.fItalic = FALSE; @@ -99,9 +97,9 @@ static void test_ifont_size(LONG lo_size, LONG hi_size, test_name, hres); /* Check returned size - allow for errors due to rounding & font realization. */ - ok((abs(S(psize).Lo - lo_size) < 10000) && S(psize).Hi == hi_size, + ok((psize.int64 - size) < 10000 && (psize.int64 - size) > -10000, "%s: IFont_get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=%d.\n", - test_name, S(psize).Lo, S(psize).Hi, lo_size, hi_size); + test_name, S(psize).Lo, S(psize).Hi, fd.cySize.Lo, fd.cySize.Hi); /* Check hFont size. */ hres = IFont_get_hFont (ifnt, &hfont); @@ -130,59 +128,59 @@ static void test_ifont_sizes(void) ReleaseDC(0, hdc); if(dpi == 96) /* normal resolution display */ { - test_ifont_size(180000, 0, 0, 0, -24, "default"); /* normal font */ - test_ifont_size(186000, 0, 0, 0, -25, "rounding"); /* test rounding */ + test_ifont_size(180000, 0, 0, -24, "default"); /* normal font */ + test_ifont_size(186000, 0, 0, -25, "rounding"); /* test rounding */ } else if(dpi == 72) /* low resolution display */ { - test_ifont_size(180000, 0, 0, 0, -18, "default"); /* normal font */ - test_ifont_size(186000, 0, 0, 0, -19, "rounding"); /* test rounding */ + test_ifont_size(180000, 0, 0, -18, "default"); /* normal font */ + test_ifont_size(186000, 0, 0, -19, "rounding"); /* test rounding */ } else if(dpi == 120) /* high resolution display */ { - test_ifont_size(180000, 0, 0, 0, -30, "default"); /* normal font */ - test_ifont_size(186000, 0, 0, 0, -31, "rounding"); /* test rounding */ + test_ifont_size(180000, 0, 0, -30, "default"); /* normal font */ + test_ifont_size(186000, 0, 0, -31, "rounding"); /* test rounding */ } else skip("Skipping resolution dependent font size tests - display resolution is %d\n", dpi); /* Next 4 tests specify a scaling ratio, so display resolution is not a factor. */ - test_ifont_size(180000, 0, 72, 2540, -18, "ratio1"); /* change ratio */ - test_ifont_size(180000, 0, 144, 2540, -36, "ratio2"); /* another ratio */ - test_ifont_size(180000, 0, 72, 1270, -36, "ratio3"); /* yet another ratio */ - test_ifont_size(186000, 0, 72, 2540, -19, "rounding+ratio"); /* test rounding with ratio */ + test_ifont_size(180000, 72, 2540, -18, "ratio1"); /* change ratio */ + test_ifont_size(180000, 144, 2540, -36, "ratio2"); /* another ratio */ + test_ifont_size(180000, 72, 1270, -36, "ratio3"); /* yet another ratio */ + test_ifont_size(186000, 72, 2540, -19, "rounding+ratio"); /* test rounding with ratio */ /* test various combinations of logical == himetric */ - test_ifont_size(180000, 0, 10, 10, -635, "identical ratio 1"); - test_ifont_size(240000, 0, 10, 10, -848, "identical ratio 2"); - test_ifont_size(300000, 0, 10, 10, -1058, "identical ratio 3"); + test_ifont_size(180000, 10, 10, -635, "identical ratio 1"); + test_ifont_size(240000, 10, 10, -848, "identical ratio 2"); + test_ifont_size(300000, 10, 10, -1058, "identical ratio 3"); /* test various combinations of logical and himetric both set to 1 */ - test_ifont_size(180000, 0, 1, 1, -24, "1:1 ratio 1"); - test_ifont_size(240000, 0, 1, 1, -32, "1:1 ratio 2"); - test_ifont_size(300000, 0, 1, 1, -40, "1:1 ratio 3"); + test_ifont_size(180000, 1, 1, -24, "1:1 ratio 1"); + test_ifont_size(240000, 1, 1, -32, "1:1 ratio 2"); + test_ifont_size(300000, 1, 1, -40, "1:1 ratio 3"); /* test various combinations of logical set to 1 */ - test_ifont_size(180000, 0, 1, 0, -24, "1:0 ratio 1"); - test_ifont_size(240000, 0, 1, 0, -32, "1:0 ratio 2"); - test_ifont_size(300000, 0, 1, 0, -40, "1:0 ratio 3"); + test_ifont_size(180000, 1, 0, -24, "1:0 ratio 1"); + test_ifont_size(240000, 1, 0, -32, "1:0 ratio 2"); + test_ifont_size(300000, 1, 0, -40, "1:0 ratio 3"); /* test various combinations of himetric set to 1 */ - test_ifont_size(180000, 0, 0, 1, -24, "0:1 ratio 1"); - test_ifont_size(240000, 0, 0, 1, -32, "0:1 ratio 2"); - test_ifont_size(300000, 0, 0, 1, -40, "0:1 ratio 3"); + test_ifont_size(180000, 0, 1, -24, "0:1 ratio 1"); + test_ifont_size(240000, 0, 1, -32, "0:1 ratio 2"); + test_ifont_size(300000, 0, 1, -40, "0:1 ratio 3"); /* test various combinations of 2:1 logical:himetric */ - test_ifont_size(180000, 0, 2, 1, -1270, "2:1 ratio 1"); - test_ifont_size(240000, 0, 2, 1, -1694, "2:1 ratio 2"); - test_ifont_size(300000, 0, 2, 1, -2117, "2:1 ratio 3"); + test_ifont_size(180000, 2, 1, -1270, "2:1 ratio 1"); + test_ifont_size(240000, 2, 1, -1694, "2:1 ratio 2"); + test_ifont_size(300000, 2, 1, -2117, "2:1 ratio 3"); /* test various combinations of 1:2 logical:himetric */ - test_ifont_size(180000, 0, 1, 2, -318, "1:2 ratio 1"); - test_ifont_size(240000, 0, 1, 2, -424, "1:2 ratio 2"); - test_ifont_size(300000, 0, 1, 2, -529, "1:2 ratio 3"); + test_ifont_size(180000, 1, 2, -318, "1:2 ratio 1"); + test_ifont_size(240000, 1, 2, -424, "1:2 ratio 2"); + test_ifont_size(300000, 1, 2, -529, "1:2 ratio 3"); /* test various combinations of logical and himetric both set to 2 */ - test_ifont_size(180000, 0, 2, 2, -635, "2:2 ratio 1"); - test_ifont_size(240000, 0, 2, 2, -848, "2:2 ratio 2"); - test_ifont_size(300000, 0, 2, 2, -1058, "2:2 ratio 3"); + test_ifont_size(180000, 2, 2, -635, "2:2 ratio 1"); + test_ifont_size(240000, 2, 2, -848, "2:2 ratio 2"); + test_ifont_size(300000, 2, 2, -1058, "2:2 ratio 3"); } static void test_QueryInterface(void)
1
0
0
0
Huw Davies : oleaut32/tests: Test against floats not integers to silence a clang warning.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: fcb9ff957bd8df1a572cf4770265b177379c4a94 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fcb9ff957bd8df1a572cf4770…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Apr 12 08:42:43 2016 +0100 oleaut32/tests: Test against floats not integers to silence a clang warning. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/tests/vartest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 4ba453c..00b2919 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -2544,7 +2544,7 @@ static void test_VarSub(void) hres = pVarSub(&left, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, "VarSub: expected coerced type VT_R8, got %s!\n", vtstr(V_VT(&result))); - ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 0), + ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 0.0), "VarSub: BSTR + BSTR, expected %f got %f\n", 0.0, V_R8(&result)); /* Manually test some VT_CY and VT_DECIMAL variants */ @@ -2565,7 +2565,7 @@ static void test_VarSub(void) ok(hres == S_OK && V_VT(&result) == VT_CY, "VarSub: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result))); hres = VarR8FromCy(V_CY(&result), &r); - ok(hres == S_OK && EQ_DOUBLE(r, 4702), + ok(hres == S_OK && EQ_DOUBLE(r, 4702.0), "VarSub: CY value %f, expected %f\n", r, (double)4720); hres = pVarSub(&left, &dec, &result); @@ -5384,7 +5384,7 @@ static void test_VarMul(void) hres = pVarMul(&cy, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_CY, "VarMul: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result))); hres = VarR8FromCy(V_CY(&result), &r); - ok(hres == S_OK && EQ_DOUBLE(r, 42399), "VarMul: CY value %f, expected %f\n", r, (double)42399); + ok(hres == S_OK && EQ_DOUBLE(r, 42399.0), "VarMul: CY value %f, expected %f\n", r, (double)42399); hres = pVarMul(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarMul: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); @@ -5555,7 +5555,7 @@ static void test_VarAdd(void) hres = pVarAdd(&left, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_BSTR, "VarAdd: expected coerced type VT_BSTR, got %s!\n", vtstr(V_VT(&result))); hres = VarR8FromStr(V_BSTR(&result), 0, 0, &r); - ok(hres == S_OK && EQ_DOUBLE(r, 1212), "VarAdd: BSTR value %f, expected %f\n", r, (double)1212); + ok(hres == S_OK && EQ_DOUBLE(r, 1212.0), "VarAdd: BSTR value %f, expected %f\n", r, (double)1212); VariantClear(&result); /* Manuly test some VT_CY and VT_DECIMAL variants */ @@ -5575,7 +5575,7 @@ static void test_VarAdd(void) hres = pVarAdd(&cy, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_CY, "VarAdd: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result))); hres = VarR8FromCy(V_CY(&result), &r); - ok(hres == S_OK && EQ_DOUBLE(r, 4720), "VarAdd: CY value %f, expected %f\n", r, (double)4720); + ok(hres == S_OK && EQ_DOUBLE(r, 4720.0), "VarAdd: CY value %f, expected %f\n", r, (double)4720); hres = pVarAdd(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarAdd: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result)));
1
0
0
0
Ken Thomases : ntoskrnl.exe: Fix SIB_INDEX() to use REX_X, not REX_R.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: f8220cbe93b1c0f86ef1091be2ef7e23e9a4337d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f8220cbe93b1c0f86ef1091be…
Author: Ken Thomases <ken(a)codeweavers.com> Date: Tue Apr 12 01:19:19 2016 -0500 ntoskrnl.exe: Fix SIB_INDEX() to use REX_X, not REX_R. Signed-off-by: Ken Thomases <ken(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/instr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c index 85b872e..48f16f2 100644 --- a/dlls/ntoskrnl.exe/instr.c +++ b/dlls/ntoskrnl.exe/instr.c @@ -492,7 +492,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(int); #define REGMODRM_RM( regmodrm, rex ) (((regmodrm) & 7) | (((rex) & REX_B) ? 8 : 0)) #define SIB_SS( sib, rex ) ((sib) >> 6) -#define SIB_INDEX( sib, rex ) (((sib) >> 3) & 7) | (((rex) & REX_R) ? 8 : 0) +#define SIB_INDEX( sib, rex ) (((sib) >> 3) & 7) | (((rex) & REX_X) ? 8 : 0) #define SIB_BASE( sib, rex ) (((sib) & 7) | (((rex) & REX_B) ? 8 : 0)) /* keep in sync with dlls/ntdll/thread.c:thread_init */
1
0
0
0
Jean-Christophe Cardot : winhlp32: Fix table formatting.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: 706145c563115afadc4eaab2a4f8ae8a7c8b26e5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=706145c563115afadc4eaab2a…
Author: Jean-Christophe Cardot <wine(a)cardot.net> Date: Sun Apr 10 22:06:12 2016 +0200 winhlp32: Fix table formatting. Signed-off-by: Jean-Christophe Cardot <wine(a)cardot.net> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winhlp32/hlpfile.c | 54 ++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c index 5e61bcf..10484a9 100644 --- a/programs/winhlp32/hlpfile.c +++ b/programs/winhlp32/hlpfile.c @@ -1216,9 +1216,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, char *text, *text_base, *text_end; LONG size, blocksize, datalen; unsigned short bits; - unsigned nc, ncol = 1; - short table_width; - BOOL in_table = FALSE; + unsigned ncol = 1; + short nc, lastcol, table_width; char tmp[256]; BOOL ret = FALSE; @@ -1262,9 +1261,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, if (buf[0x14] == HLP_TABLE) { - char type; + unsigned char type; - in_table = TRUE; ncol = *format++; if (!HLPFILE_RtfAddControl(rd, "\\trowd")) goto done; @@ -1273,6 +1271,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, { table_width = GET_SHORT(format, 0); format += 2; + if (!HLPFILE_RtfAddControl(rd, "\\trqc")) goto done; } else table_width = 32767; @@ -1282,10 +1281,10 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, { int pos; sprintf(tmp, "\\trgaph%d\\trleft%d", - HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 6), table_width, 32767)), - HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 0), table_width, 32767))); + MulDiv(HLPFILE_HalfPointsScale(page, GET_SHORT(format, 6)), table_width, 32767), + MulDiv(HLPFILE_HalfPointsScale(page, GET_SHORT(format, 2) - GET_SHORT(format, 6)), table_width, 32767) - 1); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; - pos = HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 6) / 2, table_width, 32767)); + pos = GET_SHORT(format, 6) / 2; for (nc = 0; nc < ncol; nc++) { WINE_TRACE("column(%d/%d) gap=%d width=%d\n", @@ -1293,7 +1292,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, GET_SHORT(format, nc*4+2)); pos += GET_SHORT(format, nc * 4) + GET_SHORT(format, nc * 4 + 2); sprintf(tmp, "\\cellx%d", - HLPFILE_HalfPointsScale(page, MulDiv(pos, table_width, 32767))); + MulDiv(HLPFILE_HalfPointsScale(page, pos), table_width, 32767)); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } } @@ -1302,22 +1301,27 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, WINE_TRACE("column(0/%d) gap=%d width=%d\n", ncol, GET_SHORT(format, 0), GET_SHORT(format, 2)); sprintf(tmp, "\\trleft%d\\cellx%d ", - HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 0), table_width, 32767)), - HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 0) + GET_SHORT(format, 2), - table_width, 32767))); + MulDiv(HLPFILE_HalfPointsScale(page, GET_SHORT(format, 2)), table_width, 32767) - 1, + MulDiv(HLPFILE_HalfPointsScale(page, GET_SHORT(format, 0)), table_width, 32767)); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } format += ncol * 4; } + lastcol = -1; for (nc = 0; nc < ncol; /**/) { WINE_TRACE("looking for format at offset %lu in column %d\n", (SIZE_T)(format - (buf + 0x15)), nc); if (!HLPFILE_RtfAddControl(rd, "\\pard")) goto done; - if (in_table) + if (buf[0x14] == HLP_TABLE) { - nc = GET_SHORT(format, 0); - if (nc == -1) break; + nc = lastcol = GET_SHORT(format, 0); + if (nc == -1) /* last column */ + { + if (!HLPFILE_RtfAddControl(rd, "\\row")) goto done; + rd->char_pos += 2; + break; + } format += 5; if (!HLPFILE_RtfAddControl(rd, "\\intbl")) goto done; } @@ -1436,7 +1440,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, /* else: null text, keep on storing attributes */ text += textsize + 1; - WINE_TRACE("format=%02x\n", *format); + WINE_TRACE("format=0x%02x\n", *format); if (*format == 0xff) { format++; @@ -1490,15 +1494,24 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, break; case 0x82: - if (in_table) + if (buf[0x14] == HLP_TABLE) { if (format[1] != 0xFF) { if (!HLPFILE_RtfAddControl(rd, "\\par\\intbl")) goto done; } + else if (GET_SHORT(format, 2) == -1) + { + if (!HLPFILE_RtfAddControl(rd, "\\cell\\intbl\\row")) goto done; + rd->char_pos += 2; + } + else if (GET_SHORT(format, 2) == lastcol) + { + if (!HLPFILE_RtfAddControl(rd, "\\par\\pard")) goto done; + } else { - if (!HLPFILE_RtfAddControl(rd, "\\cell\\pard\\intbl")) goto done; + if (!HLPFILE_RtfAddControl(rd, "\\cell\\pard")) goto done; } } else if (!HLPFILE_RtfAddControl(rd, "\\par")) goto done; @@ -1664,11 +1677,6 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, } } } - if (in_table) - { - if (!HLPFILE_RtfAddControl(rd, "\\row\\par\\pard\\plain")) goto done; - rd->char_pos += 2; - } ret = TRUE; done:
1
0
0
0
Jean-Christophe Cardot : winhlp32: Rework and rename HLPFILE_HalfPointsToTwips.
by Alexandre Julliard
12 Apr '16
12 Apr '16
Module: wine Branch: master Commit: a01c003007f6b2a7e53f6d726384d584710f1966 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a01c003007f6b2a7e53f6d726…
Author: Jean-Christophe Cardot <wine(a)cardot.net> Date: Sun Apr 10 22:06:11 2016 +0200 winhlp32: Rework and rename HLPFILE_HalfPointsToTwips. HLPFILE_HalfPointsToTwips was performing a useless transformation of the RTF measures, using a hardcoded 72 DPI. As winhlp32 makes use of the richedit component, it is counter productive to transform the measures, as this is taken care of by richedit himself. Signed-off-by: Jean-Christophe Cardot <wine(a)cardot.net> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winhlp32/hlpfile.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c index 141af62..5e61bcf 100644 --- a/programs/winhlp32/hlpfile.c +++ b/programs/winhlp32/hlpfile.c @@ -1199,16 +1199,9 @@ static HLPFILE_LINK* HLPFILE_AllocLink(struct RtfData* rd, int cookie, return link; } -static unsigned HLPFILE_HalfPointsToTwips(unsigned pts) +static unsigned HLPFILE_HalfPointsScale(HLPFILE_PAGE* page, unsigned pts) { - static unsigned logPxY; - if (!logPxY) - { - HDC hdc = GetDC(NULL); - logPxY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); - } - return MulDiv(pts, 72 * 10, logPxY); + return pts * page->file->scale - page->file->rounderr; } /*********************************************************************** @@ -1289,10 +1282,10 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, { int pos; sprintf(tmp, "\\trgaph%d\\trleft%d", - HLPFILE_HalfPointsToTwips(MulDiv(GET_SHORT(format, 6), table_width, 32767)), - HLPFILE_HalfPointsToTwips(MulDiv(GET_SHORT(format, 0), table_width, 32767))); + HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 6), table_width, 32767)), + HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 0), table_width, 32767))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; - pos = HLPFILE_HalfPointsToTwips(MulDiv(GET_SHORT(format, 6) / 2, table_width, 32767)); + pos = HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 6) / 2, table_width, 32767)); for (nc = 0; nc < ncol; nc++) { WINE_TRACE("column(%d/%d) gap=%d width=%d\n", @@ -1300,7 +1293,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, GET_SHORT(format, nc*4+2)); pos += GET_SHORT(format, nc * 4) + GET_SHORT(format, nc * 4 + 2); sprintf(tmp, "\\cellx%d", - HLPFILE_HalfPointsToTwips(MulDiv(pos, table_width, 32767))); + HLPFILE_HalfPointsScale(page, MulDiv(pos, table_width, 32767))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } } @@ -1309,8 +1302,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, WINE_TRACE("column(0/%d) gap=%d width=%d\n", ncol, GET_SHORT(format, 0), GET_SHORT(format, 2)); sprintf(tmp, "\\trleft%d\\cellx%d ", - HLPFILE_HalfPointsToTwips(MulDiv(GET_SHORT(format, 0), table_width, 32767)), - HLPFILE_HalfPointsToTwips(MulDiv(GET_SHORT(format, 0) + GET_SHORT(format, 2), + HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 0), table_width, 32767)), + HLPFILE_HalfPointsScale(page, MulDiv(GET_SHORT(format, 0) + GET_SHORT(format, 2), table_width, 32767))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } @@ -1337,32 +1330,32 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, if (bits & 0x0001) fetch_long(&format); if (bits & 0x0002) { - sprintf(tmp, "\\sb%d", HLPFILE_HalfPointsToTwips(fetch_short(&format))); + sprintf(tmp, "\\sb%d", HLPFILE_HalfPointsScale(page, fetch_short(&format))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } if (bits & 0x0004) { - sprintf(tmp, "\\sa%d", HLPFILE_HalfPointsToTwips(fetch_short(&format))); + sprintf(tmp, "\\sa%d", HLPFILE_HalfPointsScale(page, fetch_short(&format))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } if (bits & 0x0008) { - sprintf(tmp, "\\sl%d", HLPFILE_HalfPointsToTwips(fetch_short(&format))); + sprintf(tmp, "\\sl%d", HLPFILE_HalfPointsScale(page, fetch_short(&format))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } if (bits & 0x0010) { - sprintf(tmp, "\\li%d", HLPFILE_HalfPointsToTwips(fetch_short(&format))); + sprintf(tmp, "\\li%d", HLPFILE_HalfPointsScale(page, fetch_short(&format))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } if (bits & 0x0020) { - sprintf(tmp, "\\ri%d", HLPFILE_HalfPointsToTwips(fetch_short(&format))); + sprintf(tmp, "\\ri%d", HLPFILE_HalfPointsScale(page, fetch_short(&format))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } if (bits & 0x0040) { - sprintf(tmp, "\\fi%d", HLPFILE_HalfPointsToTwips(fetch_short(&format))); + sprintf(tmp, "\\fi%d", HLPFILE_HalfPointsScale(page, fetch_short(&format))); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } if (bits & 0x0100) @@ -1383,7 +1376,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, w = GET_SHORT(format, 0); format += 2; if (w) { - sprintf(tmp, "\\brdrw%d", HLPFILE_HalfPointsToTwips(w)); + sprintf(tmp, "\\brdrw%d", HLPFILE_HalfPointsScale(page, w)); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } } @@ -1407,7 +1400,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, } /* FIXME: do kind */ sprintf(tmp, "%s\\tx%d", - kind, HLPFILE_HalfPointsToTwips(tab & 0x3FFF)); + kind, HLPFILE_HalfPointsScale(page, tab & 0x3FFF)); if (!HLPFILE_RtfAddControl(rd, tmp)) goto done; } }
1
0
0
0
← Newer
1
...
41
42
43
44
45
46
47
...
75
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Results per page:
10
25
50
100
200