For example regedit.exe.
Total Commander x64 gives out the error “Access denied!”
Probably the problem in using of function GetWindowsDirectory
see the imageThe Windows directory is the directory where some legacy applications store initialization and help files.
..............
If the user is running a shared version of the system, the Windows directory is guaranteed to be private for each user.
..............
Terminal Services: If the application is running in a Terminal Services environment, each user has a private Windows directory. There is also a shared Windows directory for the system. If the application is Terminal-Services-aware (has the IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE flag set in the image header), this function returns the path of the system Windows directory, just as the GetSystemWindowsDirectory function does. Otherwise, it retrieves the path of the private Windows directory for the user.
Image: http://3.firepic.org/3/images/2013-12/18/6n0jz5h6z0wr.jpg
Probably instead of function GetWindowsDirectory it is necessary to use function GetSystemWindowsDirectory.