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
October 2020
----- 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
796 discussions
Start a n
N
ew thread
Zebediah Figura : ws2_32: Use server-side async I/O in accept().
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: 93fb921ca7ecf1d95049d2107df82d857569257d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93fb921ca7ecf1d95049d210…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Oct 19 11:21:19 2020 -0500 ws2_32: Use server-side async I/O in accept(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ws2_32/socket.c | 71 ++++++++++++++++++++++++---------------------------- server/async.c | 5 ++++ server/file.h | 1 + server/sock.c | 60 ++++++++++++++++++++++++++++++++++++++------ 4 files changed, 91 insertions(+), 46 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index e93c4ccf589..3efa4ebd64f 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2673,55 +2673,50 @@ static int WS2_register_async_shutdown( SOCKET s, int type ) /*********************************************************************** * accept (WS2_32.1) */ -SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr, int *addrlen32) +SOCKET WINAPI WS_accept( SOCKET s, struct WS_sockaddr *addr, int *len ) { - DWORD err; - int fd; - BOOL is_blocking; IO_STATUS_BLOCK io; NTSTATUS status; obj_handle_t accept_handle; + HANDLE sync_event; + SOCKET ret; - TRACE("socket %04lx\n", s ); - err = sock_is_blocking(s, &is_blocking); - if (err) - goto error; + TRACE("%#lx\n", s); - for (;;) + if (!(sync_event = CreateEventW( NULL, TRUE, FALSE, NULL ))) return INVALID_SOCKET; + status = NtDeviceIoControlFile( SOCKET2HANDLE(s), (HANDLE)((ULONG_PTR)sync_event | 0), NULL, NULL, &io, + IOCTL_AFD_ACCEPT, NULL, 0, &accept_handle, sizeof(accept_handle) ); + if (status == STATUS_PENDING) { - status = NtDeviceIoControlFile( SOCKET2HANDLE(s), NULL, NULL, NULL, &io, IOCTL_AFD_ACCEPT, - NULL, 0, &accept_handle, sizeof(accept_handle) ); - if (!status) + if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED) { - SOCKET as = HANDLE2SOCKET(wine_server_ptr_handle( accept_handle )); + CloseHandle( sync_event ); + return SOCKET_ERROR; + } + status = io.u.Status; + } + CloseHandle( sync_event ); + if (status) + { + WARN("failed; status %#x\n", status); + WSASetLastError( NtStatusToWSAError( status ) ); + return INVALID_SOCKET; + } - if (!socket_list_add(as)) - { - CloseHandle(SOCKET2HANDLE(as)); - return SOCKET_ERROR; - } - if (addr && addrlen32 && WS_getpeername(as, addr, addrlen32)) - { - WS_closesocket(as); - return SOCKET_ERROR; - } - TRACE("\taccepted %04lx\n", as); - return as; - } - err = NtStatusToWSAError( status ); - if (!is_blocking) break; - if (err != WSAEWOULDBLOCK) break; - fd = get_sock_fd( s, FILE_READ_DATA, NULL ); - /* block here */ - do_block(fd, POLLIN, -1); - _sync_sock_state(s); /* let wineserver notice connection */ - release_sock_fd( s, fd ); + ret = HANDLE2SOCKET(wine_server_ptr_handle( accept_handle )); + if (!socket_list_add( ret )) + { + CloseHandle( SOCKET2HANDLE(ret) ); + return INVALID_SOCKET; + } + if (addr && len && WS_getpeername( ret, addr, len )) + { + WS_closesocket( ret ); + return INVALID_SOCKET; } -error: - WARN(" -> ERROR %d\n", err); - SetLastError(err); - return INVALID_SOCKET; + TRACE("returning %#lx\n", ret); + return ret; } /*********************************************************************** diff --git a/server/async.c b/server/async.c index 24fed811da2..81d575b52bd 100644 --- a/server/async.c +++ b/server/async.c @@ -542,6 +542,11 @@ struct iosb *async_get_iosb( struct async *async ) return async->iosb ? (struct iosb *)grab_object( async->iosb ) : NULL; } +struct thread *async_get_thread( struct async *async ) +{ + return async->thread; +} + int async_is_blocking( struct async *async ) { return !async->event && !async->data.apc && !async->data.apc_context; diff --git a/server/file.h b/server/file.h index 477720f8b18..2fb634fad8d 100644 --- a/server/file.h +++ b/server/file.h @@ -221,6 +221,7 @@ extern struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key ) extern void fd_copy_completion( struct fd *src, struct fd *dst ); extern struct iosb *create_iosb( const void *in_data, data_size_t in_size, data_size_t out_size ); extern struct iosb *async_get_iosb( struct async *async ); +extern struct thread *async_get_thread( struct async *async ); extern int async_is_blocking( struct async *async ); extern struct async *find_pending_async( struct async_queue *queue ); extern void cancel_process_asyncs( struct process *process ); diff --git a/server/sock.c b/server/sock.c index 60098e697d2..24693a42fa3 100644 --- a/server/sock.c +++ b/server/sock.c @@ -175,6 +175,7 @@ static void sock_queue_async( struct fd *fd, struct async *async, int type, int static void sock_reselect_async( struct fd *fd, struct async_queue *queue ); static int accept_into_socket( struct sock *sock, struct sock *acceptsock ); +static struct sock *accept_socket( struct sock *sock ); static int sock_get_ntstatus( int err ); static unsigned int sock_get_error( int err ); @@ -448,7 +449,7 @@ static inline int sock_error( struct fd *fd ) static void free_accept_req( struct accept_req *req ) { list_remove( &req->entry ); - req->acceptsock->accept_recv_req = NULL; + if (req->acceptsock) req->acceptsock->accept_recv_req = NULL; release_object( req->async ); free( req ); } @@ -527,11 +528,37 @@ static void complete_async_accept( struct sock *sock, struct accept_req *req ) if (debug_level) fprintf( stderr, "completing accept request for socket %p\n", sock ); - if (!accept_into_socket( sock, acceptsock )) return; + if (acceptsock) + { + if (!accept_into_socket( sock, acceptsock )) return; - iosb = async_get_iosb( async ); - fill_accept_output( req, iosb ); - release_object( iosb ); + iosb = async_get_iosb( async ); + fill_accept_output( req, iosb ); + release_object( iosb ); + } + else + { + obj_handle_t handle; + + if (!(acceptsock = accept_socket( sock ))) return; + handle = alloc_handle_no_access_check( async_get_thread( async )->process, &acceptsock->obj, + GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, OBJ_INHERIT ); + acceptsock->wparam = handle; + release_object( acceptsock ); + if (!handle) return; + + iosb = async_get_iosb( async ); + if (!(iosb->out_data = malloc( sizeof(handle) ))) + { + release_object( iosb ); + return; + } + iosb->status = STATUS_SUCCESS; + iosb->out_size = sizeof(handle); + memcpy( iosb->out_data, &handle, sizeof(handle) ); + release_object( iosb ); + set_error( STATUS_ALERTED ); + } } static void complete_async_accept_recv( struct accept_req *req ) @@ -1344,8 +1371,11 @@ static struct accept_req *alloc_accept_req( struct sock *acceptsock, struct asyn req->accepted = 0; req->recv_len = 0; req->local_len = 0; - req->recv_len = params->recv_len; - req->local_len = params->local_len; + if (params) + { + req->recv_len = params->recv_len; + req->local_len = params->local_len; + } } return req; } @@ -1384,7 +1414,21 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) return 0; } - if (!(acceptsock = accept_socket( sock ))) return 0; + if (!(acceptsock = accept_socket( sock ))) + { + struct accept_req *req; + + if (sock->state & FD_WINE_NONBLOCKING) return 0; + if (get_error() != (0xc0010000 | WSAEWOULDBLOCK)) return 0; + + if (!(req = alloc_accept_req( NULL, async, NULL ))) return 0; + list_add_tail( &sock->accept_list, &req->entry ); + + queue_async( &sock->accept_q, async ); + sock_reselect( sock ); + set_error( STATUS_PENDING ); + return 1; + } handle = alloc_handle( current->process, &acceptsock->obj, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, OBJ_INHERIT ); acceptsock->wparam = handle;
1
0
0
0
Zebediah Figura : ws2_32: Use server-side async I/O in AcceptEx().
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: 0bbd3f66178abdc6ea15d30d2eb3b033367f8407 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0bbd3f66178abdc6ea15d30d…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Oct 19 11:21:18 2020 -0500 ws2_32: Use server-side async I/O in AcceptEx(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ws2_32/socket.c | 183 ++++---------------------- dlls/ws2_32/tests/sock.c | 27 ++-- include/wine/afd.h | 7 + server/sock.c | 334 ++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 357 insertions(+), 194 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=0bbd3f66178abdc6ea15…
1
0
0
0
Nikolay Sivov : ntdll/actctx: Handle empty <dependency> element.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: d3ce5fff85131cea5170b6d3646d21b268efb66e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d3ce5fff85131cea5170b6d3…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 20 13:05:32 2020 +0300 ntdll/actctx: Handle empty <dependency> element. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/actctx.c | 19 +++++++++++++++++++ dlls/ntdll/actctx.c | 2 ++ 2 files changed, 21 insertions(+) diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 4a9adc15748..4a6a22680e2 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -290,6 +290,13 @@ static const char manifest10[] = "</asmv2:trustInfo>" "</assembly>"; +/* Empty <dependency> element */ +static const char manifest11[] = +"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" xmlns:asmv2=\"urn:schemas-microsoft-com:asm.v2\" manifestVersion=\"1.0\">" +"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>" +"<dependency />" +"</assembly>"; + static const char testdep_manifest1[] = "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">" "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH "\"/>" @@ -2240,6 +2247,18 @@ static void test_actctx(void) else skip("Could not create manifest file 10\n"); + if (create_manifest_file("test11.manifest", manifest11, -1, NULL, NULL)) + { + handle = test_create("test11.manifest"); + ok(handle != INVALID_HANDLE_VALUE, "Failed to create activation context for %s, error %u\n", + "manifest11", GetLastError()); + DeleteFileA("test11.manifest"); + if (handle != INVALID_HANDLE_VALUE) + ReleaseActCtx(handle); + } + else + skip("Could not create manifest file 11\n"); + trace("manifest4\n"); if(!create_manifest_file("test4.manifest", manifest4, -1, NULL, NULL)) { diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 7e18544cda8..b99d1655d22 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -2307,6 +2307,8 @@ static void parse_dependency_elem( xmlbuf_t *xmlbuf, struct actctx_loader *acl, } } + if (end) return; + while (next_xml_elem(xmlbuf, &elem, parent)) { if (xml_elem_cmp(&elem, dependentAssemblyW, asmv1W))
1
0
0
0
Hans Leidekker : dssenh: No longer prefer native.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: 7201688841806d9b4d37cf695ed081950a769961 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7201688841806d9b4d37cf69…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Oct 20 10:13:19 2020 +0200 dssenh: No longer prefer native. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dssenh/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c index fb9c5be9328..82822e4daec 100644 --- a/dlls/dssenh/main.c +++ b/dlls/dssenh/main.c @@ -1038,8 +1038,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) switch (fdwReason) { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: instance = hinstDLL; DisableThreadLibraryCalls(hinstDLL);
1
0
0
0
Hans Leidekker : dssenh: Implement CRYPT_MACHINE_KEYSET.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: 4dcb417ed216be12cbf2cb45b14c385e2541a0a8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4dcb417ed216be12cbf2cb45…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Oct 20 10:13:18 2020 +0200 dssenh: Implement CRYPT_MACHINE_KEYSET. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dssenh/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c index 2d39884a21a..fb9c5be9328 100644 --- a/dlls/dssenh/main.c +++ b/dlls/dssenh/main.c @@ -285,10 +285,12 @@ BOOL WINAPI CPAcquireContext( HCRYPTPROV *ret_prov, LPSTR container, DWORD flags switch (flags) { case 0: + case 0 | CRYPT_MACHINE_KEYSET: ret = read_key_container( name, flags ); break; case CRYPT_NEWKEYSET: + case CRYPT_NEWKEYSET | CRYPT_MACHINE_KEYSET: if ((ret = read_key_container( name, flags ))) { heap_free( ret ); @@ -299,10 +301,12 @@ BOOL WINAPI CPAcquireContext( HCRYPTPROV *ret_prov, LPSTR container, DWORD flags break; case CRYPT_VERIFYCONTEXT: + case CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET: ret = create_key_container( "", flags ); break; case CRYPT_DELETEKEYSET: + case CRYPT_DELETEKEYSET | CRYPT_MACHINE_KEYSET: delete_key_container( name, flags ); *ret_prov = 0; return TRUE;
1
0
0
0
Hans Leidekker : dssenh: Add support for importing version 3 public keys.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: 691404bd0611c9f4d94d4dabfa756ad4ba4f0fd9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=691404bd0611c9f4d94d4dab…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Oct 20 10:13:17 2020 +0200 dssenh: Add support for importing version 3 public keys. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dssenh/main.c | 147 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 121 insertions(+), 26 deletions(-) diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c index ffd1db92da4..2d39884a21a 100644 --- a/dlls/dssenh/main.c +++ b/dlls/dssenh/main.c @@ -485,35 +485,18 @@ BOOL WINAPI CPDestroyKey( HCRYPTPROV hprov, HCRYPTKEY hkey ) #define MAGIC_DSS1 ('D' | ('S' << 8) | ('S' << 16) | ('1' << 24)) #define MAGIC_DSS2 ('D' | ('S' << 8) | ('S' << 16) | ('2' << 24)) +#define MAGIC_DSS3 ('D' | ('S' << 8) | ('S' << 16) | ('3' << 24)) -BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKEY hpubkey, DWORD flags, - HCRYPTKEY *ret_key ) +static BOOL import_key_dss2( struct container *container, ALG_ID algid, const BYTE *data, DWORD len, DWORD flags, + HCRYPTKEY *ret_key ) { - struct container *container = (struct container *)hprov; - struct key *key, *exch_key, *sign_key; - BLOBHEADER *hdr; - DSSPUBKEY *pubkey; + const BLOBHEADER *hdr = (const BLOBHEADER *)data; + const DSSPUBKEY *pubkey = (const DSSPUBKEY *)(hdr + 1); const WCHAR *type; + struct key *key, *exch_key, *sign_key; NTSTATUS status; - TRACE( "%p, %p, %u, %p, %08x, %p\n", (void *)hprov, data, len, (void *)hpubkey, flags, ret_key ); - - if (container->magic != MAGIC_CONTAINER) return FALSE; - if (len < sizeof(*hdr)) return FALSE; - - hdr = (BLOBHEADER *)data; - if ((hdr->bType != PRIVATEKEYBLOB && hdr->bType != PUBLICKEYBLOB) || hdr->bVersion != 2 || - hdr->aiKeyAlg != CALG_DSS_SIGN) - { - FIXME( "bType %u\n", hdr->bType ); - FIXME( "bVersion %u\n", hdr->bVersion ); - FIXME( "reserved %u\n", hdr->reserved ); - FIXME( "aiKeyAlg %08x\n", hdr->aiKeyAlg ); - return FALSE; - } - if (len < sizeof(*hdr) + sizeof(*pubkey)) return FALSE; - pubkey = (DSSPUBKEY *)(hdr + 1); switch (pubkey->magic) { @@ -530,7 +513,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE return FALSE; } - if (!(key = create_key( hdr->aiKeyAlg, flags ))) return FALSE; + if (!(key = create_key( CALG_DSS_SIGN, flags ))) return FALSE; if ((status = BCryptImportKeyPair( key->alg_handle, NULL, type, &key->handle, (UCHAR *)data, len, 0 ))) { @@ -541,7 +524,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE if (!wcscmp(type, LEGACY_DSA_V2_PRIVATE_BLOB)) { - switch (hdr->aiKeyAlg) + switch (algid) { case AT_KEYEXCHANGE: case CALG_DH_SF: @@ -566,7 +549,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE break; default: - FIXME( "unhandled key algorithm %u\n", hdr->aiKeyAlg ); + FIXME( "unhandled key algorithm %u\n", algid ); destroy_key( key ); return FALSE; } @@ -578,6 +561,118 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE return TRUE; } +static BOOL import_key_dss3( struct container *container, ALG_ID algid, const BYTE *data, DWORD len, DWORD flags, + HCRYPTKEY *ret_key ) +{ + const BLOBHEADER *hdr = (const BLOBHEADER *)data; + const DSSPUBKEY_VER3 *pubkey = (const DSSPUBKEY_VER3 *)(hdr + 1); + BCRYPT_DSA_KEY_BLOB *blob; + struct key *key; + BYTE *src, *dst; + ULONG i, size, size_q; + NTSTATUS status; + + if (len < sizeof(*hdr) + sizeof(*pubkey)) return FALSE; + + switch (pubkey->magic) + { + case MAGIC_DSS3: + break; + + default: + FIXME( "unsupported key magic %08x\n", pubkey->magic ); + return FALSE; + } + + if ((size_q = pubkey->bitlenQ / 8) > sizeof(blob->q)) + { + FIXME( "q too large\n" ); + return FALSE; + } + + if (!(key = create_key( CALG_DSS_SIGN, flags ))) return FALSE; + + size = sizeof(*blob) + (pubkey->bitlenP / 8) * 3; + if (!(blob = heap_alloc_zero( size ))) + { + destroy_key( key ); + return FALSE; + } + blob->dwMagic = BCRYPT_DSA_PUBLIC_MAGIC; + blob->cbKey = pubkey->bitlenP / 8; + memcpy( blob->Count, &pubkey->DSSSeed.counter, sizeof(blob->Count) ); + memcpy( blob->Seed, pubkey->DSSSeed.seed, sizeof(blob->Seed) ); + + /* q */ + src = (BYTE *)(pubkey + 1) + blob->cbKey; + for (i = 0; i < size_q; i++) blob->q[i] = src[size_q - i - 1]; + + /* p */ + src -= blob->cbKey; + dst = (BYTE *)(blob + 1); + for (i = 0; i < blob->cbKey; i++) dst[i] = src[blob->cbKey - i - 1]; + + /* g */ + src += blob->cbKey + size_q; + dst += blob->cbKey; + for (i = 0; i < blob->cbKey; i++) dst[i] = src[blob->cbKey - i - 1]; + + /* y */ + src += blob->cbKey + pubkey->bitlenJ / 8; + dst += blob->cbKey; + for (i = 0; i < blob->cbKey; i++) dst[i] = src[blob->cbKey - i - 1]; + + if ((status = BCryptImportKeyPair( key->alg_handle, NULL, BCRYPT_DSA_PUBLIC_BLOB, &key->handle, (UCHAR *)blob, + size, 0 ))) + { + WARN( "failed to import key %08x\n", status ); + destroy_key( key ); + heap_free( blob ); + return FALSE; + } + + heap_free( blob ); + *ret_key = (HCRYPTKEY)key; + return TRUE; +} + +BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKEY hpubkey, DWORD flags, + HCRYPTKEY *ret_key ) +{ + struct container *container = (struct container *)hprov; + const BLOBHEADER *hdr; + BOOL ret; + + TRACE( "%p, %p, %u, %p, %08x, %p\n", (void *)hprov, data, len, (void *)hpubkey, flags, ret_key ); + + if (container->magic != MAGIC_CONTAINER) return FALSE; + if (len < sizeof(*hdr)) return FALSE; + + hdr = (const BLOBHEADER *)data; + if ((hdr->bType != PRIVATEKEYBLOB && hdr->bType != PUBLICKEYBLOB) || hdr->aiKeyAlg != CALG_DSS_SIGN) + { + FIXME( "bType %u aiKeyAlg %08x not supported\n", hdr->bType, hdr->aiKeyAlg ); + return FALSE; + } + + switch (hdr->bVersion) + { + case 2: + ret = import_key_dss2( container, hdr->aiKeyAlg, data, len, flags, ret_key ); + break; + + case 3: + ret = import_key_dss3( container, hdr->aiKeyAlg, data, len, flags, ret_key ); + break; + + default: + FIXME( "version %u not supported\n", hdr->bVersion ); + return FALSE; + } + + return ret; +} + BOOL WINAPI CPExportKey( HCRYPTPROV hprov, HCRYPTKEY hkey, HCRYPTKEY hexpkey, DWORD blobtype, DWORD flags, BYTE *data, DWORD *len ) {
1
0
0
0
Hans Leidekker : dssenh: Always duplicate container keys.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: a71447565584265f37d3948e998680635f204da1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a71447565584265f37d3948e…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Oct 20 10:13:16 2020 +0200 dssenh: Always duplicate container keys. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dssenh/main.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c index e3771dc6f06..ffd1db92da4 100644 --- a/dlls/dssenh/main.c +++ b/dlls/dssenh/main.c @@ -433,11 +433,7 @@ static BOOL generate_key( struct container *container, ALG_ID algid, DWORD bitle return FALSE; } - if (!store_key_container_keys( container )) - { - destroy_key( key ); - return FALSE; - } + if (!store_key_container_keys( container )) return FALSE; *ret_key = (HCRYPTKEY)key; return TRUE; @@ -494,7 +490,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE HCRYPTKEY *ret_key ) { struct container *container = (struct container *)hprov; - struct key *key; + struct key *key, *exch_key, *sign_key; BLOBHEADER *hdr; DSSPUBKEY *pubkey; const WCHAR *type; @@ -549,12 +545,24 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE { case AT_KEYEXCHANGE: case CALG_DH_SF: - container->exch_key = key; + if (!(exch_key = duplicate_key( key ))) + { + destroy_key( key ); + return FALSE; + } + destroy_key( container->exch_key ); + container->exch_key = exch_key; break; case AT_SIGNATURE: case CALG_DSS_SIGN: - container->sign_key = key; + if (!(sign_key = duplicate_key( key ))) + { + destroy_key( key ); + return FALSE; + } + destroy_key( container->sign_key ); + container->sign_key = sign_key; break; default: @@ -563,11 +571,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE return FALSE; } - if (!store_key_container_keys( container )) - { - destroy_key( key ); - return FALSE; - } + if (!store_key_container_keys( container )) return FALSE; } *ret_key = (HCRYPTKEY)key;
1
0
0
0
Hans Leidekker : dssenh/tests: Add tests for CryptDuplicateKey.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: 04acc70df45dbff7d244134016d1a2172b1a8f59 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=04acc70df45dbff7d2441340…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Oct 20 10:13:15 2020 +0200 dssenh/tests: Add tests for CryptDuplicateKey. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dssenh/tests/dssenh.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/dssenh/tests/dssenh.c b/dlls/dssenh/tests/dssenh.c index d3f3172230e..e9c62cb99de 100644 --- a/dlls/dssenh/tests/dssenh.c +++ b/dlls/dssenh/tests/dssenh.c @@ -1514,6 +1514,36 @@ static void test_userkey(void) ok(!hprov, "got %08x\n", (DWORD)hprov); } +static void test_duplicate_key(void) +{ + HCRYPTPROV hprov; + HCRYPTKEY hkey, hkey2; + DWORD len; + BOOL result; + BYTE buf[512]; + + result = CryptAcquireContextA(&hprov, NULL, MS_DEF_DSS_PROV_A, PROV_DSS, CRYPT_VERIFYCONTEXT); + ok(result, "got %08x\n", GetLastError()); + + result = CryptImportKey(hprov, DSS_SIGN_PrivateKey, sizeof(DSS_SIGN_PrivateKey), 0, CRYPT_EXPORTABLE, &hkey); + ok(result, "got %08x\n", GetLastError()); + + result = CryptDuplicateKey(hkey, NULL, 0, &hkey2); + ok(result, "got %08x\n", GetLastError()); + + len = sizeof(buf); + result = CryptExportKey(hkey2, 0, PRIVATEKEYBLOB, 0, buf, &len); + ok(result, "got %08x\n", GetLastError()); + ok(len == sizeof(DSS_SIGN_PrivateKey), "got %u\n", len); + ok(!memcmp(buf, DSS_SIGN_PrivateKey, sizeof(DSS_SIGN_PrivateKey)), "wrong data\n"); + + result = CryptDestroyKey(hkey2); + ok(result, "got %08x\n", GetLastError()); + + result = CryptDestroyKey(hkey); + ok(result, "got %08x\n", GetLastError()); +} + START_TEST(dssenh) { test_acquire_context(); @@ -1525,4 +1555,5 @@ START_TEST(dssenh) test_key_exchange(); test_duplicate_hash(); test_userkey(); + test_duplicate_key(); }
1
0
0
0
Michael Stefaniuc : taskmgr: Use two kernel32 functions directly.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: c2883d77b8c272f8699a8683cc0901f5eec6daf1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c2883d77b8c272f8699a8683…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Tue Oct 20 00:31:48 2020 +0200 taskmgr: Use two kernel32 functions directly. The yougest one, IsWow64Proces, is available since WinXP SP2 / Vista. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/taskmgr/perfdata.c | 12 ++---------- programs/taskmgr/perfdata.h | 3 --- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c index a152415357e..bbd3327ab58 100644 --- a/programs/taskmgr/perfdata.c +++ b/programs/taskmgr/perfdata.c @@ -30,8 +30,6 @@ #include "taskmgr.h" #include "perfdata.h" -static PROCGPIC pGetProcessIoCounters = NULL; -static PROCISW64 pIsWow64Process = NULL; static CRITICAL_SECTION PerfDataCriticalSection; static PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */ static PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */ @@ -57,11 +55,7 @@ static size_t size_diff(size_t x, size_t y) BOOL PerfDataInitialize(void) { LONG status; - static const WCHAR wszKernel32[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0}; - pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters"); - pIsWow64Process = (PROCISW64)GetProcAddress(GetModuleHandleW(wszKernel32), "IsWow64Process"); - InitializeCriticalSection(&PerfDataCriticalSection); /* @@ -291,10 +285,8 @@ void PerfDataRefresh(void) } pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS); pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS); - if (pGetProcessIoCounters) - pGetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); - if (pIsWow64Process) - pIsWow64Process(hProcess, &pPerfData[Idx].Wow64Process); + GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); + IsWow64Process(hProcess, &pPerfData[Idx].Wow64Process); CloseHandle(hProcess); } pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart; diff --git a/programs/taskmgr/perfdata.h b/programs/taskmgr/perfdata.h index 0b06965d52e..615e7db2a64 100644 --- a/programs/taskmgr/perfdata.h +++ b/programs/taskmgr/perfdata.h @@ -66,9 +66,6 @@ struct _SYSTEM_PAGEFILE_INFORMATION #define GR_GDIOBJECTS 0 /* Count of GDI objects */ #define GR_USEROBJECTS 1 /* Count of USER objects */ -typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS); -typedef BOOL (WINAPI *PROCISW64)(HANDLE,PBOOL); - BOOL PerfDataInitialize(void); void PerfDataRefresh(void);
1
0
0
0
Michael Stefaniuc : taskmgr: Use NtQuerySystemInformation() directly.
by Alexandre Julliard
20 Oct '20
20 Oct '20
Module: wine Branch: master Commit: cf3e6c353bfc19d79237aa7b001be8a8905b8270 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cf3e6c353bfc19d79237aa7b…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Tue Oct 20 00:31:47 2020 +0200 taskmgr: Use NtQuerySystemInformation() directly. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/taskmgr/perfdata.c | 23 +++++++++-------------- programs/taskmgr/perfdata.h | 1 - 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c index 67f0d934412..a152415357e 100644 --- a/programs/taskmgr/perfdata.c +++ b/programs/taskmgr/perfdata.c @@ -30,7 +30,6 @@ #include "taskmgr.h" #include "perfdata.h" -static PROCNTQSI pNtQuerySystemInformation = NULL; static PROCGPIC pGetProcessIoCounters = NULL; static PROCISW64 pIsWow64Process = NULL; static CRITICAL_SECTION PerfDataCriticalSection; @@ -58,22 +57,17 @@ static size_t size_diff(size_t x, size_t y) BOOL PerfDataInitialize(void) { LONG status; - static const WCHAR wszNtdll[] = {'n','t','d','l','l','.','d','l','l',0}; static const WCHAR wszKernel32[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0}; - pNtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation"); pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters"); pIsWow64Process = (PROCISW64)GetProcAddress(GetModuleHandleW(wszKernel32), "IsWow64Process"); InitializeCriticalSection(&PerfDataCriticalSection); - if (!pNtQuerySystemInformation) - return FALSE; - /* * Get number of processors in the system */ - status = pNtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL); + status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL); if (status != NO_ERROR) return FALSE; @@ -102,24 +96,25 @@ void PerfDataRefresh(void) /* Get new system time */ - status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0); + status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0); if (status != NO_ERROR) return; /* Get new CPU's idle time */ - status = pNtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL); + status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL); if (status != NO_ERROR) return; /* Get system cache information */ - status = pNtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL); + status = NtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL); if (status != NO_ERROR) return; /* Get processor time information */ SysProcessorTimeInfo = HeapAlloc(GetProcessHeap(), 0, - sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors); - status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors, &ulSize); + sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors); + status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, + sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors, &ulSize); if (status != NO_ERROR) { HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo); return; @@ -135,7 +130,7 @@ void PerfDataRefresh(void) BufferSize += 0x10000; SysHandleInfoData = HeapAlloc(GetProcessHeap(), 0, BufferSize); - status = pNtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize); + status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize); if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) { HeapFree(GetProcessHeap(), 0, SysHandleInfoData); @@ -153,7 +148,7 @@ void PerfDataRefresh(void) BufferSize += 0x10000; pBuffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); - status = pNtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize); + status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize); if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) { HeapFree(GetProcessHeap(), 0, pBuffer); diff --git a/programs/taskmgr/perfdata.h b/programs/taskmgr/perfdata.h index 8b9fabbd910..0b06965d52e 100644 --- a/programs/taskmgr/perfdata.h +++ b/programs/taskmgr/perfdata.h @@ -66,7 +66,6 @@ struct _SYSTEM_PAGEFILE_INFORMATION #define GR_GDIOBJECTS 0 /* Count of GDI objects */ #define GR_USEROBJECTS 1 /* Count of USER objects */ -typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG); typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS); typedef BOOL (WINAPI *PROCISW64)(HANDLE,PBOOL);
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
80
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
Results per page:
10
25
50
100
200