Added patch to implement SetupLogError[A|W] and Setup[Open|Close]Log.

This commit is contained in:
Sebastian Lackner 2015-03-20 22:52:47 +01:00
parent c5f0106cd6
commit e2c1e62662
6 changed files with 401 additions and 16 deletions

View File

@ -38,7 +38,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [15]:**
**Bugfixes and features included in the next upcoming release [16]:**
* Add stub for PowerCreateRequest
* Add stub for wininet.ParseX509EncodedCertificateForListBoxEntry ([Wine Bug #29842](https://bugs.winehq.org/show_bug.cgi?id=29842))
@ -50,6 +50,7 @@ Included bug fixes and improvements
* Fix wrong version of ID3DXEffect interface for d3dx9_24
* Fix wrong version of ID3DXEffect interface for d3dx9_25 ([Wine Bug #25138](https://bugs.winehq.org/show_bug.cgi?id=25138))
* GetMessage should remove already seen messages with higher priority ([Wine Bug #28884](https://bugs.winehq.org/show_bug.cgi?id=28884))
* Implement SetupLogError[A|W] and Setup[Open|Close]Log
* Implement combase.WindowsSubstring function
* Implement locking and synchronization of key states ([Wine Bug #31899](https://bugs.winehq.org/show_bug.cgi?id=31899))
* Improve stub for ID3DXEffectImpl_CloneEffect

1
debian/changelog vendored
View File

@ -27,6 +27,7 @@ wine-staging (1.7.39) UNRELEASED; urgency=low
* Added patch to allow to edit winecfg library override by double clicking.
* Added patch to fix regression causing too dark/missing textures in several games.
* Added patch to fix regression causing black screen on startup.
* Added patch to implement SetupLogError[A|W] and Setup[Open|Close]Log.
* Removed patch to avoid hardcoded values for sizeof(GUID) (accepted upstream).
* Removed patches for SLGetWindowsInformationDWORD (accepted upstream).
* Removed patches for _ismbckata and _mbctohira (fixed upstream).

View File

@ -181,6 +181,7 @@ patch_enable_all ()
enable_server_Shared_Memory="$1"
enable_server_Stored_ACLs="$1"
enable_server_Unexpected_Wakeup="$1"
enable_setupapi_SetupLog="$1"
enable_setupapi_SetupPromptForDisk="$1"
enable_shdocvw_ParseURLFromOutsideSource_Tests="$1"
enable_shell32_Default_Folder_ACLs="$1"
@ -602,6 +603,9 @@ patch_enable ()
server-Unexpected_Wakeup)
enable_server_Unexpected_Wakeup="$2"
;;
setupapi-SetupLog)
enable_setupapi_SetupLog="$2"
;;
setupapi-SetupPromptForDisk)
enable_setupapi_SetupPromptForDisk="$2"
;;
@ -1855,6 +1859,18 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
# | * dlls/wined3d/state.c
# |
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Multisampling
# |
# | This patchset fixes the following Wine bugs:
@ -1919,18 +1935,6 @@ if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
# | * dlls/wined3d/state.c
# |
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset fixes the following Wine bugs:
@ -3863,6 +3867,19 @@ if test "$enable_server_Unexpected_Wakeup" -eq 1; then
) >> "$patchlist"
fi
# Patchset setupapi-SetupLog
# |
# | Modified files:
# | * dlls/setupapi/Makefile.in, dlls/setupapi/log.c, dlls/setupapi/setupapi.spec, dlls/setupapi/setupcab.c,
# | dlls/setupapi/stubs.c, dlls/setupapi/tests/Makefile.in, dlls/setupapi/tests/log.c
# |
if test "$enable_setupapi_SetupLog" -eq 1; then
patch_apply setupapi-SetupLog/0001-setupapi-Implement-SetupOpenLog-SetupLogErrorA-Setup.patch
(
echo '+ { "Pierre Schweitzer", "setupapi: Implement SetupOpenLog(), SetupLogErrorA(), SetupLogErrorW(), SetupCloseLog().", 1 },';
) >> "$patchlist"
fi
# Patchset setupapi-SetupPromptForDisk
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,367 @@
From 8cf2c00710e8883fb7d05ca0b6d580776fe6d0f7 Mon Sep 17 00:00:00 2001
From: Pierre Schweitzer <pierre@reactos.org>
Date: Thu, 12 Mar 2015 17:56:06 +0100
Subject: setupapi: Implement SetupOpenLog(), SetupLogErrorA(),
SetupLogErrorW(), SetupCloseLog()
---
dlls/setupapi/Makefile.in | 1 +
dlls/setupapi/log.c | 182 ++++++++++++++++++++++++++++++++++++++++
dlls/setupapi/setupapi.spec | 2 +-
dlls/setupapi/setupcab.c | 1 +
dlls/setupapi/stubs.c | 26 ------
dlls/setupapi/tests/Makefile.in | 1 +
dlls/setupapi/tests/log.c | 68 +++++++++++++++
7 files changed, 254 insertions(+), 27 deletions(-)
create mode 100644 dlls/setupapi/log.c
create mode 100644 dlls/setupapi/tests/log.c
diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in
index bf157cb..030b2d3 100644
--- a/dlls/setupapi/Makefile.in
+++ b/dlls/setupapi/Makefile.in
@@ -11,6 +11,7 @@ C_SRCS = \
diskspace.c \
fakedll.c \
install.c \
+ log.c \
misc.c \
parser.c \
query.c \
diff --git a/dlls/setupapi/log.c b/dlls/setupapi/log.c
new file mode 100644
index 0000000..d73085e
--- /dev/null
+++ b/dlls/setupapi/log.c
@@ -0,0 +1,182 @@
+/*
+ * SetupAPI logs functions
+ *
+ * Copyright 2015 Pierre Schweitzer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/debug.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "setupapi.h"
+#include "winnls.h"
+
+static HANDLE setupact = INVALID_HANDLE_VALUE;
+static HANDLE setuperr = INVALID_HANDLE_VALUE;
+static CRITICAL_SECTION setupapi_cs;
+static CRITICAL_SECTION_DEBUG critsect_debug =
+{
+ 0, 0, &setupapi_cs,
+ { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": setupapi_cs") }
+};
+static CRITICAL_SECTION setupapi_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
+
+/***********************************************************************
+ * SetupCloseLog(SETUPAPI.@)
+ */
+void WINAPI SetupCloseLog(void)
+{
+ EnterCriticalSection(&setupapi_cs);
+
+ if (setupact != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(setupact);
+ setupact = INVALID_HANDLE_VALUE;
+ }
+
+ if (setuperr != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(setuperr);
+ setuperr = INVALID_HANDLE_VALUE;
+ }
+
+ LeaveCriticalSection(&setupapi_cs);
+}
+
+/***********************************************************************
+ * SetupLogErrorA(SETUPAPI.@)
+ */
+BOOL WINAPI SetupLogErrorA(LPCSTR message, LogSeverity severity)
+{
+ static const CHAR null[] = "(null)";
+ DWORD written;
+ DWORD len;
+ BOOL ret;
+
+ EnterCriticalSection(&setupapi_cs);
+
+ if (setupact == INVALID_HANDLE_VALUE || setuperr == INVALID_HANDLE_VALUE)
+ {
+ SetLastError(ERROR_FILE_INVALID);
+ ret = FALSE;
+ goto done;
+ }
+
+ if (message == NULL)
+ message = null;
+
+ len = lstrlenA(message) * sizeof(CHAR);
+ ret = WriteFile(setupact, message, len, &written, NULL);
+ if (!ret)
+ goto done;
+
+ if (severity >= LogSevMaximum)
+ {
+ ret = FALSE;
+ goto done;
+ }
+
+ if (severity > LogSevInformation)
+ ret = WriteFile(setuperr, message, len, &written, NULL);
+
+done:
+ LeaveCriticalSection(&setupapi_cs);
+ return ret;
+}
+
+/***********************************************************************
+ * SetupLogErrorW(SETUPAPI.@)
+ */
+BOOL WINAPI SetupLogErrorW(LPCWSTR message, LogSeverity severity)
+{
+ LPSTR msg = NULL;
+ DWORD len;
+ BOOL ret;
+
+ if (message)
+ {
+ len = WideCharToMultiByte(CP_ACP, 0, message, -1, NULL, 0, NULL, NULL);
+ msg = HeapAlloc(GetProcessHeap(), 0, len * sizeof(CHAR));
+ if (msg == NULL)
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+ WideCharToMultiByte(CP_ACP, 0, message, -1, msg, len, NULL, NULL);
+ }
+
+ /* This is the normal way to proceed. The log files are ASCII files
+ * and W is to be converted. */
+ ret = SetupLogErrorA(msg, severity);
+
+ if (msg)
+ HeapFree(GetProcessHeap(), 0, msg);
+
+ return ret;
+}
+
+/***********************************************************************
+ * SetupOpenLog(SETUPAPI.@)
+ */
+BOOL WINAPI SetupOpenLog(BOOL reserved)
+{
+ static const WCHAR setupactlog[] = {'\\','s','e','t','u','p','a','c','t','.','l','o','g',0};
+ static const WCHAR setuperrlog[] = {'\\','s','e','t','u','p','e','r','r','.','l','o','g',0};
+ WCHAR path[MAX_PATH];
+ WCHAR win[MAX_PATH];
+
+ EnterCriticalSection(&setupapi_cs);
+
+ if (setupact != INVALID_HANDLE_VALUE && setuperr != INVALID_HANDLE_VALUE)
+ {
+ LeaveCriticalSection(&setupapi_cs);
+ SetLastError(ERROR_ALREADY_INITIALIZED);
+ return TRUE;
+ }
+
+ GetWindowsDirectoryW(win, MAX_PATH);
+
+ lstrcpyW(path, win);
+ lstrcatW(path, setupactlog);
+ setupact = CreateFileW(path, FILE_GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
+ NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (setupact == INVALID_HANDLE_VALUE)
+ {
+ LeaveCriticalSection(&setupapi_cs);
+ return FALSE;
+ }
+ SetFilePointer(setupact, 0, NULL, FILE_END);
+
+ lstrcpyW(path, win);
+ lstrcatW(path, setuperrlog);
+ setuperr = CreateFileW(path, FILE_GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
+ NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (setuperr == INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(setupact);
+ setupact = INVALID_HANDLE_VALUE;
+ LeaveCriticalSection(&setupapi_cs);
+ return FALSE;
+ }
+ SetFilePointer(setuperr, 0, NULL, FILE_END);
+
+ LeaveCriticalSection(&setupapi_cs);
+ SetLastError(ERROR_ALREADY_EXISTS);
+ return TRUE;
+}
diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec
index 4fcf298..c1dbed5 100644
--- a/dlls/setupapi/setupapi.spec
+++ b/dlls/setupapi/setupapi.spec
@@ -459,7 +459,7 @@
@ stdcall SetupInstallServicesFromInfSectionW(long wstr long)
@ stdcall SetupIterateCabinetA(str long ptr ptr)
@ stdcall SetupIterateCabinetW(wstr long ptr ptr)
-@ stub SetupLogErrorA
+@ stdcall SetupLogErrorA(str long)
@ stdcall SetupLogErrorW(wstr long)
@ stdcall SetupLogFileA(ptr str str str long str str str long)
@ stdcall SetupLogFileW(ptr wstr wstr wstr long wstr wstr wstr long)
diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c
index 21336d7..54c0256 100644
--- a/dlls/setupapi/setupcab.c
+++ b/dlls/setupapi/setupcab.c
@@ -694,6 +694,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break;
case DLL_PROCESS_DETACH:
if (lpvReserved) break;
+ SetupCloseLog();
if (CABINET_hInstance) FreeLibrary(CABINET_hInstance);
break;
}
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 673bbbf..a57f5fe 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -189,32 +189,6 @@ BOOL WINAPI RegistryDelnode(DWORD x, DWORD y)
}
/***********************************************************************
- * SetupCloseLog(SETUPAPI.@)
- */
-void WINAPI SetupCloseLog(void)
-{
- FIXME("() stub\n");
-}
-
-/***********************************************************************
- * SetupLogErrorW(SETUPAPI.@)
- */
-BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity)
-{
- FIXME("(%s, %d) stub\n", debugstr_w(MessageString), Severity);
- return TRUE;
-}
-
-/***********************************************************************
- * SetupOpenLog(SETUPAPI.@)
- */
-BOOL WINAPI SetupOpenLog(BOOL Reserved)
-{
- FIXME("(%d) stub\n", Reserved);
- return TRUE;
-}
-
-/***********************************************************************
* SetupPromptReboot(SETUPAPI.@)
*/
INT WINAPI SetupPromptReboot( HSPFILEQ file_queue, HWND owner, BOOL scan_only )
diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
index 30902e7..32ce41f 100644
--- a/dlls/setupapi/tests/Makefile.in
+++ b/dlls/setupapi/tests/Makefile.in
@@ -6,4 +6,5 @@ C_SRCS = \
diskspace.c \
install.c \
+ log.c \
misc.c \
parser.c \
diff --git a/dlls/setupapi/tests/log.c b/dlls/setupapi/tests/log.c
new file mode 100644
index 0000000..5de009e
--- /dev/null
+++ b/dlls/setupapi/tests/log.c
@@ -0,0 +1,68 @@
+/*
+ * Unit tests for setupapi.dll log functions
+ *
+ * Copyright (C) 2015 Pierre Schweitzer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdio.h>
+#include <windows.h>
+#include <setupapi.h>
+#include "wine/test.h"
+
+static void test_SetupLogError(void)
+{
+ BOOL ret;
+ DWORD error;
+
+ SetLastError(0xdeadbeef);
+ ret = SetupLogErrorA("Test without opening\r\n", LogSevInformation);
+ error = GetLastError();
+ ok(!ret, "SetupLogError succeeded\n");
+ ok(error == ERROR_FILE_INVALID, "got wrong error: %d\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = SetupOpenLog(FALSE);
+ error = GetLastError();
+ ok(ret, "SetupOpenLog failed\n");
+ ok(error == ERROR_ALREADY_EXISTS, "got wrong error: %d\n", error); /* Even if log file didn't exist */
+
+ SetLastError(0xdeadbeef);
+ ret = SetupLogErrorA("Test with wrong log severity\r\n", LogSevMaximum);
+ error = GetLastError();
+ ok(!ret, "SetupLogError succeeded\n");
+ ok(error == 0xdeadbeef, "got wrong error: %d\n", error);
+ ret = SetupLogErrorA("Test without EOL", LogSevInformation);
+ ok(ret, "SetupLogError failed\n");
+
+ SetLastError(0xdeadbeef);
+ ret = SetupLogErrorA(NULL, LogSevInformation);
+ ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER /* Win Vista+ */),
+ "SetupLogError failed: %08x\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = SetupOpenLog(FALSE);
+ error = GetLastError();
+ ok(ret, "SetupOpenLog failed\n");
+ ok(error == ERROR_ALREADY_INITIALIZED, "got wrong error: %d\n", error);
+
+ SetupCloseLog();
+}
+
+START_TEST(log)
+{
+ test_SetupLogError();
+}
--
2.3.2

View File

@ -0,0 +1 @@
Fixes: Implement SetupLogError[A|W] and Setup[Open|Close]Log

View File

@ -14,14 +14,12 @@ diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
index 30902e7..3531381 100644
--- a/dlls/setupapi/tests/Makefile.in
+++ b/dlls/setupapi/tests/Makefile.in
@@ -3,6 +3,7 @@ IMPORTS = setupapi user32 advapi32
@@ -4,4 +4,5 @@ IMPORTS = setupapi user32 advapi32
C_SRCS = \
devinst.c \
+ dialog.c \
diskspace.c \
install.c \
misc.c \
diff --git a/dlls/setupapi/tests/dialog.c b/dlls/setupapi/tests/dialog.c
new file mode 100644
index 0000000..973b1fc