Refactored to match DwApiOpen.