> or look for other examples for AdjustTokenPrivileges.
Just never ever do "disable all privileges" thing.
It also disables the traverse checking privilege, which ruins Win32 - the new processes with lack of such privilege cannot connect to CSRSS's API port and thus cannot start - the DllMain of kernel32.dll fails.
This was observed on XP with Fast User Switching on.
If you do AdjustTokenPrivileges in Explorer-loaded DLL, then you turn it off for the whole Explorer and thus for all new processes.
I think this was MS's error to provide the "disable all privileges" feature in AdjustTokenPrivileges, since some of them are mandatory for Win32 to work.
--
Maxim S. Shatskih
Windows DDK MVP
http://www.storagecraft.com