Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method writes data to a file on a remote Windows Embedded CE–based device. IRAPISession::CeWriteFilestarts writing data to the file at the position indicated by the file pointer. After the write operation has been completed, the file pointer is adjusted by the number of bytes actually written.

Syntax

BOOL CeWriteFile( 
  HANDLE 
hFile, 
  LPCVOID 
lpBuffer, 
  DWORD 
nNumberOfBytesToWrite, 
  LPDWORD 
lpNumberOfBytesWritten, 
  LPOVERLAPPED 
lpOverlapped 
);

Parameters

hFile

[in] Handle to the file to which bytes will be written. The file handle must have been created with GENERIC_WRITE access to the file.

lpBuffer

[in] Pointer to the buffer containing the data to be written to the file.

nNumberOfBytesToWrite

[in] Number of bytes to write to the file.

A value of zero specifies a null write operation. A null write operation does not write any bytes but does cause the time stamp to change. IRAPISession::CeWriteFiledoes not truncate or extend the file. To truncate or extend a file, use the IRAPISession::CeSetEndOfFilefunction.

Named pipe write operations across a network are limited to 65,535 bytes.

lpNumberOfBytesWritten

[out] Pointer to the number of bytes written by this function call. IRAPISession::CeWriteFilesets this value to zero before doing any work or error checking.

lpOverlapped

[in] Unsupported; set to NULL.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call IRAPISession::CeGetLastErrorand IRAPISession::CeRapiGetError.

Remarks

If part of the file is locked by another process and the write operation overlaps the locked portion, this function fails.

Accessing the output buffer while a write operation is using the buffer may lead to corruption of the data written from that buffer. Applications must not read from, write to, reallocate, or free the output buffer that a write operation is using until the write operation completes.

Requirements

Header rapi2.h
Library ole32.lib, rapiuuid.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also