Share via


ReadMsgQueueEx (Windows Embedded CE 6.0)

1/6/2010

This function reads a single message from a message queue, and optionally returns the security context, or token, from the writer. This allows message queue servers to run at the security level of the message queue client, so that the message queue server will fail if it attempts a privileged operation.

Syntax

BOOL ReadMsgQueueEx(
  HANDLE hMsgQ, 
  LPVOID lpBuffer,
  DWORD cbBufferSize,
  LPDWORD lpNumberOfBytesRead,
  DWORD dwTimeout,
  DWORD *pdwFlags,
  PHANDLE phTok
);

Parameters

  • hMsgQ
    [in] Handle to the message queue.
  • lpBuffer
    [in, out] Pointer to the buffer that will receive the message.
  • cbBufferSize
    [in] Size of the buffer that receives the message.
  • lpNumberOfBytesRead
    [in, out] Number of bytes read.
  • dwTimeout
    [in] Timeout for the read operation.
  • pdwFlags
    [in, out] Receives the flag sent by the writer of the message queue.
  • phTok
    [in, out] Receives the token handle of the writer of the message queue. Set to NULL if you do not need the security token for the writer. The caller is responsible for calling CloseHandle on the token returned.

Return Value

TRUE indicates success. FALSE indicates failure. To obtain extended error information, call the GetLastError function.

Remarks

If *phTok returns a NULL value, the returned token is NULL, so the sender is a kernel thread, and cannot be impersonated.

When the message queue is read, the reader may open a handle to the writer's security token. The reader can use the token to impersonate the writer's security context.

Requirements

Header msgqueue.h
Library coredll.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

Message Queue Point-to-Point Functions
CloseMsgQueue
CreateMsgQueue
GetMsgQueueInfo
MSGQUEUEINFO
MSGQUEUEOPTIONS
OpenMsgQueue
ReadMsgQueue
WriteMsgQueue

Other Resources

New Kernel APIs
Message Queue Point-to-Point