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

Posted on 2011-03-02
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.

Question by:no_hop
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
LVL 11

Expert Comment

ID: 35017730

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

Expert Comment

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

Regarding cacls command:

Author Comment

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.
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

LVL 11

Accepted Solution

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

Expert Comment

ID: 35024635
LVL 11

Assisted Solution

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)

Author Closing Comment

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.
LVL 11

Expert Comment

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

Expert Comment

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

Author Comment

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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Compress Newid value ms sql Mssql 4 45
Access Query function 4 50
MFC COM Server not showing  form 4 25
Sharepoint list value updated via access or Excel 3 31
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

739 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