/** * Serialize data to a SHITEMID item. * This is a helper function designed to ease the process of serializing internal * item structures to a Simple PIDL structure. */ PCITEMID_CHILD CNseBaseItem::GenerateITEMID(LPVOID pData, SIZE_T cbData) { // NOTE: This method assumes that pData points to a structure // which derives (or has same layout) as the SHITEMID // structure (= a basic PIDL). // TODO: Type-safety? ATLASSERT(pData); ATLASSERT(cbData>=sizeof(SHITEMID)); LPSHITEMID pSHID = reinterpret_cast<LPSHITEMID>(pData); pSHID->cb = (USHORT) cbData; CPidl pidl; pidl.Create(pSHID); return (PCITEMID_CHILD) pidl.Detach(); }