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
November 2007
----- 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
3 participants
757 discussions
Start a n
N
ew thread
Andrey Turkin : server: Pass Information field from async I/O APCs.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 7a9210fa85c28dd1a5bba33c81beddbdd194e6ae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7a9210fa85c28dd1a5bba33c8…
Author: Andrey Turkin <andrey.turkin(a)gmail.com> Date: Sat Nov 10 01:12:16 2007 +0300 server: Pass Information field from async I/O APCs. --- dlls/ntdll/directory.c | 4 ++-- dlls/ntdll/file.c | 8 ++++---- dlls/ntdll/sync.c | 3 ++- dlls/ntdll/tests/file.c | 2 -- dlls/ws2_32/socket.c | 8 ++++---- include/wine/server_protocol.h | 5 +++-- server/async.c | 4 ++-- server/file.h | 2 +- server/protocol.def | 3 ++- server/thread.c | 2 +- 10 files changed, 21 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 981d2a1..0be9942 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -2254,7 +2254,7 @@ static void WINAPI read_changes_user_apc( void *arg, IO_STATUS_BLOCK *io, ULONG RtlFreeHeap( GetProcessHeap(), 0, info ); } -static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status ) +static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG_PTR *total ) { struct read_changes_info *info = user; char path[PATH_MAX]; @@ -2299,7 +2299,7 @@ static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS st } iosb->u.Status = ret; - iosb->Information = len; + iosb->Information = *total = len; return ret; } diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index e84bc3d..b9a763f 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -338,7 +338,7 @@ NTSTATUS FILE_GetNtStatus(void) /*********************************************************************** * FILE_AsyncReadService (INTERNAL) */ -static NTSTATUS FILE_AsyncReadService(void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status) +static NTSTATUS FILE_AsyncReadService(void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG_PTR *total) { async_fileio_read *fileio = user; int fd, needs_close, result; @@ -389,7 +389,7 @@ static NTSTATUS FILE_AsyncReadService(void *user, PIO_STATUS_BLOCK iosb, NTSTATU if (status != STATUS_PENDING) { iosb->u.Status = status; - iosb->Information = fileio->already; + iosb->Information = *total = fileio->already; } return status; } @@ -718,7 +718,7 @@ err: /*********************************************************************** * FILE_AsyncWriteService (INTERNAL) */ -static NTSTATUS FILE_AsyncWriteService(void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status) +static NTSTATUS FILE_AsyncWriteService(void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status, ULONG_PTR *total) { async_fileio_write *fileio = user; int result, fd, needs_close; @@ -759,7 +759,7 @@ static NTSTATUS FILE_AsyncWriteService(void *user, IO_STATUS_BLOCK *iosb, NTSTAT if (status != STATUS_PENDING) { iosb->u.Status = status; - iosb->Information = fileio->already; + iosb->Information = *total = fileio->already; } return status; } diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index ec8aa59..fd7630f 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -786,7 +786,8 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) result->type = call->type; result->async_io.status = call->async_io.func( call->async_io.user, call->async_io.sb, - call->async_io.status ); + call->async_io.status, + &result->async_io.total ); break; case APC_VIRTUAL_ALLOC: result->type = call->type; diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 5592711..8ea454c 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -524,9 +524,7 @@ static void test_iocp_fileio(HANDLE h) if (get_msg(h)) { ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); - todo_wine { ok( ioSb.Information == 3, "Invalid ioSb.Information: %ld\n", ioSb.Information ); - } ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); } diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index eab1550..3abb5a0 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1118,7 +1118,7 @@ static int WS2_recv( int fd, struct iovec* iov, int count, * * Handler for overlapped recv() operations. */ -static NTSTATUS WS2_async_recv( void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status) +static NTSTATUS WS2_async_recv( void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status, ULONG_PTR *total ) { ws2_async* wsa = user; int result = 0, fd; @@ -1155,7 +1155,7 @@ static NTSTATUS WS2_async_recv( void* user, IO_STATUS_BLOCK* iosb, NTSTATUS stat if (status != STATUS_PENDING) { iosb->u.Status = status; - iosb->Information = result; + iosb->Information = *total = result; } return status; } @@ -1222,7 +1222,7 @@ static int WS2_send( int fd, struct iovec* iov, int count, * * Handler for overlapped send() operations. */ -static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status) +static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status, ULONG_PTR *total ) { ws2_async* wsa = user; int result = 0, fd; @@ -1262,7 +1262,7 @@ static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS statu if (status != STATUS_PENDING) { iosb->u.Status = status; - iosb->Information = result; + iosb->Information = *total = result; } return status; } diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 8598aef..9c56089 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -271,7 +271,7 @@ typedef union struct { enum apc_type type; - unsigned int (*func)(void*, void*, unsigned int); + unsigned int (*func)(void*, void*, unsigned int, unsigned long *); void *user; void *sb; unsigned int status; @@ -356,6 +356,7 @@ typedef union { enum apc_type type; unsigned int status; + unsigned long total; } async_io; struct { @@ -4904,6 +4905,6 @@ union generic_reply struct add_fd_completion_reply add_fd_completion_reply; }; -#define SERVER_PROTOCOL_VERSION 330 +#define SERVER_PROTOCOL_VERSION 331 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/async.c b/server/async.c index 98d6075..acf61d8 100644 --- a/server/async.c +++ b/server/async.c @@ -231,7 +231,7 @@ void async_set_timeout( struct async *async, timeout_t timeout, unsigned int sta } /* store the result of the client-side async callback */ -void async_set_result( struct object *obj, unsigned int status ) +void async_set_result( struct object *obj, unsigned int status, unsigned long total ) { struct async *async = (struct async *)obj; @@ -256,7 +256,7 @@ void async_set_result( struct object *obj, unsigned int status ) async->timeout = NULL; async->status = status; if (async->data.cvalue && async->queue && async->queue->fd) - fd_add_completion( async->queue->fd, async->data.cvalue, status, 0 ); /* TODO pass Information field */ + fd_add_completion( async->queue->fd, async->data.cvalue, status, total ); if (async->data.apc) { apc_call_t data; diff --git a/server/file.h b/server/file.h index dbf0930..1c659be 100644 --- a/server/file.h +++ b/server/file.h @@ -136,7 +136,7 @@ extern void free_async_queue( struct async_queue *queue ); extern struct async *create_async( struct thread *thread, struct async_queue *queue, const async_data_t *data ); 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 ); +extern void async_set_result( struct object *obj, unsigned int status, unsigned long total ); extern int async_waiting( struct async_queue *queue ); extern void async_terminate( struct async *async, unsigned int status ); extern void async_wake_up( struct async_queue *queue, unsigned int status ); diff --git a/server/protocol.def b/server/protocol.def index cf3ffa1..dfb5d48 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -287,7 +287,7 @@ typedef union struct { enum apc_type type; /* APC_ASYNC_IO */ - unsigned int (*func)(void*, void*, unsigned int); + unsigned int (*func)(void*, void*, unsigned int, unsigned long *); void *user; /* user pointer */ void *sb; /* status block */ unsigned int status; /* I/O status */ @@ -372,6 +372,7 @@ typedef union { enum apc_type type; /* APC_ASYNC_IO */ unsigned int status; /* new status of async operation */ + unsigned long total; /* bytes transferred */ } async_io; struct { diff --git a/server/thread.c b/server/thread.c index 99cf896..6eb43ee 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1199,7 +1199,7 @@ DECL_HANDLER(select) } else if (apc->result.type == APC_ASYNC_IO) { - if (apc->owner) async_set_result( apc->owner, apc->result.async_io.status ); + if (apc->owner) async_set_result( apc->owner, apc->result.async_io.status, apc->result.async_io.total ); } wake_up( &apc->obj, 0 ); close_handle( current->process, req->prev_apc );
1
0
0
0
Andrey Turkin : ntdll: Make async i/ o functions generate completion messages.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 793453f768025789f791edbcee9299b4c5d73882 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=793453f768025789f791edbce…
Author: Andrey Turkin <andrey.turkin(a)gmail.com> Date: Sat Nov 10 01:12:07 2007 +0300 ntdll: Make async i/o functions generate completion messages. --- dlls/ntdll/directory.c | 3 ++- dlls/ntdll/file.c | 39 +++++++++++++++++++++++++++------------ dlls/ntdll/ntdll_misc.h | 3 +++ dlls/ntdll/sync.c | 16 ++++++++++++++++ dlls/ntdll/tests/file.c | 8 ++------ 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 6891949..981d2a1 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -2324,6 +2324,7 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event, { struct read_changes_info *info; NTSTATUS status; + ULONG_PTR cvalue = ApcRoutine ? 0 : (ULONG_PTR)ApcContext; TRACE("%p %p %p %p %p %p %u %u %d\n", FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, @@ -2356,7 +2357,7 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event, req->async.arg = info; req->async.apc = read_changes_user_apc; req->async.event = Event; - req->async.cvalue = 0; + req->async.cvalue = cvalue; status = wine_server_call( req ); } SERVER_END_REQ; diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index a3a4af1..e84bc3d 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -560,6 +560,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, NTSTATUS status; ULONG total = 0; enum server_fd_type type; + ULONG_PTR cvalue = apc ? 0 : (ULONG_PTR)apc_user; TRACE("(%p,%p,%p,%p,%p,%p,0x%08x,%p,%p),partial stub!\n", hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key); @@ -620,7 +621,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, BOOL avail_mode; if ((status = get_io_avail_mode( hFile, type, &avail_mode ))) - goto done; + goto err; if (total && avail_mode) { status = STATUS_SUCCESS; @@ -630,7 +631,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, if (!(fileio = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*fileio)))) { status = STATUS_NO_MEMORY; - goto done; + goto err; } fileio->io.handle = hFile; fileio->io.apc = apc; @@ -650,13 +651,13 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, req->async.arg = fileio; req->async.apc = fileio_apc; req->async.event = hEvent; - req->async.cvalue = 0; + req->async.cvalue = cvalue; status = wine_server_call( req ); } SERVER_END_REQ; if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio ); - goto done; + goto err; } else /* synchronous read, wait for the fd to become ready */ { @@ -667,7 +668,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, { timeout_init_done = 1; if ((status = get_io_timeouts( hFile, type, length, TRUE, &timeouts ))) - goto done; + goto err; if (hEvent) NtResetEvent( hEvent, NULL ); } timeout = get_next_io_timeout( &timeouts, total ); @@ -693,6 +694,9 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, } done: + if (cvalue) NTDLL_AddCompletion( hFile, cvalue, status, total ); + +err: if (needs_close) close( unix_handle ); if (status == STATUS_SUCCESS) { @@ -794,6 +798,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, NTSTATUS status; ULONG total = 0; enum server_fd_type type; + ULONG_PTR cvalue = apc ? 0 : (ULONG_PTR)apc_user; TRACE("(%p,%p,%p,%p,%p,%p,0x%08x,%p,%p)!\n", hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key); @@ -848,8 +853,12 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, if (errno == EINTR) continue; if (errno != EAGAIN) { - if (errno == EFAULT) status = STATUS_INVALID_USER_BUFFER; - else status = FILE_GetNtStatus(); + if (errno == EFAULT) + { + status = STATUS_INVALID_USER_BUFFER; + goto err; + } + status = FILE_GetNtStatus(); goto done; } } @@ -861,7 +870,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, if (!(fileio = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*fileio)))) { status = STATUS_NO_MEMORY; - goto done; + goto err; } fileio->io.handle = hFile; fileio->io.apc = apc; @@ -880,13 +889,13 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, req->async.arg = fileio; req->async.apc = fileio_apc; req->async.event = hEvent; - req->async.cvalue = 0; + req->async.cvalue = cvalue; status = wine_server_call( req ); } SERVER_END_REQ; if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio ); - goto done; + goto err; } else /* synchronous write, wait for the fd to become ready */ { @@ -897,7 +906,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, { timeout_init_done = 1; if ((status = get_io_timeouts( hFile, type, length, FALSE, &timeouts ))) - goto done; + goto err; if (hEvent) NtResetEvent( hEvent, NULL ); } timeout = get_next_io_timeout( &timeouts, total ); @@ -921,6 +930,9 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, } done: + if (cvalue) NTDLL_AddCompletion( hFile, cvalue, status, total ); + +err: if (needs_close) close( unix_handle ); if (status == STATUS_SUCCESS) { @@ -989,6 +1001,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event, NTSTATUS status; HANDLE wait_handle; ULONG options; + ULONG_PTR cvalue = apc ? 0 : (ULONG_PTR)apc_context; if (!(async = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*async) ))) return STATUS_NO_MEMORY; @@ -1007,7 +1020,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event, req->async.arg = async; req->async.apc = (apc || event) ? ioctl_apc : NULL; req->async.event = event; - req->async.cvalue = 0; + req->async.cvalue = cvalue; wine_server_add_data( req, in_buffer, in_size ); wine_server_set_reply( req, out_buffer, out_size ); if (!(status = wine_server_call( req ))) @@ -2127,6 +2140,8 @@ NTSTATUS WINAPI NtLockFile( HANDLE hFile, HANDLE lock_granted_event, return STATUS_NOT_IMPLEMENTED; } + if (apc_user) FIXME("I/O completion on lock not implemented yet\n"); + for (;;) { SERVER_START_REQ( lock_file ) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 405f348..c283e1e 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -198,4 +198,7 @@ static inline struct ntdll_thread_regs *ntdll_get_thread_regs(void) return (struct ntdll_thread_regs *)NtCurrentTeb()->SpareBytes1; } +/* Completion */ +extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG_PTR Information ); + #endif diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 47c8461..ec8aa59 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -1310,3 +1310,19 @@ NTSTATUS WINAPI NtQueryIoCompletion( HANDLE CompletionPort, IO_COMPLETION_INFORM } return status; } + +NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG_PTR Information ) +{ + NTSTATUS status; + + SERVER_START_REQ( add_fd_completion ) + { + req->handle = hFile; + req->cvalue = CompletionValue; + req->status = CompletionStatus; + req->information = Information; + status = wine_server_call( req ); + } + SERVER_END_REQ; + return status; +} diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index eb3bc8c..5592711 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -521,15 +521,15 @@ static void test_iocp_fileio(HANDLE h) ok( !count, "Unexpected msg count: %ld\n", count ); WriteFile( hPipeClt, buf, 3, &read, NULL ); - todo_wine { if (get_msg(h)) { ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); + todo_wine { ok( ioSb.Information == 3, "Invalid ioSb.Information: %ld\n", ioSb.Information ); + } ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); } - } count = get_pending_msgs(h); ok( !count, "Unexpected msg count: %ld\n", count ); @@ -538,10 +538,7 @@ static void test_iocp_fileio(HANDLE h) ok( !count, "Unexpected msg count: %ld\n", count ); ReadFile( hPipeSrv, buf, 2, &read, &o); count = get_pending_msgs(h); - todo_wine { ok( count == 1, "Unexpected msg count: %ld\n", count ); - } - todo_wine { if (get_msg(h)) { ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); @@ -549,7 +546,6 @@ static void test_iocp_fileio(HANDLE h) ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); } - } } CloseHandle( hPipeSrv );
1
0
0
0
Andrey Turkin : ws2_32: Make certain winsock functions generate i/ o completion messages.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 27cb7c72747507d495e3547d920b3330e24e1da9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=27cb7c72747507d495e3547d9…
Author: Andrey Turkin <andrey.turkin(a)gmail.com> Date: Sat Nov 10 01:11:58 2007 +0300 ws2_32: Make certain winsock functions generate i/o completion messages. --- dlls/ws2_32/socket.c | 26 ++++++++++++++++++++++++-- include/wine/server_protocol.h | 20 +++++++++++++++++++- server/fd.c | 11 +++++++++++ server/protocol.def | 9 +++++++++ server/request.h | 2 ++ server/trace.c | 11 +++++++++++ 6 files changed, 76 insertions(+), 3 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 5d51311..eab1550 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2562,6 +2562,22 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds, return ret; } +/* helper to send completion messages for client-only i/o operation case */ +static void WS_AddCompletion( SOCKET sock, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG_PTR Information ) +{ + NTSTATUS status; + + SERVER_START_REQ( add_fd_completion ) + { + req->handle = SOCKET2HANDLE(sock); + req->cvalue = CompletionValue; + req->status = CompletionStatus; + req->information = Information; + status = wine_server_call( req ); + } + SERVER_END_REQ; +} + /*********************************************************************** * send (WS2_32.19) @@ -2613,6 +2629,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, unsigned int i, options; int n, fd, err; struct iovec iovec[WS_MSG_MAXIOVLEN]; + ULONG_PTR cvalue = (lpOverlapped && ((ULONG_PTR)lpOverlapped->hEvent & 1) == 0) ? (ULONG_PTR)lpOverlapped : 0; TRACE("socket %04lx, wsabuf %p, nbufs %d, flags %d, to %p, tolen %d, ovl %p, func %p\n", s, lpBuffers, dwBufferCount, dwFlags, @@ -2649,6 +2666,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, if (n == -1 && errno != EAGAIN) { err = wsaErrno(); + if (cvalue) WS_AddCompletion( s, cvalue, err, 0 ); goto error; } @@ -2689,7 +2707,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, req->async.arg = wsa; req->async.apc = ws2_async_apc; req->async.event = lpCompletionRoutine ? 0 : lpOverlapped->hEvent; - req->async.cvalue = 0; + req->async.cvalue = cvalue; err = wine_server_call( req ); } SERVER_END_REQ; @@ -2704,6 +2722,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, *lpNumberOfBytesSent = n; if (!wsa->completion_func) { + if (cvalue) WS_AddCompletion( s, cvalue, STATUS_SUCCESS, n ); SetEvent( lpOverlapped->hEvent ); HeapFree( GetProcessHeap(), 0, wsa ); } @@ -4127,6 +4146,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, int n, fd, err; DWORD timeout_start = GetTickCount(); struct iovec iovec[WS_MSG_MAXIOVLEN]; + ULONG_PTR cvalue = (lpOverlapped && ((ULONG_PTR)lpOverlapped->hEvent & 1) == 0) ? (ULONG_PTR)lpOverlapped : 0; TRACE("socket %04lx, wsabuf %p, nbufs %d, flags %d, from %p, fromlen %d, ovl %p, func %p\n", s, lpBuffers, dwBufferCount, *lpFlags, lpFrom, @@ -4159,6 +4179,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, if (errno != EAGAIN) { err = wsaErrno(); + if (cvalue) WS_AddCompletion( s, cvalue, err, 0 ); goto error; } } @@ -4203,7 +4224,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, req->async.arg = wsa; req->async.apc = ws2_async_apc; req->async.event = lpCompletionRoutine ? 0 : lpOverlapped->hEvent; - req->async.cvalue = 0; + req->async.cvalue = cvalue; err = wine_server_call( req ); } SERVER_END_REQ; @@ -4217,6 +4238,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, iosb->Information = n; if (!wsa->completion_func) { + if (cvalue) WS_AddCompletion( s, cvalue, STATUS_SUCCESS, n ); SetEvent( lpOverlapped->hEvent ); HeapFree( GetProcessHeap(), 0, wsa ); } diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 410b802..8598aef 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -4189,6 +4189,21 @@ struct set_completion_info_reply }; + +struct add_fd_completion_request +{ + struct request_header __header; + obj_handle_t handle; + unsigned long cvalue; + unsigned int status; + unsigned long information; +}; +struct add_fd_completion_reply +{ + struct reply_header __header; +}; + + enum request { REQ_new_process, @@ -4418,6 +4433,7 @@ enum request REQ_remove_completion, REQ_query_completion, REQ_set_completion_info, + REQ_add_fd_completion, REQ_NB_REQUESTS }; @@ -4652,6 +4668,7 @@ union generic_request struct remove_completion_request remove_completion_request; struct query_completion_request query_completion_request; struct set_completion_info_request set_completion_info_request; + struct add_fd_completion_request add_fd_completion_request; }; union generic_reply { @@ -4884,8 +4901,9 @@ union generic_reply struct remove_completion_reply remove_completion_reply; struct query_completion_reply query_completion_reply; struct set_completion_info_reply set_completion_info_reply; + struct add_fd_completion_reply add_fd_completion_reply; }; -#define SERVER_PROTOCOL_VERSION 329 +#define SERVER_PROTOCOL_VERSION 330 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/fd.c b/server/fd.c index cb3aea8..4bfb3e1 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2056,3 +2056,14 @@ DECL_HANDLER(set_completion_info) release_object( fd ); } } + +/* push new completion msg into a completion queue attached to the fd */ +DECL_HANDLER(add_fd_completion) +{ + struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 ); + if (fd) + { + fd_add_completion( fd, req->cvalue, req->status, req->information ); + release_object( fd ); + } +} diff --git a/server/protocol.def b/server/protocol.def index 93e4887..cf3ffa1 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3006,3 +3006,12 @@ enum message_type obj_handle_t chandle; /* port handle */ unsigned long ckey; /* completion key */ @END + + +/* check for associated completion and push msg */ +@REQ(add_fd_completion) + obj_handle_t handle; /* async' object */ + unsigned long cvalue; /* completion value */ + unsigned int status; /* completion status */ + unsigned long information; /* IO_STATUS_BLOCK Information */ +@END diff --git a/server/request.h b/server/request.h index 90ec2e1..cd53e16 100644 --- a/server/request.h +++ b/server/request.h @@ -337,6 +337,7 @@ DECL_HANDLER(add_completion); DECL_HANDLER(remove_completion); DECL_HANDLER(query_completion); DECL_HANDLER(set_completion_info); +DECL_HANDLER(add_fd_completion); #ifdef WANT_REQUEST_HANDLERS @@ -570,6 +571,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = (req_handler)req_remove_completion, (req_handler)req_query_completion, (req_handler)req_set_completion_info, + (req_handler)req_add_fd_completion, }; #endif /* WANT_REQUEST_HANDLERS */ diff --git a/server/trace.c b/server/trace.c index 7275e65..c580139 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3698,6 +3698,14 @@ static void dump_set_completion_info_request( const struct set_completion_info_r fprintf( stderr, " ckey=%lx", req->ckey ); } +static void dump_add_fd_completion_request( const struct add_fd_completion_request *req ) +{ + fprintf( stderr, " handle=%p,", req->handle ); + fprintf( stderr, " cvalue=%lx,", req->cvalue ); + fprintf( stderr, " status=%08x,", req->status ); + fprintf( stderr, " information=%lx", req->information ); +} + static const dump_func req_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_new_process_request, (dump_func)dump_get_new_process_info_request, @@ -3926,6 +3934,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_remove_completion_request, (dump_func)dump_query_completion_request, (dump_func)dump_set_completion_info_request, + (dump_func)dump_add_fd_completion_request, }; static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { @@ -4156,6 +4165,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_remove_completion_reply, (dump_func)dump_query_completion_reply, (dump_func)0, + (dump_func)0, }; static const char * const req_names[REQ_NB_REQUESTS] = { @@ -4386,6 +4396,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { "remove_completion", "query_completion", "set_completion_info", + "add_fd_completion", }; static const struct
1
0
0
0
Andrey Turkin : server: Allow async i/ o operations to send completion messages.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: c702a91a3ca605637577281f78a1dc61dd067e06 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c702a91a3ca605637577281f7…
Author: Andrey Turkin <andrey.turkin(a)gmail.com> Date: Sat Nov 10 01:11:48 2007 +0300 server: Allow async i/o operations to send completion messages. --- dlls/ntdll/directory.c | 1 + dlls/ntdll/file.c | 26 ++++++++++++++++++++++---- dlls/ws2_32/socket.c | 3 +++ include/wine/server_protocol.h | 3 ++- server/async.c | 6 ++++++ server/completion.c | 2 +- server/fd.c | 7 +++++++ server/file.h | 4 +++- server/protocol.def | 1 + 9 files changed, 46 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 9288d31..6891949 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -2356,6 +2356,7 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event, req->async.arg = info; req->async.apc = read_changes_user_apc; req->async.event = Event; + req->async.cvalue = 0; status = wine_server_call( req ); } SERVER_END_REQ; diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 7b64b67..a3a4af1 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -650,6 +650,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, req->async.arg = fileio; req->async.apc = fileio_apc; req->async.event = hEvent; + req->async.cvalue = 0; status = wine_server_call( req ); } SERVER_END_REQ; @@ -879,6 +880,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, req->async.arg = fileio; req->async.apc = fileio_apc; req->async.event = hEvent; + req->async.cvalue = 0; status = wine_server_call( req ); } SERVER_END_REQ; @@ -1005,6 +1007,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event, req->async.arg = async; req->async.apc = (apc || event) ? ioctl_apc : NULL; req->async.event = event; + req->async.cvalue = 0; wine_server_add_data( req, in_buffer, in_size ); wine_server_set_reply( req, out_buffer, out_size ); if (!(status = wine_server_call( req ))) @@ -1061,7 +1064,7 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, PVOID out_buffer, ULONG out_size) { ULONG device = (code >> 16); - NTSTATUS status; + NTSTATUS status = STATUS_NOT_SUPPORTED; TRACE("(%p,%p,%p,%p,%p,0x%08x,%p,0x%08x,%p,0x%08x)\n", handle, event, apc, apc_context, io, code, @@ -1085,11 +1088,12 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, status = TAPE_DeviceIoControl(handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size); break; - default: + } + + if (status == STATUS_NOT_SUPPORTED) status = server_ioctl_file( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size ); - break; - } + if (status != STATUS_PENDING) io->u.Status = status; return status; } @@ -1807,6 +1811,16 @@ static inline void get_device_info_fstatfs( FILE_FS_DEVICE_INFORMATION *info, co } #endif +static inline int is_device_placeholder( int fd ) +{ + static const char wine_placeholder[] = "Wine device placeholder"; + char buffer[sizeof(wine_placeholder)-1]; + + if (pread( fd, buffer, sizeof(wine_placeholder) - 1, 0 ) != sizeof(wine_placeholder) - 1) + return 0; + return !memcmp( buffer, wine_placeholder, sizeof(wine_placeholder) - 1 ); +} + /****************************************************************************** * get_device_info * @@ -1847,6 +1861,10 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info ) { info->DeviceType = FILE_DEVICE_NAMED_PIPE; } + else if (is_device_placeholder( fd )) + { + info->DeviceType = FILE_DEVICE_DISK; + } else /* regular file or directory */ { #if defined(linux) && defined(HAVE_FSTATFS) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index f4111cd..5d51311 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1324,6 +1324,7 @@ static int WS2_register_async_shutdown( SOCKET s, int type ) req->async.iosb = &wsa->local_iosb; req->async.arg = wsa; req->async.apc = ws2_async_apc; + req->async.cvalue = 0; status = wine_server_call( req ); } SERVER_END_REQ; @@ -2688,6 +2689,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, req->async.arg = wsa; req->async.apc = ws2_async_apc; req->async.event = lpCompletionRoutine ? 0 : lpOverlapped->hEvent; + req->async.cvalue = 0; err = wine_server_call( req ); } SERVER_END_REQ; @@ -4201,6 +4203,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, req->async.arg = wsa; req->async.apc = ws2_async_apc; req->async.event = lpCompletionRoutine ? 0 : lpOverlapped->hEvent; + req->async.cvalue = 0; err = wine_server_call( req ); } SERVER_END_REQ; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 913f2a1..410b802 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -163,6 +163,7 @@ typedef struct void *arg; void *apc; obj_handle_t event; + unsigned long cvalue; } async_data_t; @@ -4885,6 +4886,6 @@ union generic_reply struct set_completion_info_reply set_completion_info_reply; }; -#define SERVER_PROTOCOL_VERSION 328 +#define SERVER_PROTOCOL_VERSION 329 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/async.c b/server/async.c index 3a99f80..98d6075 100644 --- a/server/async.c +++ b/server/async.c @@ -144,6 +144,10 @@ void async_terminate( struct async *async, unsigned int status ) return; } + /* send error completion event */ + if (status != STATUS_ALERTED && async->data.cvalue && async->queue && async->queue->fd) + fd_add_completion( async->queue->fd, async->data.cvalue, status, 0 ); + memset( &data, 0, sizeof(data) ); data.type = APC_ASYNC_IO; data.async_io.func = async->data.callback; @@ -251,6 +255,8 @@ void async_set_result( struct object *obj, unsigned int status ) if (async->timeout) remove_timeout_user( async->timeout ); async->timeout = NULL; async->status = status; + if (async->data.cvalue && async->queue && async->queue->fd) + fd_add_completion( async->queue->fd, async->data.cvalue, status, 0 ); /* TODO pass Information field */ if (async->data.apc) { apc_call_t data; diff --git a/server/completion.c b/server/completion.c index bff2ada..96aaacc 100644 --- a/server/completion.c +++ b/server/completion.c @@ -132,7 +132,7 @@ struct completion *get_completion_obj( struct process *process, obj_handle_t han return (struct completion *) get_handle_obj( process, handle, access, &completion_ops ); } -static void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information ) +void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information ) { struct comp_msg *msg = mem_alloc( sizeof( *msg ) ); diff --git a/server/fd.c b/server/fd.c index dc292cb..cb3aea8 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1919,6 +1919,13 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl return fd; } +/* add a completion result to a completion queue attached to the fd */ +void fd_add_completion( struct fd *fd, unsigned long cvalue, unsigned int status, unsigned long information ) +{ + if (fd->completion) + add_completion( fd->completion, fd->comp_key, cvalue, status, information ); +} + /* flush a file buffers */ DECL_HANDLER(flush_file) { diff --git a/server/file.h b/server/file.h index d6295d9..dbf0930 100644 --- a/server/file.h +++ b/server/file.h @@ -122,7 +122,8 @@ extern struct object *create_dir_obj( struct fd *fd ); /* completion */ -struct completion *get_completion_obj( struct process *process, obj_handle_t handle, unsigned int access ); +extern struct completion *get_completion_obj( struct process *process, obj_handle_t handle, unsigned int access ); +extern void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information ); /* serial port functions */ @@ -139,6 +140,7 @@ extern void async_set_result( struct object *obj, unsigned int status ); extern int async_waiting( struct async_queue *queue ); extern void async_terminate( struct async *async, unsigned int status ); extern void async_wake_up( struct async_queue *queue, unsigned int status ); +extern void fd_add_completion( struct fd *fd, unsigned long cvalue, unsigned int status, unsigned long information ); /* access rights that require Unix read permission */ #define FILE_UNIX_READ_ACCESS (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA) diff --git a/server/protocol.def b/server/protocol.def index 90e943b..93e4887 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -179,6 +179,7 @@ typedef struct void *arg; /* opaque user data to pass to callback */ void *apc; /* user apc to call */ obj_handle_t event; /* event to signal when done */ + unsigned long cvalue; /* completion value to use for completion events */ } async_data_t; /* structures for extra message data */
1
0
0
0
Andrey Turkin : ntdll: Add some I/O completion tests.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 074281ff6c50bfb1be3d7229bc7042683d56137e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=074281ff6c50bfb1be3d7229b…
Author: Andrey Turkin <andrey.turkin(a)gmail.com> Date: Sat Nov 10 01:11:31 2007 +0300 ntdll: Add some I/O completion tests. --- dlls/ntdll/tests/file.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 157 insertions(+), 0 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index f182719..eb3bc8c 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1,6 +1,7 @@ /* Unit test suite for Ntdll file functions * * Copyright 2007 Jeff Latimer + * Copyright 2007 Andrey Turkin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,6 +34,10 @@ #include "wine/test.h" #include "winternl.h" +#ifndef IO_COMPLETION_ALL_ACCESS +#define IO_COMPLETION_ALL_ACCESS 0x001F0003 +#endif + static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR ); static VOID (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); static NTSTATUS (WINAPI *pNtCreateMailslotFile)( PHANDLE, ULONG, POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK, @@ -48,6 +53,13 @@ static NTSTATUS (WINAPI *pNtWriteFile)(HANDLE hFile, HANDLE hEvent, PLARGE_INTEGER offset, PULONG key); static NTSTATUS (WINAPI *pNtClose)( PHANDLE ); +static NTSTATUS (WINAPI *pNtCreateIoCompletion)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, ULONG); +static NTSTATUS (WINAPI *pNtOpenIoCompletion)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES); +static NTSTATUS (WINAPI *pNtQueryIoCompletion)(HANDLE, IO_COMPLETION_INFORMATION_CLASS, PVOID, ULONG, PULONG); +static NTSTATUS (WINAPI *pNtRemoveIoCompletion)(HANDLE, PULONG_PTR, PULONG_PTR, PIO_STATUS_BLOCK, PLARGE_INTEGER); +static NTSTATUS (WINAPI *pNtSetIoCompletion)(HANDLE, ULONG_PTR, ULONG_PTR, NTSTATUS, ULONG); +static NTSTATUS (WINAPI *pNtSetInformationFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FILE_INFORMATION_CLASS); + static inline BOOL is_signaled( HANDLE obj ) { return WaitForSingleObject( obj, 0 ) == 0; @@ -79,6 +91,41 @@ static HANDLE create_temp_file( ULONG flags ) return (handle == INVALID_HANDLE_VALUE) ? 0 : handle; } +#define CVALUE_FIRST 0xfffabbcc +#define CKEY_FIRST 0x1030341 +#define CKEY_SECOND 0x132E46 + +ULONG_PTR completionKey; +IO_STATUS_BLOCK ioSb; +ULONG_PTR completionValue; + +static long get_pending_msgs(HANDLE h) +{ + NTSTATUS res; + ULONG a, req; + + res = pNtQueryIoCompletion( h, IoCompletionBasicInformation, (PVOID)&a, sizeof(a), &req ); + ok( res == STATUS_SUCCESS, "NtQueryIoCompletion failed: %x\n", res ); + if (res != STATUS_SUCCESS) return -1; + ok( req == sizeof(a), "Unexpected response size: %x\n", req ); + return a; +} + +static BOOL get_msg(HANDLE h) +{ + LARGE_INTEGER timeout = {{-10000000*3}}; + DWORD res = pNtRemoveIoCompletion( h, &completionKey, &completionValue, &ioSb, &timeout); + ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %x\n", res ); + if (res != STATUS_SUCCESS) + { + completionKey = completionValue = 0; + memset(&ioSb, 0, sizeof(ioSb)); + return FALSE; + } + return TRUE; +} + + static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) { int *count = arg; @@ -424,6 +471,109 @@ static void nt_mailslot_test(void) pRtlFreeUnicodeString(&str); } +static void test_iocp_setcompletion(HANDLE h) +{ + NTSTATUS res; + long count; + + res = pNtSetIoCompletion( h, CKEY_FIRST, CVALUE_FIRST, STATUS_INVALID_DEVICE_REQUEST, 3 ); + ok( res == STATUS_SUCCESS, "NtSetIoCompletion failed: %x\n", res ); + + count = get_pending_msgs(h); + ok( count == 1, "Unexpected msg count: %ld\n", count ); + + if (get_msg(h)) + { + ok( completionKey == CKEY_FIRST, "Invalid completion key: %lx\n", completionKey ); + ok( ioSb.Information == 3, "Invalid ioSb.Information: %ld\n", ioSb.Information ); + ok( U(ioSb).Status == STATUS_INVALID_DEVICE_REQUEST, "Invalid ioSb.Status: %x\n", U(ioSb).Status); + ok( completionValue == CVALUE_FIRST, "Invalid completion value: %lx\n", completionValue ); + } + + count = get_pending_msgs(h); + ok( !count, "Unexpected msg count: %ld\n", count ); +} + +static void test_iocp_fileio(HANDLE h) +{ + static const char pipe_name[] = "\\\\.\\pipe\\iocompletiontestnamedpipe"; + + HANDLE hPipeSrv = CreateNamedPipeA( pipe_name, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 4, 1024, 1024, 1000, NULL ); + HANDLE hPipeClt = CreateFileA( pipe_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, NULL ); + ok( hPipeSrv != INVALID_HANDLE_VALUE && hPipeClt != INVALID_HANDLE_VALUE, "Cannot create or connect to pipe\n" ); + if (hPipeSrv != INVALID_HANDLE_VALUE && hPipeClt != INVALID_HANDLE_VALUE) + { + OVERLAPPED o = {0,}; + BYTE buf[3]; + DWORD read; + long count; + FILE_COMPLETION_INFORMATION fci = {h, CKEY_SECOND}; + IO_STATUS_BLOCK iosb; + + NTSTATUS res = pNtSetInformationFile( hPipeSrv, &iosb, &fci, sizeof(fci), FileCompletionInformation ); + ok( res == STATUS_SUCCESS, "NtSetInformationFile failed: %x\n", res ); + ok( iosb.Status == STATUS_SUCCESS, "iosb.Status invalid: %x\n", iosb.Status ); + + count = get_pending_msgs(h); + ok( !count, "Unexpected msg count: %ld\n", count ); + ReadFile( hPipeSrv, buf, 3, &read, &o); + count = get_pending_msgs(h); + ok( !count, "Unexpected msg count: %ld\n", count ); + WriteFile( hPipeClt, buf, 3, &read, NULL ); + + todo_wine { + if (get_msg(h)) + { + ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); + ok( ioSb.Information == 3, "Invalid ioSb.Information: %ld\n", ioSb.Information ); + ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); + ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); + } + } + count = get_pending_msgs(h); + ok( !count, "Unexpected msg count: %ld\n", count ); + + WriteFile( hPipeClt, buf, 2, &read, NULL ); + count = get_pending_msgs(h); + ok( !count, "Unexpected msg count: %ld\n", count ); + ReadFile( hPipeSrv, buf, 2, &read, &o); + count = get_pending_msgs(h); + todo_wine { + ok( count == 1, "Unexpected msg count: %ld\n", count ); + } + todo_wine { + if (get_msg(h)) + { + ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); + ok( ioSb.Information == 2, "Invalid ioSb.Information: %ld\n", ioSb.Information ); + ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); + ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); + } + } + } + + CloseHandle( hPipeSrv ); + CloseHandle( hPipeClt ); +} + +static void test_iocompletion(void) +{ + HANDLE h = INVALID_HANDLE_VALUE; + NTSTATUS res; + + res = pNtCreateIoCompletion( &h, IO_COMPLETION_ALL_ACCESS, NULL, 0); + + ok( res == 0, "NtCreateIoCompletion anonymous failed: %x\n", res ); + ok( h && h != INVALID_HANDLE_VALUE, "Invalid handle returned\n" ); + + if ( h && h != INVALID_HANDLE_VALUE) + { + test_iocp_setcompletion(h); + test_iocp_fileio(h); + pNtClose(h); + } +} + START_TEST(file) { HMODULE hntdll = GetModuleHandleA("ntdll.dll"); @@ -439,7 +589,14 @@ START_TEST(file) pNtReadFile = (void *)GetProcAddress(hntdll, "NtReadFile"); pNtWriteFile = (void *)GetProcAddress(hntdll, "NtWriteFile"); pNtClose = (void *)GetProcAddress(hntdll, "NtClose"); + pNtCreateIoCompletion = (void *)GetProcAddress(hntdll, "NtCreateIoCompletion"); + pNtOpenIoCompletion = (void *)GetProcAddress(hntdll, "NtOpenIoCompletion"); + pNtQueryIoCompletion = (void *)GetProcAddress(hntdll, "NtQueryIoCompletion"); + pNtRemoveIoCompletion = (void *)GetProcAddress(hntdll, "NtRemoveIoCompletion"); + pNtSetIoCompletion = (void *)GetProcAddress(hntdll, "NtSetIoCompletion"); + pNtSetInformationFile = (void *)GetProcAddress(hntdll, "NtSetInformationFile"); read_file_test(); nt_mailslot_test(); + test_iocompletion(); }
1
0
0
0
Gerald Pfeifer : comctl32: Remove check which never triggers.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 7b306c57bd5184e3cae55d7a29c51d24af51546a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7b306c57bd5184e3cae55d7a2…
Author: Gerald Pfeifer <gerald(a)pfeifer.com> Date: Wed Nov 14 22:14:20 2007 +0100 comctl32: Remove check which never triggers. --- dlls/comctl32/imagelist.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index c604abc..660edde 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -2582,8 +2582,6 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount) if (!is_valid(himl)) return FALSE; - if (iImageCount < 0) - return FALSE; if (himl->cMaxImage > iImageCount) { himl->cCurImage = iImageCount;
1
0
0
0
Jonathan Ernst : wordpad: Updated French translation.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: c3ff4ddcffc8bf6a25638439627df55ce817f523 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c3ff4ddcffc8bf6a256384396…
Author: Jonathan Ernst <jonathan(a)ernstfamily.ch> Date: Tue Nov 13 14:49:17 2007 +0100 wordpad: Updated French translation. --- programs/wordpad/Fr.rc | 120 ++++++++++++++++++++++++------------------------ 1 files changed, 60 insertions(+), 60 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=c3ff4ddcffc8bf6a25638…
1
0
0
0
James Hawkins : msi: Don't ignore the error returned by ready_media.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 4e9940990b4e5e5e58777b546e34328a0874756b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4e9940990b4e5e5e58777b546…
Author: James Hawkins <truiken(a)gmail.com> Date: Thu Nov 15 03:01:58 2007 -0600 msi: Don't ignore the error returned by ready_media. --- dlls/msi/files.c | 1 - dlls/msi/tests/install.c | 2 +- 2 files changed, 1 insertions(+), 2 deletions(-) diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 812f2b0..8dbc765 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -782,7 +782,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) { ERR("Failed to ready media\n"); - rc = ERROR_FUNCTION_FAILED; break; } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index a11ef21..3e48233 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -3548,9 +3548,9 @@ static void test_missingcab(void) create_pf("msitest\\gaius", TRUE); r = MsiInstallProductA(msifile, "GAIUS=1"); + ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); todo_wine { - ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n"); ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n"); }
1
0
0
0
James Hawkins : msi: Only check the presence of the cabinet if the file is compressed.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: b1507aee989b168e8c08d0202ac60e467db25871 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b1507aee989b168e8c08d0202…
Author: James Hawkins <truiken(a)gmail.com> Date: Thu Nov 15 03:01:06 2007 -0600 msi: Only check the presence of the cabinet if the file is compressed. --- dlls/msi/files.c | 3 ++- dlls/msi/tests/install.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 5375641..812f2b0 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -637,7 +637,8 @@ static UINT ready_media(MSIPACKAGE *package, MSIFILE *file, struct media_info *m } } - if (mi->cabinet && GetFileAttributesW(mi->cabinet) == INVALID_FILE_ATTRIBUTES) + if (file->IsCompressed && mi->cabinet && + GetFileAttributesW(mi->cabinet) == INVALID_FILE_ATTRIBUTES) { ERR("Cabinet not found: %s\n", debugstr_w(mi->cabinet)); return ERROR_INSTALL_FAILURE; diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index fd2ff66..a11ef21 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -3536,8 +3536,8 @@ static void test_missingcab(void) todo_wine { ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n"); } + ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n"); ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n"); ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n"); ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n"); @@ -3552,8 +3552,8 @@ static void test_missingcab(void) { ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n"); + ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n"); } - ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n"); ok(delete_pf("msitest\\caesar", TRUE), "File removed\n"); ok(delete_pf("msitest\\gaius", TRUE), "File removed\n"); ok(delete_pf("msitest", FALSE), "File not installed\n");
1
0
0
0
James Hawkins : msi: Add tests for situations involving missing cabinets.
by Alexandre Julliard
15 Nov '07
15 Nov '07
Module: wine Branch: master Commit: 0023759a4bbe5feb2799d130cebeb5b36de21c4f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0023759a4bbe5feb2799d130c…
Author: James Hawkins <truiken(a)gmail.com> Date: Thu Nov 15 02:59:17 2007 -0600 msi: Add tests for situations involving missing cabinets. --- dlls/msi/tests/install.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-) diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 871b2c9..fd2ff66 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -530,6 +530,35 @@ static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestNa "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n" "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n"; +static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n" + "augustus\t\tMSITESTDIR\t0\t1\taugustus\n" + "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n" + "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"; + +static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" + "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" + "File\tFile\n" + "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n" + "augustus\taugustus\taugustus\t500\t\t\t0\t2\n" + "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n" + "gaius\tgaius\tgaius\t500\t\t\t16384\t4"; + +static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n" + "i2\ti4\tL64\tS255\tS32\tS72\n" + "Media\tDiskId\n" + "1\t1\t\ttest1.cab\tDISK1\t\n" + "2\t2\t\ttest2.cab\tDISK2\t\n" + "3\t3\t\ttest3.cab\tDISK3\t\n" + "4\t4\t\ttest3.cab\tDISK3\t\n"; + +static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n" + "s72\ti2\ti4\ti4\ti4\ti4\n" + "MsiFileHash\tFile_\n" + "caesar\t0\t1477005400\t-2141257985\t284379198\t21485139"; + typedef struct _msi_table { const CHAR *filename; @@ -793,6 +822,19 @@ static const msi_table mov_tables[] = ADD_TABLE(registry), }; +static const msi_table mc_tables[] = +{ + ADD_TABLE(mc_component), + ADD_TABLE(directory), + ADD_TABLE(cc_feature), + ADD_TABLE(cie_feature_comp), + ADD_TABLE(mc_file), + ADD_TABLE(install_exec_seq), + ADD_TABLE(mc_media), + ADD_TABLE(property), + ADD_TABLE(mc_file_hash), +}; + /* cabinet definitions */ /* make the max size large so there is only one cab file */ @@ -3472,6 +3514,57 @@ static void test_movefiles(void) RemoveDirectory("msitest"); DeleteFile(msifile); } + +static void test_missingcab(void) +{ + UINT r; + + CreateDirectoryA("msitest", NULL); + create_file("msitest\\augustus", 500); + create_file("maximus", 500); + + create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table)); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0"); + + create_pf("msitest", FALSE); + create_pf("msitest\\caesar", TRUE); + + r = MsiInstallProductA(msifile, NULL); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n"); + } + ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n"); + ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + create_pf("msitest", FALSE); + create_pf("msitest\\caesar", TRUE); + create_pf("msitest\\gaius", TRUE); + + r = MsiInstallProductA(msifile, "GAIUS=1"); + todo_wine + { + ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); + ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n"); + } + ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n"); + ok(delete_pf("msitest\\caesar", TRUE), "File removed\n"); + ok(delete_pf("msitest\\gaius", TRUE), "File removed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + DeleteFile("msitest\\augustus"); + RemoveDirectory("msitest"); + DeleteFile("maximus"); + DeleteFile("test1.cab"); + DeleteFile(msifile); +} + START_TEST(install) { DWORD len; @@ -3512,6 +3605,7 @@ START_TEST(install) test_adminprops(); test_removefiles(); test_movefiles(); + test_missingcab(); SetCurrentDirectoryA(prev_path); }
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
76
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
Results per page:
10
25
50
100
200