https://bugs.winehq.org/show_bug.cgi?id=42982
--- Comment #7 from Toni eldrad@autistici.org --- I have investigated this error and found out these are the relevant error lines:
0009:Call KERNEL32.CreateFileA(0033fb48 "C:\users\user\My Documents/Bayonetta/system_data",80000000,00000000,00000000,00000003,40000080,00000000) ret=00c7dff4 0009:Ret KERNEL32.CreateFileA() retval=00000190 ret=00c7dff4 (...) 0009:Call KERNEL32.ReadFile(00000190,066c9e60,00000690,00000000,05ba3544) ret=00c7e040 0009:Ret KERNEL32.ReadFile() retval=00000001 ret=00c7e040 0009:Call KERNEL32.GetLastError() ret=00c7e046 0009:Ret KERNEL32.GetLastError() retval=00000000 ret=00c7e046 (...) 0009:Call msvcr100.vswprintf_s(05b85690,00000200,00e712bc L"Failed to read save data.",0033fc50) ret=00c71c9e
Turns out the program is launching an asynchronous operation on file read, and badly checking error conditions, it seems to only accept the operation as correct if it sees LastError set to STATUS_PENDING. The root error is because wine doesn't respect the async command and just performs all file/reads in sync manner.
Attached two alternative patches fixing the issue for bayonetta. The first one just sets the error to STATUS_PENDING even if the operation is done synchronous, this seems to allow the application to continue and indeed read/write the files. The second alternative actually runs the read/writes asynchronously through wineserver.