views:

191

answers:

1

In the context of a generalized .NET-based component, which can be hosted in a variety of scenarios - i.e., 64 bit or not, interactive process or not, I need to write to the registry in an area that's subject to UAC virtualisation. However, I want to prevent such access from being virtualized in order that each execution is not subject to the vagaries of the present context (i.e., dont want to have one reading from HKLM as it has a manifest and the other from HKCU..VirtualStore because it doesnt).

In other words, I'm looking for something analogous to KEY_WOW64_64KEY or reg.exe REG_KEY_DONT_VIRTUALIZE to indicate that I dont want to be virtualised under any circumstances. Or is there some form of canonicalization-related syntax I can use to force it a la the way you specify a >260 char filename?

I'm fine with the code failing if the executing user doesnt have appropriate permissions on the registry key in question.

This question is strongly related to [this question on detecting registry virtualization] (http://stackoverflow.com/questions/1002709/detecting-registry-virtualization), but detecting definitely isnt enough in this context.

A: 

Applications with a UAC-aware manifest, whether specifying asInvoker or requireAdministrator, are not virtualized. If you're ok with it failing, go with asInvoker.

Kate Gregory
Hi Kate, thanks for the answer. Unfortunately the ["In the context of a generalized component"] proviso in the question is there in order to indicate that this is outside of my control, hence my question.
Ruben Bartelink
But I bet you have answers to lots of my other open esoteric questions just waiting to jump out - if your DNR eps are anything to go by :D
Ruben Bartelink
Oh dear, you might have to head into COM elevation moniker territory. I'm not sure off the top of my head what the .NET equivalent is, if there is one.
Kate Gregory