-
July 27th, 2015, 01:42 AM
#1
Running silent installation with CreateProcess
Hi guys,
I am trying to create a silent process with CreateProcess API. I have yet succeeded to do so. So i ask for your help, which is kindly appreciated.
Code:
DWORD RunSilent(const char* strFunct, const char* strstrParams)
{
STARTUPINFOA StartupInfo;
PROCESS_INFORMATION ProcessInfo;
char Args[4096];
char *pEnvCMD = NULL;
char *pDefaultCMD = "CMD.EXE";
ULONG rc;
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_HIDE;
Args[0] = 0;
pEnvCMD = getenv("COMSPEC");
if (pEnvCMD){
strcpy(Args, pEnvCMD);
}
else{
strcpy(Args, pDefaultCMD);
}
// "/c" option - Do the command then terminate the command window
strcat(Args, " /c ");
//the application you would like to run from the command window
strcat(Args, strFunct);
strcat(Args, " ");
//the parameters passed to the application being run from the command window.
strcat(Args, strstrParams);
strcat(Args, " /S /norestart /q");
if (!CreateProcessA(NULL, Args, NULL, NULL, FALSE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&StartupInfo,
&ProcessInfo))
{
return GetLastError();
}
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
if (!GetExitCodeProcess(ProcessInfo.hProcess, &rc))
rc = 0;
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
return rc;
}
I also tried escaping the backslashes it didn;t help....Perhaps it needs something specific.
Thanks.
-
July 27th, 2015, 02:24 AM
#2
Re: Running silent installation with CreateProcess
What do you mean by silent? by installation?
In case some well known installer system is implied, you have to refer to correspondent documentation.
As for your code, it's not clear what sort of issue you are facing, as you provide no description of what happens under what circumstances, and what is expected to happen. Just asking for help hardly would work for you in this forum.
Best regards,
Igor
-
July 27th, 2015, 02:36 AM
#3
Re: Running silent installation with CreateProcess
Hi For instance, i wanted to install Dropbox silently. By silently , i mean just execute the process , So user does not see any windows about "Installing ........" or "Downloading......".
I want to be able to open a start application of the DropBox without him the installation windows. Is it possible?
Thanks
-
July 27th, 2015, 02:44 AM
#4
Re: Running silent installation with CreateProcess
Originally Posted by NirDemchog
Hi For instance, i wanted to install Dropbox silently. By silently , i mean just execute the process , So user does not see any windows about "Installing ........" or "Downloading......".
I want to be able to open a start application of the DropBox without him the installation windows. Is it possible?
Thanks
It depends if the dropbox installation can be run silently.
-
July 27th, 2015, 06:10 AM
#5
Re: Running silent installation with CreateProcess
Originally Posted by NirDemchog
Hi For instance, i wanted to install Dropbox silently. By silently , i mean just execute the process , So user does not see any windows about "Installing ........" or "Downloading......".
I want to be able to open a start application of the DropBox without him the installation windows. Is it possible?
Well, I think a correct question is if it is acceptable for your users.
A standard security policy implies user is informed about any change done in the system, and explicitly confirms that change. Any software playing dirty tricks with installations, like invisible or looking-innocent-but-bundled-with-sneaky-third-parties or mimic-something-else setups should be expelled as soon as possible, that's what I think about this sort of malware.
Best regards,
Igor
-
July 27th, 2015, 07:26 AM
#6
Re: Running silent installation with CreateProcess
In the end i solved it by ShellExecuteEx , and of course i needed to pass right arguments to the installer.
Thanks everyone who answered.
-
July 27th, 2015, 07:28 AM
#7
Re: Running silent installation with CreateProcess
By the way,
I believe if you install some weird stuff then maybe, but here user is himself clicking on the dropbox and i just wanted to install it silently.
I dont install something the user himself does not want.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|