winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2023
----- 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
920 discussions
Start a n
N
ew thread
Alexandre Julliard : imagehlp: Use the IMAGE_FIRST_SECTION helper macro.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 60f0c1b30faedddec51b483e89d4e36252cc12b6 URL:
https://gitlab.winehq.org/wine/wine/-/commit/60f0c1b30faedddec51b483e89d4e3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 25 13:01:32 2023 +0200 imagehlp: Use the IMAGE_FIRST_SECTION helper macro. --- dlls/imagehlp/access.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/imagehlp/access.c b/dlls/imagehlp/access.c index d9e3731dc02..a15b99f13c2 100644 --- a/dlls/imagehlp/access.c +++ b/dlls/imagehlp/access.c @@ -188,9 +188,7 @@ BOOL WINAPI MapAndLoad(PCSTR pszImageName, PCSTR pszDllPath, PLOADED_IMAGE pLoad pLoadedImage->hFile = hFile; pLoadedImage->MappedAddress = mapping; pLoadedImage->FileHeader = pNtHeader; - pLoadedImage->Sections = (PIMAGE_SECTION_HEADER) - ((LPBYTE) &pNtHeader->OptionalHeader + - pNtHeader->FileHeader.SizeOfOptionalHeader); + pLoadedImage->Sections = IMAGE_FIRST_SECTION(pNtHeader); pLoadedImage->NumberOfSections = pNtHeader->FileHeader.NumberOfSections; pLoadedImage->SizeOfImage = GetFileSize(hFile, NULL); pLoadedImage->Characteristics = pNtHeader->FileHeader.Characteristics;
1
0
0
0
Alexandre Julliard : dbghelp: Consistently use the IMAGE_FIRST_SECTION helper macro.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 0ee4bec912bd18719b750ba52264f8821bd12173 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0ee4bec912bd18719b750ba52264f8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 25 13:01:13 2023 +0200 dbghelp: Consistently use the IMAGE_FIRST_SECTION helper macro. --- dlls/dbghelp/pe_module.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 6c07bf5826a..fc3542b4db5 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -282,8 +282,7 @@ BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt) } fmap->u.pe.builtin = !memcmp((const IMAGE_DOS_HEADER*)mapping + 1, builtin_signature, sizeof(builtin_signature)); - section = (IMAGE_SECTION_HEADER*) - ((char*)&nthdr->OptionalHeader + nthdr->FileHeader.SizeOfOptionalHeader); + section = IMAGE_FIRST_SECTION( nthdr ); fmap->u.pe.sect = HeapAlloc(GetProcessHeap(), 0, nthdr->FileHeader.NumberOfSections * sizeof(fmap->u.pe.sect[0])); if (!fmap->u.pe.sect) goto error; @@ -630,9 +629,8 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod } else { - const IMAGE_SECTION_HEADER *sectp = (const IMAGE_SECTION_HEADER*)((const char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader); /* Debug info is embedded into PE module */ - ret = pe_load_debug_directory(pcs, module, mapping, sectp, + ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ), nth->FileHeader.NumberOfSections, dbg, nDbg); } done: @@ -668,10 +666,8 @@ static BOOL pe_load_export_debug_info(const struct process* pcs, struct module* #if 0 /* FIXME: we'd better store addresses linked to sections rather than absolute values */ - IMAGE_SECTION_HEADER* section; + IMAGE_SECTION_HEADER *section = IMAGE_FIRST_SECTION( nth ); /* Add start of sections */ - section = (IMAGE_SECTION_HEADER*) - ((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader); for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++) { symt_new_public(module, NULL, section->Name, FALSE,
1
0
0
0
Alexandre Julliard : ntdll: Consistently use the IMAGE_FIRST_SECTION helper macro.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: db3af1b238c3fe5f1fa7566787eb2afe292e0277 URL:
https://gitlab.winehq.org/wine/wine/-/commit/db3af1b238c3fe5f1fa7566787eb2a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 25 13:00:43 2023 +0200 ntdll: Consistently use the IMAGE_FIRST_SECTION helper macro. --- dlls/ntdll/loader.c | 9 +++------ dlls/ntdll/tests/virtual.c | 3 +-- dlls/ntdll/unix/loader.c | 4 ++-- dlls/ntdll/unix/virtual.c | 10 +++++----- include/winnt.h | 3 +-- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 67104e63286..5b2f9bdce0d 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2059,8 +2059,7 @@ static NTSTATUS perform_relocations( void *module, IMAGE_NT_HEADERS *nt, SIZE_T if (nt->FileHeader.NumberOfSections > ARRAY_SIZE( protect_old )) return STATUS_INVALID_IMAGE_FORMAT; - sec = (const IMAGE_SECTION_HEADER *)((const char *)&nt->OptionalHeader + - nt->FileHeader.SizeOfOptionalHeader); + sec = IMAGE_FIRST_SECTION( nt ); for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { void *addr = get_rva( module, sec[i].VirtualAddress ); @@ -2216,8 +2215,8 @@ static BOOL convert_to_pe64( HMODULE module, const SECTION_IMAGE_INFORMATION *in IMAGE_OPTIONAL_HEADER32 hdr32 = { IMAGE_NT_OPTIONAL_HDR32_MAGIC }; IMAGE_OPTIONAL_HEADER64 hdr64 = { IMAGE_NT_OPTIONAL_HDR64_MAGIC }; IMAGE_NT_HEADERS *nt = RtlImageNtHeader( module ); + IMAGE_SECTION_HEADER *sec = IMAGE_FIRST_SECTION( nt ); SIZE_T hdr_size = min( sizeof(hdr32), nt->FileHeader.SizeOfOptionalHeader ); - IMAGE_SECTION_HEADER *sec = (IMAGE_SECTION_HEADER *)((char *)&nt->OptionalHeader + hdr_size); SIZE_T size = min( nt->OptionalHeader.SizeOfHeaders, nt->OptionalHeader.SizeOfImage ); void *addr = module; ULONG i, old_prot; @@ -4361,10 +4360,8 @@ PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection( const IMAGE_NT_HEADERS *nt, HMODULE module, DWORD rva ) { int i; - const IMAGE_SECTION_HEADER *sec; + const IMAGE_SECTION_HEADER *sec = IMAGE_FIRST_SECTION( nt ); - sec = (const IMAGE_SECTION_HEADER*)((const char*)&nt->OptionalHeader + - nt->FileHeader.SizeOfOptionalHeader); for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++) { if ((sec->VirtualAddress <= rva) && (sec->VirtualAddress + sec->SizeOfRawData > rva)) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 609d702a359..a9dec1b5a8a 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -2053,8 +2053,7 @@ static void perform_relocations( void *module, INT_PTR delta ) nt = RtlImageNtHeader( module ); relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; if (!relocs->VirtualAddress || !relocs->Size) return; - sec = (const IMAGE_SECTION_HEADER *)((const char *)&nt->OptionalHeader + - nt->FileHeader.SizeOfOptionalHeader); + sec = IMAGE_FIRST_SECTION( nt ); for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { void *addr = (char *)module + sec[i].VirtualAddress; diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 38aaf778ff5..7bf3ca22566 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1125,7 +1125,7 @@ static void relocate_ntdll( void *module ) if (!(rel = get_module_data_dir( module, IMAGE_DIRECTORY_ENTRY_BASERELOC, &size ))) return; - sec = (IMAGE_SECTION_HEADER *)((char *)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader); + sec = IMAGE_FIRST_SECTION( nt ); for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { void *addr = get_rva( module, sec[i].VirtualAddress ); @@ -1991,7 +1991,7 @@ static void load_apiset_dll(void) if (!status) { nt = get_rva( ptr, ((IMAGE_DOS_HEADER *)ptr)->e_lfanew ); - sec = (IMAGE_SECTION_HEADER *)((char *)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader); + sec = IMAGE_FIRST_SECTION( nt ); for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++) { diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 078fe1c30a9..94e68edab77 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2608,7 +2608,7 @@ static NTSTATUS map_image_into_view( struct file_view *view, const WCHAR *filena int i; off_t pos; struct stat st; - char *header_end, *header_start; + char *header_end; char *ptr = view->base; SIZE_T header_size, total_size = view->size; @@ -2626,12 +2626,12 @@ static NTSTATUS map_image_into_view( struct file_view *view, const WCHAR *filena header_end = ptr + ROUND_SIZE( 0, header_size ); memset( ptr + header_size, 0, header_end - (ptr + header_size) ); if ((char *)(nt + 1) > header_end) return status; - header_start = (char*)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader; if (nt->FileHeader.NumberOfSections > ARRAY_SIZE( sections )) return status; - if (header_start + sizeof(*sections) * nt->FileHeader.NumberOfSections > header_end) return status; + sec = IMAGE_FIRST_SECTION( nt ); + if ((char *)(sec + nt->FileHeader.NumberOfSections) > header_end) return status; /* Some applications (e.g. the Steam version of Borderlands) map over the top of the section headers, * copying the headers into local memory is necessary to properly load such applications. */ - memcpy(sections, header_start, sizeof(*sections) * nt->FileHeader.NumberOfSections); + memcpy(sections, sec, sizeof(*sections) * nt->FileHeader.NumberOfSections); sec = sections; imports = nt->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_IMPORT; @@ -3297,7 +3297,7 @@ NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_nam /* The PE header is always read-only, no write, no execute. */ set_page_vprot( base, page_size, VPROT_COMMITTED | VPROT_READ ); - sec = (IMAGE_SECTION_HEADER *)((char *)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader); + sec = IMAGE_FIRST_SECTION( nt ); for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { BYTE flags = VPROT_COMMITTED; diff --git a/include/winnt.h b/include/winnt.h index d4137a64aea..df0c3282f8c 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -2927,8 +2927,7 @@ typedef struct _IMAGE_SECTION_HEADER { #define IMAGE_SIZEOF_SECTION_HEADER 40 #define IMAGE_FIRST_SECTION(ntheader) \ - ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \ - ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader)) + ((PIMAGE_SECTION_HEADER)((ULONG_PTR)&(ntheader)->OptionalHeader + (ntheader)->FileHeader.SizeOfOptionalHeader)) /* These defines are for the Characteristics bitfield. */ /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1
0
0
0
Alexandre Julliard : winedump: Don't zero out the PE optional header regardless of specified size.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: af25f29cd2406e524b0c5f4aecddfc095de34d2e URL:
https://gitlab.winehq.org/wine/wine/-/commit/af25f29cd2406e524b0c5f4aecddfc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 25 11:37:31 2023 +0200 winedump: Don't zero out the PE optional header regardless of specified size. --- tools/winedump/lib.c | 2 +- tools/winedump/pe.c | 17 ++++++++--------- tools/winedump/winedump.h | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/winedump/lib.c b/tools/winedump/lib.c index e2d25b04d24..0b94adb9b33 100644 --- a/tools/winedump/lib.c +++ b/tools/winedump/lib.c @@ -264,7 +264,7 @@ void lib_dump(void) if (fh->SizeOfOptionalHeader) { const IMAGE_OPTIONAL_HEADER32 *oh = (const IMAGE_OPTIONAL_HEADER32 *)((const char *)fh + sizeof(*fh)); - dump_optional_header(oh, fh->SizeOfOptionalHeader); + dump_optional_header(oh); } } /* Sanity check */ diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index fbcd9f5c6a5..f361e1d86bd 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -275,14 +275,14 @@ static inline void print_datadirectory(DWORD n, const IMAGE_DATA_DIRECTORY *dire } } -static void dump_optional_header32(const IMAGE_OPTIONAL_HEADER32 *image_oh, UINT header_size) +static void dump_optional_header32(const IMAGE_OPTIONAL_HEADER32 *image_oh) { IMAGE_OPTIONAL_HEADER32 oh; const IMAGE_OPTIONAL_HEADER32 *optionalHeader; /* in case optional header is missing or partial */ memset(&oh, 0, sizeof(oh)); - memcpy(&oh, image_oh, min(header_size, sizeof(oh))); + memcpy(&oh, image_oh, min(dump_total_len - ((char *)image_oh - (char *)dump_base), sizeof(oh))); optionalHeader = &oh; print_word("Magic", optionalHeader->Magic); @@ -320,14 +320,14 @@ static void dump_optional_header32(const IMAGE_OPTIONAL_HEADER32 *image_oh, UINT printf("\n"); } -static void dump_optional_header64(const IMAGE_OPTIONAL_HEADER64 *image_oh, UINT header_size) +static void dump_optional_header64(const IMAGE_OPTIONAL_HEADER64 *image_oh) { IMAGE_OPTIONAL_HEADER64 oh; const IMAGE_OPTIONAL_HEADER64 *optionalHeader; /* in case optional header is missing or partial */ memset(&oh, 0, sizeof(oh)); - memcpy(&oh, image_oh, min(header_size, sizeof(oh))); + memcpy(&oh, image_oh, min(dump_total_len - ((char *)image_oh - (char *)dump_base), sizeof(oh))); optionalHeader = &oh; print_word("Magic", optionalHeader->Magic); @@ -364,16 +364,16 @@ static void dump_optional_header64(const IMAGE_OPTIONAL_HEADER64 *image_oh, UINT printf("\n"); } -void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *optionalHeader, UINT header_size) +void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *optionalHeader) { printf("Optional Header (%s)\n", get_magic_type(optionalHeader->Magic)); switch(optionalHeader->Magic) { case IMAGE_NT_OPTIONAL_HDR32_MAGIC: - dump_optional_header32(optionalHeader, header_size); + dump_optional_header32(optionalHeader); break; case IMAGE_NT_OPTIONAL_HDR64_MAGIC: - dump_optional_header64((const IMAGE_OPTIONAL_HEADER64 *)optionalHeader, header_size); + dump_optional_header64((const IMAGE_OPTIONAL_HEADER64 *)optionalHeader); break; default: printf(" Unknown optional header magic: 0x%-4X\n", optionalHeader->Magic); @@ -428,8 +428,7 @@ void dump_file_header(const IMAGE_FILE_HEADER *fileHeader, BOOL is_hybrid) static void dump_pe_header(void) { dump_file_header(&PE_nt_headers->FileHeader, get_hybrid_metadata() != NULL); - dump_optional_header((const IMAGE_OPTIONAL_HEADER32*)&PE_nt_headers->OptionalHeader, - PE_nt_headers->FileHeader.SizeOfOptionalHeader); + dump_optional_header((const IMAGE_OPTIONAL_HEADER32*)&PE_nt_headers->OptionalHeader); } void dump_section_characteristics(DWORD characteristics, const char* sep) diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index fe1acca7976..e2b3f7b1ca6 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -233,7 +233,7 @@ const char* get_unicode_str( const WCHAR *str, int len ); const char* get_symbol_str(const char* symname); void print_fake_dll(void); void dump_file_header(const IMAGE_FILE_HEADER *, BOOL); -void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT); +void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *); void dump_section(const IMAGE_SECTION_HEADER *, const char* strtable); void dump_section_characteristics(DWORD characteristics, const char* sep);
1
0
0
0
Alexandre Julliard : server: Don't zero out the PE optional header regardless of specified size.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 4d417076e4378efb613f8519fdc57119fb1df635 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4d417076e4378efb613f8519fdc571…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Sep 25 11:01:29 2023 +0200 server: Don't zero out the PE optional header regardless of specified size. --- dlls/kernel32/tests/loader.c | 17 ++++++++--------- server/mapping.c | 27 ++++++++++++++------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index e360c24ee63..0d611990fd4 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -144,13 +144,13 @@ static const IMAGE_NT_HEADERS nt_header_template = sizeof(dos_header) + sizeof(nt_header_template), /* SizeOfHeaders */ 0, /* CheckSum */ IMAGE_SUBSYSTEM_WINDOWS_CUI, /* Subsystem */ - 0, /* DllCharacteristics */ - 0, /* SizeOfStackReserve */ - 0, /* SizeOfStackCommit */ - 0, /* SizeOfHeapReserve */ - 0, /* SizeOfHeapCommit */ + IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT, /* DllCharacteristics */ + 0x100000, /* SizeOfStackReserve */ + 0x1000, /* SizeOfStackCommit */ + 0x100000, /* SizeOfHeapReserve */ + 0x1000, /* SizeOfHeapCommit */ 0, /* LoaderFlags */ - 0, /* NumberOfRvaAndSizes */ + IMAGE_NUMBEROF_DIRECTORY_ENTRIES, /* NumberOfRvaAndSizes */ { { 0 } } /* DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] */ } }; @@ -401,7 +401,6 @@ static BOOL query_image_section( int id, const char *dll_name, const IMAGE_NT_HE "%u: MaximumStackSize wrong %Ix / %Ix\n", id, image.MaximumStackSize, max_stack ); ok( image.CommittedStackSize == commit_stack, "%u: CommittedStackSize wrong %Ix / %Ix\n", id, image.CommittedStackSize, commit_stack ); - todo_wine_if( truncated ) ok( image.SubSystemType == nt_header->OptionalHeader.Subsystem, "%u: SubSystemType wrong %08lx / %08x\n", id, image.SubSystemType, nt_header->OptionalHeader.Subsystem ); @@ -481,7 +480,7 @@ static BOOL query_image_section( int id, const char *dll_name, const IMAGE_NT_HE if (!(nt_header->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)) ok( !image.ImageDynamicallyRelocated || broken( image.ComPlusILOnly ), /* <= win7 */ "%u: wrong ImageDynamicallyRelocated flags %02x\n", id, image.ImageFlags ); - else if (image.ImageContainsCode && !cor_header) + else if (image.ImageContainsCode && !image.ImageMappedFlat && !cor_header) ok( image.ImageDynamicallyRelocated, "%u: wrong ImageDynamicallyRelocated flags %02x\n", id, image.ImageFlags ); else @@ -866,7 +865,7 @@ static void test_Loader(void) { 0x04, 0, 0x08, 0x04 /* also serves as e_lfanew in the truncated MZ header */, 0x04, - 0x200000, + 0x2000, 0x40, { ERROR_SUCCESS } } diff --git a/server/mapping.c b/server/mapping.c index 5d4df2050e4..0a69261c0ee 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -695,8 +695,8 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s } opt; } nt; off_t pos; - int size, opt_size; - size_t mz_size, clr_va, clr_size; + int size; + size_t mz_size, clr_va = 0, clr_size = 0; unsigned int i; /* load the headers */ @@ -710,9 +710,6 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s size = pread( unix_fd, &nt, sizeof(nt), pos ); if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_PROTECT; - /* zero out Optional header in the case it's not present or partial */ - opt_size = max( nt.FileHeader.SizeOfOptionalHeader, offsetof( IMAGE_OPTIONAL_HEADER32, CheckSum )); - size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + opt_size ); if (size < sizeof(nt)) memset( (char *)&nt + size, 0, sizeof(nt) - size ); if (nt.Signature != IMAGE_NT_SIGNATURE) { @@ -729,9 +726,11 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s if (!is_machine_32bit( nt.FileHeader.Machine )) return STATUS_INVALID_IMAGE_FORMAT; if (!is_machine_supported( nt.FileHeader.Machine )) return STATUS_INVALID_IMAGE_FORMAT; - clr_va = nt.opt.hdr32.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; - clr_size = nt.opt.hdr32.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; - + if (nt.opt.hdr32.NumberOfRvaAndSizes > IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR) + { + clr_va = nt.opt.hdr32.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; + clr_size = nt.opt.hdr32.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; + } mapping->image.base = nt.opt.hdr32.ImageBase; mapping->image.entry_point = nt.opt.hdr32.AddressOfEntryPoint; mapping->image.map_size = ROUND_SIZE( nt.opt.hdr32.SizeOfImage ); @@ -751,7 +750,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s mapping->image.image_flags = 0; if (nt.opt.hdr32.SectionAlignment & page_mask) mapping->image.image_flags |= IMAGE_FLAGS_ImageMappedFlat; - if ((nt.opt.hdr32.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) && + else if ((nt.opt.hdr32.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) && mapping->image.contains_code && !(clr_va && clr_size)) mapping->image.image_flags |= IMAGE_FLAGS_ImageDynamicallyRelocated; break; @@ -761,9 +760,11 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s if (!is_machine_64bit( nt.FileHeader.Machine )) return STATUS_INVALID_IMAGE_FORMAT; if (!is_machine_supported( nt.FileHeader.Machine )) return STATUS_INVALID_IMAGE_FORMAT; - clr_va = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; - clr_size = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; - + if (nt.opt.hdr64.NumberOfRvaAndSizes > IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR) + { + clr_va = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; + clr_size = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; + } mapping->image.base = nt.opt.hdr64.ImageBase; mapping->image.entry_point = nt.opt.hdr64.AddressOfEntryPoint; mapping->image.map_size = ROUND_SIZE( nt.opt.hdr64.SizeOfImage ); @@ -783,7 +784,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s mapping->image.image_flags = 0; if (nt.opt.hdr64.SectionAlignment & page_mask) mapping->image.image_flags |= IMAGE_FLAGS_ImageMappedFlat; - if ((nt.opt.hdr64.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) && + else if ((nt.opt.hdr64.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) && mapping->image.contains_code && !(clr_va && clr_size)) mapping->image.image_flags |= IMAGE_FLAGS_ImageDynamicallyRelocated; break;
1
0
0
0
Jactry Zeng : cabinet/tests: Initialize CURR_DIR globally.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 316b5bc9b3e5aa39da05397523bd8e26e0b17170 URL:
https://gitlab.winehq.org/wine/wine/-/commit/316b5bc9b3e5aa39da05397523bd8e…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Mon Sep 25 02:15:09 2023 -0500 cabinet/tests: Initialize CURR_DIR globally. So that we can run each test function independently. --- dlls/cabinet/tests/fdi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dlls/cabinet/tests/fdi.c b/dlls/cabinet/tests/fdi.c index a44f9eeae2d..9cd7a1e93bf 100644 --- a/dlls/cabinet/tests/fdi.c +++ b/dlls/cabinet/tests/fdi.c @@ -409,13 +409,6 @@ static void createTestFile(const CHAR *name) static void create_test_files(void) { - DWORD len; - - len = GetCurrentDirectoryA(MAX_PATH, CURR_DIR); - - if(len && (CURR_DIR[len-1] == '\\')) - CURR_DIR[len-1] = 0; - createTestFile("a.txt"); createTestFile("b.txt"); CreateDirectoryA("testdir", NULL); @@ -944,6 +937,12 @@ static void test_FDICopy(void) START_TEST(fdi) { + int len; + + len = GetCurrentDirectoryA(MAX_PATH, CURR_DIR); + if (len && (CURR_DIR[len - 1] == '\\')) + CURR_DIR[len - 1] = 0; + test_FDICreate(); test_FDIDestroy(); test_FDIIsCabinet();
1
0
0
0
Alex Henrie : wpcap: Use the strdup function instead of reimplementing it.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 535123c96365420d7780ed624ee0e40d3bb383ab URL:
https://gitlab.winehq.org/wine/wine/-/commit/535123c96365420d7780ed624ee0e4…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Sun Sep 24 11:54:03 2023 -0600 wpcap: Use the strdup function instead of reimplementing it. --- dlls/wpcap/wpcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wpcap/wpcap.c b/dlls/wpcap/wpcap.c index b96e940c024..6ad4fc5f04f 100644 --- a/dlls/wpcap/wpcap.c +++ b/dlls/wpcap/wpcap.c @@ -859,7 +859,7 @@ char * CDECL pcap_lookupdev( char *errbuf ) if (!ret) { if (pcap_findalldevs( &devs, errbuf ) == PCAP_ERROR || !devs) return NULL; - if ((ret = malloc( strlen(devs->name) + 1 ))) strcpy( ret, devs->name ); + ret = strdup( devs->name ); pcap_freealldevs( devs ); } return ret;
1
0
0
0
Alex Henrie : avifil32: Use CRT allocation functions.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 6b7689cbae1322638ed9eda207f6056586208e1f URL:
https://gitlab.winehq.org/wine/wine/-/commit/6b7689cbae1322638ed9eda207f605…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Aug 22 21:49:38 2023 -0600 avifil32: Use CRT allocation functions. --- dlls/avifil32/acmstream.c | 36 ++++++-------- dlls/avifil32/api.c | 68 ++++++++++++------------- dlls/avifil32/avifile.c | 121 ++++++++++++++++++--------------------------- dlls/avifil32/editstream.c | 24 +++++---- dlls/avifil32/extrachunk.c | 12 +---- dlls/avifil32/factory.c | 4 +- dlls/avifil32/getframe.c | 17 +++---- dlls/avifil32/icmstream.c | 32 ++++++------ dlls/avifil32/tmpfile.c | 8 +-- dlls/avifil32/wavfile.c | 24 ++++----- 10 files changed, 151 insertions(+), 195 deletions(-)
1
0
0
0
Alex Henrie : wordpad: Use the wcsdup function instead of reimplementing it.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: 4059c6ece270f565248da25549c4ced51bcd03b3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4059c6ece270f565248da25549c4ce…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Sun Sep 24 12:31:24 2023 -0600 wordpad: Use the wcsdup function instead of reimplementing it. --- programs/wordpad/wordpad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index ed55a1d2268..042cc04f4ad 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -627,8 +627,7 @@ static void add_font(struct font_array *fonts, LPCWSTR fontName, DWORD fontType, fontHeight = ntmc->ntmTm.tmHeight - ntmc->ntmTm.tmInternalLeading; idx = fonts->count; - fonts->fonts[idx].name = malloc((lstrlenW(fontName) + 1)*sizeof(WCHAR) ); - lstrcpyW( fonts->fonts[idx].name, fontName ); + fonts->fonts[idx].name = wcsdup(fontName); fonts->fonts[idx].lParam = MAKELONG(fontType, fontHeight); fonts->count++;
1
0
0
0
Alex Henrie : sc: Use CRT allocation functions.
by Alexandre Julliard
25 Sep '23
25 Sep '23
Module: wine Branch: master Commit: e130ef40a12cb3040a4b6c62f22c75ce2bdb0da8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/e130ef40a12cb3040a4b6c62f22c75…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Sun Sep 24 12:26:44 2023 -0600 sc: Use CRT allocation functions. --- programs/sc/sc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/programs/sc/sc.c b/programs/sc/sc.c index bd7e093b61d..d1954da1493 100644 --- a/programs/sc/sc.c +++ b/programs/sc/sc.c @@ -135,10 +135,9 @@ static BOOL parse_failure_actions( const WCHAR *arg, SERVICE_FAILURE_ACTIONSW *f unsigned int i, count; WCHAR *actions, *p; - actions = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( arg ) + 1) * sizeof(WCHAR) ); + actions = wcsdup( arg ); if (!actions) return FALSE; - lstrcpyW( actions, arg ); for (p = actions, count = 0; *p; p++) { if (*p == '/') @@ -150,10 +149,10 @@ static BOOL parse_failure_actions( const WCHAR *arg, SERVICE_FAILURE_ACTIONSW *f count = count / 2 + 1; fa->cActions = count; - fa->lpsaActions = HeapAlloc( GetProcessHeap(), 0, fa->cActions * sizeof(SC_ACTION) ); + fa->lpsaActions = malloc( fa->cActions * sizeof(SC_ACTION) ); if (!fa->lpsaActions) { - HeapFree( GetProcessHeap(), 0, actions ); + free( actions ); return FALSE; } @@ -170,7 +169,7 @@ static BOOL parse_failure_actions( const WCHAR *arg, SERVICE_FAILURE_ACTIONSW *f p += lstrlenW( p ) + 1; } - HeapFree( GetProcessHeap(), 0, actions ); + free( actions ); return TRUE; } @@ -333,7 +332,7 @@ int __cdecl wmain( int argc, const WCHAR *argv[] ) { ret = ChangeServiceConfig2W( service, SERVICE_CONFIG_FAILURE_ACTIONS, &sfa ); if (!ret) WINE_ERR("failed to set service failure actions %lu\n", GetLastError()); - HeapFree( GetProcessHeap(), 0, sfa.lpsaActions ); + free( sfa.lpsaActions ); } else WINE_ERR("failed to parse failure parameters\n");
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
92
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
Results per page:
10
25
50
100
200