-1

Our software encountered a problem seems that if the user who installed the software and the user who operates it are not the same one, some functions might fail.

I'm investigating the problem,

Get current username in C++ on Windows

Now I want to know one or two functions that would behave diferently under different user, so I can test the problem.

if(someFunction())
{
cout<<"That works under user:"<<GetUsername()<<endl;
}else
{
cout<<"That doesn't works under user:"<<GetUsername()<<endl;
}

Edit:

Our software already is set to require run as administrator,

How to run application with Admin privileges using Manifest file in Visual Studio 2005?

Zhang
  • 3,030
  • 2
  • 14
  • 31
  • The canonical example is `CreateFile` for a file with an NTFS ACL set. – Dai Dec 18 '20 at 09:31
  • A common problem is that installing a program actually writes a bunch of information in the use *profile* (files under `c:\User\username\Appdata`) or in the register under HKCU (still depending on username, because CU stands for Current User). If a different user tries to use the application, the program cannot find its informations and aborts.. – Serge Ballesta Dec 18 '20 at 09:44

1 Answers1

0

There are many functions that would exhibit this behavior, almost every function that operates outside the program itself (I guess). In modern windows, there are a lot of fine grained control over what a user can or cannot do - running as elevated user is actually a different concept (for example, elevation does not automaticly grant all permissions).

darune
  • 10,480
  • 2
  • 24
  • 62