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
November 2019
----- 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
24 participants
322 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSVFW32_WINETEST] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ac43fd2b92515ba1b2c4d…
commit ac43fd2b92515ba1b2c4da2ad468a7654df03cea Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:07:31 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:07:31 2019 +0100 [MSVFW32_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/msvfw32/CMakeLists.txt | 4 +- modules/rostests/winetests/msvfw32/mciwnd.c | 203 +++++++++++++++++++++ modules/rostests/winetests/msvfw32/msvfw.c | 148 ++++++++++++++- .../rostests/winetests/msvfw32/msvfw32.manifest | 16 ++ modules/rostests/winetests/msvfw32/msvfw32.rc | 22 +++ modules/rostests/winetests/msvfw32/testlist.c | 2 + 6 files changed, 389 insertions(+), 6 deletions(-) diff --git a/modules/rostests/winetests/msvfw32/CMakeLists.txt b/modules/rostests/winetests/msvfw32/CMakeLists.txt index f8c3038ec60..738e14d4a7e 100644 --- a/modules/rostests/winetests/msvfw32/CMakeLists.txt +++ b/modules/rostests/winetests/msvfw32/CMakeLists.txt @@ -1,6 +1,6 @@ add_definitions(-DUSE_WINE_TODOS) -add_executable(msvfw32_winetest drawdib.c msvfw.c testlist.c) +add_executable(msvfw32_winetest drawdib.c mciwnd.c msvfw.c testlist.c msvfw32.rc) set_module_type(msvfw32_winetest win32cui) -add_importlibs(msvfw32_winetest gdi32 advapi32 msvfw32 msvcrt kernel32) +add_importlibs(msvfw32_winetest user32 gdi32 advapi32 msvfw32 msvcrt kernel32) add_rostests_file(TARGET msvfw32_winetest) diff --git a/modules/rostests/winetests/msvfw32/mciwnd.c b/modules/rostests/winetests/msvfw32/mciwnd.c new file mode 100644 index 00000000000..27ca2e8d203 --- /dev/null +++ b/modules/rostests/winetests/msvfw32/mciwnd.c @@ -0,0 +1,203 @@ +/* + * Unit tests for MCIWnd + * + * Copyright 2019 Sven Baars + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> +#include <vfw.h> + +#include "wine/heap.h" +#include "wine/test.h" + +static const DWORD file_header[] = /* file_header */ +{ + FOURCC_RIFF, 0x8c0 /* file size */, + formtypeAVI, + FOURCC_LIST, 0xc0 /* list length */, + listtypeAVIHEADER, ckidAVIMAINHDR, sizeof(MainAVIHeader), +}; + +static const MainAVIHeader main_avi_header = +{ + 0x0001046b, /* dwMicroSecPerFrame */ + 0x00000000, /* dwMaxBytesPerSec */ + 0x00000000, /* dwPaddingGranularity */ + 0x00000810, /* dwFlags */ + 2, /* dwTotalFrames */ + 0, /* dwInitialFrames */ + 1, /* dwStreams */ + 0x48, /* dwSuggestedBufferSize*/ + 5, /* dwWidth */ + 5, /* dwHeight */ + { 0, 0, 0, 0 } /* dwReserved[4] */ +}; + +static const DWORD stream_list[] = +{ + FOURCC_LIST, 0x74 /* length */, + listtypeSTREAMHEADER, ckidSTREAMHEADER, 0x38 /* length */, +}; + +static const AVIStreamHeader avi_stream_header = +{ + streamtypeVIDEO, /* fccType */ + 0, /* fccHandler */ + 0, /* dwFlags */ + 0, /* wPriority */ + 0, /* wLanguage */ + 0, /* dwInitialFrames */ + 1, /* dwScale */ + 0xf, /* dwRate */ + 0, /* dwStart */ + 2, /* dwLength */ + 0x48, /* dwSuggestedBufferSize*/ + 0, /* dwQuality */ + 0, /* dwSampleSize */ + { 0, 0, 0, 0 } /* short left right top bottom */ +}; + +static const DWORD video_stream_format[] = +{ + ckidSTREAMFORMAT, + 0x28 /* length */, + 0x28 /* length */, + 5 /* width */, + 5 /* height */, + 0x00180001 , + mmioFOURCC('c', 'v', 'i', 'd'), + 0x245a, + 0, 0, 0, 0, +}; + +static const DWORD padding[] = +{ + ckidAVIPADDING, 0x718 /* length */, +}; + +static const DWORD data[] = +{ + FOURCC_LIST, 0xa4 /* length */, listtypeAVIMOVIE, + mmioFOURCC('0', '0', 'd', 'b'), 0x48, 0x48000000, 0x08000800, + 0x00100100, 0x00003e00, 0x08000000, 0x00200800, + 0x00001600, 0x00000000, 0x00003a00, 0x22e306f9, + 0xfc120000, 0x0a000022, 0x00000000, 0x00300000, + 0x00c01200, 0x00000000, 0x02010000, 0x00000000, + mmioFOURCC('0', '0', 'd', 'b'), 0x48, 0x48000000, 0x08000800, + 0x00100100, 0x00003e00, 0x08000000, 0x00200800, + 0x00001600, 0x00000000, 0x00003a00, 0x22e306f9, + 0xfc120000, 0x0a000022, 0x00000000, 0x00300000, + 0x00c01200, 0x00000000, 0x02010000, 0x00000000, + mmioFOURCC('i', 'd', 'x', '1'), 0x20, mmioFOURCC('0', '0', 'd', 'b'), 0x10, + 0x04, 0x48, mmioFOURCC('0', '0', 'd', 'b'), 0x10, + 0x54, 0x48, +}; + +static BOOL create_avi_file(char *fname) +{ + HANDLE hFile; + DWORD written; + char temp_path[MAX_PATH]; + BOOL ret; + BYTE *buffer; + ULONG buffer_length; + + ret = GetTempPathA(sizeof(temp_path), temp_path); + ok(ret, "Failed to get a temp path, err %d\n", GetLastError()); + if (!ret) + return FALSE; + + ret = GetTempFileNameA(temp_path, "mci", 0, fname); + ok(ret, "Failed to get a temp name, err %d\n", GetLastError()); + if (!ret) + return FALSE; + DeleteFileA(fname); + + lstrcatA(fname, ".avi"); + + hFile = CreateFileA(fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ok(hFile != INVALID_HANDLE_VALUE, "Failed to create a file, err %d\n", GetLastError()); + if (hFile == INVALID_HANDLE_VALUE) return FALSE; + + buffer_length = padding[1]; + buffer = heap_alloc_zero(buffer_length); + + WriteFile(hFile, file_header, sizeof(file_header), &written, NULL); + WriteFile(hFile, &main_avi_header, sizeof(MainAVIHeader), &written, NULL); + WriteFile(hFile, stream_list, sizeof(stream_list), &written, NULL); + WriteFile(hFile, &avi_stream_header, sizeof(AVIStreamHeader), &written, NULL); + WriteFile(hFile, video_stream_format, sizeof(video_stream_format), &written, NULL); + WriteFile(hFile, padding, sizeof(padding), &written, NULL); + WriteFile(hFile, buffer, buffer_length, &written, NULL); + WriteFile(hFile, data, sizeof(data), &written, NULL); + + heap_free(buffer); + + CloseHandle(hFile); + return ret; +} + +static void test_MCIWndCreate(void) +{ + HWND parent, window; + HMODULE hinst = GetModuleHandleA(NULL); + char fname[MAX_PATH]; + char invalid_fname[] = "invalid.avi"; + char error[200]; + LRESULT ret; + + create_avi_file(fname); + + window = MCIWndCreateA(NULL, hinst, MCIWNDF_NOERRORDLG, fname); + ok(window != NULL, "Failed to create an MCIWnd window without parent\n"); + + ret = SendMessageA(window, MCIWNDM_GETERRORA, sizeof(error), (LPARAM)error); + ok(!ret || broken(ret == ERROR_INVALID_HANDLE) /* w2003std, w2008s64 */, + "Unexpected error %ld\n", ret); + + DestroyWindow(window); + + parent = CreateWindowExA(0, "static", "msvfw32 test", + WS_POPUP, 0, 0, 100, 100, + 0, 0, 0, NULL); + ok(parent != NULL, "Failed to create a window\n"); + window = MCIWndCreateA(parent, hinst, MCIWNDF_NOERRORDLG, fname); + ok(window != NULL, "Failed to create an MCIWnd window\n"); + + ret = SendMessageA(window, MCIWNDM_GETERRORA, sizeof(error), (LPARAM)error); + ok(!ret || broken(ret == ERROR_INVALID_HANDLE) /* w2003std, w2008s64 */, + "Unexpected error %ld\n", ret); + + DestroyWindow(parent); + + window = MCIWndCreateA(NULL, hinst, MCIWNDF_NOERRORDLG, invalid_fname); + ok(window != NULL, "Failed to create an MCIWnd window\n"); + + ret = SendMessageA(window, MCIWNDM_GETERRORA, sizeof(error), (LPARAM)error); + todo_wine ok(ret == MCIERR_FILE_NOT_FOUND, "Unexpected error %ld\n", ret); + + DestroyWindow(window); + + DeleteFileA(fname); +} + +START_TEST(mciwnd) +{ + test_MCIWndCreate(); +} diff --git a/modules/rostests/winetests/msvfw32/msvfw.c b/modules/rostests/winetests/msvfw32/msvfw.c index fbc0afd4564..ba6e7b5f7c1 100644 --- a/modules/rostests/winetests/msvfw32/msvfw.c +++ b/modules/rostests/winetests/msvfw32/msvfw.c @@ -374,16 +374,59 @@ static void test_ICSeqCompress(void) ok(err == ICERR_BADHANDLE, "Expected -8, got %d\n", err); } +static ICINFO enum_info; + +static LRESULT CALLBACK enum_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg, + LPARAM lparam1, LPARAM lparam2) +{ + ICINFO *info = (ICINFO *)lparam1; + + ok(!id, "Got unexpected id %#lx.\n", id); + ok(msg == ICM_GETINFO, "Got unexpected message %#x.\n", msg); + ok(info == &enum_info, "Expected lparam1 %p, got %p.\n", &enum_info, info); + ok(lparam2 == sizeof(ICINFO), "Got lparam2 %ld.\n", lparam2); + + ok(!info->fccType, "Got unexpected type %#x.\n", info->fccType); + ok(!info->fccHandler, "Got unexpected handler %#x.\n", info->fccHandler); + ok(!info->dwFlags, "Got unexpected flags %#x.\n", info->dwFlags); + ok(!info->dwVersion, "Got unexpected version %#x.\n", info->dwVersion); + ok(info->dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", info->dwVersionICM); + ok(!info->szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(info->szName)); + ok(!info->szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(info->szDescription)); + ok(!info->szDriver[0], "Got unexpected driver %s.\n", wine_dbgstr_w(info->szDriver)); + + info->dwVersion = 0xdeadbeef; + return sizeof(ICINFO); +} + static void test_ICInfo(void) { + static const WCHAR bogusW[] = {'b','o','g','u','s',0}; + static const DWORD test_type = mmioFOURCC('w','i','n','e'); + static const DWORD test_handler = mmioFOURCC('t','e','s','t'); + DWORD i = 0, found = 0; + char buffer[MAX_PATH]; ICINFO info, info2; - DWORD i, found; unsigned char *fcc; + DWORD size; + BOOL ret; + HKEY key; + LONG res; - for (i = found = 0; ICInfo(0, i, &info); i++) + for (;;) { + memset(&info, 0x55, sizeof(info)); + info.dwSize = sizeof(info); + if (!ICInfo(0, i++, &info)) + break; trace("Codec name: %s, fccHandler: 0x%08x\n", wine_dbgstr_w(info.szName), info.fccHandler); - ok(info.fccType, "expected nonzero fccType\n"); + ok(info.fccType, "Expected nonzero type.\n"); + ok(info.fccHandler, "Expected nonzero handler.\n"); + ok(!info.dwFlags, "Got unexpected flags %#x.\n", info.dwFlags); + ok(!info.dwVersion, "Got unexpected version %#x.\n", info.dwVersion); + ok(info.dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", info.dwVersionICM); + ok(!info.szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szName)); + ok(!info.szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szDescription)); ok(ICInfo(info.fccType, info.fccHandler, &info2), "ICInfo failed on fcc 0x%08x\n", info.fccHandler); @@ -399,10 +442,107 @@ static void test_ICInfo(void) } ok(found != 0, "expected at least one codec\n"); - memset(&info, 0, sizeof(info)); + memset(&info, 0x55, sizeof(info)); + info.dwSize = sizeof(info); ok(!ICInfo(ICTYPE_VIDEO, mmioFOURCC('f','a','k','e'), &info), "expected failure\n"); ok(info.fccType == ICTYPE_VIDEO, "got 0x%08x\n", info.fccType); ok(info.fccHandler == mmioFOURCC('f','a','k','e'), "got 0x%08x\n", info.fccHandler); + ok(!info.dwFlags, "Got unexpected flags %#x.\n", info.dwFlags); + ok(!info.dwVersion, "Got unexpected version %#x.\n", info.dwVersion); + ok(info.dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", info.dwVersionICM); + ok(!info.szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szName)); + ok(!info.szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szDescription)); + ok(!info.szDriver[0], "Got unexpected driver %s.\n", wine_dbgstr_w(info.szDriver)); + + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT" + "\\CurrentVersion\\Drivers32", 0, KEY_ALL_ACCESS, &key)) + { + ret = ICInstall(test_type, test_handler, (LPARAM)"bogus", NULL, ICINSTALL_DRIVER); + ok(ret, "Failed to install driver.\n"); + + size = sizeof(buffer); + res = RegQueryValueExA(key, "wine.test", NULL, NULL, (BYTE *)buffer, &size); + ok(!res, "Failed to query value, error %d.\n", res); + ok(!strcmp(buffer, "bogus"), "Got unexpected value \"%s\".\n", buffer); + + memset(&info, 0x55, sizeof(info)); + info.dwSize = sizeof(info); + ok(ICInfo(test_type, test_handler, &info), "Expected success.\n"); + ok(info.fccType == test_type, "Got unexpected type %#x.\n", info.fccType); + ok(info.fccHandler == test_handler, "Got unexpected handler %#x.\n", info.fccHandler); + ok(!info.dwFlags, "Got unexpected flags %#x.\n", info.dwFlags); + ok(!info.dwVersion, "Got unexpected version %#x.\n", info.dwVersion); + ok(info.dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", info.dwVersionICM); + ok(!info.szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szName)); + ok(!info.szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szDescription)); + ok(!lstrcmpW(info.szDriver, bogusW), "Got unexpected driver %s.\n", wine_dbgstr_w(info.szDriver)); + + /* Drivers installed after msvfw32 is loaded are not enumerated. */ +todo_wine + ok(!ICInfo(test_type, 0, &info), "Expected failure.\n"); + + ret = ICRemove(test_type, test_handler, 0); + ok(ret, "Failed to remove driver.\n"); + + res = RegDeleteValueA(key, "wine.test"); + ok(res == ERROR_FILE_NOT_FOUND, "Got error %u.\n", res); + RegCloseKey(key); + } + else + win_skip("Not enough permissions to register codec drivers.\n"); + + if (WritePrivateProfileStringA("drivers32", "wine.test", "bogus", "system.ini")) + { + memset(&info, 0x55, sizeof(info)); + info.dwSize = sizeof(info); + ok(ICInfo(test_type, test_handler, &info), "Expected success.\n"); + ok(info.fccType == test_type, "Got unexpected type %#x.\n", info.fccType); + ok(info.fccHandler == test_handler, "Got unexpected handler %#x.\n", info.fccHandler); + ok(!info.dwFlags, "Got unexpected flags %#x.\n", info.dwFlags); + ok(!info.dwVersion, "Got unexpected version %#x.\n", info.dwVersion); + ok(info.dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", info.dwVersionICM); + ok(!info.szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szName)); + ok(!info.szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(info.szDescription)); + ok(!lstrcmpW(info.szDriver, bogusW), "Got unexpected driver %s.\n", wine_dbgstr_w(info.szDriver)); + + /* Drivers installed after msvfw32 is loaded are not enumerated. */ +todo_wine + ok(!ICInfo(test_type, 0, &info), "Expected failure.\n"); + + ret = WritePrivateProfileStringA("drivers32", "wine.test", NULL, "system.ini"); + ok(ret, "Failed to remove INI entry.\n"); + } + + ret = ICInstall(test_type, test_handler, (LPARAM)enum_driver_proc, NULL, ICINSTALL_FUNCTION); + ok(ret, "Failed to install driver.\n"); + + memset(&enum_info, 0x55, sizeof(enum_info)); + enum_info.dwSize = sizeof(enum_info); + ok(ICInfo(test_type, test_handler, &enum_info), "Expected success.\n"); + ok(!enum_info.fccType, "Got unexpected type %#x.\n", enum_info.fccType); + ok(!enum_info.fccHandler, "Got unexpected handler %#x.\n", enum_info.fccHandler); + ok(!enum_info.dwFlags, "Got unexpected flags %#x.\n", enum_info.dwFlags); + ok(enum_info.dwVersion == 0xdeadbeef, "Got unexpected version %#x.\n", enum_info.dwVersion); + ok(enum_info.dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", enum_info.dwVersionICM); + ok(!enum_info.szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(enum_info.szName)); + ok(!enum_info.szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(enum_info.szDescription)); + ok(!enum_info.szDriver[0], "Got unexpected driver %s.\n", wine_dbgstr_w(enum_info.szDriver)); + + /* Functions installed after msvfw32 is loaded are enumerated. */ + memset(&enum_info, 0x55, sizeof(enum_info)); + enum_info.dwSize = sizeof(enum_info); + ok(ICInfo(test_type, 0, &enum_info), "Expected success.\n"); + ok(!enum_info.fccType, "Got unexpected type %#x.\n", enum_info.fccType); + ok(!enum_info.fccHandler, "Got unexpected handler %#x.\n", enum_info.fccHandler); + ok(!enum_info.dwFlags, "Got unexpected flags %#x.\n", enum_info.dwFlags); + ok(enum_info.dwVersion == 0xdeadbeef, "Got unexpected version %#x.\n", enum_info.dwVersion); + ok(enum_info.dwVersionICM == ICVERSION, "Got unexpected ICM version %#x.\n", enum_info.dwVersionICM); + ok(!enum_info.szName[0], "Got unexpected name %s.\n", wine_dbgstr_w(enum_info.szName)); + ok(!enum_info.szDescription[0], "Got unexpected name %s.\n", wine_dbgstr_w(enum_info.szDescription)); + ok(!enum_info.szDriver[0], "Got unexpected driver %s.\n", wine_dbgstr_w(enum_info.szDriver)); + + ret = ICRemove(test_type, test_handler, 0); + ok(ret, "Failed to remove driver.\n"); } static int get_display_format_test; diff --git a/modules/rostests/winetests/msvfw32/msvfw32.manifest b/modules/rostests/winetests/msvfw32/msvfw32.manifest new file mode 100644 index 00000000000..69222c1e1dc --- /dev/null +++ b/modules/rostests/winetests/msvfw32/msvfw32.manifest @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity + type="win32" + name="Wine.msvfw32.Test" + version="1.0.0.0" + processorArchitecture="*" + /> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" /> + </requestedPrivileges> + </security> + </trustInfo> +</assembly> diff --git a/modules/rostests/winetests/msvfw32/msvfw32.rc b/modules/rostests/winetests/msvfw32/msvfw32.rc new file mode 100644 index 00000000000..463e7448edd --- /dev/null +++ b/modules/rostests/winetests/msvfw32/msvfw32.rc @@ -0,0 +1,22 @@ +/* + * Copyright 2019 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "winuser.h" + +/* @makedep: msvfw32.manifest */ +1 RT_MANIFEST msvfw32.manifest diff --git a/modules/rostests/winetests/msvfw32/testlist.c b/modules/rostests/winetests/msvfw32/testlist.c index 24e575fd85f..46cb148052d 100644 --- a/modules/rostests/winetests/msvfw32/testlist.c +++ b/modules/rostests/winetests/msvfw32/testlist.c @@ -4,11 +4,13 @@ #include <wine/test.h> extern void func_drawdib(void); +extern void func_mciwnd(void); extern void func_msvfw(void); const struct test winetest_testlist[] = { { "drawdib", func_drawdib }, + { "mciwnd", func_mciwnd }, { "msvfw", func_msvfw }, { 0, 0 } };
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSVFW32] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=80bb48e789c64f285b9ea…
commit 80bb48e789c64f285b9eab358a453e34f6cc3bfc Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:07:06 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:07:06 2019 +0100 [MSVFW32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/msvfw32/mciwnd.c | 25 +- dll/win32/msvfw32/msvideo_main.c | 527 +++++++++++++++++++-------------------- media/doc/README.WINE | 2 +- 3 files changed, 271 insertions(+), 283 deletions(-) diff --git a/dll/win32/msvfw32/mciwnd.c b/dll/win32/msvfw32/mciwnd.c index 50899e1fbdf..0b35bad356c 100644 --- a/dll/win32/msvfw32/mciwnd.c +++ b/dll/win32/msvfw32/mciwnd.c @@ -32,7 +32,6 @@ #include "vfw.h" #include "digitalv.h" #include "commctrl.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(mci); @@ -200,7 +199,7 @@ static void MCIWND_UpdateState(MCIWndInfo *mwi) return; if ((mwi->dwStyle & MCIWNDF_SHOWNAME) && mwi->lpName) - strcpyW(buffer, mwi->lpName); + lstrcpyW(buffer, mwi->lpName); else *buffer = 0; @@ -209,8 +208,8 @@ static void MCIWND_UpdateState(MCIWndInfo *mwi) static const WCHAR spaceW[] = {' ',0}; static const WCHAR l_braceW[] = {'(',0}; - if (*buffer) strcatW(buffer, spaceW); - strcatW(buffer, l_braceW); + if (*buffer) lstrcatW(buffer, spaceW); + lstrcatW(buffer, l_braceW); } if (mwi->dwStyle & MCIWNDF_SHOWPOS) @@ -219,13 +218,13 @@ static void MCIWND_UpdateState(MCIWndInfo *mwi) posW[0] = 0; SendMessageW(mwi->hWnd, MCIWNDM_GETPOSITIONW, 64, (LPARAM)posW); - strcatW(buffer, posW); + lstrcatW(buffer, posW); } if ((mwi->dwStyle & (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE)) == (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE)) { static const WCHAR dashW[] = {' ','-',' ',0}; - strcatW(buffer, dashW); + lstrcatW(buffer, dashW); } if (mwi->dwStyle & MCIWNDF_SHOWMODE) @@ -234,13 +233,13 @@ static void MCIWND_UpdateState(MCIWndInfo *mwi) modeW[0] = 0; SendMessageW(mwi->hWnd, MCIWNDM_GETMODEW, 64, (LPARAM)modeW); - strcatW(buffer, modeW); + lstrcatW(buffer, modeW); } if (mwi->dwStyle & (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE)) { static const WCHAR r_braceW[] = {')',0}; - strcatW(buffer, r_braceW); + lstrcatW(buffer, r_braceW); } TRACE("=> %s\n", debugstr_w(buffer)); @@ -590,8 +589,8 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa mwi->mci = mci_open.wDeviceID; mwi->alias = HandleToLong(hWnd) + 1; - mwi->lpName = HeapAlloc(GetProcessHeap(), 0, (strlenW((LPWSTR)lParam) + 1) * sizeof(WCHAR)); - strcpyW(mwi->lpName, (LPWSTR)lParam); + mwi->lpName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW((LPWSTR)lParam) + 1) * sizeof(WCHAR)); + lstrcpyW(mwi->lpName, (LPWSTR)lParam); MCIWND_UpdateState(mwi); @@ -987,7 +986,7 @@ end_of_mci_open: TRACE("MCIWNDM_SENDSTRINGW %s\n", debugstr_w((LPCWSTR)lParam)); - p = strchrW((LPCWSTR)lParam, ' '); + p = wcschr((LPCWSTR)lParam, ' '); if (p) { static const WCHAR formatW[] = {'%','d',' ',0}; @@ -1000,7 +999,7 @@ end_of_mci_open: memcpy(cmdW, (void *)lParam, pos * sizeof(WCHAR)); wsprintfW(cmdW + pos, formatW, mwi->alias); - strcatW(cmdW, (WCHAR *)lParam + pos); + lstrcatW(cmdW, (WCHAR *)lParam + pos); } else cmdW = (LPWSTR)lParam; @@ -1182,7 +1181,7 @@ end_of_mci_open: { cmdW = HeapAlloc(GetProcessHeap(), 0, (lstrlenW((LPCWSTR)lParam) + 64) * sizeof(WCHAR)); wsprintfW(cmdW, formatW, mwi->alias); - strcatW(cmdW, (WCHAR *)lParam); + lstrcatW(cmdW, (WCHAR *)lParam); mwi->lasterror = mciSendStringW(cmdW, NULL, 0, 0); diff --git a/dll/win32/msvfw32/msvideo_main.c b/dll/win32/msvfw32/msvideo_main.c index 4b099136671..09ed0316720 100644 --- a/dll/win32/msvfw32/msvideo_main.c +++ b/dll/win32/msvfw32/msvideo_main.c @@ -35,11 +35,14 @@ #include "winreg.h" #include "winnls.h" #include "wingdi.h" +#include "wine/winternl.h" #include "winuser.h" #include "commdlg.h" #include "vfw.h" #include "msvideo_private.h" #include "wine/debug.h" +#include "wine/heap.h" +#include "wine/list.h" /* Drivers32 settings */ #define HKLM_DRIVERS32 "Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32" @@ -100,17 +103,15 @@ static const char *wine_dbgstr_icerr( int ret ) static WINE_HIC* MSVIDEO_FirstHic /* = NULL */; -typedef struct _reg_driver reg_driver; -struct _reg_driver +struct reg_driver { DWORD fccType; DWORD fccHandler; DRIVERPROC proc; - LPWSTR name; - reg_driver* next; + struct list entry; }; -static reg_driver* reg_driver_list = NULL; +static struct list reg_driver_list = LIST_INIT(reg_driver_list); HMODULE MSVFW32_hModule; @@ -220,7 +221,7 @@ static int compare_fourcc(DWORD fcc1, DWORD fcc2) char fcc_str2[4]; fourcc_to_string(fcc_str1, fcc1); fourcc_to_string(fcc_str2, fcc2); - return strncasecmp(fcc_str1, fcc_str2, 4); + return _strnicmp(fcc_str1, fcc_str2, 4); } static DWORD get_size_image(LONG width, LONG height, WORD depth) @@ -232,53 +233,6 @@ static DWORD get_size_image(LONG width, LONG height, WORD depth) return ret; } -typedef BOOL (*enum_handler_t)(const char *name, const char *driver, unsigned int index, void *param); - -static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void* param) -{ - char fccTypeStr[4]; - char name_buf[10]; - char buf[2048]; - - DWORD i, cnt = 0, lRet; - BOOL result = FALSE; - HKEY hKey; - - fourcc_to_string(fccTypeStr, fccType); - - /* first, go through the registry entries */ - lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &hKey); - if (lRet == ERROR_SUCCESS) - { - i = 0; - for (;;) - { - DWORD name_len = 10, driver_len = 128; - lRet = RegEnumValueA(hKey, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len); - if (lRet == ERROR_NO_MORE_ITEMS) break; - if (name_len != 9 || name_buf[4] != '.') continue; - if (fccType && strncasecmp(name_buf, fccTypeStr, 4)) continue; - if ((result = handler(name_buf, buf, cnt++, param))) break; - } - RegCloseKey( hKey ); - } - if (result) return result; - - /* if that didn't work, go through the values in system.ini */ - if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini")) - { - char *s; - for (s = buf; *s; s += strlen(s) + 1) - { - if (s[4] != '.' || s[9] != '=') continue; - if (fccType && strncasecmp(s, fccTypeStr, 4)) continue; - if ((result = handler(s, s + 10, cnt++, param))) break; - } - } - - return result; -} - /****************************************************************** * MSVIDEO_GetHicPtr * @@ -303,27 +257,6 @@ DWORD WINAPI VideoForWindowsVersion(void) return 0x040003B6; /* 4.950 */ } -static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned int nr, void *param) -{ - ICINFO *lpicinfo = param; - DWORD fccType = mmioStringToFOURCCA(name, 0); - DWORD fccHandler = mmioStringToFOURCCA(name + 5, 0); - - if (lpicinfo->fccHandler != nr && compare_fourcc(lpicinfo->fccHandler, fccHandler)) - return FALSE; - - lpicinfo->fccType = fccType; - lpicinfo->fccHandler = fccHandler; - lpicinfo->dwFlags = 0; - lpicinfo->dwVersion = 0; - lpicinfo->dwVersionICM = ICVERSION; - lpicinfo->szName[0] = 0; - lpicinfo->szDescription[0] = 0; - MultiByteToWideChar(CP_ACP, 0, driver, -1, lpicinfo->szDriver, ARRAY_SIZE(lpicinfo->szDriver)); - - return TRUE; -} - /*********************************************************************** * ICInfo [MSVFW32.@] * Get information about an installable compressor. Return TRUE if there @@ -334,99 +267,170 @@ static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned i * fccHandler [I] real fcc for handler or <n>th compressor * lpicinfo [O] information about compressor */ -BOOL VFWAPI ICInfo( DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo) +BOOL VFWAPI ICInfo(DWORD type, DWORD handler, ICINFO *info) { - TRACE("(%s,%s,%p)\n", - wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), lpicinfo); + char name_buf[10], buf[2048]; + DWORD ret_type, ret_handler; + struct reg_driver *driver; + DWORD i, count = 0; + LONG res; + HKEY key; - lpicinfo->fccType = fccType; - lpicinfo->fccHandler = fccHandler; - return enum_drivers(fccType, ICInfo_enum_handler, lpicinfo); + TRACE("type %s, handler %s, info %p.\n", + wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler), info); + + memset(info, 0, sizeof(*info)); + info->dwSize = sizeof(*info); + info->dwVersionICM = ICVERSION; + + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &key)) + { + i = 0; + for (;;) + { + DWORD name_len = ARRAY_SIZE(name_buf), driver_len = ARRAY_SIZE(info->szDriver); + + res = RegEnumValueA(key, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len); + if (res == ERROR_NO_MORE_ITEMS) break; + + if (name_len != 9 || name_buf[4] != '.') continue; + ret_type = mmioStringToFOURCCA(name_buf, 0); + ret_handler = mmioStringToFOURCCA(name_buf + 5, 0); + if (type && compare_fourcc(type, ret_type)) continue; + if (compare_fourcc(handler, ret_handler) && handler != count++) continue; + + info->fccType = ret_type; + info->fccHandler = ret_handler; + MultiByteToWideChar(CP_ACP, 0, buf, -1, info->szDriver, ARRAY_SIZE(info->szDriver)); + TRACE("Returning codec %s, driver %s.\n", debugstr_a(name_buf), debugstr_a(buf)); + return TRUE; + } + RegCloseKey(key); + } + + if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini")) + { + char *s; + for (s = buf; *s; s += strlen(s) + 1) + { + if (s[4] != '.' || s[9] != '=') continue; + ret_type = mmioStringToFOURCCA(s, 0); + ret_handler = mmioStringToFOURCCA(s + 5, 0); + if (type && compare_fourcc(type, ret_type)) continue; + if (compare_fourcc(handler, ret_handler) && handler != count++) continue; + + info->fccType = ret_type; + info->fccHandler = ret_handler; + MultiByteToWideChar(CP_ACP, 0, s + 10, -1, info->szDriver, ARRAY_SIZE(info->szDriver)); + TRACE("Returning codec %s, driver %s.\n", debugstr_an(s, 8), debugstr_a(s + 10)); + return TRUE; + } + } + + LIST_FOR_EACH_ENTRY(driver, ®_driver_list, struct reg_driver, entry) + { + if (type && compare_fourcc(type, driver->fccType)) continue; + if (compare_fourcc(handler, driver->fccHandler) && handler != count++) continue; + if (driver->proc(0, NULL, ICM_GETINFO, (DWORD_PTR)info, sizeof(*info)) == sizeof(*info)) + return TRUE; + } + + info->fccType = type; + info->fccHandler = handler; + WARN("No driver found for codec %s.%s.\n", wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler)); + return FALSE; } static DWORD IC_HandleRef = 1; /*********************************************************************** - * ICInstall [MSVFW32.@] + * ICInstall [MSVFW32.@] */ -BOOL VFWAPI ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags) +BOOL VFWAPI ICInstall(DWORD type, DWORD handler, LPARAM lparam, char *desc, UINT flags) { - reg_driver* driver; - unsigned len; + struct reg_driver *driver; - TRACE("(%s,%s,%p,%p,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), (void*)lParam, szDesc, wFlags); + TRACE("type %s, handler %s, lparam %#lx, desc %s, flags %#x.\n", + wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler), lparam, debugstr_a(desc), flags); - /* Check if a driver is already registered */ - for (driver = reg_driver_list; driver; driver = driver->next) + LIST_FOR_EACH_ENTRY(driver, ®_driver_list, struct reg_driver, entry) { - if (!compare_fourcc(fccType, driver->fccType) && - !compare_fourcc(fccHandler, driver->fccHandler)) - break; + if (!compare_fourcc(type, driver->fccType) + && !compare_fourcc(handler, driver->fccHandler)) + { + return FALSE; + } } - if (driver) return FALSE; - /* Register the driver */ - driver = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(reg_driver)); - if (!driver) goto oom; - driver->fccType = fccType; - driver->fccHandler = fccHandler; - - switch(wFlags) + switch (flags) { case ICINSTALL_FUNCTION: - driver->proc = (DRIVERPROC)lParam; - driver->name = NULL; - break; + if (!(driver = heap_alloc_zero(sizeof(*driver)))) + return FALSE; + driver->fccType = type; + driver->fccHandler = handler; + driver->proc = (DRIVERPROC)lparam; + list_add_tail(®_driver_list, &driver->entry); + return TRUE; case ICINSTALL_DRIVER: - driver->proc = NULL; - len = MultiByteToWideChar(CP_ACP, 0, (char*)lParam, -1, NULL, 0); - driver->name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!driver->name) goto oom; - MultiByteToWideChar(CP_ACP, 0, (char*)lParam, -1, driver->name, len); - break; + { + const char *driver = (const char *)lparam; + char value[10]; + HKEY key; + LONG res; + + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_SET_VALUE, &key)) + return FALSE; + fourcc_to_string(value, type); + value[4] = '.'; + fourcc_to_string(value + 5, handler); + value[9] = 0; + res = RegSetValueExA(key, value, 0, REG_SZ, (const BYTE *)driver, strlen(driver) + 1); + RegCloseKey(key); + return !res; + } default: - ERR("Invalid flags!\n"); - HeapFree(GetProcessHeap(), 0, driver); - return FALSE; - } - - /* Insert our driver in the list*/ - driver->next = reg_driver_list; - reg_driver_list = driver; - - return TRUE; -oom: - HeapFree(GetProcessHeap(), 0, driver); - return FALSE; + FIXME("Unhandled flags %#x.\n", flags); + return FALSE; + } } /*********************************************************************** - * ICRemove [MSVFW32.@] + * ICRemove [MSVFW32.@] */ -BOOL VFWAPI ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags) +BOOL VFWAPI ICRemove(DWORD type, DWORD handler, UINT flags) { - reg_driver** pdriver; - reg_driver* drv; + struct reg_driver *driver; + char value[10]; + HKEY key; + LONG res; - TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wFlags); + TRACE("type %s, handler %s, flags %#x.\n", + wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler), flags); - /* Check if a driver is already registered */ - for (pdriver = ®_driver_list; *pdriver; pdriver = &(*pdriver)->next) + LIST_FOR_EACH_ENTRY(driver, ®_driver_list, struct reg_driver, entry) { - if (!compare_fourcc(fccType, (*pdriver)->fccType) && - !compare_fourcc(fccHandler, (*pdriver)->fccHandler)) - break; + if (!compare_fourcc(type, driver->fccType) + && !compare_fourcc(handler, driver->fccHandler)) + { + list_remove(&driver->entry); + heap_free(driver); + return TRUE; + } } - if (!*pdriver) - return FALSE; - /* Remove the driver from the list */ - drv = *pdriver; - *pdriver = (*pdriver)->next; - HeapFree(GetProcessHeap(), 0, drv->name); - HeapFree(GetProcessHeap(), 0, drv); - - return TRUE; + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_SET_VALUE, &key)) + { + fourcc_to_string(value, type); + value[4] = '.'; + fourcc_to_string(value + 5, handler); + value[9] = 0; + res = RegDeleteValueA(key, value); + RegCloseKey(key); + return !res; + } + + return FALSE; } @@ -438,10 +442,10 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) { WCHAR codecname[10]; ICOPEN icopen; - HDRVR hdrv; WINE_HIC* whic; static const WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'}; - reg_driver* driver; + struct reg_driver *driver; + HDRVR hdrv = NULL; TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode); @@ -466,21 +470,15 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) } } - /* Check if there is a registered driver that matches */ - driver = reg_driver_list; - while(driver) - if (!compare_fourcc(fccType, driver->fccType) && - !compare_fourcc(fccHandler, driver->fccHandler)) { - fccType = driver->fccType; - fccHandler = driver->fccHandler; - break; - } else - driver = driver->next; - - if (driver && driver->proc) - /* The driver has been registered at runtime with its driverproc */ - return ICOpenFunction(fccType, fccHandler, wMode, driver->proc); - + LIST_FOR_EACH_ENTRY(driver, ®_driver_list, struct reg_driver, entry) + { + if (!compare_fourcc(fccType, driver->fccType) + && !compare_fourcc(fccHandler, driver->fccHandler)) + { + return ICOpenFunction(driver->fccType, driver->fccHandler, wMode, driver->proc); + } + } + /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the * same layout as ICOPEN */ @@ -494,7 +492,8 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) icopen.pV2Reserved = NULL; icopen.dnDevNode = 0; /* FIXME */ - if (!driver) { + if (!hdrv) + { /* normalize to lower case as in 'vidc' */ ((char*)&fccType)[0] = tolower(((char*)&fccType)[0]); ((char*)&fccType)[1] = tolower(((char*)&fccType)[1]); @@ -510,15 +509,9 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen); if (!hdrv) return 0; - } else { - /* The driver has been registered at runtime with its name */ - hdrv = OpenDriver(driver->name, NULL, (LPARAM)&icopen); - if (!hdrv) - return 0; } - whic = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_HIC)); - if (!whic) + if (!(whic = heap_alloc(sizeof(*whic)))) { CloseDriver(hdrv, 0, 0); return FALSE; @@ -557,8 +550,8 @@ HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPRO icopen.pV2Reserved = NULL; icopen.dnDevNode = 0; /* FIXME */ - whic = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_HIC)); - if (!whic) return 0; + if (!(whic = heap_alloc(sizeof(*whic)))) + return NULL; whic->driverproc = lpfnHandler; while (MSVIDEO_GetHicPtr((HIC)(ULONG_PTR)IC_HandleRef) != NULL) IC_HandleRef++; @@ -573,7 +566,7 @@ HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPRO { WARN("DRV_LOAD failed for hic %p\n", whic->hic); MSVIDEO_FirstHic = whic->next; - HeapFree(GetProcessHeap(), 0, whic); + heap_free(whic); return 0; } /* return value is not checked */ @@ -587,7 +580,7 @@ HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPRO { WARN("DRV_OPEN failed for hic %p\n", whic->hic); MSVIDEO_FirstHic = whic->next; - HeapFree(GetProcessHeap(), 0, whic); + heap_free(whic); return 0; } @@ -634,89 +627,69 @@ LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb) return ret; } -typedef struct { - DWORD fccType; - DWORD fccHandler; - LPBITMAPINFOHEADER lpbiIn; - LPBITMAPINFOHEADER lpbiOut; - WORD wMode; - DWORD querymsg; - HIC hic; -} driver_info_t; - -static HIC try_driver(driver_info_t *info) -{ - HIC hic; - - if ((hic = ICOpen(info->fccType, info->fccHandler, info->wMode))) - { - if (!ICSendMessage(hic, info->querymsg, (DWORD_PTR)info->lpbiIn, (DWORD_PTR)info->lpbiOut)) - return hic; - ICClose(hic); - } - return 0; -} - -static BOOL ICLocate_enum_handler(const char *name, const char *driver, unsigned int nr, void *param) -{ - driver_info_t *info = param; - info->fccHandler = mmioStringToFOURCCA(name + 5, 0); - info->hic = try_driver(info); - return info->hic != 0; -} - /*********************************************************************** - * ICLocate [MSVFW32.@] + * ICLocate [MSVFW32.@] */ -HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, - LPBITMAPINFOHEADER lpbiOut, WORD wMode) +HIC VFWAPI ICLocate(DWORD type, DWORD handler, BITMAPINFOHEADER *in, + BITMAPINFOHEADER *out, WORD mode) { - driver_info_t info; - - TRACE("(%s,%s,%p,%p,0x%04x)\n", - wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), lpbiIn, lpbiOut, wMode); + ICINFO info = {sizeof(info)}; + UINT msg; + HIC hic; + DWORD i; - info.fccType = fccType; - info.fccHandler = fccHandler; - info.lpbiIn = lpbiIn; - info.lpbiOut = lpbiOut; - info.wMode = wMode; + TRACE("type %s, handler %s, in %p, out %p, mode %u.\n", + wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler), in, out, mode); - switch (wMode) + switch (mode) { case ICMODE_FASTCOMPRESS: case ICMODE_COMPRESS: - info.querymsg = ICM_COMPRESS_QUERY; + msg = ICM_COMPRESS_QUERY; break; case ICMODE_FASTDECOMPRESS: case ICMODE_DECOMPRESS: - info.querymsg = ICM_DECOMPRESS_QUERY; + msg = ICM_DECOMPRESS_QUERY; break; case ICMODE_DRAW: - info.querymsg = ICM_DRAW_QUERY; + msg = ICM_DRAW_QUERY; break; default: - WARN("Unknown mode (%d)\n", wMode); + FIXME("Unhandled mode %#x.\n", mode); return 0; } - /* Easy case: handler/type match, we just fire a query and return */ - info.hic = try_driver(&info); - /* If it didn't work, try each driver in turn. 32 bit codecs only. */ - /* FIXME: Move this to an init routine? */ - if (!info.hic) enum_drivers(fccType, ICLocate_enum_handler, &info); + if ((hic = ICOpen(type, handler, mode))) + { + if (!ICSendMessage(hic, msg, (DWORD_PTR)in, (DWORD_PTR)out)) + { + TRACE("Found codec %s.%s.\n", wine_dbgstr_fcc(type), + wine_dbgstr_fcc(handler)); + return hic; + } + ICClose(hic); + } - if (info.hic) + for (i = 0; ICInfo(type, i, &info); ++i) { - TRACE("=> %p\n", info.hic); - return info.hic; + if ((hic = ICOpen(info.fccType, info.fccHandler, mode))) + { + if (!ICSendMessage(hic, msg, (DWORD_PTR)in, (DWORD_PTR)out)) + { + TRACE("Found codec %s.%s.\n", wine_dbgstr_fcc(info.fccType), + wine_dbgstr_fcc(info.fccHandler)); + return hic; + } + ICClose(hic); + } } - if (fccType == streamtypeVIDEO) - return ICLocate(ICTYPE_VIDEO, fccHandler, lpbiIn, lpbiOut, wMode); - - ERR("Required media codec '%s %s' not found!\n", - wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler)); + if (type == streamtypeVIDEO) + return ICLocate(ICTYPE_VIDEO, handler, in, out, mode); + + WARN("Could not find a driver for codec %s.%s.\n", + wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler)); + return 0; } @@ -925,7 +898,7 @@ static BOOL enum_compressors(HWND list, COMPVARS *pcv, BOOL enum_all) idx = SendMessageW(list, CB_ADDSTRING, 0, (LPARAM)icinfo.szDescription); - ic = HeapAlloc(GetProcessHeap(), 0, sizeof(struct codec_info)); + ic = heap_alloc(sizeof(*ic)); ic->icinfo = icinfo; ic->hic = hic; SendMessageW(list, CB_SETITEMDATA, idx, (LPARAM)ic); @@ -978,7 +951,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA LoadStringW(MSVFW32_hModule, IDS_FULLFRAMES, buf, 128); SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_ADDSTRING, 0, (LPARAM)buf); - ic = HeapAlloc(GetProcessHeap(), 0, sizeof(struct codec_info)); + ic = heap_alloc(sizeof(*ic)); ic->icinfo.fccType = streamtypeVIDEO; ic->icinfo.fccHandler = comptypeDIB; ic->hic = 0; @@ -1099,7 +1072,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA if (!ic || (LONG_PTR)ic == CB_ERR) break; if (ic->hic) ICClose(ic->hic); - HeapFree(GetProcessHeap(), 0, ic); + heap_free(ic); } EndDialog(hdlg, LOWORD(wparam) == IDOK); @@ -1171,23 +1144,25 @@ BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, */ void VFWAPI ICCompressorFree(PCOMPVARS pc) { - TRACE("(%p)\n",pc); + TRACE("(%p)\n", pc); - if (pc != NULL && pc->cbSize == sizeof(COMPVARS)) { - if (pc->hic != NULL) { - ICClose(pc->hic); - pc->hic = NULL; + if (pc && pc->cbSize == sizeof(COMPVARS)) + { + if (pc->hic) + { + ICClose(pc->hic); + pc->hic = NULL; + } + heap_free(pc->lpbiIn); + pc->lpbiIn = NULL; + heap_free(pc->lpBitsOut); + pc->lpBitsOut = NULL; + heap_free(pc->lpBitsPrev); + pc->lpBitsPrev = NULL; + heap_free(pc->lpState); + pc->lpState = NULL; + pc->dwFlags = 0; } - HeapFree(GetProcessHeap(), 0, pc->lpbiIn); - pc->lpbiIn = NULL; - HeapFree(GetProcessHeap(), 0, pc->lpBitsOut); - pc->lpBitsOut = NULL; - HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev); - pc->lpBitsPrev = NULL; - HeapFree(GetProcessHeap(), 0, pc->lpState); - pc->lpState = NULL; - pc->dwFlags = 0; - } } /*********************************************************************** @@ -1297,7 +1272,7 @@ LRESULT WINAPI ICClose(HIC hic) } } - HeapFree(GetProcessHeap(), 0, whic); + heap_free(whic); return 0; } @@ -1382,8 +1357,7 @@ HANDLE VFWAPI ICImageDecompress( cbHdr = ICDecompressGetFormatSize(hic,lpbiIn); if ( cbHdr < sizeof(BITMAPINFOHEADER) ) goto err; - pHdr = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,cbHdr+sizeof(RGBQUAD)*256); - if ( pHdr == NULL ) + if (!(pHdr = heap_alloc_zero(cbHdr + sizeof(RGBQUAD) * 256))) goto err; if ( ICDecompressGetFormat( hic, lpbiIn, pHdr ) != ICERR_OK ) goto err; @@ -1438,7 +1412,7 @@ err: ICDecompressEnd( hic ); if ( bReleaseIC ) ICClose(hic); - HeapFree(GetProcessHeap(),0,pHdr); + heap_free(pHdr); if ( pMem != NULL ) GlobalUnlock( hMem ); if ( !bSucceeded && hMem != NULL ) @@ -1509,14 +1483,14 @@ LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL static void clear_compvars(PCOMPVARS pc) { - HeapFree(GetProcessHeap(), 0, pc->lpbiIn); - HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev); - HeapFree(GetProcessHeap(), 0, pc->lpBitsOut); - HeapFree(GetProcessHeap(), 0, pc->lpState); + heap_free(pc->lpbiIn); + heap_free(pc->lpBitsPrev); + heap_free(pc->lpBitsOut); + heap_free(pc->lpState); pc->lpbiIn = pc->lpBitsPrev = pc->lpBitsOut = pc->lpState = NULL; if (pc->dwFlags & 0x80000000) { - HeapFree(GetProcessHeap(), 0, pc->lpbiOut); + heap_free(pc->lpbiOut); pc->lpbiOut = NULL; pc->dwFlags &= ~0x80000000; } @@ -1532,6 +1506,28 @@ void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc) clear_compvars(pc); } +static BITMAPINFO *copy_bitmapinfo(const BITMAPINFO *src) +{ + int num_colors; + unsigned int size; + BITMAPINFO *dst; + + if (src->bmiHeader.biClrUsed) + num_colors = min(src->bmiHeader.biClrUsed, 256); + else + num_colors = src->bmiHeader.biBitCount > 8 ? 0 : 1 << src->bmiHeader.biBitCount; + + size = FIELD_OFFSET(BITMAPINFO, bmiColors[num_colors]); + if (src->bmiHeader.biCompression == BI_BITFIELDS) + size += 3 * sizeof(DWORD); + + if (!(dst = heap_alloc(size))) + return NULL; + + memcpy(dst, src, size); + return dst; +} + /*********************************************************************** * ICSeqCompressFrameStart [MSVFW32.@] */ @@ -1542,15 +1538,11 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn) */ DWORD ret; ICCOMPRESS* icComp; - pc->lpbiIn = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFO)); - if (!pc->lpbiIn) - return FALSE; - *pc->lpbiIn = *lpbiIn; + if (!(pc->lpbiIn = copy_bitmapinfo(lpbiIn))) + return FALSE; - pc->lpState = HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS) - + sizeof(*icComp->lpckid) + sizeof(*icComp->lpdwFlags)); - if (!pc->lpState) + if (!(pc->lpState = heap_alloc(sizeof(ICCOMPRESS) + sizeof(*icComp->lpckid) + sizeof(*icComp->lpdwFlags)))) goto error; pc->cbState = sizeof(ICCOMPRESS); @@ -1563,8 +1555,7 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn) if (size <= 0) goto error; - pc->lpbiOut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - if (!pc->lpbiOut) + if (!(pc->lpbiOut = heap_alloc_zero(size))) goto error; /* Flag to show that we allocated lpbiOut for proper cleanup */ pc->dwFlags |= 0x80000000; @@ -1600,13 +1591,11 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn) pc->lpbiOut->bmiHeader.biSizeImage); /* Buffer for compressed frame data */ - pc->lpBitsOut = HeapAlloc(GetProcessHeap(), 0, pc->lpbiOut->bmiHeader.biSizeImage); - if (!pc->lpBitsOut) + if (!(pc->lpBitsOut = heap_alloc(pc->lpbiOut->bmiHeader.biSizeImage))) goto error; /* Buffer for previous compressed frame data */ - pc->lpBitsPrev = HeapAlloc(GetProcessHeap(), 0, pc->lpbiOut->bmiHeader.biSizeImage); - if (!pc->lpBitsPrev) + if (!(pc->lpBitsPrev = heap_alloc(pc->lpbiOut->bmiHeader.biSizeImage))) goto error; TRACE("Compvars:\n" diff --git a/media/doc/README.WINE b/media/doc/README.WINE index fa02e2c6b17..3e2c2f7a2e7 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -126,7 +126,7 @@ dll/win32/mssip32 # Synced to WineStaging-4.18 dll/win32/mstask # Synced to WineStaging-3.3 dll/win32/msvcrt20 # Out of sync dll/win32/msvcrt40 # Out of sync -dll/win32/msvfw32 # Synced to WineStaging-4.0 +dll/win32/msvfw32 # Synced to WineStaging-4.18 dll/win32/msvidc32 # Synced to WineStaging-4.0 dll/win32/msxml # Synced to WineStaging-3.3 dll/win32/msxml2 # Synced to WineStaging-3.3
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSVCRT_WINETEST] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce2df64a06314c95713b4…
commit ce2df64a06314c95713b48b90f59f023d51b89d5 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:06:44 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:06:44 2019 +0100 [MSVCRT_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/msvcrt/data.c | 3 +- modules/rostests/winetests/msvcrt/environ.c | 36 +++- modules/rostests/winetests/msvcrt/heap.c | 18 +- modules/rostests/winetests/msvcrt/locale.c | 2 +- modules/rostests/winetests/msvcrt/printf.c | 320 +++++++++++++++------------- modules/rostests/winetests/msvcrt/scanf.c | 100 +++++---- modules/rostests/winetests/msvcrt/string.c | 216 +++++++++++++++++-- modules/rostests/winetests/msvcrt/time.c | 134 +++++++----- 8 files changed, 555 insertions(+), 274 deletions(-) diff --git a/modules/rostests/winetests/msvcrt/data.c b/modules/rostests/winetests/msvcrt/data.c index 9aacac7b503..b0acc60b20b 100644 --- a/modules/rostests/winetests/msvcrt/data.c +++ b/modules/rostests/winetests/msvcrt/data.c @@ -153,9 +153,8 @@ static void test___getmainargs(void) new_argv = *p___p___argv(); ok(new_argc == 4, "*__p___argc() = %d\n", new_argc); ok(new_argv == argv, "*__p___argv() = %p, expected %p\n", new_argv, argv); - }else { - win_skip("__p___argc or __p___argv is not available\n"); } + else skip("__p___argc or __p___argv is not available\n"); mode = 0; __getmainargs(&argc, &argv, &envp, 1, &mode); diff --git a/modules/rostests/winetests/msvcrt/environ.c b/modules/rostests/winetests/msvcrt/environ.c index fdfe81f5eec..b8e0ae6251a 100644 --- a/modules/rostests/winetests/msvcrt/environ.c +++ b/modules/rostests/winetests/msvcrt/environ.c @@ -47,6 +47,8 @@ void __cdecl __wgetmainargs(int *, wchar_t ***, wchar_t ***, int, int *); static char ***(__cdecl *p__p__environ)(void); static WCHAR ***(__cdecl *p__p__wenviron)(void); +static void (*p_get_environ)(char ***); +static void (*p_get_wenviron)(WCHAR ***); static char ***p_environ; static WCHAR ***p_wenviron; @@ -59,6 +61,8 @@ static void init(void) p__p__wenviron = (void *)GetProcAddress(hmod, "__p__wenviron"); p_environ = (void *)GetProcAddress(hmod, "_environ"); p_wenviron = (void *)GetProcAddress(hmod, "_wenviron"); + p_get_environ = (void *)GetProcAddress(hmod, "_get_environ"); + p_get_wenviron = (void *)GetProcAddress(hmod, "_get_wenviron"); } static void test_system(void) @@ -93,7 +97,17 @@ static void test__environ(void) "Expected _environ pointers to be identical\n" ); } else - win_skip( "__p__environ() is not available\n" ); + skip( "__p__environ() is not available\n" ); + + if (p_get_environ) + { + char **retptr; + p_get_environ(&retptr); + ok( retptr == *p_environ, + "Expected _environ pointers to be identical\n" ); + } + else + win_skip( "_get_environ() is not available\n" ); /* Note that msvcrt from Windows versions older than Vista * expects the mode pointer parameter to be valid.*/ @@ -149,7 +163,17 @@ static void test__wenviron(void) "Expected _wenviron pointers to be NULL\n" ); } else - win_skip( "__p__wenviron() is not available\n" ); + skip( "__p__wenviron() is not available\n" ); + + if (p_get_wenviron) + { + WCHAR **retptr; + p_get_wenviron(&retptr); + ok( retptr == NULL, + "Expected _wenviron pointers to be NULL\n" ); + } + else + win_skip( "_get_wenviron() is not available\n" ); /* __getmainargs doesn't initialize _wenviron. */ __getmainargs(&argc, &argv, &envp, 0, &mode); @@ -191,6 +215,14 @@ static void test__wenviron(void) "Expected _wenviron pointers to be identical\n" ); } + if (p_get_wenviron) + { + WCHAR **retptr; + p_get_wenviron(&retptr); + ok( retptr == *p_wenviron, + "Expected _wenviron pointers to be identical\n" ); + } + for (i = 0; ; i++) { if ((*p_wenviron)[i]) diff --git a/modules/rostests/winetests/msvcrt/heap.c b/modules/rostests/winetests/msvcrt/heap.c index a0ce2a41628..d934bf0c542 100644 --- a/modules/rostests/winetests/msvcrt/heap.c +++ b/modules/rostests/winetests/msvcrt/heap.c @@ -464,22 +464,26 @@ static void test_sbheap(void) static void test_calloc(void) { + /* use function pointer to bypass gcc builtin */ + void *(__cdecl *p_calloc)(size_t, size_t); void *ptr; - ptr = calloc(1, 0); + p_calloc = (void *)GetProcAddress( GetModuleHandleA("msvcrt.dll"), "calloc"); + + ptr = p_calloc(1, 0); ok(ptr != NULL, "got %p\n", ptr); free(ptr); - ptr = calloc(0, 0); + ptr = p_calloc(0, 0); ok(ptr != NULL, "got %p\n", ptr); free(ptr); - ptr = calloc(0, 1); + ptr = p_calloc(0, 1); ok(ptr != NULL, "got %p\n", ptr); free(ptr); errno = 0; - ptr = calloc(~(size_t)0 / 2, ~(size_t)0 / 2); + ptr = p_calloc(~(size_t)0 / 2, ~(size_t)0 / 2); ok(ptr == NULL || broken(ptr != NULL) /* winxp sp0 */, "got %p\n", ptr); ok(errno == ENOMEM || broken(errno == 0) /* winxp, win2k3 */, "got errno %d\n", errno); free(ptr); @@ -495,13 +499,13 @@ START_TEST(heap) mem = realloc(NULL, 10); ok(mem != NULL, "memory not allocated\n"); - + mem = realloc(mem, 20); ok(mem != NULL, "memory not reallocated\n"); - + mem = realloc(mem, 0); ok(mem == NULL, "memory not freed\n"); - + mem = realloc(NULL, 0); ok(mem != NULL, "memory not (re)allocated for size 0\n"); diff --git a/modules/rostests/winetests/msvcrt/locale.c b/modules/rostests/winetests/msvcrt/locale.c index ff777599aa2..08abac00bed 100644 --- a/modules/rostests/winetests/msvcrt/locale.c +++ b/modules/rostests/winetests/msvcrt/locale.c @@ -759,7 +759,7 @@ static void test___mb_cur_max_func(void) /* for older Windows */ if (!p__p___mb_cur_max) - win_skip("Skipping __p___mb_cur_max tests\n"); + skip("Skipping __p___mb_cur_max tests\n"); else { mb_cur_max = *p__p___mb_cur_max(); ok(mb_cur_max == 1, "mb_cur_max = %d, expected 1\n", mb_cur_max); diff --git a/modules/rostests/winetests/msvcrt/printf.c b/modules/rostests/winetests/msvcrt/printf.c index 80180ff8b25..d8a82a0bc82 100644 --- a/modules/rostests/winetests/msvcrt/printf.c +++ b/modules/rostests/winetests/msvcrt/printf.c @@ -24,9 +24,10 @@ * the following macro is defined. */ #define _CRT_NON_CONFORMING_SWPRINTFS - + #include <stdio.h> #include <errno.h> +#include <math.h> #include <locale.h> #include "windef.h" @@ -35,6 +36,8 @@ #include "wine/test.h" +#ifndef __REACTOS__ + static inline float __port_infinity(void) { static const unsigned __inf_bytes = 0x7f800000; @@ -49,6 +52,8 @@ static inline float __port_nan(void) } #define NAN __port_nan() +#endif + static inline float __port_ind(void) { static const unsigned __ind_bytes = 0xffc00000; @@ -67,6 +72,7 @@ static int (__cdecl *p__fcvt_s)(char *buffer, size_t length, double number, int ndigits, int *decpt, int *sign); static unsigned int (__cdecl *p__get_output_format)(void); static unsigned int (__cdecl *p__set_output_format)(unsigned int); +static int (WINAPIV *p_sprintf)(char*, ...); static int (__cdecl *p__vsprintf_p)(char*, size_t, const char*, __ms_va_list); static int (__cdecl *p_vswprintf)(wchar_t *str, const wchar_t *format, __ms_va_list valist); static int (__cdecl *p__vswprintf)(wchar_t *str, const wchar_t *format, __ms_va_list valist); @@ -83,6 +89,7 @@ static void init( void ) { HMODULE hmod = GetModuleHandleA("msvcrt.dll"); + p_sprintf = (void *)GetProcAddress(hmod, "sprintf"); p__vscprintf = (void *)GetProcAddress(hmod, "_vscprintf"); p__vscwprintf = (void *)GetProcAddress(hmod, "_vscwprintf"); p__vsnwprintf_s = (void *)GetProcAddress(hmod, "_vsnwprintf_s"); @@ -106,189 +113,190 @@ static void test_sprintf( void ) double pnumber=789456123; int x, r; WCHAR wide[] = { 'w','i','d','e',0}; + WCHAR buf_w[2]; format = "%+#23.15e"; - r = sprintf(buffer,format,pnumber); + r = p_sprintf(buffer,format,pnumber); ok(!strcmp(buffer,"+7.894561230000000e+008"),"+#23.15e failed: '%s'\n", buffer); ok( r==23, "return count wrong\n"); format = "%-#23.15e"; - r = sprintf(buffer,format,pnumber); + r = p_sprintf(buffer,format,pnumber); ok(!strcmp(buffer,"7.894561230000000e+008 "),"-#23.15e failed: '%s'\n", buffer); ok( r==23, "return count wrong\n"); format = "%#23.15e"; - r = sprintf(buffer,format,pnumber); + r = p_sprintf(buffer,format,pnumber); ok(!strcmp(buffer," 7.894561230000000e+008"),"#23.15e failed: '%s'\n", buffer); ok( r==23, "return count wrong\n"); format = "%#1.1g"; - r = sprintf(buffer,format,pnumber); + r = p_sprintf(buffer,format,pnumber); ok(!strcmp(buffer,"8.e+008"),"#1.1g failed: '%s'\n", buffer); ok( r==7, "return count wrong\n"); format = "%I64d"; - r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff); + r = p_sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff); ok(!strcmp(buffer,"-8589934591"),"Problem with long long\n"); ok( r==11, "return count wrong\n"); format = "%+8I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," +100") && r==8,"+8I64d failed: '%s'\n", buffer); format = "%+.8I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"+00000100") && r==9,"+.8I64d failed: '%s'\n", buffer); format = "%+10.8I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," +00000100") && r==10,"+10.8I64d failed: '%s'\n", buffer); format = "%_1I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"_1I64d") && r==6,"_1I64d failed\n"); format = "%-1.5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-00100") && r==6,"-1.5I64d failed: '%s'\n", buffer); format = "%5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," 100") && r==5,"5I64d failed: '%s'\n", buffer); format = "%5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer," -100") && r==5,"5I64d failed: '%s'\n", buffer); format = "%-5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"100 ") && r==5,"-5I64d failed: '%s'\n", buffer); format = "%-5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-100 ") && r==5,"-5I64d failed: '%s'\n", buffer); format = "%-.5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"00100") && r==5,"-.5I64d failed: '%s'\n", buffer); format = "%-.5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-00100") && r==6,"-.5I64d failed: '%s'\n", buffer); format = "%-8.5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"00100 ") && r==8,"-8.5I64d failed: '%s'\n", buffer); format = "%-8.5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-00100 ") && r==8,"-8.5I64d failed: '%s'\n", buffer); format = "%05I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"00100") && r==5,"05I64d failed: '%s'\n", buffer); format = "%05I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-0100") && r==5,"05I64d failed: '%s'\n", buffer); format = "% I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," 100") && r==4,"' I64d' failed: '%s'\n", buffer); format = "% I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-100") && r==4,"' I64d' failed: '%s'\n", buffer); format = "% 5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," 100") && r==5,"' 5I64d' failed: '%s'\n", buffer); format = "% 5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer," -100") && r==5,"' 5I64d' failed: '%s'\n", buffer); format = "% .5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," 00100") && r==6,"' .5I64d' failed: '%s'\n", buffer); format = "% .5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"-00100") && r==6,"' .5I64d' failed: '%s'\n", buffer); format = "% 8.5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer," 00100") && r==8,"' 8.5I64d' failed: '%s'\n", buffer); format = "% 8.5I64d"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer," -00100") && r==8,"' 8.5I64d' failed: '%s'\n", buffer); format = "%.0I64d"; - r = sprintf(buffer,format,(LONGLONG)0); + r = p_sprintf(buffer,format,(LONGLONG)0); ok(r==0,".0I64d failed: '%s'\n", buffer); format = "%#+21.18I64x"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer," 0x00ffffffffffffff9c") && r==21,"#+21.18I64x failed: '%s'\n", buffer); format = "%#.25I64o"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"0001777777777777777777634") && r==25,"#.25I64o failed: '%s'\n", buffer); format = "%#+24.20I64o"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer," 01777777777777777777634") && r==24,"#+24.20I64o failed: '%s'\n", buffer); format = "%#+18.21I64X"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"0X00000FFFFFFFFFFFFFF9C") && r==23,"#+18.21I64X failed: '%s '\n", buffer); format = "%#+20.24I64o"; - r = sprintf(buffer,format,(LONGLONG)-100); + r = p_sprintf(buffer,format,(LONGLONG)-100); ok(!strcmp(buffer,"001777777777777777777634") && r==24,"#+20.24I64o failed: '%s'\n", buffer); format = "%#+25.22I64u"; - r = sprintf(buffer,format,(LONGLONG)-1); + r = p_sprintf(buffer,format,(LONGLONG)-1); ok(!strcmp(buffer," 0018446744073709551615") && r==25,"#+25.22I64u conversion failed: '%s'\n", buffer); format = "%#+25.22I64u"; - r = sprintf(buffer,format,(LONGLONG)-1); + r = p_sprintf(buffer,format,(LONGLONG)-1); ok(!strcmp(buffer," 0018446744073709551615") && r==25,"#+25.22I64u failed: '%s'\n", buffer); format = "%#+30.25I64u"; - r = sprintf(buffer,format,(LONGLONG)-1); + r = p_sprintf(buffer,format,(LONGLONG)-1); ok(!strcmp(buffer," 0000018446744073709551615") && r==30,"#+30.25I64u failed: '%s'\n", buffer); format = "%+#25.22I64d"; - r = sprintf(buffer,format,(LONGLONG)-1); + r = p_sprintf(buffer,format,(LONGLONG)-1); ok(!strcmp(buffer," -0000000000000000000001") && r==25,"+#25.22I64d failed: '%s'\n", buffer); format = "%#-8.5I64o"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"00144 ") && r==8,"-8.5I64o failed: '%s'\n", buffer); format = "%#-+ 08.5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"+00100 ") && r==8,"'#-+ 08.5I64d failed: '%s'\n", buffer); format = "%#-+ 08.5I64d"; - r = sprintf(buffer,format,(LONGLONG)100); + r = p_sprintf(buffer,format,(LONGLONG)100); ok(!strcmp(buffer,"+00100 ") && r==8,"#-+ 08.5I64d failed: '%s'\n", buffer); format = "%.80I64d"; - r = sprintf(buffer,format,(LONGLONG)1); + r = p_sprintf(buffer,format,(LONGLONG)1); ok(r==80,"%s format failed\n", format); format = "% .80I64d"; - r = sprintf(buffer,format,(LONGLONG)1); + r = p_sprintf(buffer,format,(LONGLONG)1); ok(r==81,"%s format failed\n", format); format = "% .80d"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(r==81,"%s format failed\n", format); format = "%lld"; - r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff); + r = p_sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff); ok( r == 1 || r == 11, "return count wrong %d\n", r); if (r == 11) /* %ll works on Vista */ ok(!strcmp(buffer, "-8589934591"), "Problem with \"ll\" interpretation '%s'\n", buffer); @@ -296,17 +304,17 @@ static void test_sprintf( void ) ok(!strcmp(buffer, "1"), "Problem with \"ll\" interpretation '%s'\n", buffer); format = "%I"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer, "I"), "Problem with \"I\" interpretation\n"); ok( r==1, "return count wrong\n"); format = "%I0d"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"I0d"),"I0d failed\n"); ok( r==3, "return count wrong\n"); format = "%I32d"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); if (r == 1) { ok(!strcmp(buffer,"1"),"I32d failed, got '%s'\n",buffer); @@ -318,248 +326,248 @@ static void test_sprintf( void ) } format = "%I64D"; - r = sprintf(buffer,format,(LONGLONG)-1); + r = p_sprintf(buffer,format,(LONGLONG)-1); ok(!strcmp(buffer,"D"),"I64D failed: %s\n",buffer); ok( r==1, "return count wrong\n"); format = "%zx"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer, "zx"), "Problem with \"z\" interpretation\n"); ok( r==2, "return count wrong\n"); format = "% d"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer, " 1"),"Problem with sign place-holder: '%s'\n",buffer); ok( r==2, "return count wrong\n"); format = "%+ d"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer, "+1"),"Problem with sign flags: '%s'\n",buffer); ok( r==2, "return count wrong\n"); format = "%S"; - r = sprintf(buffer,format,wide); + r = p_sprintf(buffer,format,wide); ok(!strcmp(buffer,"wide"),"Problem with wide string format\n"); ok( r==4, "return count wrong\n"); format = "%04c"; - r = sprintf(buffer,format,'1'); + r = p_sprintf(buffer,format,'1'); ok(!strcmp(buffer,"0001"),"Character not zero-prefixed \"%s\"\n",buffer); ok( r==4, "return count wrong\n"); format = "%-04c"; - r = sprintf(buffer,format,'1'); + r = p_sprintf(buffer,format,'1'); ok(!strcmp(buffer,"1 "),"Character zero-padded and/or not left-adjusted \"%s\"\n",buffer); ok( r==4, "return count wrong\n"); format = "%#012x"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"0x0000000001"),"Hexadecimal zero-padded \"%s\"\n",buffer); ok( r==12, "return count wrong\n"); - r = sprintf(buffer,format,0); + r = p_sprintf(buffer,format,0); ok(!strcmp(buffer,"000000000000"),"Hexadecimal zero-padded \"%s\"\n",buffer); ok( r==12, "return count wrong\n"); format = "%#04.8x"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"0x00000001"), "Hexadecimal zero-padded precision \"%s\"\n",buffer); ok( r==10, "return count wrong\n"); - r = sprintf(buffer,format,0); + r = p_sprintf(buffer,format,0); ok(!strcmp(buffer,"00000000"), "Hexadecimal zero-padded precision \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); format = "%#-08.2x"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"0x01 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); - r = sprintf(buffer,format,0); + r = p_sprintf(buffer,format,0); ok(!strcmp(buffer,"00 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); format = "%#.0x"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"0x1"), "Hexadecimal zero-padded zero-precision \"%s\"\n",buffer); ok( r==3, "return count wrong\n"); - r = sprintf(buffer,format,0); + r = p_sprintf(buffer,format,0); ok(!strcmp(buffer,""), "Hexadecimal zero-padded zero-precision \"%s\"\n",buffer); ok( r==0, "return count wrong\n"); format = "%#08o"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"00000001"), "Octal zero-padded \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); format = "%#o"; - r = sprintf(buffer,format,1); + r = p_sprintf(buffer,format,1); ok(!strcmp(buffer,"01"), "Octal zero-padded \"%s\"\n",buffer); ok( r==2, "return count wrong\n"); - r = sprintf(buffer,format,0); + r = p_sprintf(buffer,format,0); ok(!strcmp(buffer,"0"), "Octal zero-padded \"%s\"\n",buffer); ok( r==1, "return count wrong\n"); if (sizeof(void *) == 8) { format = "%p"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok( r==16, "return count wrong\n"); format = "%#020p"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer," 0X0000000000000039"),"Pointer formatted incorrectly\n"); ok( r==20, "return count wrong\n"); format = "%Fp"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok( r==16, "return count wrong\n"); format = "%Np"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok( r==16, "return count wrong\n"); format = "%#-020p"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"0X0000000000000039 "),"Pointer formatted incorrectly\n"); ok( r==20, "return count wrong\n"); format = "%Ix %d"; - r = sprintf(buffer,format,(size_t)0x12345678123456,1); + r = p_sprintf(buffer,format,(size_t)0x12345678123456,1); ok(!strcmp(buffer,"12345678123456 1"),"buffer = %s\n",buffer); ok( r==16, "return count wrong\n"); } else { format = "%p"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); format = "%#012p"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer," 0X00000039"),"Pointer formatted incorrectly\n"); ok( r==12, "return count wrong\n"); format = "%Fp"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); format = "%Np"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok( r==8, "return count wrong\n"); format = "%#-012p"; - r = sprintf(buffer,format,(void *)57); + r = p_sprintf(buffer,format,(void *)57); ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted incorrectly\n"); ok( r==12, "return count wrong\n"); format = "%Ix %d"; - r = sprintf(buffer,format,0x123456,1); + r = p_sprintf(buffer,format,0x123456,1); ok(!strcmp(buffer,"123456 1"),"buffer = %s\n",buffer); ok( r==8, "return count wrong\n"); } format = "%04s"; - r = sprintf(buffer,format,"foo"); + r = p_sprintf(buffer,format,"foo"); ok(!strcmp(buffer,"0foo"),"String not zero-prefixed \"%s\"\n",buffer); ok( r==4, "return count wrong\n"); format = "%.1s"; - r = sprintf(buffer,format,"foo"); + r = p_sprintf(buffer,format,"foo"); ok(!strcmp(buffer,"f"),"Precision ignored \"%s\"\n",buffer); ok( r==1, "return count wrong\n"); format = "%.*s"; - r = sprintf(buffer,format,1,"foo"); + r = p_sprintf(buffer,format,1,"foo"); ok(!strcmp(buffer,"f"),"Precision ignored \"%s\"\n",buffer); ok( r==1, "return count wrong\n"); format = "%*s"; - r = sprintf(buffer,format,-5,"foo"); + r = p_sprintf(buffer,format,-5,"foo"); ok(!strcmp(buffer,"foo "),"Negative field width ignored \"%s\"\n",buffer); ok( r==5, "return count wrong\n"); format = "hello"; - r = sprintf(buffer, format); + r = p_sprintf(buffer, format); ok(!strcmp(buffer,"hello"), "failed\n"); ok( r==5, "return count wrong\n"); format = "%ws"; - r = sprintf(buffer, format, wide); + r = p_sprintf(buffer, format, wide); ok(!strcmp(buffer,"wide"), "failed\n"); ok( r==4, "return count wrong\n"); format = "%-10ws"; - r = sprintf(buffer, format, wide ); + r = p_sprintf(buffer, format, wide ); ok(!strcmp(buffer,"wide "), "failed\n"); ok( r==10, "return count wrong\n"); format = "%10ws"; - r = sprintf(buffer, format, wide ); + r = p_sprintf(buffer, format, wide ); ok(!strcmp(buffer," wide"), "failed\n"); ok( r==10, "return count wrong\n"); format = "%#+ -03whlls"; - r = sprintf(buffer, format, wide ); + r = p_sprintf(buffer, format, wide ); ok(!strcmp(buffer,"wide"), "failed\n"); ok( r==4, "return count wrong\n"); format = "%w0s"; - r = sprintf(buffer, format, wide ); + r = p_sprintf(buffer, format, wide ); ok(!strcmp(buffer,"0s"), "failed\n"); ok( r==2, "return count wrong\n"); format = "%w-s"; - r = sprintf(buffer, format, wide ); + r = p_sprintf(buffer, format, wide ); ok(!strcmp(buffer,"-s"), "failed\n"); ok( r==2, "return count wrong\n"); format = "%ls"; - r = sprintf(buffer, format, wide ); + r = p_sprintf(buffer, format, wide ); ok(!strcmp(buffer,"wide"), "failed\n"); ok( r==4, "return count wrong\n"); format = "%Ls"; - r = sprintf(buffer, format, "not wide" ); + r = p_sprintf(buffer, format, "not wide" ); ok(!strcmp(buffer,"not wide"), "failed\n"); ok( r==8, "return count wrong\n"); format = "%b"; - r = sprintf(buffer, format); + r = p_sprintf(buffer, format); ok(!strcmp(buffer,"b"), "failed\n"); ok( r==1, "return count wrong\n"); format = "%3c"; - r = sprintf(buffer, format,'a'); + r = p_sprintf(buffer, format,'a'); ok(!strcmp(buffer," a"), "failed\n"); ok( r==3, "return count wrong\n"); format = "%3d"; - r = sprintf(buffer, format,1234); + r = p_sprintf(buffer, format,1234); ok(!strcmp(buffer,"1234"), "failed\n"); ok( r==4, "return count wrong\n"); format = "%3h"; - r = sprintf(buffer, format); + r = p_sprintf(buffer, format); ok(!strcmp(buffer,""), "failed\n"); ok( r==0, "return count wrong\n"); format = "%j%k%m%q%r%t%v%y%z"; - r = sprintf(buffer, format); + r = p_sprintf(buffer, format); ok(!strcmp(buffer,"jkmqrtvyz"), "failed\n"); ok( r==9, "return count wrong\n"); format = "asdf%n"; x = 0; - r = sprintf(buffer, format, &x ); + r = p_sprintf(buffer, format, &x ); if (r == -1) { /* %n format is disabled by default on vista */ @@ -574,77 +582,77 @@ static void test_sprintf( void ) } format = "%-1d"; - r = sprintf(buffer, format,2); + r = p_sprintf(buffer, format,2); ok(!strcmp(buffer,"2"), "failed\n"); ok( r==1, "return count wrong\n"); format = "%2.4f"; - r = sprintf(buffer, format,8.6); + r = p_sprintf(buffer, format,8.6); ok(!strcmp(buffer,"8.6000"), "failed\n"); ok( r==6, "return count wrong\n"); format = "%0f"; - r = sprintf(buffer, format,0.6); + r = p_sprintf(buffer, format,0.6); ok(!strcmp(buffer,"0.600000"), "failed\n"); ok( r==8, "return count wrong\n"); format = "%.0f"; - r = sprintf(buffer, format,0.6); + r = p_sprintf(buffer, format,0.6); ok(!strcmp(buffer,"1"), "failed\n"); ok( r==1, "return count wrong\n"); format = "%2.4e"; - r = sprintf(buffer, format,8.6); + r = p_sprintf(buffer, format,8.6); ok(!strcmp(buffer,"8.6000e+000"), "failed\n"); ok( r==11, "return count wrong\n"); format = "% 2.4e"; - r = sprintf(buffer, format,8.6); + r = p_sprintf(buffer, format,8.6); ok(!strcmp(buffer," 8.6000e+000"), "failed: %s\n", buffer); ok( r==12, "return count wrong\n"); format = "% 014.4e"; - r = sprintf(buffer, format,8.6); + r = p_sprintf(buffer, format,8.6); ok(!strcmp(buffer," 008.6000e+000"), "failed: %s\n", buffer); ok( r==14, "return count wrong\n"); format = "% 2.4e"; - r = sprintf(buffer, format,-8.6); + r = p_sprintf(buffer, format,-8.6); ok(!strcmp(buffer,"-8.6000e+000"), "failed: %s\n", buffer); ok( r==12, "return count wrong\n"); format = "%+2.4e"; - r = sprintf(buffer, format,8.6); + r = p_sprintf(buffer, format,8.6); ok(!strcmp(buffer,"+8.6000e+000"), "failed: %s\n", buffer); ok( r==12, "return count wrong\n"); format = "%2.4g"; - r = sprintf(buffer, format,8.6); + r = p_sprintf(buffer, format,8.6); ok(!strcmp(buffer,"8.6"), "failed\n"); ok( r==3, "return count wrong\n"); format = "%-i"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,"-1"), "failed\n"); ok( r==2, "return count wrong\n"); format = "%-i"; - r = sprintf(buffer, format,1); + r = p_sprintf(buffer, format,1); ok(!strcmp(buffer,"1"), "failed\n"); ok( r==1, "return count wrong\n"); format = "%+i"; - r = sprintf(buffer, format,1); + r = p_sprintf(buffer, format,1); ok(!strcmp(buffer,"+1"), "failed\n"); ok( r==2, "return count wrong\n"); format = "%o"; - r = sprintf(buffer, format,10); + r = p_sprintf(buffer, format,10); ok(!strcmp(buffer,"12"), "failed\n"); ok( r==2, "return count wrong\n"); format = "%p"; - r = sprintf(buffer, format,0); + r = p_sprintf(buffer, format,0); if (sizeof(void *) == 8) { ok(!strcmp(buffer,"0000000000000000"), "failed\n"); @@ -657,150 +665,166 @@ static void test_sprintf( void ) } format = "%s"; - r = sprintf(buffer, format,0); + r = p_sprintf(buffer, format,0); ok(!strcmp(buffer,"(null)"), "failed\n"); ok( r==6, "return count wrong\n"); format = "%s"; - r = sprintf(buffer, format,"%%%%"); + r = p_sprintf(buffer, format,"%%%%"); ok(!strcmp(buffer,"%%%%"), "failed\n"); ok( r==4, "return count wrong\n"); format = "%u"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,"4294967295"), "failed\n"); ok( r==10, "return count wrong\n"); format = "%w"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,""), "failed\n"); ok( r==0, "return count wrong\n"); format = "%h"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,""), "failed\n"); ok( r==0, "return count wrong\n"); format = "%z"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,"z"), "failed\n"); ok( r==1, "return count wrong\n"); format = "%j"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,"j"), "failed\n"); ok( r==1, "return count wrong\n"); format = "%F"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,""), "failed\n"); ok( r==0, "return count wrong\n"); format = "%N"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,""), "failed\n"); ok( r==0, "return count wrong\n"); format = "%H"; - r = sprintf(buffer, format,-1); + r = p_sprintf(buffer, format,-1); ok(!strcmp(buffer,"H"), "failed\n"); ok( r==1, "return count wrong\n"); format = "x%cx"; - r = sprintf(buffer, format, 0x100+'X'); + r = p_sprintf(buffer, format, 0x100+'X'); ok(!strcmp(buffer,"xXx"), "failed\n"); ok( r==3, "return count wrong\n"); format = "%%0"; - r = sprintf(buffer, format); + r = p_sprintf(buffer, format); ok(!strcmp(buffer,"%0"), "failed: \"%s\"\n", buffer); ok( r==2, "return count wrong\n"); format = "%hx"; - r = sprintf(buffer, format, 0x12345); + r = p_sprintf(buffer, format, 0x12345); ok(!strcmp(buffer,"2345"), "failed \"%s\"\n", buffer); format = "%hhx"; - r = sprintf(buffer, format, 0x123); + r = p_sprintf(buffer, format, 0x123); ok(!strcmp(buffer,"123"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, 0x12345); + r = p_sprintf(buffer, format, 0x12345); ok(!strcmp(buffer,"2345"), "failed \"%s\"\n", buffer); format = "%lf"; - r = sprintf(buffer, format, IND); + r = p_sprintf(buffer, format, IND); ok(r==9, "r = %d\n", r); ok(!strcmp(buffer, "-1.#IND00"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, NAN); + r = p_sprintf(buffer, format, NAN); ok(r==8, "r = %d\n", r); ok(!strcmp(buffer, "1.#QNAN0"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, INFINITY); + r = p_sprintf(buffer, format, INFINITY); ok(r==8, "r = %d\n", r); ok(!strcmp(buffer, "1.#INF00"), "failed: \"%s\"\n", buffer); format = "%le"; - r = sprintf(buffer, format, IND); + r = p_sprintf(buffer, format, IND); ok(r==14, "r = %d\n", r); ok(!strcmp(buffer, "-1.#IND00e+000"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, NAN); + r = p_sprintf(buffer, format, NAN); ok(r==13, "r = %d\n", r); ok(!strcmp(buffer, "1.#QNAN0e+000"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, INFINITY); + r = p_sprintf(buffer, format, INFINITY); ok(r==13, "r = %d\n", r); ok(!strcmp(buffer, "1.#INF00e+000"), "failed: \"%s\"\n", buffer); format = "%lg"; - r = sprintf(buffer, format, IND); + r = p_sprintf(buffer, format, IND); ok(r==7, "r = %d\n", r); ok(!strcmp(buffer, "-1.#IND"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, NAN); + r = p_sprintf(buffer, format, NAN); ok(r==7, "r = %d\n", r); ok(!strcmp(buffer, "1.#QNAN"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, INFINITY); + r = p_sprintf(buffer, format, INFINITY); ok(r==6, "r = %d\n", r); ok(!strcmp(buffer, "1.#INF"), "failed: \"%s\"\n", buffer); format = "%010.2lf"; - r = sprintf(buffer, format, IND); + r = p_sprintf(buffer, format, IND); ok(r==10, "r = %d\n", r); ok(!strcmp(buffer, "-000001.#J"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, NAN); + r = p_sprintf(buffer, format, NAN); ok(r==10, "r = %d\n", r); ok(!strcmp(buffer, "0000001.#R"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, INFINITY); + r = p_sprintf(buffer, format, INFINITY); ok(r==10, "r = %d\n", r); ok(!strcmp(buffer, "0000001.#J"), "failed: \"%s\"\n", buffer); format = "%c"; - r = sprintf(buffer, format, 'a'); + r = p_sprintf(buffer, format, 'a'); ok(r==1, "r = %d\n", r); ok(!strcmp(buffer, "a"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, 0xa082); + r = p_sprintf(buffer, format, 0xa082); ok(r==1, "r = %d\n", r); ok(!strcmp(buffer, "\x82"), "failed: \"%s\"\n", buffer); format = "%C"; - r = sprintf(buffer, format, 'a'); + r = p_sprintf(buffer, format, 'a'); ok(r==1, "r = %d\n", r); ok(!strcmp(buffer, "a"), "failed: \"%s\"\n", buffer); - r = sprintf(buffer, format, 0x3042); + r = p_sprintf(buffer, format, 0x3042); ok(r==0, "r = %d\n", r); ok(!strcmp(buffer, ""), "failed: \"%s\"\n", buffer); + format = "a%Cb"; + r = p_sprintf(buffer, format, 0x3042); + ok(r==2, "r = %d\n", r); + ok(!strcmp(buffer, "ab"), "failed: \"%s\"\n", buffer); + + format = "%S"; + buf_w[0] = 0x3042; + buf_w[1] = 0; + r = p_sprintf(buffer, format, buf_w); + ok(r==-1 || broken(!r), "r = %d\n", r); + if(!setlocale(LC_ALL, "Japanese_Japan.932")) { win_skip("Japanese_Japan.932 locale not available\n"); return; } format = "%c"; - r = sprintf(buffer, format, 0xa082); + r = p_sprintf(buffer, format, 0xa082); ok(r==1, "r = %d\n", r); ok(!strcmp(buffer, "\x82"), "failed: \"%s\"\n", buffer); format = "%C"; - r = sprintf(buffer, format, 0x3042); + r = p_sprintf(buffer, format, 0x3042); ok(r==2, "r = %d\n", r); ok(!strcmp(buffer, "\x82\xa0"), "failed: \"%s\"\n", buffer); + strcpy(buffer, " string to copy"); + r = p_sprintf(buffer, buffer+1); + ok(r==14, "r = %d\n", r); + ok(!strcmp(buffer, "string to copy"), "failed: \"%s\"\n", buffer); + setlocale(LC_ALL, "C"); } @@ -1499,14 +1523,14 @@ static void test__get_output_format(void) ret = p__get_output_format(); ok(ret == 0, "got %d\n", ret); - c = sprintf(buf, "%E", 1.23); + c = p_sprintf(buf, "%E", 1.23); ok(c == 13, "c = %d\n", c); ok(!strcmp(buf, "1.230000E+000"), "buf = %s\n", buf); ret = p__set_output_format(_TWO_DIGIT_EXPONENT); ok(ret == 0, "got %d\n", ret); - c = sprintf(buf, "%E", 1.23); + c = p_sprintf(buf, "%E", 1.23); ok(c == 12, "c = %d\n", c); ok(!strcmp(buf, "1.230000E+00"), "buf = %s\n", buf); diff --git a/modules/rostests/winetests/msvcrt/scanf.c b/modules/rostests/winetests/msvcrt/scanf.c index b7244835aca..6d38e438c8c 100644 --- a/modules/rostests/winetests/msvcrt/scanf.c +++ b/modules/rostests/winetests/msvcrt/scanf.c @@ -24,6 +24,9 @@ static void test_sscanf( void ) { + /* use function pointers to bypass gcc builtin */ + int (WINAPIV *p_sprintf)(char *buf, const char *fmt, ...); + int (WINAPIV *p_sscanf)(const char *buf, const char *fmt, ...); char buffer[100], buffer1[100]; char format[20]; int result, ret; @@ -35,197 +38,200 @@ static void test_sscanf( void ) static const char pname[]=" St. Petersburg, Florida\n"; int hour=21,min=59,sec=20; int number,number_so_far; + HMODULE hmod = GetModuleHandleA("msvcrt.dll"); + p_sprintf = (void *)GetProcAddress( hmod, "sprintf" ); + p_sscanf = (void *)GetProcAddress( hmod, "sscanf" ); /* check EOF */ strcpy(buffer,""); - ret = sscanf(buffer, "%d", &result); + ret = p_sscanf(buffer, "%d", &result); ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF ); /* check %p */ - ok( sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)0x46F170,"sscanf reads %p instead of %x\n", ptr, 0x46F170 ); - ok( sscanf("0046F171", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("0046F171", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)0x46F171,"sscanf reads %p instead of %x\n", ptr, 0x46F171 ); - ok( sscanf("46F172", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("46F172", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)0x46F172,"sscanf reads %p instead of %x\n", ptr, 0x46F172 ); - ok( sscanf("0x46F173", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("0x46F173", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == NULL,"sscanf reads %p instead of %x\n", ptr, 0 ); - ok( sscanf("-46F174", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("-46F174", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)(ULONG_PTR)-0x46f174,"sscanf reads %p instead of %p\n", ptr, (void *)(ULONG_PTR)-0x46f174 ); - ok( sscanf("+46F175", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("+46F175", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)0x46F175,"sscanf reads %p instead of %x\n", ptr, 0x46F175 ); /* check %p with no hex digits */ - ok( sscanf("1233", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("1233", "%p", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)0x1233,"sscanf reads %p instead of %x\n", ptr, 0x1233 ); - ok( sscanf("1234", "%P", &ptr) == 1, "sscanf failed\n" ); + ok( p_sscanf("1234", "%P", &ptr) == 1, "sscanf failed\n" ); ok( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 ); /* check %x */ strcpy(buffer,"0x519"); - ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); + ok( p_sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); ok( result == 0x519,"sscanf reads %x instead of %x\n", result, 0x519 ); strcpy(buffer,"0x51a"); - ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); + ok( p_sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); ok( result == 0x51a ,"sscanf reads %x instead of %x\n", result, 0x51a ); strcpy(buffer,"0x51g"); - ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); + ok( p_sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); ok( result == 0x51, "sscanf reads %x instead of %x\n", result, 0x51 ); result = 0; - ret = sscanf("-1", "%x", &result); + ret = p_sscanf("-1", "%x", &result); ok(ret == 1, "Wrong number of arguments read: %d (expected 1)\n", ret); ok(result == -1, "Read %d, expected -1\n", result); /* check % followed by any char */ strcpy(buffer,"\"%12@"); strcpy(format,"%\"%%%d%@"); /* work around gcc format check */ - ok( sscanf(buffer, format, &result) == 1, "sscanf failed\n" ); + ok( p_sscanf(buffer, format, &result) == 1, "sscanf failed\n" ); ok( result == 12, "sscanf reads %x instead of %x\n", result, 12 ); /* Check float */ - ret = sprintf(buffer,"%f %f",res1, res2); + ret = p_sprintf(buffer,"%f %f",res1, res2); ok( ret == 20, "expected 20, got %u\n", ret); - ret = sscanf(buffer,"%f%f",&res11, &res12); + ret = p_sscanf(buffer,"%f%f",&res11, &res12); ok( ret == 2, "expected 2, got %u\n", ret); ok( (res11 == res1) && (res12 == res2), "Error reading floats\n"); /* Check double */ - ret = sprintf(buffer, "%lf", 32.715); + ret = p_sprintf(buffer, "%lf", 32.715); ok(ret == 9, "expected 9, got %u\n", ret); - ret = sscanf(buffer, "%lf", &double_res); + ret = p_sscanf(buffer, "%lf", &double_res); ok(ret == 1, "expected 1, got %u\n", ret); ok(double_res == 32.715, "Got %lf, expected %lf\n", double_res, 32.715); - ret = sscanf(buffer, "%Lf", &double_res); + ret = p_sscanf(buffer, "%Lf", &double_res); ok(ret == 1, "expected 1, got %u\n", ret); ok(double_res == 32.715, "Got %lf, expected %lf\n", double_res, 32.715); strcpy(buffer, "1.1e-30"); - ret = sscanf(buffer, "%lf", &double_res); + ret = p_sscanf(buffer, "%lf", &double_res); ok(ret == 1, "expected 1, got %u\n", ret); ok(double_res >= 1.1e-30-1e-45 && double_res <= 1.1e-30+1e-45, "Got %.18le, expected %.18le\n", double_res, 1.1e-30); /* check strings */ - ret = sprintf(buffer," %s", pname); + ret = p_sprintf(buffer," %s", pname); ok( ret == 26, "expected 26, got %u\n", ret); - ret = sscanf(buffer,"%*c%[^\n]",buffer1); + ret = p_sscanf(buffer,"%*c%[^\n]",buffer1); ok( ret == 1, "Error with format \"%s\"\n","%*c%[^\n]"); ok( strncmp(pname,buffer1,strlen(buffer1)) == 0, "Error with \"%s\" \"%s\"\n",pname, buffer1); - ret = sscanf("abcefgdh","%*[a-cg-e]%c",&buffer[0]); + ret = p_sscanf("abcefgdh","%*[a-cg-e]%c",&buffer[0]); ok( ret == 1, "Error with format \"%s\"\n","%*[a-cg-e]%c"); ok( buffer[0] == 'd', "Error with \"abcefgdh\" \"%c\"\n", buffer[0]); - ret = sscanf("abcefgdh","%*[a-cd-dg-e]%c",&buffer[0]); + ret = p_sscanf("abcefgdh","%*[a-cd-dg-e]%c",&buffer[0]); ok( ret == 1, "Error with format \"%s\"\n","%*[a-cd-dg-e]%c"); ok( buffer[0] == 'h', "Error with \"abcefgdh\" \"%c\"\n", buffer[0]); buffer1[0] = 'b'; - ret = sscanf("a","%s%s", buffer, buffer1); + ret = p_sscanf("a","%s%s", buffer, buffer1); ok( ret == 1, "expected 1, got %u\n", ret); ok( buffer[0] == 'a', "buffer[0] = '%c'\n", buffer[0]); ok( buffer[1] == '\0', "buffer[1] = '%c'\n", buffer[1]); ok( buffer1[0] == 'b', "buffer1[0] = '%c'\n", buffer1[0]); /* check digits */ - ret = sprintf(buffer,"%d:%d:%d",hour,min,sec); + ret = p_sprintf(buffer,"%d:%d:%d",hour,min,sec); ok( ret == 8, "expected 8, got %u\n", ret); - ret = sscanf(buffer,"%d%n",&number,&number_so_far); + ret = p_sscanf(buffer,"%d%n",&number,&number_so_far); ok(ret == 1 , "problem with format arg \"%%d%%n\"\n"); ok(number == hour,"Read wrong arg %d instead of %d\n",number, hour); ok(number_so_far == 2,"Read wrong arg for \"%%n\" %d instead of 2\n",number_so_far); - ret = sscanf(buffer+2,"%*c%n",&number_so_far); + ret = p_sscanf(buffer+2,"%*c%n",&number_so_far); ok(ret == 0 , "problem with format arg \"%%*c%%n\"\n"); ok(number_so_far == 1,"Read wrong arg for \"%%n\" %d instead of 2\n",number_so_far); result = 0xdeadbeef; strcpy(buffer,"12345678"); - ret = sscanf(buffer, "%hd", &result); + ret = p_sscanf(buffer, "%hd", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(result == 0xdead614e, "Wrong number read (%x)\n", result); result = 0xdeadbeef; - ret = sscanf(buffer, "%hhd", &result); + ret = p_sscanf(buffer, "%hhd", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(result == 0xbc614e, "Wrong number read (%x)\n", result); strcpy(buffer,"12345678901234"); - ret = sscanf(buffer, "%lld", &result64); + ret = p_sscanf(buffer, "%lld", &result64); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); - ret = sprintf(buffer1, "%lld", result64); + ret = p_sprintf(buffer1, "%lld", result64); ok(ret==14 || broken(ret==10), "sprintf returned %d\n", ret); if(ret == 14) ok(!strcmp(buffer, buffer1), "got %s, expected %s\n", buffer1, buffer); /* Check %i according to bug 1878 */ strcpy(buffer,"123"); - ret = sscanf(buffer, "%i", &result); + ret = p_sscanf(buffer, "%i", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(result == 123, "Wrong number read\n"); result = 0; - ret = sscanf("-1", "%i", &result); + ret = p_sscanf("-1", "%i", &result); ok(ret == 1, "Wrong number of arguments read: %d (expected 1)\n", ret); ok(result == -1, "Read %d, expected -1\n", result); - ret = sscanf(buffer, "%d", &result); + ret = p_sscanf(buffer, "%d", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(result == 123, "Wrong number read\n"); result = 0; - ret = sscanf("-1", "%d", &result); + ret = p_sscanf("-1", "%d", &result); ok(ret == 1, "Wrong number of arguments read: %d (expected 1)\n", ret); ok(result == -1, "Read %d, expected -1\n", result); /* Check %i for octal and hexadecimal input */ result = 0; strcpy(buffer,"017"); - ret = sscanf(buffer, "%i", &result); + ret = p_sscanf(buffer, "%i", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(result == 15, "Wrong number read\n"); result = 0; strcpy(buffer,"0x17"); - ret = sscanf(buffer, "%i", &result); + ret = p_sscanf(buffer, "%i", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(result == 23, "Wrong number read\n"); /* %o */ result = 0; - ret = sscanf("-1", "%o", &result); + ret = p_sscanf("-1", "%o", &result); ok(ret == 1, "Wrong number of arguments read: %d (expected 1)\n", ret); ok(result == -1, "Read %d, expected -1\n", result); /* %u */ result = 0; - ret = sscanf("-1", "%u", &result); + ret = p_sscanf("-1", "%u", &result); ok(ret == 1, "Wrong number of arguments read: %d (expected 1)\n", ret); ok(result == -1, "Read %d, expected -1\n", result); /* Check %c */ strcpy(buffer,"a"); c = 0x55; - ret = sscanf(buffer, "%c", &c); + ret = p_sscanf(buffer, "%c", &c); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(c == 'a', "Field incorrect: '%c'\n", c); strcpy(buffer," a"); c = 0x55; - ret = sscanf(buffer, "%c", &c); + ret = p_sscanf(buffer, "%c", &c); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); ok(c == ' ', "Field incorrect: '%c'\n", c); strcpy(buffer,"18:59"); c = 0x55; - ret = sscanf(buffer, "%d:%d%c", &hour, &min, &c); + ret = p_sscanf(buffer, "%d:%d%c", &hour, &min, &c); ok(ret == 2, "Wrong number of arguments read: %d\n", ret); ok(hour == 18, "Field 1 incorrect: %d\n", hour); ok(min == 59, "Field 2 incorrect: %d\n", min); @@ -233,7 +239,7 @@ static void test_sscanf( void ) /* Check %n (also whitespace in format strings and %s) */ buffer[0]=0; buffer1[0]=0; - ret = sscanf("abc def", "%s %n%s", buffer, &number_so_far, buffer1); + ret = p_sscanf("abc def", "%s %n%s", buffer, &number_so_far, buffer1); ok(strcmp(buffer, "abc")==0, "First %%s read incorrectly: %s\n", buffer); ok(strcmp(buffer1,"def")==0, "Second %%s read incorrectly: %s\n", buffer1); ok(number_so_far==6, "%%n yielded wrong result: %d\n", number_so_far); @@ -241,18 +247,18 @@ static void test_sscanf( void ) /* Check where %n matches to EOF in buffer */ strcpy(buffer, "3:45"); - ret = sscanf(buffer, "%d:%d%n", &hour, &min, &number_so_far); + ret = p_sscanf(buffer, "%d:%d%n", &hour, &min, &number_so_far); ok(ret == 2, "Wrong number of arguments read: %d\n", ret); ok(number_so_far == 4, "%%n yielded wrong result: %d\n", number_so_far); buffer[0] = 0; buffer1[0] = 0; - ret = sscanf("test=value\xda", "%[^=] = %[^;]", buffer, buffer1); + ret = p_sscanf("test=value\xda", "%[^=] = %[^;]", buffer, buffer1); ok(ret == 2, "got %d\n", ret); ok(!strcmp(buffer, "test"), "buf %s\n", buffer); ok(!strcmp(buffer1, "value\xda"), "buf %s\n", buffer1); - ret = sscanf("\x81\x82test", "\x81%\x82%s", buffer); + ret = p_sscanf("\x81\x82test", "\x81%\x82%s", buffer); ok(ret == 1, "got %d\n", ret); ok(!strcmp(buffer, "test"), "buf = %s\n", buffer); } diff --git a/modules/rostests/winetests/msvcrt/string.c b/modules/rostests/winetests/msvcrt/string.c index e80a51824ba..573289d77b5 100644 --- a/modules/rostests/winetests/msvcrt/string.c +++ b/modules/rostests/winetests/msvcrt/string.c @@ -88,6 +88,7 @@ static errno_t (__cdecl *p_mbsupr_s)(unsigned char *str, size_t numberOfElements static errno_t (__cdecl *p_mbslwr_s)(unsigned char *str, size_t numberOfElements); static int (__cdecl *p_wctob)(wint_t); static size_t (__cdecl *p_wcrtomb)(char*, wchar_t, mbstate_t*); +static int (__cdecl *p_wcrtomb_s)(size_t*, char*, size_t, wchar_t, mbstate_t*); static int (__cdecl *p_tolower)(int); static int (__cdecl *p_towlower)(wint_t); static int (__cdecl *p__towlower_l)(wint_t, _locale_t); @@ -101,6 +102,7 @@ static int (__cdecl *p__atodbl_l)(_CRT_DOUBLE*,char*,_locale_t); static double (__cdecl *p__atof_l)(const char*,_locale_t); static double (__cdecl *p__strtod_l)(const char *,char**,_locale_t); static int (__cdecl *p__strnset_s)(char*,size_t,int,size_t); +static int (__cdecl *p__wcsnset_s)(wchar_t*,size_t,wchar_t,size_t); static int (__cdecl *p__wcsset_s)(wchar_t*,size_t,wchar_t); static size_t (__cdecl *p__mbsnlen)(const unsigned char*, size_t); static int (__cdecl *p__mbccpy_s)(unsigned char*, size_t, int*, const unsigned char*); @@ -515,13 +517,32 @@ static void test_mbsspn( void) unsigned char str2[]="shiraz"; unsigned char set[]="abc"; unsigned char empty[]=""; - int ret; + unsigned char mbstr[]=" 2019\x94\x4e" "6\x8c\x8e" "29\x93\xfa"; + unsigned char mbset1[]="0123456789 \x94\x4e"; + unsigned char mbset2[]=" \x94\x4e\x8c\x8e"; + unsigned char mbset3[]="\x8e"; + int ret, cp = _getmbcp(); + ret=_mbsspn( str1, set); ok( ret==3, "_mbsspn returns %d should be 3\n", ret); ret=_mbsspn( str2, set); ok( ret==0, "_mbsspn returns %d should be 0\n", ret); ret=_mbsspn( str1, empty); ok( ret==0, "_mbsspn returns %d should be 0\n", ret); + + _setmbcp( 932); + ret=_mbsspn( mbstr, mbset1); + ok( ret==8, "_mbsspn returns %d should be 8\n", ret); + ret=_mbsspn( mbstr, mbset2); + ok( ret==1, "_mbsspn returns %d should be 1\n", ret); + ret=_mbsspn( mbstr+8, mbset1); + ok( ret==0, "_mbsspn returns %d should be 0\n", ret); + ret=_mbsspn( mbstr+8, mbset2); + ok( ret==2, "_mbsspn returns %d should be 2\n", ret); + ret=_mbsspn( mbstr, mbset3); + ok( ret==14, "_mbsspn returns %d should be 14\n", ret); + + _setmbcp( cp); } static void test_mbsspnp( void) @@ -531,7 +552,12 @@ static void test_mbsspnp( void) unsigned char set[]="abc"; unsigned char empty[]=""; unsigned char full[]="abcenrt"; + unsigned char mbstr[]=" 2019\x94\x4e" "6\x8c\x8e" "29\x93\xfa"; + unsigned char mbset1[]="0123456789 \x94\x4e"; + unsigned char mbset2[]=" \x94\x4e\x8c\x8e"; unsigned char* ret; + int cp = _getmbcp(); + ret=_mbsspnp( str1, set); ok( ret[0]=='e', "_mbsspnp returns %c should be e\n", ret[0]); ret=_mbsspnp( str2, set); @@ -540,6 +566,18 @@ static void test_mbsspnp( void) ok( ret[0]=='c', "_mbsspnp returns %c should be c\n", ret[0]); ret=_mbsspnp( str1, full); ok( ret==NULL, "_mbsspnp returns %p should be NULL\n", ret); + + _setmbcp( 932); + ret=_mbsspnp( mbstr, mbset1); + ok( ret==mbstr+8, "_mbsspnp returns %p should be %p\n", ret, mbstr+8); + ret=_mbsspnp( mbstr, mbset2); + ok( ret==mbstr+1, "_mbsspnp returns %p should be %p\n", ret, mbstr+1); + ret=_mbsspnp( mbstr+8, mbset1); + ok( ret==mbstr+8, "_mbsspnp returns %p should be %p\n", ret, mbstr+8); + ret=_mbsspnp( mbstr+8, mbset2); + ok( ret==mbstr+10, "_mbsspnp returns %p should be %p\n", ret, mbstr+10); + + _setmbcp( cp); } static void test_strdup(void) @@ -1019,6 +1057,11 @@ static void test_wcscpy_s(void) ok(ret == 0, "expected 0 got %d\n", ret); ok(lstrcmpW(szDest, szLongText) == 0, "szDest != szLongText\n"); + /* dest == source */ + ret = p_wcscpy_s(szDest, 18, szDest); + ok(ret == 0, "expected 0 got %d\n", ret); + ok(lstrcmpW(szDest, szLongText) == 0, "szDest != szLongText\n"); + /* Copy smaller buffer size */ errno = EBADF; szDest[0] = 'A'; @@ -2701,7 +2744,7 @@ static void test__ultoa_s(void) static void test_wctob(void) { - int ret; + int ret, cp = _getmbcp(); if(!p_wctob || !setlocale(LC_ALL, "chinese-traditional")) { win_skip("Skipping wctob tests\n"); @@ -2733,12 +2776,16 @@ static void test_wctob(void) ret = p_wctob(0xe0); ok(ret == (int)(char)0xe0, "ret = %x\n", ret); + + _setmbcp(cp); } + static void test_wctomb(void) { mbstate_t state; unsigned char dst[10]; size_t ret; + int err; if(!p_wcrtomb || !setlocale(LC_ALL, "Japanese_Japan.932")) { win_skip("wcrtomb tests\n"); @@ -2770,6 +2817,43 @@ static void test_wctomb(void) ok(ret == -1, "wcrtomb did not return -1\n"); ok(dst[0] == 0x3f, "dst[0] = %x, expected 0x3f\n", dst[0]); + if(!p_wcrtomb_s) { + win_skip("wcrtomb_s tests\n"); + setlocale(LC_ALL, "C"); + return; + } + + state = 1; + dst[2] = 'a'; + err = p_wcrtomb_s(&ret, (char*)dst, sizeof(dst), 0x3042, &state); + ok(!err, "err = %d\n", err); + ok(ret == 2, "ret != 2\n"); + ok(!state, "state != 0\n"); + ok(dst[0] == 0x82, "dst[0] = %x, expected 0x82\n", dst[0]); + ok(dst[1] == 0xa0, "dst[1] = %x, expected 0xa0\n", dst[1]); + ok(dst[2] == 'a', "dst[2] != 'a'\n"); + + err = p_wcrtomb_s(&ret, (char*)dst, sizeof(dst), 0x3042, NULL); + ok(!err, "err = %d\n", err); + ok(ret == 2, "ret != 2\n"); + ok(!state, "state != 0\n"); + ok(dst[0] == 0x82, "dst[0] = %x, expected 0x82\n", dst[0]); + ok(dst[1] == 0xa0, "dst[1] = %x, expected 0xa0\n", dst[1]); + + err = p_wcrtomb_s(&ret, (char*)dst, sizeof(dst), 0x20, NULL); + ok(!err, "err = %d\n", err); + ok(ret == 1, "ret != 1\n"); + ok(dst[0] == 0x20, "dst[0] = %x, expected 0x20\n", dst[0]); + + err = p_wcrtomb_s(&ret, NULL, 0, 0x20, NULL); + ok(!err, "err = %d\n", err); + ok(ret == 1, "ret != 1\n"); + + err = p_wcrtomb_s(&ret, (char*)dst, sizeof(dst), 0xffff, NULL); + ok(err == EILSEQ, "err = %d\n", err); + ok(ret == -1, "wcrtomb did not return -1\n"); + ok(dst[0] == 0x3f, "dst[0] = %x, expected 0x3f\n", dst[0]); + setlocale(LC_ALL, "C"); } @@ -2788,13 +2872,19 @@ static void test_tolower(void) errno = 0xdeadbeef; ret = p_tolower((char)0xF4); - todo_wine ok(ret == (char)0xF4, "ret = %x\n", ret); - todo_wine ok(errno == 0xdeadbeef, "errno = %d\n", errno); + ok(ret == (char)0xF4, "ret = %x\n", ret); + ok(errno == 0xdeadbeef, "errno = %d\n", errno); errno = 0xdeadbeef; ret = p_tolower((char)0xD0); - todo_wine ok(ret == (char)0xD0, "ret = %x\n", ret); - todo_wine ok(errno == 0xdeadbeef, "errno = %d\n", errno); + ok(ret == (char)0xD0, "ret = %x\n", ret); + ok(errno == 0xdeadbeef, "errno = %d\n", errno); + + setlocale(LC_ALL, "C"); + errno = 0xdeadbeef; + ret = p_tolower((char)0xF4); + ok(ret == (char)0xF4, "ret = %x\n", ret); + ok(errno == 0xdeadbeef, "errno = %d\n", errno); /* test C locale after setting locale */ if(!setlocale(LC_ALL, "us")) { @@ -3041,6 +3131,23 @@ static void test_atoi(void) ok(r == 0, "atoi(4294967296) = %d\n", r); } +static void test_atol(void) +{ + int r; + + r = atol("0"); + ok(r == 0, "atol(0) = %d\n", r); + + r = atol("-1"); + ok(r == -1, "atol(-1) = %d\n", r); + + r = atol("1"); + ok(r == 1, "atol(1) = %d\n", r); + + r = atol("4294967296"); + ok(r == 0, "atol(4294967296) = %d\n", r); +} + static void test_atof(void) { double d; @@ -3074,29 +3181,33 @@ static void test_atof(void) static void test_strncpy(void) { #define TEST_STRNCPY_LEN 10 + /* use function pointer to bypass gcc builtin */ + char *(__cdecl *p_strncpy)(char*,const char*,size_t); char *ret; char dst[TEST_STRNCPY_LEN + 1]; char not_null_terminated[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; + p_strncpy = (void *)GetProcAddress( GetModuleHandleA("msvcrt.dll"), "strncpy"); + /* strlen(src) > TEST_STRNCPY_LEN */ - ret = strncpy(dst, "01234567890123456789", TEST_STRNCPY_LEN); + ret = p_strncpy(dst, "01234567890123456789", TEST_STRNCPY_LEN); ok(ret == dst, "ret != dst\n"); ok(!strncmp(dst, "0123456789", TEST_STRNCPY_LEN), "dst != 0123456789\n"); /* without null-terminated */ - ret = strncpy(dst, not_null_terminated, TEST_STRNCPY_LEN); + ret = p_strncpy(dst, not_null_terminated, TEST_STRNCPY_LEN); ok(ret == dst, "ret != dst\n"); ok(!strncmp(dst, "0123456789", TEST_STRNCPY_LEN), "dst != 0123456789\n"); /* strlen(src) < TEST_STRNCPY_LEN */ strcpy(dst, "0123456789"); - ret = strncpy(dst, "012345", TEST_STRNCPY_LEN); + ret = p_strncpy(dst, "012345", TEST_STRNCPY_LEN); ok(ret == dst, "ret != dst\n"); ok(!strcmp(dst, "012345"), "dst != 012345\n"); ok(dst[TEST_STRNCPY_LEN - 1] == '\0', "dst[TEST_STRNCPY_LEN - 1] != 0\n"); /* strlen(src) == TEST_STRNCPY_LEN */ - ret = strncpy(dst, "0123456789", TEST_STRNCPY_LEN); + ret = p_strncpy(dst, "0123456789", TEST_STRNCPY_LEN); ok(ret == dst, "ret != dst\n"); ok(!strncmp(dst, "0123456789", TEST_STRNCPY_LEN), "dst != 0123456789\n"); } @@ -3198,6 +3309,45 @@ static void test__strnset_s(void) ok(!buf[0] && buf[1]=='c' && buf[2]=='b', "buf = %s\n", buf); } +static void test__wcsnset_s(void) +{ + wchar_t text[] = { 't','e','x','t',0 }; + int r; + + if(!p__wcsnset_s) { + win_skip("_wcsnset_s not available\n"); + return; + } + + r = p__wcsnset_s(NULL, 0, 'a', 0); + ok(r == 0, "r = %d\n", r); + + r = p__wcsnset_s(text, 0, 'a', 1); + ok(r == EINVAL, "r = %d\n", r); + ok(text[0] == 't', "text[0] = %d\n", text[0]); + + r = p__wcsnset_s(NULL, 2, 'a', 1); + ok(r == EINVAL, "r = %d\n", r); + + r = p__wcsnset_s(text, 2, 'a', 3); + ok(r == EINVAL, "r = %d\n", r); + ok(text[0] == 0, "text[0] = %d\n", text[0]); + ok(text[1] == 'e', "text[1] = %d\n", text[1]); + + text[0] = 't'; + r = p__wcsnset_s(text, 5, 'a', 1); + ok(r == 0, "r = %d\n", r); + ok(text[0] == 'a', "text[0] = %d\n", text[0]); + ok(text[1] == 'e', "text[1] = %d\n", text[1]); + + text[1] = 0; + r = p__wcsnset_s(text, 5, 'b', 3); + ok(r == 0, "r = %d\n", r); + ok(text[0] == 'b', "text[0] = %d\n", text[0]); + ok(text[1] == 0, "text[1] = %d\n", text[1]); + ok(text[2] == 'x', "text[2] = %d\n", text[2]); +} + static void test__wcsset_s(void) { wchar_t str[10]; @@ -3227,6 +3377,7 @@ static void test__wcsset_s(void) str[1] = 0; str[2] = 'b'; r = p__wcsset_s(str, 3, 'c'); + ok(r == 0, "r = %d\n", r); ok(str[0] == 'c', "str[0] = %d\n", str[0]); ok(str[1] == 0, "str[1] = %d\n", str[1]); ok(str[2] == 'b', "str[2] = %d\n", str[2]); @@ -3264,16 +3415,28 @@ static void test__mbscmp(void) static void test__ismbclx(void) { - int cp, ret; + int ret, cp = _getmbcp(); ret = _ismbcl0(0); ok(!ret, "got %d\n", ret); - cp = _setmbcp(1252); + ret = _ismbcl1(0); + ok(!ret, "got %d\n", ret); + + ret = _ismbcl2(0); + ok(!ret, "got %d\n", ret); + + _setmbcp(1252); ret = _ismbcl0(0x8140); ok(!ret, "got %d\n", ret); + ret = _ismbcl1(0x889f); + ok(!ret, "got %d\n", ret); + + ret = _ismbcl2(0x989f); + ok(!ret, "got %d\n", ret); + _setmbcp(932); ret = _ismbcl0(0); @@ -3282,6 +3445,27 @@ static void test__ismbclx(void) ret = _ismbcl0(0x8140); ok(ret, "got %d\n", ret); + ret = _ismbcl0(0x817f); + ok(!ret, "got %d\n", ret); + + ret = _ismbcl1(0); + ok(!ret, "got %d\n", ret); + + ret = _ismbcl1(0x889f); + ok(ret, "got %d\n", ret); + + ret = _ismbcl1(0x88fd); + ok(!ret, "got %d\n", ret); + + ret = _ismbcl2(0); + ok(!ret, "got %d\n", ret); + + ret = _ismbcl2(0x989f); + ok(ret, "got %d\n", ret); + + ret = _ismbcl2(0x993f); + ok(!ret, "got %d\n", ret); + _setmbcp(cp); } @@ -3627,7 +3811,6 @@ static void test_C_locale(void) ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); } else - todo_wine_if(ret != i) ok(ret == i, "expected self %x, got %x for C locale\n", i, ret); ret = p_towupper(i); @@ -3637,7 +3820,6 @@ static void test_C_locale(void) ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); } else - todo_wine_if(ret != i) ok(ret == i, "expected self %x, got %x for C locale\n", i, ret); } @@ -3658,7 +3840,6 @@ static void test_C_locale(void) ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); } else - todo_wine_if(ret != j) ok(ret == j, "expected self %x, got %x for C locale\n", j, ret); ret = p__towupper_l(j, locale); @@ -3668,7 +3849,6 @@ static void test_C_locale(void) ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); } else - todo_wine_if(ret != j) ok(ret == j, "expected self %x, got %x for C locale\n", j, ret); } @@ -3720,6 +3900,7 @@ START_TEST(string) p_mbslwr_s = (void*)GetProcAddress(hMsvcrt, "_mbslwr_s"); p_wctob = (void*)GetProcAddress(hMsvcrt, "wctob"); p_wcrtomb = (void*)GetProcAddress(hMsvcrt, "wcrtomb"); + p_wcrtomb_s = (void*)GetProcAddress(hMsvcrt, "wcrtomb_s"); p_tolower = (void*)GetProcAddress(hMsvcrt, "tolower"); p_towlower = (void*)GetProcAddress(hMsvcrt, "towlower"); p__towlower_l = (void*)GetProcAddress(hMsvcrt, "_towlower_l"); @@ -3735,6 +3916,7 @@ START_TEST(string) p__atof_l = (void*)GetProcAddress(hMsvcrt, "_atof_l"); p__strtod_l = (void*)GetProcAddress(hMsvcrt, "_strtod_l"); p__strnset_s = (void*)GetProcAddress(hMsvcrt, "_strnset_s"); + p__wcsnset_s = (void*)GetProcAddress(hMsvcrt, "_wcsnset_s"); p__wcsset_s = (void*)GetProcAddress(hMsvcrt, "_wcsset_s"); p__mbsnlen = (void*)GetProcAddress(hMsvcrt, "_mbsnlen"); p__mbccpy_s = (void*)GetProcAddress(hMsvcrt, "_mbccpy_s"); @@ -3796,10 +3978,12 @@ START_TEST(string) test__stricmp(); test__wcstoi64(); test_atoi(); + test_atol(); test_atof(); test_strncpy(); test_strxfrm(); test__strnset_s(); + test__wcsnset_s(); test__wcsset_s(); test__mbscmp(); test__ismbclx(); diff --git a/modules/rostests/winetests/msvcrt/time.c b/modules/rostests/winetests/msvcrt/time.c index a5a2df18bba..cf79e5971ec 100644 --- a/modules/rostests/winetests/msvcrt/time.c +++ b/modules/rostests/winetests/msvcrt/time.c @@ -577,7 +577,7 @@ static void test_daylight(void) if (!p___p__daylight) { - win_skip("__p__daylight not available\n"); + skip("__p__daylight not available\n"); return; } @@ -609,47 +609,97 @@ static void test_strftime(void) ok(gmt_tm != NULL, "gmtime failed\n"); errno = 0xdeadbeef; - retA = strftime(NULL, 0, "copy", gmt_tm); + retA = p_strftime(bufA, 256, "%C", gmt_tm); ok(retA == 0, "expected 0, got %ld\n", retA); ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); - retA = strftime(bufA, 256, "copy", NULL); + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%D", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%e", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%F", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%h", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%n", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%R", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%t", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%T", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(bufA, 256, "%u", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = p_strftime(NULL, 0, "copy", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + retA = p_strftime(bufA, 256, "copy", NULL); ok(retA == 4, "expected 4, got %ld\n", retA); ok(!strcmp(bufA, "copy"), "got %s\n", bufA); - retA = strftime(bufA, 256, "copy it", gmt_tm); + retA = p_strftime(bufA, 256, "copy it", gmt_tm); ok(retA == 7, "expected 7, got %ld\n", retA); ok(!strcmp(bufA, "copy it"), "got %s\n", bufA); errno = 0xdeadbeef; - retA = strftime(bufA, 2, "copy", gmt_tm); + retA = p_strftime(bufA, 2, "copy", gmt_tm); ok(retA == 0, "expected 0, got %ld\n", retA); ok(!strcmp(bufA, "") || broken(!strcmp(bufA, "copy it")), "got %s\n", bufA); ok(errno==ERANGE || errno==0xdeadbeef, "errno = %d\n", errno); errno = 0xdeadbeef; - retA = strftime(bufA, 256, "a%e", gmt_tm); + retA = p_strftime(bufA, 256, "a%e", gmt_tm); ok(retA==0 || broken(retA==1), "expected 0, got %ld\n", retA); ok(!strcmp(bufA, "") || broken(!strcmp(bufA, "a")), "got %s\n", bufA); ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); if(0) { /* crashes on Win2k */ errno = 0xdeadbeef; - retA = strftime(bufA, 256, "%c", NULL); + retA = p_strftime(bufA, 256, "%c", NULL); ok(retA == 0, "expected 0, got %ld\n", retA); ok(!strcmp(bufA, ""), "got %s\n", bufA); ok(errno == EINVAL, "errno = %d\n", errno); } - retA = strftime(bufA, 256, "e%#%e", gmt_tm); + retA = p_strftime(bufA, 256, "e%#%e", gmt_tm); ok(retA == 3, "expected 3, got %ld\n", retA); ok(!strcmp(bufA, "e%e"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%c", gmt_tm); + retA = p_strftime(bufA, 256, "%c", gmt_tm); ok(retA == 17, "expected 17, got %ld\n", retA); ok(strcmp(bufA, expected) == 0, "expected %s, got %s\n", expected, bufA); - retW = wcsftime(bufW, 256, cW, gmt_tm); + retW = p_wcsftime(bufW, 256, cW, gmt_tm); ok(retW == 17, "expected 17, got %ld\n", retW); ok(retA == retW, "expected %ld, got %ld\n", retA, retW); buf[0] = 0; @@ -657,91 +707,91 @@ static void test_strftime(void) buf[retA] = 0; ok(strcmp(bufA, buf) == 0, "expected %s, got %s\n", bufA, buf); - retA = strftime(bufA, 256, "%x", gmt_tm); + retA = p_strftime(bufA, 256, "%x", gmt_tm); ok(retA == 8, "expected 8, got %ld\n", retA); ok(!strcmp(bufA, "01/01/70"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%X", gmt_tm); + retA = p_strftime(bufA, 256, "%X", gmt_tm); ok(retA == 8, "expected 8, got %ld\n", retA); ok(!strcmp(bufA, "00:00:00"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%a", gmt_tm); + retA = p_strftime(bufA, 256, "%a", gmt_tm); ok(retA == 3, "expected 3, got %ld\n", retA); ok(!strcmp(bufA, "Thu"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%A", gmt_tm); + retA = p_strftime(bufA, 256, "%A", gmt_tm); ok(retA == 8, "expected 8, got %ld\n", retA); ok(!strcmp(bufA, "Thursday"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%b", gmt_tm); + retA = p_strftime(bufA, 256, "%b", gmt_tm); ok(retA == 3, "expected 3, got %ld\n", retA); ok(!strcmp(bufA, "Jan"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%B", gmt_tm); + retA = p_strftime(bufA, 256, "%B", gmt_tm); ok(retA == 7, "expected 7, got %ld\n", retA); ok(!strcmp(bufA, "January"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%d", gmt_tm); + retA = p_strftime(bufA, 256, "%d", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "01"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%#d", gmt_tm); + retA = p_strftime(bufA, 256, "%#d", gmt_tm); ok(retA == 1, "expected 1, got %ld\n", retA); ok(!strcmp(bufA, "1"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%H", gmt_tm); + retA = p_strftime(bufA, 256, "%H", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "00"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%I", gmt_tm); + retA = p_strftime(bufA, 256, "%I", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "12"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%j", gmt_tm); + retA = p_strftime(bufA, 256, "%j", gmt_tm); ok(retA == 3, "expected 3, got %ld\n", retA); ok(!strcmp(bufA, "001"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%m", gmt_tm); + retA = p_strftime(bufA, 256, "%m", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "01"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%#M", gmt_tm); + retA = p_strftime(bufA, 256, "%#M", gmt_tm); ok(retA == 1, "expected 1, got %ld\n", retA); ok(!strcmp(bufA, "0"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%p", gmt_tm); + retA = p_strftime(bufA, 256, "%p", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "AM"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%U", gmt_tm); + retA = p_strftime(bufA, 256, "%U", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "00"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%W", gmt_tm); + retA = p_strftime(bufA, 256, "%W", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "00"), "got %s\n", bufA); gmt_tm->tm_wday = 0; - retA = strftime(bufA, 256, "%U", gmt_tm); + retA = p_strftime(bufA, 256, "%U", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "01"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%W", gmt_tm); + retA = p_strftime(bufA, 256, "%W", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "00"), "got %s\n", bufA); gmt_tm->tm_yday = 365; - retA = strftime(bufA, 256, "%U", gmt_tm); + retA = p_strftime(bufA, 256, "%U", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "53"), "got %s\n", bufA); - retA = strftime(bufA, 256, "%W", gmt_tm); + retA = p_strftime(bufA, 256, "%W", gmt_tm); ok(retA == 2, "expected 2, got %ld\n", retA); ok(!strcmp(bufA, "52"), "got %s\n", bufA); gmt_tm->tm_mon = 1; gmt_tm->tm_mday = 30; - retA = strftime(bufA, 256, "%c", gmt_tm); + retA = p_strftime(bufA, 256, "%c", gmt_tm); todo_wine { ok(retA == 17, "expected 17, got %ld\n", retA); ok(!strcmp(bufA, "02/30/70 00:00:00"), "got %s\n", bufA); @@ -753,7 +803,7 @@ static void test_strftime(void) } /* test with multibyte character */ - retA = strftime(bufA, 256, "\x82%c", gmt_tm); + retA = p_strftime(bufA, 256, "\x82%c", gmt_tm); ok(retA == 3, "expected 3, got %ld\n", retA); ok(!strcmp(bufA, "\x82%c"), "got %s\n", bufA); } @@ -829,7 +879,7 @@ static void test__tzset(void) int ret; if(!p___p__daylight || !p___p__timezone || !p___p__dstbias) { - win_skip("__p__daylight, __p__timezone or __p__dstbias is not available\n"); + skip("__p__daylight, __p__timezone or __p__dstbias is not available\n"); return; } @@ -873,23 +923,6 @@ static void test__tzset(void) _putenv(TZ_env); } -static void test_clock(void) -{ - static const int THRESH = 100; - FILETIME start, cur; - int c, expect; - BOOL ret; - - ret = GetProcessTimes(GetCurrentProcess(), &start, &cur, &cur, &cur); - ok(ret, "GetProcessTimes failed with error: %d\n", GetLastError()); - GetSystemTimeAsFileTime(&cur); - expect = (((LONGLONG)cur.dwHighDateTime<<32)+cur.dwLowDateTime - - ((LONGLONG)start.dwHighDateTime<<32)-start.dwLowDateTime) / 10000; - - c = clock(); - ok(abs(c-expect) < THRESH, "clock() = %d, expected %d\n", c, expect); -} - START_TEST(time) { init(); @@ -908,5 +941,4 @@ START_TEST(time) test_localtime64_s(); test_daylight(); test_asctime(); - test_clock(); }
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSSIP32] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e80dec128eb069c11e741…
commit e80dec128eb069c11e741be684c70c43bf06e877 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:06:19 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:06:19 2019 +0100 [MSSIP32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/mssip32/main.c | 2 -- media/doc/README.WINE | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dll/win32/mssip32/main.c b/dll/win32/mssip32/main.c index a72c34662fd..abefdd0b1b2 100644 --- a/dll/win32/mssip32/main.c +++ b/dll/win32/mssip32/main.c @@ -16,8 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include "windef.h" diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 94f0d1a1897..fa02e2c6b17 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -122,7 +122,7 @@ dll/win32/msnet32 # Synced to WineStaging-4.18 dll/win32/mspatcha # Forked at WineStaging-3.3 dll/win32/msrle32 # Synced to WineStaging-4.18 dll/win32/mssign32 # Synced to WineStaging-4.18 -dll/win32/mssip32 # Synced to WineStaging-3.3 +dll/win32/mssip32 # Synced to WineStaging-4.18 dll/win32/mstask # Synced to WineStaging-3.3 dll/win32/msvcrt20 # Out of sync dll/win32/msvcrt40 # Out of sync
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSSIGN32] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f3c326b2250409143fd1e…
commit f3c326b2250409143fd1e75b2939cf881404be49 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:05:55 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:05:55 2019 +0100 [MSSIGN32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/mssign32/mssign32.spec | 4 +- dll/win32/mssign32/mssign32_main.c | 21 +++++- dll/win32/mssign32/mssign32_private.h | 124 ++++++++++++++++++++++++++++++++++ media/doc/README.WINE | 2 +- 4 files changed, 146 insertions(+), 5 deletions(-) diff --git a/dll/win32/mssign32/mssign32.spec b/dll/win32/mssign32/mssign32.spec index 249b36d301e..43329f57ae9 100644 --- a/dll/win32/mssign32/mssign32.spec +++ b/dll/win32/mssign32/mssign32.spec @@ -22,9 +22,9 @@ @ stub SignerAddTimeStampResponse @ stub SignerAddTimeStampResponseEx @ stub SignerCreateTimeStampRequest -@ stub SignerFreeSignerContext +@ stdcall SignerFreeSignerContext(ptr) @ stub SignerSign -@ stub SignerSignEx +@ stdcall SignerSignEx(long ptr ptr ptr ptr wstr ptr ptr ptr) @ stub SignerTimeStamp @ stub SignerTimeStampEx @ stub SpcGetCertFromKey diff --git a/dll/win32/mssign32/mssign32_main.c b/dll/win32/mssign32/mssign32_main.c index e35488bad3e..da7551e6d1b 100644 --- a/dll/win32/mssign32/mssign32_main.c +++ b/dll/win32/mssign32/mssign32_main.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include "windef.h" @@ -27,6 +25,9 @@ #include "wincrypt.h" #include "wine/debug.h" +#include "wine/heap.h" + +#include "mssign32_private.h" WINE_DEFAULT_DEBUG_CHANNEL(mssign); @@ -72,3 +73,19 @@ void WINAPI PvkFreeCryptProv(HCRYPTPROV hProv, LPCWSTR pwszCapiProvider, DWORD d FIXME("%08lx %s %d %s stub\n", hProv, debugstr_w(pwszCapiProvider), dwProviderType, debugstr_w(pwszTmpContainer)); } + +HRESULT WINAPI SignerSignEx(DWORD flags, SIGNER_SUBJECT_INFO *subject_info, SIGNER_CERT *signer_cert, + SIGNER_SIGNATURE_INFO *signature_info, SIGNER_PROVIDER_INFO *provider_info, + const WCHAR *http_time_stamp, CRYPT_ATTRIBUTES *request, void *sip_data, + SIGNER_CONTEXT **signer_context) +{ + FIXME("%x %p %p %p %p %s %p %p %p stub\n", flags, subject_info, signer_cert, signature_info, provider_info, + wine_dbgstr_w(http_time_stamp), request, sip_data, signer_cert); + return E_NOTIMPL; +} + +HRESULT WINAPI SignerFreeSignerContext(SIGNER_CONTEXT *signer_context) +{ + heap_free(signer_context); + return S_OK; +} diff --git a/dll/win32/mssign32/mssign32_private.h b/dll/win32/mssign32/mssign32_private.h new file mode 100644 index 00000000000..a4e5d360a75 --- /dev/null +++ b/dll/win32/mssign32/mssign32_private.h @@ -0,0 +1,124 @@ +/* + * Copyright 2019 Gijs Vermeulen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windef.h" +#include "winbase.h" +#include "wincrypt.h" + +#define SPC_EXC_PE_PAGE_HASHES_FLAG 0x10 +#define SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG 0x20 +#define SPC_INC_PE_DEBUG_INFO_FLAG 0x40 +#define SPC_INC_PE_RESOURCES_FLAG 0x80 +#define SPC_INC_PE_PAGE_HASHES_FLAG 0x100 + +#define SIGNER_CERT_SPC_FILE 1 +#define SIGNER_CERT_STORE 2 +#define SIGNER_CERT_SPC_CHAIN 3 + +#define SIGNER_CERT_POLICY_STORE 0x1 +#define SIGNER_CERT_POLICY_CHAIN 0x2 +#define SIGNER_CERT_POLICY_CHAIN_NO_ROOT 0x8 + +#define SIGNER_NO_ATTR 0 +#define SIGNER_AUTHCODE_ATTR 1 + +typedef struct _SIGNER_CONTEXT { + DWORD cbSize; + DWORD cbBlob; + BYTE *pbBlob; +} SIGNER_CONTEXT, *PSIGNER_CONTEXT; + +typedef struct _SIGNER_FILE_INFO { + DWORD cbSize; + const WCHAR *pwszFileName; + HANDLE hFile; +} SIGNER_FILE_INFO, *PSIGNER_FILE_INFO; + +typedef struct _SIGNER_BLOB_INFO { + DWORD cbSize; + GUID *pGuidSubject; + DWORD cbBlob; + BYTE *pbBlob; + const WCHAR *pwszDisplayName; +} SIGNER_BLOB_INFO, *PSIGNER_BLOB_INFO; + +typedef struct _SIGNER_SUBJECT_INFO { + DWORD cbSize; + DWORD *pdwIndex; + DWORD dwSubjectChoice; + union { + SIGNER_FILE_INFO *pSignerFileInfo; + SIGNER_BLOB_INFO *pSignerBlobInfo; + }; +} SIGNER_SUBJECT_INFO, *PSIGNER_SUBJECT_INFO; + +typedef struct _SIGNER_CERT_STORE_INFO { + DWORD cbSize; + const CERT_CONTEXT *pSigningCert; + DWORD dwCertPolicy; + HCERTSTORE hCertStore; +} SIGNER_CERT_STORE_INFO, *PSIGNER_CERT_STORE_INFO; + +typedef struct _SIGNER_SPC_CHAIN_INFO { + DWORD cbSize; + const WCHAR *pwszSpcFile; + DWORD dwCertPolicy; + HCERTSTORE hCertStore; +} SIGNER_SPC_CHAIN_INFO, *PSIGNER_SPC_CHAIN_INFO; + +typedef struct _SIGNER_CERT { + DWORD cbSize; + DWORD dwCertChoice; + union { + const WCHAR *pwszSpcFile; + SIGNER_CERT_STORE_INFO *pCertStoreInfo; + SIGNER_SPC_CHAIN_INFO *pSpcChainInfo; + }; + HWND hwnd; +} SIGNER_CERT, *PSIGNER_CERT; + +typedef struct _SIGNER_ATTR_AUTHCODE { + DWORD cbSize; + BOOL fCommercial; + BOOL fIndividual; + const WCHAR *pwszName; + const WCHAR *pwszInfo; +} SIGNER_ATTR_AUTHCODE, *PSIGNER_ATTR_AUTHCODE; + +typedef struct _SIGNER_SIGNATURE_INFO { + DWORD cbSize; + ALG_ID algidHash; + DWORD dwAttrChoice; + union { + SIGNER_ATTR_AUTHCODE *pAttrAuthcode; + }; + CRYPT_ATTRIBUTES *psAuthenticated; + CRYPT_ATTRIBUTES *psUnauthenticated; +} SIGNER_SIGNATURE_INFO, *PSIGNER_SIGNATURE_INFO; + +typedef struct _SIGNER_PROVIDER_INFO { + DWORD cbSize; + const WCHAR *pwszProviderName; + DWORD dwProviderType; + DWORD dwKeySpec; + DWORD dwPvkChoice; + union { + WCHAR *pwszPvkFileName; + WCHAR *pwszKeyContainer; + }; +} SIGNER_PROVIDER_INFO, *PSIGNER_PROVIDER_INFO; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 054faffb38b..94f0d1a1897 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -121,7 +121,7 @@ dll/win32/msisys.ocx # Synced to WineStaging-4.18 dll/win32/msnet32 # Synced to WineStaging-4.18 dll/win32/mspatcha # Forked at WineStaging-3.3 dll/win32/msrle32 # Synced to WineStaging-4.18 -dll/win32/mssign32 # Synced to WineStaging-3.3 +dll/win32/mssign32 # Synced to WineStaging-4.18 dll/win32/mssip32 # Synced to WineStaging-3.3 dll/win32/mstask # Synced to WineStaging-3.3 dll/win32/msvcrt20 # Out of sync
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSRLE32] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ee39ccec369d664349e54…
commit ee39ccec369d664349e54c333787cae07f8e353c Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:04:59 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:04:59 2019 +0100 [MSRLE32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/msrle32/msrle32.c | 5 +++++ media/doc/README.WINE | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dll/win32/msrle32/msrle32.c b/dll/win32/msrle32/msrle32.c index 5bcfa86f978..5b17b25a0b4 100644 --- a/dll/win32/msrle32/msrle32.c +++ b/dll/win32/msrle32/msrle32.c @@ -1544,6 +1544,11 @@ static LRESULT CompressEnd(CodecInfo *pi) pi->pCurFrame = NULL; pi->nPrevFrame = -1; pi->bCompress = FALSE; + + if (pi->palette_map != NULL) { + LocalFree(pi->palette_map); + pi->palette_map = NULL; + } } return ICERR_OK; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 5f9bcc76777..054faffb38b 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -120,7 +120,7 @@ dll/win32/msisip # Synced to WineStaging-4.18 dll/win32/msisys.ocx # Synced to WineStaging-4.18 dll/win32/msnet32 # Synced to WineStaging-4.18 dll/win32/mspatcha # Forked at WineStaging-3.3 -dll/win32/msrle32 # Synced to WineStaging-4.0 +dll/win32/msrle32 # Synced to WineStaging-4.18 dll/win32/mssign32 # Synced to WineStaging-3.3 dll/win32/mssip32 # Synced to WineStaging-3.3 dll/win32/mstask # Synced to WineStaging-3.3
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSNET32] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7b0046072f37e70a0af06…
commit 7b0046072f37e70a0af0673b63469f537043a3c4 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:04:36 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:04:36 2019 +0100 [MSNET32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/msnet32/msnet_main.c | 2 -- media/doc/README.WINE | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dll/win32/msnet32/msnet_main.c b/dll/win32/msnet32/msnet_main.c index 1ffef5097b4..8303b8f1730 100644 --- a/dll/win32/msnet32/msnet_main.c +++ b/dll/win32/msnet32/msnet_main.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include "windef.h" diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 645033e2203..5f9bcc76777 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -118,7 +118,7 @@ dll/win32/msimg32 # Synced to WineStaging-3.3 dll/win32/msimtf # Synced to WineStaging-4.18 dll/win32/msisip # Synced to WineStaging-4.18 dll/win32/msisys.ocx # Synced to WineStaging-4.18 -dll/win32/msnet32 # Synced to WineStaging-2.9 +dll/win32/msnet32 # Synced to WineStaging-4.18 dll/win32/mspatcha # Forked at WineStaging-3.3 dll/win32/msrle32 # Synced to WineStaging-4.0 dll/win32/mssign32 # Synced to WineStaging-3.3
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSISYS.OCX] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1420b5b062e44af642c66…
commit 1420b5b062e44af642c66b243e850cc1a80c25dc Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:04:14 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:04:14 2019 +0100 [MSISYS.OCX] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/msisys.ocx/msisys.c | 2 -- media/doc/README.WINE | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dll/win32/msisys.ocx/msisys.c b/dll/win32/msisys.ocx/msisys.c index e4b0df02fba..b0aaded2a4d 100644 --- a/dll/win32/msisys.ocx/msisys.c +++ b/dll/win32/msisys.ocx/msisys.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include "windef.h" diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 0117d4ff940..645033e2203 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -117,7 +117,7 @@ dll/win32/msi # Synced to WineStaging-3.3 dll/win32/msimg32 # Synced to WineStaging-3.3 dll/win32/msimtf # Synced to WineStaging-4.18 dll/win32/msisip # Synced to WineStaging-4.18 -dll/win32/msisys.ocx # Synced to WineStaging-3.3 +dll/win32/msisys.ocx # Synced to WineStaging-4.18 dll/win32/msnet32 # Synced to WineStaging-2.9 dll/win32/mspatcha # Forked at WineStaging-3.3 dll/win32/msrle32 # Synced to WineStaging-4.0
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSISIP] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bc2a33a802a0f6fd018f4…
commit bc2a33a802a0f6fd018f42800c87c41223908795 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:03:52 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:03:52 2019 +0100 [MSISIP] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/msisip/main.c | 1 - media/doc/README.WINE | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dll/win32/msisip/main.c b/dll/win32/msisip/main.c index 882db3d9d84..aabea78ae62 100644 --- a/dll/win32/msisip/main.c +++ b/dll/win32/msisip/main.c @@ -16,7 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include <stdarg.h> #include "windef.h" #include "winbase.h" diff --git a/media/doc/README.WINE b/media/doc/README.WINE index a09da406e9d..0117d4ff940 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -116,7 +116,7 @@ dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55 dll/win32/msi # Synced to WineStaging-3.3 dll/win32/msimg32 # Synced to WineStaging-3.3 dll/win32/msimtf # Synced to WineStaging-4.18 -dll/win32/msisip # Synced to WineStaging-3.3 +dll/win32/msisip # Synced to WineStaging-4.18 dll/win32/msisys.ocx # Synced to WineStaging-3.3 dll/win32/msnet32 # Synced to WineStaging-2.9 dll/win32/mspatcha # Forked at WineStaging-3.3
5 years, 1 month
1
0
0
0
[reactos] 01/01: [MSIMTF] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=38a119a72e025646b97b2…
commit 38a119a72e025646b97b22da72fd1a0989c2d5f6 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Nov 10 14:03:20 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Nov 10 14:03:20 2019 +0100 [MSIMTF] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/msimtf/activeimmapp.c | 4 ---- dll/win32/msimtf/main.c | 2 -- dll/win32/msimtf/precomp.h | 2 -- media/doc/README.WINE | 2 +- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/dll/win32/msimtf/activeimmapp.c b/dll/win32/msimtf/activeimmapp.c index fb5ef40be55..2d53feaae97 100644 --- a/dll/win32/msimtf/activeimmapp.c +++ b/dll/win32/msimtf/activeimmapp.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #define COBJMACROS @@ -34,8 +32,6 @@ #include "dimm.h" #include "imm.h" -#include "wine/unicode.h" - #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(msimtf); diff --git a/dll/win32/msimtf/main.c b/dll/win32/msimtf/main.c index 78c26cb10ee..76ad6548f4b 100644 --- a/dll/win32/msimtf/main.c +++ b/dll/win32/msimtf/main.c @@ -16,8 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include <stdio.h> diff --git a/dll/win32/msimtf/precomp.h b/dll/win32/msimtf/precomp.h index 6daa8c5a88b..1d8c9510c04 100644 --- a/dll/win32/msimtf/precomp.h +++ b/dll/win32/msimtf/precomp.h @@ -2,8 +2,6 @@ #ifndef _MSIMTF_PCH_ #define _MSIMTF_PCH_ -#include <wine/config.h> - #include <stdarg.h> #define WIN32_NO_STATUS diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 2cda2743636..a09da406e9d 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -115,7 +115,7 @@ dll/win32/mshtml # Synced to WineStaging-1.7.55 dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55 dll/win32/msi # Synced to WineStaging-3.3 dll/win32/msimg32 # Synced to WineStaging-3.3 -dll/win32/msimtf # Synced to WineStaging-3.3 +dll/win32/msimtf # Synced to WineStaging-4.18 dll/win32/msisip # Synced to WineStaging-3.3 dll/win32/msisys.ocx # Synced to WineStaging-3.3 dll/win32/msnet32 # Synced to WineStaging-2.9
5 years, 1 month
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
33
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
Results per page:
10
25
50
100
200