Alexandre Julliard : ntdll:
Retrieve mailslot message info from the client side.
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Nov 4 13:32:32 CST 2006
Module: wine
Branch: master
Commit: 02fc8863027cd3ac995f131d784b7aeaab27694e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=02fc8863027cd3ac995f131d784b7aeaab27694e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Nov 3 17:53:04 2006 +0100
ntdll: Retrieve mailslot message info from the client side.
---
dlls/ntdll/file.c | 21 +++++++++++++++++++--
include/wine/server_protocol.h | 4 +---
server/mailslot.c | 18 ------------------
server/protocol.def | 2 --
server/trace.c | 4 +---
5 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 7b170a8..5d397cc 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1350,12 +1350,29 @@ NTSTATUS WINAPI NtQueryInformationFile(
{
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:
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 577c797..09b8906 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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 */
diff --git a/server/mailslot.c b/server/mailslot.c
index 7015f41..578f751 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -212,16 +212,6 @@ static int mailslot_message_count(struct
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 );
}
}
diff --git a/server/protocol.def b/server/protocol.def
index a4a2376..192b8a3 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2578,8 +2578,6 @@ #define SET_GLOBAL_TASKMAN_WINDOW 0x04
@REPLY
unsigned int max_msgsize;
int read_timeout;
- unsigned int msg_count;
- unsigned int next_msgsize;
@END
#define MAILSLOT_SET_READ_TIMEOUT 1
diff --git a/server/trace.c b/server/trace.c
index 9931ea0..50268f9 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -3186,9 +3186,7 @@ static void dump_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 )
More information about the wine-cvs
mailing list