ntdll: Retrieve mailslot message info from the client side.
This commit is contained in:
parent
511e0bb671
commit
02fc886302
|
@ -1350,12 +1350,29 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
|
|||
{
|
||||
info->MaximumMessageSize = reply->max_msgsize;
|
||||
info->MailslotQuota = 0;
|
||||
info->NextMessageSize = reply->next_msgsize;
|
||||
info->MessagesAvailable = reply->msg_count;
|
||||
info->NextMessageSize = 0;
|
||||
info->MessagesAvailable = 0;
|
||||
info->ReadTimeout.QuadPart = reply->read_timeout * -10000;
|
||||
}
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (!io->u.Status)
|
||||
{
|
||||
ULONG size = info->MaximumMessageSize ? info->MaximumMessageSize : 0x10000;
|
||||
char *tmpbuf = RtlAllocateHeap( GetProcessHeap(), 0, size );
|
||||
if (tmpbuf)
|
||||
{
|
||||
int fd, needs_close;
|
||||
if (!server_get_unix_fd( hFile, FILE_READ_DATA, &fd, &needs_close, NULL ))
|
||||
{
|
||||
int res = recv( fd, tmpbuf, size, MSG_PEEK );
|
||||
info->MessagesAvailable = (res > 0);
|
||||
info->NextMessageSize = (res >= 0) ? res : MAILSLOT_NO_MESSAGE;
|
||||
if (needs_close) close( fd );
|
||||
}
|
||||
RtlFreeHeap( GetProcessHeap(), 0, tmpbuf );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FilePipeLocalInformation:
|
||||
|
|
|
@ -3666,8 +3666,6 @@ struct set_mailslot_info_reply
|
|||
struct reply_header __header;
|
||||
unsigned int max_msgsize;
|
||||
int read_timeout;
|
||||
unsigned int msg_count;
|
||||
unsigned int next_msgsize;
|
||||
};
|
||||
#define MAILSLOT_SET_READ_TIMEOUT 1
|
||||
|
||||
|
@ -4406,6 +4404,6 @@ union generic_reply
|
|||
struct query_symlink_reply query_symlink_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 258
|
||||
#define SERVER_PROTOCOL_VERSION 259
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -212,16 +212,6 @@ static int mailslot_message_count(struct mailslot *mailslot)
|
|||
return (poll( &pfd, 1, 0 ) == 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int mailslot_next_msg_size( struct mailslot *mailslot )
|
||||
{
|
||||
int size, fd;
|
||||
|
||||
size = 0;
|
||||
fd = get_unix_fd( mailslot->fd );
|
||||
ioctl( fd, FIONREAD, &size );
|
||||
return size;
|
||||
}
|
||||
|
||||
static int mailslot_get_info( struct fd *fd )
|
||||
{
|
||||
struct mailslot *mailslot = get_fd_user( fd );
|
||||
|
@ -541,14 +531,6 @@ DECL_HANDLER(set_mailslot_info)
|
|||
mailslot->read_timeout = req->read_timeout;
|
||||
reply->max_msgsize = mailslot->max_msgsize;
|
||||
reply->read_timeout = mailslot->read_timeout;
|
||||
reply->msg_count = mailslot_message_count(mailslot);
|
||||
|
||||
/* get the size of the next message */
|
||||
if (reply->msg_count)
|
||||
reply->next_msgsize = mailslot_next_msg_size(mailslot);
|
||||
else
|
||||
reply->next_msgsize = MAILSLOT_NO_MESSAGE;
|
||||
|
||||
release_object( mailslot );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2578,8 +2578,6 @@ enum message_type
|
|||
@REPLY
|
||||
unsigned int max_msgsize;
|
||||
int read_timeout;
|
||||
unsigned int msg_count;
|
||||
unsigned int next_msgsize;
|
||||
@END
|
||||
#define MAILSLOT_SET_READ_TIMEOUT 1
|
||||
|
||||
|
|
|
@ -3186,9 +3186,7 @@ static void dump_set_mailslot_info_request( const struct set_mailslot_info_reque
|
|||
static void dump_set_mailslot_info_reply( const struct set_mailslot_info_reply *req )
|
||||
{
|
||||
fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize );
|
||||
fprintf( stderr, " read_timeout=%d,", req->read_timeout );
|
||||
fprintf( stderr, " msg_count=%08x,", req->msg_count );
|
||||
fprintf( stderr, " next_msgsize=%08x", req->next_msgsize );
|
||||
fprintf( stderr, " read_timeout=%d", req->read_timeout );
|
||||
}
|
||||
|
||||
static void dump_create_directory_request( const struct create_directory_request *req )
|
||||
|
|
Loading…
Reference in New Issue