Initializing the Device Store (Windows Embedded CE 6.0)

1/6/2010

To initialize the device provider, call InitObjType. If the device provider supports synchronization of multiple object types, it calls InitObjType for each object type whose lpszObjType is not NULL. When an ActiveSync service terminates, the lpszObjType of its objects are set to NULL, thereby allowing the device provider to free any resources it may have allocated.

The following code example shows how to implement InitObjType.

EXTERN_C BOOL InitObjType
(
   LPWSTR            lpszObjType,
   IReplObjHandler **ppObjHandler,
   UINT              uPartnerBit
)
{
   if (lpszObjType == NULL)
   {
   // Terminates device provider and frees all allocated resources.
   // ...
       return TRUE;
   }

   // Allocates a new IReplObjHandler.
   *ppObjHandler = new CDataHandler;

   // Saves uPartnerBit for later use in ObjectNotify.
   // ...

   // Initializing the module.
   // ...

   return TRUE;
}

ActiveSync supports the synchronization of two desktop computers with a Windows Embedded CEā€“based device. To differentiate between two computers, the service manager passes a partner bit to InitObjType when initializing the device provider. This bit is 1 if the connected desktop computer is the first partner and 2 if it is the second partner. The device provider must use this partner bit when setting and resetting "dirty" bits of an object.

See Also

Concepts

Developing the Device Provider