Does Visual Studio run tests with a less privileged process?

I have an application that is supposed to be read from the registry, and when I run the console application, my access to the registry works fine.

However, when I go to the test, this returns null :

var masterKey = Registry.LocalMachine.OpenSubKey("path_to_my_key");

So my question is:

Does Visual Studio run tests with a less privileged process?

I tested to find out what this user gave me: var x = WindowsIdentity.GetCurrent().Name; , and it gives me the same thing as in the console application. So I'm a little confused.

I use the MS Test Framework, and on the computer - 64-bit Windows 2003.

+6
c # unit-testing visual-studio-2010
source share
2 answers

This is not a security issue. It is a fact that you work in a 64-bit operating system. 64-bit applications have a different view of HKLM \ Software than 32-bit applications. 64-bit applications get a β€œnormal” look, 32-bit applications are redirected to HKLM \ Software \ Wow6432Node. EXE defines the process bit process, it will be different when mstest runs the code. 32 bit perhaps.

You need to create the key that you are trying to read in the Wow6432Node tree. Or make a regular application the same bit, Project + Properties, Build tab, Platform Target = x86. Also replaced on the fly with Corflags.exe.

+1
source share

I would say yes. Why are you expecting something else? It should be designed to fit the Windows logo. This is also good from a security point of view. Visual Studio.NET is compatible with the Windows logo, so you expect it to work as a limited user

http://blogs.msdn.com/vcblog/archive/2006/09/06/742187.aspx

-one
source share

All Articles