A virtual device driver typically registers a VDM_TERMINATE hook with the Virtual DOS Machine Manager, which causes the virtual device driver to be informed when a VDM is terminated. When the VDM_TERMINATE hook is called, the virtual device driver is responsible for freeing all resources allocated on behalf of the terminating VDM.