Reads a file directly from cache memory
#include <nwfileio.h> int AsyncRead ( int handle, LONG startingOffset, LONG numberOfBytesToRead, LONG *numberOfBytesActuallyRead, LONG localSemaphoreHandle, T_cacheBufferStructure **cacheBufferInformation, LONG *numberOfCacheBuffers);
(IN) Specifies a handle of the file from which data is to be read.
(IN) Specifies the offset in the file from which the first byte is to be read.
(IN) Specifies the number of bytes to read from the file.
(OUT) Points to the number of bytes actually read from the file.
(IN) Specifies this is used by the AsyncRead Event Service Routine (ESR) to signal completion of all of the requested cache reads for a particular call to AsyncRead. A local semaphore handle is obtained by calling OpenLocalSemaphore. Either WaitOnLocalSemaphore or ExamineLocalSemaphore should be used to determine when the ESR has signalled the semaphore.
(OUT) Points to an array of structures which contain the cache buffer pointers, lengths, and completion codes.
(OUT) Points to the number of cache buffers required to perform the file read.
This function returns a value of 0 if successful. Otherwise, it returns an error code (nonzero value).
NOTE:If this function returns an error, do not wait on the local semaphore passed. AsyncRead does not signal the semaphore when the function fails.
This function reads data from a file and returns pointers to the cache buffers which contain the requested data. The requested data can then be read directly from the cache buffers.
AsyncRead now reads only 64K at a time.
The cache buffer structure has the following form:
typedef struct cacheBufferStructure { char *cacheBufferPointer; LONG cacheBufferLength; int completionCode; } T_cacheBufferStructure;
The cacheBufferPointer field is the address of the first character for that particular cache buffer. The cacheBufferLength field is the number of bytes to be used from that cache buffer. The completionCode field is the NetWare error code for that particular cache buffer read operation.
AsyncRelease must be called to release the memory allocated by AsyncRead.