winehq.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
2025
February
January
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
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2019
----- 2025 -----
February 2025
January 2025
----- 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
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
865 discussions
Start a n
N
ew thread
Jacek Caban : services: Support delayed autostart services.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: d8dec0b3f9da2daad55efd1a9f8fa99711b15635 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d8dec0b3f9da2daad55efd1a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 20 17:58:45 2019 +0200 services: Support delayed autostart services. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/services/services.c | 116 ++++++++++++++++++++++++++++++++++++++++++- programs/services/services.h | 1 + 2 files changed, 116 insertions(+), 1 deletion(-) diff --git a/programs/services/services.c b/programs/services/services.c index 7ca249c..ff5c4cb 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -29,6 +29,7 @@ #include <userenv.h> #include "wine/debug.h" +#include "wine/heap.h" #include "svcctl.h" #include "services.h" @@ -42,6 +43,7 @@ struct scmdatabase *active_database; DWORD service_pipe_timeout = 10000; DWORD service_kill_timeout = 60000; static DWORD default_preshutdown_timeout = 180000; +static DWORD autostart_delay = 120000; static void *environment = NULL; static HKEY service_current_key = NULL; @@ -68,6 +70,7 @@ static const WCHAR SZ_TAG[] = {'T','a','g',0}; static const WCHAR SZ_DESCRIPTION[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; static const WCHAR SZ_PRESHUTDOWN[] = {'P','r','e','s','h','u','t','d','o','w','n','T','i','m','e','o','u','t',0}; static const WCHAR SZ_WOW64[] = {'W','O','W','6','4',0}; +static const WCHAR SZ_DELAYED_AUTOSTART[] = {'D','e','l','a','y','e','d','A','u','t','o','S','t','a','r','t',0}; static DWORD process_create(const WCHAR *name, struct process_entry **entry) { @@ -186,6 +189,8 @@ static DWORD load_service_config(HKEY hKey, struct service_entry *entry) if (load_reg_dword(hKey, SZ_WOW64, &value) == 0 && value == 1) entry->is_wow64 = TRUE; + if (load_reg_dword(hKey, SZ_DELAYED_AUTOSTART, &value) == 0 && value == 1) + entry->delayed_autostart = TRUE; WINE_TRACE("Image path = %s\n", wine_dbgstr_w(entry->config.lpBinaryPathName) ); WINE_TRACE("Group = %s\n", wine_dbgstr_w(entry->config.lpLoadOrderGroup) ); @@ -329,11 +334,101 @@ static int __cdecl compare_tags(const void *a, const void *b) return service_a->config.dwTagId - service_b->config.dwTagId; } +static PTP_CLEANUP_GROUP delayed_autostart_cleanup; + +struct delayed_autostart_params +{ + unsigned int count; + struct service_entry **services; +}; + +static void CALLBACK delayed_autostart_cancel_callback(void *object, void *userdata) +{ + struct delayed_autostart_params *params = object; + while(params->count--) + release_service(params->services[params->count]); + heap_free(params->services); + heap_free(params); +} + +static void CALLBACK delayed_autostart_callback(TP_CALLBACK_INSTANCE *instance, void *context, + TP_WAIT *wait, TP_WAIT_RESULT result) +{ + struct delayed_autostart_params *params = context; + struct service_entry *service; + unsigned int i; + DWORD err; + + if (result == WAIT_TIMEOUT) + { + scmdatabase_lock_startup(active_database, INFINITE); + + for (i = 0; i < params->count; i++) + { + service = params->services[i]; + if (service->status.dwCurrentState == SERVICE_STOPPED) + { + TRACE("Starting deleyed auto-start service %s\n", debugstr_w(service->name)); + err = service_start(service, 0, NULL); + if (err != ERROR_SUCCESS) + FIXME("Delayed auto-start service %s failed to start: %d\n", + wine_dbgstr_w(service->name), err); + } + release_service(service); + } + + scmdatabase_unlock_startup(active_database); + } + + heap_free(params->services); + heap_free(params); + CloseThreadpoolWait(wait); +} + +static BOOL schedule_delayed_autostart(struct service_entry **services, unsigned int count) +{ + struct delayed_autostart_params *params; + TP_CALLBACK_ENVIRON environment; + LARGE_INTEGER timestamp; + TP_WAIT *wait; + FILETIME ft; + + if (!(delayed_autostart_cleanup = CreateThreadpoolCleanupGroup())) + { + ERR("CreateThreadpoolCleanupGroup failed with error %u\n", GetLastError()); + return FALSE; + } + + if (!(params = heap_alloc(sizeof(*params)))) return FALSE; + params->count = count; + params->services = services; + + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.CleanupGroup = delayed_autostart_cleanup; + environment.CleanupGroupCancelCallback = delayed_autostart_cancel_callback; + + timestamp.QuadPart = (ULONGLONG)autostart_delay * -10000; + ft.dwLowDateTime = timestamp.u.LowPart; + ft.dwHighDateTime = timestamp.u.HighPart; + + if (!(wait = CreateThreadpoolWait(delayed_autostart_callback, params, &environment))) + { + ERR("CreateThreadpoolWait failed: %u\n", GetLastError()); + heap_free(params); + return FALSE; + } + + SetThreadpoolWait(wait, params, &ft); + return TRUE; +} + static void scmdatabase_autostart_services(struct scmdatabase *db) { struct service_entry **services_list; unsigned int i = 0; unsigned int size = 32; + unsigned int delayed_cnt = 0; struct service_entry *service; services_list = HeapAlloc(GetProcessHeap(), 0, size * sizeof(services_list[0])); @@ -370,6 +465,12 @@ static void scmdatabase_autostart_services(struct scmdatabase *db) { DWORD err; service = services_list[i]; + if (service->delayed_autostart) + { + TRACE("delayed starting %s\n", wine_dbgstr_w(service->name)); + services_list[delayed_cnt++] = service; + continue; + } err = service_start(service, 0, NULL); if (err != ERROR_SUCCESS) WINE_FIXME("Auto-start service %s failed to start: %d\n", @@ -378,7 +479,9 @@ static void scmdatabase_autostart_services(struct scmdatabase *db) } scmdatabase_unlock_startup(db); - HeapFree(GetProcessHeap(), 0, services_list); + + if (!delayed_cnt || !schedule_delayed_autostart(services_list, delayed_cnt)) + heap_free(services_list); } static void scmdatabase_wait_terminate(struct scmdatabase *db) @@ -1115,6 +1218,8 @@ static void load_registry_parameters(void) {'S','e','r','v','i','c','e','s','P','i','p','e','T','i','m','e','o','u','t',0}; static const WCHAR killtimeoutW[] = {'W','a','i','t','T','o','K','i','l','l','S','e','r','v','i','c','e','T','i','m','e','o','u','t',0}; + static const WCHAR autostartdelayW[] = + {'A','u','t','o','S','t','a','r','t','D','e','l','a','y',0}; HKEY key; WCHAR buffer[64]; DWORD type, count, val; @@ -1131,6 +1236,10 @@ static void load_registry_parameters(void) type == REG_SZ && (val = wcstol( buffer, NULL, 10 ))) service_kill_timeout = val; + count = sizeof(val); + if (!RegQueryValueExW( key, autostartdelayW, NULL, &type, (BYTE *)&val, &count ) && type == REG_DWORD) + autostart_delay = val; + RegCloseKey( key ); } @@ -1164,6 +1273,11 @@ int main(int argc, char *argv[]) SetEvent(started_event); WaitForSingleObject(exit_event, INFINITE); scmdatabase_wait_terminate(active_database); + if (delayed_autostart_cleanup) + { + CloseThreadpoolCleanupGroupMembers(delayed_autostart_cleanup, TRUE, NULL); + CloseThreadpoolCleanupGroup(delayed_autostart_cleanup); + } RPC_Stop(); } scmdatabase_destroy(active_database); diff --git a/programs/services/services.h b/programs/services/services.h index e1481d9..0d400e5 100644 --- a/programs/services/services.h +++ b/programs/services/services.h @@ -63,6 +63,7 @@ struct service_entry BOOL force_shutdown; BOOL marked_for_delete; BOOL is_wow64; + BOOL delayed_autostart; struct list handles; };
1
0
0
0
Rémi Bernon : ntdll: Pass the alignment parameter down to map_view instead of mask.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: 4c750a35c3c087d1fa9b0882fb0bdd6804296473 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4c750a35c3c087d1fa9b0882…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 20 16:05:39 2019 +0200 ntdll: Pass the alignment parameter down to map_view instead of mask. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/virtual.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 380c638..6196a4e 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1082,11 +1082,12 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot ) * Create a view and mmap the corresponding memory area. * The csVirtual section must be held by caller. */ -static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, size_t mask, +static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, size_t alignment, int top_down, unsigned int vprot, size_t zero_bits ) { void *ptr; NTSTATUS status; + size_t mask = get_mask( alignment ); if (base) { @@ -1287,7 +1288,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot if (addr != low_64k) { if (addr != (void *)-1) munmap( addr, dosmem_size - 0x10000 ); - return map_view( view, NULL, dosmem_size, 0xffff, 0, vprot, 0 ); + return map_view( view, NULL, dosmem_size, 0, FALSE, vprot, 0 ); } } @@ -1390,11 +1391,11 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, SIZE_T z server_enter_uninterrupted_section( &csVirtual, &sigset ); if (base >= (char *)address_space_start) /* make sure the DOS area remains free */ - status = map_view( &view, base, total_size, get_mask( 0 ), FALSE, SEC_IMAGE | SEC_FILE | + status = map_view( &view, base, total_size, 0, FALSE, SEC_IMAGE | SEC_FILE | VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, zero_bits ); if (status != STATUS_SUCCESS) - status = map_view( &view, NULL, total_size, get_mask( 0 ), FALSE, SEC_IMAGE | SEC_FILE | + status = map_view( &view, NULL, total_size, 0, FALSE, SEC_IMAGE | SEC_FILE | VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, zero_bits ); if (status != STATUS_SUCCESS) goto error; @@ -1717,7 +1718,7 @@ NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, S get_vprot_flags( protect, &vprot, sec_flags & SEC_IMAGE ); vprot |= sec_flags; if (!(sec_flags & SEC_RESERVE)) vprot |= VPROT_COMMITTED; - res = map_view( &view, *addr_ptr, size, get_mask( 0 ), FALSE, vprot, zero_bits ); + res = map_view( &view, *addr_ptr, size, 0, FALSE, vprot, zero_bits ); if (res) { server_leave_uninterrupted_section( &csVirtual, &sigset ); @@ -1949,7 +1950,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SI server_enter_uninterrupted_section( &csVirtual, &sigset ); - if ((status = map_view( &view, NULL, size + extra_size, 0xffff, 0, + if ((status = map_view( &view, NULL, size + extra_size, 0, FALSE, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, 0 )) != STATUS_SUCCESS) goto done; @@ -2551,7 +2552,6 @@ NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr, void *base; unsigned int vprot; SIZE_T size = *size_ptr; - SIZE_T mask = get_mask( alignment ); NTSTATUS status = STATUS_SUCCESS; BOOL is_dos_memory = FALSE; struct file_view *view; @@ -2564,7 +2564,7 @@ NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr, if (*ret) { if (type & MEM_RESERVE) /* Round down to 64k boundary */ - base = ROUND_ADDR( *ret, mask ); + base = ROUND_ADDR( *ret, get_mask( alignment ) ); else base = ROUND_ADDR( *ret, page_mask ); size = (((UINT_PTR)*ret + size + page_mask) & ~page_mask) - (UINT_PTR)base; @@ -2608,7 +2608,7 @@ NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr, if (vprot & VPROT_WRITECOPY) status = STATUS_INVALID_PAGE_PROTECTION; else if (is_dos_memory) status = allocate_dos_memory( &view, vprot ); - else status = map_view( &view, base, size, mask, type & MEM_TOP_DOWN, vprot, zero_bits ); + else status = map_view( &view, base, size, alignment, type & MEM_TOP_DOWN, vprot, zero_bits ); if (status == STATUS_SUCCESS) base = view->base; }
1
0
0
0
Rémi Bernon : ntdll: Clarify NtMapViewOfSection zero_bits parameter semantics.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: be48a56e700d47f2221d983a37ef70228508c11b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=be48a56e700d47f2221d983a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 20 16:05:38 2019 +0200 ntdll: Clarify NtMapViewOfSection zero_bits parameter semantics. See 00451d5edf9a13fd8f414a0d06869e38cf66b754. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/virtual.c | 2 -- dlls/ntdll/virtual.c | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index fce4049..bb110f1 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -367,7 +367,6 @@ static void test_NtMapViewOfSection(void) } else { - todo_wine ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, "NtMapViewOfSection returned %08x\n", status); if (status == STATUS_SUCCESS) @@ -423,7 +422,6 @@ static void test_NtMapViewOfSection(void) offset.QuadPart = 0; zero_bits = get_zero_bits((UINT_PTR)ptr2); status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE); - todo_wine ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08x\n", status); if (sizeof(void *) == sizeof(int) && (!pIsWow64Process || diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 5c12d87..380c638 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -409,12 +409,12 @@ static struct file_view *VIRTUAL_FindView( const void *addr, size_t size ) /*********************************************************************** * get_mask */ -static inline UINT_PTR get_mask( ULONG zero_bits ) +static inline UINT_PTR get_mask( ULONG alignment ) { - if (!zero_bits) return 0xffff; /* allocations are aligned to 64K by default */ - if (zero_bits < page_shift) zero_bits = page_shift; - if (zero_bits > 21) return 0; - return (1 << zero_bits) - 1; + if (!alignment) return 0xffff; /* allocations are aligned to 64K by default */ + if (alignment < page_shift) alignment = page_shift; + if (alignment > 21) return 0; + return (1 << alignment) - 1; } @@ -1360,7 +1360,7 @@ static NTSTATUS map_pe_header( void *ptr, size_t size, int fd, BOOL *removable ) * * Map an executable (PE format) image into memory. */ -static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, SIZE_T mask, +static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, SIZE_T zero_bits, pe_image_info_t *image_info, int shared_fd, BOOL removable, PVOID *addr_ptr ) { IMAGE_DOS_HEADER *dos; @@ -1390,12 +1390,12 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, SIZE_T m server_enter_uninterrupted_section( &csVirtual, &sigset ); if (base >= (char *)address_space_start) /* make sure the DOS area remains free */ - status = map_view( &view, base, total_size, mask, FALSE, SEC_IMAGE | SEC_FILE | - VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, 0 ); + status = map_view( &view, base, total_size, get_mask( 0 ), FALSE, SEC_IMAGE | SEC_FILE | + VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, zero_bits ); if (status != STATUS_SUCCESS) - status = map_view( &view, NULL, total_size, mask, FALSE, SEC_IMAGE | SEC_FILE | - VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, 0 ); + status = map_view( &view, NULL, total_size, get_mask( 0 ), FALSE, SEC_IMAGE | SEC_FILE | + VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, zero_bits ); if (status != STATUS_SUCCESS) goto error; @@ -1617,7 +1617,7 @@ NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, S NTSTATUS res; mem_size_t full_size; ACCESS_MASK access; - SIZE_T size, mask = get_mask( zero_bits ); + SIZE_T size; int unix_handle = -1, needs_close; unsigned int vprot, sec_flags; struct file_view *view; @@ -1672,14 +1672,15 @@ NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, S if ((res = server_get_unix_fd( shared_file, FILE_READ_DATA|FILE_WRITE_DATA, &shared_fd, &shared_needs_close, NULL, NULL ))) goto done; - res = map_image( handle, access, unix_handle, mask, image_info, + res = map_image( handle, access, unix_handle, zero_bits, image_info, shared_fd, needs_close, addr_ptr ); if (shared_needs_close) close( shared_fd ); close_handle( shared_file ); } else { - res = map_image( handle, access, unix_handle, mask, image_info, -1, needs_close, addr_ptr ); + res = map_image( handle, access, unix_handle, zero_bits, image_info, + -1, needs_close, addr_ptr ); } if (needs_close) close( unix_handle ); if (res >= 0) *size_ptr = image_info->map_size; @@ -1716,7 +1717,7 @@ NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, S get_vprot_flags( protect, &vprot, sec_flags & SEC_IMAGE ); vprot |= sec_flags; if (!(sec_flags & SEC_RESERVE)) vprot |= VPROT_COMMITTED; - res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot, 0 ); + res = map_view( &view, *addr_ptr, size, get_mask( 0 ), FALSE, vprot, zero_bits ); if (res) { server_leave_uninterrupted_section( &csVirtual, &sigset ); @@ -3136,7 +3137,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect ) { NTSTATUS res; - SIZE_T mask = get_mask( zero_bits ); + SIZE_T mask = get_mask( 0 ); pe_image_info_t image_info; LARGE_INTEGER offset; @@ -3146,8 +3147,17 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p handle, process, *addr_ptr, offset.u.HighPart, offset.u.LowPart, *size_ptr, protect ); /* Check parameters */ + if (zero_bits > 21 && zero_bits < 32) + return STATUS_INVALID_PARAMETER_4; + if (!is_win64 && !is_wow64 && zero_bits >= 32) + return STATUS_INVALID_PARAMETER_4; - if ((*addr_ptr && zero_bits) || !mask) + /* If both addr_ptr and zero_bits are passed, they have match */ + if (*addr_ptr && zero_bits && zero_bits < 32 && + (((UINT_PTR)*addr_ptr) >> (32 - zero_bits))) + return STATUS_INVALID_PARAMETER_4; + if (*addr_ptr && zero_bits >= 32 && + (((UINT_PTR)*addr_ptr) & ~zero_bits)) return STATUS_INVALID_PARAMETER_4; #ifndef _WIN64
1
0
0
0
Rémi Bernon : ntdll/tests: Add more NtMapViewOfSection tests with zero_bits.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: bec9a63f7ac7683305a3401fe005f2a6ef10db6a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bec9a63f7ac7683305a3401f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 20 16:05:37 2019 +0200 ntdll/tests: Add more NtMapViewOfSection tests with zero_bits. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/virtual.c | 67 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 5a2effd..fce4049 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -299,25 +299,88 @@ static void test_NtMapViewOfSection(void) ok(result == sizeof(buffer), "ReadProcessMemory didn't read all data (%lx)\n", result); ok(!memcmp(buffer, data, sizeof(buffer)), "Wrong data read\n"); + /* 1 zero bits should zero 63-31 upper bits */ ptr2 = NULL; size = 0; + zero_bits = 1; offset.QuadPart = 0; - status = NtMapViewOfSection(mapping, process, &ptr2, 1, 0, &offset, &size, 1, 0, PAGE_READWRITE); + status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE); ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, "NtMapViewOfSection returned %08x\n", status); if (status == STATUS_SUCCESS) { + todo_wine_if((UINT_PTR)ptr2 >> (32 - zero_bits)) + ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0, + "NtMapViewOfSection returned address: %p\n", ptr2); + status = NtUnmapViewOfSection(process, ptr2); ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status); } - /* 22 zero bits isn't acceptable */ + for (zero_bits = 2; zero_bits <= 20; zero_bits++) + { + ptr2 = NULL; + size = 0; + offset.QuadPart = 0; + status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE); + ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, + "NtMapViewOfSection with %d zero_bits returned %08x\n", zero_bits, status); + if (status == STATUS_SUCCESS) + { + todo_wine_if((UINT_PTR)ptr2 >> (32 - zero_bits)) + ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0, + "NtMapViewOfSection with %d zero_bits returned address %p\n", zero_bits, ptr2); + + status = NtUnmapViewOfSection(process, ptr2); + ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status); + } + } + + /* 21 zero bits never succeeds */ + ptr2 = NULL; + size = 0; + offset.QuadPart = 0; + status = NtMapViewOfSection(mapping, process, &ptr2, 21, 0, &offset, &size, 1, 0, PAGE_READWRITE); + todo_wine + ok(status == STATUS_NO_MEMORY || status == STATUS_INVALID_PARAMETER, + "NtMapViewOfSection returned %08x\n", status); + + /* 22 zero bits is invalid */ ptr2 = NULL; size = 0; + offset.QuadPart = 0; status = NtMapViewOfSection(mapping, process, &ptr2, 22, 0, &offset, &size, 1, 0, PAGE_READWRITE); ok(status == STATUS_INVALID_PARAMETER_4 || status == STATUS_INVALID_PARAMETER, "NtMapViewOfSection returned %08x\n", status); + /* zero bits > 31 should be considered as bitmask on 64bit and WoW64 */ + ptr2 = NULL; + size = 0; + zero_bits = 0x1fffffff; + offset.QuadPart = 0; + status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE); + + if (sizeof(void *) == sizeof(int) && (!pIsWow64Process || + !pIsWow64Process(NtCurrentProcess(), &is_wow64) || !is_wow64)) + { + ok(status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %08x\n", status); + } + else + { + todo_wine + ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, + "NtMapViewOfSection returned %08x\n", status); + if (status == STATUS_SUCCESS) + { + todo_wine_if((UINT_PTR)ptr2 & ~zero_bits) + ok(((UINT_PTR)ptr2 & ~zero_bits) == 0, + "NtMapViewOfSection returned address %p\n", ptr2); + + status = NtUnmapViewOfSection(process, ptr2); + ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status); + } + } + /* mapping at the same page conflicts */ ptr2 = ptr; size = 0;
1
0
0
0
Rémi Bernon : ntdll/tests: Move NtMapViewOfSection tests from kernel32/tests.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: d1b7e01e5e1697e10d3530bdf4124c2e40172cee URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d1b7e01e5e1697e10d3530bd…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 20 16:05:36 2019 +0200 ntdll/tests: Move NtMapViewOfSection tests from kernel32/tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/virtual.c | 198 ------------------------------------ dlls/ntdll/tests/virtual.c | 227 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+), 198 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d1b7e01e5e1697e10d35…
1
0
0
0
Rémi Bernon : kernel32/tests: Fix some NtMapViewOfSection tests expectations, and add results for w1064v1809.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: d6bc3830e470eb90fbe697c95e1db4dda75b2359 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d6bc3830e470eb90fbe697c9…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 20 16:05:35 2019 +0200 kernel32/tests: Fix some NtMapViewOfSection tests expectations, and add results for w1064v1809. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/virtual.c | 67 ++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 0b71860..5f0fe55 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -73,6 +73,20 @@ static HANDLE create_target_process(const char *arg) return pi.hProcess; } +static UINT_PTR get_zero_bits(UINT_PTR p) +{ + UINT_PTR z = 0; + +#ifdef _WIN64 + if (p >= 0xffffffff) + return (~(UINT_PTR)0) >> get_zero_bits(p >> 32); +#endif + + if (p == 0) return 32; + while ((p >> (31 - z)) != 1) z++; + return z; +} + static void test_VirtualAllocEx(void) { const unsigned int alloc_size = 1<<15; @@ -1260,24 +1274,12 @@ static void test_NtMapViewOfSection(void) ok( result == sizeof(buffer), "ReadProcessMemory didn't read all data (%lx)\n", result ); ok( !memcmp( buffer, data, sizeof(buffer) ), "Wrong data read\n" ); - /* for some unknown reason NtMapViewOfSection fails with STATUS_NO_MEMORY when zero_bits != 0 ? */ ptr2 = NULL; size = 0; offset.QuadPart = 0; - status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - todo_wine - ok( status == STATUS_NO_MEMORY, "NtMapViewOfSection returned %x\n", status ); - if (status == STATUS_SUCCESS) - { - status = pNtUnmapViewOfSection( hProcess, ptr2 ); - ok( !status, "NtUnmapViewOfSection failed status %x\n", status ); - } - - ptr2 = NULL; - size = 0; - status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - todo_wine - ok( status == STATUS_NO_MEMORY, "NtMapViewOfSection returned %x\n", status ); + status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 1, 0, &offset, &size, 1, 0, PAGE_READWRITE ); + ok( status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, + "NtMapViewOfSection returned %x\n", status ); if (status == STATUS_SUCCESS) { status = pNtUnmapViewOfSection( hProcess, ptr2 ); @@ -1288,12 +1290,8 @@ static void test_NtMapViewOfSection(void) ptr2 = NULL; size = 0; status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 22, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status ); - if (status == STATUS_SUCCESS) - { - status = pNtUnmapViewOfSection( hProcess, ptr2 ); - ok( !status, "NtUnmapViewOfSection failed status %x\n", status ); - } + ok( status == STATUS_INVALID_PARAMETER_4 || status == STATUS_INVALID_PARAMETER, + "NtMapViewOfSection returned %x\n", status ); /* mapping at the same page conflicts */ ptr2 = ptr; @@ -1323,30 +1321,20 @@ static void test_NtMapViewOfSection(void) status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE ); ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status ); - /* zero_bits != 0 is not allowed when an address is set */ + /* when an address is passed, it has to satisfy the provided number of zero bits */ ptr2 = (char *)ptr + 0x1000; size = 0; offset.QuadPart = 0; - status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status ); + status = pNtMapViewOfSection( mapping, hProcess, &ptr2, get_zero_bits(((UINT_PTR)ptr2) >> 1), 0, &offset, &size, 1, 0, PAGE_READWRITE ); + ok( status == STATUS_INVALID_PARAMETER_4 || status == STATUS_INVALID_PARAMETER, + "NtMapViewOfSection returned %x\n", status ); ptr2 = (char *)ptr + 0x1000; size = 0; offset.QuadPart = 0; - status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status ); - - ptr2 = (char *)ptr + 0x1001; - size = 0; - offset.QuadPart = 0; - status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status ); - - ptr2 = (char *)ptr + 0x1000; - size = 0; - offset.QuadPart = 1; - status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status ); + status = pNtMapViewOfSection( mapping, hProcess, &ptr2, get_zero_bits((UINT_PTR)ptr2), 0, &offset, &size, 1, 0, PAGE_READWRITE ); + todo_wine + ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status ); if (sizeof(void *) == sizeof(int) && (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 ) || !is_wow64)) @@ -1409,7 +1397,8 @@ static void test_NtMapViewOfSection(void) status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE ); todo_wine - ok( status == STATUS_INVALID_PARAMETER_9, "NtMapViewOfSection returned %x\n", status ); + ok( status == STATUS_INVALID_PARAMETER_9 || status == STATUS_INVALID_PARAMETER, + "NtMapViewOfSection returned %x\n", status ); } status = pNtUnmapViewOfSection( hProcess, ptr );
1
0
0
0
Rémi Bernon : ntdll/tests: Cleanup NtAllocateVirtualMemory related tests.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: 3acc123ed30c8270a04fdaa282e04b92396c4d63 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3acc123ed30c8270a04fdaa2…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 20 16:05:34 2019 +0200 ntdll/tests: Cleanup NtAllocateVirtualMemory related tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/virtual.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 183a097..a547717 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -32,7 +32,7 @@ static NTSTATUS (WINAPI *pRtlCreateUserStack)(SIZE_T, SIZE_T, ULONG, SIZE_T, SIZ static NTSTATUS (WINAPI *pRtlFreeUserStack)(void *); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); -static void test_AllocateVirtualMemory(void) +static void test_NtAllocateVirtualMemory(void) { void *addr1, *addr2; NTSTATUS status; @@ -60,18 +60,12 @@ static void test_AllocateVirtualMemory(void) status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 12, &size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) - { - size = 0; - status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); - ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); - } /* 1 zero bits should zero 63-31 upper bits */ size = 0x1000; addr2 = NULL; zero_bits = 1; - status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 1, &size, + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY || broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */, @@ -250,6 +244,6 @@ START_TEST(virtual) trace("system page size %#x\n", sbi.PageSize); page_size = sbi.PageSize; - test_AllocateVirtualMemory(); + test_NtAllocateVirtualMemory(); test_RtlCreateUserStack(); }
1
0
0
0
Alistair Leslie-Hughes : mshtml: Implement IHTMLDocument2 put/get_bgColor.
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: 22ee077382b9c947639b7146f6fca8153fa7eabf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=22ee077382b9c947639b7146…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Thu Jun 20 00:07:41 2019 +0000 mshtml: Implement IHTMLDocument2 put/get_bgColor. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/htmldoc.c | 60 +++++++++++++++++++++++++++++++++++++++++++++---- dlls/mshtml/tests/dom.c | 34 ++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index af99d64..87ee8e6 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -678,15 +678,67 @@ static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v) { HTMLDocument *This = impl_from_IHTMLDocument2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + IHTMLElement *element = NULL; + IHTMLBodyElement *body; + HRESULT hr; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + hr = IHTMLDocument2_get_body(iface, &element); + if (FAILED(hr)) + { + ERR("Failed to get body (0x%08x)\n", hr); + return hr; + } + + if(!element) + { + FIXME("Empty body element.\n"); + return hr; + } + + hr = IHTMLElement_QueryInterface(element, &IID_IHTMLBodyElement, (void**)&body); + if (SUCCEEDED(hr)) + { + hr = IHTMLBodyElement_put_bgColor(body, v); + IHTMLBodyElement_Release(body); + } + IHTMLElement_Release(element); + + return hr; } static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p) { HTMLDocument *This = impl_from_IHTMLDocument2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + IHTMLElement *element = NULL; + IHTMLBodyElement *body; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, p); + + hr = IHTMLDocument2_get_body(iface, &element); + if (FAILED(hr)) + { + ERR("Failed to get body (0x%08x)\n", hr); + return hr; + } + + if(!element) + { + FIXME("Empty body element.\n"); + return hr; + } + + hr = IHTMLElement_QueryInterface(element, &IID_IHTMLBodyElement, (void**)&body); + if (SUCCEEDED(hr)) + { + hr = IHTMLBodyElement_get_bgColor(body, p); + IHTMLBodyElement_Release(body); + } + IHTMLElement_Release(element); + + return hr; } static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index e152c4f..f6eebbc 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -6708,7 +6708,7 @@ static void _set_body_scroll(unsigned line, IHTMLBodyElement *body, const char * _test_body_scroll(line, body, val); } -static void test_body_funs(IHTMLBodyElement *body) +static void test_body_funs(IHTMLBodyElement *body, IHTMLDocument2 *doc) { VARIANT vbg, vDefaultbg; HRESULT hres; @@ -6730,6 +6730,36 @@ static void test_body_funs(IHTMLBodyElement *body) ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg))); VariantClear(&vbg); + hres = IHTMLDocument2_get_bgColor(doc, &vbg); + ok(hres == S_OK, "get_bgColor failed: %08x\n", hres); + ok(V_VT(&vbg) == VT_BSTR, "V_VT(&vbg) != VT_BSTR\n"); + ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg))); + VariantClear(&vbg); + + /* Restore Original */ + hres = IHTMLBodyElement_put_bgColor(body, vDefaultbg); + ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); + VariantClear(&vDefaultbg); + + /* Set via IHTMLDocument2 */ + V_VT(&vbg) = VT_BSTR; + V_BSTR(&vbg) = a2bstr("red"); + hres = IHTMLDocument2_put_bgColor(doc, vbg); + ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); + VariantClear(&vbg); + + hres = IHTMLBodyElement_get_bgColor(body, &vbg); + ok(hres == S_OK, "get_bgColor failed: %08x\n", hres); + ok(V_VT(&vbg) == VT_BSTR, "V_VT(&vbg) != VT_BSTR\n"); + ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg))); + VariantClear(&vbg); + + hres = IHTMLDocument2_get_bgColor(doc, &vbg); + ok(hres == S_OK, "get_bgColor failed: %08x\n", hres); + ok(V_VT(&vbg) == VT_BSTR, "V_VT(&vbg) != VT_BSTR\n"); + ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg))); + VariantClear(&vbg); + /* Restore Original */ hres = IHTMLBodyElement_put_bgColor(body, vDefaultbg); ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); @@ -7161,7 +7191,7 @@ static void test_defaults(IHTMLDocument2 *doc) hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLBodyElement, (void**)&body); ok(hres == S_OK, "Could not get IHTMBodyElement: %08x\n", hres); test_default_body(body); - test_body_funs(body); + test_body_funs(body, doc); IHTMLBodyElement_Release(body); test_elem_set_outertext_fail(elem);
1
0
0
0
Jeff Smith : d3drm: Implement d3drm_frame3_Transform().
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: 328d002d848681a30a14bd32a5d7b3a9f80c4103 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=328d002d848681a30a14bd32…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Thu Jun 20 02:47:55 2019 +0430 d3drm: Implement d3drm_frame3_Transform(). Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3drm/frame.c | 35 +++++++++++++++++---- dlls/d3drm/tests/d3drm.c | 81 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 85 insertions(+), 31 deletions(-) diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index b6b4075..0561f6d 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -155,6 +155,17 @@ static void d3drm_matrix_set_rotation(struct d3drm_matrix *matrix, D3DVECTOR *ax matrix->_44 = 1.0f; } +static void d3drm_vector_transform_affine(D3DVECTOR *dst, const D3DVECTOR *v, const struct d3drm_matrix *m) +{ + D3DVECTOR tmp; + + tmp.u1.x = v->u1.x * m->_11 + v->u2.y * m->_21 + v->u3.z * m->_31 + m->_41; + tmp.u2.y = v->u1.x * m->_12 + v->u2.y * m->_22 + v->u3.z * m->_32 + m->_42; + tmp.u3.z = v->u1.x * m->_13 + v->u2.y * m->_23 + v->u3.z * m->_33 + m->_43; + + *dst = tmp; +} + static HRESULT WINAPI d3drm_frame_array_QueryInterface(IDirect3DRMFrameArray *iface, REFIID riid, void **out) { TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); @@ -2592,23 +2603,35 @@ static HRESULT WINAPI d3drm_frame1_SetZbufferMode(IDirect3DRMFrame *iface, D3DRM static HRESULT WINAPI d3drm_frame3_Transform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s) { - FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); - return E_NOTIMPL; + TRACE("iface %p, d %p, s %p.\n", iface, d, s); + + d3drm_vector_transform_affine(d, s, &frame->transform); + while ((frame = frame->parent)) + { + d3drm_vector_transform_affine(d, d, &frame->transform); + } + + return D3DRM_OK; } static HRESULT WINAPI d3drm_frame2_Transform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s) { - FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); - return E_NOTIMPL; + TRACE("iface %p, d %p, s %p.\n", iface, d, s); + + return d3drm_frame3_Transform(&frame->IDirect3DRMFrame3_iface, d, s); } static HRESULT WINAPI d3drm_frame1_Transform(IDirect3DRMFrame *iface, D3DVECTOR *d, D3DVECTOR *s) { - FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); - return E_NOTIMPL; + TRACE("iface %p, d %p, s %p.\n", iface, d, s); + + return d3drm_frame3_Transform(&frame->IDirect3DRMFrame3_iface, d, s); } static HRESULT WINAPI d3drm_frame2_AddMoveCallback2(IDirect3DRMFrame2 *iface, diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index e1ade86..6fe7dfa 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -86,21 +86,21 @@ static void expect_matrix_(unsigned int line, D3DRMMATRIX4D m, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); } -#define check_vector(a, b, c, d, e) check_vector_(__LINE__, a, b, c, d, e) -static void check_vector_(unsigned int line, const D3DVECTOR *v, float x, float y, float z, unsigned int ulps) +#define expect_vector(v, x, y, z, u) expect_vector_(__LINE__, v, x, y, z, u) +static void expect_vector_(unsigned int line, const D3DVECTOR *v, float x, float y, float z, unsigned int ulps) { - BOOL ret = compare_float(U1(v)->x, x, ulps) - && compare_float(U2(v)->y, y, ulps) - && compare_float(U3(v)->z, z, ulps); + BOOL equal = compare_float(U1(*v).x, x, ulps) + && compare_float(U2(*v).y, y, ulps) + && compare_float(U3(*v).z, z, ulps); - ok_(__FILE__, line)(ret, "Got unexpected vector {%.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e}.\n", - U1(v)->x, U2(v)->y, U3(v)->z, x, y, z); + ok_(__FILE__, line)(equal, "Got unexpected vector {%.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e}.\n", + U1(*v).x, U2(*v).y, U3(*v).z, x, y, z); } #define vector_eq(a, b) vector_eq_(__LINE__, a, b) static void vector_eq_(unsigned int line, const D3DVECTOR *left, const D3DVECTOR *right) { - check_vector_(line, left, U1(right)->x, U2(right)->y, U3(right)->z, 0); + expect_vector_(line, left, U1(*right).x, U2(*right).y, U3(*right).z, 0); } static D3DRMMATRIX4D identity = { @@ -125,6 +125,13 @@ static void frame_set_transform(IDirect3DRMFrame *frame, IDirect3DRMFrame_AddTransform(frame, D3DRMCOMBINE_REPLACE, matrix); } +static void set_vector(D3DVECTOR *v, float x, float y, float z) +{ + U1(*v).x = x; + U2(*v).y = y; + U3(*v).z = z; +} + static void matrix_sanitise(D3DRMMATRIX4D m) { unsigned int i, j; @@ -515,10 +522,10 @@ static void test_MeshBuilder(void) /* Check that Load method generated default normals */ hr = IDirect3DRMMeshBuilder_GetVertices(pMeshBuilder, NULL, NULL, &val2, n, NULL, NULL); ok(hr == D3DRM_OK, "Cannot get vertices information (hr = %x)\n", hr); - check_vector(&n[0], 0.577350f, 0.577350f, 0.577350f, 32); - check_vector(&n[1], -0.229416f, 0.688247f, 0.688247f, 32); - check_vector(&n[2], -0.229416f, 0.688247f, 0.688247f, 32); - check_vector(&n[3], -0.577350f, 0.577350f, 0.577350f, 32); + expect_vector(&n[0], 0.577350f, 0.577350f, 0.577350f, 32); + expect_vector(&n[1], -0.229416f, 0.688247f, 0.688247f, 32); + expect_vector(&n[2], -0.229416f, 0.688247f, 0.688247f, 32); + expect_vector(&n[3], -0.577350f, 0.577350f, 0.577350f, 32); /* Check that Load method generated default texture coordinates (0.0f, 0.0f) for each vertex */ valu = 1.23f; @@ -614,12 +621,12 @@ static void test_MeshBuilder(void) ok(val1 == 3, "Wrong number of vertices %d (must be 3)\n", val1); ok(val2 == 3, "Wrong number of normals %d (must be 3)\n", val2); ok(val3 == 8, "Wrong number of face data bytes %d (must be 8)\n", val3); - check_vector(&v[0], 0.1f, 0.2f, 0.3f, 32); - check_vector(&v[1], 0.4f, 0.5f, 0.6f, 32); - check_vector(&v[2], 0.7f, 0.8f, 0.9f, 32); - check_vector(&n[0], 1.1f, 1.2f, 1.3f, 32); - check_vector(&n[1], 1.4f, 1.5f, 1.6f, 32); - check_vector(&n[2], 1.7f, 1.8f, 1.9f, 32); + expect_vector(&v[0], 0.1f, 0.2f, 0.3f, 32); + expect_vector(&v[1], 0.4f, 0.5f, 0.6f, 32); + expect_vector(&v[2], 0.7f, 0.8f, 0.9f, 32); + expect_vector(&n[0], 1.1f, 1.2f, 1.3f, 32); + expect_vector(&n[1], 1.4f, 1.5f, 1.6f, 32); + expect_vector(&n[2], 1.7f, 1.8f, 1.9f, 32); ok(f[0] == 3 , "Wrong component f[0] = %d (expected 3)\n", f[0]); ok(f[1] == 0 , "Wrong component f[1] = %d (expected 0)\n", f[1]); ok(f[2] == 0 , "Wrong component f[2] = %d (expected 0)\n", f[2]); @@ -683,13 +690,13 @@ static void test_MeshBuilder(void) ok(val2 == 3, "Wrong number of normals %d (must be 3)\n", val2); ok(val1 == 3, "Wrong number of vertices %d (must be 3)\n", val1); - check_vector(&v[0], 0.1f * 2, 0.2f * 3, 0.3f * 4, 32); - check_vector(&v[1], 0.4f * 2, 0.5f * 3, 0.6f * 4, 32); - check_vector(&v[2], 0.7f * 2, 0.8f * 3, 0.9f * 4, 32); + expect_vector(&v[0], 0.1f * 2, 0.2f * 3, 0.3f * 4, 32); + expect_vector(&v[1], 0.4f * 2, 0.5f * 3, 0.6f * 4, 32); + expect_vector(&v[2], 0.7f * 2, 0.8f * 3, 0.9f * 4, 32); /* Normals are not affected by Scale */ - check_vector(&n[0], 1.1f, 1.2f, 1.3f, 32); - check_vector(&n[1], 1.4f, 1.5f, 1.6f, 32); - check_vector(&n[2], 1.7f, 1.8f, 1.9f, 32); + expect_vector(&n[0], 1.1f, 1.2f, 1.3f, 32); + expect_vector(&n[1], 1.4f, 1.5f, 1.6f, 32); + expect_vector(&n[2], 1.7f, 1.8f, 1.9f, 32); IDirect3DRMMeshBuilder_Release(pMeshBuilder); @@ -2768,9 +2775,10 @@ cleanup: static void test_frame_transform(void) { + IDirect3DRMFrame *frame, *subframe; D3DRMMATRIX4D matrix, add_matrix; - IDirect3DRMFrame *frame; IDirect3DRM *d3drm; + D3DVECTOR v1, v2; HRESULT hr; hr = Direct3DRMCreate(&d3drm); @@ -3000,6 +3008,29 @@ static void test_frame_transform(void) 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1); + frame_set_transform(frame, + 2.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 4.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 8.0f, 0.0f, + 64.0f, 64.0f, 64.0f, 1.0f); + hr = IDirect3DRM_CreateFrame(d3drm, frame, &subframe); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + frame_set_transform(subframe, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 11.0f, 11.0f, 11.0f, 1.0f); + set_vector(&v1, 3.0f, 5.0f, 7.0f); + + hr = IDirect3DRMFrame_Transform(frame, &v2, &v1); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + expect_vector(&v2, 70.0f, 84.0f, 120.0f, 1); + + hr = IDirect3DRMFrame_Transform(subframe, &v2, &v1); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + expect_vector(&v2, 92.0f, 128.0f, 208.0f, 1); + + IDirect3DRMFrame_Release(subframe); IDirect3DRMFrame_Release(frame); IDirect3DRM_Release(d3drm); }
1
0
0
0
Jeff Smith : d3drm: Implement d3drm_frame3_AddRotation().
by Alexandre Julliard
20 Jun '19
20 Jun '19
Module: wine Branch: master Commit: c241a9c054838d338e1d69f510c6e1fea0be7401 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c241a9c054838d338e1d69f5…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Thu Jun 20 02:47:54 2019 +0430 d3drm: Implement d3drm_frame3_AddRotation(). Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3drm/frame.c | 76 +++++++++++++++++++++++++++++++++++++++---- dlls/d3drm/tests/d3drm.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 7 deletions(-) diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index af1a3ac..b6b4075 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -125,6 +125,36 @@ static void d3drm_matrix_multiply_affine(struct d3drm_matrix *dst, *dst = tmp; } +static void d3drm_matrix_set_rotation(struct d3drm_matrix *matrix, D3DVECTOR *axis, float theta) +{ + float sin_theta, cos_theta, vers_theta; + + D3DRMVectorNormalize(axis); + sin_theta = sinf(theta); + cos_theta = cosf(theta); + vers_theta = 1.0f - cos_theta; + + matrix->_11 = vers_theta * axis->u1.x * axis->u1.x + cos_theta; + matrix->_21 = vers_theta * axis->u1.x * axis->u2.y - sin_theta * axis->u3.z; + matrix->_31 = vers_theta * axis->u1.x * axis->u3.z + sin_theta * axis->u2.y; + matrix->_41 = 0.0f; + + matrix->_12 = vers_theta * axis->u2.y * axis->u1.x + sin_theta * axis->u3.z; + matrix->_22 = vers_theta * axis->u2.y * axis->u2.y + cos_theta; + matrix->_32 = vers_theta * axis->u2.y * axis->u3.z - sin_theta * axis->u1.x; + matrix->_42 = 0.0f; + + matrix->_13 = vers_theta * axis->u3.z * axis->u1.x - sin_theta * axis->u2.y; + matrix->_23 = vers_theta * axis->u3.z * axis->u2.y + sin_theta * axis->u1.x; + matrix->_33 = vers_theta * axis->u3.z * axis->u3.z + cos_theta; + matrix->_43 = 0.0f; + + matrix->_14 = 0.0f; + matrix->_24 = 0.0f; + matrix->_34 = 0.0f; + matrix->_44 = 1.0f; +} + static HRESULT WINAPI d3drm_frame_array_QueryInterface(IDirect3DRMFrameArray *iface, REFIID riid, void **out) { TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); @@ -1149,26 +1179,58 @@ static HRESULT WINAPI d3drm_frame1_AddScale(IDirect3DRMFrame *iface, static HRESULT WINAPI d3drm_frame3_AddRotation(IDirect3DRMFrame3 *iface, D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) { - FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", - iface, type, x, y, z, theta); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_matrix m; + D3DVECTOR axis; - return E_NOTIMPL; + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta); + + axis.u1.x = x; + axis.u2.y = y; + axis.u3.z = z; + + switch (type) + { + case D3DRMCOMBINE_REPLACE: + d3drm_matrix_set_rotation(&frame->transform, &axis, theta); + break; + + case D3DRMCOMBINE_BEFORE: + d3drm_matrix_set_rotation(&m, &axis, theta); + d3drm_matrix_multiply_affine(&frame->transform, &m, &frame->transform); + break; + + case D3DRMCOMBINE_AFTER: + d3drm_matrix_set_rotation(&m, &axis, theta); + d3drm_matrix_multiply_affine(&frame->transform, &frame->transform, &m); + break; + + default: + FIXME("Unhandled type %#x.\n", type); + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; } static HRESULT WINAPI d3drm_frame2_AddRotation(IDirect3DRMFrame2 *iface, D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) { - FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", iface, type, x, y, z, theta); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); - return E_NOTIMPL; + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta); + + return d3drm_frame3_AddRotation(&frame->IDirect3DRMFrame3_iface, type, x, y, z, theta); } static HRESULT WINAPI d3drm_frame1_AddRotation(IDirect3DRMFrame *iface, D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) { - FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", iface, type, x, y, z, theta); + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); - return E_NOTIMPL; + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta); + + return d3drm_frame3_AddRotation(&frame->IDirect3DRMFrame3_iface, type, x, y, z, theta); } static HRESULT WINAPI d3drm_frame3_AddVisual(IDirect3DRMFrame3 *iface, IUnknown *visual) diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 0d18d08..e1ade86 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -22,10 +22,12 @@ #include <limits.h> #define COBJMACROS +#define _USE_MATH_DEFINES #include <d3d.h> #include <initguid.h> #include <d3drm.h> #include <d3drmwin.h> +#include <math.h> #include "wine/test.h" @@ -123,6 +125,20 @@ static void frame_set_transform(IDirect3DRMFrame *frame, IDirect3DRMFrame_AddTransform(frame, D3DRMCOMBINE_REPLACE, matrix); } +static void matrix_sanitise(D3DRMMATRIX4D m) +{ + unsigned int i, j; + + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + if (m[i][j] > -1e-7f && m[i][j] < 1e-7f) + m[i][j] = 0.0f; + } + } +} + static HWND create_window(void) { RECT r = {0, 0, 640, 480}; @@ -2915,6 +2931,75 @@ static void test_frame_transform(void) 0.0f, 0.0f, 2.0f, 0.0f, 6.0f, 6.0f, 6.0f, 1.0f, 1); + frame_set_transform(frame, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 3.0f, 3.0f, 3.0f, 1.0f); + hr = IDirect3DRMFrame_AddRotation(frame, D3DRMCOMBINE_REPLACE, 1.0f, 0.0f, 0.0f, M_PI_2); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMFrame_GetTransform(frame, matrix); + matrix_sanitise(matrix); + expect_matrix(matrix, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, 1); + + frame_set_transform(frame, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 3.0f, 3.0f, 3.0f, 1.0f); + hr = IDirect3DRMFrame_AddRotation(frame, D3DRMCOMBINE_BEFORE, 1.0f, 0.0f, 0.0f, M_PI_2); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMFrame_GetTransform(frame, matrix); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + matrix_sanitise(matrix); + expect_matrix(matrix, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 3.0f, 3.0f, 3.0f, 1.0f, 1); + + frame_set_transform(frame, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 3.0f, 3.0f, 3.0f, 1.0f); + hr = IDirect3DRMFrame_AddRotation(frame, D3DRMCOMBINE_AFTER, 1.0f, 0.0f, 0.0f, M_PI_2); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMFrame_GetTransform(frame, matrix); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + matrix_sanitise(matrix); + expect_matrix(matrix, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 3.0f, -3.0f, 3.0f, 1.0f, 1); + + hr = IDirect3DRMFrame_AddRotation(frame, D3DRMCOMBINE_REPLACE, 0.0f, 0.0f, 1.0f, M_PI_2); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMFrame_GetTransform(frame, matrix); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + matrix_sanitise(matrix); + expect_matrix(matrix, + 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, 1); + + hr = IDirect3DRMFrame_AddRotation(frame, D3DRMCOMBINE_REPLACE, 0.0f, 0.0f, 0.0f, M_PI_2); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMFrame_GetTransform(frame, matrix); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + matrix_sanitise(matrix); + expect_matrix(matrix, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, 1); + IDirect3DRMFrame_Release(frame); IDirect3DRM_Release(d3drm); }
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
87
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Results per page:
10
25
50
100
200