Robert Shearman : msi: The szLogFile parameter of MsiEnableLogW is optional , so handle the case of it being NULL.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 24 06:55:14 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: c0596e0ae91ee942dac6c5a8891000093c9aa3ae
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=c0596e0ae91ee942dac6c5a8891000093c9aa3ae

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon Jul 24 11:45:50 2006 +0100

msi: The szLogFile parameter of MsiEnableLogW is optional, so handle the case of it being NULL.

---

 dlls/msi/msi.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index f8bd963..7e4bae3 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -632,15 +632,20 @@ UINT WINAPI MsiEnableLogW(DWORD dwLogMod
 
     TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_w(szLogFile), attributes);
 
-    lstrcpyW(gszLogFile,szLogFile);
-    if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
-        DeleteFileW(szLogFile);
-    file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
-                           FILE_ATTRIBUTE_NORMAL, NULL);
-    if (file != INVALID_HANDLE_VALUE)
-        CloseHandle(file);
+    if (szLogFile)
+    {
+        lstrcpyW(gszLogFile,szLogFile);
+        if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
+            DeleteFileW(szLogFile);
+        file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
+                               FILE_ATTRIBUTE_NORMAL, NULL);
+        if (file != INVALID_HANDLE_VALUE)
+            CloseHandle(file);
+        else
+            ERR("Unable to enable log %s\n",debugstr_w(szLogFile));
+    }
     else
-        ERR("Unable to enable log %s\n",debugstr_w(szLogFile));
+        gszLogFile[0] = '\0';
 
     return ERROR_SUCCESS;
 }




More information about the wine-cvs mailing list