gdi32: Add helper functions for converting between handle and index.