I have discovered (purely through experimentation) that on Vista one can
enable/disable file system virtualization in a process by calling
SetTokenInformation with a class value of "TokenVirtualizationEnabled" (24).
Because there is currently no documentation for
TokenVirtualizationEnabled, there are some things I'm uncertain about:
1. Is there some other (higher-level?) API I should be using instead?
2. Will the SetTokenInformation call do anything besides just
enabling/disabling file system virtualization?
(I'm only interested in enabling virtualization temporarily in order to
move some files out of the VirtualStore. I certainly don't want any
nasty side effects that last for the lifetime of the process.)
3. What type should I be passing in the TokenInformation parameter?
DWORD values of 0 and 1 seem to work, but I don't know if that's *right*.
4. Is it possible to enable/disable virtualization on a per-thread basis?
I tried duplicating the process's token using DuplicateTokenEx() and
assigning it to the current thread using SetThreadToken(). That
succeeded, but then the SetTokenInformation() call no longer had any
effect (despite succeeding). Before I spend much more time trying to get
that to work, I'd like to know if it's simply not possible.