https://bugs.winehq.org/show_bug.cgi?id=56968
--- Comment #4 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Fabian Maurer from comment #3)
Created attachment 76798 [details] Hack to work around the issue
Attaching a dirty hack that should make it work.
+ void *ptr = &sec[i].VirtualAddress; Looks like a typo, '&' should not be needed.
Does your hack work if it's only done at the end of perform_relocations()? Probably when relocating a PE image the loader is also supposed to fix up VirtualAddress field in every section in the sections table.
Also NtProtectVirtualMemory() probably should be called only for the section table, not for every random section in the PE binary.