Commit 1bc72fb6 authored by Alexandre Julliard's avatar Alexandre Julliard

cabinet: Use the correct create disposition in fdi_open.

parent d5ff7282
...@@ -84,7 +84,7 @@ static INT_PTR fdi_open(char *pszFile, int oflag, int pmode) ...@@ -84,7 +84,7 @@ static INT_PTR fdi_open(char *pszFile, int oflag, int pmode)
HANDLE handle; HANDLE handle;
DWORD dwAccess = 0; DWORD dwAccess = 0;
DWORD dwShareMode = 0; DWORD dwShareMode = 0;
DWORD dwCreateDisposition = OPEN_EXISTING; DWORD dwCreateDisposition;
switch (oflag & _O_ACCMODE) switch (oflag & _O_ACCMODE)
{ {
...@@ -102,10 +102,17 @@ static INT_PTR fdi_open(char *pszFile, int oflag, int pmode) ...@@ -102,10 +102,17 @@ static INT_PTR fdi_open(char *pszFile, int oflag, int pmode)
break; break;
} }
if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES) if (oflag & _O_CREAT)
dwCreateDisposition = OPEN_EXISTING; {
dwCreateDisposition = OPEN_ALWAYS;
if (oflag & _O_EXCL) dwCreateDisposition = CREATE_NEW;
else if (oflag & _O_TRUNC) dwCreateDisposition = CREATE_ALWAYS;
}
else else
dwCreateDisposition = CREATE_NEW; {
dwCreateDisposition = OPEN_EXISTING;
if (oflag & _O_TRUNC) dwCreateDisposition = TRUNCATE_EXISTING;
}
handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL, handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
dwCreateDisposition, 0, NULL); dwCreateDisposition, 0, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment