IReplObjHandler::GetPacket

The ActiveSync service provider implements GetPacket to deserialize an object into one or more packets. These packets are sent between the Windows CE device and the desktop by the ActiveSync service provider.

Syntax

HRESULT GetPacket(
LPBYTE
*lppbData,
DWORD *pcbData,
DWORD cbRecommend
);

At a Glance

Header file: Cesync.h
Platforms: H/PC
Windows CE versions: 2.0 and later

Parameters

lppbData
Pointer to a pointer of the outgoing packet.
pcbData
Pointer to a DWORD for the packet size.
cbRecommend
Recommended maximum size of the packet.

Return Values

NOERROR
The operation successfully created one packet.
RERR_BAD_OBJECT
The operation failed to create one object. If the receiver does receive some of the earlier packets, they should be discarded.
RWRN_LAST_PACKET
A packet was successfully created, and it is the last one for the object.

Remarks

During a deserialization of an object, the ActiveSync service manager calls the IReplObjHandler::GetPacket method continuously until RWRN_LAST_OBJECT or an error value is returned. The ActiveSync service provider determines how many packets are to be sent and what are the sizes of each packet. As a guideline for efficiency, a packet size is recommended to be less than 8000 bytes in size.

Allocation and deallocation of memory for the packet is totally the responsibility of the ActiveSync service provider. An ActiveSync service provider sets lppbData to that pointer and sets pcbData with the packet size. Typically, an ActiveSync service provider allocates a piece of memory of a known size in IReplObjHandler::Setup and frees it in IReplObjHandler::Reset.

See Also

IReplObjHandler::SetPacket