ddraw: Implement proper handle management.