tags:

views:

203

answers:

1

I'm working on an 32 installer that has to run on environments ranging from Win XP upwards. We have a problem where we have to remove a registry entry on the x64 section of the registry under Windows 2k3 x64.

That's easy enough with RegDeleteKeyEx, but I can't distribute an executable that might call that function because it won't run on Windows XP. I can get a handle to the key easily enough, I just can't see how I'm supposed to delete it.

I can't use RegDeleteKey because registry redirection will thwart my efforts on x64 platforms. I'm annoyed I can't just pass it a handle to my key, and an empty/null subkey string. I can't believe this API was so broken. Am I missing something?

My only idea at the moment to call out to a registry file or a separate executable to do the job for me, but that's just incredibly ugly and only makes a fugly workaround even worse. Is there a better way?

A: 

Why not resolving RegDeleteKeyEx at run-time (using LoadLibrary, GetModuleHandle or similar and GetProcAddress) after you have determined, that the system is a x64 one?

Dirk