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 2020
----- 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
1016 discussions
Start a n
N
ew thread
Chip Davis : d3d11: Introduce a function to convert D3D10 map types to wined3d map flags.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: 43a4037d33d72d87611457fe7f990b1766a20a3c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=43a4037d33d72d87611457fe…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Fri Apr 3 11:05:55 2020 -0500 d3d11: Introduce a function to convert D3D10 map types to wined3d map flags. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d11/buffer.c | 2 +- dlls/d3d11/d3d11_private.h | 1 + dlls/d3d11/texture.c | 6 +++--- dlls/d3d11/utils.c | 5 +++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/d3d11/buffer.c b/dlls/d3d11/buffer.c index f2b950f357..b33be57d43 100644 --- a/dlls/d3d11/buffer.c +++ b/dlls/d3d11/buffer.c @@ -310,7 +310,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_buffer_Map(ID3D10Buffer *iface, D3D10_MAP wined3d_mutex_lock(); hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0, - &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)); + &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type)); *data = wined3d_map_desc.data; wined3d_mutex_unlock(); diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index 1e8d86fede..48c76959fa 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -69,6 +69,7 @@ DWORD wined3d_usage_from_d3d11(enum D3D11_USAGE usage) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN; DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) DECLSPEC_HIDDEN; +DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) DECLSPEC_HIDDEN; DWORD wined3d_clear_flags_from_d3d11_clear_flags(UINT clear_flags) DECLSPEC_HIDDEN; unsigned int wined3d_access_from_d3d11(D3D11_USAGE usage, UINT cpu_access) DECLSPEC_HIDDEN; diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c index 36d07beb23..1682aa05d9 100644 --- a/dlls/d3d11/texture.c +++ b/dlls/d3d11/texture.c @@ -356,7 +356,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture1d_Map(ID3D10Texture1D *iface, UIN wined3d_mutex_lock(); if (SUCCEEDED(hr = wined3d_resource_map(wined3d_texture_get_resource(texture->wined3d_texture), sub_resource_idx, - &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)))) + &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type)))) { *data = wined3d_map_desc.data; } @@ -858,7 +858,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UIN wined3d_mutex_lock(); if (SUCCEEDED(hr = wined3d_resource_map(wined3d_texture_get_resource(texture->wined3d_texture), sub_resource_idx, - &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)))) + &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type)))) { mapped_texture->pData = wined3d_map_desc.data; mapped_texture->RowPitch = wined3d_map_desc.row_pitch; @@ -1355,7 +1355,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN wined3d_mutex_lock(); if (SUCCEEDED(hr = wined3d_resource_map(wined3d_texture_get_resource(texture->wined3d_texture), sub_resource_idx, - &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)))) + &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type)))) { mapped_texture->pData = wined3d_map_desc.data; mapped_texture->RowPitch = wined3d_map_desc.row_pitch; diff --git a/dlls/d3d11/utils.c b/dlls/d3d11/utils.c index 065436cb4f..0e483fd4bb 100644 --- a/dlls/d3d11/utils.c +++ b/dlls/d3d11/utils.c @@ -756,6 +756,11 @@ DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) } } +DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) +{ + return wined3d_map_flags_from_d3d11_map_type((D3D11_MAP)map_type); +} + DWORD wined3d_clear_flags_from_d3d11_clear_flags(UINT clear_flags) { DWORD wined3d_clear_flags = 0;
1
0
0
0
Chip Davis : d3d11/tests: Use compare_uint() in a few more places.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: bd9e3dde1e860842a7a478915e43a695505cf71a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bd9e3dde1e860842a7a47891…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Fri Apr 3 11:00:44 2020 -0500 d3d11/tests: Use compare_uint() in a few more places. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d11/tests/d3d11.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 37ec829cd7..3ae05537a1 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -1011,7 +1011,7 @@ static void check_readback_data_u8_(unsigned int line, struct resource_readback for (x = rect->left; x < rect->right; ++x) { value = get_readback_u8(rb, x, y, z); - if (abs((int)value - (int)expected_value) > max_diff) + if (!compare_uint(value, expected_value, max_diff)) goto done; } } @@ -1046,7 +1046,7 @@ static void check_readback_data_u16_(unsigned int line, struct resource_readback for (x = rect->left; x < rect->right; ++x) { value = get_readback_u16(rb, x, y, z); - if (abs((int)value - (int)expected_value) > max_diff) + if (!compare_uint(value, expected_value, max_diff)) goto done; } } @@ -1081,7 +1081,7 @@ static void check_readback_data_u24_(unsigned int line, struct resource_readback for (x = rect->left; x < rect->right; ++x) { value = get_readback_u32(rb, x, y, z) >> shift; - if (abs((int)value - (int)expected_value) > max_diff) + if (!compare_uint(value, expected_value, max_diff)) goto done; } } @@ -25841,7 +25841,7 @@ static void test_depth_bias(void) u32 = get_readback_data(&rb, 0, y, 0, sizeof(*u32)); u32_value = *u32 >> shift; expected_value = depth * 16777215.0f + 0.5f; - all_match = abs(u32_value - expected_value) <= 3; + all_match = compare_uint(u32_value, expected_value, 3); ok(all_match, "Got value %#x (%.8e), expected %#x (%.8e).\n", u32_value, u32_value / 16777215.0f, @@ -25850,7 +25850,7 @@ static void test_depth_bias(void) case DXGI_FORMAT_D16_UNORM: u16 = get_readback_data(&rb, 0, y, 0, sizeof(*u16)); expected_value = depth * 65535.0f + 0.5f; - all_match = abs(*u16 - expected_value) <= 1; + all_match = compare_uint(*u16, expected_value, 1); ok(all_match, "Got value %#x (%.8e), expected %#x (%.8e).\n", *u16, *u16 / 65535.0f, expected_value, expected_value / 65535.0f);
1
0
0
0
Chip Davis : d3d10core/tests: Use compare_uint() in a few more places.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: 4b19ef0b74747814cec30bd4d6d6bfedda746a97 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4b19ef0b74747814cec30bd4…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Fri Apr 3 10:58:45 2020 -0500 d3d10core/tests: Use compare_uint() in a few more places. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10core/tests/d3d10core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 8332257d37..97a00a0715 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -814,7 +814,7 @@ static void check_readback_data_u8_(unsigned int line, struct resource_readback for (x = rect->left; x < rect->right; ++x) { value = get_readback_u8(rb, x, y); - if (abs((int)value - (int)expected_value) > max_diff) + if (!compare_uint(value, expected_value, max_diff)) goto done; } } @@ -846,7 +846,7 @@ static void check_readback_data_u16_(unsigned int line, struct resource_readback for (x = rect->left; x < rect->right; ++x) { value = get_readback_u16(rb, x, y); - if (abs((int)value - (int)expected_value) > max_diff) + if (!compare_uint(value, expected_value, max_diff)) goto done; } } @@ -878,7 +878,7 @@ static void check_readback_data_u24_(unsigned int line, struct resource_readback for (x = rect->left; x < rect->right; ++x) { value = get_readback_u32(rb, x, y) >> shift; - if (abs((int)value - (int)expected_value) > max_diff) + if (!compare_uint(value, expected_value, max_diff)) goto done; } } @@ -15855,7 +15855,7 @@ static void test_depth_bias(void) u32 = get_readback_data(&rb, 0, y, sizeof(*u32)); u32_value = *u32 >> shift; expected_value = depth * 16777215.0f + 0.5f; - all_match = abs(u32_value - expected_value) <= 3; + all_match = compare_uint(u32_value, expected_value, 3); ok(all_match, "Got value %#x (%.8e), expected %#x (%.8e).\n", u32_value, u32_value / 16777215.0f, @@ -15864,7 +15864,7 @@ static void test_depth_bias(void) case DXGI_FORMAT_D16_UNORM: u16 = get_readback_data(&rb, 0, y, sizeof(*u16)); expected_value = depth * 65535.0f + 0.5f; - all_match = abs(*u16 - expected_value) <= 1; + all_match = compare_uint(*u16, expected_value, 1); ok(all_match, "Got value %#x (%.8e), expected %#x (%.8e).\n", *u16, *u16 / 65535.0f, expected_value, expected_value / 65535.0f);
1
0
0
0
Chip Davis : d3d9/tests: Use compare_uint() in a couple more places.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: ea70874aa10a663c3045dafab34533ccb488938f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ea70874aa10a663c3045dafa…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Fri Apr 3 10:57:55 2020 -0500 d3d9/tests: Use compare_uint() in a couple more places. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/visual.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 92116b3eb8..f873f3ae9b 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1514,7 +1514,7 @@ static void test_clear_different_size_surfaces(void) depth = (WORD *)((BYTE *)lr.pBits + y * lr.Pitch); for (x = 0; x < 4; ++x) { - ok(abs(depth[x] - 0x7fff) <= 2, "Got depth 0x%04x at %u, %u.\n", depth[x], x, y); + ok(compare_uint(depth[x], 0x7fff, 2), "Got depth 0x%04x at %u, %u.\n", depth[x], x, y); } } hr = IDirect3DSurface9_UnlockRect(ds); @@ -1729,7 +1729,7 @@ static void color_fill_test(void) /* Windows drivers disagree on how to promote the 8 bit per channel * input argument to 16 bit for D3DFMT_G16R16. */ ok(color_match(surface_data[0], formats[i].fill_value, 2) && - abs((expected_a) - (fill_a)) < 3, + compare_uint(expected_a, fill_a, 2), "Expected clear value 0x%08x, got 0x%08x, fmt=%s.\n", formats[i].fill_value, surface_data[0], formats[i].name); hr = IDirect3DSurface9_UnlockRect(surface);
1
0
0
0
Mathew Hodson : user32/tests: Don't report cursor handle since it always changes.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: a8dee2a23f449adad2dc8ba96ad39c74d717fc4d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a8dee2a23f449adad2dc8ba9…
Author: Mathew Hodson <mathew.hodson(a)gmail.com> Date: Fri Mar 27 21:02:11 2020 -0400 user32/tests: Don't report cursor handle since it always changes. Signed-off-by: Mathew Hodson <mathew.hodson(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/cursoricon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c index ff4ab5d875..d2265be9b1 100644 --- a/dlls/user32/tests/cursoricon.c +++ b/dlls/user32/tests/cursoricon.c @@ -2332,7 +2332,7 @@ static void test_SetCursor(void) ok( pGetCursorInfo( &info ), "GetCursorInfo failed\n" ); /* global cursor doesn't change since we don't have a window */ ok( info.hCursor == global_cursor || broken(info.hCursor != cursor), /* win9x */ - "wrong info cursor %p/%p\n", info.hCursor, global_cursor ); + "expected global cursor %p\n", global_cursor ); } thread = CreateThread( NULL, 0, set_cursor_thread, 0, 0, &id ); WaitForSingleObject( thread, 1000 ); @@ -2364,7 +2364,7 @@ static void test_SetCursor(void) info.cbSize = sizeof(info); ok( pGetCursorInfo( &info ), "GetCursorInfo failed\n" ); ok( info.hCursor == global_cursor || broken(info.hCursor != cursor), /* win9x */ - "wrong info cursor %p/%p\n", info.hCursor, global_cursor ); + "expected global cursor %p\n", global_cursor ); } SetCursor( old_cursor ); DestroyCursor( cursor ); @@ -2381,7 +2381,7 @@ static void test_SetCursor(void) info.cbSize = sizeof(info); ok( pGetCursorInfo( &info ), "GetCursorInfo failed\n" ); ok( info.hCursor == global_cursor || broken(info.hCursor != cursor), /* win9x */ - "wrong info cursor %p/%p\n", info.hCursor, global_cursor ); + "expected global cursor %p\n", global_cursor ); } }
1
0
0
0
Zebediah Figura : ntdll: Implement NtQueryVolumeInformationFile(FileFsVolumeInformation).
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: 021d9f07602da5d61a27f86c86f6a06a38ee2e58 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=021d9f07602da5d61a27f86c…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 27 10:32:33 2020 -0500 ntdll: Implement NtQueryVolumeInformationFile(FileFsVolumeInformation). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 36 ++++++++++++++++++++++++++++++++---- dlls/ntdll/tests/file.c | 7 ++----- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 71343c25be..1adc1e094e 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -3262,7 +3262,6 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io { int fd, needs_close; struct stat st; - static int once; io->u.Status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL ); if (io->u.Status == STATUS_BAD_DEVICE_TYPE) @@ -3285,9 +3284,6 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io switch( info_class ) { - case FileFsVolumeInformation: - if (!once++) FIXME( "%p: volume info not supported\n", handle ); - break; case FileFsLabelInformation: FIXME( "%p: label info not supported\n", handle ); break; @@ -3448,6 +3444,38 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io io->u.Status = STATUS_SUCCESS; break; } + case FileFsVolumeInformation: + { + FILE_FS_VOLUME_INFORMATION *info = buffer; + struct mountmgr_unix_drive *drive; + const WCHAR *label; + + if (length < sizeof(FILE_FS_VOLUME_INFORMATION)) + { + io->u.Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } + + if (!(drive = get_mountmgr_fs_info( handle, fd ))) + { + ERR_(winediag)("Failed to query volume information from mountmgr.\n"); + io->u.Status = STATUS_NOT_IMPLEMENTED; + break; + } + + label = (WCHAR *)((char *)drive + drive->label_offset); + info->VolumeCreationTime.QuadPart = 0; /* FIXME */ + info->VolumeSerialNumber = drive->serial; + info->VolumeLabelLength = min( wcslen( label ) * sizeof(WCHAR), + length - offsetof( FILE_FS_VOLUME_INFORMATION, VolumeLabel ) ); + info->SupportsObjects = (drive->fs_type == MOUNTMGR_FS_TYPE_NTFS); + memcpy( info->VolumeLabel, label, info->VolumeLabelLength ); + RtlFreeHeap( GetProcessHeap(), 0, drive ); + + io->Information = offsetof( FILE_FS_VOLUME_INFORMATION, VolumeLabel ) + info->VolumeLabelLength; + io->u.Status = STATUS_SUCCESS; + break; + } case FileFsControlInformation: FIXME( "%p: control info not supported\n", handle ); break; diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 546795456a..33b8ead552 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3900,8 +3900,6 @@ static void test_query_volume_information_file(void) ffvi = (FILE_FS_VOLUME_INFORMATION *)buf; -todo_wine -{ ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", status); ok(U(io).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", U(io).Status); @@ -3909,10 +3907,9 @@ todo_wine "expected %d, got %lu\n", (FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION, VolumeLabel) + ffvi->VolumeLabelLength), io.Information); - ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\n"); - ok(ffvi->VolumeSerialNumber != 0, "Missing VolumeSerialNumber\n"); + todo_wine ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\n"); + todo_wine ok(ffvi->VolumeSerialNumber != 0, "Missing VolumeSerialNumber\n"); ok(ffvi->SupportsObjects == 1,"expected 1, got %d\n", ffvi->SupportsObjects); -} ok(ffvi->VolumeLabelLength == lstrlenW(ffvi->VolumeLabel) * sizeof(WCHAR), "got %d\n", ffvi->VolumeLabelLength); trace("VolumeSerialNumber: %x VolumeLabelName: %s\n", ffvi->VolumeSerialNumber, wine_dbgstr_w(ffvi->VolumeLabel));
1
0
0
0
Zebediah Figura : mountmgr: Return the serial and label from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: 19b8aadf4b0071e9b712b80a7c0dfeb197c4f5b3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=19b8aadf4b0071e9b712b80a…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 27 10:32:32 2020 -0500 mountmgr: Return the serial and label from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/device.c | 18 ++++++++++++++++-- dlls/mountmgr.sys/mountmgr.c | 22 ++++++++++++++++++---- dlls/mountmgr.sys/mountmgr.h | 7 ++++--- include/ddk/mountmgr.h | 2 ++ 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 9d287bd639..8fb984579e 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -152,6 +152,15 @@ static char *strdupA( const char *str ) return ret; } +static WCHAR *strdupW( const WCHAR *str ) +{ + WCHAR *ret; + + if (!str) return NULL; + if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(WCHAR) ))) strcpyW( ret, str ); + return ret; +} + static const GUID *get_default_uuid( int letter ) { static GUID guid; @@ -1631,7 +1640,7 @@ enum mountmgr_fs_type get_mountmgr_fs_type(enum fs_type fs_type) /* query information about an existing dos drive, by letter or udi */ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, - char **device, char **mount_point ) + DWORD *serial, char **device, char **mount_point, WCHAR **label ) { NTSTATUS status = STATUS_NO_SUCH_DEVICE; struct dos_drive *drive; @@ -1644,8 +1653,10 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_ disk_device = drive->volume->device; if (type) *type = disk_device->type; if (fs_type) *fs_type = get_mountmgr_fs_type( drive->volume->fs_type ); + if (serial) *serial = drive->volume->serial; if (device) *device = strdupA( disk_device->unix_device ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); + if (label) *label = strdupW( drive->volume->label ); status = STATUS_SUCCESS; break; } @@ -1655,7 +1666,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_ /* query information about an existing unix device, by dev_t */ NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, - enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) + enum mountmgr_fs_type *fs_type, DWORD *serial, char **device, + char **mount_point, WCHAR **label ) { NTSTATUS status = STATUS_NO_SUCH_DEVICE; struct volume *volume; @@ -1674,8 +1686,10 @@ NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, if (type) *type = disk_device->type; if (fs_type) *fs_type = get_mountmgr_fs_type( volume->fs_type ); + if (serial) *serial = volume->serial; if (device) *device = strdupA( disk_device->unix_device ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); + if (label) *label = strdupW( volume->label ); status = STATUS_SUCCESS; break; } diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 791b0b722d..cf12f03a73 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -294,22 +294,25 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, char *device, *mount_point; int letter = tolowerW( input->letter ); NTSTATUS status; - DWORD size, type = DEVICE_UNKNOWN; + DWORD size, type = DEVICE_UNKNOWN, serial; enum mountmgr_fs_type fs_type; enum device_type device_type; char *ptr; + WCHAR *label; if (!letter) { - if ((status = query_unix_device( input->unix_dev, &device_type, - &fs_type, &device, &mount_point ))) + if ((status = query_unix_device( input->unix_dev, &device_type, &fs_type, + &serial, &device, &mount_point, &label ))) return status; } else { if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER; - if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &device, &mount_point ))) return status; + if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &serial, &device, + &mount_point, &label ))) + return status; } switch (device_type) @@ -334,8 +337,10 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, output->letter = letter; output->type = type; output->fs_type = fs_type; + output->serial = serial; output->mount_point_offset = 0; output->device_offset = 0; + output->label_offset = 0; if (size > outsize) { @@ -372,6 +377,14 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, } else output->device_offset = 0; + if (label) + { + output->label_offset = ptr - (char *)output; + strcpyW( (WCHAR *)ptr, label ); + ptr += (strlenW(label) + 1) * sizeof(WCHAR); + } + else output->label_offset = 0; + TRACE( "returning %c: dev %s mount %s type %u\n", letter, debugstr_a(device), debugstr_a(mount_point), type ); @@ -379,6 +392,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, done: RtlFreeHeap( GetProcessHeap(), 0, device ); RtlFreeHeap( GetProcessHeap(), 0, mount_point ); + RtlFreeHeap( GetProcessHeap(), 0, label ); return status; } diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index 7171a50a41..82d783a7a0 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -57,10 +57,11 @@ extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device, const char *mount_point, enum device_type type, const GUID *guid, UNICODE_STRING *devname ) DECLSPEC_HIDDEN; extern NTSTATUS remove_dos_device( int letter, const char *udi ) DECLSPEC_HIDDEN; -extern NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, - char **device, char **mount_point ) DECLSPEC_HIDDEN; +extern NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, DWORD *serial, + char **device, char **mount_point, WCHAR **label ) DECLSPEC_HIDDEN; extern NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, - enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) DECLSPEC_HIDDEN; + DWORD *serial, enum mountmgr_fs_type *fs_type, char **device, + char **mount_point, WCHAR **label ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI serial_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h index 5d382a1869..13829a5395 100644 --- a/include/ddk/mountmgr.h +++ b/include/ddk/mountmgr.h @@ -66,10 +66,12 @@ struct mountmgr_unix_drive ULONG size; ULONG type; ULONG fs_type; + DWORD serial; ULONGLONG unix_dev; WCHAR letter; USHORT mount_point_offset; USHORT device_offset; + USHORT label_offset; }; #define IOCTL_MOUNTMGR_QUERY_DHCP_REQUEST_PARAMS CTL_CODE(MOUNTMGRCONTROLTYPE, 64, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1
0
0
0
Zebediah Figura : ntdll: Implement NtQueryVolumeInformationFile(FileFsAttributeInformation).
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: 18a960bb84b92c21062fcccb50944ddf27e7f2f6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=18a960bb84b92c21062fcccb…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 27 10:32:31 2020 -0500 ntdll: Implement NtQueryVolumeInformationFile(FileFsAttributeInformation). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 204 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 37e697c8c6..71343c25be 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -107,6 +107,8 @@ #include "winioctl.h" #include "ddk/ntddk.h" #include "ddk/ntddser.h" +#define WINE_MOUNTMGR_EXTENSIONS +#include "ddk/mountmgr.h" WINE_DEFAULT_DEBUG_CHANNEL(ntdll); WINE_DECLARE_DEBUG_CHANNEL(winediag); @@ -119,8 +121,6 @@ mode_t FILE_umask = 0; #define FILE_WRITE_TO_END_OF_FILE ((LONGLONG)-1) #define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2) -static const WCHAR ntfsW[] = {'N','T','F','S'}; - /* fetch the attributes of a file */ static inline ULONG get_file_attributes( const struct stat *st ) { @@ -3120,6 +3120,124 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info ) return STATUS_SUCCESS; } +/* Find a DOS device which can act as the root of "path". + * Similar to find_drive_root(), but returns -1 instead of crossing volumes. */ +static int find_dos_device( const char *path ) +{ + int len = strlen(path); + int drive; + char *buffer; + struct stat st; + struct drive_info info[MAX_DOS_DRIVES]; + dev_t dev_id; + + if (!DIR_get_drives_info( info )) return -1; + + if (stat( path, &st ) < 0) return -1; + dev_id = st.st_dev; + + /* strip off trailing slashes */ + while (len > 1 && path[len - 1] == '/') len--; + + /* make a copy of the path */ + if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len + 1 ))) return -1; + memcpy( buffer, path, len ); + buffer[len] = 0; + + for (;;) + { + if (!stat( buffer, &st ) && S_ISDIR( st.st_mode )) + { + if (st.st_dev != dev_id) break; + + for (drive = 0; drive < MAX_DOS_DRIVES; drive++) + { + if ((info[drive].dev == st.st_dev) && (info[drive].ino == st.st_ino)) + { + if (len == 1) len = 0; /* preserve root slash in returned path */ + TRACE( "%s -> drive %c:, root=%s, name=%s\n", + debugstr_a(path), 'A' + drive, debugstr_a(buffer), debugstr_a(path + len)); + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + return drive; + } + } + } + if (len <= 1) break; /* reached root */ + while (path[len - 1] != '/') len--; + while (path[len - 1] == '/') len--; + buffer[len] = 0; + } + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + return -1; +} + +static struct mountmgr_unix_drive *get_mountmgr_fs_info( HANDLE handle, int fd ) +{ + struct mountmgr_unix_drive *drive; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING string; + ANSI_STRING unix_name; + IO_STATUS_BLOCK io; + HANDLE mountmgr; + NTSTATUS status; + int letter; + + if (server_get_unix_name( handle, &unix_name )) + return NULL; + + letter = find_dos_device( unix_name.Buffer ); + RtlFreeAnsiString( &unix_name ); + + if (!(drive = RtlAllocateHeap( GetProcessHeap(), 0, 1024 ))) + return NULL; + + if (letter == -1) + { + struct stat st; + + if (fstat( fd, &st ) == -1) + { + RtlFreeHeap( GetProcessHeap(), 0, drive ); + return NULL; + } + + drive->unix_dev = st.st_dev; + drive->letter = 0; + } + else + drive->letter = 'a' + letter; + + RtlInitUnicodeString( &string, MOUNTMGR_DEVICE_NAME ); + InitializeObjectAttributes( &attr, &string, 0, NULL, NULL ); + if (NtOpenFile( &mountmgr, GENERIC_READ | SYNCHRONIZE, &attr, &io, + FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT )) + return NULL; + + status = NtDeviceIoControlFile( mountmgr, NULL, NULL, NULL, &io, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, + drive, sizeof(*drive), drive, 1024 ); + if (status == STATUS_BUFFER_OVERFLOW) + { + if (!(drive = RtlReAllocateHeap( GetProcessHeap(), 0, drive, drive->size ))) + { + RtlFreeHeap( GetProcessHeap(), 0, drive ); + NtClose( mountmgr ); + return NULL; + } + status = NtDeviceIoControlFile( mountmgr, NULL, NULL, NULL, &io, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, + drive, sizeof(*drive), drive, drive->size ); + } + NtClose( mountmgr ); + + if (status) + { + WARN("failed to retrieve filesystem type from mountmgr, status %#x\n", status); + RtlFreeHeap( GetProcessHeap(), 0, drive ); + return NULL; + } + + return drive; +} + /****************************************************************************** * NtQueryVolumeInformationFile [NTDLL.@] @@ -3240,24 +3358,96 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io } break; case FileFsAttributeInformation: - if (length < offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName[ARRAY_SIZE( ntfsW )] )) - io->u.Status = STATUS_BUFFER_TOO_SMALL; + { + static const WCHAR fatW[] = {'F','A','T'}; + static const WCHAR fat32W[] = {'F','A','T','3','2'}; + static const WCHAR ntfsW[] = {'N','T','F','S'}; + static const WCHAR cdfsW[] = {'C','D','F','S'}; + static const WCHAR udfW[] = {'U','D','F'}; + + FILE_FS_ATTRIBUTE_INFORMATION *info = buffer; + struct mountmgr_unix_drive *drive; + enum mountmgr_fs_type fs_type = MOUNTMGR_FS_TYPE_NTFS; + + if (length < sizeof(FILE_FS_ATTRIBUTE_INFORMATION)) + { + io->u.Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } + + if ((drive = get_mountmgr_fs_info( handle, fd ))) + { + fs_type = drive->fs_type; + RtlFreeHeap( GetProcessHeap(), 0, drive ); + } else { - FILE_FS_ATTRIBUTE_INFORMATION *info = buffer; + struct statfs stfs; - FIXME( "%p: faking attribute info\n", handle ); - info->FileSystemAttributes = FILE_SUPPORTS_ENCRYPTION | FILE_FILE_COMPRESSION | - FILE_PERSISTENT_ACLS | FILE_UNICODE_ON_DISK | - FILE_CASE_PRESERVED_NAMES | FILE_CASE_SENSITIVE_SEARCH; - info->MaximumComponentNameLength = MAXIMUM_FILENAME_LENGTH - 1; - info->FileSystemNameLength = sizeof(ntfsW); - memcpy(info->FileSystemName, ntfsW, sizeof(ntfsW)); + if (!fstatfs( fd, &stfs )) + { +#if defined(linux) && defined(HAVE_FSTATFS) + switch (stfs.f_type) + { + case 0x9660: + fs_type = MOUNTMGR_FS_TYPE_ISO9660; + break; + case 0x15013346: + fs_type = MOUNTMGR_FS_TYPE_UDF; + break; + case 0x4d44: + fs_type = MOUNTMGR_FS_TYPE_FAT32; + break; + } +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) + if (!strcmp( stfs.f_fstypename, "cd9660" )) + fs_type = MOUNTMGR_FS_TYPE_ISO9660; + else if (!strcmp( stfs.f_fstypename, "udf" )) + fs_type = MOUNTMGR_FS_TYPE_UDF; + else if (!strcmp( stfs.f_fstypename, "msdos" )) + fs_type = MOUNTMGR_FS_TYPE_FAT32; +#endif + } + } - io->Information = sizeof(*info); - io->u.Status = STATUS_SUCCESS; + switch (fs_type) + { + case MOUNTMGR_FS_TYPE_ISO9660: + info->FileSystemAttributes = FILE_READ_ONLY_VOLUME; + info->MaximumComponentNameLength = 221; + info->FileSystemNameLength = min( sizeof(cdfsW), length - offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) ); + memcpy(info->FileSystemName, cdfsW, info->FileSystemNameLength); + break; + case MOUNTMGR_FS_TYPE_UDF: + info->FileSystemAttributes = FILE_READ_ONLY_VOLUME | FILE_UNICODE_ON_DISK | FILE_CASE_SENSITIVE_SEARCH; + info->MaximumComponentNameLength = 255; + info->FileSystemNameLength = min( sizeof(udfW), length - offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) ); + memcpy(info->FileSystemName, udfW, info->FileSystemNameLength); + break; + case MOUNTMGR_FS_TYPE_FAT: + info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES; /* FIXME */ + info->MaximumComponentNameLength = 255; + info->FileSystemNameLength = min( sizeof(fatW), length - offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) ); + memcpy(info->FileSystemName, fatW, info->FileSystemNameLength); + break; + case MOUNTMGR_FS_TYPE_FAT32: + info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES; /* FIXME */ + info->MaximumComponentNameLength = 255; + info->FileSystemNameLength = min( sizeof(fat32W), length - offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) ); + memcpy(info->FileSystemName, fat32W, info->FileSystemNameLength); + break; + default: + info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES | FILE_PERSISTENT_ACLS; + info->MaximumComponentNameLength = 255; + info->FileSystemNameLength = min( sizeof(ntfsW), length - offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) ); + memcpy(info->FileSystemName, ntfsW, info->FileSystemNameLength); + break; } + + io->Information = offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) + info->FileSystemNameLength; + io->u.Status = STATUS_SUCCESS; break; + } case FileFsControlInformation: FIXME( "%p: control info not supported\n", handle ); break;
1
0
0
0
Zebediah Figura : mountmgr: Allow querying a Unix device by device ID.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: 54f93b9bb90c92d57abbefbb524bcd4e87465a52 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=54f93b9bb90c92d57abbefbb…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 27 10:32:30 2020 -0500 mountmgr: Allow querying a Unix device by device ID. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/device.c | 55 ++++++++++++++++++++++++++++++++++---------- dlls/mountmgr.sys/mountmgr.c | 14 +++++++++-- dlls/mountmgr.sys/mountmgr.h | 2 ++ include/ddk/mountmgr.h | 13 ++++++----- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 8917136336..9d287bd639 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1617,6 +1617,18 @@ NTSTATUS remove_dos_device( int letter, const char *udi ) return status; } +enum mountmgr_fs_type get_mountmgr_fs_type(enum fs_type fs_type) +{ + switch (fs_type) + { + case FS_ISO9660: return MOUNTMGR_FS_TYPE_ISO9660; + case FS_UDF: return MOUNTMGR_FS_TYPE_UDF; + case FS_FAT1216: return MOUNTMGR_FS_TYPE_FAT; + case FS_FAT32: return MOUNTMGR_FS_TYPE_FAT32; + default: return MOUNTMGR_FS_TYPE_NTFS; + } +} + /* query information about an existing dos drive, by letter or udi */ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) @@ -1631,18 +1643,37 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_ if (drive->drive != letter) continue; disk_device = drive->volume->device; if (type) *type = disk_device->type; - if (fs_type) - { - switch (drive->volume->fs_type) - { - case FS_ISO9660: *fs_type = MOUNTMGR_FS_TYPE_ISO9660; break; - case FS_UDF: *fs_type = MOUNTMGR_FS_TYPE_UDF; break; - case FS_FAT1216: *fs_type = MOUNTMGR_FS_TYPE_FAT; break; - case FS_FAT32: *fs_type = MOUNTMGR_FS_TYPE_FAT32; break; - default: *fs_type = MOUNTMGR_FS_TYPE_NTFS; break; - } - *fs_type = drive->volume->fs_type; - } + if (fs_type) *fs_type = get_mountmgr_fs_type( drive->volume->fs_type ); + if (device) *device = strdupA( disk_device->unix_device ); + if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); + status = STATUS_SUCCESS; + break; + } + LeaveCriticalSection( &device_section ); + return status; +} + +/* query information about an existing unix device, by dev_t */ +NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, + enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) +{ + NTSTATUS status = STATUS_NO_SUCH_DEVICE; + struct volume *volume; + struct disk_device *disk_device; + struct stat st; + + EnterCriticalSection( &device_section ); + LIST_FOR_EACH_ENTRY( volume, &volumes_list, struct volume, entry ) + { + disk_device = volume->device; + + if (!disk_device->unix_device + || stat( disk_device->unix_device, &st ) < 0 + || st.st_rdev != unix_dev) + continue; + + if (type) *type = disk_device->type; + if (fs_type) *fs_type = get_mountmgr_fs_type( volume->fs_type ); if (device) *device = strdupA( disk_device->unix_device ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); status = STATUS_SUCCESS; diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 3a1b20af37..791b0b722d 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -299,9 +299,19 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, enum device_type device_type; char *ptr; - if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER; + if (!letter) + { + if ((status = query_unix_device( input->unix_dev, &device_type, + &fs_type, &device, &mount_point ))) + return status; + } + else + { + if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER; + + if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &device, &mount_point ))) return status; + } - if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &device, &mount_point ))) return status; switch (device_type) { case DEVICE_UNKNOWN: type = DRIVE_UNKNOWN; break; diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index 26901499ac..7171a50a41 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -59,6 +59,8 @@ extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device, extern NTSTATUS remove_dos_device( int letter, const char *udi ) DECLSPEC_HIDDEN; extern NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) DECLSPEC_HIDDEN; +extern NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, + enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI serial_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h index b28d6b17de..5d382a1869 100644 --- a/include/ddk/mountmgr.h +++ b/include/ddk/mountmgr.h @@ -63,12 +63,13 @@ enum mountmgr_fs_type struct mountmgr_unix_drive { - ULONG size; - ULONG type; - ULONG fs_type; - WCHAR letter; - USHORT mount_point_offset; - USHORT device_offset; + ULONG size; + ULONG type; + ULONG fs_type; + ULONGLONG unix_dev; + WCHAR letter; + USHORT mount_point_offset; + USHORT device_offset; }; #define IOCTL_MOUNTMGR_QUERY_DHCP_REQUEST_PARAMS CTL_CODE(MOUNTMGRCONTROLTYPE, 64, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1
0
0
0
Zebediah Figura : mountmgr: Return the filesystem type from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.
by Alexandre Julliard
06 Apr '20
06 Apr '20
Module: wine Branch: master Commit: cf174edfd940007bfe4857c4f254479e18f79ef0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cf174edfd940007bfe4857c4…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 27 10:32:29 2020 -0500 mountmgr: Return the filesystem type from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/device.c | 15 ++++++++++++++- dlls/mountmgr.sys/mountmgr.c | 4 +++- dlls/mountmgr.sys/mountmgr.h | 3 ++- include/ddk/mountmgr.h | 10 ++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 1459386f06..8917136336 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1618,7 +1618,8 @@ NTSTATUS remove_dos_device( int letter, const char *udi ) } /* query information about an existing dos drive, by letter or udi */ -NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point ) +NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, + char **device, char **mount_point ) { NTSTATUS status = STATUS_NO_SUCH_DEVICE; struct dos_drive *drive; @@ -1630,6 +1631,18 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, ch if (drive->drive != letter) continue; disk_device = drive->volume->device; if (type) *type = disk_device->type; + if (fs_type) + { + switch (drive->volume->fs_type) + { + case FS_ISO9660: *fs_type = MOUNTMGR_FS_TYPE_ISO9660; break; + case FS_UDF: *fs_type = MOUNTMGR_FS_TYPE_UDF; break; + case FS_FAT1216: *fs_type = MOUNTMGR_FS_TYPE_FAT; break; + case FS_FAT32: *fs_type = MOUNTMGR_FS_TYPE_FAT32; break; + default: *fs_type = MOUNTMGR_FS_TYPE_NTFS; break; + } + *fs_type = drive->volume->fs_type; + } if (device) *device = strdupA( disk_device->unix_device ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); status = STATUS_SUCCESS; diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 21712dc9ce..3a1b20af37 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -295,12 +295,13 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, int letter = tolowerW( input->letter ); NTSTATUS status; DWORD size, type = DEVICE_UNKNOWN; + enum mountmgr_fs_type fs_type; enum device_type device_type; char *ptr; if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER; - if ((status = query_dos_device( letter - 'a', &device_type, &device, &mount_point ))) return status; + if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &device, &mount_point ))) return status; switch (device_type) { case DEVICE_UNKNOWN: type = DRIVE_UNKNOWN; break; @@ -322,6 +323,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, output->size = size; output->letter = letter; output->type = type; + output->fs_type = fs_type; output->mount_point_offset = 0; output->device_offset = 0; diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index b7fb7d8658..26901499ac 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -57,7 +57,8 @@ extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device, const char *mount_point, enum device_type type, const GUID *guid, UNICODE_STRING *devname ) DECLSPEC_HIDDEN; extern NTSTATUS remove_dos_device( int letter, const char *udi ) DECLSPEC_HIDDEN; -extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point ) DECLSPEC_HIDDEN; +extern NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, + char **device, char **mount_point ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI serial_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN; diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h index d6b0ed21df..b28d6b17de 100644 --- a/include/ddk/mountmgr.h +++ b/include/ddk/mountmgr.h @@ -52,10 +52,20 @@ static const WCHAR MOUNTMGR_DOS_DEVICE_NAME[] = {'\\','\\','.','\\','M','o','u', #define IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 32, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) #define IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 33, METHOD_BUFFERED, FILE_READ_ACCESS) +enum mountmgr_fs_type +{ + MOUNTMGR_FS_TYPE_NTFS, + MOUNTMGR_FS_TYPE_FAT, + MOUNTMGR_FS_TYPE_FAT32, + MOUNTMGR_FS_TYPE_ISO9660, + MOUNTMGR_FS_TYPE_UDF, +}; + struct mountmgr_unix_drive { ULONG size; ULONG type; + ULONG fs_type; WCHAR letter; USHORT mount_point_offset; USHORT device_offset;
1
0
0
0
← Newer
1
...
83
84
85
86
87
88
89
...
102
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Results per page:
10
25
50
100
200