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
September 2021
----- 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
1030 discussions
Start a n
N
ew thread
Rémi Bernon : winebus.sys: Remove the now useless native product strings.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: e4f0b4ab8a2a573b0985c3764779f44c88420f59 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e4f0b4ab8a2a573b0985c376…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Sep 13 13:01:45 2021 +0200 winebus.sys: Remove the now useless native product strings. This should now be handled by winexinput.sys. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 93 +++++++++---------------------------------------- 1 file changed, 16 insertions(+), 77 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 42614b09f3a..53f6ac032e8 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -61,35 +61,25 @@ struct product_desc { WORD vid; WORD pid; - const WCHAR* manufacturer; - const WCHAR* product; - const WCHAR* serialnumber; }; #define VID_MICROSOFT 0x045e -static const WCHAR xbox360_product_string[] = { - 'C','o','n','t','r','o','l','l','e','r',' ','(','X','B','O','X',' ','3','6','0',' ','F','o','r',' ','W','i','n','d','o','w','s',')',0 -}; - -static const WCHAR xboxone_product_string[] = { - 'C','o','n','t','r','o','l','l','e','r',' ','(','X','B','O','X',' ','O','n','e',' ','F','o','r',' ','W','i','n','d','o','w','s',')',0 -}; - -static const struct product_desc XBOX_CONTROLLERS[] = { - {VID_MICROSOFT, 0x0202, NULL, NULL, NULL}, /* Xbox Controller */ - {VID_MICROSOFT, 0x0285, NULL, NULL, NULL}, /* Xbox Controller S */ - {VID_MICROSOFT, 0x0289, NULL, NULL, NULL}, /* Xbox Controller S */ - {VID_MICROSOFT, 0x028e, NULL, xbox360_product_string, NULL}, /* Xbox360 Controller */ - {VID_MICROSOFT, 0x028f, NULL, xbox360_product_string, NULL}, /* Xbox360 Wireless Controller */ - {VID_MICROSOFT, 0x02d1, NULL, xboxone_product_string, NULL}, /* Xbox One Controller */ - {VID_MICROSOFT, 0x02dd, NULL, xboxone_product_string, NULL}, /* Xbox One Controller (Covert Forces/Firmware 2015) */ - {VID_MICROSOFT, 0x02e0, NULL, NULL, NULL}, /* Xbox One X Controller */ - {VID_MICROSOFT, 0x02e3, NULL, xboxone_product_string, NULL}, /* Xbox One Elite Controller */ - {VID_MICROSOFT, 0x02e6, NULL, NULL, NULL}, /* Wireless XBox Controller Dongle */ - {VID_MICROSOFT, 0x02ea, NULL, xboxone_product_string, NULL}, /* Xbox One S Controller */ - {VID_MICROSOFT, 0x02fd, NULL, xboxone_product_string, NULL}, /* Xbox One S Controller (Firmware 2017) */ - {VID_MICROSOFT, 0x0719, NULL, xbox360_product_string, NULL}, /* Xbox 360 Wireless Adapter */ +static const struct product_desc XBOX_CONTROLLERS[] = +{ + {VID_MICROSOFT, 0x0202}, /* Xbox Controller */ + {VID_MICROSOFT, 0x0285}, /* Xbox Controller S */ + {VID_MICROSOFT, 0x0289}, /* Xbox Controller S */ + {VID_MICROSOFT, 0x028e}, /* Xbox360 Controller */ + {VID_MICROSOFT, 0x028f}, /* Xbox360 Wireless Controller */ + {VID_MICROSOFT, 0x02d1}, /* Xbox One Controller */ + {VID_MICROSOFT, 0x02dd}, /* Xbox One Controller (Covert Forces/Firmware 2015) */ + {VID_MICROSOFT, 0x02e0}, /* Xbox One X Controller */ + {VID_MICROSOFT, 0x02e3}, /* Xbox One Elite Controller */ + {VID_MICROSOFT, 0x02e6}, /* Wireless XBox Controller Dongle */ + {VID_MICROSOFT, 0x02ea}, /* Xbox One S Controller */ + {VID_MICROSOFT, 0x02fd}, /* Xbox One S Controller (Firmware 2017) */ + {VID_MICROSOFT, 0x0719}, /* Xbox 360 Wireless Adapter */ }; static DRIVER_OBJECT *driver_obj; @@ -825,55 +815,6 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l } } -static NTSTATUS hid_get_native_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length) -{ - struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - const struct product_desc *vendor_products; - unsigned int i, vendor_products_size = 0; - - if (ext->desc.vid == VID_MICROSOFT) - { - vendor_products = XBOX_CONTROLLERS; - vendor_products_size = ARRAY_SIZE(XBOX_CONTROLLERS); - } - - for (i = 0; i < vendor_products_size; i++) - { - if (ext->desc.pid == vendor_products[i].pid) - break; - } - - if (i >= vendor_products_size) - return STATUS_UNSUCCESSFUL; - - switch (index) - { - case HID_STRING_ID_IPRODUCT: - if (vendor_products[i].product) - { - strcpyW(buffer, vendor_products[i].product); - return STATUS_SUCCESS; - } - break; - case HID_STRING_ID_IMANUFACTURER: - if (vendor_products[i].manufacturer) - { - strcpyW(buffer, vendor_products[i].manufacturer); - return STATUS_SUCCESS; - } - break; - case HID_STRING_ID_ISERIALNUMBER: - if (vendor_products[i].serialnumber) - { - strcpyW(buffer, vendor_products[i].serialnumber); - return STATUS_SUCCESS; - } - break; - } - - return STATUS_UNSUCCESSFUL; -} - static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp); @@ -965,9 +906,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) DWORD index = (ULONG_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer; TRACE("IOCTL_HID_GET_STRING[%08x]\n", index); - irp->IoStatus.Status = hid_get_native_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); - if (irp->IoStatus.Status != STATUS_SUCCESS) - irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); + irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); if (irp->IoStatus.Status == STATUS_SUCCESS) irp->IoStatus.Information = (strlenW((WCHAR *)irp->UserBuffer) + 1) * sizeof(WCHAR); break;
1
0
0
0
Rémi Bernon : winexinput.sys: Return native product strings on some devices.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 5e41525c3bb774be7cce8801505c58c460d889f9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5e41525c3bb774be7cce8801…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Sep 13 13:01:44 2021 +0200 winexinput.sys: Return native product strings on some devices. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winexinput.sys/main.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/dlls/winexinput.sys/main.c b/dlls/winexinput.sys/main.c index 3832c97ef26..667ce867269 100644 --- a/dlls/winexinput.sys/main.c +++ b/dlls/winexinput.sys/main.c @@ -32,6 +32,7 @@ #include "ddk/wdm.h" #include "ddk/hidport.h" #include "ddk/hidpddi.h" +#include "ddk/hidtypes.h" #include "wine/asm.h" #include "wine/debug.h" @@ -314,17 +315,76 @@ static NTSTATUS try_complete_pending_read(DEVICE_OBJECT *device, IRP *irp) return IoCallDriver(fdo->bus_device, xinput_irp); } +struct device_strings +{ + const WCHAR *id; + const WCHAR *product; +}; + +static const struct device_strings device_strings[] = +{ + { .id = L"VID_045E&PID_028E&IG_00", .product = L"Controller (XBOX 360 For Windows)" }, + { .id = L"VID_045E&PID_028F&IG_00", .product = L"Controller (XBOX 360 For Windows)" }, + { .id = L"VID_045E&PID_02D1&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02DD&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02E3&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02EA&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02FD&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_0719&IG_00", .product = L"Controller (XBOX 360 For Windows)" }, +}; + +static const WCHAR *find_product_string(const WCHAR *device_id) +{ + const WCHAR *match_id = wcsrchr(device_id, '\\') + 1; + DWORD i; + + for (i = 0; i < ARRAY_SIZE(device_strings); ++i) + if (!wcsicmp(device_strings[i].id, match_id)) + return device_strings[i].product; + + return NULL; +} + static NTSTATUS WINAPI gamepad_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); ULONG output_len = stack->Parameters.DeviceIoControl.OutputBufferLength; ULONG code = stack->Parameters.DeviceIoControl.IoControlCode; struct func_device *fdo = fdo_from_DEVICE_OBJECT(device); + struct device *impl = impl_from_DEVICE_OBJECT(device); + const WCHAR *str = NULL; TRACE("device %p, irp %p, code %#x, bus_device %p.\n", device, irp, code, fdo->bus_device); switch (code) { + case IOCTL_HID_GET_STRING: + switch ((ULONG_PTR)stack->Parameters.DeviceIoControl.Type3InputBuffer) + { + case HID_STRING_ID_IPRODUCT: + str = find_product_string(impl->device_id); + break; + } + + if (!str) + { + IoSkipCurrentIrpStackLocation(irp); + return IoCallDriver(fdo->bus_device, irp); + } + + irp->IoStatus.Information = (wcslen(str) + 1) * sizeof(WCHAR); + if (output_len < irp->IoStatus.Information) + { + irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_BUFFER_TOO_SMALL; + } + + wcscpy(irp->UserBuffer, str); + irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + case IOCTL_HID_GET_DEVICE_DESCRIPTOR: { HID_DESCRIPTOR *descriptor = (HID_DESCRIPTOR *)irp->UserBuffer;
1
0
0
0
Nikolay Sivov : ole32: Simplify IsEqual() for file monikers.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: fb31e6f3f314ad3946d93b7d5feca94cb11dad6e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fb31e6f3f314ad3946d93b7d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 13 10:01:26 2021 +0300 ole32: Simplify IsEqual() for file monikers. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/filemoniker.c | 45 +++++++++++++++++---------------------------- dlls/ole32/tests/moniker.c | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index d3940a9365f..f52881108c7 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -57,6 +57,15 @@ static inline FileMonikerImpl *impl_from_IROTData(IROTData *iface) return CONTAINING_RECORD(iface, FileMonikerImpl, IROTData_iface); } +static const IMonikerVtbl VT_FileMonikerImpl; + +static FileMonikerImpl *unsafe_impl_from_IMoniker(IMoniker *iface) +{ + if (iface->lpVtbl != &VT_FileMonikerImpl) + return NULL; + return CONTAINING_RECORD(iface, FileMonikerImpl, IMoniker_iface); +} + /* Local function used by filemoniker implementation */ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName); @@ -735,40 +744,20 @@ FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker return S_OK; } -/****************************************************************************** - * FileMoniker_IsEqual - */ -static HRESULT WINAPI -FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker) +static HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker *iface, IMoniker *other) { - FileMonikerImpl *This = impl_from_IMoniker(iface); - CLSID clsid; - LPOLESTR filePath; - IBindCtx* bind; - HRESULT res; - - TRACE("(%p,%p)\n",iface,pmkOtherMoniker); + FileMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker; - if (pmkOtherMoniker==NULL) - return S_FALSE; + TRACE("%p, %p.\n", iface, other); - IMoniker_GetClassID(pmkOtherMoniker,&clsid); + if (!other) + return E_INVALIDARG; - if (!IsEqualCLSID(&clsid,&CLSID_FileMoniker)) + other_moniker = unsafe_impl_from_IMoniker(other); + if (!other_moniker) return S_FALSE; - res = CreateBindCtx(0,&bind); - if (FAILED(res)) return res; - - res = S_FALSE; - if (SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath))) { - if (!lstrcmpiW(filePath, This->filePathName)) - res = S_OK; - CoTaskMemFree(filePath); - } - - IBindCtx_Release(bind); - return res; + return !wcsicmp(moniker->filePathName, other_moniker->filePathName) ? S_OK : S_FALSE; } /****************************************************************************** diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 8d9c0678436..d8d52295ff2 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -1981,8 +1981,8 @@ static void test_file_monikers(void) {0x20ac, 0x2020, 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, 0x10a, 0x10b, 0x10c, 0}, }; WCHAR filename[MAX_PATH], path[MAX_PATH]; + IMoniker *moniker, *moniker2; BIND_OPTS bind_opts; - IMoniker *moniker; IStorage *storage; IBindCtx *bindctx; STATSTG statstg; @@ -2057,6 +2057,22 @@ static void test_file_monikers(void) IMoniker_Release(moniker); DeleteFileW(filename); + + /* IsEqual() */ + hr = CreateFileMoniker(L"test.bmp", &moniker); + ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr); + + hr = CreateFileMoniker(L"TEST.bmp", &moniker2); + ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr); + + hr = IMoniker_IsEqual(moniker, moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_IsEqual(moniker, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + IMoniker_Release(moniker2); + IMoniker_Release(moniker); } static void test_item_moniker(void)
1
0
0
0
Nikolay Sivov : ole32/filemoniker: Remove helper used once.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 7c518c3bd149c480ccf6e8935178e48d6ec042e7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7c518c3bd149c480ccf6e893…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 13 10:01:25 2021 +0300 ole32/filemoniker: Remove helper used once. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/filemoniker.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index d7c2a5a5ea7..d3940a9365f 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -59,7 +59,6 @@ static inline FileMonikerImpl *impl_from_IROTData(IROTData *iface) /* Local function used by filemoniker implementation */ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName); -static HRESULT FileMonikerImpl_Destroy(FileMonikerImpl* iface); /******************************************************************************* * FileMoniker_QueryInterface @@ -116,21 +115,19 @@ FileMonikerImpl_AddRef(IMoniker* iface) return InterlockedIncrement(&This->ref); } -/****************************************************************************** - * FileMoniker_Release - */ -static ULONG WINAPI -FileMonikerImpl_Release(IMoniker* iface) +static ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) { - FileMonikerImpl *This = impl_from_IMoniker(iface); - ULONG ref; - - TRACE("(%p)\n",iface); + FileMonikerImpl *moniker = impl_from_IMoniker(iface); + ULONG ref = InterlockedDecrement(&moniker->ref); - ref = InterlockedDecrement(&This->ref); + TRACE("(%p, refcount %d)\n", iface, ref); - /* destroy the object if there are no more references to it */ - if (ref == 0) FileMonikerImpl_Destroy(This); + if (!ref) + { + if (moniker->pMarshal) IUnknown_Release(moniker->pMarshal); + HeapFree(GetProcessHeap(), 0, moniker->filePathName); + HeapFree(GetProcessHeap(), 0, moniker); + } return ref; } @@ -452,20 +449,6 @@ FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize) return S_OK; } -/****************************************************************************** - * FileMoniker_Destroy (local function) - *******************************************************************************/ -HRESULT FileMonikerImpl_Destroy(FileMonikerImpl* This) -{ - TRACE("(%p)\n",This); - - if (This->pMarshal) IUnknown_Release(This->pMarshal); - HeapFree(GetProcessHeap(),0,This->filePathName); - HeapFree(GetProcessHeap(),0,This); - - return S_OK; -} - /****************************************************************************** * FileMoniker_BindToObject */
1
0
0
0
Nikolay Sivov : ole32: Use access mask from bind context in file moniker's BindToStorage().
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: a0bb938224366cc07ce0f318ac07c0ffd12545ef URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a0bb938224366cc07ce0f318…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 13 10:01:24 2021 +0300 ole32: Use access mask from bind context in file moniker's BindToStorage(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/filemoniker.c | 46 ++++++++++++++++++-------------------- dlls/ole32/tests/moniker.c | 55 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index d8c401c8978..d7c2a5a5ea7 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -583,41 +583,37 @@ FileMonikerImpl_BindToObject(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft */ static HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, - REFIID riid, VOID** ppvObject) + REFIID riid, void **object) { - LPOLESTR filePath=0; - IStorage *pstg=0; - HRESULT res; - - TRACE("(%p,%p,%p,%s,%p)\n",iface,pbc,pmkToLeft,debugstr_guid(riid),ppvObject); - - if (pmkToLeft==NULL){ + FileMonikerImpl *moniker = impl_from_IMoniker(iface); + BIND_OPTS bind_opts; + HRESULT hr; - if (IsEqualIID(&IID_IStorage, riid)){ + TRACE("(%p,%p,%p,%s,%p)\n", iface, pbc, pmkToLeft, debugstr_guid(riid), object); - /* get the file name */ - IMoniker_GetDisplayName(iface,pbc,pmkToLeft,&filePath); - - res=StgOpenStorage(filePath,NULL,STGM_READWRITE|STGM_SHARE_DENY_WRITE,NULL,0,&pstg); + if (!pbc) + return E_INVALIDARG; - if (SUCCEEDED(res)) - *ppvObject=pstg; + bind_opts.cbStruct = sizeof(bind_opts); + hr = IBindCtx_GetBindOptions(pbc, &bind_opts); + if (FAILED(hr)) + return hr; - CoTaskMemFree(filePath); + if (!pmkToLeft) + { + if (IsEqualIID(&IID_IStorage, riid)) + { + return StgOpenStorage(moniker->filePathName, NULL, bind_opts.grfMode, NULL, 0, (IStorage **)object); } + else if ((IsEqualIID(&IID_IStream, riid)) || (IsEqualIID(&IID_ILockBytes, riid))) + return E_FAIL; else - if ( (IsEqualIID(&IID_IStream, riid)) || (IsEqualIID(&IID_ILockBytes, riid)) ) - return E_FAIL; - else - return E_NOINTERFACE; + return E_NOINTERFACE; } - else { - FIXME("(%p,%p,%p,%s,%p)\n",iface,pbc,pmkToLeft,debugstr_guid(riid),ppvObject); + FIXME("(%p,%p,%p,%s,%p)\n", iface, pbc, pmkToLeft, debugstr_guid(riid), object); - return E_NOTIMPL; - } - return res; + return E_NOTIMPL; } /****************************************************************************** diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 6be75f75c28..8d9c0678436 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -1980,7 +1980,13 @@ static void test_file_monikers(void) */ {0x20ac, 0x2020, 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, 0x10a, 0x10b, 0x10c, 0}, }; - + WCHAR filename[MAX_PATH], path[MAX_PATH]; + BIND_OPTS bind_opts; + IMoniker *moniker; + IStorage *storage; + IBindCtx *bindctx; + STATSTG statstg; + HRESULT hr; int i; trace("ACP is %u\n", GetACP()); @@ -2004,6 +2010,53 @@ static void test_file_monikers(void) test_file_moniker(wszFile[i]); } } + + /* BindToStorage() */ + GetTempPathW(MAX_PATH, path); + GetTempFileNameW(path, L"stg", 1, filename); + + hr = StgCreateStorageEx(filename, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, STGFMT_STORAGE, + 0, NULL, NULL, &IID_IStorage, (void **)&storage); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IStorage_Release(storage); + + hr = CreateFileMoniker(filename, &moniker); + ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr); + + hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IStorage, (void **)&storage); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = CreateBindCtx(0, &bindctx); + ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr); + + hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage); + ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#x.\n", hr); + + bind_opts.cbStruct = sizeof(bind_opts); + bind_opts.grfMode = STGM_READWRITE | STGM_SHARE_DENY_WRITE; + hr = IBindCtx_SetBindOptions(bindctx, &bind_opts); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage); + ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#x.\n", hr); + + bind_opts.grfMode = STGM_READ | STGM_SHARE_DENY_WRITE; + hr = IBindCtx_SetBindOptions(bindctx, &bind_opts); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + memset(&statstg, 0, sizeof(statstg)); + hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(statstg.grfMode == (STGM_READ | STGM_SHARE_DENY_WRITE), "Unexpected mode %#x.\n", statstg.grfMode); + + IStorage_Release(storage); + IBindCtx_Release(bindctx); + IMoniker_Release(moniker); + + DeleteFileW(filename); } static void test_item_moniker(void)
1
0
0
0
Jacek Caban : gdi32: Remove no longer used printer config driver entry points.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 01fdc50fa2ceb4c7fb3ea64ad412f2299c947e83 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=01fdc50fa2ceb4c7fb3ea64a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 13 13:51:22 2021 +0200 gdi32: Remove no longer used printer config driver entry points. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/dibdrv/dc.c | 4 -- dlls/gdi32/driver.c | 14 ----- dlls/gdi32/emfdrv.c | 2 - dlls/gdi32/font.c | 2 - dlls/gdi32/path.c | 2 - dlls/wineandroid.drv/init.c | 2 - dlls/winemac.drv/gdi.c | 2 - dlls/wineps.drv/driver.c | 147 -------------------------------------------- dlls/wineps.drv/init.c | 2 - dlls/wineps.drv/psdrv.h | 5 -- dlls/winex11.drv/init.c | 2 - dlls/winex11.drv/xrender.c | 2 - include/wine/gdi_driver.h | 4 +- 13 files changed, 1 insertion(+), 189 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=01fdc50fa2ceb4c7fb3e…
1
0
0
0
Jacek Caban : gdi32: Remove ordinal exports.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 689046b2162a7eaade0b6902eadb7b7396628640 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=689046b2162a7eaade0b6902…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 13 13:50:58 2021 +0200 gdi32: Remove ordinal exports. We no longer need them for our winspool and they are not present on Windows. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/driver.c | 134 -------------------------------------------------- dlls/gdi32/gdi32.spec | 7 --- 2 files changed, 141 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index d5528128089..ea857599b93 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -935,140 +935,6 @@ BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) } -/***************************************************************************** - * @ [GDI32.100] - * - * This should thunk to 16-bit and simply call the proc with the given args. - */ -INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd, - LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort ) -{ - FIXME("(%p, %p, %s, %s, %s)\n", lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort ); - return -1; -} - -/***************************************************************************** - * @ [GDI32.101] - * - * This should load the correct driver for lpszDevice and calls this driver's - * ExtDeviceModePropSheet proc. - * - * Note: The driver calls a callback routine for each property sheet page; these - * pages are supposed to be filled into the structure pointed to by lpPropSheet. - * The layout of this structure is: - * - * struct - * { - * DWORD nPages; - * DWORD unknown; - * HPROPSHEETPAGE pages[10]; - * }; - */ -INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice, - LPCSTR lpszPort, LPVOID lpPropSheet ) -{ - FIXME("(%p, %s, %s, %p)\n", hWnd, lpszDevice, lpszPort, lpPropSheet ); - return -1; -} - -/***************************************************************************** - * @ [GDI32.102] - * - * This should load the correct driver for lpszDevice and call this driver's - * ExtDeviceMode proc. - * - * FIXME: convert ExtDeviceMode to unicode in the driver interface - */ -INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd, - LPDEVMODEA lpdmOutput, LPSTR lpszDevice, - LPSTR lpszPort, LPDEVMODEA lpdmInput, - LPSTR lpszProfile, DWORD fwMode ) -{ - WCHAR deviceW[300]; - WCHAR bufW[300]; - char buf[300]; - HDC hdc; - DC *dc; - INT ret = -1; - - TRACE("(%p, %p, %s, %s, %p, %s, %d)\n", - hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode ); - - if (!lpszDevice) return -1; - if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1; - - if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1; - - if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1; - - if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1; - - if ((dc = get_dc_ptr( hdc ))) - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtDeviceMode ); - ret = physdev->funcs->pExtDeviceMode( buf, hwnd, lpdmOutput, lpszDevice, lpszPort, - lpdmInput, lpszProfile, fwMode ); - release_dc_ptr( dc ); - } - DeleteDC( hdc ); - return ret; -} - -/**************************************************************************** - * @ [GDI32.103] - * - * This should load the correct driver for lpszDevice and calls this driver's - * AdvancedSetupDialog proc. - */ -INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice, - LPDEVMODEA devin, LPDEVMODEA devout ) -{ - TRACE("(%p, %s, %p, %p)\n", hwnd, lpszDevice, devin, devout ); - return -1; -} - -/***************************************************************************** - * @ [GDI32.104] - * - * This should load the correct driver for lpszDevice and calls this driver's - * DeviceCapabilities proc. - * - * FIXME: convert DeviceCapabilities to unicode in the driver interface - */ -DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort, - WORD fwCapability, LPSTR lpszOutput, - LPDEVMODEA lpdm ) -{ - WCHAR deviceW[300]; - WCHAR bufW[300]; - char buf[300]; - HDC hdc; - DC *dc; - INT ret = -1; - - TRACE("(%s, %s, %d, %p, %p)\n", lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm ); - - if (!lpszDevice) return -1; - if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1; - - if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1; - - if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1; - - if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1; - - if ((dc = get_dc_ptr( hdc ))) - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDeviceCapabilities ); - ret = physdev->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort, - fwCapability, lpszOutput, lpdm ); - release_dc_ptr( dc ); - } - DeleteDC( hdc ); - return ret; -} - - /****************************************************************************** * NtGdiExtEscape (win32u.@) * diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 81a4dd5d1e9..6dbc8a9bf12 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -1,10 +1,3 @@ -# ordinal exports -100 stdcall @(long long str str str) GDI_CallDevInstall16 -101 stdcall @(long str str ptr) GDI_CallExtDeviceModePropSheet16 -102 stdcall @(long ptr str str ptr str long) GDI_CallExtDeviceMode16 -103 stdcall @(long str ptr ptr) GDI_CallAdvancedSetupDialog16 -104 stdcall @(str str long ptr ptr) GDI_CallDeviceCapabilities16 - @ stdcall AbortDoc(long) @ stdcall AbortPath(long) @ stdcall AddFontMemResourceEx(ptr long ptr ptr)
1
0
0
0
Jacek Caban : winspool: Use DocumentPropertiesW for DocumentPropertiesA.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 8eddb793a6f287cdaa3d9952d07e752b7755a3ca URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8eddb793a6f287cdaa3d9952…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 13 13:50:24 2021 +0200 winspool: Use DocumentPropertiesW for DocumentPropertiesA. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winspool.drv/info.c | 82 +++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index 76c83345ebb..edfdab218c4 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -198,11 +198,6 @@ static opened_printer_t **printer_handles; static UINT nb_printer_handles; static LONG next_job_id = 1; -static INT (WINAPI *GDI_CallExtDeviceMode16)( HWND hwnd, LPDEVMODEA lpdmOutput, - LPSTR lpszDevice, LPSTR lpszPort, - LPDEVMODEA lpdmInput, LPSTR lpszProfile, - DWORD fwMode ); - static const WCHAR DriversW[] = { 'S','y','s','t','e','m','\\', 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'c','o','n','t','r','o','l','\\', @@ -394,18 +389,6 @@ static LPWSTR strdupW(LPCWSTR p) return ret; } -static LPSTR strdupWtoA( LPCWSTR str ) -{ - LPSTR ret; - INT len; - - if (!str) return NULL; - len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL ); - ret = HeapAlloc( GetProcessHeap(), 0, len ); - if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); - return ret; -} - static DEVMODEW *dup_devmode( const DEVMODEW *dm ) { DEVMODEW *ret; @@ -2513,46 +2496,47 @@ INT WINAPI DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort, /****************************************************************** * DocumentPropertiesA [WINSPOOL.@] - * - * FIXME: implement DocumentPropertiesA via DocumentPropertiesW, not vice versa */ -LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter, - LPSTR pDeviceName, LPDEVMODEA pDevModeOutput, - LPDEVMODEA pDevModeInput,DWORD fMode ) +LONG WINAPI DocumentPropertiesA(HWND hwnd, HANDLE printer, char *device_name, DEVMODEA *output, + DEVMODEA *input, DWORD mode) { - LPSTR lpName = pDeviceName, dupname = NULL; - static CHAR port[] = "LPT1:"; - LONG ret; + DEVMODEW *outputW = NULL, *inputW = NULL; + WCHAR *device = NULL; + unsigned int len; + int ret; - TRACE("(%p,%p,%s,%p,%p,%d)\n", - hWnd,hPrinter,pDeviceName,pDevModeOutput,pDevModeInput,fMode - ); + TRACE("(%p,%p,%s,%p,%p,%d)\n", hwnd, printer, debugstr_a(device_name), output, input, mode); - if(!pDeviceName || !*pDeviceName) { - LPCWSTR lpNameW = get_opened_printer_name(hPrinter); - if(!lpNameW) { - ERR("no name from hPrinter?\n"); - SetLastError(ERROR_INVALID_HANDLE); - return -1; - } - lpName = dupname = strdupWtoA(lpNameW); + len = MultiByteToWideChar(CP_ACP, 0, device_name, -1, NULL, 0); + if (len) { + device = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, device_name, -1, device, len); } - if (!GDI_CallExtDeviceMode16) - { - GDI_CallExtDeviceMode16 = (void*)GetProcAddress( GetModuleHandleA("gdi32"), - (LPCSTR)102 ); - if (!GDI_CallExtDeviceMode16) { - ERR("No CallExtDeviceMode16?\n"); - ret = -1; - goto end; - } + if (output && (mode & (DM_COPY | DM_UPDATE))) { + ret = DocumentPropertiesW(hwnd, printer, device, NULL, NULL, 0); + if (ret <= 0) { + HeapFree(GetProcessHeap(), 0, device); + return -1; + } + outputW = HeapAlloc(GetProcessHeap(), 0, ret); } - ret = GDI_CallExtDeviceMode16(hWnd, pDevModeOutput, lpName, port, - pDevModeInput, NULL, fMode); -end: - HeapFree(GetProcessHeap(), 0, dupname); + if (input) inputW = GdiConvertToDevmodeW(input); + + ret = DocumentPropertiesW(hwnd, printer, device, outputW, inputW, mode); + + if (ret >= 0 && outputW && (mode & (DM_COPY | DM_UPDATE))) { + DEVMODEA *dmA = DEVMODEdupWtoA( outputW ); + if (dmA) memcpy(output, dmA, dmA->dmSize + dmA->dmDriverExtra); + HeapFree(GetProcessHeap(), 0, dmA); + } + + HeapFree(GetProcessHeap(), 0, device); + HeapFree(GetProcessHeap(), 0, inputW); + HeapFree(GetProcessHeap(), 0, outputW); + + if (!mode && ret > 0) ret -= CCHDEVICENAME + CCHFORMNAME; return ret; }
1
0
0
0
Jacek Caban : winspool: Use configuration file for DocumentPropertiesW.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 68feb134af0538d7fc589c2ddb6403de9cea1055 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=68feb134af0538d7fc589c2d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 13 13:50:08 2021 +0200 winspool: Use configuration file for DocumentPropertiesW. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winspool.drv/info.c | 77 +++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 54 deletions(-) diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index d7f2b7fb7d1..76c83345ebb 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -187,6 +187,7 @@ typedef struct /* entry points */ DWORD (WINAPI *pDrvDeviceCapabilities)(HANDLE, const WCHAR *, WORD, void *, const DEVMODEW *); + INT (WINAPI *pDrvDocumentProperties)(HWND, const WCHAR *, DEVMODEW *, DEVMODEW *, DWORD); WCHAR name[1]; } config_module_t; @@ -623,6 +624,7 @@ static config_module_t *get_config_module(const WCHAR *device, BOOL grab) ret->ref = 2; /* one for config_module and one for the caller */ ret->module = driver_module; ret->pDrvDeviceCapabilities = (void *)GetProcAddress(driver_module, "DrvDeviceCapabilities"); + ret->pDrvDocumentProperties = (void *)GetProcAddress(driver_module, "DrvDocumentProperties"); lstrcpyW(ret->name, device); wine_rb_put(&config_modules, ret->name, &ret->entry); @@ -1878,36 +1880,6 @@ static job_t *get_job(HANDLE hprn, DWORD JobId) return NULL; } -/*********************************************************** - * DEVMODEcpyAtoW - */ -static LPDEVMODEW DEVMODEcpyAtoW(DEVMODEW *dmW, const DEVMODEA *dmA) -{ - BOOL Formname; - ptrdiff_t off_formname = (const char *)dmA->dmFormName - (const char *)dmA; - DWORD size; - - Formname = (dmA->dmSize > off_formname); - size = dmA->dmSize + CCHDEVICENAME + (Formname ? CCHFORMNAME : 0); - MultiByteToWideChar(CP_ACP, 0, (LPCSTR)dmA->dmDeviceName, -1, - dmW->dmDeviceName, CCHDEVICENAME); - if(!Formname) { - memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, - dmA->dmSize - CCHDEVICENAME); - } else { - memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, - off_formname - CCHDEVICENAME); - MultiByteToWideChar(CP_ACP, 0, (LPCSTR)dmA->dmFormName, -1, - dmW->dmFormName, CCHFORMNAME); - memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - - (off_formname + CCHFORMNAME)); - } - dmW->dmSize = size; - memcpy((char *)dmW + dmW->dmSize, (const char *)dmA + dmA->dmSize, - dmA->dmDriverExtra); - return dmW; -} - /****************************************************************** * convert_printerinfo_W_to_A [internal] * @@ -2587,39 +2559,36 @@ end: /***************************************************************************** * DocumentPropertiesW (WINSPOOL.@) - * - * FIXME: implement DocumentPropertiesA via DocumentPropertiesW, not vice versa */ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, LPDEVMODEW pDevModeOutput, LPDEVMODEW pDevModeInput, DWORD fMode) { - - LPSTR pDeviceNameA = strdupWtoA(pDeviceName); - LPDEVMODEA pDevModeInputA; - LPDEVMODEA pDevModeOutputA = NULL; + config_module_t *config = NULL; + const WCHAR *device = NULL; LONG ret; TRACE("(%p,%p,%s,%p,%p,%d)\n", - hWnd,hPrinter,debugstr_w(pDeviceName),pDevModeOutput,pDevModeInput, - fMode); - if(pDevModeOutput) { - ret = DocumentPropertiesA(hWnd, hPrinter, pDeviceNameA, NULL, NULL, 0); - if(ret < 0) return ret; - pDevModeOutputA = HeapAlloc(GetProcessHeap(), 0, ret); - } - pDevModeInputA = (fMode & DM_IN_BUFFER) ? DEVMODEdupWtoA(pDevModeInput) : NULL; - ret = DocumentPropertiesA(hWnd, hPrinter, pDeviceNameA, pDevModeOutputA, - pDevModeInputA, fMode); - if(pDevModeOutput) { - DEVMODEcpyAtoW(pDevModeOutput, pDevModeOutputA); - HeapFree(GetProcessHeap(),0,pDevModeOutputA); - } - if(fMode == 0 && ret > 0) - ret += (CCHDEVICENAME + CCHFORMNAME); - HeapFree(GetProcessHeap(),0,pDevModeInputA); - HeapFree(GetProcessHeap(),0,pDeviceNameA); + hWnd, hPrinter, debugstr_w(pDeviceName), pDevModeOutput, pDevModeInput, fMode); + + device = pDeviceName && pDeviceName[0] ? pDeviceName : get_opened_printer_name(hPrinter); + if (!device) { + ERR("no device name\n"); + return -1; + } + + config = get_config_module(device, TRUE); + if (!config) { + ERR("Could not load config module for %s\n", debugstr_w(device)); + return -1; + } + + /* FIXME: This uses Wine-specific config file entry point. + * We should use DrvDevicePropertySheets instead (requires CPSUI support first). + */ + ret = config->pDrvDocumentProperties(hWnd, device, pDevModeOutput, pDevModeInput, fMode); + release_config_module(config); return ret; }
1
0
0
0
Jacek Caban : wineps: Introduce DrvDocumentProperties entry point.
by Alexandre Julliard
13 Sep '21
13 Sep '21
Module: wine Branch: master Commit: 0da3ffc4b941ec35e08b93ceb2981c1d42723a4f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0da3ffc4b941ec35e08b93ce…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 13 13:49:44 2021 +0200 wineps: Introduce DrvDocumentProperties entry point. This is not compatible with native. We should use DrvDevicePropertySheets instead, but that requires support for CPSUI support first. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineps.drv/driver.c | 116 +++++++++++++++++++++------------------- dlls/wineps.drv/wineps.drv.spec | 1 + 2 files changed, 62 insertions(+), 55 deletions(-) diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c index c4dcd405c26..18ede3d028d 100644 --- a/dlls/wineps.drv/driver.c +++ b/dlls/wineps.drv/driver.c @@ -435,19 +435,6 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPage) (LPCPROPSHEETPAGEW); static int (WINAPI *pPropertySheet) (LPCPROPSHEETHEADERW); -static PRINTERINFO *PSDRV_FindPrinterInfoA(LPCSTR name) -{ - int len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 ); - WCHAR *nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - PRINTERINFO *pi; - - MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len ); - pi = PSDRV_FindPrinterInfo( nameW ); - HeapFree( GetProcessHeap(), 0, nameW ); - - return pi; -} - /*********************************************************** * DEVMODEdupWtoA * @@ -489,27 +476,12 @@ static DEVMODEA *DEVMODEdupWtoA( const DEVMODEW *dmW ) return dmA; } - /****************************************************************** - * PSDRV_ExtDeviceMode +/****************************************************************************** + * DrvDocumentProperties (wineps.drv.@) * * Retrieves or modifies device-initialization information for the PostScript * driver, or displays a driver-supplied dialog box for configuring the driver. * - * PARAMETERS - * lpszDriver -- Driver name - * hwnd -- Parent window for the dialog box - * lpdmOutput -- Address of a DEVMODE structure for writing initialization information - * lpszDevice -- Device name - * lpszPort -- Port name - * lpdmInput -- Address of a DEVMODE structure for reading initialization information - * lpProfile -- Name of initialization file, defaults to WIN.INI if NULL - * wMode -- Operation to perform. Can be a combination if > 0. - * (0) -- Returns number of bytes required by DEVMODE structure - * DM_UPDATE (1) -- Write current settings to environment and initialization file - * DM_COPY (2) -- Write current settings to lpdmOutput - * DM_PROMPT (4) -- Presents the driver's modal dialog box (USER.240) - * DM_MODIFY (8) -- Changes current settings according to lpdmInput before any other operation - * * RETURNS * Returns size of DEVMODE structure if wMode is 0. Otherwise, IDOK is returned for success * for both dialog and non-dialog operations. IDCANCEL is returned if the dialog box was cancelled. @@ -519,31 +491,29 @@ static DEVMODEA *DEVMODEdupWtoA( const DEVMODEW *dmW ) * * Just returns default devmode at the moment. No use of initialization file. */ -INT CDECL PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput, - LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput, - LPSTR lpszProfile, DWORD dwMode) +INT WINAPI DrvDocumentProperties(HWND hwnd, const WCHAR *device, DEVMODEW *output, + DEVMODEW *input, DWORD mode) { - PRINTERINFO *pi = PSDRV_FindPrinterInfoA(lpszDevice); - if(!pi) return -1; + PRINTERINFO *pi; + + TRACE("(hwnd=%p, Device='%s', devOut=%p, devIn=%p, Mode=%04x)\n", + hwnd, debugstr_w(device), output, input, mode); - TRACE("(Driver=%s, hwnd=%p, devOut=%p, Device='%s', Port='%s', devIn=%p, Profile='%s', Mode=%04x)\n", - lpszDriver, hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, debugstr_a(lpszProfile), dwMode); + if (!(pi = PSDRV_FindPrinterInfo(device))) return -1; - /* If dwMode == 0, return size of DEVMODE structure */ - if(!dwMode) - return pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra - CCHDEVICENAME - CCHFORMNAME; + /* If mode == 0, return size of DEVMODE structure */ + if (!mode) + return pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra; /* If DM_MODIFY is set, change settings in accordance with lpdmInput */ - if((dwMode & DM_MODIFY) && lpdmInput) + if ((mode & DM_MODIFY) && input) { - DEVMODEW *dmW = GdiConvertToDevmodeW( lpdmInput ); - TRACE("DM_MODIFY set. devIn->dmFields = %08x\n", lpdmInput->dmFields); - if (dmW) PSDRV_MergeDevmodes(pi->Devmode, (PSDRV_DEVMODE *)dmW, pi); - HeapFree( GetProcessHeap(), 0, dmW ); + TRACE("DM_MODIFY set. devIn->dmFields = %08x\n", input->dmFields); + PSDRV_MergeDevmodes(pi->Devmode, (PSDRV_DEVMODE *)input, pi); } /* If DM_PROMPT is set, present modal dialog box */ - if(dwMode & DM_PROMPT) { + if (mode & DM_PROMPT) { HINSTANCE hinstComctl32; HPROPSHEETPAGE hpsp[1]; PROPSHEETPAGEW psp; @@ -581,22 +551,58 @@ INT CDECL PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput } /* If DM_UPDATE is set, should write settings to environment and initialization file */ - if(dwMode & DM_UPDATE) + if (mode & DM_UPDATE) FIXME("Mode DM_UPDATE. Just do the same as DM_COPY\n"); /* If DM_COPY is set, should write settings to lpdmOutput */ - if((dwMode & DM_COPY) || (dwMode & DM_UPDATE)) { - if (lpdmOutput) - { - DEVMODEA *dmA = DEVMODEdupWtoA( &pi->Devmode->dmPublic ); + if (output && (mode & (DM_COPY | DM_UPDATE))) + memcpy( output, &pi->Devmode->dmPublic, + pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra ); + return IDOK; +} + +INT CDECL PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput, + LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput, + LPSTR lpszProfile, DWORD dwMode) +{ + DEVMODEW *outputW = NULL, *inputW = NULL; + WCHAR *device = NULL; + unsigned int len; + int ret; + + len = MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, NULL, 0); + if (len) { + device = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, device, len); + } + + if (lpdmOutput && (dwMode & (DM_COPY | DM_UPDATE))) { + ret = DrvDocumentProperties(hwnd, device, NULL, NULL, 0); + if (ret <= 0) { + HeapFree(GetProcessHeap(), 0, device); + return -1; + } + outputW = HeapAlloc(GetProcessHeap(), 0, ret); + } + + if (lpdmInput) inputW = GdiConvertToDevmodeW( lpdmInput ); + + ret = DrvDocumentProperties(hwnd, device, outputW, inputW, dwMode); + + if (ret >= 0 && outputW && (dwMode & (DM_COPY | DM_UPDATE))) { + DEVMODEA *dmA = DEVMODEdupWtoA( outputW ); if (dmA) memcpy( lpdmOutput, dmA, dmA->dmSize + dmA->dmDriverExtra ); HeapFree( GetProcessHeap(), 0, dmA ); } - else - FIXME("lpdmOutput is NULL what should we do??\n"); - } - return IDOK; + + HeapFree(GetProcessHeap(), 0, device); + HeapFree(GetProcessHeap(), 0, inputW); + HeapFree(GetProcessHeap(), 0, outputW); + + if (!dwMode && ret > 0) ret -= CCHDEVICENAME + CCHFORMNAME; + return ret; } + /*********************************************************************** * PSDRV_DeviceCapabilities * diff --git a/dlls/wineps.drv/wineps.drv.spec b/dlls/wineps.drv/wineps.drv.spec index 6cd7e680350..4dbdc0a2998 100644 --- a/dlls/wineps.drv/wineps.drv.spec +++ b/dlls/wineps.drv/wineps.drv.spec @@ -2,3 +2,4 @@ # Printer driver config exports @ stdcall DrvDeviceCapabilities(ptr wstr long ptr ptr) +@ stdcall DrvDocumentProperties(long ptr wstr ptr long)
1
0
0
0
← Newer
1
...
67
68
69
70
71
72
73
...
103
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
Results per page:
10
25
50
100
200