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 2017
----- 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
2 participants
595 discussions
Start a n
N
ew thread
Jacek Caban : ntdll: Set iosb status in server_ioctl_file.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 4e02a3bb1383f7191226b6b03c07aee47151c80a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4e02a3bb1383f7191226b6b03…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:19:56 2017 +0200 ntdll: Set iosb status in server_ioctl_file. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index b73af7e..0d7efc3 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1560,6 +1560,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event, NtClose( wait_handle ); } + if (status != STATUS_PENDING && code != FSCTL_PIPE_LISTEN) io->u.Status = status; return status; } @@ -1644,8 +1645,8 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, } if (status == STATUS_NOT_SUPPORTED || status == STATUS_BAD_DEVICE_TYPE) - status = server_ioctl_file( handle, event, apc, apc_context, io, code, - in_buffer, in_size, out_buffer, out_size ); + return server_ioctl_file( handle, event, apc, apc_context, io, code, + in_buffer, in_size, out_buffer, out_size ); if (status != STATUS_PENDING) io->u.Status = status; return status; @@ -1694,7 +1695,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc status = server_ioctl_file( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size ); if (!status) status = DIR_unmount_device( handle ); - break; + return status; case FSCTL_PIPE_PEEK: { @@ -1710,8 +1711,8 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc if ((status = server_get_unix_fd( handle, FILE_READ_DATA, &fd, &needs_close, NULL, NULL ))) { if (status == STATUS_BAD_DEVICE_TYPE) - status = server_ioctl_file( handle, event, apc, apc_context, io, code, - in_buffer, in_size, out_buffer, out_size ); + return server_ioctl_file( handle, event, apc, apc_context, io, code, + in_buffer, in_size, out_buffer, out_size ); break; } @@ -1767,11 +1768,6 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc int fd = server_remove_fd_from_cache( handle ); if (fd != -1) close( fd ); } - break; - - case FSCTL_PIPE_LISTEN: - status = server_ioctl_file( handle, event, apc, apc_context, io, code, - in_buffer, in_size, out_buffer, out_size ); return status; case FSCTL_PIPE_IMPERSONATE: @@ -1814,11 +1810,9 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc io->Information = 0; status = STATUS_SUCCESS; break; - case FSCTL_PIPE_WAIT: default: - status = server_ioctl_file( handle, event, apc, apc_context, io, code, - in_buffer, in_size, out_buffer, out_size ); - break; + return server_ioctl_file( handle, event, apc, apc_context, io, code, + in_buffer, in_size, out_buffer, out_size ); } if (status != STATUS_PENDING) io->u.Status = status;
1
0
0
0
Jacek Caban : server: Allow async_handoff users to set result themselves.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 74364ed0172ad91f0516cc95a4a5c1062a561e21 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=74364ed0172ad91f0516cc95a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:19:40 2017 +0200 server: Allow async_handoff users to set result themselves. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/async.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/async.c b/server/async.c index 409c9b5..3a83a63 100644 --- a/server/async.c +++ b/server/async.c @@ -338,13 +338,23 @@ obj_handle_t async_handoff( struct async *async, int success, data_size_t *resul return 0; } - if (async->iosb->status != STATUS_PENDING) + if (get_error() != STATUS_PENDING) + { + /* status and data are already set and returned */ + async_terminate( async, get_error() ); + } + else if (async->iosb->status != STATUS_PENDING) { + /* result is already available in iosb, return it */ if (async->iosb->out_data) { set_reply_data_ptr( async->iosb->out_data, async->iosb->out_size ); async->iosb->out_data = NULL; } + } + + if (async->iosb->status != STATUS_PENDING) + { if (result) *result = async->iosb->result; async->signaled = 1; }
1
0
0
0
Jacek Caban : server: Store fd reference in async object for unqueued asyncs.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: fa0dfe5967087edf5e9f77975dc1ad5e0e01a963 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fa0dfe5967087edf5e9f77975…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:19:28 2017 +0200 server: Store fd reference in async object for unqueued asyncs. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/async.c | 35 +++++++++++++++++++++++------------ server/change.c | 2 +- server/fd.c | 10 +++++----- server/file.h | 4 ++-- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/server/async.c b/server/async.c index b693c28..409c9b5 100644 --- a/server/async.c +++ b/server/async.c @@ -41,6 +41,7 @@ struct async struct list queue_entry; /* entry in async queue list */ struct list process_entry; /* entry in process list */ struct async_queue *queue; /* queue containing this async */ + struct fd *fd; /* fd associated with an unqueued async */ unsigned int status; /* current status */ struct timeout_user *timeout; unsigned int timeout_status; /* status to report upon timeout */ @@ -167,6 +168,7 @@ static void async_destroy( struct object *obj ) release_object( async->queue ); } + if (async->fd) release_object( async->fd ); if (async->timeout) remove_timeout_user( async->timeout ); if (async->event) release_object( async->event ); if (async->iosb) release_object( async->iosb ); @@ -257,8 +259,10 @@ void free_async_queue( struct async_queue *queue ) void queue_async( struct async_queue *queue, struct async *async ) { - async->queue = (struct async_queue *)grab_object( queue ); + release_object( async->fd ); + async->fd = NULL; + async->queue = (struct async_queue *)grab_object( queue ); grab_object( async ); list_add_tail( &queue->queue, &async->queue_entry ); @@ -266,7 +270,7 @@ void queue_async( struct async_queue *queue, struct async *async ) } /* create an async on a given queue of a fd */ -struct async *create_async( struct thread *thread, const async_data_t *data, struct iosb *iosb ) +struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, struct iosb *iosb ) { struct event *event = NULL; struct async *async; @@ -286,6 +290,7 @@ struct async *create_async( struct thread *thread, const async_data_t *data, str async->data = *data; async->timeout = NULL; async->queue = NULL; + async->fd = (struct fd *)grab_object( fd ); async->signaled = 0; async->wait_handle = 0; async->direct_result = 0; @@ -301,7 +306,7 @@ struct async *create_async( struct thread *thread, const async_data_t *data, str /* create an async associated with iosb for async-based requests * returned async must be passed to async_handoff */ -struct async *create_request_async( struct thread *thread, const async_data_t *data ) +struct async *create_request_async( struct fd *fd, const async_data_t *data ) { struct async *async; struct iosb *iosb; @@ -309,7 +314,7 @@ struct async *create_request_async( struct thread *thread, const async_data_t *d if (!(iosb = create_iosb( get_req_data(), get_req_data_size(), get_reply_max_size() ))) return NULL; - async = create_async( current, data, iosb ); + async = create_async( fd, current, data, iosb ); release_object( iosb ); if (async) { @@ -365,13 +370,15 @@ void async_set_timeout( struct async *async, timeout_t timeout, unsigned int sta async->timeout_status = status; } -static void add_async_completion( struct async_queue *queue, apc_param_t cvalue, unsigned int status, +static void add_async_completion( struct async *async, apc_param_t cvalue, unsigned int status, apc_param_t information ) { - if (queue->fd) + struct fd *fd = async->queue ? async->queue->fd : async->fd; + + if (fd) { apc_param_t ckey; - struct completion *completion = fd_get_completion( queue->fd, &ckey ); + struct completion *completion = fd_get_completion( fd, &ckey ); if (completion) { @@ -379,8 +386,8 @@ static void add_async_completion( struct async_queue *queue, apc_param_t cvalue, release_object( completion ); } } - else if (queue->completion) add_completion( queue->completion, queue->comp_key, - cvalue, status, information ); + else if (async->queue && async->queue->completion) + add_completion( async->queue->completion, async->queue->comp_key, cvalue, status, information ); } /* store the result of the client-side async callback */ @@ -410,8 +417,6 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota async->status = status; if (status == STATUS_MORE_PROCESSING_REQUIRED) return; /* don't report the completion */ - if (async->queue && !async->data.apc && async->data.apc_context) - add_async_completion( async->queue, async->data.apc_context, status, total ); if (async->data.apc) { apc_call_t data; @@ -423,7 +428,11 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota data.user.args[2] = 0; thread_queue_apc( async->thread, NULL, &data ); } + else if (async->data.apc_context) + add_async_completion( async, async->data.apc_context, status, total ); + if (async->event) set_event( async->event ); + else if (async->fd) set_fd_signaled( async->fd, 1 ); else if (async->queue && async->queue->fd) set_fd_signaled( async->queue->fd, 1 ); if (!async->signaled) { @@ -454,13 +463,15 @@ int async_waiting( struct async_queue *queue ) static int cancel_async( struct process *process, struct object *obj, struct thread *thread, client_ptr_t iosb ) { struct async *async; + struct fd *fd; int woken = 0; restart: LIST_FOR_EACH_ENTRY( async, &process->asyncs, struct async, process_entry ) { if (async->status == STATUS_CANCELLED) continue; - if ((!obj || (async->queue && async->queue->fd && get_fd_user( async->queue->fd ) == obj)) && + fd = async->queue ? async->queue->fd : async->fd; + if ((!obj || (fd && get_fd_user( fd ) == obj)) && (!thread || async->thread == thread) && (!iosb || async->data.iosb == iosb)) { diff --git a/server/change.c b/server/change.c index 14fb2f1..88423fe 100644 --- a/server/change.c +++ b/server/change.c @@ -1246,7 +1246,7 @@ DECL_HANDLER(read_directory_changes) return; /* requests don't timeout */ - if (!(async = create_async( current, &req->async, NULL ))) goto end; + if (!(async = create_async( dir->fd, current, &req->async, NULL ))) goto end; if (!fd_queue_async( dir->fd, async, ASYNC_TYPE_WAIT )) goto end; /* assign it once */ diff --git a/server/fd.c b/server/fd.c index 0f1a15e..a073c54 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2373,7 +2373,7 @@ DECL_HANDLER(flush) if (!fd) return; - async = create_async( current, &req->async, NULL ); + async = create_async( fd, current, &req->async, NULL ); if (async) { reply->event = fd->fd_ops->flush( fd, async ); @@ -2449,7 +2449,7 @@ DECL_HANDLER(read) if (!fd) return; - if ((async = create_request_async( current, &req->async ))) + if ((async = create_request_async( fd, &req->async ))) { reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ), NULL ); reply->options = fd->options; @@ -2466,7 +2466,7 @@ DECL_HANDLER(write) if (!fd) return; - if ((async = create_request_async( current, &req->async ))) + if ((async = create_request_async( fd, &req->async ))) { reply->wait = async_handoff( async, fd->fd_ops->write( fd, async, req->pos ), &reply->size ); reply->options = fd->options; @@ -2487,7 +2487,7 @@ DECL_HANDLER(ioctl) if ((iosb = create_iosb( get_req_data(), get_req_data_size(), get_reply_max_size() ))) { - if ((async = create_async( current, &req->async, iosb ))) + if ((async = create_async( fd, current, &req->async, iosb ))) { reply->wait = fd->fd_ops->ioctl( fd, req->code, async ); reply->options = fd->options; @@ -2520,7 +2520,7 @@ DECL_HANDLER(register_async) if ((fd = get_handle_fd_obj( current->process, req->async.handle, access ))) { - if (get_unix_fd( fd ) != -1 && (async = create_async( current, &req->async, NULL ))) + if (get_unix_fd( fd ) != -1 && (async = create_async( fd, current, &req->async, NULL ))) { fd->fd_ops->queue_async( fd, async, req->type, req->count ); release_object( async ); diff --git a/server/file.h b/server/file.h index 96c1d23..1e5ea7a 100644 --- a/server/file.h +++ b/server/file.h @@ -175,8 +175,8 @@ extern struct object *create_serial( struct fd *fd ); /* async I/O functions */ extern struct async_queue *create_async_queue( struct fd *fd ); extern void free_async_queue( struct async_queue *queue ); -extern struct async *create_async( struct thread *thread, const async_data_t *data, struct iosb *iosb ); -extern struct async *create_request_async( struct thread *thread, const async_data_t *data ); +extern struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, struct iosb *iosb ); +extern struct async *create_request_async( struct fd *fd, const async_data_t *data ); extern obj_handle_t async_handoff( struct async *async, int success, data_size_t *result ); extern void queue_async( struct async_queue *queue, struct async *async ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status );
1
0
0
0
Jacek Caban : server: Use create_request_async for write requests.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 2bd828b13cf0307ca087d098e67f192dd236c1b0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2bd828b13cf0307ca087d098e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:18:23 2017 +0200 server: Use create_request_async for write requests. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 6 +++++- server/async.c | 3 ++- server/device.c | 6 +++--- server/fd.c | 18 ++++++------------ server/file.h | 6 +++--- server/named_pipe.c | 26 ++++---------------------- 6 files changed, 23 insertions(+), 42 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 3d9840f..b73af7e 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -624,6 +624,11 @@ static NTSTATUS server_write_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE status = wine_server_call( req ); wait_handle = wine_server_ptr_handle( reply->wait ); options = reply->options; + if (wait_handle && status != STATUS_PENDING) + { + io->u.Status = status; + io->Information = reply->size; + } } SERVER_END_REQ; @@ -633,7 +638,6 @@ static NTSTATUS server_write_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE { NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL ); status = io->u.Status; - NtClose( wait_handle ); } return status; diff --git a/server/async.c b/server/async.c index 7f2bcf5..b693c28 100644 --- a/server/async.c +++ b/server/async.c @@ -324,7 +324,7 @@ struct async *create_request_async( struct thread *thread, const async_data_t *d } /* return async object status and wait handle to client */ -obj_handle_t async_handoff( struct async *async, int success ) +obj_handle_t async_handoff( struct async *async, int success, data_size_t *result ) { if (!success) { @@ -340,6 +340,7 @@ obj_handle_t async_handoff( struct async *async, int success ) set_reply_data_ptr( async->iosb->out_data, async->iosb->out_size ); async->iosb->out_data = NULL; } + if (result) *result = async->iosb->result; async->signaled = 1; } else diff --git a/server/device.c b/server/device.c index 4aa605b..4c7aa16 100644 --- a/server/device.c +++ b/server/device.c @@ -175,7 +175,7 @@ static int device_file_close_handle( struct object *obj, struct process *process static void device_file_destroy( struct object *obj ); static enum server_fd_type device_file_get_fd_type( struct fd *fd ); static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); -static obj_handle_t device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); +static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); static obj_handle_t device_file_flush( struct fd *fd, struct async *async ); static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -506,7 +506,7 @@ static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos return handle; } -static obj_handle_t device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) +static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct device_file *file = get_fd_user( fd ); struct irp_call *irp; @@ -522,7 +522,7 @@ static obj_handle_t device_file_write( struct fd *fd, struct async *async, file_ irp = create_irp( file, ¶ms, async ); if (!irp) return 0; - handle = queue_irp( file, irp, async, 1 ); + handle = queue_irp( file, irp, async, 0 ); release_object( irp ); return handle; } diff --git a/server/fd.c b/server/fd.c index f6eb57d..0f1a15e 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2165,7 +2165,7 @@ int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) } /* default write() routine */ -obj_handle_t no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) +int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); return 0; @@ -2451,7 +2451,7 @@ DECL_HANDLER(read) if ((async = create_request_async( current, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ) ); + reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ), NULL ); reply->options = fd->options; release_object( async ); } @@ -2463,20 +2463,14 @@ DECL_HANDLER(write) { struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_WRITE_DATA ); struct async *async; - struct iosb *iosb; if (!fd) return; - if ((iosb = create_iosb( get_req_data(), get_req_data_size(), 0 ))) + if ((async = create_request_async( current, &req->async ))) { - async = create_async( current, &req->async, iosb ); - if (async) - { - reply->wait = fd->fd_ops->write( fd, async, req->pos ); - reply->options = fd->options; - release_object( async ); - } - release_object( iosb ); + reply->wait = async_handoff( async, fd->fd_ops->write( fd, async, req->pos ), &reply->size ); + reply->options = fd->options; + release_object( async ); } release_object( fd ); } diff --git a/server/file.h b/server/file.h index 8cc4d3b..96c1d23 100644 --- a/server/file.h +++ b/server/file.h @@ -54,7 +54,7 @@ struct fd_ops /* perform a read on the file */ int (*read)(struct fd *, struct async *, file_pos_t ); /* perform a write on the file */ - obj_handle_t (*write)(struct fd *, struct async *, file_pos_t ); + int (*write)(struct fd *, struct async *, file_pos_t ); /* flush the object buffers */ obj_handle_t (*flush)(struct fd *, struct async *); /* perform an ioctl on the file */ @@ -101,7 +101,7 @@ extern int fd_queue_async( struct fd *fd, struct async *async, int type ); extern void fd_async_wake_up( struct fd *fd, int type, unsigned int status ); extern void fd_reselect_async( struct fd *fd, struct async_queue *queue ); extern int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); -extern obj_handle_t no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); +extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern obj_handle_t no_fd_flush( struct fd *fd, struct async *async ); extern obj_handle_t no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern obj_handle_t default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -177,7 +177,7 @@ extern struct async_queue *create_async_queue( struct fd *fd ); extern void free_async_queue( struct async_queue *queue ); extern struct async *create_async( struct thread *thread, const async_data_t *data, struct iosb *iosb ); extern struct async *create_request_async( struct thread *thread, const async_data_t *data ); -extern obj_handle_t async_handoff( struct async *async, int success ); +extern obj_handle_t async_handoff( struct async *async, int success, data_size_t *result ); extern void queue_async( struct async_queue *queue, struct async *async ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); extern void async_set_result( struct object *obj, unsigned int status, apc_param_t total ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 07ec006..f33daf8 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -155,7 +155,7 @@ static const struct object_ops named_pipe_ops = /* common server and client pipe end functions */ static enum server_fd_type pipe_end_get_fd_type( struct fd *fd ); static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); -static obj_handle_t pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); +static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static void pipe_end_queue_async( struct fd *fd, struct async *async, int type, int count ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); @@ -830,12 +830,11 @@ static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) return 1; } -static obj_handle_t pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) +static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct pipe_end *write_end = get_fd_user( fd ); struct pipe_end *read_end = write_end->connection; struct pipe_message *message; - obj_handle_t handle = 0; if (!use_server_io( write_end )) return no_fd_write( fd, async, pos ); @@ -846,13 +845,8 @@ static obj_handle_t pipe_end_write( struct fd *fd, struct async *async, file_pos } if (!write_end->write_q && !(write_end->write_q = create_async_queue( fd ))) return 0; - if (!(handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 ))) return 0; - if (!(message = mem_alloc( sizeof(*message) ))) - { - close_handle( current->process, handle ); - return 0; - } + if (!(message = mem_alloc( sizeof(*message) ))) return 0; message->async = (struct async *)grab_object( async ); message->iosb = async_get_iosb( async ); message->read_pos = 0; @@ -861,19 +855,7 @@ static obj_handle_t pipe_end_write( struct fd *fd, struct async *async, file_pos queue_async( write_end->write_q, async ); reselect_write_queue( write_end ); set_error( STATUS_PENDING ); - - if (!async_is_blocking( async )) - { - struct iosb *iosb; - iosb = async_get_iosb( async ); - if (iosb->status == STATUS_PENDING) - { - close_handle( current->process, handle ); - handle = 0; - } - release_object( iosb ); - } - return handle; + return 1; } static void pipe_end_queue_async( struct fd *fd, struct async *async, int type, int count )
1
0
0
0
Jacek Caban : server: Return async result directly instead of via APCs if it's available.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 879d46e45644147a14269bf46829b44c2a374ad3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=879d46e45644147a14269bf46…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:18:08 2017 +0200 server: Return async result directly instead of via APCs if it's available. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 5 ++++ server/async.c | 76 +++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 5329c79..3d9840f 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -580,6 +580,11 @@ static NTSTATUS server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE a status = wine_server_call( req ); wait_handle = wine_server_ptr_handle( reply->wait ); options = reply->options; + if (wait_handle && status != STATUS_PENDING) + { + io->u.Status = status; + io->Information = wine_server_reply_size( reply ); + } } SERVER_END_REQ; diff --git a/server/async.c b/server/async.c index f50cdc5..7f2bcf5 100644 --- a/server/async.c +++ b/server/async.c @@ -49,6 +49,7 @@ struct async async_data_t data; /* data for async I/O call */ struct iosb *iosb; /* I/O status block */ obj_handle_t wait_handle; /* pre-allocated wait handle */ + int direct_result; /* a flag if we're passing result directly from request instead of APC */ }; static void async_dump( struct object *obj, int verbose ); @@ -138,6 +139,12 @@ static void async_satisfied( struct object *obj, struct wait_queue_entry *entry struct async *async = (struct async *)obj; assert( obj->ops == &async_ops ); + if (async->direct_result) + { + async_set_result( &async->obj, async->iosb->status, async->iosb->result ); + async->direct_result = 0; + } + /* close wait handle here to avoid extra server round trip */ if (async->wait_handle) { @@ -195,18 +202,21 @@ void async_terminate( struct async *async, unsigned int status ) async->status = status; if (async->iosb && async->iosb->status == STATUS_PENDING) async->iosb->status = status; - if (async->data.user) + if (!async->direct_result) { - apc_call_t data; - - memset( &data, 0, sizeof(data) ); - data.type = APC_ASYNC_IO; - data.async_io.user = async->data.user; - data.async_io.sb = async->data.iosb; - data.async_io.status = status; - thread_queue_apc( async->thread, &async->obj, &data ); + if (async->data.user) + { + apc_call_t data; + + memset( &data, 0, sizeof(data) ); + data.type = APC_ASYNC_IO; + data.async_io.user = async->data.user; + data.async_io.sb = async->data.iosb; + data.async_io.status = status; + thread_queue_apc( async->thread, &async->obj, &data ); + } + else async_set_result( &async->obj, STATUS_SUCCESS, 0 ); } - else async_set_result( &async->obj, STATUS_SUCCESS, 0 ); async_reselect( async ); if (async->queue) release_object( async ); /* so that it gets destroyed when the async is done */ @@ -270,14 +280,15 @@ struct async *create_async( struct thread *thread, const async_data_t *data, str return NULL; } - async->thread = (struct thread *)grab_object( thread ); - async->event = event; - async->status = STATUS_PENDING; - async->data = *data; - async->timeout = NULL; - async->queue = NULL; - async->signaled = 0; - async->wait_handle = 0; + async->thread = (struct thread *)grab_object( thread ); + async->event = event; + async->status = STATUS_PENDING; + async->data = *data; + async->timeout = NULL; + async->queue = NULL; + async->signaled = 0; + async->wait_handle = 0; + async->direct_result = 0; if (iosb) async->iosb = (struct iosb *)grab_object( iosb ); else async->iosb = NULL; @@ -307,6 +318,7 @@ struct async *create_request_async( struct thread *thread, const async_data_t *d release_object( async ); return NULL; } + async->direct_result = 1; } return async; } @@ -321,12 +333,25 @@ obj_handle_t async_handoff( struct async *async, int success ) return 0; } - if (async->iosb->status == STATUS_PENDING && !async_is_blocking( async )) + if (async->iosb->status != STATUS_PENDING) { - close_handle( async->thread->process, async->wait_handle); - async->wait_handle = 0; + if (async->iosb->out_data) + { + set_reply_data_ptr( async->iosb->out_data, async->iosb->out_size ); + async->iosb->out_data = NULL; + } + async->signaled = 1; + } + else + { + async->direct_result = 0; + if (!async_is_blocking( async )) + { + close_handle( async->thread->process, async->wait_handle); + async->wait_handle = 0; + } } - set_error( STATUS_PENDING ); + set_error( async->iosb->status ); return async->wait_handle; } @@ -399,8 +424,11 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota } if (async->event) set_event( async->event ); else if (async->queue && async->queue->fd) set_fd_signaled( async->queue->fd, 1 ); - async->signaled = 1; - wake_up( &async->obj, 0 ); + if (!async->signaled) + { + async->signaled = 1; + wake_up( &async->obj, 0 ); + } } }
1
0
0
0
Jacek Caban : server: Close async wait handle when wait is satisfied.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 0e0834ae92291e9857ed01f3cb116240abda642b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0e0834ae92291e9857ed01f3c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:17:51 2017 +0200 server: Close async wait handle when wait is satisfied. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 1 - server/async.c | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index fd5a690..5329c79 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -589,7 +589,6 @@ static NTSTATUS server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE a { NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL ); status = io->u.Status; - NtClose( wait_handle ); } return status; diff --git a/server/async.c b/server/async.c index 4c6c6a9..f50cdc5 100644 --- a/server/async.c +++ b/server/async.c @@ -53,6 +53,7 @@ struct async static void async_dump( struct object *obj, int verbose ); static int async_signaled( struct object *obj, struct wait_queue_entry *entry ); +static void async_satisfied( struct object * obj, struct wait_queue_entry *entry ); static void async_destroy( struct object *obj ); static const struct object_ops async_ops = @@ -63,7 +64,7 @@ static const struct object_ops async_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ async_signaled, /* signaled */ - no_satisfied, /* satisfied */ + async_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ no_map_access, /* map_access */ @@ -132,6 +133,19 @@ static int async_signaled( struct object *obj, struct wait_queue_entry *entry ) return async->signaled; } +static void async_satisfied( struct object *obj, struct wait_queue_entry *entry ) +{ + struct async *async = (struct async *)obj; + assert( obj->ops == &async_ops ); + + /* close wait handle here to avoid extra server round trip */ + if (async->wait_handle) + { + close_handle( async->thread->process, async->wait_handle ); + async->wait_handle = 0; + } +} + static void async_destroy( struct object *obj ) { struct async *async = (struct async *)obj; @@ -300,7 +314,6 @@ struct async *create_request_async( struct thread *thread, const async_data_t *d /* return async object status and wait handle to client */ obj_handle_t async_handoff( struct async *async, int success ) { - obj_handle_t handle; if (!success) { close_handle( async->thread->process, async->wait_handle ); @@ -313,10 +326,8 @@ obj_handle_t async_handoff( struct async *async, int success ) close_handle( async->thread->process, async->wait_handle); async->wait_handle = 0; } - handle = async->wait_handle; - async->wait_handle = 0; set_error( STATUS_PENDING ); - return handle; + return async->wait_handle; } /* set the timeout of an async operation */
1
0
0
0
Jacek Caban : server: Preallocate wait handle in create_request_async and return it in read request.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 0fb6099b01df30a7bb55112fa1d29a079570cb8a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0fb6099b01df30a7bb55112fa…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 26 12:17:36 2017 +0200 server: Preallocate wait handle in create_request_async and return it in read request. alloc_handle is failable and when we're returning the handle, handling error properly is not really possible. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/async.c | 35 ++++++++++++++++++++++++++++++++++- server/device.c | 19 ++++++++++--------- server/fd.c | 4 ++-- server/file.h | 5 +++-- server/named_pipe.c | 20 +++----------------- 5 files changed, 52 insertions(+), 31 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=0fb6099b01df30a7bb551…
1
0
0
0
Alexandre Julliard : server: Call the satisfied methods after removing the thread wait.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: e0760ce933c4216bdb388a832be6792dccd7784c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e0760ce933c4216bdb388a832…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 28 12:23:00 2017 +0200 server: Call the satisfied methods after removing the thread wait. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/thread.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/server/thread.c b/server/thread.c index 10a5bf1..70f5f28 100644 --- a/server/thread.c +++ b/server/thread.c @@ -583,7 +583,7 @@ void make_wait_abandoned( struct wait_queue_entry *entry ) } /* finish waiting */ -static void end_wait( struct thread *thread ) +static unsigned int end_wait( struct thread *thread, unsigned int status ) { struct thread_wait *wait = thread->wait; struct wait_queue_entry *entry; @@ -591,10 +591,26 @@ static void end_wait( struct thread *thread ) assert( wait ); thread->wait = wait->next; + + if (status < wait->count) /* wait satisfied, tell it to the objects */ + { + if (wait->select == SELECT_WAIT_ALL) + { + for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) + entry->obj->ops->satisfied( entry->obj, entry ); + } + else + { + entry = wait->queues + status; + entry->obj->ops->satisfied( entry->obj, entry ); + } + if (wait->abandoned) status += STATUS_ABANDONED_WAIT_0; + } for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) entry->obj->ops->remove_queue( entry->obj, entry ); if (wait->user) remove_timeout_user( wait->user ); free( wait ); + return status; } /* build the thread wait structure */ @@ -624,7 +640,7 @@ static int wait_on( const select_op_t *select_op, unsigned int count, struct obj if (!obj->ops->add_queue( obj, entry )) { wait->count = i; - end_wait( current ); + end_wait( current, get_error() ); return 0; } } @@ -672,25 +688,14 @@ static int check_wait( struct thread *thread ) * want to do something when signaled, even if others are not */ for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) not_ok |= !entry->obj->ops->signaled( entry->obj, entry ); - if (not_ok) goto other_checks; - /* Wait satisfied: tell it to all objects */ - for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) - entry->obj->ops->satisfied( entry->obj, entry ); - return wait->abandoned ? STATUS_ABANDONED_WAIT_0 : STATUS_WAIT_0; + if (!not_ok) return STATUS_WAIT_0; } else { for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) - { - if (!entry->obj->ops->signaled( entry->obj, entry )) continue; - /* Wait satisfied: tell it to the object */ - entry->obj->ops->satisfied( entry->obj, entry ); - if (wait->abandoned) i += STATUS_ABANDONED_WAIT_0; - return i; - } + if (entry->obj->ops->signaled( entry->obj, entry )) return i; } - other_checks: if ((wait->flags & SELECT_ALERTABLE) && !list_empty(&thread->user_apc)) return STATUS_USER_APC; if (wait->timeout <= current_time) return STATUS_TIMEOUT; return -1; @@ -728,8 +733,8 @@ int wake_thread( struct thread *thread ) if ((signaled = check_wait( thread )) == -1) break; cookie = thread->wait->cookie; + signaled = end_wait( thread, signaled ); if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d\n", thread->id, signaled ); - end_wait( thread ); if (cookie && send_thread_wakeup( thread, cookie, signaled ) == -1) /* error */ { if (!count) count = -1; @@ -752,13 +757,9 @@ int wake_thread_queue_entry( struct wait_queue_entry *entry ) assert( wait->select != SELECT_WAIT_ALL ); - signaled = entry - wait->queues; - entry->obj->ops->satisfied( entry->obj, entry ); - if (wait->abandoned) signaled += STATUS_ABANDONED_WAIT_0; - cookie = wait->cookie; + signaled = end_wait( thread, entry - wait->queues ); if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d\n", thread->id, signaled ); - end_wait( thread ); if (!cookie || send_thread_wakeup( thread, cookie, signaled ) != -1) wake_thread( thread ); /* check other waits too */ @@ -778,7 +779,7 @@ static void thread_timeout( void *ptr ) if (thread->suspend + thread->process->suspend > 0) return; /* suspended, ignore it */ if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=TIMEOUT\n", thread->id ); - end_wait( thread ); + end_wait( thread, STATUS_TIMEOUT ); assert( cookie ); if (send_thread_wakeup( thread, cookie, STATUS_TIMEOUT ) == -1) return; @@ -836,7 +837,7 @@ static timeout_t select_on( const select_op_t *select_op, data_size_t op_size, c { if (!signal_object( select_op->signal_and_wait.signal )) { - end_wait( current ); + end_wait( current, get_error() ); return timeout; } /* check if we woke ourselves up */ @@ -863,8 +864,7 @@ static timeout_t select_on( const select_op_t *select_op, data_size_t op_size, c if ((ret = check_wait( current )) != -1) { /* condition is already satisfied */ - end_wait( current ); - set_error( ret ); + set_error( end_wait( current, ret )); return timeout; } @@ -874,7 +874,7 @@ static timeout_t select_on( const select_op_t *select_op, data_size_t op_size, c if (!(current->wait->user = add_timeout_user( current->wait->timeout, thread_timeout, current->wait ))) { - end_wait( current ); + end_wait( current, get_error() ); return timeout; } } @@ -1106,7 +1106,7 @@ void kill_thread( struct thread *thread, int violent_death ) thread->id, thread->exit_code ); if (thread->wait) { - while (thread->wait) end_wait( thread ); + while (thread->wait) end_wait( thread, STATUS_THREAD_IS_TERMINATING ); send_thread_wakeup( thread, 0, thread->exit_code ); /* if it is waiting on the socket, we don't need to send a SIGQUIT */ violent_death = 0;
1
0
0
0
Alistair Leslie-Hughes : dmime: Add TRACE to IDirectMusicSegment8 QueryInterface.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: d5380f0d008ede8da5fdb403830c7345d93591ca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d5380f0d008ede8da5fdb4038…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Wed Jun 28 06:50:51 2017 +0000 dmime: Add TRACE to IDirectMusicSegment8 QueryInterface. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dmime/segment.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c index dd07971..ad8561f 100644 --- a/dlls/dmime/segment.c +++ b/dlls/dmime/segment.c @@ -46,6 +46,8 @@ static HRESULT WINAPI IDirectMusicSegment8Impl_QueryInterface(IDirectMusicSegmen { IDirectMusicSegment8Impl *This = impl_from_IDirectMusicSegment8(iface); + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface); + *ret_iface = NULL; if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDirectMusicSegment) ||
1
0
0
0
Alistair Leslie-Hughes : oledb32: Support DBTYPE_DBTIMESTAMP to DBTYPE_WSTR in DataConvert.
by Alexandre Julliard
28 Jun '17
28 Jun '17
Module: wine Branch: master Commit: 70d54d8c67d757ade9a2d2209de44ff2c4ff078d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=70d54d8c67d757ade9a2d2209…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Wed Jun 28 02:10:56 2017 +0000 oledb32: Support DBTYPE_DBTIMESTAMP to DBTYPE_WSTR in DataConvert. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oledb32/convert.c | 19 +++++++++++++++ dlls/oledb32/tests/convert.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index 91de291..7fa4c81 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -641,6 +641,25 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, } } break; + case DBTYPE_DBTIMESTAMP: + { + WCHAR szBuff[64]; + static const WCHAR format1[] = { + '%','0','4','d','-','%','0','2','d','-','%','0','2','d',' ','%','0','2','d',':','%','0','2','d', + ':','%','0','2','d', 0}; + static const WCHAR format2[] = { + '%','0','4','d','-','%','0','2','d','-','%','0','2','d',' ','%','0','2','d',':','%','0','2','d', + ':','%','0','2','d','.','%','0','9','d', 0}; + DBTIMESTAMP *ts = (DBTIMESTAMP *)src; + + if(ts->fraction == 0) + wsprintfW(szBuff, format1, ts->year, ts->month, ts->day, ts->hour, ts->minute, ts->second); + else + wsprintfW(szBuff, format2, ts->year, ts->month, ts->day, ts->hour, ts->minute, ts->second, ts->fraction ); + *d = SysAllocString(szBuff); + hr = *d ? S_OK : E_OUTOFMEMORY; + break; + } case DBTYPE_VARIANT: VariantInit(&tmp); if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_BSTR)) == S_OK) diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c index 813c72a..708471b 100644 --- a/dlls/oledb32/tests/convert.c +++ b/dlls/oledb32/tests/convert.c @@ -955,6 +955,10 @@ static void test_converttobstr(void) DBSTATUS dst_status; DBLENGTH dst_len; static const WCHAR ten[] = {'1','0',0}; + static const WCHAR tsW[] = {'2','0','1','3','-','0','5','-','1','4',' ','0','2',':','0','4',':','1','2',0}; + static const WCHAR ts1W[] = {'2','0','1','3','-','0','5','-','1','4',' ','0','2',':','0','4',':','1','2','.','0','0','0','0','0','0','0','0','3',0}; + static const WCHAR ts2W[] = {'2','0','1','3','-','0','5','-','1','4',' ','0','2',':','0','4',':','1','2','.','0','0','0','0','0','0','2','0','0',0}; + DBTIMESTAMP ts = {2013, 5, 14, 2, 4, 12, 0}; VARIANT v; BSTR b; @@ -1016,6 +1020,32 @@ static void test_converttobstr(void) ok(dst_status == DBSTATUS_S_ISNULL, "got %08x\n", dst_status); ok(dst_len == 33, "got %ld\n", dst_len); ok(dst == (void*)0x1234, "got %p\n", dst); + + dst_len = 0x1234; + hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_BSTR, 0, &dst_len, &ts, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == sizeof(BSTR), "got %ld\n", dst_len); + ok(!lstrcmpW(tsW, dst), "got %s\n", wine_dbgstr_w(dst)); + SysFreeString(dst); + + dst_len = 0x1234; + ts.fraction = 3; + hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_BSTR, 0, &dst_len, &ts, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == sizeof(BSTR), "got %ld\n", dst_len); + ok(!lstrcmpW(ts1W, dst), "got %s\n", wine_dbgstr_w(dst)); + SysFreeString(dst); + + dst_len = 0x1234; + ts.fraction = 200; + hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_BSTR, 0, &dst_len, &ts, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == sizeof(BSTR), "got %ld\n", dst_len); + ok(!lstrcmpW(ts2W, dst), "got %s\n", wine_dbgstr_w(dst)); + SysFreeString(dst); } static void test_converttowstr(void) @@ -1032,6 +1062,10 @@ static void test_converttowstr(void) 'A','D','E','5','-','0','0','A','A','0','0','4','4','7','7','3','D','}',0}; static const WCHAR hexunpacked_w[] = {'5','7','0','0','6','9','0','0','6','E','0','0','6','5','0','0','0','0','0','0', 0 }; static const WCHAR hexpacked_w[] = {'W','i','n','e', 0 }; + static const WCHAR tsW[] = {'2','0','1','3','-','0','5','-','1','4',' ','0','2',':','0','4',':','1','2',0}; + static const WCHAR ts1W[] = {'2','0','1','3','-','0','5','-','1','4',' ','0','2',':','0','4',':','1','2','.','0','0','0','0','0','0','0','0','3',0}; + static const WCHAR ts2W[] = {'2','0','1','3','-','0','5','-','1','4',' ','0','2',':','0','4',':','1','2','.','0','0','0','0','0','0','2','0','0',0}; + DBTIMESTAMP ts = {2013, 5, 14, 2, 4, 12, 0}; BSTR b; VARIANT v; @@ -1413,7 +1447,28 @@ static void test_converttowstr(void) ok(dst_len == 4, "got %ld\n", dst_len); ok(!lstrcmpW(ten, dst), "got %s\n", wine_dbgstr_w(dst)); + dst_len = 0x1234; + hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_WSTR, 0, &dst_len, &ts, dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 38, "got %ld\n", dst_len); + ok(!lstrcmpW(tsW, dst), "got %s\n", wine_dbgstr_w(dst)); + + dst_len = 0x1234; + ts.fraction = 3; + hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_WSTR, 0, &dst_len, &ts, dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 58, "got %ld\n", dst_len); + ok(!lstrcmpW(ts1W, dst), "got %s\n", wine_dbgstr_w(dst)); + dst_len = 0x1234; + ts.fraction = 200; + hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_WSTR, 0, &dst_len, &ts, dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 58, "got %ld\n", dst_len); + ok(!lstrcmpW(ts2W, dst), "got %s\n", wine_dbgstr_w(dst)); /* DBTYPE_BYTES to DBTYPE_*STR unpacks binary data into a hex string */ memcpy(src, hexpacked_w, sizeof(hexpacked_w));
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
60
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
Results per page:
10
25
50
100
200