To find the parent of a context, you call ParentChunk() on the relevant ContextNode: parentnode = ParentChunk(currentnode); If there is no parent context, NULL is returned.