How to stop files been saved in Virtual Store / ProgramData?

6.7k Views Asked by At

[ I submitted this question 2 months ago and didn't have any replies ... and obviously the problem is still live and we are about to release a new version of our app, so now am writing some documentation to get the users to delete any entries in the virtual store - something I didn't want to do .... so now really hoping someone out there can help us ?! ]

I appreciate that there is a lot of info regarding this topic, but I am still having an annoying issue and not sure where to go with it ... hence coming here !!

We have an app (VB.NET) that now installs REPORT files into a folder under ProgramData. Now our app dll is run from a third party app ( that we obviously have no control over ) and this third party app allows people to run the reports; but when a report is run, it then updates the report, so that it's "last run date" is stored. This is what is causing us the fun we are having.

With UAC on, the report files are been copied to the equivalent location within the Virtual Store. This of course is ok while they are using the current version of our app, but when we release a new version ( with modified reports ) these new versions are getting installed correctly into ProgramData, but when the user runs the app - they are seeing the outdated reports from Virtual Store.

We are very close to writing some installation documentation, telling folk to delete any reports from Virtual Store, before installing our new version - but this is a real cop out !!

The third party app also installs its own reports ( into a different location under ProgramData ) and they are able to update their reports without Virtual Store kicking in - so we know it's possible !

I have just added a manifest to our dll :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
  </assembly>

hoping that would be the cure, but alas no !

So, I'm open to any suggestions that you folk may have ?!?

Cheers,

Chris.

2

There are 2 best solutions below

0
On

VirtualStore is used when the user doesn't have permissions to write into the requested program folder. So the simpliest solution is to give your users permission. Actually, I like to use a user group so there is some security left.

System Tools > Local Users and Groups > Groups, "New group" and create say "XYZCompanyUsers". Windows Explorer > Program Files (x86) > XYZCompany, "Properties" "Security". Now add the new group "XYZCompanyUsers" and give them full permissions.

0
On

The application needs to have the assembly manifest.

Putting asInvoker in the assembly manifest of a .dll will not help you.

Now our app dll is run from a third party app ( that we obviously have no control over )

You need to tell the 3rd party app to write a correct Windows application. And correctly written Windows applications have an assembly manifest. If their .exe does not have a manifest, then it is not a correctly written Windows application. (A manifest is part of the Windows programming ground rules).

  • if they don't have a manifest: you can create your own and place it in their executable (e.g. using ResourceHacker, or MT which can be found in the Windows 10 SDK)
  • or you can edit their existing assembly manifest (again using Resource Hacker) to include the asInvoker attribute
  • or you can place an external (CotosoApp.exe.manifest) manifest