https://bugs.winehq.org/show_bug.cgi?id=41258
Yujiang Wang alaniwbft@outlook.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alaniwbft@outlook.com
--- Comment #17 from Yujiang Wang alaniwbft@outlook.com --- After debugging with my UE4 build, I found the bug is related to EnumDisplayDevicesW:
The engine uses an ugly way to get the device name for monitors. It extracts the name from the device id by finding a second backslash starting from position 8: Engine\Source\Runtime\Core\Private\Windows\WindowsApplication.cpp: GetMonitorsInfo: 611 Info.ID = FString::Printf(TEXT("%s"), Monitor.DeviceID); Info.Name = Info.ID.Mid (8, Info.ID.Find (TEXT("\"), ESearchCase::CaseSensitive, ESearchDir::FromStart, 9) - 8);
The Monitor.DeviceID comes from EnumDisplayDevices(DisplayDevice.DeviceName, MonitorIndex, &Monitor, 0)
On Windows, Monitor.DeviceID is set to something like: MONITOR\HWP3183{4d36e96e-e325-11ce-bfc1-08002be10318}\0001 while wine set it to: MONITOR\WINE0000
Clearly we can see there is no second backslash to be found, thus causing a crash.
The device id is defined at:
wine-staging/patches/gdi32-MultiMonitor/0003-user32-Implement-EnumDisplayDevicesW-based-on-EnumDi.patch: 29 +static const WCHAR display_device_deviceid[] = {'M','O','N','I','T','O','R','\','W','I','N','E','%','0','4','d',0};
I changed it by just adding a backslash:
+static const WCHAR display_device_deviceid[] = {'M','O','N','I','T','O','R','\','W','I','N','E','%','0','4','d','\',0};
Now the engine gets through. Maybe we can fake a guid here to get more robustness?
I also prepared a minimal unreal engine 4 project build for you: (UE4 master branch 4.17 2017-05-22 VS2015 Windows 10) https://www.dropbox.com/s/2g2tl7gz7bsiop5/WineTest.7z?dl=0 This build comes along with pdb files. I think it will be useful for you.
Good luck!