SLPS Developer Discussion Developer level questions on Code Protection, Licensing, customisation APIs etc
InishTech Support Forums > SLPS Developer Discussion > StorageAccessCouldBeVirtualizedException after using KB7 Login to add this as a favourite.
User avatar
Member
Member
igor@inovativatec.co - 1/5/2010 12:42:05 PM
   
StorageAccessCouldBeVirtualizedException after using KB7

Hello all,

Recently we followed the great KB7 (How To: Install SLPS Runtime Components) and performed all necessary changes on the application.

However, I'm getting the following exception when the installer.VerifyInstalled() method is called on the application startup:

ex = {"Licensing storage access could be virtualized per user as this application does not have a manifest with a requestedExecutionLevel. If this is desired, use PermutationInstaller.VerifyInstalledEvenIfRegistryWouldBeVirtualized instead of VerifyInstalled"}

[Slps.Licensing.StorageAccessCouldBeVirtualizedException] = {"Licensing storage access could be virtualized per user as this application does not have a manifest with a requestedExecutionLevel. If this is desired, use PermutationInstaller.VerifyInstalledEvenIfRegistryWouldBeVirtualized instead of VerifyInstalled"}

What does this exception actually mean? I cannot really understand it..

Do I have to efectively install the application ( I use a setup and deployment project type on Visual Studio) in order to use this approach? As I´m still developing the application, do I have to bypass this verification at development time?

 


User avatar
InishTech Dev
InishTech Dev
RBartelink - 1/5/2010 3:24:54 PM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

igor@inovativatec.co wrote: Recently we followed the great KB7 (How To: Install SLPS Runtime Components) and performed all necessary changes on the application.

Thanks for the kind words!

igor@inovativatec.co wrote: However, I'm getting the following exception when the installer.VerifyInstalled() method is called on the application startup:
Slps.Licensing.StorageAccessCouldBeVirtualizedException: Licensing storage access could be virtualized per user as this application does not have a manifest with a requestedExecutionLevel. If this is desired, use PermutationInstaller.VerifyInstalledEvenIfRegistryWouldBeVirtualized instead of VerifyInstalled

What does this exception actually mean? I cannot really understand it

This exception is being thrown because the licensing runtime has detected that registry access is being virtualized due to UAC virtualization (see http://en.wikipedia.org/wiki/User_Account_Control). Proceeding could mean that registry writes could get diverted to a per-user store. This can lead to a variety of confusing behaviour (works for one user but not another, license administrator doesnt show license but app does find it etc.)

The recommended (and generally by far the easiest solution to this is to add an UAC manifest to your app by (in VS) using Project|Add Components
and selecting Application Manifest File - especially as this is required for Windows Logo Certification in any case. There are potential problems with doing this code if you have code trying to write to HKLM or Program Files without appropriate permissions.

Given your app is currently under development, this should be fine for you.

There is a workaround to inhibit this check, but that should really be a last resort.

igor@inovativatec.co wrote: Do I have to efectively install the application ( I use a setup and deployment project type on Visual Studio) in order to use this approach? As I´m still developing the application, do I have to bypass this verification at development time?

You should not need to do anything different in a development context - this is about your app's interaction with UAC due to the absence of a manifest file.

Note that this warning is not about the installation necessarily having succeeded or failed - merely that one can never be sure if the app is running with UAC virtualization as attempts to read the registry may actually be reading shadowed versions of the data.

The current runtime requires at least one installation of an SLPS protected application to have succeeded on a machine in order for the licensing and installation checks to work. Generally on a development machine, Code Protector will be installed. As CP is SLPS protected, you will thus not have to do an install step for your app during your development phase. (i.e., you wouldnt even need to do a single install of your MSI on your development machine. (This is also why the fact that a protected app works on a dev box can mislead one into thinking it should work on clean machines without an install step.)

(ASIDE: In the latest beta version of the runtime components, the message has been clarified slightly in light of some cleanup in this area:-

Slps.Licensing.StorageAccessCouldBeVirtualizedException: Licensing storage could be virtualized per user as this Application does not have an Application Manifest resource with a requestedExecutionLevel specified. To resolve this issue, please add an Application Manifest resource with a requestedExecutionLevel. To inhibit reporting of this problem, pass RuntimeInstaller.OptionsEnum.PermitRegistryVirtualization to PermutationInstallerBase's constructor prior to calling VerifyInstalled() to ignore the error.

ASIDE 2: There is also an associated StorageInstallationWouldBeVirtualizedException which is the same problem in a slightly different context)

I hope this answers the question - apologies for length of the post. Please revert if you need any further clarification.


User avatar
Member
Member
igor@inovativatec.co - 1/5/2010 5:32:14 PM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

Hello,

Thank you for the reply back.

Actually I´m note sure why the licensing runtime detected that the registry acess is been virtualized. After reading your post I tested running the application outside of Vistual Studio and the Exception wast NOT thrown anymore. Maybe VS is doing this virutalization....Any toughts?

But the most woring issue at the moment is that I added the manifest file you suggested to the project, marked it for been copied to the output directory but the error still occurs when lauching the app in VS. Do you know if I have to set any compiling option on it (embedded resource, content, etc)? I have not many experience in manifest files.

In ASIDE 1, you mean the latest beta for the next release (4)? If not, please let me know so I can update my runtime components.

Thank in advance,

Igor.


User avatar
InishTech Dev
InishTech Dev
RBartelink - 1/6/2010 10:06:58 AM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

igor@inovativatec.co wrote: Actually I´m note sure why the licensing runtime detected that the registry acess is been virtualized. After reading your post I tested running the application outside of Vistual Studio and the Exception wast NOT thrown anymore. Maybe VS is doing this virutalization....Any toughts?

If the process is running as elevated, you won't be virtualized. On W7 in task manager there's there's a "UAC virtualization" column, think there's one on Vista too but it might be called something else. Note that if VS is elevated, all spawned processes (including IEs and apps you are debugging) gain the same elevation.

igor@inovativatec.co wrote: But the most woring issue at the moment is that I added the manifest file you suggested to the project, marked it for been copied to the output directory but the error still occurs when lauching the app in VS. Do you know if I have to set any compiling option on it (embedded resource, content, etc)? I have not many experience in manifest files.

It needs to be marked as none/do not copy - definitely nothing is going to read the file from beside your EXE. (A .manifest file has another usage in a ClickOnce context where it is a standalone file, but that's under the covers).

On VS2008, Where the manifest is really controlled is via the Resources section in the Application page of the project settings. There is a manifest drop-down where you get to choose to use it (or a default one).

igor@inovativatec.co wrote: In ASIDE 1, you mean the latest beta for the next release (4)? If not, please let me know so I can update my runtime components.

The Beta I was referring to is a beta of some client side improvements which include:

- better command-line build support (MSBuild integration)

- better ClickOnce support
While they represent significant functionality for many users, they likely won't bear a 4.0 badge. As it happens you've actually been included on the list for the next set of participants for this based on recent questions you've had, so will recieve the pack shortly - unfortunately the beta packs had just been issued immediately prior to you being added to the list.

The beta pack includes an out-of-band shipment of an update to your permutation [which would give you updated runtime components when you protect using that permutation]. When it is actually released, the same update to the runtime will be available to all users as desired by updating ones permutation on the Accounts page of the Online Service.


User avatar
Member
Member
igor@inovativatec.co - 1/18/2010 5:44:35 PM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

Hello,

Sorry for the delayed answer.

Actually I'm confused now. If you say that this exception is thrown when the registry is virtualized (throught UAC), then most of the time this would happen, since the idea is to run elevated only in special ocasions.

What did I miss?

Kindly Regards,

Igor

 

 


User avatar
InishTech Dev
InishTech Dev
RBartelink - 1/19/2010 10:17:26 AM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

Hi Igor,

igor@inovativatec.co wrote: Actually I'm confused now. If you say that this exception is thrown when the registry is virtualized (throught UAC), then most of the time this would happen, since the idea is to run elevated only in special ocasions.

You are right - running elevated should be very much the exception rather than the rule.

However there are two reasonably common cases in which virtualization will not happen:

1. If you are running Visual Studio as admin (e.g. because it wont let you do a clickonce publish or websiter debugging etc.) then code you run with F5 (and Ctrl-F5) *also* runs elevated []

2. If you mark your code x64 OR mary your code AnyCpu and run in x64 mode on an x64 machine.

3. People that should know better sometimes completely turn off UAC (see http://www.interact-sw.co.uk/iangblog/2007/05/09/uacproblem)

In either of these cases, you'll never see this issue.

To see whether something is or is not being virtualized, look in Task Manager's Process tab


User avatar
Member
Member
igor@inovativatec.co - 1/19/2010 5:10:59 PM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

Thank you for the reply back.

I think I did not expressed my point correctly.

What I mean is that if in common scenarios the application is run not elevated, then the registry will be virtualized right? If so, I my app should be throwing this exception most of the time (what actually do not happen), right? (forget the Visual Studio issue for the moment).

Thanks in advance,

Igor.


User avatar
InishTech Dev
InishTech Dev
RBartelink - 1/20/2010 12:04:20 AM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

I had an idea you meant something different.

Yes, if you don't have a manifest and dont run elevated on vista and later, you should get virtualised and hence get the exception.

Hence you ideally want to regularise things by getting the manifest in so you're not virtualised.

Task manager will let you see quickly whether you are virtualised (and you can also add a Console.ReadKey and then switch UAC virtualization on or off for testing purposes via Task Manager too).

I hope this straightens things out - is this adding up any more for you now?


User avatar
Member
Member
marius - 4/17/2010 3:20:40 PM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

Hello all, I'm on the same project with Igor.


Today we updated our permutation and code protector to version 3.0.1908 to be able to integrate protection in Visual Studio (as described in KB12).


In VisualStudio 2008, only in the DEBUG configuration we are still getting the following exception thrown in the PermutationInstallerBase.VerifyInstalled method call.


We have included a manifest file as you recommend in the previous posts.
 

We have checked the "UAC Virtualization" collumn in the Task Manager and noticed that our application is described as "Active" when it is lauched by Visual Studio. The "devenv.exe" process in the other hand is marked as "disabled".


On the RELEASE configuration, the exception is not thrown, and we see on the Task Manager that our application was lauched with "disabled" virtualization.


From what we have concluded in the previous posts, in regular scenarios the application should be lauched virtualized (no admin privileges). So what we see in DEBUG configuration seems to be the normal situation.


Meanwhile we have supressed the error message using the recommend approach in the exception message.
PS: We are using the SLPS_PROTECTED conditional compilation symbol only in RELEASE configuration.


1 - Why this do not happen in the RELEASE?


2 - Whay do we still have the exception thrown even if we are using a manifest file?

 

Regards,

Marius Edelsbrunner


User avatar
InishTech Dev
InishTech Dev
RBartelink - 4/19/2010 3:18:33 PM
   
RE:StorageAccessCouldBeVirtualizedException after using KB7

 Hi Marius,

Sorry the response took so long.

Can you double check that Project|<Project> Properties, Application tab, Resources group has the correct Manifest setting applied? Visual Studio is very fond of forgetting what this has been set to.

If you have it set to Embed manifest with default settings or have explicitly selected one you wrote (just adding it to the project is sometimes not enough) then the EXE should have a manifest.

An app that:

1. has a correct manifest embedded (as opposed to one that says I need virtualization)

2. isnt running elevated

should show Disabled for UAC Virtualization in Task Manager when run as non-admin.

Running the EXE as Administrator will cause it to show a blank (not even Disabled) in the UAC Virtualization column. Note this will apply to F5 and Ctrl-F5 launched instances of your app if you launch them from an elevated devenv (which will also show blank in the column).

The only thing that should influence whether or not you get this exception is whether the manifest is a) present, i.e.,bound into the EXE being run and b) applicable - i.e., you're running on an OS that supports UAC and you're not running Elevated. Thus the primary way of causing the exception is to both:

1. have no manifest in the EXE

2. run the app as non-administrator

There should not be a difference in runtime behaviour of the code either based on Debug/Release, Protected/Not Protected status.

Can you verify:

1. you definitely have a manifest and VS isnt ignoring it

2. you are launching the release and debug exes in the same way (i.e. same elevation status)

If that doesnt flush it out, can you supply a log of the output window in Normal detail level (so I can see the CSC.EXE command invocation) and/or [via email separate to this] a repro EXE please?


1 2

There are currently no users on-line.

  • Sticky
  • Locked sticky
  • Hot sticky
  • Hot locked sticky
  • Thread
  • Hot thread
  • Locked thread