ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2018
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
436 discussions
Start a n
N
ew thread
03/04: [DRWTSN32] Add code to write a minidump
by William Kent
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f6ce101f7705b93ff4fc…
commit 6f6ce101f7705b93ff4fcf15b8ea1ae01d349449 Author: William Kent <wjk011(a)gmail.com> AuthorDate: Thu Mar 8 20:51:15 2018 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sat Mar 10 00:04:57 2018 +0100 [DRWTSN32] Add code to write a minidump --- base/applications/drwtsn32/main.cpp | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/base/applications/drwtsn32/main.cpp b/base/applications/drwtsn32/main.cpp index 1224b7554e..436a18bf30 100644 --- a/base/applications/drwtsn32/main.cpp +++ b/base/applications/drwtsn32/main.cpp @@ -178,6 +178,62 @@ std::wstring Settings_GetOutputPath(void) return std::wstring(Buffer); } +BOOL Settings_GetShouldWriteDump(void) +{ + CRegKey key; + if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\ReactOS\\Crash Reporter", KEY_READ) != ERROR_SUCCESS) + { + return FALSE; + } + + DWORD Value; + if (key.QueryDWORDValue(L"Minidump", Value) != ERROR_SUCCESS) + { + return FALSE; + } + + return (Value != 0); +} + +HRESULT WriteMinidump(LPCWSTR LogFilePath, DumpData& data) +{ + HRESULT hr = S_OK; + + WCHAR DumpFilePath[MAX_PATH] = L""; + StringCchCopyW(DumpFilePath, _countof(DumpFilePath), LogFilePath); + PathRemoveExtensionW(DumpFilePath); + PathAddExtensionW(DumpFilePath, L".dmp"); + + HANDLE hDumpFile = CreateFileW(DumpFilePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hDumpFile == INVALID_HANDLE_VALUE) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + ThreadData& Thread = data.Threads[data.ThreadID]; + Thread.Update(); + PCONTEXT ContextPointer = &Thread.Context; + + MINIDUMP_EXCEPTION_INFORMATION DumpExceptionInfo = {0}; + EXCEPTION_POINTERS ExceptionPointers = {0}; + ExceptionPointers.ExceptionRecord = &data.ExceptionInfo.ExceptionRecord; + ExceptionPointers.ContextRecord = ContextPointer; + + DumpExceptionInfo.ThreadId = data.ThreadID; + DumpExceptionInfo.ExceptionPointers = &ExceptionPointers; + DumpExceptionInfo.ClientPointers = FALSE; + + BOOL DumpSucceeded = MiniDumpWriteDump(data.ProcessHandle, data.ProcessID, hDumpFile, MiniDumpNormal, &DumpExceptionInfo, NULL, NULL); + if (!DumpSucceeded) + { + // According to MSDN, this value is already an HRESULT, so don't convert it again. + hr = GetLastError(); + } + + CloseHandle(hDumpFile); + return hr; +} + int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR cmdLine, INT) { int argc; @@ -284,6 +340,10 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR cmdLine, INT) } PrintBugreport(output, data); + if (Settings_GetShouldWriteDump() && HasPath) + { + WriteMinidump(OutputPath.c_str(), data); + } TerminateProcess(data.ProcessHandle, data.ExceptionInfo.ExceptionRecord.ExceptionCode);
6 years, 9 months
1
0
0
0
02/04: [DRWTSN32] Various improvements * Convert to wWinMain() * Add a resource file * Use a slightly friendlier application name * Add code to load the output path from the Registry * Add localized string resources
by William Kent
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1d10606fadb62e6472f3c…
commit 1d10606fadb62e6472f3c6194674e90b639c9b3e Author: William Kent <wjk011(a)gmail.com> AuthorDate: Thu Mar 8 20:50:29 2018 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sat Mar 10 00:04:57 2018 +0100 [DRWTSN32] Various improvements * Convert to wWinMain() * Add a resource file * Use a slightly friendlier application name * Add code to load the output path from the Registry * Add localized string resources --- base/applications/drwtsn32/CMakeLists.txt | 8 ++- base/applications/drwtsn32/drwtsn32.cpp | 8 +-- base/applications/drwtsn32/drwtsn32.h | 4 +- base/applications/drwtsn32/drwtsn32.rc | 21 ++++++ base/applications/drwtsn32/lang/en-US.rc | 12 ++++ base/applications/drwtsn32/main.cpp | 105 ++++++++++++++++++++++-------- base/applications/drwtsn32/resource.h | 11 ++++ base/applications/drwtsn32/sysinfo.cpp | 2 +- 8 files changed, 133 insertions(+), 38 deletions(-) diff --git a/base/applications/drwtsn32/CMakeLists.txt b/base/applications/drwtsn32/CMakeLists.txt index 3a7e93f736..66dbdab1f7 100644 --- a/base/applications/drwtsn32/CMakeLists.txt +++ b/base/applications/drwtsn32/CMakeLists.txt @@ -2,6 +2,7 @@ PROJECT(drwtsn32) set_cpp(WITH_RUNTIME WITH_EXCEPTIONS WITH_STL) +include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl) list(APPEND CPP_SOURCE drwtsn32.cpp @@ -11,8 +12,9 @@ list(APPEND CPP_SOURCE drwtsn32.h precomp.h) -add_executable(drwtsn32 ${CPP_SOURCE}) +add_executable(drwtsn32 ${CPP_SOURCE} drwtsn32.rc) add_pch(drwtsn32 precomp.h CPP_SOURCE) -set_module_type(drwtsn32 win32gui) -add_importlibs(drwtsn32 dbghelp psapi advapi32 shell32 msvcrt user32 kernel32 ntdll) +set_module_type(drwtsn32 win32gui UNICODE) +target_link_libraries(drwtsn32 atlnew) +add_importlibs(drwtsn32 dbghelp psapi advapi32 shell32 shlwapi msvcrt user32 kernel32 ntdll) add_cd_file(TARGET drwtsn32 DESTINATION reactos/system32 FOR all) diff --git a/base/applications/drwtsn32/drwtsn32.cpp b/base/applications/drwtsn32/drwtsn32.cpp index b667dd723c..598e4f0b6b 100644 --- a/base/applications/drwtsn32/drwtsn32.cpp +++ b/base/applications/drwtsn32/drwtsn32.cpp @@ -59,18 +59,18 @@ bool UpdateFromEvent(DEBUG_EVENT& evt, DumpData& data) { case CREATE_PROCESS_DEBUG_EVENT: { - data.ProcessPath.resize(MAX_PATH); - DWORD len = GetModuleFileNameExA(evt.u.CreateProcessInfo.hProcess, NULL, &data.ProcessPath[0], data.ProcessPath.size()); + data.ProcessPath.resize(MAX_PATH*2); + DWORD len = GetModuleFileNameExW(evt.u.CreateProcessInfo.hProcess, NULL, &data.ProcessPath[0], data.ProcessPath.size()); if (len) { data.ProcessPath.resize(len); - std::string::size_type pos = data.ProcessPath.find_last_of("\\/"); + std::string::size_type pos = data.ProcessPath.find_last_of(L"\\/"); if (pos != std::string::npos) data.ProcessName = data.ProcessPath.substr(pos+1); } else { - data.ProcessPath = "??"; + data.ProcessPath = L"??"; } if (data.ProcessName.empty()) data.ProcessName = data.ProcessPath; diff --git a/base/applications/drwtsn32/drwtsn32.h b/base/applications/drwtsn32/drwtsn32.h index 4d161ffe2a..a16b2f3f00 100644 --- a/base/applications/drwtsn32/drwtsn32.h +++ b/base/applications/drwtsn32/drwtsn32.h @@ -36,8 +36,8 @@ typedef std::map<DWORD, ThreadData> ThreadMap; class DumpData { public: - std::string ProcessPath; - std::string ProcessName; + std::wstring ProcessPath; + std::wstring ProcessName; DWORD ProcessID; DWORD ThreadID; HANDLE ProcessHandle; diff --git a/base/applications/drwtsn32/drwtsn32.rc b/base/applications/drwtsn32/drwtsn32.rc new file mode 100644 index 0000000000..0f3e2108af --- /dev/null +++ b/base/applications/drwtsn32/drwtsn32.rc @@ -0,0 +1,21 @@ +/* + * PROJECT: Dr. Watson crash reporter + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: Main resource file + * COPYRIGHT: Copyright 2018 William Kent (wjk011 [at] gmail [dot] com) + */ + +#include <windef.h> +#include <winuser.h> +#include "resource.h" + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Crash Reporter" +#define REACTOS_STR_INTERNAL_NAME "drwtsn32" +#define REACTOS_STR_ORIGINAL_FILENAME "drwtsn32.exe" +#include <reactos/version.rc> + +#include <reactos/manifest_exe.rc> + +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif diff --git a/base/applications/drwtsn32/lang/en-US.rc b/base/applications/drwtsn32/lang/en-US.rc new file mode 100644 index 0000000000..d681297c2a --- /dev/null +++ b/base/applications/drwtsn32/lang/en-US.rc @@ -0,0 +1,12 @@ +/* + * PROJECT: Dr. Watson crash reporter + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: en-US resource file + * COPYRIGHT: Copyright 2018 William Kent (wjk011 [at] gmail [dot] com) + */ + +STRINGTABLE +BEGIN + IDS_APP_TITLE "ReactOS Crash Reporter" + IDS_USER_ALERT_MESSAGE "The application %ls has crashed. Information about this crash has been saved to:\r\n\r\n%ls" +END diff --git a/base/applications/drwtsn32/main.cpp b/base/applications/drwtsn32/main.cpp index 65c7dc1995..1224b7554e 100644 --- a/base/applications/drwtsn32/main.cpp +++ b/base/applications/drwtsn32/main.cpp @@ -9,9 +9,15 @@ #include <winuser.h> #include <algorithm> #include <shlobj.h> +#include <shlwapi.h> +#include <tchar.h> #include <strsafe.h> #include <tlhelp32.h> +#include <dbghelp.h> #include <conio.h> +#include <atlbase.h> +#include <atlstr.h> +#include "resource.h" static const char szUsage[] = "Usage: DrWtsn32 [-i] [-g] [-p dddd] [-e dddd] [-?]\n" @@ -56,7 +62,7 @@ void PrintBugreport(FILE* output, DumpData& data) { do { - xfprintf(output, "%5d: %s" NEWLINE, pe.th32ProcessID, pe.szExeFile); + xfprintf(output, "%5d: %ls" NEWLINE, pe.th32ProcessID, pe.szExeFile); } while (Process32Next(hSnap, &pe)); } CloseHandle(hSnap); @@ -67,7 +73,7 @@ void PrintBugreport(FILE* output, DumpData& data) ModuleData mainModule(NULL); mainModule.Update(data.ProcessHandle); - xfprintf(output, "(%p - %p) %s" NEWLINE, + xfprintf(output, "(%p - %p) %ls" NEWLINE, mainModule.BaseAddress, (PBYTE)mainModule.BaseAddress + mainModule.Size, data.ProcessPath.c_str()); @@ -144,11 +150,41 @@ int abort(FILE* output, int err) return err; } -int main(int argc, char* argv[]) +std::wstring Settings_GetOutputPath(void) { + WCHAR Buffer[MAX_PATH] = L""; + ULONG BufferSize = _countof(Buffer); + BOOL UseDefaultPath = FALSE; + + CRegKey key; + if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\ReactOS\\Crash Reporter", KEY_READ) != ERROR_SUCCESS) + { + UseDefaultPath = TRUE; + } + + if (key.QueryStringValue(L"Dump Directory", Buffer, &BufferSize) != ERROR_SUCCESS) + { + UseDefaultPath = TRUE; + } + + if (UseDefaultPath) + { + if (FAILED(SHGetFolderPathW(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, Buffer))) + { + return std::wstring(); + } + } + + return std::wstring(Buffer); +} + +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR cmdLine, INT) +{ + int argc; + WCHAR **argv = CommandLineToArgvW(cmdLine, &argc); + DWORD pid = 0; - char Buffer[MAX_PATH+55]; - char Filename[50]; + WCHAR Filename[50]; FILE* output = NULL; SYSTEMTIME st; DumpData data; @@ -156,37 +192,37 @@ int main(int argc, char* argv[]) for (int n = 0; n < argc; ++n) { - char* arg = argv[n]; + WCHAR* arg = argv[n]; - if (!strcmp(arg, "-i")) + if (!wcscmp(arg, L"-i")) { /* FIXME: Installs as the postmortem debugger. */ } - else if (!strcmp(arg, "-g")) + else if (!wcscmp(arg, L"-g")) { } - else if (!strcmp(arg, "-p")) + else if (!wcscmp(arg, L"-p")) { if (n + 1 < argc) { - pid = strtoul(argv[n+1], NULL, 10); + pid = wcstoul(argv[n+1], NULL, 10); n++; } } - else if (!strcmp(arg, "-e")) + else if (!wcscmp(arg, L"-e")) { if (n + 1 < argc) { - data.Event = (HANDLE)strtoul(argv[n+1], NULL, 10); + data.Event = (HANDLE)wcstoul(argv[n+1], NULL, 10); n++; } } - else if (!strcmp(arg, "-?")) + else if (!wcscmp(arg, L"-?")) { - MessageBoxA(NULL, szUsage, "DrWtsn32", MB_OK); + MessageBoxA(NULL, szUsage, "ReactOS Crash Reporter", MB_OK); return abort(output, 0); } - else if (!strcmp(arg, "/?")) + else if (!wcscmp(arg, L"/?")) { xfprintf(stdout, "%s\n", szUsage); return abort(stdout, 0); @@ -195,19 +231,33 @@ int main(int argc, char* argv[]) if (!pid) { - MessageBoxA(NULL, szUsage, "DrWtsn32", MB_OK); + MessageBoxA(NULL, szUsage, "ReactOS Crash Reporter", MB_OK); return abort(stdout, 0); } GetLocalTime(&st); - if (SHGetFolderPathA(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, Buffer) == S_OK && - SUCCEEDED(StringCchPrintfA(Filename, _countof(Filename), "Appcrash_%d-%02d-%02d_%02d-%02d-%02d.txt", + std::wstring OutputPath = Settings_GetOutputPath(); + BOOL HasPath = (OutputPath.size() != 0); + + if (!PathIsDirectoryW(OutputPath.c_str())) + { + int res = SHCreateDirectoryExW(NULL, OutputPath.c_str(), NULL); + if (res != ERROR_SUCCESS && res != ERROR_ALREADY_EXISTS) + { + xfprintf(stdout, "Could not create output directory, not writing dump\n"); + MessageBoxA(NULL, "Could not create directory to write crash report.", "ReactOS Crash Reporter", MB_ICONERROR | MB_OK); + return abort(stdout, 0); + } + } + + if (HasPath && + SUCCEEDED(StringCchPrintfW(Filename, _countof(Filename), L"Appcrash_%d-%02d-%02d_%02d-%02d-%02d.txt", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond))) { - StringCchCatA(Buffer, _countof(Buffer), "\\"); - StringCchCatA(Buffer, _countof(Buffer), Filename); - output = fopen(Buffer, "wb"); + OutputPath += L"\\"; + OutputPath += Filename; + output = _wfopen(OutputPath.c_str(), L"wb"); } if (!output) output = stdout; @@ -237,13 +287,12 @@ int main(int argc, char* argv[]) TerminateProcess(data.ProcessHandle, data.ExceptionInfo.ExceptionRecord.ExceptionCode); - std::string Message = "The application '"; - Message += data.ProcessName; - Message += "' has just crashed :(\n"; - Message += "Information about this crash is saved to:\n"; - Message += Filename; - Message += "\nThis file is stored on your desktop."; - MessageBoxA(NULL, Message.c_str(), "Sorry!", MB_OK); + CStringW FormattedMessage; + FormattedMessage.Format(IDS_USER_ALERT_MESSAGE, data.ProcessName.c_str(), OutputPath.c_str()); + CStringW DialogTitle; + DialogTitle.LoadString(hInstance, IDS_APP_TITLE); + + MessageBoxW(NULL, FormattedMessage.GetString(), DialogTitle.GetString(), MB_OK); return abort(output, 0); } diff --git a/base/applications/drwtsn32/resource.h b/base/applications/drwtsn32/resource.h new file mode 100644 index 0000000000..064207ea64 --- /dev/null +++ b/base/applications/drwtsn32/resource.h @@ -0,0 +1,11 @@ +/* + * PROJECT: Dr. Watson crash reporter + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: Resource file header + * COPYRIGHT: Copyright 2018 William Kent (wjk011 [at] gmail [dot] com) + */ + +#pragma once + +#define IDS_APP_TITLE 101 +#define IDS_USER_ALERT_MESSAGE 102 diff --git a/base/applications/drwtsn32/sysinfo.cpp b/base/applications/drwtsn32/sysinfo.cpp index 7cad0cab5a..7148163b15 100644 --- a/base/applications/drwtsn32/sysinfo.cpp +++ b/base/applications/drwtsn32/sysinfo.cpp @@ -54,7 +54,7 @@ void PrintSystemInfo(FILE* output, DumpData& data) GetLocalTime(&LocalTime); xfprintf(output, NEWLINE "ReactOS " KERNEL_VERSION_STR " DrWtsn32" NEWLINE NEWLINE); xfprintf(output, "Application exception occurred:" NEWLINE); - xfprintf(output, " App: %s (pid=%d, tid=0x%x)" NEWLINE, data.ProcessName.c_str(), data.ProcessID, data.ThreadID); + xfprintf(output, " App: %ls (pid=%d, tid=0x%x)" NEWLINE, data.ProcessName.c_str(), data.ProcessID, data.ThreadID); xfprintf(output, " When: %d/%d/%d @ %02d:%02d:%02d.%d" NEWLINE, LocalTime.wDay, LocalTime.wMonth, LocalTime.wYear, LocalTime.wHour, LocalTime.wMinute, LocalTime.wSecond, LocalTime.wMilliseconds);
6 years, 9 months
1
0
0
0
01/04: [SDK] Do not use a NUL file while calculating format string length CORE-14342
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2f548599a4b9e33eeec79…
commit 2f548599a4b9e33eeec79b113e7d8bc511336b07 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Thu Mar 8 21:38:40 2018 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sat Mar 10 00:04:57 2018 +0100 [SDK] Do not use a NUL file while calculating format string length CORE-14342 --- sdk/lib/crt/printf/_vscprintf.c | 15 +++++---------- sdk/lib/crt/printf/_vscwprintf.c | 14 +++++--------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/sdk/lib/crt/printf/_vscprintf.c b/sdk/lib/crt/printf/_vscprintf.c index 5db594f718..7b4e6b5f72 100644 --- a/sdk/lib/crt/printf/_vscprintf.c +++ b/sdk/lib/crt/printf/_vscprintf.c @@ -15,14 +15,9 @@ _vscprintf( const char *format, va_list argptr) { - int ret; - FILE* nulfile = fopen("nul", "w"); - if(nulfile == NULL) - { - /* This should never happen... */ - return -1; - } - ret = streamout(nulfile, format, argptr); - fclose(nulfile); - return ret; + FILE nulfile; + nulfile._tmpfname = nulfile._ptr = nulfile._base = NULL; + nulfile._bufsiz = nulfile._charbuf = nulfile._cnt = 0; + nulfile._flag = _IOSTRG | _IOWRT; + return streamout(&nulfile, format, argptr); } diff --git a/sdk/lib/crt/printf/_vscwprintf.c b/sdk/lib/crt/printf/_vscwprintf.c index f6b7e9d55d..5b01fc1db9 100644 --- a/sdk/lib/crt/printf/_vscwprintf.c +++ b/sdk/lib/crt/printf/_vscwprintf.c @@ -22,15 +22,11 @@ _vscwprintf( { int ret; #ifndef _LIBCNT_ - FILE* nulfile; - nulfile = fopen("nul", "w"); - if(nulfile == NULL) - { - /* This should never happen... */ - return -1; - } - ret = wstreamout(nulfile, format, argptr); - fclose(nulfile); + FILE nulfile; + nulfile._tmpfname = nulfile._ptr = nulfile._base = NULL; + nulfile._bufsiz = nulfile._charbuf = nulfile._cnt = 0; + nulfile._flag = _IOSTRG | _IOWRT; + ret = wstreamout(&nulfile, format, argptr); #else ret = -1; #endif
6 years, 9 months
1
0
0
0
01/01: [PSDK] Fix wide string literals in bcrypt.h. Should fix VC2010 build.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dedd08c38d34f3bc380df…
commit dedd08c38d34f3bc380dfbd734c66a1d8453fda7 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Fri Mar 9 19:34:31 2018 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Fri Mar 9 19:35:20 2018 +0100 [PSDK] Fix wide string literals in bcrypt.h. Should fix VC2010 build. --- sdk/include/psdk/bcrypt.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/include/psdk/bcrypt.h b/sdk/include/psdk/bcrypt.h index d4118b3f1b..de74af7bb1 100644 --- a/sdk/include/psdk/bcrypt.h +++ b/sdk/include/psdk/bcrypt.h @@ -59,12 +59,12 @@ typedef NTSTATUS *PNTSTATUS; #define BCRYPT_SIGNATURE_LENGTH L"SignatureLength" #define BCRYPT_OPAQUE_KEY_BLOB L"OpaqueKeyBlob" -#define BCRYPT_KEY_DATA_BLOB (const WCHAR []){'K','e','y','D','a','t','a','B','l','o','b',0} -#define BCRYPT_AES_WRAP_KEY_BLOB (const WCHAR []){'R','f','c','3','5','6','5','K','e','y','W','r','a','p','B','l','o','b',0} -#define BCRYPT_ECCPUBLIC_BLOB (const WCHAR []){'E','C','C','P','U','B','L','I','C','B','L','O','B',0} -#define BCRYPT_ECCPRIVATE_BLOB (const WCHAR []){'E','C','C','P','R','I','V','A','T','E','B','L','O','B',0} -#define BCRYPT_RSAPUBLIC_BLOB (const WCHAR []){'R','S','A','P','U','B','L','I','C','B','L','O','B',0} -#define BCRYPT_RSAPRIVATE_BLOB (const WCHAR []){'R','S','A','P','R','I','V','A','T','E','B','L','O','B',0} +#define BCRYPT_KEY_DATA_BLOB L"KeyDataBlob" +#define BCRYPT_AES_WRAP_KEY_BLOB L"Rfc3565KeyWrapBlob" +#define BCRYPT_ECCPUBLIC_BLOB L"ECCPUBLICBLOB" +#define BCRYPT_ECCPRIVATE_BLOB L"ECCPRIVATEBLOB" +#define BCRYPT_RSAPUBLIC_BLOB L"RSAPUBLICBLOB" +#define BCRYPT_RSAPRIVATE_BLOB L"RSAPRIVATEBLOB" #define MS_PRIMITIVE_PROVIDER L"Microsoft Primitive Provider" #define MS_PLATFORM_CRYPTO_PROVIDER L"Microsoft Platform Crypto Provider"
6 years, 9 months
1
0
0
0
01/01: [BCRYPT] Improve stubs for functions needed by crypt32 aka fix build.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a6265fc4b07bcb2b95c0a…
commit a6265fc4b07bcb2b95c0ab901e371f6fd616efc7 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Fri Mar 9 18:10:15 2018 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Fri Mar 9 18:20:30 2018 +0100 [BCRYPT] Improve stubs for functions needed by crypt32 aka fix build. --- dll/win32/bcrypt/bcrypt.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/win32/bcrypt/bcrypt.spec b/dll/win32/bcrypt/bcrypt.spec index e299fe0cce..b7bde3a0df 100644 --- a/dll/win32/bcrypt/bcrypt.spec +++ b/dll/win32/bcrypt/bcrypt.spec @@ -9,7 +9,7 @@ @ stub BCryptDeleteContext @ stub BCryptDeriveKey @ stdcall BCryptDestroyHash(ptr) -@ stub BCryptDestroyKey +@ stdcall -stub BCryptDestroyKey(ptr) @ stub BCryptDestroySecret @ stub BCryptDuplicateHash @ stub BCryptDuplicateKey @@ -32,7 +32,7 @@ @ stdcall BCryptHash(ptr ptr long ptr long ptr long) @ stdcall BCryptHashData(ptr ptr long long) @ stub BCryptImportKey -@ stub BCryptImportKeyPair +@ stdcall -stub BCryptImportKeyPair(ptr ptr wstr ptr ptr long long) @ stdcall BCryptOpenAlgorithmProvider(ptr wstr wstr long) @ stub BCryptQueryContextConfiguration @ stub BCryptQueryContextFunctionConfiguration @@ -50,7 +50,7 @@ @ stub BCryptSignHash @ stub BCryptUnregisterConfigChangeNotify @ stub BCryptUnregisterProvider -@ stub BCryptVerifySignature +@ stdcall -stub BCryptVerifySignature(ptr ptr ptr long ptr long long) @ stub GetAsymmetricEncryptionInterface @ stub GetCipherInterface @ stub GetHashInterface
6 years, 9 months
1
0
0
0
01/01: [GDIPLUS_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e3f6657f95bd42baa80ec…
commit e3f6657f95bd42baa80ece83a74f6074172d052c Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 9 13:09:52 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 9 13:09:52 2018 +0100 [GDIPLUS_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/gdiplus/brush.c | 6 +- modules/rostests/winetests/gdiplus/customlinecap.c | 4 +- modules/rostests/winetests/gdiplus/font.c | 6 +- modules/rostests/winetests/gdiplus/graphics.c | 6 +- modules/rostests/winetests/gdiplus/graphicspath.c | 31 +- modules/rostests/winetests/gdiplus/image.c | 387 ++++++++++++++++++++- modules/rostests/winetests/gdiplus/matrix.c | 7 +- modules/rostests/winetests/gdiplus/metafile.c | 6 +- modules/rostests/winetests/gdiplus/pathiterator.c | 4 +- modules/rostests/winetests/gdiplus/pen.c | 6 +- modules/rostests/winetests/gdiplus/precomp.h | 3 + modules/rostests/winetests/gdiplus/region.c | 6 +- modules/rostests/winetests/gdiplus/stringformat.c | 4 +- 13 files changed, 453 insertions(+), 23 deletions(-) diff --git a/modules/rostests/winetests/gdiplus/brush.c b/modules/rostests/winetests/gdiplus/brush.c index c012b97933..0451948175 100644 --- a/modules/rostests/winetests/gdiplus/brush.c +++ b/modules/rostests/winetests/gdiplus/brush.c @@ -18,7 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got) diff --git a/modules/rostests/winetests/gdiplus/customlinecap.c b/modules/rostests/winetests/gdiplus/customlinecap.c index 8bfa06c0b4..bac80adbdb 100644 --- a/modules/rostests/winetests/gdiplus/customlinecap.c +++ b/modules/rostests/winetests/gdiplus/customlinecap.c @@ -18,7 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got) diff --git a/modules/rostests/winetests/gdiplus/font.c b/modules/rostests/winetests/gdiplus/font.c index de8e64dc59..6d1933e2f0 100644 --- a/modules/rostests/winetests/gdiplus/font.c +++ b/modules/rostests/winetests/gdiplus/font.c @@ -19,7 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) #define expect_(expected, got, precision) ok(abs((expected) - (got)) <= (precision), "Expected %d, got %d\n", (expected), (got)) diff --git a/modules/rostests/winetests/gdiplus/graphics.c b/modules/rostests/winetests/gdiplus/graphics.c index 2c0221c10c..96df1a2743 100644 --- a/modules/rostests/winetests/gdiplus/graphics.c +++ b/modules/rostests/winetests/gdiplus/graphics.c @@ -19,7 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got)) #define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got)) diff --git a/modules/rostests/winetests/gdiplus/graphicspath.c b/modules/rostests/winetests/gdiplus/graphicspath.c index b601aad0f9..c5403cbe0e 100644 --- a/modules/rostests/winetests/gdiplus/graphicspath.c +++ b/modules/rostests/winetests/gdiplus/graphicspath.c @@ -18,7 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" +#include <math.h> #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf(expected, got) ok(fabs(expected - got) < 2.0, "Expected %.2f, got %.2f\n", expected, got) @@ -1298,6 +1301,7 @@ static void test_empty_rect(void) { GpPath *path; GpStatus status; + INT count; BOOL result; status = GdipCreatePath(FillModeAlternate, &path); @@ -1306,19 +1310,42 @@ static void test_empty_rect(void) status = GdipAddPathRectangle(path, 0.0, 0.0, -5.0, 5.0); expect(Ok, status); + status = GdipGetPointCount(path, &count); + expect(Ok, status); + expect(0, count); + status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result); expect(Ok, status); - expect(FALSE, status); + expect(FALSE, result); status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, -5.0); expect(Ok, status); + status = GdipGetPointCount(path, &count); + expect(Ok, status); + expect(0, count); + status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0); expect(Ok, status); + status = GdipGetPointCount(path, &count); + expect(Ok, status); + expect(0, count); + status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0); expect(Ok, status); + status = GdipGetPointCount(path, &count); + expect(Ok, status); + expect(0, count); + + status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.1); + expect(Ok, status); + + status = GdipGetPointCount(path, &count); + expect(Ok, status); + expect(4, count); + GdipDeletePath(path); } diff --git a/modules/rostests/winetests/gdiplus/image.c b/modules/rostests/winetests/gdiplus/image.c index 96e988ccba..bb27dd6af2 100644 --- a/modules/rostests/winetests/gdiplus/image.c +++ b/modules/rostests/winetests/gdiplus/image.c @@ -19,10 +19,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#define COBJMACROS +#include <math.h> #include <assert.h> +#include <stdio.h> + +#include "initguid.h" +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" + +#ifdef __REACTOS__ #include <ole2.h> +#endif /* FIXME: They belong to gdipluseffects.h */ DEFINE_GUID(BlurEffectGuid, 0x633c80a4, 0x1843, 0x482b, 0x9e, 0xf2, 0xbe, 0x28, 0x34, 0xc5, 0xfd, 0xd4); @@ -41,6 +51,8 @@ static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat,UINT*); static GpStatus (WINAPI *pGdipBitmapGetHistogram)(GpBitmap*,HistogramFormat,UINT,UINT*,UINT*,UINT*,UINT*); static GpStatus (WINAPI *pGdipImageSetAbort)(GpImage*,GdiplusAbort*); +static GpStatus (WINGDIPAPI *pGdipInitializePalette)(ColorPalette*,PaletteType,INT,BOOL,GpBitmap*); + #define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got)) #define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got)) @@ -3248,8 +3260,6 @@ static GpImage *load_image(const BYTE *image_data, UINT image_size) ok(refcount == 1, "expected stream refcount 1, got %d\n", refcount); status = GdipLoadImageFromStream(stream, &image); - ok(status == Ok || broken(status == InvalidParameter), /* XP */ - "GdipLoadImageFromStream error %d\n", status); if (status != Ok) { IStream_Release(stream); @@ -4804,14 +4814,13 @@ static void test_supported_encoders(void) { LPCWSTR mime; const GUID *format; - BOOL todo; } td[] = { - { bmp_mimetype, &ImageFormatBMP, FALSE }, - { jpeg_mimetype, &ImageFormatJPEG, FALSE }, - { gif_mimetype, &ImageFormatGIF, TRUE }, - { tiff_mimetype, &ImageFormatTIFF, FALSE }, - { png_mimetype, &ImageFormatPNG, FALSE } + { bmp_mimetype, &ImageFormatBMP }, + { jpeg_mimetype, &ImageFormatJPEG }, + { gif_mimetype, &ImageFormatGIF }, + { tiff_mimetype, &ImageFormatTIFF }, + { png_mimetype, &ImageFormatPNG } }; GUID format, clsid; BOOL ret; @@ -4837,8 +4846,7 @@ static void test_supported_encoders(void) ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); status = GdipSaveImageToStream((GpImage *)bm, stream, &clsid, NULL); - todo_wine_if (td[i].todo) - ok(status == Ok, "GdipSaveImageToStream error %d\n", status); + ok(status == Ok, "GdipSaveImageToStream error %d\n", status); IStream_Release(stream); } @@ -5168,6 +5176,360 @@ static void test_png_color_formats(void) } } +static void test_GdipLoadImageFromStream(void) +{ + IStream *stream; + GpStatus status; + GpImage *image; + HGLOBAL hglob; + BYTE *data; + HRESULT hr; + + status = GdipLoadImageFromStream(NULL, NULL); + ok(status == InvalidParameter, "Unexpected return value %d.\n", status); + + image = (void *)0xdeadbeef; + status = GdipLoadImageFromStream(NULL, &image); + ok(status == InvalidParameter, "Unexpected return value %d.\n", status); + ok(image == (void *)0xdeadbeef, "Unexpected image pointer.\n"); + + hglob = GlobalAlloc(0, sizeof(pngimage)); + data = GlobalLock (hglob); + memcpy(data, pngimage, sizeof(pngimage)); + GlobalUnlock(hglob); + + hr = CreateStreamOnHGlobal(hglob, TRUE, &stream); + ok(hr == S_OK, "Failed to create a stream.\n"); + + status = GdipLoadImageFromStream(stream, NULL); + ok(status == InvalidParameter, "Unexpected return value %d.\n", status); + + IStream_Release(stream); +} + +static BYTE *init_bitmap(UINT *width, UINT *height, UINT *stride) +{ + BYTE *src; + UINT i, j, scale; + + *width = 256; + *height = 256; + *stride = (*width * 3 + 3) & ~3; + trace("width %d, height %d, stride %d\n", *width, *height, *stride); + + src = HeapAlloc(GetProcessHeap(), 0, *stride * *height); + + scale = 256 / *width; + if (!scale) scale = 1; + + for (i = 0; i < *height; i++) + { + for (j = 0; j < *width; j++) + { + src[i * *stride + j*3 + 0] = scale * i; + src[i * *stride + j*3 + 1] = scale * (255 - (i+j)/2); + src[i * *stride + j*3 + 2] = scale * j; + } + } + + return src; +} + +static void test_GdipInitializePalette(void) +{ + GpStatus status; + BYTE *data; + GpBitmap *bitmap; + ColorPalette *palette; + UINT width, height, stride; + + pGdipInitializePalette = (void *)GetProcAddress(GetModuleHandleA("gdiplus.dll"), "GdipInitializePalette"); + if (!pGdipInitializePalette) + { + win_skip("GdipInitializePalette is not supported on this platform\n"); + return; + } + + data = init_bitmap(&width, &height, &stride); + + status = GdipCreateBitmapFromScan0(width, height, stride, PixelFormat24bppRGB, data, &bitmap); + expect(Ok, status); + + palette = GdipAlloc(sizeof(*palette) + sizeof(ARGB) * 255); + + palette->Flags = 0; + palette->Count = 15; + status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, bitmap); + expect(GenericError, status); + + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, NULL); + expect(InvalidParameter, status); + + memset(palette->Entries, 0x11, sizeof(ARGB) * 256); + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeCustom, 16, FALSE, NULL); + expect(Ok, status); + expect(0, palette->Flags); + expect(256, palette->Count); + expect(0x11111111, palette->Entries[0]); + expect(0x11111111, palette->Entries[128]); + expect(0x11111111, palette->Entries[255]); + + memset(palette->Entries, 0x11, sizeof(ARGB) * 256); + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeFixedBW, 0, FALSE, bitmap); + expect(Ok, status); +todo_wine + expect(0x200, palette->Flags); + expect(2, palette->Count); + expect(0xff000000, palette->Entries[0]); + expect(0xffffffff, palette->Entries[1]); + + memset(palette->Entries, 0x11, sizeof(ARGB) * 256); + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone8, 1, FALSE, NULL); + expect(Ok, status); +todo_wine + expect(0x300, palette->Flags); + expect(16, palette->Count); + expect(0xff000000, palette->Entries[0]); + expect(0xffc0c0c0, palette->Entries[8]); + expect(0xff008080, palette->Entries[15]); + + memset(palette->Entries, 0x11, sizeof(ARGB) * 256); + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone8, 1, FALSE, bitmap); + expect(Ok, status); +todo_wine + expect(0x300, palette->Flags); + expect(16, palette->Count); + expect(0xff000000, palette->Entries[0]); + expect(0xffc0c0c0, palette->Entries[8]); + expect(0xff008080, palette->Entries[15]); + + memset(palette->Entries, 0x11, sizeof(ARGB) * 256); + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone252, 1, FALSE, bitmap); + expect(Ok, status); +todo_wine + expect(0x800, palette->Flags); + expect(252, palette->Count); + expect(0xff000000, palette->Entries[0]); + expect(0xff990066, palette->Entries[128]); + expect(0xffffffff, palette->Entries[251]); + + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeOptimal, 1, FALSE, bitmap); + expect(InvalidParameter, status); + + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeOptimal, 2, FALSE, bitmap); + expect(Ok, status); + expect(0, palette->Flags); + expect(2, palette->Count); + + palette->Flags = 0; + palette->Count = 256; + status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, bitmap); + expect(Ok, status); + expect(0, palette->Flags); + expect(16, palette->Count); + + /* passing invalid enumeration palette type crashes under most Windows versions */ + + GdipFree(palette); + GdipDisposeImage((GpImage *)bitmap); +} + +#include "pshpack2.h" +static const struct tiff_1x1_data +{ + USHORT byte_order; + USHORT version; + ULONG dir_offset; + USHORT number_of_entries; + struct IFD_entry entry[12]; + ULONG next_IFD; + struct IFD_rational res; + short palette_data[3][256]; + short bps_data[4]; + BYTE pixel_data[32]; +} tiff_1x1_data = +{ +#ifdef WORDS_BIGENDIAN + 'M' | 'M' << 8, +#else + 'I' | 'I' << 8, +#endif + 42, + FIELD_OFFSET(struct tiff_1x1_data, number_of_entries), + 12, + { + { 0xff, IFD_SHORT, 1, 0 }, /* SUBFILETYPE */ + { 0x100, IFD_LONG, 1, 1 }, /* IMAGEWIDTH */ + { 0x101, IFD_LONG, 1, 1 }, /* IMAGELENGTH */ + { 0x102, IFD_SHORT, 3, FIELD_OFFSET(struct tiff_1x1_data, bps_data) }, /* BITSPERSAMPLE */ + { 0x103, IFD_SHORT, 1, 1 }, /* COMPRESSION: XP doesn't accept IFD_LONG here */ + { 0x106, IFD_SHORT, 1, 2 }, /* PHOTOMETRIC */ + { 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_1x1_data, pixel_data) }, /* STRIPOFFSETS */ + { 0x115, IFD_SHORT, 1, 3 }, /* SAMPLESPERPIXEL */ + { 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) }, + { 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) }, + { 0x128, IFD_SHORT, 1, 2 }, /* RESOLUTIONUNIT */ + { 0x140, IFD_SHORT, 256*3, FIELD_OFFSET(struct tiff_1x1_data, palette_data) } /* COLORMAP */ + }, + 0, + { 96, 1 }, + { { 0 } }, + { 8,8,8,0 }, + { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 } +}; +#include "poppack.h" + +static void test_tiff_color_formats(void) +{ + static const struct + { + int photometric; /* PhotometricInterpretation */ + int samples; /* SamplesPerPixel */ + int bps; /* BitsPerSample */ + PixelFormat format; + } td[] = + { + /* 2 - RGB */ + { 2, 3, 1, PixelFormat24bppRGB }, + { 2, 3, 4, PixelFormat24bppRGB }, + { 2, 3, 8, PixelFormat24bppRGB }, + { 2, 3, 16, PixelFormat48bppRGB }, + { 2, 3, 24, 0 }, +#if 0 /* FIXME */ + { 2, 3, 32, 0 }, +#endif + { 2, 4, 1, PixelFormat32bppARGB }, + { 2, 4, 4, PixelFormat32bppARGB }, + { 2, 4, 8, PixelFormat32bppARGB }, + { 2, 4, 16, PixelFormat48bppRGB }, + { 2, 4, 24, 0 }, + { 2, 4, 32, 0 }, + /* 1 - BlackIsZero (Bilevel) */ + { 1, 1, 1, PixelFormat1bppIndexed }, +#if 0 /* FIXME: PNG vs TIFF mismatch */ + { 1, 1, 4, PixelFormat8bppIndexed }, +#endif + { 1, 1, 8, PixelFormat8bppIndexed }, + { 1, 1, 16, PixelFormat32bppARGB }, + { 1, 1, 24, 0 }, + { 1, 1, 32, PixelFormat32bppARGB }, + /* 3 - Palette Color */ + { 3, 1, 1, PixelFormat1bppIndexed }, + { 3, 1, 4, PixelFormat4bppIndexed }, + { 3, 1, 8, PixelFormat8bppIndexed }, +#if 0 /* FIXME: for some reason libtiff replaces photometric 3 by 1 for bps > 8 */ + { 3, 1, 16, 0 }, + { 3, 1, 24, 0 }, + { 3, 1, 32, 0 }, +#endif + /* 5 - Separated */ + { 5, 4, 1, 0 }, + { 5, 4, 4, 0 }, + { 5, 4, 8, PixelFormat32bppCMYK }, + { 5, 4, 16, PixelFormat48bppRGB }, + { 5, 4, 24, 0 }, + { 5, 4, 32, 0 }, + }; + BYTE buf[sizeof(tiff_1x1_data)]; + GpStatus status; + GpImage *image; + UINT count, i; + struct IFD_entry *tag, *tag_photo = NULL, *tag_bps = NULL, *tag_samples = NULL, *tag_colormap = NULL; + short *bps; + ImageType type; + PixelFormat format; + + memcpy(buf, &tiff_1x1_data, sizeof(tiff_1x1_data)); + + count = *(short *)(buf + tiff_1x1_data.dir_offset); + tag = (struct IFD_entry *)(buf + tiff_1x1_data.dir_offset + sizeof(short)); + + /* verify the TIFF structure */ + for (i = 0; i < count; i++) + { + if (tag[i].id == 0x102) /* BitsPerSample */ + tag_bps = &tag[i]; + else if (tag[i].id == 0x106) /* PhotometricInterpretation */ + tag_photo = &tag[i]; + else if (tag[i].id == 0x115) /* SamplesPerPixel */ + tag_samples = &tag[i]; + else if (tag[i].id == 0x140) /* ColorMap */ + tag_colormap = &tag[i]; + } + + ok(tag_bps && tag_photo && tag_samples && tag_colormap, "tag 0x102,0x106,0x115 or 0x140 is missing\n"); + if (!tag_bps || !tag_photo || !tag_samples || !tag_colormap) return; + + ok(tag_bps->type == IFD_SHORT, "tag 0x102 should have type IFD_SHORT\n"); + bps = (short *)(buf + tag_bps->value); + ok(bps[0] == 8 && bps[1] == 8 && bps[2] == 8 && bps[3] == 0, + "expected bps 8,8,8,0 got %d,%d,%d,%d\n", bps[0], bps[1], bps[2], bps[3]); + + for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + { + tag_colormap->count = (1 << td[i].bps) * 3; + tag_photo->value = td[i].photometric; + tag_bps->count = td[i].samples; + tag_samples->value = td[i].samples; + + if (td[i].samples == 1) + tag_bps->value = td[i].bps; + else if (td[i].samples == 2) + tag_bps->value = MAKELONG(td[i].bps, td[i].bps); + else if (td[i].samples == 3) + { + tag_bps->value = (BYTE *)bps - buf; + bps[0] = bps[1] = bps[2] = td[i].bps; + } + else if (td[i].samples == 4) + { + tag_bps->value = (BYTE *)bps - buf; + bps[0] = bps[1] = bps[2] = bps[3] = td[i].bps; + } + else + { + ok(0, "%u: unsupported samples count %d\n", i, td[i].samples); + continue; + } + + image = load_image(buf, sizeof(buf)); + if (!td[i].format) + ok(!image, + "%u: (%d,%d,%d) TIFF image loading should have failed\n", i, td[i].photometric, td[i].samples, td[i].bps); + else + ok(image != NULL || broken(!image) /* XP */, "%u: failed to load TIFF image data (%d,%d,%d)\n", + i, td[i].photometric, td[i].samples, td[i].bps); + if (!image) continue; + + status = GdipGetImageType(image, &type); + ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status); + ok(type == ImageTypeBitmap, "%u: wrong image type %d\n", i, type); + + status = GdipGetImagePixelFormat(image, &format); + expect(Ok, status); + ok(format == td[i].format, + "%u: expected %#x, got %#x\n", i, td[i].format, format); + + GdipDisposeImage(image); + } +} + START_TEST(image) { HMODULE mod = GetModuleHandleA("gdiplus.dll"); @@ -5192,6 +5554,8 @@ START_TEST(image) pGdipBitmapGetHistogram = (void*)GetProcAddress(mod, "GdipBitmapGetHistogram"); pGdipImageSetAbort = (void*)GetProcAddress(mod, "GdipImageSetAbort"); + test_tiff_color_formats(); + test_GdipInitializePalette(); test_png_color_formats(); test_supported_encoders(); test_CloneBitmapArea(); @@ -5241,6 +5605,7 @@ START_TEST(image) test_getadjustedpalette(); test_histogram(); test_imageabort(); + test_GdipLoadImageFromStream(); GdiplusShutdown(gdiplusToken); } diff --git a/modules/rostests/winetests/gdiplus/matrix.c b/modules/rostests/winetests/gdiplus/matrix.c index 719b6a0251..5ca0209f6a 100644 --- a/modules/rostests/winetests/gdiplus/matrix.c +++ b/modules/rostests/winetests/gdiplus/matrix.c @@ -18,7 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> +#include <limits.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got) diff --git a/modules/rostests/winetests/gdiplus/metafile.c b/modules/rostests/winetests/gdiplus/metafile.c index 49f06ca5aa..bd4d5264ed 100644 --- a/modules/rostests/winetests/gdiplus/metafile.c +++ b/modules/rostests/winetests/gdiplus/metafile.c @@ -18,7 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got)) diff --git a/modules/rostests/winetests/gdiplus/pathiterator.c b/modules/rostests/winetests/gdiplus/pathiterator.c index bb8a1e7ed0..9bd3ac5452 100644 --- a/modules/rostests/winetests/gdiplus/pathiterator.c +++ b/modules/rostests/winetests/gdiplus/pathiterator.c @@ -18,7 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) diff --git a/modules/rostests/winetests/gdiplus/pen.c b/modules/rostests/winetests/gdiplus/pen.c index c7847d7991..ded6e642eb 100644 --- a/modules/rostests/winetests/gdiplus/pen.c +++ b/modules/rostests/winetests/gdiplus/pen.c @@ -18,7 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf(expected, got) ok(fabs(got - expected) < 0.1, "Expected %.2f, got %.2f\n", expected, got) diff --git a/modules/rostests/winetests/gdiplus/precomp.h b/modules/rostests/winetests/gdiplus/precomp.h index 77fa1fca09..640d5f71c0 100644 --- a/modules/rostests/winetests/gdiplus/precomp.h +++ b/modules/rostests/winetests/gdiplus/precomp.h @@ -1,3 +1,4 @@ + #ifndef _GDIPLUS_WINETEST_PRECOMP_H_ #define _GDIPLUS_WINETEST_PRECOMP_H_ @@ -6,9 +7,11 @@ #define WIN32_NO_STATUS #define _INC_WINDOWS #define COM_NO_WINDOWS_H + #define COBJMACROS #include <wine/test.h> + #include <wingdi.h> #include <winnls.h> #include <objbase.h> diff --git a/modules/rostests/winetests/gdiplus/region.c b/modules/rostests/winetests/gdiplus/region.c index fc2675bf47..86a2e40fa2 100644 --- a/modules/rostests/winetests/gdiplus/region.c +++ b/modules/rostests/winetests/gdiplus/region.c @@ -19,7 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <math.h> + +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define RGNDATA_RECT 0x10000000 #define RGNDATA_PATH 0x10000001 diff --git a/modules/rostests/winetests/gdiplus/stringformat.c b/modules/rostests/winetests/gdiplus/stringformat.c index 332799b9a9..71fb860e47 100644 --- a/modules/rostests/winetests/gdiplus/stringformat.c +++ b/modules/rostests/winetests/gdiplus/stringformat.c @@ -18,7 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "objbase.h" +#include "gdiplus.h" +#include "wine/test.h" #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)
6 years, 9 months
1
0
0
0
01/01: [GDIPLUS] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5f279f2d12afd6872a467…
commit 5f279f2d12afd6872a4671d47d7b3fdf4f478a8b Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 9 13:09:03 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 9 13:09:03 2018 +0100 [GDIPLUS] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/gdiplus/CMakeLists.txt | 4 +- dll/win32/gdiplus/brush.c | 16 ++++ dll/win32/gdiplus/customlinecap.c | 12 +++ dll/win32/gdiplus/font.c | 19 ++++- dll/win32/gdiplus/gdiplus.c | 17 ++++ dll/win32/gdiplus/gdiplus.spec | 2 +- dll/win32/gdiplus/gdiplus_private.h | 48 +++-------- dll/win32/gdiplus/graphics.c | 160 ++++++++++++++++++++++++++++++++---- dll/win32/gdiplus/graphicspath.c | 17 ++++ dll/win32/gdiplus/image.c | 146 ++++++++++++++++++++++++++++++-- dll/win32/gdiplus/imageattributes.c | 9 ++ dll/win32/gdiplus/matrix.c | 13 +++ dll/win32/gdiplus/metafile.c | 26 +++++- dll/win32/gdiplus/pathiterator.c | 12 +++ dll/win32/gdiplus/pen.c | 12 +++ dll/win32/gdiplus/precomp.h | 17 ++++ dll/win32/gdiplus/region.c | 12 +++ dll/win32/gdiplus/stringformat.c | 13 +++ media/doc/README.WINE | 2 +- 19 files changed, 491 insertions(+), 66 deletions(-) diff --git a/dll/win32/gdiplus/CMakeLists.txt b/dll/win32/gdiplus/CMakeLists.txt index 30f07f8226..5a6aecf7ff 100644 --- a/dll/win32/gdiplus/CMakeLists.txt +++ b/dll/win32/gdiplus/CMakeLists.txt @@ -21,7 +21,7 @@ list(APPEND SOURCE pen.c region.c stringformat.c - gdiplus_private.h) + precomp.h) add_library(gdiplus SHARED ${SOURCE} @@ -34,7 +34,7 @@ set_module_type(gdiplus win32dll) target_link_libraries(gdiplus wine) add_delay_importlibs(gdiplus windowscodecs) add_importlibs(gdiplus msvcrt shlwapi oleaut32 ole32 user32 gdi32 kernel32 ntdll) -add_pch(gdiplus gdiplus_private.h SOURCE) +add_pch(gdiplus precomp.h SOURCE) add_cd_file(TARGET gdiplus DESTINATION reactos/system32 FOR all) add_cd_file(TARGET gdiplus DESTINATION reactos/winsxs/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23038_none_deadbeef FOR all) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23038_none_deadbeef.manifest DESTINATION reactos/winsxs/manifests FOR all) diff --git a/dll/win32/gdiplus/brush.c b/dll/win32/gdiplus/brush.c index dfacfbcb03..51264212ae 100644 --- a/dll/win32/gdiplus/brush.c +++ b/dll/win32/gdiplus/brush.c @@ -17,7 +17,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" + +#define COBJMACROS +#include "objbase.h" +#include "olectl.h" +#include "ole2.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); #ifdef __REACTOS__ /* diff --git a/dll/win32/gdiplus/customlinecap.c b/dll/win32/gdiplus/customlinecap.c index 3380b1438a..ca81bee217 100644 --- a/dll/win32/gdiplus/customlinecap.c +++ b/dll/win32/gdiplus/customlinecap.c @@ -16,7 +16,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from, GpCustomLineCap** to) diff --git a/dll/win32/gdiplus/font.c b/dll/win32/gdiplus/font.c index c0fb51c076..f99b026b25 100644 --- a/dll/win32/gdiplus/font.c +++ b/dll/win32/gdiplus/font.c @@ -17,10 +17,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winnls.h" +#include "winreg.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL (gdiplus); + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" /* PANOSE is 10 bytes in size, need to pack the structure properly */ -#include <pshpack2.h> +#include "pshpack2.h" typedef struct { USHORT version; @@ -85,7 +100,7 @@ typedef struct SHORT metricDataFormat; USHORT numberOfHMetrics; } TT_HHEA; -#include <poppack.h> +#include "poppack.h" #ifdef WORDS_BIGENDIAN #define GET_BE_WORD(x) (x) diff --git a/dll/win32/gdiplus/gdiplus.c b/dll/win32/gdiplus/gdiplus.c index c34bed8ad8..d114ff797e 100644 --- a/dll/win32/gdiplus/gdiplus.c +++ b/dll/win32/gdiplus/gdiplus.c @@ -16,8 +16,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <math.h> + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "wine/debug.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "winreg.h" +#include "shlwapi.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); + static const REAL mm_per_inch = 25.4; static const REAL point_per_inch = 72.0; diff --git a/dll/win32/gdiplus/gdiplus.spec b/dll/win32/gdiplus/gdiplus.spec index 0e7a78f30c..b29e41ebfa 100644 --- a/dll/win32/gdiplus/gdiplus.spec +++ b/dll/win32/gdiplus/gdiplus.spec @@ -615,7 +615,7 @@ 615 stub GdipGetEffectParameterSize 616 stub GdipGetEffectParameters 617 stdcall GdipSetEffectParameters(ptr ptr long) -618 stdcall -stub GdipInitializePalette(ptr long long long ptr) +618 stdcall GdipInitializePalette(ptr long long long ptr) 619 stdcall GdipBitmapCreateApplyEffect(ptr long ptr ptr ptr ptr long ptr ptr) 620 stdcall GdipBitmapApplyEffect(ptr ptr ptr long ptr ptr) 621 stdcall GdipBitmapGetHistogram(ptr long long ptr ptr ptr ptr) diff --git a/dll/win32/gdiplus/gdiplus_private.h b/dll/win32/gdiplus/gdiplus_private.h index 192e36756a..ea79f1183c 100644 --- a/dll/win32/gdiplus/gdiplus_private.h +++ b/dll/win32/gdiplus/gdiplus_private.h @@ -22,25 +22,18 @@ #include <math.h> #include <stdarg.h> -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H +#include "windef.h" +#include "wingdi.h" +#include "winbase.h" +#include "winuser.h" -#define NONAMELESSUNION -#define COBJMACROS +#include "objbase.h" +#include "ocidl.h" +#include "wincodecsdk.h" +#include "wine/heap.h" +#include "wine/list.h" -#include <windef.h> -#include <winbase.h> -#include <wingdi.h> -#include <objbase.h> -#include <wincodecsdk.h> -#include <gdiplus.h> - -#include <wine/unicode.h> -#include <wine/list.h> - -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); +#include "gdiplus.h" #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER) #define MAX_ARC_PTS (13) @@ -57,25 +50,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); #define GIF_DISPOSE_RESTORE_TO_BKGND 2 #define GIF_DISPOSE_RESTORE_TO_PREV 3 -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size) -{ - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); -} - -static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t size) -{ - return HeapReAlloc(GetProcessHeap(), 0, mem, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN; HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN; @@ -627,4 +601,4 @@ static inline void image_unlock(GpImage *image, BOOL unlock) if (unlock) image->busy = 0; } -#endif /* __WINE_GP_PRIVATE_H_ */ +#endif diff --git a/dll/win32/gdiplus/graphics.c b/dll/win32/gdiplus/graphics.c index 71ea19cbb5..f42fca643d 100644 --- a/dll/win32/gdiplus/graphics.c +++ b/dll/win32/gdiplus/graphics.c @@ -16,10 +16,31 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <math.h> +#include <limits.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/unicode.h" + +#define COBJMACROS +#include "objbase.h" +#include "ocidl.h" +#include "olectl.h" +#include "ole2.h" + +#include "winreg.h" +#include "shlwapi.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" +#include "wine/list.h" -#include <winreg.h> -#include <shlwapi.h> +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); /* Mike "tamlin" Nordell 2012-09-14 for ReactOS: * NOTE: Wine uses per-GpGraphics id's ('contid' starting from zero in @@ -531,12 +552,23 @@ static GpStatus alpha_blend_pixels(GpGraphics *graphics, INT dst_x, INT dst_y, return alpha_blend_pixels_hrgn(graphics, dst_x, dst_y, src, src_width, src_height, src_stride, NULL, fmt); } +/* NOTE: start and end pixels must be in pre-multiplied ARGB format */ +static inline ARGB blend_colors_premult(ARGB start, ARGB end, REAL position) +{ + UINT pos = position * 255.0f + 0.5f; + return + (((((start >> 24) ) << 8) + (((end >> 24) ) - ((start >> 24) )) * pos) >> 8) << 24 | + (((((start >> 16) & 0xff) << 8) + (((end >> 16) & 0xff) - ((start >> 16) & 0xff)) * pos) >> 8) << 16 | + (((((start >> 8) & 0xff) << 8) + (((end >> 8) & 0xff) - ((start >> 8) & 0xff)) * pos) >> 8) << 8 | + (((((start ) & 0xff) << 8) + (((end ) & 0xff) - ((start ) & 0xff)) * pos) >> 8); +} + static ARGB blend_colors(ARGB start, ARGB end, REAL position) { INT start_a, end_a, final_a; INT pos; - pos = gdip_round(position * 0xff); + pos = (INT)(position * 255.0f + 0.5f); start_a = ((start >> 24) & 0xff) * (pos ^ 0xff); end_a = ((end >> 24) & 0xff) * pos; @@ -942,6 +974,11 @@ static ARGB sample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT wi return ((DWORD*)(bits))[(x - src_rect->X) + (y - src_rect->Y) * src_rect->Width]; } +static inline int positive_ceilf(float f) +{ + return f - (int)f > 0.0f ? f + 1.0f : f; +} + static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, UINT height, GpPointF *point, GDIPCONST GpImageAttributes *attributes, InterpolationMode interpolation, PixelOffsetMode offset_mode) @@ -962,12 +999,12 @@ static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT ARGB top, bottom; float x_offset; - leftxf = floorf(point->X); - leftx = (INT)leftxf; - rightx = (INT)ceilf(point->X); - topyf = floorf(point->Y); - topy = (INT)topyf; - bottomy = (INT)ceilf(point->Y); + leftx = (INT)point->X; + leftxf = (REAL)leftx; + rightx = positive_ceilf(point->X); + topy = (INT)point->Y; + topyf = (REAL)topy; + bottomy = positive_ceilf(point->Y); if (leftx == rightx && topy == bottomy) return sample_bitmap_pixel(src_rect, bits, width, height, @@ -1011,6 +1048,75 @@ static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT } } +static ARGB resample_bitmap_pixel_premult(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, + UINT height, GpPointF *point, GDIPCONST GpImageAttributes *attributes, + InterpolationMode interpolation, PixelOffsetMode offset_mode) +{ + static int fixme; + + switch (interpolation) + { + default: + if (!fixme++) + FIXME("Unimplemented interpolation %i\n", interpolation); + /* fall-through */ + case InterpolationModeBilinear: + { + REAL leftxf, topyf; + INT leftx, rightx, topy, bottomy; + ARGB topleft, topright, bottomleft, bottomright; + ARGB top, bottom; + float x_offset; + + leftx = (INT)point->X; + leftxf = (REAL)leftx; + rightx = positive_ceilf(point->X); + topy = (INT)point->Y; + topyf = (REAL)topy; + bottomy = positive_ceilf(point->Y); + + if (leftx == rightx && topy == bottomy) + return sample_bitmap_pixel(src_rect, bits, width, height, + leftx, topy, attributes); + + topleft = sample_bitmap_pixel(src_rect, bits, width, height, + leftx, topy, attributes); + topright = sample_bitmap_pixel(src_rect, bits, width, height, + rightx, topy, attributes); + bottomleft = sample_bitmap_pixel(src_rect, bits, width, height, + leftx, bottomy, attributes); + bottomright = sample_bitmap_pixel(src_rect, bits, width, height, + rightx, bottomy, attributes); + + x_offset = point->X - leftxf; + top = blend_colors_premult(topleft, topright, x_offset); + bottom = blend_colors_premult(bottomleft, bottomright, x_offset); + + return blend_colors_premult(top, bottom, point->Y - topyf); + } + case InterpolationModeNearestNeighbor: + { + FLOAT pixel_offset; + switch (offset_mode) + { + default: + case PixelOffsetModeNone: + case PixelOffsetModeHighSpeed: + pixel_offset = 0.5; + break; + + case PixelOffsetModeHalf: + case PixelOffsetModeHighQuality: + pixel_offset = 0.0; + break; + } + return sample_bitmap_pixel(src_rect, bits, width, height, + floorf(point->X + pixel_offset), point->Y + pixel_offset, attributes); + } + + } +} + static REAL intersect_line_scanline(const GpPointF *p1, const GpPointF *p2, REAL y) { return (p1->X - p2->X) * (p2->Y - y) / (p2->Y - p1->Y) + p2->X; @@ -3106,8 +3212,10 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image lockeddata.Scan0 = src_data; if (!do_resampling && bitmap->format == PixelFormat32bppPARGB) lockeddata.PixelFormat = apply_image_attributes(imageAttributes, NULL, 0, 0, 0, ColorAdjustTypeBitmap, bitmap->format); - else + else if (imageAttributes != &defaultImageAttributes) lockeddata.PixelFormat = PixelFormat32bppARGB; + else + lockeddata.PixelFormat = PixelFormat32bppPARGB; stat = GdipBitmapLockBits(bitmap, &src_area, ImageLockModeRead|ImageLockModeUserInputBuf, lockeddata.PixelFormat, &lockeddata); @@ -3127,6 +3235,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image if (do_resampling) { + REAL delta_xx, delta_xy, delta_yx, delta_yy; + /* Transform the bits as needed to the destination. */ dst_data = dst_dyn_data = heap_alloc_zero(sizeof(ARGB) * (dst_area.right - dst_area.left) * (dst_area.bottom - dst_area.top)); if (!dst_data) @@ -3144,24 +3254,42 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image y_dx = dst_to_src_points[2].X - dst_to_src_points[0].X; y_dy = dst_to_src_points[2].Y - dst_to_src_points[0].Y; - for (x=dst_area.left; x<dst_area.right; x++) + delta_yy = dst_area.top * y_dy; + delta_yx = dst_area.top * y_dx; + + for (y=dst_area.top; y<dst_area.bottom; y++) { - for (y=dst_area.top; y<dst_area.bottom; y++) + delta_xx = dst_area.left * x_dx; + delta_xy = dst_area.left * x_dy; + + for (x=dst_area.left; x<dst_area.right; x++) { GpPointF src_pointf; ARGB *dst_color; - src_pointf.X = dst_to_src_points[0].X + x * x_dx + y * y_dx; - src_pointf.Y = dst_to_src_points[0].Y + x * x_dy + y * y_dy; + src_pointf.X = dst_to_src_points[0].X + delta_xx + delta_yx; + src_pointf.Y = dst_to_src_points[0].Y + delta_xy + delta_yy; dst_color = (ARGB*)(dst_data + dst_stride * (y - dst_area.top) + sizeof(ARGB) * (x - dst_area.left)); if (src_pointf.X >= srcx && src_pointf.X < srcx + srcwidth && src_pointf.Y >= srcy && src_pointf.Y < srcy+srcheight) - *dst_color = resample_bitmap_pixel(&src_area, src_data, bitmap->width, bitmap->height, &src_pointf, - imageAttributes, interpolation, offset_mode); + { + if (lockeddata.PixelFormat != PixelFormat32bppPARGB) + *dst_color = resample_bitmap_pixel(&src_area, src_data, bitmap->width, bitmap->height, &src_pointf, + imageAttributes, interpolation, offset_mode); + else + *dst_color = resample_bitmap_pixel_premult(&src_area, src_data, bitmap->width, bitmap->height, &src_pointf, + imageAttributes, interpolation, offset_mode); + } else *dst_color = 0; + + delta_xx += x_dx; + delta_yx += y_dx; } + + delta_xy += x_dy; + delta_yy += y_dy; } } else diff --git a/dll/win32/gdiplus/graphicspath.c b/dll/win32/gdiplus/graphicspath.c index 31a0d3e086..76ef1c248e 100644 --- a/dll/win32/gdiplus/graphicspath.c +++ b/dll/win32/gdiplus/graphicspath.c @@ -17,7 +17,21 @@ * */ +#include <stdarg.h> +#include <math.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); typedef struct path_list_node_t path_list_node_t; struct path_list_node_t { @@ -2292,6 +2306,9 @@ GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y, if(!path) return InvalidParameter; + if (width <= 0.0 || height <= 0.0) + return Ok; + /* make a backup copy of path data */ if((retstat = GdipClonePath(path, &backup)) != Ok) return retstat; diff --git a/dll/win32/gdiplus/image.c b/dll/win32/gdiplus/image.c index 6390bff288..ff9bd9be7f 100644 --- a/dll/win32/gdiplus/image.c +++ b/dll/win32/gdiplus/image.c @@ -17,11 +17,28 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <assert.h> + +#define NONAMELESSUNION + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" + +#define COBJMACROS +#include "objbase.h" +#include "olectl.h" +#include "ole2.h" + +#include "initguid.h" +#include "wincodec.h" +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" -#include <assert.h> -#include <ole2.h> -#include <olectl.h> +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT, IWICImagingFactory**); @@ -38,13 +55,19 @@ static const struct { { &GUID_WICPixelFormatBlackWhite, PixelFormat1bppIndexed, WICBitmapPaletteTypeFixedBW }, { &GUID_WICPixelFormat1bppIndexed, PixelFormat1bppIndexed, WICBitmapPaletteTypeFixedBW }, + { &GUID_WICPixelFormat4bppIndexed, PixelFormat4bppIndexed, WICBitmapPaletteTypeFixedHalftone8 }, { &GUID_WICPixelFormat8bppGray, PixelFormat8bppIndexed, WICBitmapPaletteTypeFixedGray256 }, { &GUID_WICPixelFormat8bppIndexed, PixelFormat8bppIndexed, WICBitmapPaletteTypeFixedHalftone256 }, { &GUID_WICPixelFormat16bppBGR555, PixelFormat16bppRGB555, WICBitmapPaletteTypeFixedHalftone256 }, { &GUID_WICPixelFormat24bppBGR, PixelFormat24bppRGB, WICBitmapPaletteTypeFixedHalftone256 }, { &GUID_WICPixelFormat32bppBGR, PixelFormat32bppRGB, WICBitmapPaletteTypeFixedHalftone256 }, + { &GUID_WICPixelFormat48bppRGB, PixelFormat48bppRGB, WICBitmapPaletteTypeFixedHalftone256 }, { &GUID_WICPixelFormat32bppBGRA, PixelFormat32bppARGB, WICBitmapPaletteTypeFixedHalftone256 }, { &GUID_WICPixelFormat32bppPBGRA, PixelFormat32bppPARGB, WICBitmapPaletteTypeFixedHalftone256 }, + { &GUID_WICPixelFormat32bppCMYK, PixelFormat32bppCMYK, WICBitmapPaletteTypeFixedHalftone256 }, + { &GUID_WICPixelFormat32bppGrayFloat, PixelFormat32bppARGB, WICBitmapPaletteTypeFixedGray256 }, + { &GUID_WICPixelFormat64bppCMYK, PixelFormat48bppRGB, WICBitmapPaletteTypeFixedHalftone256 }, + { &GUID_WICPixelFormat64bppRGBA, PixelFormat48bppRGB, WICBitmapPaletteTypeFixedHalftone256 }, { NULL } }; @@ -4297,6 +4320,11 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream *stream, GpImage **image) HRESULT hr; const struct image_codec *codec=NULL; + TRACE("%p %p\n", stream, image); + + if (!stream || !image) + return InvalidParameter; + /* choose an appropriate image decoder */ stat = get_decoder_info(stream, &codec); if (stat != Ok) return stat; @@ -4545,7 +4573,7 @@ static GpStatus encode_image_jpeg(GpImage *image, IStream* stream, static GpStatus encode_image_gif(GpImage *image, IStream* stream, GDIPCONST EncoderParameters* params) { - return encode_image_wic(image, stream, &CLSID_WICGifEncoder, params); + return encode_image_wic(image, stream, &GUID_ContainerFormatGif, params); } /***************************************************************************** @@ -4558,7 +4586,7 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, encode_image_func encode_image; int i; - TRACE("%p %p %p %p\n", image, stream, clsid, params); + TRACE("%p %p %s %p\n", image, stream, wine_dbgstr_guid(clsid), params); if(!image || !stream) return InvalidParameter; @@ -5572,3 +5600,111 @@ GpStatus WINGDIPAPI GdipBitmapGetHistogramSize(HistogramFormat format, UINT *num *num_of_entries = 256; return Ok; } + +static GpStatus create_optimal_palette(ColorPalette *palette, INT desired, + BOOL transparent, GpBitmap *bitmap) +{ + GpStatus status; + BitmapData data; + HRESULT hr; + IWICImagingFactory *factory; + IWICPalette *wic_palette; + + if (!bitmap) return InvalidParameter; + if (palette->Count < desired) return GenericError; + + status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat24bppRGB, &data); + if (status != Ok) return status; + + hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory); + if (hr != S_OK) + { + GdipBitmapUnlockBits(bitmap, &data); + return hresult_to_status(hr); + } + + hr = IWICImagingFactory_CreatePalette(factory, &wic_palette); + if (hr == S_OK) + { + IWICBitmap *bitmap; + + /* PixelFormat24bppRGB actually stores the bitmap bits as BGR. */ + hr = IWICImagingFactory_CreateBitmapFromMemory(factory, data.Width, data.Height, + &GUID_WICPixelFormat24bppBGR, data.Stride, data.Stride * data.Width, data.Scan0, &bitmap); + if (hr == S_OK) + { + hr = IWICPalette_InitializeFromBitmap(wic_palette, (IWICBitmapSource *)bitmap, desired, transparent); + if (hr == S_OK) + { + palette->Flags = 0; + IWICPalette_GetColorCount(wic_palette, &palette->Count); + IWICPalette_GetColors(wic_palette, palette->Count, palette->Entries, &palette->Count); + } + + IWICBitmap_Release(bitmap); + } + + IWICPalette_Release(wic_palette); + } + + IWICImagingFactory_Release(factory); + GdipBitmapUnlockBits(bitmap, &data); + + return hresult_to_status(hr); +} + +/***************************************************************************** + * GdipInitializePalette [GDIPLUS.@] + */ +GpStatus WINGDIPAPI GdipInitializePalette(ColorPalette *palette, + PaletteType type, INT desired, BOOL transparent, GpBitmap *bitmap) +{ + TRACE("(%p,%d,%d,%d,%p)\n", palette, type, desired, transparent, bitmap); + + if (!palette) return InvalidParameter; + + switch (type) + { + case PaletteTypeCustom: + return Ok; + + case PaletteTypeOptimal: + return create_optimal_palette(palette, desired, transparent, bitmap); + + /* WIC palette type enumeration matches these gdiplus enums */ + case PaletteTypeFixedBW: + case PaletteTypeFixedHalftone8: + case PaletteTypeFixedHalftone27: + case PaletteTypeFixedHalftone64: + case PaletteTypeFixedHalftone125: + case PaletteTypeFixedHalftone216: + case PaletteTypeFixedHalftone252: + case PaletteTypeFixedHalftone256: + { + ColorPalette *wic_palette; + GpStatus status = Ok; + + wic_palette = get_palette(NULL, type); + if (!wic_palette) return OutOfMemory; + + if (palette->Count >= wic_palette->Count) + { + palette->Flags = wic_palette->Flags; + palette->Count = wic_palette->Count; + memcpy(palette->Entries, wic_palette->Entries, wic_palette->Count * sizeof(wic_palette->Entries[0])); + } + else + status = GenericError; + + heap_free(wic_palette); + + return status; + } + + default: + FIXME("unknown palette type %d\n", type); + break; + } + + return InvalidParameter; +} diff --git a/dll/win32/gdiplus/imageattributes.c b/dll/win32/gdiplus/imageattributes.c index b30eba9444..ab197a4f61 100644 --- a/dll/win32/gdiplus/imageattributes.c +++ b/dll/win32/gdiplus/imageattributes.c @@ -16,7 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "windef.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr) diff --git a/dll/win32/gdiplus/matrix.c b/dll/win32/gdiplus/matrix.c index 8893206ba8..2219d46369 100644 --- a/dll/win32/gdiplus/matrix.c +++ b/dll/win32/gdiplus/matrix.c @@ -16,7 +16,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <math.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); /* Multiplies two matrices of the form * diff --git a/dll/win32/gdiplus/metafile.c b/dll/win32/gdiplus/metafile.c index 165a55dc8c..77673a7ea3 100644 --- a/dll/win32/gdiplus/metafile.c +++ b/dll/win32/gdiplus/metafile.c @@ -16,10 +16,32 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <math.h> +#include <assert.h> + +#define NONAMELESSUNION + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "wine/unicode.h" + +#define COBJMACROS +#include "objbase.h" +#include "ocidl.h" +#include "olectl.h" +#include "ole2.h" + +#include "winreg.h" +#include "shlwapi.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" +#include "wine/list.h" -#include <assert.h> -#include <ole2.h> +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT, IWICImagingFactory**); diff --git a/dll/win32/gdiplus/pathiterator.c b/dll/win32/gdiplus/pathiterator.c index 7fc2711757..2addbc3bc5 100644 --- a/dll/win32/gdiplus/pathiterator.c +++ b/dll/win32/gdiplus/pathiterator.c @@ -17,7 +17,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath* path) { diff --git a/dll/win32/gdiplus/pen.c b/dll/win32/gdiplus/pen.c index 3f732eb069..2c49371bd5 100644 --- a/dll/win32/gdiplus/pen.c +++ b/dll/win32/gdiplus/pen.c @@ -16,7 +16,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); static DWORD gdip_to_gdi_dash(GpDashStyle dash) { diff --git a/dll/win32/gdiplus/precomp.h b/dll/win32/gdiplus/precomp.h new file mode 100644 index 0000000000..fd58a83cf3 --- /dev/null +++ b/dll/win32/gdiplus/precomp.h @@ -0,0 +1,17 @@ + +#ifndef _WINE_GDIPLUS_PRECOMP_H_ +#define _WINE_GDIPLUS_PRECOMP_H_ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define NONAMELESSUNION +#define COBJMACROS + +#include "gdiplus_private.h" + +#include <wine/unicode.h> +#include <wine/debug.h> + +#endif /* !_WINE_GDIPLUS_PRECOMP_H_ */ diff --git a/dll/win32/gdiplus/region.c b/dll/win32/gdiplus/region.c index c40882c7ad..8eb3ff3535 100644 --- a/dll/win32/gdiplus/region.c +++ b/dll/win32/gdiplus/region.c @@ -17,7 +17,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); /********************************************************** * diff --git a/dll/win32/gdiplus/stringformat.c b/dll/win32/gdiplus/stringformat.c index 4d19b6d798..e376e7b36c 100644 --- a/dll/win32/gdiplus/stringformat.c +++ b/dll/win32/gdiplus/stringformat.c @@ -17,7 +17,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winnls.h" + +#include "objbase.h" + +#include "gdiplus.h" #include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); const GpStringFormat default_drawstring_format = { diff --git a/media/doc/README.WINE b/media/doc/README.WINE index aee3bad39e..fc1cce6951 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -68,7 +68,7 @@ reactos/dll/win32/dciman32 # Synced to WineStaging-3.3 reactos/dll/win32/faultrep # Synced to WineStaging-2.9 reactos/dll/win32/fontsub # Synced to WineStaging-2.9 reactos/dll/win32/fusion # Synced to WineStaging-3.3 -reactos/dll/win32/gdiplus # Synced to Wine-3.0 +reactos/dll/win32/gdiplus # Synced to WineStaging-3.3 reactos/dll/win32/hhctrl.ocx # Synced to Wine-3.0 reactos/dll/win32/hlink # Synced to Wine-3.0 reactos/dll/win32/hnetcfg # Synced to Wine-3.0
6 years, 9 months
1
0
0
0
01/01: [FUSION_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=235892b4a4f85b090035d…
commit 235892b4a4f85b090035de6ce5f42b6d7170476a Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 9 13:08:05 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 9 13:08:05 2018 +0100 [FUSION_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/fusion/asmcache.c | 14 +++----------- modules/rostests/winetests/fusion/asmenum.c | 18 +++++------------- modules/rostests/winetests/fusion/asmname.c | 17 ++++------------- modules/rostests/winetests/fusion/fusion.c | 14 ++------------ 4 files changed, 14 insertions(+), 49 deletions(-) diff --git a/modules/rostests/winetests/fusion/asmcache.c b/modules/rostests/winetests/fusion/asmcache.c index 63dcd36753..081023d809 100644 --- a/modules/rostests/winetests/fusion/asmcache.c +++ b/modules/rostests/winetests/fusion/asmcache.c @@ -16,25 +16,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define INITGUID #include <stdio.h> -//#include <windows.h> -#include <windef.h> -#include <winbase.h> -#include <winver.h> -#include <objbase.h> -//#include <mscoree.h> +#include <windows.h> +#include <mscoree.h> #include <fusion.h> #include <corerror.h> -#include <wine/test.h> +#include "wine/test.h" typedef struct _tagASSEMBLY ASSEMBLY; diff --git a/modules/rostests/winetests/fusion/asmenum.c b/modules/rostests/winetests/fusion/asmenum.c index 49caca5c8f..5091be464a 100644 --- a/modules/rostests/winetests/fusion/asmenum.c +++ b/modules/rostests/winetests/fusion/asmenum.c @@ -16,26 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #include <stdio.h> -//#include <windows.h> -#include <windef.h> -#include <winbase.h> -#include <winreg.h> -#include <winnls.h> +#include <windows.h> #include <shlwapi.h> -//#include <mscoree.h> +#include <mscoree.h> #include <fusion.h> -//#include <corerror.h> +#include <corerror.h> -#include <wine/test.h> -#include <wine/list.h> +#include "wine/test.h" +#include "wine/list.h" static HRESULT (WINAPI *pCreateAssemblyEnum)(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, diff --git a/modules/rostests/winetests/fusion/asmname.c b/modules/rostests/winetests/fusion/asmname.c index 1558f500de..f48fe32d4c 100644 --- a/modules/rostests/winetests/fusion/asmname.c +++ b/modules/rostests/winetests/fusion/asmname.c @@ -16,26 +16,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS -//#include <stdio.h> -#include <stdarg.h> +#include <stdio.h> -//#include <windows.h> -#include <windef.h> -#include <winbase.h> -#include <winnls.h> -#include <objbase.h> -//#include <mscoree.h> +#include <windows.h> +#include <mscoree.h> #include <fusion.h> #include <corerror.h> #include <strsafe.h> -#include <wine/test.h> +#include "wine/test.h" /* ok-like statement which takes two unicode strings or one unicode and one ANSI string as arguments */ static CHAR string1[MAX_PATH]; diff --git a/modules/rostests/winetests/fusion/fusion.c b/modules/rostests/winetests/fusion/fusion.c index 48d90306dd..82829d55b1 100644 --- a/modules/rostests/winetests/fusion/fusion.c +++ b/modules/rostests/winetests/fusion/fusion.c @@ -16,20 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <stdarg.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -//#include <windows.h> -#include <windef.h> -#include <winbase.h> -#include <winnls.h> -#include <objbase.h> +#include <windows.h> #include <fusion.h> -#include <wine/test.h> +#include "wine/test.h" static HMODULE hmscoree;
6 years, 9 months
1
0
0
0
01/01: [FUSION] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b980bb98c2971a9b19bc0…
commit b980bb98c2971a9b19bc0adb25fc902fa4bdf995 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 9 13:07:30 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 9 13:07:30 2018 +0100 [FUSION] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/fusion/CMakeLists.txt | 4 +-- dll/win32/fusion/asmcache.c | 71 +++++++++++++++++++++++++---------------- dll/win32/fusion/asmenum.c | 36 ++++++++++++++------- dll/win32/fusion/asmname.c | 55 +++++++++++++++++++------------ dll/win32/fusion/assembly.c | 58 +++++++++++++++++---------------- dll/win32/fusion/fusion.c | 15 ++++++++- dll/win32/fusion/fusionpriv.h | 26 +++++---------- dll/win32/fusion/precomp.h | 20 ++++++++++++ media/doc/README.WINE | 2 +- 9 files changed, 177 insertions(+), 110 deletions(-) diff --git a/dll/win32/fusion/CMakeLists.txt b/dll/win32/fusion/CMakeLists.txt index 67613c14bf..fcaa5c23f6 100644 --- a/dll/win32/fusion/CMakeLists.txt +++ b/dll/win32/fusion/CMakeLists.txt @@ -9,7 +9,7 @@ list(APPEND COMMON_SOURCE asmname.c assembly.c fusion.c - fusionpriv.h + precomp.h ${CMAKE_CURRENT_BINARY_DIR}/fusion_stubs.c) add_library(fusion_common STATIC ${COMMON_SOURCE}) @@ -22,7 +22,7 @@ add_library(fusion SHARED set_module_type(fusion win32dll) target_link_libraries(fusion fusion_common uuid wine) add_importlibs(fusion advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll) -add_pch(fusion_common fusionpriv.h COMMON_SOURCE) +add_pch(fusion_common precomp.h COMMON_SOURCE) add_cd_file(TARGET fusion DESTINATION
reactos/Microsoft.NET/Framework/v1.0.3705
FOR all) add_cd_file(TARGET fusion DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/fusion/asmcache.c b/dll/win32/fusion/asmcache.c index c8f389a9a0..668aa8777e 100644 --- a/dll/win32/fusion/asmcache.c +++ b/dll/win32/fusion/asmcache.c @@ -18,7 +18,28 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <stdio.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winver.h" +#include "wincrypt.h" +#include "winreg.h" +#include "shlwapi.h" +#include "dbghelp.h" +#include "ole2.h" +#include "fusion.h" +#include "corerror.h" + #include "fusionpriv.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fusion); typedef struct { IAssemblyCache IAssemblyCache_iface; @@ -42,9 +63,7 @@ static BOOL create_full_path(LPCWSTR path) BOOL ret = TRUE; int len; - new_path = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 1) * sizeof(WCHAR)); - if (!new_path) - return FALSE; + if (!(new_path = heap_alloc((strlenW(path) + 1) * sizeof(WCHAR)))) return FALSE; strcpyW(new_path, path); @@ -82,7 +101,7 @@ static BOOL create_full_path(LPCWSTR path) new_path[len] = '\\'; } - HeapFree(GetProcessHeap(), 0, new_path); + heap_free(new_path); return ret; } @@ -179,7 +198,7 @@ static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface) if (!refCount) { CloseHandle( cache->lock ); - HeapFree( GetProcessHeap(), 0, cache ); + heap_free( cache ); } return refCount; } @@ -237,7 +256,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface if (hr != HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER )) goto done; - if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) + if (!(path = heap_alloc( len * sizeof(WCHAR) ))) { hr = E_OUTOFMEMORY; goto done; @@ -272,7 +291,7 @@ done: IAssemblyName_Release( asmname ); if (next) IAssemblyName_Release( next ); if (asmenum) IAssemblyEnum_Release( asmenum ); - HeapFree( GetProcessHeap(), 0, path ); + heap_free( path ); cache_unlock( cache ); return hr; } @@ -354,9 +373,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem(IAssemblyCache *ppAsmItem = NULL; - item = HeapAlloc(GetProcessHeap(), 0, sizeof(IAssemblyCacheItemImpl)); - if (!item) - return E_OUTOFMEMORY; + if (!(item = heap_alloc(sizeof(*item)))) return E_OUTOFMEMORY; item->IAssemblyCacheItem_iface.lpVtbl = &AssemblyCacheItemVtbl; item->ref = 1; @@ -379,22 +396,22 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_ DWORD len = strlenW( filename ); HRESULT hr = S_OK; - if (!(src_file = HeapAlloc( GetProcessHeap(), 0, (src_len + len + 1) * sizeof(WCHAR) ))) + if (!(src_file = heap_alloc( (src_len + len + 1) * sizeof(WCHAR) ))) return E_OUTOFMEMORY; memcpy( src_file, src_dir, src_len * sizeof(WCHAR) ); strcpyW( src_file + src_len, filename ); - if (!(dst_file = HeapAlloc( GetProcessHeap(), 0, (dst_len + len + 1) * sizeof(WCHAR) ))) + if (!(dst_file = heap_alloc( (dst_len + len + 1) * sizeof(WCHAR) ))) { - HeapFree( GetProcessHeap(), 0, src_file ); + heap_free( src_file ); return E_OUTOFMEMORY; } memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) ); strcpyW( dst_file + dst_len, filename ); if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() ); - HeapFree( GetProcessHeap(), 0, src_file ); - HeapFree( GetProcessHeap(), 0, dst_file ); + heap_free( src_file ); + heap_free( dst_file ); return hr; } @@ -467,7 +484,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, get_assembly_directory(asmdir, MAX_PATH, clr_version, architecture); dst_len += strlenW(asmdir) + strlenW(name) + strlenW(version) + strlenW(token); - if (!(dst_dir = HeapAlloc(GetProcessHeap(), 0, dst_len * sizeof(WCHAR)))) + if (!(dst_dir = heap_alloc(dst_len * sizeof(WCHAR)))) { hr = E_OUTOFMEMORY; goto done; @@ -507,13 +524,13 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, } done: - HeapFree(GetProcessHeap(), 0, name); - HeapFree(GetProcessHeap(), 0, token); - HeapFree(GetProcessHeap(), 0, version); - HeapFree(GetProcessHeap(), 0, asmpath); - HeapFree(GetProcessHeap(), 0, dst_dir); - for (i = 0; i < count; i++) HeapFree(GetProcessHeap(), 0, external_files[i]); - HeapFree(GetProcessHeap(), 0, external_files); + heap_free(name); + heap_free(token); + heap_free(version); + heap_free(asmpath); + heap_free(dst_dir); + for (i = 0; i < count; i++) heap_free(external_files[i]); + heap_free(external_files); assembly_release(assembly); cache_unlock( cache ); return hr; @@ -544,16 +561,14 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved *ppAsmCache = NULL; - cache = HeapAlloc(GetProcessHeap(), 0, sizeof(IAssemblyCacheImpl)); - if (!cache) - return E_OUTOFMEMORY; + if (!(cache = heap_alloc(sizeof(*cache)))) return E_OUTOFMEMORY; cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl; cache->ref = 1; cache->lock = CreateMutexW( NULL, FALSE, cache_mutex_nameW ); if (!cache->lock) { - HeapFree( GetProcessHeap(), 0, cache ); + heap_free( cache ); return HRESULT_FROM_WIN32( GetLastError() ); } *ppAsmCache = &cache->IAssemblyCache_iface; @@ -606,7 +621,7 @@ static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface) TRACE("(%p)->(ref before = %u)\n", This, refCount + 1); if (!refCount) - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); return refCount; } diff --git a/dll/win32/fusion/asmenum.c b/dll/win32/fusion/asmenum.c index 4a87768e16..ba86818a2c 100644 --- a/dll/win32/fusion/asmenum.c +++ b/dll/win32/fusion/asmenum.c @@ -18,9 +18,26 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#define COBJMACROS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "guiddef.h" +#include "fusion.h" +#include "corerror.h" #include "fusionpriv.h" -#include <wine/list.h> +#include "wine/debug.h" +#include "wine/unicode.h" +#include "wine/list.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fusion); typedef struct _tagASMNAME { @@ -89,10 +106,10 @@ static ULONG WINAPI IAssemblyEnumImpl_Release(IAssemblyEnum *iface) list_remove(&asmname->entry); IAssemblyName_Release(asmname->name); - HeapFree(GetProcessHeap(), 0, asmname); + heap_free(asmname); } - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); } return refCount; @@ -338,8 +355,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, } sprintfW(disp, name_fmt, parent, version, token); - asmname = HeapAlloc(GetProcessHeap(), 0, sizeof(ASMNAME)); - if (!asmname) + if (!(asmname = heap_alloc(sizeof(*asmname)))) { hr = E_OUTOFMEMORY; break; @@ -349,7 +365,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, CANOF_PARSE_DISPLAY_NAME, NULL); if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, asmname); + heap_free(asmname); break; } @@ -357,7 +373,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, if (FAILED(hr)) { IAssemblyName_Release(asmname->name); - HeapFree(GetProcessHeap(), 0, asmname); + heap_free(asmname); break; } @@ -460,9 +476,7 @@ HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, if (dwFlags == 0 || dwFlags == ASM_CACHE_ROOT) return E_INVALIDARG; - asmenum = HeapAlloc(GetProcessHeap(), 0, sizeof(IAssemblyEnumImpl)); - if (!asmenum) - return E_OUTOFMEMORY; + if (!(asmenum = heap_alloc(sizeof(*asmenum)))) return E_OUTOFMEMORY; asmenum->IAssemblyEnum_iface.lpVtbl = &AssemblyEnumVtbl; asmenum->ref = 1; @@ -473,7 +487,7 @@ HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, hr = enumerate_gac(asmenum, pName); if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, asmenum); + heap_free(asmenum); return hr; } } diff --git a/dll/win32/fusion/asmname.c b/dll/win32/fusion/asmname.c index 79a99f5bc0..c5d07009a3 100644 --- a/dll/win32/fusion/asmname.c +++ b/dll/win32/fusion/asmname.c @@ -18,11 +18,26 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> +#include <assert.h> + +#define COBJMACROS +#define INITGUID + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "guiddef.h" +#include "fusion.h" +#include "corerror.h" +#include "strsafe.h" + +#include "wine/debug.h" +#include "wine/unicode.h" #include "fusionpriv.h" -#include <assert.h> -#include <winuser.h> -#include <strsafe.h> +WINE_DEFAULT_DEBUG_CHANNEL(fusion); typedef struct { IAssemblyName IAssemblyName_iface; @@ -100,12 +115,12 @@ static ULONG WINAPI IAssemblyNameImpl_Release(IAssemblyName *iface) if (!refCount) { - HeapFree(GetProcessHeap(), 0, This->path); - HeapFree(GetProcessHeap(), 0, This->displayname); - HeapFree(GetProcessHeap(), 0, This->name); - HeapFree(GetProcessHeap(), 0, This->culture); - HeapFree(GetProcessHeap(), 0, This->procarch); - HeapFree(GetProcessHeap(), 0, This); + heap_free(This->path); + heap_free(This->displayname); + heap_free(This->name); + heap_free(This->culture); + heap_free(This->procarch); + heap_free(This); } return refCount; @@ -648,7 +663,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int len ) BOOL quoted = FALSE; unsigned int i = 0; - if (!(ret = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return NULL; + if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL; if (*p == '\"') { quoted = TRUE; @@ -657,7 +672,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int len ) while (*p && *p != '\"') ret[i++] = *p++; if ((quoted && *p != '\"') || (!quoted && *p == '\"')) { - HeapFree( GetProcessHeap(), 0, ret ); + heap_free( ret ); return NULL; } ret[i] = 0; @@ -754,7 +769,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam hr = parse_procarch( name, name->procarch ); } - HeapFree( GetProcessHeap(), 0, value ); + heap_free( value ); if (FAILED(hr)) goto done; @@ -763,13 +778,13 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam } done: - HeapFree(GetProcessHeap(), 0, save); + heap_free(save); if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, name->displayname); - HeapFree(GetProcessHeap(), 0, name->name); - HeapFree(GetProcessHeap(), 0, name->culture); - HeapFree(GetProcessHeap(), 0, name->procarch); + heap_free(name->displayname); + heap_free(name->name); + heap_free(name->culture); + heap_free(name->procarch); } return hr; } @@ -794,9 +809,7 @@ HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj, (!szAssemblyName || !*szAssemblyName)) return E_INVALIDARG; - name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAssemblyNameImpl)); - if (!name) - return E_OUTOFMEMORY; + if (!(name = heap_alloc_zero(sizeof(*name)))) return E_OUTOFMEMORY; name->IAssemblyName_iface.lpVtbl = &AssemblyNameVtbl; name->ref = 1; @@ -804,7 +817,7 @@ HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj, hr = parse_display_name(name, szAssemblyName); if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, name); + heap_free(name); return hr; } diff --git a/dll/win32/fusion/assembly.c b/dll/win32/fusion/assembly.c index 1159d9612a..ec380ef442 100644 --- a/dll/win32/fusion/assembly.c +++ b/dll/win32/fusion/assembly.c @@ -18,11 +18,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "fusionpriv.h" +#include <stdarg.h> +#include <stdio.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winver.h" +#include "wincrypt.h" +#include "dbghelp.h" +#include "ole2.h" +#include "fusion.h" +#include "corhdr.h" -#include <wincrypt.h> -#include <dbghelp.h> -#include <corhdr.h> +#include "fusionpriv.h" +#include "wine/debug.h" +#include "wine/unicode.h" #define TableFromToken(tk) (TypeFromToken(tk) >> 24) #define TokenFromTable(idx) (idx << 24) @@ -528,9 +539,7 @@ static HRESULT parse_metadata_header(ASSEMBLY *assembly, DWORD *hdrsz) metadatahdr = (METADATAHDR *)ptr; - assembly->metadatahdr = HeapAlloc(GetProcessHeap(), 0, sizeof(METADATAHDR)); - if (!assembly->metadatahdr) - return E_OUTOFMEMORY; + if (!(assembly->metadatahdr = heap_alloc(sizeof(*assembly->metadatahdr)))) return E_OUTOFMEMORY; size = FIELD_OFFSET(METADATAHDR, Version); memcpy(assembly->metadatahdr, metadatahdr, size); @@ -635,9 +644,7 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file) *out = NULL; - assembly = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ASSEMBLY)); - if (!assembly) - return E_OUTOFMEMORY; + if (!(assembly = heap_alloc_zero(sizeof(*assembly)))) return E_OUTOFMEMORY; assembly->path = strdupW(file); if (!assembly->path) @@ -688,12 +695,12 @@ HRESULT assembly_release(ASSEMBLY *assembly) if (!assembly) return S_OK; - HeapFree(GetProcessHeap(), 0, assembly->metadatahdr); - HeapFree(GetProcessHeap(), 0, assembly->path); + heap_free(assembly->metadatahdr); + heap_free(assembly->path); UnmapViewOfFile(assembly->data); CloseHandle(assembly->hmap); CloseHandle(assembly->hfile); - HeapFree(GetProcessHeap(), 0, assembly); + heap_free(assembly); return S_OK; } @@ -706,8 +713,8 @@ static LPWSTR assembly_dup_str(const ASSEMBLY *assembly, DWORD index) len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - if ((cpy = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) - MultiByteToWideChar(CP_ACP, 0, str, -1, cpy, len); + if ((cpy = heap_alloc(len * sizeof(WCHAR)))) + MultiByteToWideChar(CP_ACP, 0, str, -1, cpy, len); return cpy; } @@ -741,7 +748,7 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name) HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path) { - LPWSTR cpy = HeapAlloc(GetProcessHeap(), 0, (strlenW(assembly->path) + 1) * sizeof(WCHAR)); + WCHAR *cpy = heap_alloc((strlenW(assembly->path) + 1) * sizeof(WCHAR)); *path = cpy; if (cpy) strcpyW(cpy, assembly->path); @@ -768,8 +775,7 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version) if (!asmtbl) return E_FAIL; - *version = HeapAlloc(GetProcessHeap(), 0, sizeof(format) + 4 * strlen("65535") * sizeof(WCHAR)); - if (!*version) + if (!(*version = heap_alloc(sizeof(format) + 4 * strlen("65535") * sizeof(WCHAR)))) return E_OUTOFMEMORY; sprintfW(*version, format, asmtbl->MajorVersion, asmtbl->MinorVersion, @@ -841,8 +847,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) if (!CryptGetHashParam(hash, HP_HASHVAL, NULL, &size, 0)) return E_FAIL; - hashdata = HeapAlloc(GetProcessHeap(), 0, size); - if (!hashdata) + if (!(hashdata = heap_alloc(size))) { hr = E_OUTOFMEMORY; goto done; @@ -854,8 +859,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) for (i = size - 1; i >= size - 8; i--) tokbytes[size - i - 1] = hashdata[i]; - tok = HeapAlloc(GetProcessHeap(), 0, (TOKEN_LENGTH + 1) * sizeof(WCHAR)); - if (!tok) + if (!(tok = heap_alloc((TOKEN_LENGTH + 1) * sizeof(WCHAR)))) { hr = E_OUTOFMEMORY; goto done; @@ -867,7 +871,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) hr = S_OK; done: - HeapFree(GetProcessHeap(), 0, hashdata); + heap_free(hashdata); CryptDestroyHash(hash); CryptReleaseContext(crypt, 0); @@ -902,9 +906,7 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c if (num_rows <= 0) return S_OK; - ret = HeapAlloc(GetProcessHeap(), 0, num_rows * sizeof(WCHAR *)); - if (!ret) - return E_OUTOFMEMORY; + if (!(ret = heap_alloc(num_rows * sizeof(WCHAR *)))) return E_OUTOFMEMORY; for (i = 0; i < num_rows; i++) { @@ -917,8 +919,8 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c ret[i] = assembly_dup_str(assembly, idx); if (!ret[i]) { - for (; i >= 0; i--) HeapFree(GetProcessHeap(), 0, ret[i]); - HeapFree(GetProcessHeap(), 0, ret); + for (; i >= 0; i--) heap_free(ret[i]); + heap_free(ret); return E_OUTOFMEMORY; } ptr += assembly->stringsz; /* skip Name field */ diff --git a/dll/win32/fusion/fusion.c b/dll/win32/fusion/fusion.c index a51f40660d..b038b38092 100644 --- a/dll/win32/fusion/fusion.c +++ b/dll/win32/fusion/fusion.c @@ -18,7 +18,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "fusionpriv.h" +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "fusion.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fusion); + /****************************************************************** * InitializeFusion (FUSION.@) diff --git a/dll/win32/fusion/fusionpriv.h b/dll/win32/fusion/fusionpriv.h index 2a61e4f476..24c932d156 100644 --- a/dll/win32/fusion/fusionpriv.h +++ b/dll/win32/fusion/fusionpriv.h @@ -23,25 +23,16 @@ #include <stdarg.h> -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winver.h" +#include "wine/heap.h" -#define COBJMACROS -#define NONAMELESSUNION -#define NONAMELESSSTRUCT - -#include <windef.h> -#include <winbase.h> -#include <winver.h> +#ifdef __REACTOS__ #include <objbase.h> #include <fusion.h> -#include <corerror.h> - -#include <wine/unicode.h> - -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(fusion); +#endif #include <pshpack1.h> @@ -463,8 +454,7 @@ static inline LPWSTR strdupW(LPCWSTR src) if (!src) return NULL; - dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR)); - if (dest) + if ((dest = heap_alloc((lstrlenW(src) + 1) * sizeof(WCHAR)))) lstrcpyW(dest, src); return dest; diff --git a/dll/win32/fusion/precomp.h b/dll/win32/fusion/precomp.h new file mode 100644 index 0000000000..de2c9a84b0 --- /dev/null +++ b/dll/win32/fusion/precomp.h @@ -0,0 +1,20 @@ + +#ifndef _WINE_FUSION_PRECOMP_H_ +#define _WINE_FUSION_PRECOMP_H_ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include "fusionpriv.h" + +#include <corerror.h> + +#include <wine/unicode.h> +#include <wine/debug.h> + +#endif /* !_WINE_FUSION_PRECOMP_H_ */ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 4fde5a92a4..aee3bad39e 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -67,7 +67,7 @@ reactos/dll/win32/dbghelp # Synced to WineStaging-3.3 reactos/dll/win32/dciman32 # Synced to WineStaging-3.3 reactos/dll/win32/faultrep # Synced to WineStaging-2.9 reactos/dll/win32/fontsub # Synced to WineStaging-2.9 -reactos/dll/win32/fusion # Synced to Wine-3.0 +reactos/dll/win32/fusion # Synced to WineStaging-3.3 reactos/dll/win32/gdiplus # Synced to Wine-3.0 reactos/dll/win32/hhctrl.ocx # Synced to Wine-3.0 reactos/dll/win32/hlink # Synced to Wine-3.0
6 years, 9 months
1
0
0
0
01/01: [CRYPTUI_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4bb5d086b437da361653…
commit e4bb5d086b437da36165353d638de67b799a7e3e Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 9 13:06:48 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 9 13:06:48 2018 +0100 [CRYPTUI_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/cryptui/cryptui.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/rostests/winetests/cryptui/cryptui.c b/modules/rostests/winetests/cryptui/cryptui.c index fd16a6b8b0..bb1db929ba 100644 --- a/modules/rostests/winetests/cryptui/cryptui.c +++ b/modules/rostests/winetests/cryptui/cryptui.c @@ -18,16 +18,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <stdarg.h> -//#include <stdio.h> +#include <stdio.h> #define NONAMELESSUNION #include <windef.h> #include <winbase.h> -//#include <winerror.h> +#include <winerror.h> #include <winuser.h> -//#include <wincrypt.h> +#include <wincrypt.h> #include <cryptuiapi.h> -#include <wine/test.h> +#include "wine/test.h" static BYTE v1CertWithValidPubKey[] = { 0x30,0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
6 years, 9 months
1
0
0
0
← Newer
1
...
31
32
33
34
35
36
37
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200