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
February 2014
----- 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
503 discussions
Start a n
N
ew thread
Matteo Bruni : d3dx9: Trace DDS pixel format.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: ac5664c8790c72ecc7c38126ddd0b227d9d9d47b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ac5664c8790c72ecc7c38126d…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 14 15:53:11 2014 +0100 d3dx9: Trace DDS pixel format. --- dlls/d3dx9_36/surface.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index fbfff0f..48d129e 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -259,6 +259,11 @@ static D3DFORMAT dds_bump_to_d3dformat(const struct dds_pixel_format *pixel_form static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format *pixel_format) { + TRACE("pixel_format: size %u, flags %#x, fourcc %#x, bpp %u.\n", pixel_format->size, + pixel_format->flags, pixel_format->fourcc, pixel_format->bpp); + TRACE("rmask %#x, gmask %#x, bmask %#x, amask %#x.\n", pixel_format->rmask, pixel_format->gmask, + pixel_format->bmask, pixel_format->amask); + if (pixel_format->flags & DDS_PF_FOURCC) return dds_fourcc_to_d3dformat(pixel_format->fourcc); if (pixel_format->flags & DDS_PF_RGB)
1
0
0
0
Matteo Bruni : d3dx9: Enforce minimum texture dimensions for block-based pixel formats.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: 190877422e644eb1eb7f43c2e817a7d163853175 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=190877422e644eb1eb7f43c2e…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 14 15:53:10 2014 +0100 d3dx9: Enforce minimum texture dimensions for block-based pixel formats. --- dlls/d3dx9_36/tests/texture.c | 11 +++ dlls/d3dx9_36/texture.c | 149 +++++++++++++++++++++-------------------- 2 files changed, 89 insertions(+), 71 deletions(-) diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c index afc7144..4a93ac6 100644 --- a/dlls/d3dx9_36/tests/texture.c +++ b/dlls/d3dx9_36/tests/texture.c @@ -340,6 +340,17 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device) ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); ok(format == expected, "Returned format %u, expected %u\n", format, expected); + /* Block-based texture formats and size < block size. */ + format = D3DFMT_DXT1; + width = 2; height = 2; + mipmaps = 1; + hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, &format, D3DPOOL_DEFAULT); + ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); + ok(width == 4, "Returned width %d, expected %d\n", width, 4); + ok(height == 4, "Returned height %d, expected %d\n", height, 4); + ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1); + ok(format == D3DFMT_DXT1, "Returned format %u, expected %u\n", format, D3DFMT_DXT1); + IDirect3D9_Release(d3d); } diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index f96536a..be86347 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -195,6 +195,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN D3DDISPLAYMODE mode; HRESULT hr; D3DFORMAT usedformat = D3DFMT_UNKNOWN; + const struct pixel_format_desc *fmt; TRACE("(%p, %p, %p, %p, %u, %p, %u)\n", device, width, height, miplevels, usage, format, pool); @@ -211,73 +212,6 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN if ((pool != D3DPOOL_DEFAULT) && (pool != D3DPOOL_MANAGED) && (pool != D3DPOOL_SYSTEMMEM) && (pool != D3DPOOL_SCRATCH)) return D3DERR_INVALIDCALL; - /* width and height */ - if (FAILED(IDirect3DDevice9_GetDeviceCaps(device, &caps))) - return D3DERR_INVALIDCALL; - - /* 256 x 256 default width/height */ - if ((w == D3DX_DEFAULT) && (h == D3DX_DEFAULT)) - w = h = 256; - else if (w == D3DX_DEFAULT) - w = (height ? h : 256); - else if (h == D3DX_DEFAULT) - h = (width ? w : 256); - - /* ensure width/height is power of 2 */ - if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w))) - w = make_pow2(w); - - if (w > caps.MaxTextureWidth) - w = caps.MaxTextureWidth; - - if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(h))) - h = make_pow2(h); - - if (h > caps.MaxTextureHeight) - h = caps.MaxTextureHeight; - - /* texture must be square? */ - if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) - { - if (w > h) - h = w; - else - w = h; - } - - if (width) - *width = w; - - if (height) - *height = h; - - /* miplevels */ - if (miplevels && (usage & D3DUSAGE_AUTOGENMIPMAP)) - { - if (*miplevels > 1) - *miplevels = 0; - } - else if (miplevels) - { - UINT max_mipmaps = 1; - - if (!width && !height) - max_mipmaps = 9; /* number of mipmaps in a 256x256 texture */ - else - { - UINT max_dimen = max(w, h); - - while (max_dimen > 1) - { - max_dimen >>= 1; - max_mipmaps++; - } - } - - if (*miplevels == 0 || *miplevels > max_mipmaps) - *miplevels = max_mipmaps; - } - /* format */ if (format) { @@ -303,17 +237,18 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN if ((usedformat == D3DFMT_UNKNOWN) || (usedformat == D3DX_DEFAULT)) usedformat = D3DFMT_A8R8G8B8; + fmt = get_format_info(usedformat); + hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format, usage, D3DRTYPE_TEXTURE, usedformat); - if (FAILED(hr)) { - /* Heuristic to choose the fallback format */ - const struct pixel_format_desc *fmt = get_format_info(usedformat); BOOL allow_24bits; int bestscore = INT_MIN, i = 0, j; unsigned int channels; - const struct pixel_format_desc *curfmt; + const struct pixel_format_desc *curfmt, *bestfmt = NULL; + + TRACE("Requested format not supported, looking for a fallback.\n"); if (!fmt) { @@ -358,11 +293,83 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN { bestscore = score; usedformat = curfmt->format; + bestfmt = curfmt; } } + fmt = bestfmt; hr = D3D_OK; } + if (FAILED(IDirect3DDevice9_GetDeviceCaps(device, &caps))) + return D3DERR_INVALIDCALL; + + if ((w == D3DX_DEFAULT) && (h == D3DX_DEFAULT)) + w = h = 256; + else if (w == D3DX_DEFAULT) + w = (height ? h : 256); + else if (h == D3DX_DEFAULT) + h = (width ? w : 256); + + if (fmt->block_width != 1 || fmt->block_height != 1) + { + if (w < fmt->block_width) + w = fmt->block_width; + if (h < fmt->block_height) + h = fmt->block_height; + } + + if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w))) + w = make_pow2(w); + + if (w > caps.MaxTextureWidth) + w = caps.MaxTextureWidth; + + if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(h))) + h = make_pow2(h); + + if (h > caps.MaxTextureHeight) + h = caps.MaxTextureHeight; + + if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) + { + if (w > h) + h = w; + else + w = h; + } + + if (width) + *width = w; + + if (height) + *height = h; + + if (miplevels && (usage & D3DUSAGE_AUTOGENMIPMAP)) + { + if (*miplevels > 1) + *miplevels = 0; + } + else if (miplevels) + { + UINT max_mipmaps = 1; + + if (!width && !height) + max_mipmaps = 9; /* number of mipmaps in a 256x256 texture */ + else + { + UINT max_dimen = max(w, h); + + while (max_dimen > 1) + { + max_dimen >>= 1; + max_mipmaps++; + } + } + + if (*miplevels == 0 || *miplevels > max_mipmaps) + *miplevels = max_mipmaps; + } + cleanup: if (d3d)
1
0
0
0
Matteo Bruni : d3dx9: Add some TRACEs and FIXMEs to D3DXCreateTextureFromFileInMemoryEx.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: dda9da793f709622a3c72fe704f811c16aeb7041 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dda9da793f709622a3c72fe70…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 14 15:53:09 2014 +0100 d3dx9: Add some TRACEs and FIXMEs to D3DXCreateTextureFromFileInMemoryEx. --- dlls/d3dx9_36/texture.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index 8e62059..f96536a 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -534,9 +534,9 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi return D3DERR_INVALIDCALL; hr = D3DXGetImageInfoFromFileInMemory(srcdata, srcdatasize, &imginfo); - if (FAILED(hr)) { + FIXME("Unrecognized file format, returning failure.\n"); *texture = NULL; return hr; } @@ -583,9 +583,9 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi /* fix texture creation parameters */ hr = D3DXCheckTextureRequirements(device, &width, &height, &miplevels, usage, &format, pool); - if (FAILED(hr)) { + FIXME("Couldn't find suitable texture parameters.\n"); *texture = NULL; return hr; } @@ -622,11 +622,12 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi if (FAILED(hr)) { + FIXME("Texture creation failed.\n"); *texture = NULL; return hr; } - /* Load the file */ + TRACE("Texture created correctly. Now loading the texture data into it.\n"); if (imginfo.ImageFileFormat != D3DXIFF_DDS) { IDirect3DTexture9_GetSurfaceLevel(*texptr, 0, &surface); @@ -640,6 +641,7 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi if (FAILED(hr)) { + FIXME("Texture loading failed.\n"); IDirect3DTexture9_Release(*texptr); *texture = NULL; return hr; @@ -647,9 +649,9 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels); hr = D3DXFilterTexture((IDirect3DBaseTexture9*) *texptr, palette, loaded_miplevels - 1, mipfilter); - if (FAILED(hr)) { + FIXME("Texture filtering failed.\n"); IDirect3DTexture9_Release(*texptr); *texture = NULL; return hr;
1
0
0
0
Jacek Caban : jscript: Skip tests if we can't register ActiveX object.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: cd22e8c223bc3cd55ff86aa4da03c3d8b6fb3e41 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cd22e8c223bc3cd55ff86aa4d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Feb 17 18:55:55 2014 +0100 jscript: Skip tests if we can't register ActiveX object. --- dlls/jscript/tests/activex.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/tests/activex.c b/dlls/jscript/tests/activex.c index 1153409..636dd81 100644 --- a/dlls/jscript/tests/activex.c +++ b/dlls/jscript/tests/activex.c @@ -1143,11 +1143,12 @@ START_TEST(activex) CoInitialize(NULL); if(check_jscript()) { - register_activex(); - - test_ActiveXObject(); - - init_registry(FALSE); + if(register_activex()) { + test_ActiveXObject(); + init_registry(FALSE); + }else { + skip("Could not register ActiveX object\n"); + } }else { win_skip("Broken engine, probably too old\n"); }
1
0
0
0
Jacek Caban : wmp.idl: Added some missing interfaces.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: 0473a790fec925d59cdeb3664bdc332a02bbf14e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0473a790fec925d59cdeb3664…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Feb 17 17:36:28 2014 +0100 wmp.idl: Added some missing interfaces. --- include/wmp.idl | 921 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 920 insertions(+), 1 deletion(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=0473a790fec925d59cdeb…
1
0
0
0
Francois Gouget : atl100/tests: Skip the test_regcat() tests if we don' t have elevated privileges.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: 9eaf355130df56d2d47948c64b87bc6e2f637650 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9eaf355130df56d2d47948c64…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Mon Feb 17 17:13:02 2014 +0100 atl100/tests: Skip the test_regcat() tests if we don't have elevated privileges. --- dlls/atl100/tests/atl.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dlls/atl100/tests/atl.c b/dlls/atl100/tests/atl.c index 383dbe4..96abf57 100644 --- a/dlls/atl100/tests/atl.c +++ b/dlls/atl100/tests/atl.c @@ -43,6 +43,32 @@ static const GUID CATID_CatTest2 = {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x46}}; #define CATID_CATTEST2_STR "178fc163-0000-0000-0000-000000000246" +static BOOL is_process_limited(void) +{ + static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE) = NULL; + HANDLE token; + + if (!pOpenProcessToken) + { + HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); + pOpenProcessToken = (void*)GetProcAddress(hadvapi32, "OpenProcessToken"); + if (!pOpenProcessToken) + return FALSE; + } + + if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + { + BOOL ret; + TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; + DWORD size; + + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + CloseHandle(token); + return (ret && type == TokenElevationTypeLimited); + } + return FALSE; +} + static void test_winmodule(void) { _AtlCreateWndData create_data[3]; @@ -148,6 +174,12 @@ static void test_regcat(void) {_ATL_CATMAP_ENTRY_END} }; + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, TRUE); ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
1
0
0
0
Alexandre Julliard : ntdll: Only allocate TLS data when resolving imports.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: ff08cd597d1d8b4e806d7ace9f3667ac6022b852 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ff08cd597d1d8b4e806d7ace9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 17 17:33:30 2014 +0100 ntdll: Only allocate TLS data when resolving imports. --- dlls/kernel32/tests/loader.c | 23 +++++++++++++++++++++++ dlls/ntdll/loader.c | 5 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index cd64a34..e749238 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -1214,6 +1214,7 @@ static void test_import_resolution(void) char dll_name[MAX_PATH]; DWORD dummy; void *expect; + char *str; HANDLE hfile; HMODULE mod, mod2; struct imports @@ -1223,6 +1224,9 @@ static void test_import_resolution(void) IMAGE_THUNK_DATA thunks[2]; char module[16]; struct { WORD hint; char name[32]; } function; + IMAGE_TLS_DIRECTORY tls; + char tls_data[16]; + SHORT tls_index; } data, *ptr; IMAGE_NT_HEADERS nt; IMAGE_SECTION_HEADER section; @@ -1243,6 +1247,8 @@ static void test_import_resolution(void) memset( nt.OptionalHeader.DataDirectory, 0, sizeof(nt.OptionalHeader.DataDirectory) ); nt.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size = sizeof(data.descr); nt.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress = DATA_RVA(data.descr); + nt.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size = sizeof(data.tls); + nt.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress = DATA_RVA(&data.tls); memset( &data, 0, sizeof(data) ); data.descr[0].u.OriginalFirstThunk = DATA_RVA( data.original_thunks ); @@ -1253,6 +1259,12 @@ static void test_import_resolution(void) data.original_thunks[0].u1.AddressOfData = DATA_RVA( &data.function ); data.thunks[0].u1.AddressOfData = 0xdeadbeef; + data.tls.StartAddressOfRawData = nt.OptionalHeader.ImageBase + DATA_RVA( data.tls_data ); + data.tls.EndAddressOfRawData = data.tls.StartAddressOfRawData + sizeof(data.tls_data); + data.tls.AddressOfIndex = nt.OptionalHeader.ImageBase + DATA_RVA( &data.tls_index ); + strcpy( data.tls_data, "hello world" ); + data.tls_index = 9999; + GetTempPathA(MAX_PATH, temp_path); GetTempFileNameA(temp_path, "ldr", 0, dll_name); @@ -1286,6 +1298,13 @@ static void test_import_resolution(void) expect = GetProcAddress( GetModuleHandleA( data.module ), data.function.name ); ok( (void *)ptr->thunks[0].u1.Function == expect, "thunk %p instead of %p for %s.%s\n", (void *)ptr->thunks[0].u1.Function, expect, data.module, data.function.name ); + ok( ptr->tls_index < 32 || broken(ptr->tls_index == 9999), /* before vista */ + "wrong tls index %d\n", ptr->tls_index ); + if (ptr->tls_index != 9999) + { + str = ((char **)NtCurrentTeb()->ThreadLocalStoragePointer)[ptr->tls_index]; + ok( !strcmp( str, "hello world" ), "wrong tls data '%s' at %p\n", str, str ); + } FreeLibrary( mod ); break; case 1: /* load with DONT_RESOLVE_DLL_REFERENCES doesn't resolve imports */ @@ -1295,10 +1314,13 @@ static void test_import_resolution(void) ptr = (struct imports *)((char *)mod + page_size); ok( ptr->thunks[0].u1.Function == 0xdeadbeef, "thunk resolved to %p for %s.%s\n", (void *)ptr->thunks[0].u1.Function, data.module, data.function.name ); + ok( ptr->tls_index == 9999, "wrong tls index %d\n", ptr->tls_index ); + mod2 = LoadLibraryA( dll_name ); ok( mod2 == mod, "loaded twice %p / %p\n", mod, mod2 ); ok( ptr->thunks[0].u1.Function == 0xdeadbeef, "thunk resolved to %p for %s.%s\n", (void *)ptr->thunks[0].u1.Function, data.module, data.function.name ); + ok( ptr->tls_index == 9999, "wrong tls index %d\n", ptr->tls_index ); FreeLibrary( mod ); break; case 2: /* load without IMAGE_FILE_DLL doesn't resolve imports */ @@ -1308,6 +1330,7 @@ static void test_import_resolution(void) ptr = (struct imports *)((char *)mod + page_size); ok( ptr->thunks[0].u1.Function == 0xdeadbeef, "thunk resolved to %p for %s.%s\n", (void *)ptr->thunks[0].u1.Function, data.module, data.function.name ); + ok( ptr->tls_index == 9999, "wrong tls index %d\n", ptr->tls_index ); FreeLibrary( mod ); break; } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 8414ec5..a8d675a 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -852,6 +852,8 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) return STATUS_SUCCESS; /* already done */ wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS; + wm->ldr.TlsIndex = alloc_tls_slot( &wm->ldr ); + if (!(imports = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &size ))) return STATUS_SUCCESS; @@ -907,6 +909,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) wm->ldr.EntryPoint = NULL; wm->ldr.SizeOfImage = nt->OptionalHeader.SizeOfImage; wm->ldr.Flags = LDR_DONT_RESOLVE_REFS; + wm->ldr.TlsIndex = -1; wm->ldr.LoadCount = 1; wm->ldr.SectionHandle = NULL; wm->ldr.CheckSum = 0; @@ -944,8 +947,6 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) wm->ldr.InInitializationOrderModuleList.Flink = NULL; wm->ldr.InInitializationOrderModuleList.Blink = NULL; - wm->ldr.TlsIndex = alloc_tls_slot( &wm->ldr ); - if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT)) { ULONG flags = MEM_EXECUTE_OPTION_ENABLE;
1
0
0
0
Alexandre Julliard : ntdll: Move fixup_imports to avoid forward declarations.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: f5fc925f0e97bd80b244c0efe453b329c7dd7d5d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f5fc925f0e97bd80b244c0efe…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 17 17:32:37 2014 +0100 ntdll: Move fixup_imports to avoid forward declarations. --- dlls/ntdll/loader.c | 102 +++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 7f36ddd..8414ec5 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -705,57 +705,6 @@ static NTSTATUS create_module_activation_context( LDR_MODULE *module ) } -/**************************************************************** - * fixup_imports - * - * Fixup all imports of a given module. - * The loader_section must be locked while calling this function. - */ -static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) -{ - int i, nb_imports; - const IMAGE_IMPORT_DESCRIPTOR *imports; - WINE_MODREF *prev; - DWORD size; - NTSTATUS status; - ULONG_PTR cookie; - - if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) return STATUS_SUCCESS; /* already done */ - wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS; - - if (!(imports = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE, - IMAGE_DIRECTORY_ENTRY_IMPORT, &size ))) - return STATUS_SUCCESS; - - nb_imports = 0; - while (imports[nb_imports].Name && imports[nb_imports].FirstThunk) nb_imports++; - - if (!nb_imports) return STATUS_SUCCESS; /* no imports */ - - if (!create_module_activation_context( &wm->ldr )) - RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie ); - - /* Allocate module dependency list */ - wm->nDeps = nb_imports; - wm->deps = RtlAllocateHeap( GetProcessHeap(), 0, nb_imports*sizeof(WINE_MODREF *) ); - - /* load the imported modules. They are automatically - * added to the modref list of the process. - */ - prev = current_modref; - current_modref = wm; - status = STATUS_SUCCESS; - for (i = 0; i < nb_imports; i++) - { - if (!(wm->deps[i] = import_dll( wm->ldr.BaseAddress, &imports[i], load_path ))) - status = STATUS_DLL_NOT_FOUND; - } - current_modref = prev; - if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie ); - return status; -} - - /************************************************************************* * is_dll_native_subsystem * @@ -885,6 +834,57 @@ static void free_tls_slot( LDR_MODULE *mod ) } +/**************************************************************** + * fixup_imports + * + * Fixup all imports of a given module. + * The loader_section must be locked while calling this function. + */ +static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) +{ + int i, nb_imports; + const IMAGE_IMPORT_DESCRIPTOR *imports; + WINE_MODREF *prev; + DWORD size; + NTSTATUS status; + ULONG_PTR cookie; + + if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) return STATUS_SUCCESS; /* already done */ + wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS; + + if (!(imports = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE, + IMAGE_DIRECTORY_ENTRY_IMPORT, &size ))) + return STATUS_SUCCESS; + + nb_imports = 0; + while (imports[nb_imports].Name && imports[nb_imports].FirstThunk) nb_imports++; + + if (!nb_imports) return STATUS_SUCCESS; /* no imports */ + + if (!create_module_activation_context( &wm->ldr )) + RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie ); + + /* Allocate module dependency list */ + wm->nDeps = nb_imports; + wm->deps = RtlAllocateHeap( GetProcessHeap(), 0, nb_imports*sizeof(WINE_MODREF *) ); + + /* load the imported modules. They are automatically + * added to the modref list of the process. + */ + prev = current_modref; + current_modref = wm; + status = STATUS_SUCCESS; + for (i = 0; i < nb_imports; i++) + { + if (!(wm->deps[i] = import_dll( wm->ldr.BaseAddress, &imports[i], load_path ))) + status = STATUS_DLL_NOT_FOUND; + } + current_modref = prev; + if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie ); + return status; +} + + /************************************************************************* * alloc_module *
1
0
0
0
Alexandre Julliard : ntdll: Don't fixup imports for executables.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: 0f0bf5866311e6aab081232cc85a64449086ec5d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0f0bf5866311e6aab081232cc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 17 16:25:43 2014 +0100 ntdll: Don't fixup imports for executables. --- dlls/kernel32/tests/loader.c | 1 - dlls/ntdll/loader.c | 16 +++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 55c63ad..cd64a34 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -1306,7 +1306,6 @@ static void test_import_resolution(void) ok( mod != NULL, "failed to load err %u\n", GetLastError() ); if (!mod) break; ptr = (struct imports *)((char *)mod + page_size); - todo_wine ok( ptr->thunks[0].u1.Function == 0xdeadbeef, "thunk resolved to %p for %s.%s\n", (void *)ptr->thunks[0].u1.Function, data.module, data.function.name ); FreeLibrary( mod ); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index fedade5..7f36ddd 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1509,12 +1509,8 @@ static void load_builtin_callback( void *module, const char *filename ) } wm->ldr.Flags |= LDR_WINE_INTERNAL; - if (!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL) && - !NtCurrentTeb()->Peb->ImageBaseAddress) /* if we already have an executable, ignore this one */ - { - NtCurrentTeb()->Peb->ImageBaseAddress = module; - } - else + if ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) || + nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE) { /* fixup imports */ @@ -1591,7 +1587,11 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, /* fixup imports */ - if (!(flags & DONT_RESOLVE_DLL_REFERENCES)) + nt = RtlImageNtHeader( module ); + + if (!(flags & DONT_RESOLVE_DLL_REFERENCES) && + ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) || + nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE)) { if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS) { @@ -1612,8 +1612,6 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, /* send DLL load event */ - nt = RtlImageNtHeader( module ); - SERVER_START_REQ( load_dll ) { req->mapping = wine_server_obj_handle( mapping );
1
0
0
0
Alexandre Julliard : ntdll: Don' t fixup imports when a dll is already loaded.
by Alexandre Julliard
17 Feb '14
17 Feb '14
Module: wine Branch: master Commit: 7307298ac3a6fbd205841d34cceea4bbf88d7e29 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7307298ac3a6fbd205841d34c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 17 16:25:13 2014 +0100 ntdll: Don't fixup imports when a dll is already loaded. --- dlls/kernel32/tests/loader.c | 1 - dlls/ntdll/loader.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 9a56794..55c63ad 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -1297,7 +1297,6 @@ static void test_import_resolution(void) (void *)ptr->thunks[0].u1.Function, data.module, data.function.name ); mod2 = LoadLibraryA( dll_name ); ok( mod2 == mod, "loaded twice %p / %p\n", mod, mod2 ); - todo_wine ok( ptr->thunks[0].u1.Function == 0xdeadbeef, "thunk resolved to %p for %s.%s\n", (void *)ptr->thunks[0].u1.Function, data.module, data.function.name ); FreeLibrary( mod ); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index e25ba1f..fedade5 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2018,8 +2018,6 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ { if ((*pwm)->ldr.LoadCount != -1) (*pwm)->ldr.LoadCount++; - if (!(flags & DONT_RESOLVE_DLL_REFERENCES)) fixup_imports( *pwm, load_path ); - TRACE("Found %s for %s at %p, count=%d\n", debugstr_w((*pwm)->ldr.FullDllName.Buffer), debugstr_w(libname), (*pwm)->ldr.BaseAddress, (*pwm)->ldr.LoadCount);
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
24
...
51
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
Results per page:
10
25
50
100
200