IGLib  1.5
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
MailslotNative Class Reference

The class exposes kernel32.dll methods for Mailslot communication. More...

Public Member Functions

static bool ReadFile (IntPtr hFile, byte[] lpBuffer, int nNumberOfBytesToRead, out int lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, and starts at the position that the file pointer indicates More...
 
static bool WriteFile (IntPtr handle, byte[] lpBuffer, int nNumberOfBytesToWrite, out int lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to the specified file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hObject)
 Closes an open object handle More...
 
static bool GetMailslotInfo (IntPtr hMailslot, IntPtr lpMaxMessageSize, out int lpNextSize, out int lpMessageCount, IntPtr lpReadTimeout)
 Retrieves information about the specified mailslot More...
 
static IntPtr CreateMailslot (string lpName, uint nMaxMessageSize, int lReadTimeout, IntPtr lpSecurityAttributes)
 Creates an instance of a mailslot and returns a handle for subsequent operations. More...
 
static IntPtr CreateFile (string lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr SecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile)
 open an instance of a mailslot and returns a handle for subsequent operations. More...
 
static bool ReadFile (IntPtr hFile, byte[] lpBuffer, int nNumberOfBytesToRead, out int lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, and starts at the position that the file pointer indicates More...
 
static bool WriteFile (IntPtr handle, byte[] lpBuffer, int nNumberOfBytesToWrite, out int lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to the specified file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hObject)
 Closes an open object handle More...
 
static bool GetMailslotInfo (IntPtr hMailslot, IntPtr lpMaxMessageSize, out int lpNextSize, out int lpMessageCount, IntPtr lpReadTimeout)
 Retrieves information about the specified mailslot More...
 
static IntPtr CreateMailslot (string lpName, uint nMaxMessageSize, int lReadTimeout, IntPtr lpSecurityAttributes)
 Creates an instance of a mailslot and returns a handle for subsequent operations. More...
 
static IntPtr CreateFile (string lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr SecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile)
 open an instance of a mailslot and returns a handle for subsequent operations. More...
 

Public Attributes

const int MAILSLOT_WAIT_FOREVER = -1
 mailslot waits forever for a message More...
 
const int INVALID_HANDLE_VALUE = -1
 Invalid operating system handle. More...
 
const int MAILSLOT_NO_MESSAGE = -1
 There is no next message More...
 

Private Member Functions

static bool SetMailslotInfo (IntPtr hMailslot, uint lReadTimeout)
 Sets the time-out value used by the specified mailslot for a read operation More...
 
static bool SetMailslotInfo (IntPtr hMailslot, uint lReadTimeout)
 Sets the time-out value used by the specified mailslot for a read operation More...
 

Detailed Description

The class exposes kernel32.dll methods for Mailslot communication.

The class exposes kernel32.dll methods for MailSlot communication.

Member Function Documentation

static bool MailslotNative.ReadFile ( IntPtr  hFile,
byte[]  lpBuffer,
int  nNumberOfBytesToRead,
out int  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, and starts at the position that the file pointer indicates

Parameters
hFileA handle to the file to be read
lpBufferA buffer that receives the data read from a file
nNumberOfBytesToReadThe maximum number of bytes to be read
lpNumberOfBytesReadthe number of bytes read
lpOverlappedA pointer to an OVERLAPPED structure.
Returns
The ReadFile functiona returns when one of the following conditions is met:A write operation completes on the write end of the pipe;The number of bytes requested is read;An error occurs

Referenced by Program.ReadMailslot().

static bool MailslotNative.WriteFile ( IntPtr  handle,
byte[]  lpBuffer,
int  nNumberOfBytesToWrite,
out int  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to the specified file at the position specified by the file pointer.

Parameters
handleA handle to the file
lpBufferA buffer containing the data to be written to the file.
nNumberOfBytesToWriteThe number of bytes to be written to the file.
lpNumberOfBytesWrittenthe number of bytes written.
lpOverlappedA pointer to an OVERLAPPED structure.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.WriteMailslot().

static bool MailslotNative.CloseHandle ( IntPtr  hObject)

Closes an open object handle

Parameters
hObjectA valid handle to an open object
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.Main().

static bool MailslotNative.GetMailslotInfo ( IntPtr  hMailslot,
IntPtr  lpMaxMessageSize,
out int  lpNextSize,
out int  lpMessageCount,
IntPtr  lpReadTimeout 
)

Retrieves information about the specified mailslot

Parameters
hMailslotA handle to a mailslot
lpMaxMessageSizeThe maximum message size, in bytes, allowed for this mailslot
lpNextSizeThe size of the next message in bytes
lpMessageCountThe total number of messages waiting to be read
lpReadTimeoutThe amount of time, in milliseconds, a read operation can wait for a message to be written to the mailslot before a time-out occurs.
Returns

Referenced by Program.ReadMailslot().

static IntPtr MailslotNative.CreateMailslot ( string  lpName,
uint  nMaxMessageSize,
int  lReadTimeout,
IntPtr  lpSecurityAttributes 
)

Creates an instance of a mailslot and returns a handle for subsequent operations.

Parameters
lpNamemailslot name
nMaxMessageSizeThe maximum size of a single message
lReadTimeoutThe time a read operation can wait for a message
lpSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a mailslot instance.

Referenced by Program.Main().

static IntPtr MailslotNative.CreateFile ( string  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  SecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
IntPtr  hTemplateFile 
)

open an instance of a mailslot and returns a handle for subsequent operations.

Parameters
lpFileNamemailslot name
dwDesiredAccessThe access to the object
dwShareModeThe sharing mode of an object
SecurityAttributesSecurity attributes
dwCreationDispositionAn action to take on files that exist and do not exist
dwFlagsAndAttributesThe file attributes and flags
hTemplateFileA handle to a template file with the GENERIC_READ access right
Returns
If the function succeeds, the return value is a handle to the server end of a mailslot instance

Referenced by Program.Main().

static bool MailslotNative.SetMailslotInfo ( IntPtr  hMailslot,
uint  lReadTimeout 
)
private

Sets the time-out value used by the specified mailslot for a read operation

Parameters
hMailslotA handle to a mailslot
lReadTimeoutThe time a read operation can wait for a message to be written to the mailslot before a time-out occurs, in milliseconds
Returns
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero
static bool MailslotNative.ReadFile ( IntPtr  hFile,
byte[]  lpBuffer,
int  nNumberOfBytesToRead,
out int  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, and starts at the position that the file pointer indicates

Parameters
hFileA handle to the file to be read
lpBufferA buffer that receives the data read from a file
nNumberOfBytesToReadThe maximum number of bytes to be read
lpNumberOfBytesReadthe number of bytes read
lpOverlappedA pointer to an OVERLAPPED structure.
Returns
The ReadFile functiona returns when one of the following conditions is met: A write operation completes on the write end of the pipe; The number of bytes requested is read; An error occurs.
static bool MailslotNative.WriteFile ( IntPtr  handle,
byte[]  lpBuffer,
int  nNumberOfBytesToWrite,
out int  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to the specified file at the position specified by the file pointer.

Parameters
handleA handle to the file
lpBufferA buffer containing the data to be written to the file.
nNumberOfBytesToWriteThe number of bytes to be written to the file.
lpNumberOfBytesWrittenthe number of bytes written.
lpOverlappedA pointer to an OVERLAPPED structure.
Returns
If the function succeeds, the return value is nonzero.
static bool MailslotNative.CloseHandle ( IntPtr  hObject)

Closes an open object handle

Parameters
hObjectA valid handle to an open object
Returns
If the function succeeds, the return value is nonzero.
Parameters
hObject/ handle to kernel object
static bool MailslotNative.GetMailslotInfo ( IntPtr  hMailslot,
IntPtr  lpMaxMessageSize,
out int  lpNextSize,
out int  lpMessageCount,
IntPtr  lpReadTimeout 
)

Retrieves information about the specified mailslot

Parameters
hMailslotA handle to a mailslot
lpMaxMessageSizeThe maximum message size, in bytes, allowed for this mailslot
lpNextSizeThe size of the next message in bytes
lpMessageCountThe total number of messages waiting to be read
lpReadTimeoutThe amount of time, in milliseconds, a read operation can wait for a message to be written to the mailslot before a time-out occurs.
Returns
static IntPtr MailslotNative.CreateMailslot ( string  lpName,
uint  nMaxMessageSize,
int  lReadTimeout,
IntPtr  lpSecurityAttributes 
)

Creates an instance of a mailslot and returns a handle for subsequent operations.

Parameters
lpNamemailslot name
nMaxMessageSizeThe maximum size of a single message
lReadTimeoutThe time a read operation can wait for a message
lpSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a mailslot instance.
static IntPtr MailslotNative.CreateFile ( string  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  SecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
IntPtr  hTemplateFile 
)

open an instance of a mailslot and returns a handle for subsequent operations.

Parameters
lpFileNamemailslot name
dwDesiredAccessThe access to the object
dwShareModeThe sharing mode of an object
SecurityAttributesSecurity attributes
dwCreationDispositionAn action to take on files that exist and do not exist
dwFlagsAndAttributesThe file attributes and flags
hTemplateFileA handle to a template file with the GENERIC_READ access right
Returns
If the function succeeds, the return value is a handle to the server end of a mailslot instance
static bool MailslotNative.SetMailslotInfo ( IntPtr  hMailslot,
uint  lReadTimeout 
)
private

Sets the time-out value used by the specified mailslot for a read operation

Parameters
hMailslotA handle to a mailslot
lReadTimeoutThe time a read operation can wait for a message to be written to the mailslot before a time-out occurs, in milliseconds
Returns
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero

Member Data Documentation

const int MailslotNative.MAILSLOT_WAIT_FOREVER = -1

mailslot waits forever for a message

Referenced by Program.Main().

const int MailslotNative.INVALID_HANDLE_VALUE = -1

Invalid operating system handle.

Referenced by Program.Main().

const int MailslotNative.MAILSLOT_NO_MESSAGE = -1

There is no next message

Referenced by Program.ReadMailslot().


The documentation for this class was generated from the following file: