all groups > sql server msde > june 2004 >
You're in the

sql server msde

group:

MSDE installer problem


MSDE installer problem Usman Jamil
6/26/2004 2:51:29 PM
sql server msde:
Hi
I'm working in visual C++ and through it I start MSDE setup.exe. I have to
wait in my VC++ code before the MSDE installer is finished totally. The
problem i'm having is that as soon as I initiate the process of MSDE
setup.exe, i get its finished status in my VC waiting code, though the
installer is still running. I've tried running the MSDE setup.exe from the
command line and i see that the status also come back to prompt just a
second after the setup.exe is run. I was wondering how can i keep the
control from coming back to the setup.exe instantiating application unless
the whole setup.exe is complete. Hope i've made my point clear.

Regards
Usman Jamil

Re: MSDE installer problem viki
6/28/2004 10:38:42 AM
Hi Usman,

Try this code: here WaitForSingleObject( ) waits till your process gets =
completed. I used the same for installing MSDE through my setup =
launcher.

Cheers=20

Piyush


int ExecCmd(char * pszCmd )
{
BOOL bReturnVal =3D false ;
STARTUPINFO si ;
DWORD dwExitCode ;
SECURITY_ATTRIBUTES saProcess, saThread ;
PROCESS_INFORMATION process_info ;
ZeroMemory(&si, sizeof(si)) ;
si.cb =3D sizeof(si) ;

saProcess.nLength =3D sizeof(saProcess) ;
saProcess.lpSecurityDescriptor =3D NULL ;
saProcess.bInheritHandle =3D TRUE ;

saThread.nLength =3D sizeof(saThread) ;
saThread.lpSecurityDescriptor =3D NULL ;
saThread.bInheritHandle =3D FALSE ;

bReturnVal =3D CreateProcess(NULL, (LPTSTR)pszCmd, &saProcess, =
&saThread, FALSE,
DETACHED_PROCESS,=20
NULL,=20
NULL,=20
&si,=20
&process_info) ;


if (bReturnVal)
{
CloseHandle( process_info.hThread ) ;
WaitForSingleObject( process_info.hProcess, INFINITE ) ;
GetExitCodeProcess( process_info.hProcess, &dwExitCode ) ;
CloseHandle( process_info.hProcess ) ;

}

return dwExitCode;

}





[quoted text, click to view]
Re: MSDE installer problem Usman Jamil
6/29/2004 6:57:05 PM
Hi viki

I dont know how it worked in your case but its not supposed to work and i've
checked it too. It wont work coz the Waitforsingleobject would also return
as soon as the process created is finished. and when we run the process
setup.exe, this setup.exe script asks the windows installer service to run
the actull installer and it exits itself thus breaking the
waitforsingleobject lock too. So it would not work for MSDE installer from
C++ code. Anyway thanx for your help. :)

Still waiting for a solution..

Regards

Usman Jamil
[quoted text, click to view]
Hi Usman,
Try this code: here WaitForSingleObject( ) waits till your process gets
completed. I used the same for installing MSDE through my setup launcher.
Cheers
Piyush

int ExecCmd(char * pszCmd )
{
BOOL bReturnVal = false ;
STARTUPINFO si ;
DWORD dwExitCode ;
SECURITY_ATTRIBUTES saProcess, saThread ;
PROCESS_INFORMATION process_info ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
saProcess.nLength = sizeof(saProcess) ;
saProcess.lpSecurityDescriptor = NULL ;
saProcess.bInheritHandle = TRUE ;
saThread.nLength = sizeof(saThread) ;
saThread.lpSecurityDescriptor = NULL ;
saThread.bInheritHandle = FALSE ;
bReturnVal = CreateProcess(NULL, (LPTSTR)pszCmd, &saProcess, &saThread,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&si,
&process_info) ;

if (bReturnVal)
{
CloseHandle( process_info.hThread ) ;
WaitForSingleObject( process_info.hProcess, INFINITE ) ;
GetExitCodeProcess( process_info.hProcess, &dwExitCode ) ;
CloseHandle( process_info.hProcess ) ;
}
return dwExitCode;
}



[quoted text, click to view]

AddThis Social Bookmark Button