I tried both my C drive and my M drive (flash drive). I am trying to run a program as admin from my C++ executable. When I run it gives the following error:
Windows cannot find 'M'. Make sure you typed the name correctly, and then try again.
Replacing M with whatever drive I put it in. Here is my code:
Mixing strlen() and wchar_t as you do in your code will give you unexpected results, learn about UNICODE prepocessor definition, it is an article on this website.
I will try the PathRemoveFileSpec() but I noticed you linked an article on MSDN, I am using pure C++, not VC++. I am not a big fan of .NET framework when it can be done in the same/similar language. And on the strlen() and wchar_t, I don't understand, I didn't use strlen() on the wchar_t I used it on char...
UPDATE:
I tried the PathRemoveFileSpec() and got this error
C:\Users\Timberwolf\Documents\C++ Projects\Tool Belt UAC Launcher\main.cpp|7|error: 'PathRemoveFileSpec' was not declared in this scope|
and here is main.cpp
removed to shorten post
and main.h
removed to shorten post
EDIT:
Added #include "Shlwapi.h"
to main.h
and got a different error:
C:\Users\Timberwolf\Documents\C++ Projects\Tool Belt UAC Launcher\main.cpp|7|undefined reference to `_imp__PathRemoveFileSpecA@4'|
EDIT:
Removed the include and created a function that works the way I want...
ok, I got it to "find" M. However its starting itself up in an endless loop... I don't uderstand that because I used this, which points to uac.exe and not app.exe: