http://bugs.winehq.org/show_bug.cgi?id=1142
------- Additional Comments From wine@deesconsulting.com 2004-12-10 12:10 ------- Upon further investigation, this is what I have found:
The main function for opening/creating files in Windows is NtCreateFile(). This function calls SERVER_START_REQ( create_file ) which tells the wine server to open/create a file. The function DECL_HANDLER(create_file) handles this request in the wine server by calling the create_file() function. create_file() calls open_fd(). open_fd() calls check_sharing().
check_sharing() seems to be the broken function in question. From a cursory investigation, this function seems to only check for cached file locks within the wine environment. check_sharing() does not call fcntl() to check for filesystem locks in Linux. Thus, locks set by the wine server with lock_fd() upon calling NtLockFile() are not checked upon file open.
Based on my previous post, I'm assuming that Windows normally enforces mandatory file locking upon opening a file with NtCreateFile(). This assumption could be wrong, but it explains the behaviour seen and seems to be backed up.
Now the question becomes "what error/status should the wine server return to the program upon opening a locked file?"