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
March 2019
----- 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
1097 discussions
Start a n
N
ew thread
Michael Stefaniuc : d3dx9: Use get_version_counter_ptr() instead of open coding it.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 9438d031277cce1a1c21e0739e12d4c37f365467 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9438d031277cce1a1c21e073…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Wed Mar 20 17:46:29 2019 +0100 d3dx9: Use get_version_counter_ptr() instead of open coding it. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/effect.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 30a60f4..17d97bb 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -6077,9 +6077,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U { if (FAILED(hr = d3dx_pool_sync_shared_parameter(base->pool, &base->parameters[i]))) goto err_out; - base->parameters[i].version_counter = base->pool - ? &base->pool->version_counter - : &base->version_counter; + base->parameters[i].version_counter = get_version_counter_ptr(effect); set_dirty(&base->parameters[i].param); } return D3D_OK;
1
0
0
0
Michael Stefaniuc : d3dx9: Move technique_count out of struct d3dx9_base_effect.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 074e3232ee90c94f9a8e7c55988b29b40e1e3f0f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=074e3232ee90c94f9a8e7c55…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Wed Mar 20 17:46:28 2019 +0100 d3dx9: Move technique_count out of struct d3dx9_base_effect. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/effect.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index d2af2d5..30a60f4 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -152,8 +152,6 @@ struct d3dx9_base_effect { struct d3dx_effect *effect; - UINT technique_count; - struct d3dx_top_level_parameter *parameters; struct d3dx_technique *techniques; @@ -170,6 +168,7 @@ struct d3dx_effect struct d3dx9_base_effect base_effect; unsigned int parameter_count; + unsigned int technique_count; unsigned int object_count; struct d3dx_object *objects; struct wine_rb_tree param_tree; @@ -459,7 +458,7 @@ static struct d3dx_technique *get_technique_by_name(struct d3dx_effect *effect, if (!name) return NULL; - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) { if (!strcmp(base->techniques[i].name, name)) return &base->techniques[i]; @@ -473,7 +472,7 @@ static struct d3dx_technique *get_valid_technique(struct d3dx_effect *effect, D3 struct d3dx9_base_effect *base = &effect->base_effect; unsigned int i; - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) { if (get_technique_handle(&base->techniques[i]) == technique) return &base->techniques[i]; @@ -487,7 +486,7 @@ static struct d3dx_pass *get_valid_pass(struct d3dx_effect *effect, D3DXHANDLE p struct d3dx9_base_effect *base = &effect->base_effect; unsigned int i, k; - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) { struct d3dx_technique *technique = &base->techniques[i]; @@ -701,7 +700,7 @@ static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect) if (base->techniques) { - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) free_technique(&base->techniques[i]); HeapFree(GetProcessHeap(), 0, base->techniques); base->techniques = NULL; @@ -1859,7 +1858,7 @@ static HRESULT WINAPI d3dx_effect_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *d desc->Creator = NULL; desc->Functions = 0; desc->Parameters = effect->parameter_count; - desc->Techniques = effect->base_effect.technique_count; + desc->Techniques = effect->technique_count; return D3D_OK; } @@ -2122,7 +2121,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetTechnique(ID3DXEffect *iface, UINT index TRACE("iface %p, index %u.\n", iface, index); - if (index >= effect->base_effect.technique_count) + if (index >= effect->technique_count) { WARN("Invalid argument specified.\n"); return NULL; @@ -3659,7 +3658,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D if (!(prev_tech = get_valid_technique(effect, technique))) return D3DERR_INVALIDCALL; - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) { tech = &base->techniques[i]; if (tech == prev_tech) @@ -3674,7 +3673,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D i = 0; } - for (; i < base->technique_count; ++i) + for (; i < effect->technique_count; ++i) { tech = &base->techniques[i]; if (SUCCEEDED(d3dx_effect_ValidateTechnique(iface, get_technique_handle(tech)))) @@ -5837,9 +5836,10 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, struct d3dx_technique *technique; struct d3dx_pass *pass; - if (technique_index >= base->technique_count) + if (technique_index >= effect->technique_count) { - FIXME("Index out of bounds: technique_index %u >= technique_count %u\n", technique_index, base->technique_count); + FIXME("Index out of bounds: technique_index %u >= technique_count %u.\n", technique_index, + effect->technique_count); return E_FAIL; } @@ -5972,8 +5972,8 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U read_dword(&ptr, &effect->parameter_count); TRACE("Parameter count: %u.\n", effect->parameter_count); - read_dword(&ptr, &base->technique_count); - TRACE("Technique count: %u.\n", base->technique_count); + read_dword(&ptr, &effect->technique_count); + TRACE("Technique count: %u.\n", effect->technique_count); skip_dword_unknown(&ptr, 1); @@ -6016,10 +6016,9 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U } } - if (base->technique_count) + if (effect->technique_count) { - base->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(*base->techniques) * base->technique_count); + base->techniques = heap_alloc_zero(sizeof(*base->techniques) * effect->technique_count); if (!base->techniques) { ERR("Out of memory.\n"); @@ -6027,7 +6026,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U goto err_out; } - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) { TRACE("Parsing technique %u.\n", i); hr = d3dx_parse_effect_technique(effect, &base->techniques[i], data, &ptr, effect->objects); @@ -6089,7 +6088,7 @@ err_out: if (base->techniques) { - for (i = 0; i < base->technique_count; ++i) + for (i = 0; i < effect->technique_count; ++i) free_technique(&base->techniques[i]); HeapFree(GetProcessHeap(), 0, base->techniques); base->techniques = NULL; @@ -6292,7 +6291,7 @@ static HRESULT d3dx9_base_effect_init(struct d3dx_effect *effect, const char *da param = get_parameter_by_name(effect, NULL, skip_constants[i]); if (param) { - for (j = 0; j < base->technique_count; ++j) + for (j = 0; j < effect->technique_count; ++j) { if (is_parameter_used(param, &base->techniques[j])) {
1
0
0
0
Michael Stefaniuc : d3dx9: Pass a struct d3dx_effect to d3dx9_create_object().
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 92d2f6d99429df4b5f132eca2fa8a2c1eae4a6d0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=92d2f6d99429df4b5f132eca…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Wed Mar 20 17:46:27 2019 +0100 d3dx9: Pass a struct d3dx_effect to d3dx9_create_object(). Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/effect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index b8fb904..d2af2d5 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -5674,10 +5674,10 @@ err_out: return hr; } -static HRESULT d3dx9_create_object(struct d3dx9_base_effect *base, struct d3dx_object *object) +static HRESULT d3dx9_create_object(struct d3dx_effect *effect, struct d3dx_object *object) { struct d3dx_parameter *param = object->param; - struct IDirect3DDevice9 *device = base->effect->device; + IDirect3DDevice9 *device = effect->device; HRESULT hr; if (*(char **)param->data) @@ -5880,7 +5880,7 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, if (object->data) { - if (FAILED(hr = d3dx9_create_object(base, object))) + if (FAILED(hr = d3dx9_create_object(effect, object))) return hr; if (FAILED(hr = d3dx_create_param_eval(effect, object->data, object->size, param->type, ¶m->param_eval, get_version_counter_ptr(effect), @@ -6057,7 +6057,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U if (effect->objects[id].data) { - if (FAILED(hr = d3dx9_create_object(base, &effect->objects[id]))) + if (FAILED(hr = d3dx9_create_object(effect, &effect->objects[id]))) goto err_out; } }
1
0
0
0
Michael Stefaniuc : d3dx9: Don' t pass a struct d3dx9_base_effect to d3dx9_base_effect_init().
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: de59a1297111dfd0be93dccaa2db31865c61b79a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=de59a1297111dfd0be93dcca…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Wed Mar 20 17:46:26 2019 +0100 d3dx9: Don't pass a struct d3dx9_base_effect to d3dx9_base_effect_init(). Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/effect.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 1379c26..b8fb904 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -6173,11 +6173,11 @@ static const char **parse_skip_constants_string(char *skip_constants_string, uns return new_alloc; } -static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, - const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, - UINT eflags, ID3DBlob **errors, struct d3dx_effect *effect, struct d3dx_effect_pool *pool, - const char *skip_constants_string) +static HRESULT d3dx9_base_effect_init(struct d3dx_effect *effect, const char *data, SIZE_T data_size, + const D3D_SHADER_MACRO *defines, ID3DInclude *include, unsigned int eflags, ID3DBlob **errors, + struct d3dx_effect_pool *pool, const char *skip_constants_string) { + struct d3dx9_base_effect *base = &effect->base_effect; DWORD tag, offset; const char *ptr = data; HRESULT hr; @@ -6192,9 +6192,9 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, #endif unsigned int i, j; - TRACE("base %p, data %p, data_size %lu, defines %p, include %p, eflags %#x, errors %p, " - "effect %p, pool %p, skip_constants %s.\n", - base, data, data_size, defines, include, eflags, errors, effect, pool, + TRACE("effect %p, data %p, data_size %lu, defines %p, include %p, eflags %#x, errors %p, " + "pool %p, skip_constants %s.\n", + effect, data, data_size, defines, include, eflags, errors, pool, debugstr_a(skip_constants_string)); base->effect = effect; @@ -6339,8 +6339,8 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev IDirect3DDevice9_AddRef(device); effect->device = device; - if (FAILED(hr = d3dx9_base_effect_init(&effect->base_effect, data, data_size, defines, include, - eflags, error_messages, effect, pool_impl, skip_constants))) + if (FAILED(hr = d3dx9_base_effect_init(effect, data, data_size, defines, include, eflags, + error_messages, pool_impl, skip_constants))) { FIXME("Failed to parse effect, hr %#x.\n", hr); free_effect(effect);
1
0
0
0
Zhiyi Zhang : winebus.sys: Handle create existent device failure.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: f4d5b357d3a240bd80d14a4c11ab32b0a4e5d3b9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f4d5b357d3a240bd80d14a4c…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Wed Mar 20 23:28:15 2019 +0800 winebus.sys: Handle create existent device failure. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index fd68833..f9675b3 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -207,6 +207,8 @@ DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW, UNICODE_STRING nameW; WCHAR dev_name[256]; HDEVINFO devinfo; + SP_DEVINFO_DATA data = {sizeof(data)}; + WCHAR *instance = NULL; NTSTATUS status; DWORD length; @@ -258,26 +260,31 @@ DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW, LeaveCriticalSection(&device_list_cs); - devinfo = SetupDiGetClassDevsW(class, NULL, NULL, DIGCF_DEVICEINTERFACE); - if (devinfo) + devinfo = SetupDiCreateDeviceInfoList(class, NULL); + if (devinfo == INVALID_HANDLE_VALUE) { - SP_DEVINFO_DATA data; - WCHAR *instance; - - data.cbSize = sizeof(data); - if (!(instance = get_instance_id(device))) - ERR("failed to generate instance id\n"); - else if (!SetupDiCreateDeviceInfoW(devinfo, instance, class, NULL, NULL, DICD_INHERIT_CLASSDRVS, &data)) - ERR("failed to create device info: %x\n", GetLastError()); - else if (!SetupDiRegisterDeviceInfo(devinfo, &data, 0, NULL, NULL, NULL)) - ERR("failed to register device info: %x\n", GetLastError()); - - HeapFree(GetProcessHeap(), 0, instance); - SetupDiDestroyDeviceInfoList(devinfo); + ERR("failed to create device info list, error %#x\n", GetLastError()); + goto error; } - else - ERR("failed to get ClassDevs: %x\n", GetLastError()); + instance = get_instance_id(device); + if (!instance) + { + ERR("failed to generate instance id\n"); + goto error; + } + + if (SetupDiCreateDeviceInfoW(devinfo, instance, class, NULL, NULL, DICD_INHERIT_CLASSDRVS, &data)) + { + if (!SetupDiRegisterDeviceInfo(devinfo, &data, 0, NULL, NULL, NULL)) + ERR("failed to register device info, error %#x\n", GetLastError()); + } + else if (GetLastError() != ERROR_DEVINST_ALREADY_EXISTS) + ERR("failed to create device info, error %#x\n", GetLastError()); + +error: + HeapFree(GetProcessHeap(), 0, instance); + SetupDiDestroyDeviceInfoList(devinfo); return device; }
1
0
0
0
Zhiyi Zhang : hidclass.sys: Handle create existent device failure.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 56b509a84a26576e4dbfe95b076e5463f2496b6f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=56b509a84a26576e4dbfe95b…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Wed Mar 20 23:27:41 2019 +0800 hidclass.sys: Handle create existent device failure. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hidclass.sys/device.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 547c355..81d5c3c 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -90,26 +90,24 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device) RtlInitUnicodeString( &nameW, ext->device_name); - devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_HIDCLASS, NULL, NULL, DIGCF_DEVICEINTERFACE); - if (!devinfo) + devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_HIDCLASS, NULL); + if (devinfo == INVALID_HANDLE_VALUE) { FIXME( "failed to get ClassDevs %x\n", GetLastError()); return STATUS_UNSUCCESSFUL; } Data.cbSize = sizeof(Data); - if (!SetupDiCreateDeviceInfoW(devinfo, ext->instance_id, &GUID_DEVCLASS_HIDCLASS, NULL, NULL, DICD_INHERIT_CLASSDRVS, &Data)) + if (SetupDiCreateDeviceInfoW(devinfo, ext->instance_id, &GUID_DEVCLASS_HIDCLASS, NULL, NULL, DICD_INHERIT_CLASSDRVS, &Data)) { - if (GetLastError() == ERROR_DEVINST_ALREADY_EXISTS) + if (!SetupDiRegisterDeviceInfo(devinfo, &Data, 0, NULL, NULL, NULL)) { - SetupDiDestroyDeviceInfoList(devinfo); - return STATUS_SUCCESS; + FIXME( "failed to register device info %x\n", GetLastError()); + goto error; } - FIXME( "failed to Create Device Info %x\n", GetLastError()); - goto error; } - if (!SetupDiRegisterDeviceInfo( devinfo, &Data, 0, NULL, NULL, NULL )) + else if (GetLastError() != ERROR_DEVINST_ALREADY_EXISTS) { - FIXME( "failed to Register Device Info %x\n", GetLastError()); + FIXME( "failed to create device info %x\n", GetLastError()); goto error; } SetupDiDestroyDeviceInfoList(devinfo);
1
0
0
0
Józef Kucia : d3d12: Add support for building with Win32 Vulkan.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 682292f0f7bc1c257374de9b37da5bfbca2fe93e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=682292f0f7bc1c257374de9b…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Mar 21 13:12:41 2019 +0100 d3d12: Add support for building with Win32 Vulkan. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d12/d3d12_main.c | 73 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/dlls/d3d12/d3d12_main.c b/dlls/d3d12/d3d12_main.c index 2c6472a..8a199aa 100644 --- a/dlls/d3d12/d3d12_main.c +++ b/dlls/d3d12/d3d12_main.c @@ -24,7 +24,9 @@ #define VK_NO_PROTOTYPES #define VKD3D_NO_VULKAN_H #define VKD3D_NO_WIN32_TYPES +#ifndef USE_WIN32_VULKAN #define WINE_VK_HOST +#endif #include "wine/debug.h" #include "wine/heap.h" @@ -43,6 +45,34 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d12); WINE_DECLARE_DEBUG_CHANNEL(winediag); +#ifdef USE_WIN32_VULKAN + +/* FIXME: We should unload vulkan-1.dll. */ +static PFN_vkGetInstanceProcAddr load_vulkan(void) +{ + HMODULE vulkan = LoadLibraryA("vulkan-1.dll"); + return (void *)GetProcAddress(vulkan, "vkGetInstanceProcAddr"); +} + +#else + +static PFN_vkGetInstanceProcAddr load_vulkan(void) +{ + const struct vulkan_funcs *vk_funcs; + HDC hdc; + + hdc = GetDC(0); + vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); + ReleaseDC(0, hdc); + + if (vk_funcs) + return (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr; + + return NULL; +} + +#endif /* USE_WIN32_VULKAN */ + HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug) { TRACE("iid %s, debug %p.\n", debugstr_guid(iid), debug); @@ -111,17 +141,6 @@ static HRESULT d3d12_join_thread(void *handle) return ret == WAIT_OBJECT_0 ? S_OK : E_FAIL; } -static const struct vulkan_funcs *get_vk_funcs(void) -{ - const struct vulkan_funcs *vk_funcs; - HDC hdc; - - hdc = GetDC(0); - vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); - ReleaseDC(0, hdc); - return vk_funcs; -} - static HRESULT d3d12_get_adapter(IWineDXGIAdapter **wine_adapter, IUnknown *adapter) { IDXGIAdapter *dxgi_adapter = NULL; @@ -157,20 +176,25 @@ done: return hr; } -static BOOL check_vk_instance_extension(const struct vulkan_funcs *vk_funcs, const char *name) +static BOOL check_vk_instance_extension(VkInstance vk_instance, + PFN_vkGetInstanceProcAddr pfn_vkGetInstanceProcAddr, const char *name) { + PFN_vkEnumerateInstanceExtensionProperties pfn_vkEnumerateInstanceExtensionProperties; VkExtensionProperties *properties; BOOL ret = FALSE; unsigned int i; uint32_t count; - if (vk_funcs->p_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL) < 0) + pfn_vkEnumerateInstanceExtensionProperties + = (void *)pfn_vkGetInstanceProcAddr(vk_instance, "vkEnumerateInstanceExtensionProperties"); + + if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL) < 0) return FALSE; if (!(properties = heap_calloc(count, sizeof(*properties)))) return FALSE; - if (vk_funcs->p_vkEnumerateInstanceExtensionProperties(NULL, &count, properties) >= 0) + if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, properties) >= 0) { for (i = 0; i < count; ++i) { @@ -187,7 +211,7 @@ static BOOL check_vk_instance_extension(const struct vulkan_funcs *vk_funcs, con } static VkPhysicalDevice d3d12_get_vk_physical_device(struct vkd3d_instance *instance, - const struct vulkan_funcs *vk_funcs, const struct wine_dxgi_adapter_info *adapter_info) + PFN_vkGetInstanceProcAddr pfn_vkGetInstanceProcAddr, const struct wine_dxgi_adapter_info *adapter_info) { PFN_vkGetPhysicalDeviceProperties2 pfn_vkGetPhysicalDeviceProperties2 = NULL; PFN_vkGetPhysicalDeviceProperties pfn_vkGetPhysicalDeviceProperties; @@ -204,11 +228,11 @@ static VkPhysicalDevice d3d12_get_vk_physical_device(struct vkd3d_instance *inst vk_instance = vkd3d_instance_get_vk_instance(instance); - pfn_vkEnumeratePhysicalDevices = vk_funcs->p_vkGetInstanceProcAddr(vk_instance, "vkEnumeratePhysicalDevices"); + pfn_vkEnumeratePhysicalDevices = (void *)pfn_vkGetInstanceProcAddr(vk_instance, "vkEnumeratePhysicalDevices"); - pfn_vkGetPhysicalDeviceProperties = vk_funcs->p_vkGetInstanceProcAddr(vk_instance, "vkGetPhysicalDeviceProperties"); - if (check_vk_instance_extension(vk_funcs, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) - pfn_vkGetPhysicalDeviceProperties2 = vk_funcs->p_vkGetInstanceProcAddr(vk_instance, "vkGetPhysicalDeviceProperties2KHR"); + pfn_vkGetPhysicalDeviceProperties = (void *)pfn_vkGetInstanceProcAddr(vk_instance, "vkGetPhysicalDeviceProperties"); + if (check_vk_instance_extension(vk_instance, pfn_vkGetInstanceProcAddr, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) + pfn_vkGetPhysicalDeviceProperties2 = (void *)pfn_vkGetInstanceProcAddr(vk_instance, "vkGetPhysicalDeviceProperties2KHR"); if ((vr = pfn_vkEnumeratePhysicalDevices(vk_instance, &count, NULL)) < 0) { @@ -279,9 +303,9 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe { struct vkd3d_optional_instance_extensions_info optional_extensions_info; struct vkd3d_instance_create_info instance_create_info; + PFN_vkGetInstanceProcAddr pfn_vkGetInstanceProcAddr; struct vkd3d_device_create_info device_create_info; struct wine_dxgi_adapter_info adapter_info; - const struct vulkan_funcs *vk_funcs; struct vkd3d_instance *instance; IWineDXGIAdapter *wine_adapter; HRESULT hr; @@ -303,9 +327,9 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe TRACE("adapter %p, minimum_feature_level %#x, iid %s, device %p.\n", adapter, minimum_feature_level, debugstr_guid(iid), device); - if (!(vk_funcs = get_vk_funcs())) + if (!(pfn_vkGetInstanceProcAddr = load_vulkan())) { - ERR_(winediag)("Failed to load Wine Vulkan driver.\n"); + ERR_(winediag)("Failed to load Vulkan library.\n"); return E_FAIL; } @@ -329,8 +353,7 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe instance_create_info.pfn_create_thread = d3d12_create_thread; instance_create_info.pfn_join_thread = d3d12_join_thread; instance_create_info.wchar_size = sizeof(WCHAR); - instance_create_info.pfn_vkGetInstanceProcAddr - = (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr; + instance_create_info.pfn_vkGetInstanceProcAddr = pfn_vkGetInstanceProcAddr; instance_create_info.instance_extensions = instance_extensions; instance_create_info.instance_extension_count = ARRAY_SIZE(instance_extensions); @@ -345,7 +368,7 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe device_create_info.minimum_feature_level = minimum_feature_level; device_create_info.instance = instance; device_create_info.instance_create_info = NULL; - device_create_info.vk_physical_device = d3d12_get_vk_physical_device(instance, vk_funcs, &adapter_info); + device_create_info.vk_physical_device = d3d12_get_vk_physical_device(instance, pfn_vkGetInstanceProcAddr, &adapter_info); device_create_info.device_extensions = device_extensions; device_create_info.device_extension_count = ARRAY_SIZE(device_extensions); device_create_info.parent = (IUnknown *)wine_adapter;
1
0
0
0
Józef Kucia : dxgi: Add support for building with Win32 Vulkan.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 6b05ef1f01bda2d51c36f9b465a12a15d4119db6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6b05ef1f01bda2d51c36f9b4…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Mar 21 13:12:40 2019 +0100 dxgi: Add support for building with Win32 Vulkan. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dxgi/swapchain.c | 102 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 20 deletions(-) diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index 4c6217e..17f9a1e 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -27,7 +27,9 @@ #define VKD3D_NO_PROTOTYPES #define VKD3D_NO_VULKAN_H #define VKD3D_NO_WIN32_TYPES +#ifndef USE_WIN32_VULKAN #define WINE_VK_HOST +#endif #include "wine/library.h" #include "wine/vulkan.h" #include "wine/vulkan_driver.h" @@ -858,6 +860,67 @@ cleanup: #ifdef SONAME_LIBVKD3D +#ifdef USE_WIN32_VULKAN + +static void *load_library(const char *name) +{ + return LoadLibraryA(name); +} + +static void *get_library_proc(void *handle, const char *name) +{ + return (void *)GetProcAddress(handle, name); +} + +static void close_library(void *handle) +{ + if (handle) + FreeLibrary(handle); +} + +static PFN_vkGetInstanceProcAddr load_vulkan(void **vulkan_handle) +{ + *vulkan_handle = LoadLibraryA("vulkan-1.dll"); + return (void *)GetProcAddress(*vulkan_handle, "vkGetInstanceProcAddr"); +} + +#else + +static void *load_library(const char *name) +{ + return wine_dlopen(name, RTLD_NOW, NULL, 0); +} + +static void *get_library_proc(void *handle, const char *name) +{ + return wine_dlsym(handle, name, NULL, 0); +} + +static void close_library(void *handle) +{ + if (handle) + wine_dlclose(handle, NULL, 0); +} + +static PFN_vkGetInstanceProcAddr load_vulkan(void **vulkan_handle) +{ + const struct vulkan_funcs *vk_funcs; + HDC hdc; + + *vulkan_handle = NULL; + + hdc = GetDC(0); + vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); + ReleaseDC(0, hdc); + + if (vk_funcs) + return (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr; + + return NULL; +} + +#endif /* USE_WIN32_VULKAN */ + static PFN_vkd3d_acquire_vk_queue vkd3d_acquire_vk_queue; static PFN_vkd3d_create_image_resource vkd3d_create_image_resource; static PFN_vkd3d_get_device_parent vkd3d_get_device_parent; @@ -908,6 +971,8 @@ struct dxgi_vk_funcs PFN_vkQueueWaitIdle p_vkQueueWaitIdle; PFN_vkResetFences p_vkResetFences; PFN_vkWaitForFences p_vkWaitForFences; + + void *vulkan_module; }; static HRESULT hresult_from_vk_result(VkResult vr) @@ -1705,6 +1770,7 @@ static ULONG STDMETHODCALLTYPE d3d12_swapchain_AddRef(IDXGISwapChain3 *iface) static void d3d12_swapchain_destroy(struct d3d12_swapchain *swapchain) { const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs; + void *vulkan_module = vk_funcs->vulkan_module; d3d12_swapchain_destroy_buffers(swapchain, TRUE); @@ -1727,6 +1793,8 @@ static void d3d12_swapchain_destroy(struct d3d12_swapchain *swapchain) if (swapchain->factory) IWineDXGIFactory_Release(swapchain->factory); + + close_library(vulkan_module); } static ULONG STDMETHODCALLTYPE d3d12_swapchain_Release(IDXGISwapChain3 *iface) @@ -2424,20 +2492,9 @@ static const struct IDXGISwapChain3Vtbl d3d12_swapchain_vtbl = d3d12_swapchain_ResizeBuffers1, }; -static const struct vulkan_funcs *get_vk_funcs(void) -{ - const struct vulkan_funcs *vk_funcs; - HDC hdc; - - hdc = GetDC(0); - vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); - ReleaseDC(0, hdc); - return vk_funcs; -} - static BOOL load_vkd3d_functions(void *vkd3d_handle) { -#define LOAD_FUNCPTR(f) if (!(f = wine_dlsym(vkd3d_handle, #f, NULL, 0))) return FALSE; +#define LOAD_FUNCPTR(f) if (!(f = get_library_proc(vkd3d_handle, #f))) return FALSE; LOAD_FUNCPTR(vkd3d_acquire_vk_queue) LOAD_FUNCPTR(vkd3d_create_image_resource) LOAD_FUNCPTR(vkd3d_get_device_parent) @@ -2461,13 +2518,13 @@ static BOOL WINAPI init_vkd3d_once(INIT_ONCE *once, void *param, void **context) { TRACE("Loading vkd3d %s.\n", SONAME_LIBVKD3D); - if (!(vkd3d_handle = wine_dlopen(SONAME_LIBVKD3D, RTLD_NOW, NULL, 0))) + if (!(vkd3d_handle = load_library(SONAME_LIBVKD3D))) return FALSE; if (!load_vkd3d_functions(vkd3d_handle)) { ERR("Failed to load vkd3d functions.\n"); - wine_dlclose(vkd3d_handle, NULL, 0); + close_library(vkd3d_handle); vkd3d_handle = NULL; return FALSE; } @@ -2484,20 +2541,24 @@ static BOOL init_vkd3d(void) static BOOL init_vk_funcs(struct dxgi_vk_funcs *dxgi, VkInstance vk_instance, VkDevice vk_device) { - const struct vulkan_funcs *vk; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr; + + dxgi->vulkan_module = NULL; - if (!(vk = get_vk_funcs())) + if (!(vkGetInstanceProcAddr = load_vulkan(&dxgi->vulkan_module))) { - ERR_(winediag)("Failed to load Wine Vulkan driver.\n"); + ERR_(winediag)("Failed to load Vulkan.\n"); return FALSE; } - dxgi->p_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)vk->p_vkGetInstanceProcAddr; + vkGetDeviceProcAddr = (void *)vkGetInstanceProcAddr(vk_instance, "vkGetDeviceProcAddr"); #define LOAD_INSTANCE_PFN(name) \ - if (!(dxgi->p_##name = vk->p_vkGetInstanceProcAddr(vk_instance, #name))) \ + if (!(dxgi->p_##name = (void *)vkGetInstanceProcAddr(vk_instance, #name))) \ { \ ERR("Failed to get instance proc "#name".\n"); \ + close_library(dxgi->vulkan_module); \ return FALSE; \ } LOAD_INSTANCE_PFN(vkCreateWin32SurfaceKHR) @@ -2511,9 +2572,10 @@ static BOOL init_vk_funcs(struct dxgi_vk_funcs *dxgi, VkInstance vk_instance, Vk #undef LOAD_INSTANCE_PFN #define LOAD_DEVICE_PFN(name) \ - if (!(dxgi->p_##name = vk->p_vkGetDeviceProcAddr(vk_device, #name))) \ + if (!(dxgi->p_##name = (void *)vkGetDeviceProcAddr(vk_device, #name))) \ { \ ERR("Failed to get device proc "#name".\n"); \ + close_library(dxgi->vulkan_module); \ return FALSE; \ } LOAD_DEVICE_PFN(vkAcquireNextImageKHR)
1
0
0
0
Nikolay Sivov : mfplat: Implement attributes deserialization.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 6dc7503b2370b68fbdacc51f6db90c06cc108986 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6dc7503b2370b68fbdacc51f…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Mar 21 10:42:58 2019 +0300 mfplat: Implement attributes deserialization. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 117 +++++++++++++++++++++++++++++++++++++++++++-- dlls/mfplat/mfplat.spec | 2 +- dlls/mfplat/tests/mfplat.c | 72 +++++++++++++++++++++++++++- include/mfapi.h | 1 + 4 files changed, 184 insertions(+), 8 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=6dc7503b2370b68fbdac…
1
0
0
0
Nikolay Sivov : mfplat: Implement attributes serialization.
by Alexandre Julliard
21 Mar '19
21 Mar '19
Module: wine Branch: master Commit: 7dfc5db155c1330023143745d0ead5d6a7dbe54f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7dfc5db155c1330023143745…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Mar 21 10:42:57 2019 +0300 mfplat: Implement attributes serialization. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 197 ++++++++++++++++++++++++++++++++++++++++++++- dlls/mfplat/mfplat.spec | 4 +- dlls/mfplat/tests/mfplat.c | 29 +++++++ include/mfapi.h | 2 + 4 files changed, 229 insertions(+), 3 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index ae94645..69746f2 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1364,7 +1364,8 @@ static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 i if (index < attributes->count) { *key = attributes->attributes[index].key; - PropVariantCopy(value, &attributes->attributes[index].value); + if (value) + PropVariantCopy(value, &attributes->attributes[index].value); } else hr = E_INVALIDARG; @@ -1493,6 +1494,200 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size) return S_OK; } +#define ATTRIBUTES_STORE_MAGIC 0x494d4641 /* IMFA */ + +struct attributes_store_header +{ + DWORD magic; + UINT32 count; +}; + +struct attributes_store_item +{ + GUID key; + QWORD type; + union + { + double f; + UINT64 i64; + struct + { + DWORD size; + DWORD offset; + } subheader; + } u; +}; + +/*********************************************************************** + * MFGetAttributesAsBlobSize (mfplat.@) + */ +HRESULT WINAPI MFGetAttributesAsBlobSize(IMFAttributes *attributes, UINT32 *size) +{ + unsigned int i, count, length; + HRESULT hr; + GUID key; + + TRACE("%p, %p.\n", attributes, size); + + IMFAttributes_LockStore(attributes); + + hr = IMFAttributes_GetCount(attributes, &count); + + *size = sizeof(struct attributes_store_header); + + for (i = 0; i < count; ++i) + { + MF_ATTRIBUTE_TYPE type; + + hr = IMFAttributes_GetItemByIndex(attributes, i, &key, NULL); + if (FAILED(hr)) + break; + + *size += sizeof(struct attributes_store_item); + + IMFAttributes_GetItemType(attributes, &key, &type); + + switch (type) + { + case MF_ATTRIBUTE_GUID: + *size += sizeof(GUID); + break; + case MF_ATTRIBUTE_STRING: + IMFAttributes_GetStringLength(attributes, &key, &length); + *size += (length + 1) * sizeof(WCHAR); + break; + case MF_ATTRIBUTE_BLOB: + IMFAttributes_GetBlobSize(attributes, &key, &length); + *size += length; + break; + case MF_ATTRIBUTE_UINT32: + case MF_ATTRIBUTE_UINT64: + case MF_ATTRIBUTE_DOUBLE: + case MF_ATTRIBUTE_IUNKNOWN: + default: + ; + } + } + + IMFAttributes_UnlockStore(attributes); + + return hr; +} + +struct attr_serialize_context +{ + UINT8 *buffer; + UINT8 *ptr; + UINT32 size; +}; + +static void attributes_serialize_write(struct attr_serialize_context *context, const void *value, unsigned int size) +{ + memcpy(context->ptr, value, size); + context->ptr += size; +} + +static void attributes_serialize_write_item(struct attr_serialize_context *context, struct attributes_store_item *item, + const void *value) +{ + switch (item->type) + { + case MF_ATTRIBUTE_UINT32: + case MF_ATTRIBUTE_UINT64: + case MF_ATTRIBUTE_DOUBLE: + attributes_serialize_write(context, item, sizeof(*item)); + break; + case MF_ATTRIBUTE_GUID: + case MF_ATTRIBUTE_STRING: + case MF_ATTRIBUTE_BLOB: + item->u.subheader.offset = context->size - item->u.subheader.size; + attributes_serialize_write(context, item, sizeof(*item)); + memcpy(context->buffer + item->u.subheader.offset, value, item->u.subheader.size); + context->size -= item->u.subheader.size; + break; + default: + ; + } +} + +/*********************************************************************** + * MFGetAttributesAsBlob (mfplat.@) + */ +HRESULT WINAPI MFGetAttributesAsBlob(IMFAttributes *attributes, UINT8 *buffer, UINT size) +{ + struct attributes_store_header header; + struct attr_serialize_context context; + unsigned int required_size, i; + PROPVARIANT value; + HRESULT hr; + + TRACE("%p, %p, %u.\n", attributes, buffer, size); + + if (FAILED(hr = MFGetAttributesAsBlobSize(attributes, &required_size))) + return hr; + + if (required_size > size) + return MF_E_BUFFERTOOSMALL; + + context.buffer = buffer; + context.ptr = buffer; + context.size = required_size; + + IMFAttributes_LockStore(attributes); + + header.magic = ATTRIBUTES_STORE_MAGIC; + IMFAttributes_GetCount(attributes, &header.count); + + attributes_serialize_write(&context, &header, sizeof(header)); + + for (i = 0; i < header.count; ++i) + { + struct attributes_store_item item; + const void *data = NULL; + + hr = IMFAttributes_GetItemByIndex(attributes, i, &item.key, &value); + if (FAILED(hr)) + break; + + item.type = value.vt; + + switch (value.vt) + { + case MF_ATTRIBUTE_UINT32: + case MF_ATTRIBUTE_UINT64: + item.u.i64 = value.u.uhVal.QuadPart; + break; + case MF_ATTRIBUTE_DOUBLE: + item.u.f = value.u.dblVal; + break; + case MF_ATTRIBUTE_GUID: + item.u.subheader.size = sizeof(*value.u.puuid); + data = value.u.puuid; + break; + case MF_ATTRIBUTE_STRING: + item.u.subheader.size = (strlenW(value.u.pwszVal) + 1) * sizeof(WCHAR); + data = value.u.pwszVal; + break; + case MF_ATTRIBUTE_BLOB: + item.u.subheader.size = value.u.caub.cElems; + data = value.u.caub.pElems; + break; + case MF_ATTRIBUTE_IUNKNOWN: + break; + default: + WARN("Unknown attribute type %#x.\n", value.vt); + } + + attributes_serialize_write_item(&context, &item, data); + + PropVariantClear(&value); + } + + IMFAttributes_UnlockStore(attributes); + + return S_OK; +} + typedef struct _mfbytestream { mfattributes attributes; diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index 8b340a2..730e64b 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -85,8 +85,8 @@ @ stub MFFrameRateToAverageTimePerFrame @ stub MFFreeAdaptersAddresses @ stub MFGetAdaptersAddresses -@ stub MFGetAttributesAsBlob -@ stub MFGetAttributesAsBlobSize +@ stdcall MFGetAttributesAsBlob(ptr ptr long) +@ stdcall MFGetAttributesAsBlobSize(ptr ptr) @ stub MFGetConfigurationDWORD @ stub MFGetConfigurationPolicy @ stub MFGetConfigurationStore diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 2f8b1aa..258895f 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -47,6 +47,7 @@ DEFINE_GUID(DUMMY_GUID3, 0x12345678,0x1234,0x1234,0x23,0x23,0x23,0x23,0x23,0x23, #include "strsafe.h" #include "wine/test.h" +#include "wine/heap.h" static BOOL is_win8_plus; @@ -2520,6 +2521,33 @@ static void test_MFCompareFullToPartialMediaType(void) IMFMediaType_Release(partial_type); } +static void test_attributes_serialization(void) +{ + IMFAttributes *attributes; + UINT8 *buffer; + UINT32 size; + HRESULT hr; + + hr = MFCreateAttributes(&attributes, 0); + ok(hr == S_OK, "Failed to create object, hr %#x.\n", hr); + + hr = MFGetAttributesAsBlobSize(attributes, &size); + ok(hr == S_OK, "Failed to get blob size, hr %#x.\n", hr); + ok(size == 8, "Got size %u.\n", size); + + buffer = heap_alloc(size); + + hr = MFGetAttributesAsBlob(attributes, buffer, size); + ok(hr == S_OK, "Failed to serialize, hr %#x.\n", hr); + + hr = MFGetAttributesAsBlob(attributes, buffer, size - 1); + ok(hr == MF_E_BUFFERTOOSMALL, "Unexpected hr %#x.\n", hr); + + heap_free(buffer); + + IMFAttributes_Release(attributes); +} + START_TEST(mfplat) { CoInitialize(NULL); @@ -2551,6 +2579,7 @@ START_TEST(mfplat) test_stream_descriptor(); test_MFCalculateImageSize(); test_MFCompareFullToPartialMediaType(); + test_attributes_serialization(); CoUninitialize(); } diff --git a/include/mfapi.h b/include/mfapi.h index d8738d5..5d6d1e7 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -204,6 +204,8 @@ HRESULT WINAPI MFCreateSample(IMFSample **sample); HRESULT WINAPI MFCreateMemoryBuffer(DWORD max_length, IMFMediaBuffer **buffer); void * WINAPI MFHeapAlloc(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type); void WINAPI MFHeapFree(void *ptr); +HRESULT WINAPI MFGetAttributesAsBlob(IMFAttributes *attributes, UINT8 *buffer, UINT size); +HRESULT WINAPI MFGetAttributesAsBlobSize(IMFAttributes *attributes, UINT32 *size); HRESULT WINAPI MFGetTimerPeriodicity(DWORD *periodicity); HRESULT WINAPI MFTEnum(GUID category, UINT32 flags, MFT_REGISTER_TYPE_INFO *input_type, MFT_REGISTER_TYPE_INFO *output_type, IMFAttributes *attributes,
1
0
0
0
← Newer
1
...
25
26
27
28
29
30
31
...
110
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
Results per page:
10
25
50
100
200