Copying Reg Key With Descriptor Error
I am attempting to copy a Registry Key(including its values and subkeys). I am also trying to copy the security descriptor of the key. I am accomplishing this by using GetSecurityInfo to get the descriptor of the key I am copying. I then use RegCreateKeyEx to create the key using the security descriptor I obtained. This generally works. However I encountered a key that RegCreateKeyEx fails with ERROR_INVALID_OWNER.
I am assuming that the account I am running in(Administrator) is not an owner of the original key. However, I still want to copy this key with the exact same descriptor of the original. Is there anyway to accomplish this? (I do not want to use RegSaveKey)
Thanks for any help you can provide.