Embed manifest in FireflyShell to avoid compatibility dingus on vista, switch execute method in starting and stopping services from CreateProcess to ShellExecute to allow the annoying f-ing UAC permissings thing to pop up.

This commit is contained in:
Ron Pedde 2007-03-19 21:57:17 +00:00
parent 4547e93785
commit bb7cc3fdf9
4 changed files with 35 additions and 23 deletions

View File

@ -5,4 +5,11 @@
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -321,6 +321,10 @@
>
</File>
</Filter>
<File
RelativePath=".\FireflyShell.exe.manifest"
>
</File>
<File
RelativePath=".\README.txt"
>

View File

@ -19,35 +19,37 @@
#include "DosPath.h"
bool Service::ExecHelper(const TCHAR *szAction) {
PROCESS_INFORMATION pi;
STARTUPINFO si;
CString commandline;
CDosPath path = CDosPath::AppPath();
CDosPath filename(_T("svcctrl.exe"));
DWORD dwResult;
LPTSTR cmd;
filename |= path;
commandline.Format(_T("%s %s \"%s\""),filename.GetPath(),szAction,m_name);
cmd = commandline.GetBuffer(commandline.GetLength() + 1);
SHELLEXECUTEINFO si;
ZeroMemory(&si,sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi,sizeof(pi));
BOOL bStarted = CreateProcess(NULL,cmd,NULL,NULL,
FALSE,0,NULL,NULL,&si,&pi);
si.cbSize = sizeof(si);
si.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
si.hwnd = NULL;
si.lpVerb = _T("open");
commandline.ReleaseBuffer();
CDosPath path = CDosPath::AppPath();
CString strPath = path.GetPathOnly();
si.lpDirectory = static_cast<LPCTSTR>(strPath);
if(!bStarted)
CDosPath filename = CDosPath(_T("svcctrl.exe"));
filename |= path;
CString strFilename = filename.GetPath();
si.lpFile = static_cast<LPCTSTR>(strFilename);
CString strParams;
strParams.Format(_T("%s \"%s\""),szAction,m_name);
si.lpParameters = static_cast<LPCTSTR>(strParams);
si.nShow = 0;
if(!ShellExecuteEx(&si))
return false;
WaitForSingleObject(pi.hProcess, INFINITE);
WaitForSingleObject(si.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess,&dwResult);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
DWORD dwResult;
GetExitCodeProcess(si.hProcess,&dwResult);
if(dwResult)
return false;

View File

@ -170,7 +170,6 @@ NoProgramItems:
File "${CONFIG_SOURCE}\FireflyShell-1d.dll"
File "${CONFIG_SOURCE}\FireflyShell-11.dll"
File "${CONFIG_SOURCE}\FireflyShell-10.dll"
File "${CONFIG_SOURCE}\..\FireflyShell.exe.manifest"
File "${CONFIG_SOURCE}\svcctrl.exe"
File "${DLL_SOURCE}\gnu_regex.dll"
File "${DLL_SOURCE}\pthreadVC2.dll"