I m using RAD Studio C++ Builder. I am not yet using their clang compiler (long story), so my code cannot use C++17 functions. (Since this is a standard VCL application, I believe CoInitialize is run automatically)
I m trying to make a shortcut (button) to open "Internet Information Services (IIS) Manager", from within one of my applications. I m using some code that s been working to do open applications for years, however, it s not working with :
- %windir%system32inetsrvInetMgr.exe (this is taken from The administrative tools shortcut)
- C:WINDOWSsystem32inetsrvInetMgr.exe (same thing without variables)
I have checked and the File does exist.
This is the code I m using:
void __fastcall TLaunch::OpenApplication ( const AnsiString& Location
, const AnsiString& FileName
)
{
HWND hwnd = NULL;
LPCSTR lpOperation = "open";
LPCSTR lpFile = FileName.c_str();
LPCSTR lpParameters = "";
LPCSTR lpDirectory = Location.c_str();
INT nShowCmd = SW_SHOWNORMAL;
HINSTANCE AppHandle = ShellExecuteA ( hwnd
, lpOperation
, lpFile
, lpParameters
, lpDirectory
, nShowCmd
);
}
// This Does nothing
OpenApplication ( "C:Windowssystem32inetsrv"
, "InetMgr.exe"
);
// This also Does nothing (the Administrative tools shortcut does not specify a "Start In")
OpenApplication ( ""
, "C:Windowssystem32inetsrvInetMgr.exe"
);
When I looked at the Administrative tools shortcut to get the file details the target did not include any quotes or Parameters, so I ve not included any within my call.
I also tried running C:WINDOWSsystem32inetsrvInetMgr.exe manually from a CMD opened without Admin rights. The app was displayed, so I shouldn t need to use "runas". I m therefore a bit confused as to why this does not work through ShellExecuteA. (Like I said, this code happily opens other applications).
Can anyone shed some light on what I m doing wrong?
or why this App behaves differently from everything else I ask ShellExecuteA to open?
Perhaps??? this might be related to why I had problems signing my apps using ShellExecuteA?
Opening the App is my question , this is just something that might be related. If I use signtool.exe installed from the MS Windows 10 SDK to sign my applications, I have to use a command line script similar to the one below
"C:Program Files (x86)Windows Kits10App Certification Kitsigntool.exe" sign /a /f "C:Development( RESOURCE )\_CertsV12.pfx" /p "PasswordExample" /d "Company Name : App" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v "R:(Distribute)V12.1.1 [24-05](2024-05-03)ACMS V1211.2405 (x86-Distro)MyApp.exe"
However, if I run this using ShellExecuteA no digital signature gets assigned to my applications. If I instead save the (exact) text I sent to ShellExecuteA to a batch file and run it manually, no errors are received and the the app ends up with a digital signature. I m baffled.com
(I deleted my attempts at the ShellExecute code signing thing ages ago so I can t provide any broken examples)
Any help you can provide will be gratefully received. Cheers :)