Alexandre Julliard : cabinet:
Use the correct create disposition in fdi_open.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Aug 22 06:23:26 CDT 2007
Module: wine
Branch: master
Commit: 1bc72fb6da2e86c2323de6273034580882059e67
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1bc72fb6da2e86c2323de6273034580882059e67
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Aug 22 11:55:01 2007 +0200
cabinet: Use the correct create disposition in fdi_open.
---
dlls/cabinet/cabinet_main.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/cabinet/cabinet_main.c b/dlls/cabinet/cabinet_main.c
index 4cea2a1..6483a3f 100644
--- a/dlls/cabinet/cabinet_main.c
+++ b/dlls/cabinet/cabinet_main.c
@@ -84,7 +84,7 @@ static INT_PTR fdi_open(char *pszFile, int oflag, int pmode)
HANDLE handle;
DWORD dwAccess = 0;
DWORD dwShareMode = 0;
- DWORD dwCreateDisposition = OPEN_EXISTING;
+ DWORD dwCreateDisposition;
switch (oflag & _O_ACCMODE)
{
@@ -102,10 +102,17 @@ static INT_PTR fdi_open(char *pszFile, int oflag, int pmode)
break;
}
- if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
- dwCreateDisposition = OPEN_EXISTING;
+ if (oflag & _O_CREAT)
+ {
+ dwCreateDisposition = OPEN_ALWAYS;
+ if (oflag & _O_EXCL) dwCreateDisposition = CREATE_NEW;
+ else if (oflag & _O_TRUNC) dwCreateDisposition = CREATE_ALWAYS;
+ }
else
- dwCreateDisposition = CREATE_NEW;
+ {
+ dwCreateDisposition = OPEN_EXISTING;
+ if (oflag & _O_TRUNC) dwCreateDisposition = TRUNCATE_EXISTING;
+ }
handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
dwCreateDisposition, 0, NULL);
More information about the wine-cvs
mailing list