Solved

VC++ 6.0 App must run as Admin to access a DB in the Common Application Data area

Posted on 2011-03-02
10
452 Views
Last Modified: 2012-06-27
I have an old C++/MFC app written with VS 6. I am trying to make it compliant with Windows Vista and 7 by moving the DB directory to the Common Application Data area. But when I try to open the Access DB using DAO it reads the primary table, finds no records, and reports that no data is found. However, if I select "Run as Admin", then records are found and the app runs like normal and without any issue.

Should I be storing the database in another location? If not, why does it fail to read the table correctly?

Also, I have tried using the attached manifest, that I found online and modified slightly, but it does not seem to force the application to run as admin and so I still get the no data found message. I don't know much about manifests yet, so it could be that I didn't configure it correctly.

I would appreciate it if you could provide me with the correct location to store the DB, so multiple users on a single computer can access it and/or a method of getting this app to run as Admin.

Thanks for any help or advise you can give.


F-Apps.manifest
0
Comment
Question by:no_hop
  • 6
  • 3
10 Comments
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 35017730
http://msdn.microsoft.com/en-us/library/bb756929.aspx

Can you try with:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 35018007
Another way is to set ACL on AppData folder during the installation/before starting the application.

Regarding cacls command:
http://technet.microsoft.com/en-us/library/bb490872.aspx
http://en.wikipedia.org/wiki/Cacls
0
 

Author Comment

by:no_hop
ID: 35018323
The initial comment to try: <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
did not make any difference.

I did notice that if I copy the application to some other folder that is not under the Program Files folder, say C:\MyApp; then it seems to recognize the manifest and ask the user about allowing this app to control the system.  If I select Yes, then everything seemed to work fine.  Why is that?  Also, how do I avoid that popup everytime I start the application?

With regard to the second comment to use CACLS, the instructions seem to imply that you must specify a user name and I need it to support any user and not just the one that installs it.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 11

Accepted Solution

by:
DeepuAbrahamK earned 250 total points
ID: 35019481
What about this?
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 35024635
0
 
LVL 11

Assisted Solution

by:cup
cup earned 250 total points
ID: 35048391
You can specify the user everyone.  eg

cacls xxx.mdb /E /G everyone:C

It keeps the old permissions /E
It grants (/G) everyone change permission (C)
0
 

Author Closing Comment

by:no_hop
ID: 35051695
I could not seem to find a suitable answer, so I just upgraded the application from VS 6 to VS 2008 and used a built-in manifest that seems to work.
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 35053261
Thanks for letting me know about that. Much appreciated.
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 35053262
BTW. did you make any modifications in your manifest?
0
 

Author Comment

by:no_hop
ID: 35060907
No matter what I did, the VC++ 6 compiled app would not run from the Program Files folder.  
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question