5

I'm running VS2K8 in Win7 64-bit. I'm logged in as admin and I'm running it as admin, but the program I'm working on fails with access denied when I call a restricted API. If run the program from Explorer with "Run as Administrator" it works.

I was under the belief that VS2K8 debugs programs with whatever rights VS2K8 itself is running with. As it stands I can't debug my application due to this and I'm at a loss as to what's going on.

ChrisF
  • 41,278
  • 17
  • 101
  • 154
brian
  • 51
  • 1
  • 1
  • 2

2 Answers2

3

Although you are logged on as admin, any program you run in Win7 has reduced permissions. Therefore, even an admin needs to use "Run as Administrator" to run with full permissions.

Use Visual Studio with "Run as Administrator" to find out if that's what's going on.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • I haven't had any problems debugging applications on my machine so far, though. Even with UAC enabled and running as a standard user. – Joey Jun 20 '10 at 20:01
  • @Johannes Rössel: Me neither, but we don't know his exact configuration. This looks like a permissions problem, and UAC is normally to blame for "Run as Administrator" problems. – harrymc Jun 21 '10 at 06:19
  • 2
    Re-reading the question, it probably is enough when running VS with administrative privileges. They explicitly stated that “was under the belief that VS2K8 debugs programs with whatever rights VS2K8 itself is running with” – VS running as normal user simply cannot debug an application running as another user so that should suffice, I think. – Joey Jun 21 '10 at 08:33
  • @Johannes Rössel: Where in the post do you see running as another user? – harrymc Jun 21 '10 at 10:01
  • “with whatever rights VS2K8 itself is running with” points either to a different user or a restricted token. At least I read it like that. – Joey Jun 21 '10 at 17:45
  • @Johannes Rössel: I read this as contrast between logon as Administrator and still needing to do "Run as Administrator", the classic gotcha in Win7. – harrymc Jun 21 '10 at 20:04
  • As I said, restricted token. From a system perpective there isn't much of a difference to another user. – Joey Jun 21 '10 at 20:25
  • @Joey's suggestion of using "Run as administrator" on VS worked for me – JoeCool Jul 19 '11 at 14:53
  • Who down-voted a working solution? – harrymc Jun 23 '12 at 08:11
  • @harrymc Probably the same person who is flagging some of your answers as *not an answer*. I don't know why though. – slhck Jun 23 '12 at 08:19
  • @harrymc Two if I recall correctly. Other community users disputed those flags as "invalid", so there shouldn't be any problem. If you *do* have additional questions, maybe visit the moderator chat room. – slhck Jun 23 '12 at 09:24
  • @harrymc I apologise for the downvote, it was unintentional and caused purely by fat fingers on a mobile phone screen. I have removed it now. The flags on the other hand are nothing to do with me and I've been marking them as "invalid", it was them that brought me here and to the accidental downvote. – Mokubai Jun 23 '12 at 11:51
  • @Mokubai: No problem - thanks for letting me know. Cheers. – harrymc Jun 23 '12 at 14:51
0

Run Visual Studio as "Run as administrator" and in the manifest file set the value of requestedExecution level as requireAdministrator.

bluish
  • 495
  • 3
  • 10
Dhanya
  • 1