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 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
996 discussions
Start a n
N
ew thread
Jacek Caban : dbghelp: Make dll builtin PE path search helper more generic.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 21af2e194792aaa263c144c8fb42fe678ad2ecd7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=21af2e194792aaa263c144c8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Mar 23 16:15:58 2020 +0100 dbghelp: Make dll builtin PE path search helper more generic. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/dbghelp_private.h | 1 + dlls/dbghelp/path.c | 86 +++++++++++++++++++++++++++++++++++++++ dlls/dbghelp/pe_module.c | 91 ++++++++++-------------------------------- 3 files changed, 107 insertions(+), 71 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 81ae1507e0..e846d21054 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -670,6 +670,7 @@ extern BOOL path_find_symbol_file(const struct process* pcs, const struc PCSTR full_path, const GUID* guid, DWORD dw1, DWORD dw2, WCHAR *buffer, BOOL* is_unmatched) DECLSPEC_HIDDEN; extern WCHAR *get_dos_file_name(const WCHAR *filename) DECLSPEC_HIDDEN; +extern BOOL search_dll_path(const WCHAR *name, BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) DECLSPEC_HIDDEN; extern const WCHAR* file_name(const WCHAR* str) DECLSPEC_HIDDEN; extern const char* file_nameA(const char* str) DECLSPEC_HIDDEN; diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index 1b04d97e13..99f6d00395 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -720,3 +720,89 @@ WCHAR *get_dos_file_name(const WCHAR *filename) } return dos_path; } + +BOOL search_dll_path(const WCHAR *name, BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) +{ + size_t len, i; + HANDLE file; + WCHAR *buf; + BOOL ret; + + static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0}; + static const WCHAR winedlldirW[] = {'W','I','N','E','D','L','L','D','I','R','%','u',0}; + + name = file_name(name); + + if ((len = GetEnvironmentVariableW(winebuilddirW, NULL, 0))) + { + WCHAR *p, *end; + const WCHAR dllsW[] = { '\\','d','l','l','s','\\' }; + const WCHAR programsW[] = { '\\','p','r','o','g','r','a','m','s','\\' }; + const WCHAR dot_dllW[] = {'.','d','l','l',0}; + const WCHAR dot_exeW[] = {'.','e','x','e',0}; + const WCHAR dot_soW[] = {'.','s','o',0}; + + if (!(buf = heap_alloc((len + 8 + 3 * lstrlenW(name)) * sizeof(WCHAR)))) return FALSE; + end = buf + GetEnvironmentVariableW(winebuilddirW, buf, len); + + memcpy(end, dllsW, sizeof(dllsW)); + strcpyW(end + ARRAY_SIZE(dllsW), name); + if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0; + if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_dllW)) *p = 0; + p = end + strlenW(end); + *p++ = '\\'; + strcpyW(p, name); + file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file != INVALID_HANDLE_VALUE) + { + ret = match(param, file, buf); + CloseHandle(file); + if (ret) goto found; + } + + memcpy(end, programsW, sizeof(programsW)); + end += ARRAY_SIZE(programsW); + strcpyW(end, name); + if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0; + if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_exeW)) *p = 0; + p = end + strlenW(end); + *p++ = '\\'; + strcpyW(p, name); + file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file != INVALID_HANDLE_VALUE) + { + ret = match(param, file, buf); + CloseHandle(file); + if (ret) goto found; + } + + heap_free(buf); + } + + for (i = 0;; i++) + { + WCHAR env_name[64]; + sprintfW(env_name, winedlldirW, i); + if (!(len = GetEnvironmentVariableW(env_name, NULL, 0))) break; + if (!(buf = heap_alloc((len + lstrlenW(name) + 2) * sizeof(WCHAR)))) return FALSE; + + len = GetEnvironmentVariableW(env_name, buf, len); + buf[len++] = '\\'; + strcpyW(buf + len, name); + file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file != INVALID_HANDLE_VALUE) + { + ret = match(param, file, buf); + CloseHandle(file); + if (ret) goto found; + } + heap_free(buf); + } + + return FALSE; + +found: + TRACE("found %s\n", debugstr_w(buf)); + heap_free(buf); + return TRUE; +} diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 8c120e00dc..a9410fea58 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -740,68 +740,23 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module) return ret; } -static WCHAR *find_builtin_pe(const WCHAR *path, HANDLE *file) +struct builtin_search { - const WCHAR *base_name; - size_t len, i; - WCHAR *buf; + WCHAR *path; + struct image_file_map fmap; +}; - static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0}; - static const WCHAR winedlldirW[] = {'W','I','N','E','D','L','L','D','I','R','%','u',0}; +static BOOL search_builtin_pe(void *param, HANDLE handle, const WCHAR *path) +{ + struct builtin_search *search = param; + size_t size; - if ((base_name = strrchrW(path, '\\'))) base_name++; - else base_name = path; + if (!pe_map_file(handle, &search->fmap, DMT_PE)) return FALSE; - if ((len = GetEnvironmentVariableW(winebuilddirW, NULL, 0))) - { - WCHAR *p, *end; - const WCHAR dllsW[] = { '\\','d','l','l','s','\\' }; - const WCHAR programsW[] = { '\\','p','r','o','g','r','a','m','s','\\' }; - const WCHAR dot_dllW[] = {'.','d','l','l',0}; - const WCHAR dot_exeW[] = {'.','e','x','e',0}; - - if (!(buf = heap_alloc((len + 8 + 2 * lstrlenW(base_name)) * sizeof(WCHAR)))) return NULL; - end = buf + GetEnvironmentVariableW(winebuilddirW, buf, len); - - memcpy(end, dllsW, sizeof(dllsW)); - strcpyW(end + ARRAY_SIZE(dllsW), base_name); - if ((p = strchrW(end, '.')) && !lstrcmpW(p, dot_dllW)) *p = 0; - p = end + strlenW(end); - *p++ = '\\'; - strcpyW(p, base_name); - *file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (*file != INVALID_HANDLE_VALUE) return buf; - - memcpy(end, programsW, sizeof(programsW)); - end += ARRAY_SIZE(programsW); - strcpyW(end, base_name); - if ((p = strchrW(end, '.')) && !lstrcmpW(p, dot_exeW)) *p = 0; - p = end + strlenW(end); - *p++ = '\\'; - strcpyW(p, base_name); - *file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (*file != INVALID_HANDLE_VALUE) return buf; - - heap_free(buf); - } - - for (i = 0;; i++) - { - WCHAR name[64]; - sprintfW(name, winedlldirW, i); - if (!(len = GetEnvironmentVariableW(name, NULL, 0))) break; - if (!(buf = heap_alloc((len + lstrlenW(base_name) + 2) * sizeof(WCHAR)))) return NULL; - - GetEnvironmentVariableW(name, buf, len); - buf[len++] = '\\'; - strcpyW(buf + len, base_name); - *file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (*file != INVALID_HANDLE_VALUE) return buf; - - heap_free(buf); - } - - return NULL; + size = (lstrlenW(path) + 1) * sizeof(WCHAR); + if ((search->path = heap_alloc(size))) + memcpy(search->path, path, size); + return TRUE; } /****************************************************************** @@ -833,18 +788,12 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, modfmt->u.pe_info = (struct pe_module_info*)(modfmt + 1); if (pe_map_file(hFile, &modfmt->u.pe_info->fmap, DMT_PE)) { - WCHAR *builtin_path = NULL; - HANDLE builtin_module; - if (modfmt->u.pe_info->fmap.u.pe.builtin && (builtin_path = find_builtin_pe(loaded_name, &builtin_module))) + struct builtin_search builtin = { NULL }; + if (modfmt->u.pe_info->fmap.u.pe.builtin && search_dll_path(loaded_name, search_builtin_pe, &builtin)) { - struct image_file_map builtin_fmap; - if (pe_map_file(builtin_module, &builtin_fmap, DMT_PE)) - { - TRACE("reloaded %s from %s\n", debugstr_w(loaded_name), debugstr_w(builtin_path)); - image_unmap_file(&modfmt->u.pe_info->fmap); - modfmt->u.pe_info->fmap = builtin_fmap; - } - CloseHandle(builtin_module); + TRACE("reloaded %s from %s\n", debugstr_w(loaded_name), debugstr_w(builtin.path)); + image_unmap_file(&modfmt->u.pe_info->fmap); + modfmt->u.pe_info->fmap = builtin.fmap; } if (!base) base = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.ImageBase; if (!size) size = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.SizeOfImage; @@ -854,7 +803,7 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.CheckSum); if (module) { - module->real_path = builtin_path; + module->real_path = builtin.path; modfmt->module = module; modfmt->remove = pe_module_remove; modfmt->loc_compute = NULL; @@ -869,7 +818,7 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, else { ERR("could not load the module '%s'\n", debugstr_w(loaded_name)); - heap_free(module->real_path); + heap_free(builtin.path); image_unmap_file(&modfmt->u.pe_info->fmap); } }
1
0
0
0
Jacek Caban : dbghelp: Use file_name helper in more places.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 77e880e6d22ef9be031f783fbb4b6a5e8c8826e8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=77e880e6d22ef9be031f783f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Mar 23 16:15:44 2020 +0100 dbghelp: Use file_name helper in more places. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/dbghelp_private.h | 2 ++ dlls/dbghelp/elf_module.c | 14 +++++--------- dlls/dbghelp/macho_module.c | 21 +++++++-------------- dlls/dbghelp/module.c | 4 ++-- dlls/dbghelp/path.c | 4 ++-- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 8fa9e799c0..81ae1507e0 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -670,6 +670,8 @@ extern BOOL path_find_symbol_file(const struct process* pcs, const struc PCSTR full_path, const GUID* guid, DWORD dw1, DWORD dw2, WCHAR *buffer, BOOL* is_unmatched) DECLSPEC_HIDDEN; extern WCHAR *get_dos_file_name(const WCHAR *filename) DECLSPEC_HIDDEN; +extern const WCHAR* file_name(const WCHAR* str) DECLSPEC_HIDDEN; +extern const char* file_nameA(const char* str) DECLSPEC_HIDDEN; /* pe_module.c */ extern BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS* nth) DECLSPEC_HIDDEN; diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index a11e73a0e1..34fffdae5b 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -727,8 +727,7 @@ static const Elf64_Sym *elf_lookup_symtab(const struct module* module, { compiland_name = source_get(module, ((const struct symt_compiland*)compiland)->source); - compiland_basename = strrchr(compiland_name, '/'); - if (!compiland_basename++) compiland_basename = compiland_name; + compiland_basename = file_nameA(compiland_name); } else compiland_name = compiland_basename = NULL; @@ -745,8 +744,7 @@ static const Elf64_Sym *elf_lookup_symtab(const struct module* module, const char* filename = source_get(module, ste->compiland->source); if (strcmp(filename, compiland_name)) { - base = strrchr(filename, '/'); - if (!base++) base = filename; + base = file_nameA(filename); if (strcmp(base, compiland_basename)) continue; } } @@ -1434,7 +1432,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, const WCHAR* filename, if (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do it */ ret = elf_load_file(pcs, filename, load_offset, dyn_addr, elf_info); /* if relative pathname, try some absolute base dirs */ - if (!ret && !strchrW(filename, '/')) + if (!ret && filename == file_name(filename)) { ret = elf_load_file_from_path(pcs, filename, load_offset, dyn_addr, getenv("PATH"), elf_info) || @@ -1689,8 +1687,7 @@ static BOOL elf_load_cb(const WCHAR* name, unsigned long load_addr, /* memcmp is needed for matches when bufstr contains also version information * el->name: libc.so, name: libc.so.6.0 */ - p = strrchrW(name, '/'); - if (!p++) p = name; + p = file_name(name); } if (!el->name || !memcmp(p, el->name, lstrlenW(el->name) * sizeof(WCHAR))) @@ -1724,8 +1721,7 @@ struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned /* do only the lookup from the filename, not the path (as we lookup module * name in the process' loaded module list) */ - el.name = strrchrW(name, '/'); - if (!el.name++) el.name = name; + el.name = file_name(name); el.ret = FALSE; if (!elf_enum_modules_internal(pcs, NULL, elf_load_cb, &el)) diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c index 8fa05d312a..4bc0a3e903 100644 --- a/dlls/dbghelp/macho_module.c +++ b/dlls/dbghelp/macho_module.c @@ -1193,10 +1193,7 @@ static void find_and_map_dsym(struct process *pcs, struct module* module) if (!fmap->uuid) return; - if ((p = strrchrW(module->module.LoadedImageName, '/'))) - p++; - else - p = module->module.LoadedImageName; + p = file_name(module->module.LoadedImageName); len = strlenW(module->module.LoadedImageName) + strlenW(dot_dsym) + strlenW(dsym_subpath) + strlenW(p) + 1; path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (!path) @@ -1637,19 +1634,17 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam if (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do it */ /* If has no directories, try PATH first. */ - if (!strchrW(filename, '/')) + p = file_name(filename); + if (p == filename) { ret = macho_load_file_from_path(pcs, filename, load_addr, getenv("PATH"), macho_info); } /* Try DYLD_LIBRARY_PATH, with just the filename (no directories). */ if (!ret) - { - if ((p = strrchrW(filename, '/'))) p++; - else p = filename; ret = macho_load_file_from_path(pcs, p, load_addr, getenv("DYLD_LIBRARY_PATH"), macho_info); - } + /* Try the path as given. */ if (!ret) ret = macho_load_file(pcs, filename, load_addr, macho_info); @@ -1661,7 +1656,7 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam fallback = "/usr/local/lib:/lib:/usr/lib"; ret = macho_load_file_from_path(pcs, p, load_addr, fallback, macho_info); } - if (!ret && !strchrW(filename, '/')) + if (!ret && p == filename) ret = macho_load_file_from_dll_path(pcs, filename, load_addr, macho_info); return ret; @@ -1957,8 +1952,7 @@ static BOOL macho_load_cb(const WCHAR* name, unsigned long addr, void* user) /* memcmp is needed for matches when bufstr contains also version information * ml->name: libc.so, name: libc.so.6.0 */ - p = strrchrW(name, '/'); - if (!p++) p = name; + p = file_name(name); if (!memcmp(p, ml->name, lstrlenW(ml->name) * sizeof(WCHAR))) { ml->ret = macho_search_and_load_file(ml->pcs, name, addr, &ml->macho_info); @@ -1989,8 +1983,7 @@ struct module* macho_load_module(struct process* pcs, const WCHAR* name, unsign /* do only the lookup from the filename, not the path (as we lookup module * name in the process' loaded module list) */ - ml.name = strrchrW(name, '/'); - if (!ml.name++) ml.name = name; + ml.name = file_name(name); ml.ret = FALSE; if (!macho_enum_modules_internal(pcs, NULL, macho_load_cb, &ml)) diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 0a90595b8c..74502a9d6b 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -82,14 +82,14 @@ static BOOL is_wine_loader(const WCHAR *module) static const WCHAR wineW[] = {'w','i','n','e',0}; static const WCHAR suffixW[] = {'6','4',0}; const WCHAR *filename = get_filename(module, NULL); - const char *ptr, *p; + const char *ptr; BOOL ret = FALSE; WCHAR *buffer; DWORD len; if ((ptr = getenv("WINELOADER"))) { - if ((p = strrchr(ptr, '/'))) ptr = p + 1; + ptr = file_nameA(ptr); len = 2 + MultiByteToWideChar( CP_UNIXCP, 0, ptr, -1, NULL, 0 ); buffer = heap_alloc( len * sizeof(WCHAR) ); MultiByteToWideChar( CP_UNIXCP, 0, ptr, -1, buffer, len ); diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index 704fbbdee3..1b04d97e13 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); static inline BOOL is_sepA(char ch) {return ch == '/' || ch == '\\';} static inline BOOL is_sep(WCHAR ch) {return ch == '/' || ch == '\\';} -static inline const char* file_nameA(const char* str) +const char* file_nameA(const char* str) { const char* p; @@ -42,7 +42,7 @@ static inline const char* file_nameA(const char* str) return p + 1; } -static inline const WCHAR* file_name(const WCHAR* str) +const WCHAR* file_name(const WCHAR* str) { const WCHAR* p;
1
0
0
0
Jacek Caban : dbghelp: Rename helpers to make unicode variants default.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 63d41a41f21c4d9f32b484d6c7ed78c9d7b2a48d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=63d41a41f21c4d9f32b484d6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Mar 23 16:15:31 2020 +0100 dbghelp: Rename helpers to make unicode variants default. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/path.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index feb951ad55..704fbbdee3 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -31,22 +31,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); -static inline BOOL is_sep(char ch) {return ch == '/' || ch == '\\';} -static inline BOOL is_sepW(WCHAR ch) {return ch == '/' || ch == '\\';} +static inline BOOL is_sepA(char ch) {return ch == '/' || ch == '\\';} +static inline BOOL is_sep(WCHAR ch) {return ch == '/' || ch == '\\';} -static inline const char* file_name(const char* str) +static inline const char* file_nameA(const char* str) { const char* p; - for (p = str + strlen(str) - 1; p >= str && !is_sep(*p); p--); + for (p = str + strlen(str) - 1; p >= str && !is_sepA(*p); p--); return p + 1; } -static inline const WCHAR* file_nameW(const WCHAR* str) +static inline const WCHAR* file_name(const WCHAR* str) { const WCHAR* p; - for (p = str + strlenW(str) - 1; p >= str && !is_sepW(*p); p--); + for (p = str + strlenW(str) - 1; p >= str && !is_sep(*p); p--); return p + 1; } @@ -54,7 +54,7 @@ static inline void file_pathW(const WCHAR *src, WCHAR *dst) { int len; - for (len = strlenW(src) - 1; (len > 0) && (!is_sepW(src[len])); len--); + for (len = strlenW(src) - 1; (len > 0) && (!is_sep(src[len])); len--); memcpy( dst, src, len * sizeof(WCHAR) ); dst[len] = 0; } @@ -71,7 +71,7 @@ HANDLE WINAPI FindDebugInfoFile(PCSTR FileName, PCSTR SymbolPath, PSTR DebugFile OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) { - if (!SearchPathA(SymbolPath, file_name(FileName), NULL, MAX_PATH, DebugFilePath, NULL)) + if (!SearchPathA(SymbolPath, file_nameA(FileName), NULL, MAX_PATH, DebugFilePath, NULL)) return NULL; h = CreateFileA(DebugFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); @@ -181,7 +181,7 @@ BOOL WINAPI SymMatchFileNameW(PCWSTR file, PCWSTR match, while (fptr >= file && mptr >= match) { - if (toupperW(*fptr) != toupperW(*mptr) && !(is_sepW(*fptr) && is_sepW(*mptr))) + if (toupperW(*fptr) != toupperW(*mptr) && !(is_sep(*fptr) && is_sep(*mptr))) break; fptr--; mptr--; } @@ -208,7 +208,7 @@ BOOL WINAPI SymMatchFileName(PCSTR file, PCSTR match, while (fptr >= file && mptr >= match) { - if (toupper(*fptr) != toupper(*mptr) && !(is_sep(*fptr) && is_sep(*mptr))) + if (toupper(*fptr) != toupper(*mptr) && !(is_sepA(*fptr) && is_sepA(*mptr))) break; fptr--; mptr--; } @@ -385,7 +385,7 @@ BOOL WINAPI SymFindFileInPathW(HANDLE hProcess, PCWSTR searchPath, PCWSTR full_p s.cb = cb; s.user = user; - filename = file_nameW(full_path); + filename = file_name(full_path); /* first check full path to file */ if (sffip_cb(full_path, &s)) @@ -642,7 +642,7 @@ BOOL path_find_symbol_file(const struct process* pcs, const struct module* modul mf.matched = 0; MultiByteToWideChar(CP_ACP, 0, full_path, -1, full_pathW, MAX_PATH); - filename = file_nameW(full_pathW); + filename = file_name(full_pathW); mf.kind = module_get_type_by_name(filename); *is_unmatched = FALSE;
1
0
0
0
Rémi Bernon : winemac.drv: Remove frame when non-client area is empty.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 062ce94fd5a0c0f119559d90ba1f95625b988a84 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=062ce94fd5a0c0f119559d90…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Mar 18 14:46:08 2020 +0100 winemac.drv: Remove frame when non-client area is empty. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=46857
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Ken Thomases <ken(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winemac.drv/window.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 605c0c87f1..066eb553f7 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -57,12 +57,15 @@ static DWORD activate_on_focus_time; */ static void get_cocoa_window_features(struct macdrv_win_data *data, DWORD style, DWORD ex_style, - struct macdrv_window_features* wf) + struct macdrv_window_features* wf, + const RECT *window_rect, + const RECT *client_rect) { memset(wf, 0, sizeof(*wf)); if (disable_window_decorations) return; - if (IsRectEmpty(&data->window_rect)) return; + if (IsRectEmpty(window_rect)) return; + if (EqualRect(window_rect, client_rect)) return; if ((style & WS_CAPTION) == WS_CAPTION && !(ex_style & WS_EX_LAYERED)) { @@ -130,7 +133,8 @@ static void get_cocoa_window_state(struct macdrv_win_data *data, * * Helper for macdrv_window_to_mac_rect and macdrv_mac_to_window_rect. */ -static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT *rect) +static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT *rect, + const RECT *window_rect, const RECT *client_rect) { DWORD ex_style, style_mask = 0, ex_style_mask = 0; @@ -141,7 +145,7 @@ static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT if (!data->shaped) { struct macdrv_window_features wf; - get_cocoa_window_features(data, style, ex_style, &wf); + get_cocoa_window_features(data, style, ex_style, &wf, window_rect, client_rect); if (wf.title_bar) { @@ -167,14 +171,15 @@ static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT * * Convert a rect from client to Mac window coordinates */ -static void macdrv_window_to_mac_rect(struct macdrv_win_data *data, DWORD style, RECT *rect) +static void macdrv_window_to_mac_rect(struct macdrv_win_data *data, DWORD style, RECT *rect, + const RECT *window_rect, const RECT *client_rect) { RECT rc; if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return; if (IsRectEmpty(rect)) return; - get_mac_rect_offset(data, style, &rc); + get_mac_rect_offset(data, style, &rc, window_rect, client_rect); rect->left -= rc.left; rect->right -= rc.right; @@ -198,7 +203,7 @@ static void macdrv_mac_to_window_rect(struct macdrv_win_data *data, RECT *rect) if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return; if (IsRectEmpty(rect)) return; - get_mac_rect_offset(data, style, &rc); + get_mac_rect_offset(data, style, &rc, &data->window_rect, &data->client_rect); rect->left += rc.left; rect->right += rc.right; @@ -351,7 +356,7 @@ static void set_cocoa_window_properties(struct macdrv_win_data *data) owner_win = macdrv_get_cocoa_window(owner, TRUE); macdrv_set_cocoa_parent_window(data->cocoa_window, owner_win); - get_cocoa_window_features(data, style, ex_style, &wf); + get_cocoa_window_features(data, style, ex_style, &wf, &data->window_rect, &data->client_rect); macdrv_set_cocoa_window_features(data->cocoa_window, &wf); get_cocoa_window_state(data, style, ex_style, &state); @@ -620,7 +625,7 @@ static void sync_window_min_max_info(HWND hwnd) CGSize min_size, max_size; SetRect(&min_rect, 0, 0, minmax.ptMinTrackSize.x, minmax.ptMinTrackSize.y); - macdrv_window_to_mac_rect(data, style, &min_rect); + macdrv_window_to_mac_rect(data, style, &min_rect, &data->window_rect, &data->client_rect); min_size = CGSizeMake(min_rect.right - min_rect.left, min_rect.bottom - min_rect.top); if (minmax.ptMaxTrackSize.x == GetSystemMetrics(SM_CXMAXTRACK) && @@ -629,7 +634,7 @@ static void sync_window_min_max_info(HWND hwnd) else { SetRect(&max_rect, 0, 0, minmax.ptMaxTrackSize.x, minmax.ptMaxTrackSize.y); - macdrv_window_to_mac_rect(data, style, &max_rect); + macdrv_window_to_mac_rect(data, style, &max_rect, &data->window_rect, &data->client_rect); max_size = CGSizeMake(max_rect.right - max_rect.left, max_rect.bottom - max_rect.top); } @@ -691,9 +696,9 @@ static void create_cocoa_window(struct macdrv_win_data *data) ex_style = GetWindowLongW(data->hwnd, GWL_EXSTYLE); data->whole_rect = data->window_rect; - macdrv_window_to_mac_rect(data, style, &data->whole_rect); + macdrv_window_to_mac_rect(data, style, &data->whole_rect, &data->window_rect, &data->client_rect); - get_cocoa_window_features(data, style, ex_style, &wf); + get_cocoa_window_features(data, style, ex_style, &wf, &data->window_rect, &data->client_rect); frame = cgrect_from_rect(data->whole_rect); constrain_window_frame(&frame); @@ -2063,7 +2068,7 @@ void CDECL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags if (!data && !(data = macdrv_create_win_data(hwnd, window_rect, client_rect))) return; *visible_rect = *window_rect; - macdrv_window_to_mac_rect(data, style, visible_rect); + macdrv_window_to_mac_rect(data, style, visible_rect, window_rect, client_rect); TRACE("visible_rect %s -> %s\n", wine_dbgstr_rect(window_rect), wine_dbgstr_rect(visible_rect)); @@ -2845,7 +2850,8 @@ BOOL query_resize_size(HWND hwnd, macdrv_query *query) if (SendMessageW(hwnd, WM_SIZING, corner, (LPARAM)&rect)) { - macdrv_window_to_mac_rect(data, GetWindowLongW(hwnd, GWL_STYLE), &rect); + macdrv_window_to_mac_rect(data, GetWindowLongW(hwnd, GWL_STYLE), &rect, + &data->window_rect, &data->client_rect); query->resize_size.rect = cgrect_from_rect(rect); ret = TRUE; }
1
0
0
0
Rémi Bernon : winex11.drv: Remove frame when non-client area is empty.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 47f69a22484a5b0c1286cb0f430976d97fa6d9a0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=47f69a22484a5b0c1286cb0f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Mar 18 14:46:07 2020 +0100 winex11.drv: Remove frame when non-client area is empty. Several applications -Steam,
Battle.net
for instance- handle the WM_NCCALCSIZE message to override the non-client areas size and make the client area cover the whole window, instead of changing the styles. In winex11.drv, in decorated mode, we adjust the window rect according to the window style to hide the unwanted decorations behind the frame, but when client and window rects are equals, there's nothing to hide and the actual window styles are irrelevant and can safely be ignored. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=40930
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/window.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 99e4094ebd..4676b09935 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -280,13 +280,16 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl * get_mwm_decorations */ static unsigned long get_mwm_decorations( struct x11drv_win_data *data, - DWORD style, DWORD ex_style ) + DWORD style, DWORD ex_style, + const RECT *window_rect, + const RECT *client_rect ) { unsigned long ret = 0; if (!decorated_mode) return 0; - if (IsRectEmpty( &data->window_rect )) return 0; + if (EqualRect( window_rect, client_rect )) return 0; + if (IsRectEmpty( window_rect )) return 0; if (data->shaped) return 0; if (ex_style & WS_EX_TOOLWINDOW) return 0; @@ -712,7 +715,7 @@ static void set_mwm_hints( struct x11drv_win_data *data, DWORD style, DWORD ex_s } else { - mwm_hints.decorations = get_mwm_decorations( data, style, ex_style ); + mwm_hints.decorations = get_mwm_decorations( data, style, ex_style, &data->window_rect, &data->client_rect ); mwm_hints.functions = MWM_FUNC_MOVE; if (is_window_resizable( data, style )) mwm_hints.functions |= MWM_FUNC_RESIZE; if (!(style & WS_DISABLED)) @@ -1157,7 +1160,8 @@ void make_window_embedded( struct x11drv_win_data *data ) * * Convert a rect from client to X window coordinates */ -static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect ) +static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect, + const RECT *window_rect, const RECT *client_rect ) { DWORD style, ex_style, style_mask = 0, ex_style_mask = 0; unsigned long decor; @@ -1168,7 +1172,7 @@ static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect ) style = GetWindowLongW( data->hwnd, GWL_STYLE ); ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE ); - decor = get_mwm_decorations( data, style, ex_style ); + decor = get_mwm_decorations( data, style, ex_style, window_rect, client_rect ); if (decor & MWM_DECOR_TITLE) style_mask |= WS_CAPTION; if (decor & MWM_DECOR_BORDER) @@ -2274,7 +2278,7 @@ void CDECL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flag } *visible_rect = *window_rect; - X11DRV_window_to_X_rect( data, visible_rect ); + X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect ); /* create the window surface if necessary */
1
0
0
0
Vijay Kiran Kamuju : include: Add some missing defines to xinput.h.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 3b19726788780043fc293c718089e3664df59cb6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3b19726788780043fc293c71…
Author: Vijay Kiran Kamuju <infyquest(a)gmail.com> Date: Sun Mar 22 08:07:05 2020 +0100 include: Add some missing defines to xinput.h. Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/xinput.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/xinput.h b/include/xinput.h index 73b8c92372..f7c291630c 100644 --- a/include/xinput.h +++ b/include/xinput.h @@ -110,14 +110,17 @@ * which are being used. */ -#define XINPUT_DEVTYPE_GAMEPAD 0x01 -#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 -#define XINPUT_DEVSUBTYPE_WHEEL 0x02 -#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 -#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04 -#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 -#define XINPUT_DEVSUBTYPE_GUITAR 0x06 -#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 +#define XINPUT_DEVTYPE_GAMEPAD 0x01 +#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 +#define XINPUT_DEVSUBTYPE_WHEEL 0x02 +#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 +#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04 +#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 +#define XINPUT_DEVSUBTYPE_GUITAR 0x06 +#define XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE 0x07 +#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 +#define XINPUT_DEVSUBTYPE_GUITAR_BASS 0x0b +#define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13 /* * These are used with the XInputGetCapabilities function to
1
0
0
0
Vincent Povirk : gdiplus/tests: Don't test the exact substitution of MS Shell Dlg.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 689e94c597471bb5779268bf21f093f9668c163e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=689e94c597471bb5779268bf…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Sun Mar 22 14:46:17 2020 -0500 gdiplus/tests: Don't test the exact substitution of MS Shell Dlg. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=47872
Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/font.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index a4a96970af..10d1f3bd5a 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -828,8 +828,7 @@ static void test_font_substitution(void) memset(&lf, 0xfe, sizeof(lf)); status = GdipGetLogFontA(font, graphics, &lf); expect(Ok, status); - ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") || - !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName); + ok(lstrcmpA(lf.lfFaceName, "MS Shell Dlg") != 0, "expected substitution of MS Shell Dlg\n"); GdipDeleteFont(font); status = GdipCreateFontFamilyFromName(L"MS Shell Dlg", NULL, &family); @@ -839,8 +838,7 @@ static void test_font_substitution(void) memset(&lf, 0xfe, sizeof(lf)); status = GdipGetLogFontA(font, graphics, &lf); expect(Ok, status); - ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") || - !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName); + ok(lstrcmpA(lf.lfFaceName, "MS Shell Dlg") != 0, "expected substitution of MS Shell Dlg\n"); GdipDeleteFont(font); GdipDeleteFontFamily(family);
1
0
0
0
Vincent Povirk : gdiplus/tests: Don't test font face of DEFAULT_GUI_FONT.
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 861811254f52f278d9cf7eeab5fc4b167d65bd4e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=861811254f52f278d9cf7eea…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Sun Mar 22 14:46:16 2020 -0500 gdiplus/tests: Don't test font face of DEFAULT_GUI_FONT. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=47872
Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/font.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 9abb80faaf..a4a96970af 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -808,29 +808,20 @@ static void test_font_metrics(void) static void test_font_substitution(void) { - WCHAR ms_shell_dlg[LF_FACESIZE]; char fallback_font[LF_FACESIZE]; HDC hdc; - HFONT hfont; LOGFONTA lf; GpStatus status; GpGraphics *graphics; GpFont *font; GpFontFamily *family; - int ret; hdc = CreateCompatibleDC(0); status = GdipCreateFromHDC(hdc, &graphics); expect(Ok, status); - hfont = GetStockObject(DEFAULT_GUI_FONT); - ok(hfont != 0, "GetStockObject(DEFAULT_GUI_FONT) failed\n"); - - memset(&lf, 0xfe, sizeof(lf)); - ret = GetObjectA(hfont, sizeof(lf), &lf); - ok(ret == sizeof(lf), "GetObject failed\n"); - ok(!lstrcmpA(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName); - MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, -1, ms_shell_dlg, LF_FACESIZE); + memset(&lf, 0, sizeof(lf)); + lstrcpyA(lf.lfFaceName, "MS Shell Dlg"); status = GdipCreateFontFromLogfontA(hdc, &lf, &font); expect(Ok, status); @@ -841,7 +832,7 @@ static void test_font_substitution(void) !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName); GdipDeleteFont(font); - status = GdipCreateFontFamilyFromName(ms_shell_dlg, NULL, &family); + status = GdipCreateFontFamilyFromName(L"MS Shell Dlg", NULL, &family); expect(Ok, status); status = GdipCreateFont(family, 12, FontStyleRegular, UnitPoint, &font); expect(Ok, status);
1
0
0
0
Zebediah Figura : kernel32: Reimplement GetVolumePathName() using NtQueryInformationFile(FileAttributeTagInformation).
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 9b80443a8ff67523f0c2d8ba11779523a5fa3cec URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9b80443a8ff67523f0c2d8ba…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 20 12:15:27 2020 -0500 kernel32: Reimplement GetVolumePathName() using NtQueryInformationFile(FileAttributeTagInformation). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/volume.c | 4 +- dlls/kernel32/volume.c | 242 +++++++++++++++++++++++-------------------- 2 files changed, 134 insertions(+), 112 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=9b80443a8ff67523f0c2…
1
0
0
0
Zebediah Figura : ntdll: Report Unix mount points as Win32 mount points in NtQueryInformationFile().
by Alexandre Julliard
23 Mar '20
23 Mar '20
Module: wine Branch: master Commit: 340757c62a1e1a02ef5ef0cd6626c48c02a764d6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=340757c62a1e1a02ef5ef0cd…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 20 12:15:26 2020 -0500 ntdll: Report Unix mount points as Win32 mount points in NtQueryInformationFile(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 31 ++++++++++++++++++++++--------- include/winternl.h | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index c2ec4a7dee..1a5f86d7c2 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -136,8 +136,15 @@ static inline ULONG get_file_attributes( const struct stat *st ) return attr; } +static BOOL fd_is_mount_point( int fd, const struct stat *st ) +{ + struct stat parent; + return S_ISDIR( st->st_mode ) && !fstatat( fd, "..", &parent, 0 ) + && (parent.st_dev != st->st_dev || parent.st_ino == st->st_ino); +} + /* get the stat info and file attributes for a file (by file descriptor) */ -int fd_get_file_info( int fd, struct stat *st, ULONG *attr ) +int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr ) { int ret; @@ -145,6 +152,9 @@ int fd_get_file_info( int fd, struct stat *st, ULONG *attr ) ret = fstat( fd, st ); if (ret == -1) return ret; *attr |= get_file_attributes( st ); + /* consider mount points to be reparse points (IO_REPARSE_TAG_MOUNT_POINT) */ + if ((options & FILE_OPEN_REPARSE_POINT) && fd_is_mount_point( fd, st )) + *attr |= FILE_ATTRIBUTE_REPARSE_POINT; return ret; } @@ -2319,6 +2329,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, struct stat st; int fd, needs_close = FALSE; ULONG attr; + unsigned int options; TRACE("(%p,%p,%p,0x%08x,0x%08x)\n", hFile, io, ptr, len, class); @@ -2331,7 +2342,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, if (len < info_sizes[class]) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH; - if ((io->u.Status = server_get_unix_fd( hFile, 0, &fd, &needs_close, NULL, NULL ))) + if ((io->u.Status = server_get_unix_fd( hFile, 0, &fd, &needs_close, NULL, &options ))) { if (io->u.Status != STATUS_BAD_DEVICE_TYPE) return io->u.Status; return server_get_file_info( hFile, io, ptr, len, class ); @@ -2340,7 +2351,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, switch (class) { case FileBasicInformation: - if (fd_get_file_info( fd, &st, &attr ) == -1) + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) io->u.Status = STATUS_INVALID_INFO_CLASS; @@ -2351,7 +2362,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, { FILE_STANDARD_INFORMATION *info = ptr; - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else { fill_file_info( &st, attr, info, class ); @@ -2368,7 +2379,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, } break; case FileInternalInformation: - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else fill_file_info( &st, attr, ptr, class ); break; case FileEaInformation: @@ -2378,7 +2389,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, } break; case FileEndOfFileInformation: - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else fill_file_info( &st, attr, ptr, class ); break; case FileAllInformation: @@ -2386,7 +2397,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, FILE_ALL_INFORMATION *info = ptr; ANSI_STRING unix_name; - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) io->u.Status = STATUS_INVALID_INFO_CLASS; else if (!(io->u.Status = server_get_unix_name( hFile, &unix_name ))) @@ -2494,7 +2505,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, } break; case FileIdInformation: - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else { FILE_ID_INFORMATION *info = ptr; @@ -2504,12 +2515,14 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, } break; case FileAttributeTagInformation: - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); + if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); else { FILE_ATTRIBUTE_TAG_INFORMATION *info = ptr; info->FileAttributes = attr; info->ReparseTag = 0; /* FIXME */ + if ((options & FILE_OPEN_REPARSE_POINT) && fd_is_mount_point( fd, &st )) + info->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; } break; default: diff --git a/include/winternl.h b/include/winternl.h index d9809c7ad3..19e8965e99 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1795,7 +1795,7 @@ typedef struct _RTL_HANDLE_TABLE #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 #define FILE_NO_COMPRESSION 0x00008000 #define FILE_RESERVE_OPFILTER 0x00100000 -#define FILE_TRANSACTED_MODE 0x00200000 +#define FILE_OPEN_REPARSE_POINT 0x00200000 #define FILE_OPEN_OFFLINE_FILE 0x00400000 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
100
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
Results per page:
10
25
50
100
200