Called by the framework when it needs to serialize the user-defined data.
The default implementation stores the user-defined data as a simple DWORD_PTR value.