/*++

Routine Description:

    This function is executed when a Stop command is sent to the service by SCM.
    It specifies actions to take when a service stops running.  In this code
    sample, OnStop logs a service-stop message to the Application log, and
    waits for the finish of the main service function.

    Be sure to periodically call ReportServiceStatus() with
    SERVICE_STOP_PENDING if the procedure is going to take a long time.

Arguments:

    VOID

Return Value:

    VOID

--*/
VOID
CSampleService::OnStop()
{
    //
    // Log a service stop message to the Application log.
    //
    WriteToEventLog(L"SampleService in OnStop", 
                    EVENTLOG_INFORMATION_TYPE);

    //
    // Indicate that the service is stopping and wait for the finish of the 
    // main service function (ServiceWorkerThread).
    //
    m_fStopping = TRUE;

    if (WaitForSingleObject(m_hStoppedEvent, INFINITE) != WAIT_OBJECT_0)
    {
        throw GetLastError();
    }

    //
    // Clean up the context after the worker thread has finished.
    //
    CloseContext(m_Context);
}
Exemple #2
0
/*
 * Pop the top context off the context stack, and make it the current
 * context.  The current context must be closed before calling PopContext.
 */
void PopContext( void )
/*********************/
{
    CloseContext();
    if( stackItems == 0 )  Zoinks();
    memcpy( &curContext, &stack[stackItems-1], sizeof(struct Context) );
    stackItems--;
    curContextInitialized = 1;
}
void CFileFind::Close()
/*********************/
{
    if( m_pFoundInfo != NULL ) {
        delete (LPWIN32_FIND_DATA)m_pFoundInfo;
    }
    if( m_pNextInfo != NULL ) {
        delete (LPWIN32_FIND_DATA)m_pNextInfo;
    }
    CloseContext();
}
Exemple #4
0
/*
 * Parse the command string contained in the current context.
 */
void CmdStringParse( OPT_STORAGE *cmdOpts, int *itemsParsed )
/***********************************************************/
{
    int                 ch;
    char *              filename;

    for( ;; ) {
        /*** Find the start of the next item ***/
        CmdScanWhitespace();
        ch = GetCharContext();
        if( ch == '\0' )  break;
        MarkPosContext();               /* mark start of switch */

        /*** Handle switches, command files, and input files ***/
        if( ch == '-'  ||  ch == '/' ) {        /* switch */
            if( OPT_PROCESS( cmdOpts ) != 0 ) {
                cmd_line_error();
            }
        } else if( ch == '@' ) {                /* command file */
            filename = CmdScanFileNameWithoutQuotes();
            PushContext();
            if( OpenFileContext( filename ) ) {
                FatalError( "Cannot open '%s'.", filename );
            }
            FreeMem( filename );
            CmdStringParse( cmdOpts, itemsParsed );
            PopContext();
        } else if( ch == '"' ) {                /* quoted option or file name */
            ch = GetCharContext();
            if( ch == '-' ) {
                Quoted = 1;
                if( OPT_PROCESS( cmdOpts ) != 0 ) {
                    cmd_line_error();
                }
            } else {
                UngetCharContext();
                UngetCharContext();
                filename = CmdScanFileName();
                AddFile( TYPE_DEFAULT_FILE, filename );
                FreeMem( filename );
            }                
        } else {                                /* input file */
            UngetCharContext();
            filename = CmdScanFileName();
            AddFile( TYPE_DEFAULT_FILE, filename );
            FreeMem( filename );
        }
        (*itemsParsed)++;
    }
    CloseContext();
}
Exemple #5
0
// ---
void CAvpFileFindW::Close() {
	if (m_pFoundInfo != NULL)	{
		delete m_pFoundInfo;
		m_pFoundInfo = NULL;
	}

	if (m_pNextInfo != NULL) {
		delete m_pNextInfo;
		m_pNextInfo = NULL;
	}

	if (m_hContext != NULL && m_hContext != INVALID_HANDLE_VALUE)	{
		CloseContext();
		m_hContext = NULL;
	}
}
Exemple #6
0
/*
 * Parse the command string contained in the current context.
 */
void CmdStringParse( OPT_STORAGE *cmdOpts, int *itemsParsed )
/***********************************************************/
{
    char                ch;
    char *              filename;
    char *              str;

    for( ;; ) {
        /*** Find the start of the next item ***/
        CmdScanWhitespace();
        ch = GetCharContext();
        if( ch == '\0' )  break;
        MarkPosContext();               /* mark start of switch */

        /*** Handle switches, command files, and input files ***/
        if( ch == '-'  ||  ch == '/' ) {        /* switch */
            if( OPT_PROCESS( cmdOpts ) ) {
                /*
                 * Switch didn't match, if user entered empty switch,
                 * just be silent like MS's nmake does.
                 */

                ch = GetCharContext();
                if( ch != '\0' && !isspace( ch ) ) {
                    cmd_line_error();
                }
            }
        } else if( ch == '@' ) {                /* command file */
            filename = CmdScanFileNameWithoutQuotes();
            PushContext();
            if( OpenFileContext( filename ) ) {
                FatalError( "Cannot open '%s'.", filename );
            }
            FreeMem( filename );
            CmdStringParse( cmdOpts, itemsParsed );
            PopContext();
        } else {                                /* targets and macros */
            UngetCharContext();
            str = CmdScanString();
            add_string( &(cmdOpts->t010101010101_value), str, '\0' );
            cmdOpts->t010101010101 = 1;
        }
        (*itemsParsed)++;
    }
    CloseContext();
}
Exemple #7
0
void metaxml(ofstream * fout) {

  *fout<<"     <configFile>&lt;?xml version='1.0'?&gt;"<<endl;
  *fout<<"&lt;xc:Partition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"  xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xc=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XMLConfiguration-30\"&gt;"<<endl;

  if (!ttc_) { //a (successful) test -- this is a modification from the working configurations in the past
    *fout<<Context("GlobalErrorDispatcher")<<endl;
    
    *fout<<App("GlobalErrorDispatcher")<<endl;
    *fout<<Module("GlobalErrorDispatcher")<<endl;
    *fout<<App("AjaxLogReader")<<endl;
    *fout<<Module("AjaxLogReader")<<endl;
    *fout<<CloseContext()<<endl;
  }

  *fout<<Context("PixelSupervisor")<<endl;
  *fout<<Endpoint("PixelSupervisor")<<endl;
  *fout<<App("PixelSupervisor")<<endl;
  if (!ttc_) *fout<<Module("xdaq2rc")<<endl;
  if (!ttc_)   *fout<<Module("PixelSupervisor")<<endl;
  *fout<<CloseContext()<<endl;

  *fout<<Context("PixelDCSFSMInterface")<<endl;
  *fout<<Endpoint("PixelDCSFSMInterface")<<endl;
  *fout<<App("PixelDCSFSMInterface")<<endl;

  *fout<<App("PixelDCStoTrkFECDpInterface")<<endl;
  if (!ttc_)   *fout<<Module("PixelDCSFSMInterface")<<endl;

  *fout<<App("tstore::TStore")<<endl;
  if (!ttc_) {
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libtstoreutils.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libxalan-c.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libxoapfilter.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libtstore.so")<<endl;
  }
  *fout<<CloseContext()<<endl;

  for (int jj=1; jj<=3; jj++) {

    if (fpixonly_ && jj!=3) continue;
    if (bpixonly_ && jj==3) continue;

    *fout<<Context("PixelFEDSupervisor",jj)<<endl;
    *fout<<Endpoint("PixelFEDSupervisor",jj)<<endl;
    
    *fout<<App("PixelFEDSupervisor",jj)<<endl;
  if (!ttc_)     *fout<<Module("PixelFEDSupervisor")<<endl;
    
    *fout<<XApp("xplore::Application","appshort")<<endl;
    if (!ttc_) {
      *fout<<MiscModule("/lib/libslp.so")<<endl;
      *fout<<MiscModule("${XDAQ_ROOT}/lib/libxslp.so")<<endl;
      *fout<<MiscModule("${XDAQ_ROOT}/lib/libxploreutils.so")<<endl;
      *fout<<MiscModule("${XDAQ_ROOT}/lib/libxplore.so")<<endl;
    }    

    *fout<<XApp("sentinel::Application","applong")<<endl;
    if (!ttc_) {
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libwsaddressing.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libwseventing.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libsentinelutils.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libsentinel.so")<<endl;
    }
    
    *fout<<XApp("xmas::sensor::Application","applong")<<endl;
    if (!ttc_) {
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libwsutils.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libxmasutils.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libwsbrokerutils.so")<<endl;
    *fout<<MiscModule("${XDAQ_ROOT}/lib/libxmassensor.so")<<endl;
    }
    *fout<<CloseContext()<<endl;
  }

  for (int jj=1; jj<=2; jj++) {

    if (fpixonly_ && jj!=2) continue;
    if (bpixonly_ && jj!=1) continue;

    *fout<<Context("PixelFECSupervisor",jj)<<endl;
    *fout<<Endpoint("PixelFECSupervisor",jj)<<endl;
    *fout<<App("PixelFECSupervisor",jj)<<endl;
    if (!ttc_)     *fout<<Module("PixelFECSupervisor")<<endl;
    *fout<<CloseContext()<<endl;
  }

  for (int jj=1; jj<=2; jj++) {

    if (fpixonly_ && jj!=2) continue;
    if (bpixonly_ && jj!=1) continue;

    *fout<<Context("PixelTKFECSupervisor",jj)<<endl;
    //for reasons that i do not understand, there is no endpoint in our model configuration for instance 1
    //it appears that our configurations are inconsistent in their use of endpoints
    if (jj==2) *fout<<Endpoint("PixelTKFECSupervisor",jj)<<endl;
    *fout<<App("PixelTKFECSupervisor",jj)<<endl;
    if (!ttc_)     *fout<<Module("PixelTKFECSupervisor")<<endl;
    *fout<<CloseContext()<<endl;
  }

  for (int jj=1; jj<=2; jj++) {

    if (fpixonly_ && jj!=2) continue;
    if (bpixonly_ && jj!=1) continue;

    *fout<<Context("ttc::TTCciControl",jj)<<endl;
    //it seems that some configs have no endpoints for the ttc , but others do
    *fout<<Endpoint("ttc::TTCciControl",jj)<<endl;
    *fout<<App("ttc::TTCciControl",jj)<<endl;
    //this 'if' is new. If we are running from rpm then we only want this included in the TTC xdaq application block

    if (ttc_)  {
		*fout<<Module("ttc::TTCciControl")<<endl;
    	// marc *fout<<MiscModule("${XDAQ_ROOT}/lib/libttcttcci.so")<<endl;
    	*fout<<MiscModuleTTC("file:///opt/xdaq/lib/libttcutils.so")<<endl;
    	*fout<<MiscModuleTTC("file:///opt/xdaq/lib/libttcmonitoring.so")<<endl;
	}
    *fout<<CloseContext()<<endl;
  }

  *fout<<Context("psx")<<endl;
  //this is going to leave the instance=0 out of the psx server def'n
  //i will have to test if this is ok
  *fout<<XApp("psx","applong")<<endl;
  *fout<<CloseContext()<<endl;

  //not using this anymore!
//   *fout<<Context("psxtk")<<endl;
//   *fout<<XApp("psxtk","applong")<<endl;
//   *fout<<CloseContext()<<endl;

  *fout<<RCMS()<<endl;
  *fout<<JobControlBlock()<<endl;
  *fout<<"&lt;/xc:Partition&gt;</configFile>\n   </XdaqExecutive>"<<endl<<endl;


}