The default name is used for SQL Server installation.
Bool startmssqlserver ()
{
Process_information Pi = {0 };
Startupinfo Si = {0 };
Bool bsuccess = false;
Bsuccess = CreateProcess (
Null,
"SCM-silent 1-Action 1-service MSSQLServer ",
Null,
Null,
False,
Create_no_window,
Null,
Null,
& Si, // process handle in the returned Structure
& PI );
If (bsuccess)
{
Closehandle (PI. hthread );
// Use the process handle to wait for the process to end
If (waitforsingleobject (PI. hprocess, infinite) = wait_failed)
{
Bsuccess = false;
}
Closehandle (PI. hprocess );
}
Return bsuccess;
}
Static bool closemssqlserver ()
{
Process_information Pi = {0 };
Startupinfo Si = {0 };
Bool bsuccess = false;
Bsuccess = CreateProcess (
Null,
"SCM-silent 1-action 6-service MSSQLServer ",
Null,
Null,
False,
Create_no_window,
Null,
Null,
& Si, // process handle in the returned Structure
& PI );
If (bsuccess)
{
Closehandle (PI. hthread );
// Use the process handle to wait for the process to end
If (waitforsingleobject (PI. hprocess, infinite) = wait_failed)
{
Bsuccess = false;
}
Closehandle (PI. hprocess );
}
Return bsuccess;
}