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
October 2008
----- 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
3 participants
1216 discussions
Start a n
N
ew thread
Henri Verbeet : dxgi: Add a debug function for DXGI_FORMAT.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: 0f0f2a626bf5267b1f5cc68e8c2ab8e6f892c223 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0f0f2a626bf5267b1f5cc68e8…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Oct 23 16:37:09 2008 +0200 dxgi: Add a debug function for DXGI_FORMAT. --- dlls/dxgi/Makefile.in | 3 +- dlls/dxgi/dxgi_private.h | 3 + dlls/dxgi/utils.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+), 1 deletions(-) diff --git a/dlls/dxgi/Makefile.in b/dlls/dxgi/Makefile.in index 2b01f9d..3a48994 100644 --- a/dlls/dxgi/Makefile.in +++ b/dlls/dxgi/Makefile.in @@ -9,7 +9,8 @@ IMPORTS = dxguid uuid kernel32 C_SRCS = \ device.c \ dxgi_main.c \ - factory.c + factory.c \ + utils.c RC_SRCS = version.rc diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index 2d6fbc2..110c9c0 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -28,6 +28,9 @@ #include "dxgi.h" +/* TRACE helper functions */ +const char *debug_dxgi_format(DXGI_FORMAT format); + /* IDXGIFactory */ extern const struct IDXGIFactoryVtbl dxgi_factory_vtbl; struct dxgi_factory diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c new file mode 100644 index 0000000..be3949f --- /dev/null +++ b/dlls/dxgi/utils.c @@ -0,0 +1,128 @@ +/* + * Copyright 2008 Henri Verbeet for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include "config.h" +#include "wine/port.h" + +#include "dxgi_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dxgi); + +#define WINE_DXGI_TO_STR(x) case x: return #x + +const char *debug_dxgi_format(DXGI_FORMAT format) +{ + switch(format) + { + WINE_DXGI_TO_STR(DXGI_FORMAT_UNKNOWN); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32G8X24_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_D32_FLOAT_S8X24_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10A2_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10A2_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10A2_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R11G11B10_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_D32_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R32_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R24G8_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_D24_UNORM_S8_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R24_UNORM_X8_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_X24_TYPELESS_G8_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16_FLOAT); + WINE_DXGI_TO_STR(DXGI_FORMAT_D16_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R16_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8_UINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8_SINT); + WINE_DXGI_TO_STR(DXGI_FORMAT_A8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R1_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_R9G9B9E5_SHAREDEXP); + WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_B8G8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_G8R8_G8B8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC1_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC1_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC1_UNORM_SRGB); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC2_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC2_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC2_UNORM_SRGB); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC3_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC3_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC3_UNORM_SRGB); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC4_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC4_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC4_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC5_TYPELESS); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC5_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_BC5_SNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_B5G6R5_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_B5G5R5A1_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8A8_UNORM); + WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8X8_UNORM); + default: + FIXME("Unrecognized DXGI_FORMAT %#x\n", format); + return "unrecognized"; + } +} + +#undef WINE_DXGI_TO_STR
1
0
0
0
Henri Verbeet : d3d10: It doesn't make sense to prefer native d3d10.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: db6be63bd303bb79380f5cc6934faab3f6de2171 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=db6be63bd303bb79380f5cc69…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Oct 23 16:37:09 2008 +0200 d3d10: It doesn't make sense to prefer native d3d10. --- dlls/d3d10/d3d10_main.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index f34a8ea..5728035 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -32,8 +32,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) TRACE("fdwReason=%d\n", fdwReason); switch(fdwReason) { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hInstDLL ); break;
1
0
0
0
Henri Verbeet : d3d10: Implement D3D10CreateDeviceAndSwapChain().
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: 5d6b7e4c4594862b9bbdafe5074c237c03d1d601 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5d6b7e4c4594862b9bbdafe50…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Oct 23 16:37:09 2008 +0200 d3d10: Implement D3D10CreateDeviceAndSwapChain(). --- dlls/d3d10/Makefile.in | 2 +- dlls/d3d10/d3d10.spec | 2 +- dlls/d3d10/d3d10_main.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ include/d3d10misc.h | 4 +++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index 296c236..eeaa542 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = d3d10.dll IMPORTLIB = d3d10 -IMPORTS = dxguid uuid kernel32 +IMPORTS = dxguid uuid dxgi kernel32 C_SRCS = \ d3d10_main.c \ diff --git a/dlls/d3d10/d3d10.spec b/dlls/d3d10/d3d10.spec index 0b59175..2613e38 100644 --- a/dlls/d3d10/d3d10.spec +++ b/dlls/d3d10/d3d10.spec @@ -2,7 +2,7 @@ @ stub D3D10CompileShader @ stub D3D10CreateBlob @ stdcall D3D10CreateDevice(ptr long ptr long long ptr) -@ stub D3D10CreateDeviceAndSwapChain +@ stdcall D3D10CreateDeviceAndSwapChain(ptr long ptr long long ptr ptr ptr) @ stub D3D10CreateEffectFromMemory @ stub D3D10CreateEffectPoolFromMemory @ stub D3D10CreateStateBlock diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index 6ed1756..f34a8ea 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -64,3 +64,52 @@ HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver return S_OK; } + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc, + IDXGISwapChain **swapchain, ID3D10Device **device) +{ + IDXGIFactory *factory; + HRESULT hr; + + TRACE("adapter %p, driver_type %s, swrast %p, flags %#x, sdk_version %d,\n" + "\tswapchain_desc %p, swapchain %p, device %p\n", + adapter, debug_d3d10_driver_type(driver_type), swrast, flags, sdk_version, + swapchain_desc, swapchain, device); + + hr = D3D10CreateDevice(adapter, driver_type, swrast, flags, sdk_version, device); + if (FAILED(hr)) + { + WARN("Failed to create a device, returning %#x\n", hr); + return hr; + } + + TRACE("Created ID3D10Device %p\n", *device); + + hr = CreateDXGIFactory(&IID_IDXGIFactory, (void **)&factory); + if (FAILED(hr)) + { + ID3D10Device_Release(*device); + *device = NULL; + + WARN("Failed to create a DXGI factory, returning %#x\n", hr); + return hr; + } + + TRACE("Created IDXGIFactory %p\n", factory); + + hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)*device, swapchain_desc, swapchain); + IDXGIFactory_Release(factory); + if (FAILED(hr)) + { + ID3D10Device_Release(*device); + *device = NULL; + + WARN("Failed to create a swapchain, returning %#x\n", hr); + return hr; + } + + TRACE("Created IDXGISwapChain %p\n", *swapchain); + + return S_OK; +} diff --git a/include/d3d10misc.h b/include/d3d10misc.h index 00cf153..58a6d26 100644 --- a/include/d3d10misc.h +++ b/include/d3d10misc.h @@ -35,6 +35,10 @@ typedef enum D3D10_DRIVER_TYPE { HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device); +HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc, + IDXGISwapChain **swapchain, ID3D10Device **device); + #ifdef __cplusplus } #endif
1
0
0
0
Henri Verbeet : d3d10: d3d10 doesn't need wined3d.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: c7e1c0907c02f2ff0179f9cf06bf882edce8132a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c7e1c0907c02f2ff0179f9cf0…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Oct 23 16:37:09 2008 +0200 d3d10: d3d10 doesn't need wined3d. --- dlls/d3d10/Makefile.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/d3d10/Makefile.in b/dlls/d3d10/Makefile.in index 7500aaa..296c236 100644 --- a/dlls/d3d10/Makefile.in +++ b/dlls/d3d10/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = d3d10.dll IMPORTLIB = d3d10 -IMPORTS = dxguid uuid wined3d kernel32 +IMPORTS = dxguid uuid kernel32 C_SRCS = \ d3d10_main.c \
1
0
0
0
Alexandre Julliard : kernel32: Return the Windows symlink in QueryDosDevice instead of the Unix one.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: 6dee4c6e639b7de1d4b1aaee9263d26ecce7bbc3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6dee4c6e639b7de1d4b1aaee9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 23 20:24:49 2008 +0200 kernel32: Return the Windows symlink in QueryDosDevice instead of the Unix one. --- dlls/kernel32/tests/volume.c | 2 +- dlls/kernel32/volume.c | 56 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 0229a82..97e3559 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -51,7 +51,7 @@ static void test_query_dos_deviceA(void) if (strstr(buffer, "HARDDISK") || strstr(buffer, "RAMDISK")) found = TRUE; } } - todo_wine ok(found, "expected at least one devicename to contain HARDDISK or RAMDISK\n"); + ok(found, "expected at least one devicename to contain HARDDISK or RAMDISK\n"); } static void test_FindFirstVolume(void) diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c index 823d163..7dc046f 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -46,6 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(volume); #define SUPERBLOCK_SIZE 2048 +#define SYMBOLIC_LINK_QUERY 0x0001 #define CDFRAMES_PERSEC 75 #define CDFRAMES_PERMIN (CDFRAMES_PERSEC * 60) @@ -128,6 +129,33 @@ static char *get_dos_device_path( LPCWSTR name ) return buffer; } +/* read the contents of an NT symlink object */ +static NTSTATUS read_nt_symlink( const WCHAR *name, WCHAR *target, DWORD size ) +{ + NTSTATUS status; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING nameW; + HANDLE handle; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.ObjectName = &nameW; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + RtlInitUnicodeString( &nameW, name ); + + if (!(status = NtOpenSymbolicLinkObject( &handle, SYMBOLIC_LINK_QUERY, &attr ))) + { + UNICODE_STRING targetW; + targetW.Buffer = target; + targetW.MaximumLength = (size - 1) * sizeof(WCHAR); + status = NtQuerySymbolicLinkObject( handle, &targetW, NULL ); + if (!status) target[targetW.Length / sizeof(WCHAR)] = 0; + NtClose( handle ); + } + return status; +} /* open a handle to a device root */ static BOOL open_device_root( LPCWSTR root, HANDLE *handle ) @@ -916,6 +944,7 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize ) static const WCHAR com0W[] = {'\\','?','?','\\','C','O','M','0',0}; static const WCHAR com1W[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','C','O','M','1',0,0}; static const WCHAR lpt1W[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','L','P','T','1',0,0}; + static const WCHAR driveW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','A',':',0}; UNICODE_STRING nt_name; ANSI_STRING unix_name; @@ -941,7 +970,19 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize ) } else if (devname[0] && devname[1] == ':' && !devname[2]) { - memcpy( name, devname, 3 * sizeof(WCHAR) ); + /* FIXME: should do this for all devices, not just drives */ + NTSTATUS status; + WCHAR buffer[sizeof(driveW)/sizeof(WCHAR)]; + + memcpy( buffer, driveW, sizeof(driveW) ); + buffer[12] = devname[0]; + if ((status = read_nt_symlink( buffer, target, bufsize ))) + { + SetLastError( RtlNtStatusToDosError(status) ); + return 0; + } + ret = strlenW( target ) + 1; + goto done; } else { @@ -995,7 +1036,7 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize ) RtlFreeAnsiString( &unix_name ); } } - + done: if (ret) { if (ret < bufsize) target[ret++] = 0; /* add an extra null */ @@ -1064,12 +1105,17 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize ) strcpyW( nt_buffer + 4, rootW ); RtlInitUnicodeString( &nt_name, nt_buffer ); + /* FIXME: should simply enumerate the DosDevices directory instead */ for (i = 0; i < 26; i++) { - nt_buffer[4] = 'a' + i; - if (!wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, TRUE )) + WCHAR buffer[sizeof(driveW)/sizeof(WCHAR)], dummy[8]; + NTSTATUS status; + + memcpy( buffer, driveW, sizeof(driveW) ); + buffer[12] = 'A' + i; + status = read_nt_symlink( buffer, dummy, sizeof(dummy)/sizeof(WCHAR) ); + if (status == STATUS_SUCCESS || status == STATUS_BUFFER_TOO_SMALL) { - RtlFreeAnsiString( &unix_name ); if (p + 3 >= target + bufsize) { SetLastError( ERROR_INSUFFICIENT_BUFFER );
1
0
0
0
Alexandre Julliard : mpr: Use a mountmgr ioctl to retrieve the UNC name for a drive.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: cb566755f73905196817770b610f74dc43283517 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cb566755f73905196817770b6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 23 19:59:17 2008 +0200 mpr: Use a mountmgr ioctl to retrieve the UNC name for a drive. --- dlls/mpr/wnet.c | 74 +++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 50 insertions(+), 24 deletions(-) diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 959efb3..3b05ede 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -24,10 +24,13 @@ #include "windef.h" #include "winbase.h" #include "winnls.h" +#include "winioctl.h" #include "winnetwk.h" #include "npapi.h" #include "winreg.h" #include "winuser.h" +#define WINE_MOUNTMGR_EXTENSIONS +#include "ddk/mountmgr.h" #include "wine/debug.h" #include "wine/unicode.h" #include "mprres.h" @@ -1750,6 +1753,52 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName, return ret; } +/* find the network connection for a given drive; helper for WNetGetConnection */ +static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size ) +{ + char buffer[1024]; + struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer; + HANDLE mgr; + DWORD ret = WN_NOT_CONNECTED; + + if ((mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, GENERIC_READ|GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + 0, 0 )) == INVALID_HANDLE_VALUE) + { + ERR( "failed to open mount manager err %u\n", GetLastError() ); + return ret; + } + memset( data, 0, sizeof(*data) ); + data->letter = letter; + if (DeviceIoControl( mgr, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, data, sizeof(*data), + data, sizeof(buffer), NULL, NULL )) + { + char *p, *mount_point = buffer + data->mount_point_offset; + DWORD len; + + if (data->mount_point_offset && !strncmp( mount_point, "unc/", 4 )) + { + mount_point += 2; + mount_point[0] = '\\'; + for (p = mount_point; *p; p++) if (*p == '/') *p = '\\'; + + len = MultiByteToWideChar( CP_UNIXCP, 0, mount_point, -1, NULL, 0 ); + if (len > *size) + { + *size = len; + ret = WN_MORE_DATA; + } + else + { + *size = MultiByteToWideChar( CP_UNIXCP, 0, mount_point, -1, remote, *size); + ret = WN_SUCCESS; + } + } + } + CloseHandle( mgr ); + return ret; +} + /************************************************************************** * WNetGetConnectionW [MPR.@] * @@ -1778,31 +1827,8 @@ DWORD WINAPI WNetGetConnectionW( LPCWSTR lpLocalName, switch(GetDriveTypeW(lpLocalName)) { case DRIVE_REMOTE: - { - static const WCHAR unc[] = { 'u','n','c','\\' }; - WCHAR rremote[MAX_PATH], *remote = rremote; - if (!QueryDosDeviceW( lpLocalName, remote, MAX_PATH )) remote[0] = 0; - else if (!strncmpW(remote, unc, 4)) - { - remote += 2; - remote[0] = '\\'; - } - else if (remote[0] != '\\' || remote[1] != '\\') - FIXME("Don't know how to convert %s to an unc\n", debugstr_w(remote)); - - if (strlenW(remote) + 1 > *lpBufferSize) - { - *lpBufferSize = strlenW(remote) + 1; - ret = WN_MORE_DATA; - } - else - { - strcpyW( lpRemoteName, remote ); - *lpBufferSize = strlenW(lpRemoteName) + 1; - ret = WN_SUCCESS; - } + ret = get_drive_connection( lpLocalName[0], lpRemoteName, lpBufferSize ); break; - } case DRIVE_REMOVABLE: case DRIVE_FIXED: case DRIVE_CDROM:
1
0
0
0
Alexandre Julliard : winecfg: Load the existing drive config from mountmgr instead of relying on QueryDosDevice .
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: abe00bbebe6c64df9d54038b8f7a2a1d1bddbe1f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=abe00bbebe6c64df9d54038b8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 23 16:29:11 2008 +0200 winecfg: Load the existing drive config from mountmgr instead of relying on QueryDosDevice. --- programs/winecfg/drive.c | 134 +++++++++++-------------------------------- programs/winecfg/winecfg.h | 2 +- 2 files changed, 36 insertions(+), 100 deletions(-) diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c index 7ee9a0e..1a3671c 100644 --- a/programs/winecfg/drive.c +++ b/programs/winecfg/drive.c @@ -256,121 +256,57 @@ static HANDLE open_mountmgr(void) } /* Load currently defined drives into the drives array */ -void load_drives(void) +BOOL load_drives(void) { - WCHAR *devices, *dev; - int len; - int drivecount = 0, i; - int retval; - static const int arraysize = 512; - const char *config_dir = wine_get_config_dir(); - char *path; - - WINE_TRACE("\n"); - - /* setup the drives array */ - dev = devices = HeapAlloc(GetProcessHeap(), 0, arraysize * sizeof(WCHAR)); - len = GetLogicalDriveStringsW(arraysize, devices); - - /* make all devices unused */ - for (i = 0; i < 26; i++) - { - drives[i].letter = 'A' + i; - drives[i].in_use = FALSE; - drives[i].serial = 0; - - HeapFree(GetProcessHeap(), 0, drives[i].unixpath); - drives[i].unixpath = NULL; + DWORD i, size = 1024; + HANDLE mgr; + WCHAR root[] = {'A',':',0}; - HeapFree(GetProcessHeap(), 0, drives[i].label); - drives[i].label = NULL; - } + if ((mgr = open_mountmgr()) == INVALID_HANDLE_VALUE) return FALSE; - /* work backwards through the result of GetLogicalDriveStrings */ - while (len) + while (root[0] <= 'Z') { - WCHAR volname[512]; /* volume name */ - DWORD serial; - char simplepath[3]; - char targetpath[256]; - char *c; + struct mountmgr_unix_drive input; + struct mountmgr_unix_drive *data; - WINE_TRACE("devices == %s\n", wine_dbgstr_w(devices)); + if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) break; - volname[0] = 0; + memset( &input, 0, sizeof(input) ); + input.letter = root[0]; - retval = GetVolumeInformationW(devices, volname, sizeof(volname)/sizeof(WCHAR), - &serial, NULL, NULL, NULL, 0); - if(!retval) + if (DeviceIoControl( mgr, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, &input, sizeof(input), + data, size, NULL, NULL )) { - WINE_ERR("GetVolumeInformation() for %s failed, setting serial to 0\n", - wine_dbgstr_w(devices)); - PRINTERROR(); - serial = 0; - } - - WINE_TRACE("serial: '0x%X'\n", serial); - - /* QueryDosDevice() requires no trailing backslash */ - simplepath[0] = devices[0]; - simplepath[1] = ':'; - simplepath[2] = 0; - QueryDosDevice(simplepath, targetpath, sizeof(targetpath)); - - /* targetpath may have forward slashes rather than backslashes, so correct */ - c = targetpath; - do if (*c == '\\') *c = '/'; while (*c++); + char *unixpath = NULL, *device = NULL; + WCHAR volname[MAX_PATH]; + DWORD serial; - add_drive(*devices, targetpath, NULL, volname, serial, get_drive_type(devices[0]) ); + if (data->mount_point_offset) unixpath = (char *)data + data->mount_point_offset; + if (data->device_offset) device = (char *)data + data->device_offset; - len -= lstrlenW(devices); - devices += lstrlenW(devices); - - /* skip over any nulls */ - while ((*devices == 0) && (len)) + if (!GetVolumeInformationW( root, volname, sizeof(volname)/sizeof(WCHAR), + &serial, NULL, NULL, NULL, 0 )) + { + volname[0] = 0; + serial = 0; + } + if (unixpath) /* FIXME: handle unmounted drives too */ + add_drive( root[0], unixpath, device, volname, serial, get_drive_type(root[0]) ); + root[0]++; + } + else { - len--; - devices++; + if (GetLastError() == ERROR_MORE_DATA) size = data->size; + else root[0]++; /* skip this drive */ } - - drivecount++; - } - - /* Find all the broken symlinks we might have and add them as well. */ - - len = strlen(config_dir) + sizeof("/dosdevices/a:"); - if (!(path = HeapAlloc(GetProcessHeap(), 0, len))) - return; - - strcpy(path, config_dir); - strcat(path, "/dosdevices/a:"); - - for (i = 0; i < 26; i++) - { - char buff[MAX_PATH]; - struct stat st; - int cnt; - - if (drives[i].in_use) continue; - path[len - 3] = 'a' + i; - - if (lstat(path, &st) == -1 || !S_ISLNK(st.st_mode)) continue; - if ((cnt = readlink(path, buff, sizeof(buff))) == -1) continue; - buff[cnt] = '\0'; - - WINE_TRACE("found broken symlink %s -> %s\n", path, buff); - add_drive('A' + i, buff, NULL, NULL, 0, DRIVE_UNKNOWN); - - drivecount++; + HeapFree( GetProcessHeap(), 0, data ); } /* reset modified flags */ for (i = 0; i < 26; i++) drives[i].modified = FALSE; - WINE_TRACE("found %d drives\n", drivecount); - - HeapFree(GetProcessHeap(), 0, path); - HeapFree(GetProcessHeap(), 0, dev); + CloseHandle( mgr ); + return TRUE; } /* some of this code appears to be broken by bugs in Wine: the label diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h index b0e2e40..43fb278 100644 --- a/programs/winecfg/winecfg.h +++ b/programs/winecfg/winecfg.h @@ -90,7 +90,7 @@ INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); /* Drive management */ -void load_drives(void); +BOOL load_drives(void); int autodetect_drives(void); struct drive
1
0
0
0
Alexandre Julliard : winecfg: Store the Unix device if any in the drive configuration.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: 18b66912b7f0c27cf5caca6c26295b9c915f6cfe URL:
http://source.winehq.org/git/wine.git/?a=commit;h=18b66912b7f0c27cf5caca6c2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 23 16:19:36 2008 +0200 winecfg: Store the Unix device if any in the drive configuration. --- programs/winecfg/drive.c | 35 ++++++++++++++++++++++++++--------- programs/winecfg/drivedetect.c | 16 ++++++++++------ programs/winecfg/driveui.c | 4 ++-- programs/winecfg/winecfg.h | 4 +++- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c index 35f013b..7ee9a0e 100644 --- a/programs/winecfg/drive.c +++ b/programs/winecfg/drive.c @@ -93,19 +93,22 @@ long drive_available_mask(char letter) return result; } -BOOL add_drive(char letter, const char *targetpath, const WCHAR *label, DWORD serial, DWORD type) +BOOL add_drive(char letter, const char *targetpath, const char *device, const WCHAR *label, + DWORD serial, DWORD type) { int driveIndex = letter_to_index(letter); if(drives[driveIndex].in_use) return FALSE; - WINE_TRACE("letter == '%c', unixpath == '%s', label == %s, serial == %08x, type == %d\n", - letter, targetpath, wine_dbgstr_w(label), serial, type); + WINE_TRACE("letter == '%c', unixpath == %s, device == %s, label == %s, serial == %08x, type == %d\n", + letter, wine_dbgstr_a(targetpath), wine_dbgstr_a(device), + wine_dbgstr_w(label), serial, type); drives[driveIndex].letter = toupper(letter); drives[driveIndex].unixpath = strdupA(targetpath); - drives[driveIndex].label = strdupW(label); + drives[driveIndex].device = device ? strdupA(device) : NULL; + drives[driveIndex].label = label ? strdupW(label) : NULL; drives[driveIndex].serial = serial; drives[driveIndex].type = type; drives[driveIndex].in_use = TRUE; @@ -119,6 +122,8 @@ void delete_drive(struct drive *d) { HeapFree(GetProcessHeap(), 0, d->unixpath); d->unixpath = NULL; + HeapFree(GetProcessHeap(), 0, d->device); + d->device = NULL; HeapFree(GetProcessHeap(), 0, d->label); d->label = NULL; d->serial = 0; @@ -316,7 +321,7 @@ void load_drives(void) c = targetpath; do if (*c == '\\') *c = '/'; while (*c++); - add_drive(*devices, targetpath, volname, serial, get_drive_type(devices[0]) ); + add_drive(*devices, targetpath, NULL, volname, serial, get_drive_type(devices[0]) ); len -= lstrlenW(devices); devices += lstrlenW(devices); @@ -354,7 +359,7 @@ void load_drives(void) buff[cnt] = '\0'; WINE_TRACE("found broken symlink %s -> %s\n", path, buff); - add_drive('A' + i, buff, NULL, 0, DRIVE_UNKNOWN); + add_drive('A' + i, buff, NULL, NULL, 0, DRIVE_UNKNOWN); drivecount++; } @@ -388,16 +393,28 @@ void apply_drive_changes(void) drives[i].modified = FALSE; len = sizeof(*ioctl); - if (drives[i].in_use) len += strlen(drives[i].unixpath) + 1; + if (drives[i].in_use) + { + len += strlen(drives[i].unixpath) + 1; + if (drives[i].device) len += strlen(drives[i].device) + 1; + } if (!(ioctl = HeapAlloc( GetProcessHeap(), 0, len ))) continue; ioctl->size = len; ioctl->letter = 'a' + i; ioctl->device_offset = 0; if (drives[i].in_use) { + char *ptr = (char *)(ioctl + 1); + ioctl->type = drives[i].type; - ioctl->mount_point_offset = sizeof(*ioctl); - strcpy( (char *)(ioctl + 1), drives[i].unixpath ); + strcpy( ptr, drives[i].unixpath ); + ioctl->mount_point_offset = ptr - (char *)ioctl; + if (drives[i].device) + { + ptr += strlen(ptr) + 1; + strcpy( ptr, drives[i].device ); + ioctl->device_offset = ptr - (char *)ioctl; + } } else { diff --git a/programs/winecfg/drivedetect.c b/programs/winecfg/drivedetect.c index 9a2b451..1c03b6f 100644 --- a/programs/winecfg/drivedetect.c +++ b/programs/winecfg/drivedetect.c @@ -235,7 +235,7 @@ static void ensure_root_is_mapped(void) { if (!drives[letter - 'A'].in_use) { - add_drive(letter, "/", NULL, 0, DRIVE_FIXED); + add_drive(letter, "/", NULL, NULL, 0, DRIVE_FIXED); WINE_TRACE("allocated drive %c as the root drive\n", letter); break; } @@ -264,7 +264,7 @@ static void ensure_home_is_mapped(void) { if (!drives[letter - 'A'].in_use) { - add_drive(letter, home, NULL, 0, DRIVE_FIXED); + add_drive(letter, home, NULL, NULL, 0, DRIVE_FIXED); WINE_TRACE("allocated drive %c as the user's home directory\n", letter); break; } @@ -292,7 +292,7 @@ static void ensure_drive_c_is_mapped(void) WCHAR label[64]; LoadStringW (GetModuleHandle (NULL), IDS_SYSTEM_DRIVE_LABEL, label, sizeof(label)/sizeof(label[0])); - add_drive('C', "../drive_c", label, 0, DRIVE_FIXED); + add_drive('C', "../drive_c", NULL, label, 0, DRIVE_FIXED); } else { @@ -330,7 +330,8 @@ int autodetect_drives(void) { char letter; int type; - + char *device = NULL; + WINE_TRACE("ent->mnt_dir=%s\n", ent->mnt_dir); if (should_ignore_fstype(ent->mnt_type)) continue; @@ -355,8 +356,11 @@ int autodetect_drives(void) return FALSE; } - WINE_TRACE("adding drive %c for %s, type %s\n", letter, ent->mnt_dir, ent->mnt_type); - add_drive(letter, ent->mnt_dir, NULL, 0, type); + if (type == DRIVE_CDROM) device = ent->mnt_fsname; + + WINE_TRACE("adding drive %c for %s, device %s, type %s\n", + letter, ent->mnt_dir, device, ent->mnt_type); + add_drive(letter, ent->mnt_dir, device, NULL, 0, type); /* working_mask is a map of the drive letters still available. */ working_mask &= ~DRIVE_MASK_BIT(letter); diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c index 8443537..a15d599 100644 --- a/programs/winecfg/driveui.c +++ b/programs/winecfg/driveui.c @@ -315,9 +315,9 @@ static void on_add_click(HWND dialog) WCHAR label[64]; LoadStringW (GetModuleHandle (NULL), IDS_SYSTEM_DRIVE_LABEL, label, sizeof(label)/sizeof(label[0])); - add_drive(new, "../drive_c", label, 0, DRIVE_FIXED); + add_drive(new, "../drive_c", NULL, label, 0, DRIVE_FIXED); } - else add_drive(new, "/", NULL, 0, DRIVE_UNKNOWN); + else add_drive(new, "/", NULL, NULL, 0, DRIVE_UNKNOWN); fill_drives_list(dialog); diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h index 807caf7..b0e2e40 100644 --- a/programs/winecfg/winecfg.h +++ b/programs/winecfg/winecfg.h @@ -97,6 +97,7 @@ struct drive { char letter; char *unixpath; + char *device; WCHAR *label; DWORD serial; DWORD type; /* one of the DRIVE_ constants from winbase.h */ @@ -108,7 +109,8 @@ struct drive #define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A')) long drive_available_mask(char letter); -BOOL add_drive(char letter, const char *targetpath, const WCHAR *label, DWORD serial, DWORD type); +BOOL add_drive(char letter, const char *targetpath, const char *device, + const WCHAR *label, DWORD serial, DWORD type); void delete_drive(struct drive *pDrive); void apply_drive_changes(void); BOOL browse_for_unix_folder(HWND dialog, WCHAR *pszPath);
1
0
0
0
Alexandre Julliard : winecfg: Use an ioctl to the mount manager to define drives.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: eb65f6a212658a0554a8ffe7b6bb0645a7aee28a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eb65f6a212658a0554a8ffe7b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 23 16:00:00 2008 +0200 winecfg: Use an ioctl to the mount manager to define drives. --- programs/winecfg/drive.c | 111 +++++++++++++++++++--------------------------- 1 files changed, 45 insertions(+), 66 deletions(-) diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c index bc3766c..35f013b 100644 --- a/programs/winecfg/drive.c +++ b/programs/winecfg/drive.c @@ -29,8 +29,12 @@ #include <stdio.h> #include <string.h> +#include <ntstatus.h> +#define WIN32_NO_STATUS #include <windef.h> #include <winbase.h> +#include <winternl.h> +#include <winioctl.h> #include <winreg.h> #include <wine/debug.h> #include <shellapi.h> @@ -38,6 +42,8 @@ #include <shlguid.h> #include <shlwapi.h> #include <shlobj.h> +#define WINE_MOUNTMGR_EXTENSIONS +#include <ddk/mountmgr.h> #include <wine/library.h> #include "winecfg.h" @@ -120,36 +126,6 @@ void delete_drive(struct drive *d) d->modified = TRUE; } -static void set_drive_type( char letter, DWORD type ) -{ - HKEY hKey; - char driveValue[4]; - const char *typeText = NULL; - - sprintf(driveValue, "%c:", letter); - - /* Set the drive type in the registry */ - if (type == DRIVE_FIXED) - typeText = "hd"; - else if (type == DRIVE_REMOTE) - typeText = "network"; - else if (type == DRIVE_REMOVABLE) - typeText = "floppy"; - else if (type == DRIVE_CDROM) - typeText = "cdrom"; - - if (RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\Wine\\Drives", &hKey) != ERROR_SUCCESS) - WINE_TRACE(" Unable to open '%s'\n", "Software\\Wine\\Drives"); - else - { - if (typeText) - RegSetValueEx( hKey, driveValue, 0, REG_SZ, (const BYTE *)typeText, strlen(typeText) + 1 ); - else - RegDeleteValue( hKey, driveValue ); - RegCloseKey(hKey); - } -} - static DWORD get_drive_type( char letter ) { HKEY hKey; @@ -263,6 +239,17 @@ BOOL moveDrive(struct drive *pSrc, struct drive *pDst) #endif +static HANDLE open_mountmgr(void) +{ + HANDLE ret; + + if ((ret = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, GENERIC_READ|GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + 0, 0 )) == INVALID_HANDLE_VALUE) + WINE_ERR( "failed to open mount manager err %u\n", GetLastError() ); + return ret; +} + /* Load currently defined drives into the drives array */ void load_drives(void) { @@ -386,55 +373,47 @@ void load_drives(void) void apply_drive_changes(void) { int i; - CHAR devicename[4]; - CHAR targetpath[256]; + HANDLE mgr; + DWORD len; + struct mountmgr_unix_drive *ioctl; WINE_TRACE("\n"); + if ((mgr = open_mountmgr()) == INVALID_HANDLE_VALUE) return; + /* add each drive and remove as we go */ for(i = 0; i < 26; i++) { if (!drives[i].modified) continue; drives[i].modified = FALSE; - snprintf(devicename, sizeof(devicename), "%c:", 'A' + i); - + len = sizeof(*ioctl); + if (drives[i].in_use) len += strlen(drives[i].unixpath) + 1; + if (!(ioctl = HeapAlloc( GetProcessHeap(), 0, len ))) continue; + ioctl->size = len; + ioctl->letter = 'a' + i; + ioctl->device_offset = 0; if (drives[i].in_use) { - /* define this drive */ - /* DefineDosDevice() requires that NO trailing slash be present */ - if(!DefineDosDevice(DDD_RAW_TARGET_PATH, devicename, drives[i].unixpath)) - { - WINE_ERR(" unable to define devicename of '%s', targetpath of '%s'\n", - devicename, drives[i].unixpath); - PRINTERROR(); - } - else - { - WINE_TRACE(" added devicename of '%s', targetpath of '%s'\n", - devicename, drives[i].unixpath); - } - set_drive_label( drives[i].letter, drives[i].label ); - set_drive_serial( drives[i].letter, drives[i].serial ); - set_drive_type( drives[i].letter, drives[i].type ); + ioctl->type = drives[i].type; + ioctl->mount_point_offset = sizeof(*ioctl); + strcpy( (char *)(ioctl + 1), drives[i].unixpath ); + } + else + { + ioctl->type = DRIVE_NO_ROOT_DIR; + ioctl->mount_point_offset = 0; } - else if (QueryDosDevice(devicename, targetpath, sizeof(targetpath))) + + if (DeviceIoControl( mgr, IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE, ioctl, len, NULL, 0, NULL, NULL )) { - /* remove this drive */ - if(!DefineDosDevice(DDD_REMOVE_DEFINITION, devicename, drives[i].unixpath)) - { - WINE_ERR("unable to remove devicename of '%s', targetpath of '%s'\n", - devicename, drives[i].unixpath); - PRINTERROR(); - } - else - { - WINE_TRACE("removed devicename of '%s', targetpath of '%s'\n", - devicename, drives[i].unixpath); - } - - set_drive_type( drives[i].letter, DRIVE_UNKNOWN ); - continue; + set_drive_label( drives[i].letter, drives[i].label ); + if (drives[i].in_use) set_drive_serial( drives[i].letter, drives[i].serial ); + WINE_TRACE( "set drive %c: to %s type %u\n", 'a' + i, + wine_dbgstr_a(drives[i].unixpath), drives[i].type ); } + else WINE_WARN( "failed to set drive %c: to %s type %u err %u\n", 'a' + i, + wine_dbgstr_a(drives[i].unixpath), drives[i].type, GetLastError() ); } + CloseHandle( mgr ); }
1
0
0
0
Alexandre Julliard : mountmgr: Add a Wine-specific ioctl to query the Unix information about a drive.
by Alexandre Julliard
24 Oct '08
24 Oct '08
Module: wine Branch: master Commit: bc32b857ab5e4dc00aa3258bb476089053be543f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bc32b857ab5e4dc00aa3258bb…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 23 15:52:39 2008 +0200 mountmgr: Add a Wine-specific ioctl to query the Unix information about a drive. --- dlls/mountmgr.sys/device.c | 16 ++++++++++ dlls/mountmgr.sys/mountmgr.c | 64 ++++++++++++++++++++++++++++++++++++++++++ dlls/mountmgr.sys/mountmgr.h | 1 + include/ddk/mountmgr.h | 1 + 4 files changed, 82 insertions(+), 0 deletions(-) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 9036654..00b59ed 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -568,6 +568,22 @@ NTSTATUS remove_dos_device( int letter, const char *udi ) return STATUS_NO_SUCH_DEVICE; } +/* query information about an existing dos drive, by letter or udi */ +NTSTATUS query_dos_device( int letter, DWORD *type, const char **device, const char **mount_point ) +{ + struct dos_drive *drive; + + LIST_FOR_EACH_ENTRY( drive, &drives_list, struct dos_drive, entry ) + { + if (drive->drive != letter) continue; + if (type) *type = drive->type; + if (device) *device = drive->unix_device; + if (mount_point) *mount_point = drive->unix_mount; + return STATUS_SUCCESS; + } + return STATUS_NO_SUCH_DEVICE; +} + /* handler for ioctls on the harddisk device */ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp ) { diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index c633588..3c1aa88 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -265,6 +265,61 @@ static NTSTATUS define_unix_drive( const void *in_buff, SIZE_T insize ) } } +/* implementation of IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE */ +static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize, + void *out_buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb ) +{ + const struct mountmgr_unix_drive *input = in_buff; + struct mountmgr_unix_drive *output = out_buff; + const char *device, *mount_point; + int letter = tolowerW( input->letter ); + NTSTATUS status; + DWORD size, type; + char *ptr; + + if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER; + + if ((status = query_dos_device( letter - 'a', &type, &device, &mount_point ))) return status; + + size = sizeof(*output); + if (device) size += strlen(device) + 1; + if (mount_point) size += strlen(mount_point) + 1; + + if (size > outsize) + { + if (size >= FIELD_OFFSET( struct mountmgr_unix_drive, size ) + sizeof(output->size)) + output->size = size; + iosb->Information = FIELD_OFFSET( struct mountmgr_unix_drive, size ) + sizeof(output->size); + return STATUS_MORE_ENTRIES; + } + output->size = size; + output->letter = letter; + output->type = type; + ptr = (char *)(output + 1); + + if (mount_point) + { + output->mount_point_offset = ptr - (char *)output; + strcpy( ptr, mount_point ); + ptr += strlen(ptr) + 1; + } + else output->mount_point_offset = 0; + + if (device) + { + output->device_offset = ptr - (char *)output; + strcpy( ptr, device ); + ptr += strlen(ptr) + 1; + } + else output->device_offset = 0; + + TRACE( "returning %c: dev %s mount %s type %u\n", + letter, debugstr_a(device), debugstr_a(mount_point), type ); + + iosb->Information = ptr - (char *)output; + return STATUS_SUCCESS; +} + /* handler for ioctls on the mount manager device */ static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp ) { @@ -293,6 +348,15 @@ static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp ) irp->IoStatus.u.Status = define_unix_drive( irpsp->Parameters.DeviceIoControl.Type3InputBuffer, irpsp->Parameters.DeviceIoControl.InputBufferLength ); break; + case IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE: + if (irpsp->Parameters.DeviceIoControl.InputBufferLength < sizeof(struct mountmgr_unix_drive)) + return STATUS_INVALID_PARAMETER; + irp->IoStatus.u.Status = query_unix_drive( irpsp->Parameters.DeviceIoControl.Type3InputBuffer, + irpsp->Parameters.DeviceIoControl.InputBufferLength, + irp->MdlAddress->StartVa, + irpsp->Parameters.DeviceIoControl.OutputBufferLength, + &irp->IoStatus ); + break; default: FIXME( "ioctl %x not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode ); irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index 1b4b3f6..63e9b75 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -43,6 +43,7 @@ extern void initialize_diskarbitration(void); extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device, const char *mount_point, DWORD type ); extern NTSTATUS remove_dos_device( int letter, const char *udi ); +extern NTSTATUS query_dos_device( int letter, DWORD *type, const char **device, const char **mount_point ); extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ); /* mount point functions */ diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h index 05eeeac..f0e836f 100644 --- a/include/ddk/mountmgr.h +++ b/include/ddk/mountmgr.h @@ -53,6 +53,7 @@ static const WCHAR MOUNTMGR_DOS_DEVICE_NAME[] = {'\\','\\','.','\\','M','o','u', #ifdef WINE_MOUNTMGR_EXTENSIONS #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) struct mountmgr_unix_drive {
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
24
...
122
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Results per page:
10
25
50
100
200