[ADVAPI32] Fix several corner cases in RegOpenKey* functions