当前位置: 首页>>代码示例>>C++>>正文


C++ Detach函数代码示例

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


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

示例1: GetContext

 void
 TerminalDisplay::DisplayInfo(const std::vector<std::string>& Options) {
   char infoColIdx = 0;
   if (GetContext()->GetColorizer()) {
      infoColIdx = GetContext()->GetColorizer()->GetInfoColor();
   }
   WriteRawString("\n", 1);
   for (size_t i = 0, n = Options.size(); i < n; ++i) {
     Text t(Options[i], infoColIdx);
     WriteWrappedElement(t, 0, 0, (size_t) -1);
     WriteRawString("\n", 1);
   }
   // Reset position
   Detach();
   Attach();
 }
开发者ID:0x0all,项目名称:ROOT,代码行数:16,代码来源:TerminalDisplay.cpp

示例2: Attach

void TaskManager::UpdateProcesses(Uint32 deltaMs)
{
    TaskPtr next;
    for (auto current : task_list) {
        if (current->IsDead()) {
            next = current->GetNext();
            if (next) {
                current->SetNext(TaskPtr(nullptr));
                Attach(next);
            }
            Detach(current);
        } else if (current->IsActive() && !current->IsPaused()) {
            current->OnUpdate(deltaMs);
        }
    }
}
开发者ID:stephenap07,项目名称:sp_engine,代码行数:16,代码来源:Task.cpp

示例3: Detach

// ----------------------------------------------------------------------------
void MouseSap::OnWindowClose(wxEvent& event)
// ----------------------------------------------------------------------------
{
    // wxEVT_DESTROY entry

    wxWindow* pWindow = (wxWindow*)(event.GetEventObject());

    if ( (pWindow) && (m_EditorPtrs.Index(pWindow) != wxNOT_FOUND))
    {   // window is one of ours
        Detach(pWindow);
        #ifdef LOGGING
         LOGIT( _T("OnWindowClose Detached %p"), pWindow);
        #endif //LOGGING
    }
    event.Skip();
}//OnWindowClose
开发者ID:stahta01,项目名称:EmBlocks,代码行数:17,代码来源:MouseSap.cpp

示例4: Detach

void cEntity::AttachTo(cEntity * a_AttachTo)
{
	if (m_AttachedTo == a_AttachTo)
	{
		// Already attached to that entity, nothing to do here
		return;
	}

	// Detach from any previous entity:
	Detach();

	// Attach to the new entity:
	m_AttachedTo = a_AttachTo;
	a_AttachTo->m_Attachee = this;
	m_World->BroadcastAttachEntity(*this, a_AttachTo);
}
开发者ID:ravenscroftj,项目名称:MCServer,代码行数:16,代码来源:Entity.cpp

示例5: Detach

/// <summary>
/// Create new process and attach to it
/// </summary>
/// <param name="path">Executable path</param>
/// <param name="suspended">Leave process in suspended state. To resume process one should resume its main thread</param>
/// <param name="forceInit">If 'suspended' is true, this flag will enforce process initialization via second thread</param>
/// <param name="cmdLine">Process command line</param>
/// <param name="currentDir">Startup directory</param>
/// <param name="pStartup">Additional startup params</param>
/// <returns>Status code</returns>
NTSTATUS Process::CreateAndAttach( 
    const std::wstring& path, 
    bool suspended /*= false*/,
    bool forceInit /*= true*/,
    const std::wstring& cmdLine /*= L""*/,
    const wchar_t* currentDir /*= nullptr*/,
    STARTUPINFOW* pStartup /*= nullptr*/
    )
{
    Detach();

    STARTUPINFOW si = { 0 };
    PROCESS_INFORMATION pi = { 0 };
    if (!pStartup)
        pStartup = &si;

    if (!CreateProcessW(
        path.c_str(), const_cast<LPWSTR>(cmdLine.c_str()), 
        NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, 
        currentDir, pStartup, &pi
        ))
    {
        return LastNtStatus();
    } 

    // Get handle ownership
    auto status = _core.Open( pi.hProcess );
    if (NT_SUCCESS( status ))
    {
        _nativeLdr.Init();

        // Check if process must be left in suspended mode
        if (suspended)
        {
            // Create new thread to make sure LdrInitializeProcess gets called
            if (forceInit)
                EnsureInit();
        }
        else
            ResumeThread( pi.hThread );
    }

    // Close unneeded handles
    CloseHandle( pi.hThread );

    return status;
}
开发者ID:ApocalypsEnd,项目名称:Blackbone,代码行数:57,代码来源:Process.cpp

示例6: main

int main(int argc, char *argv[])
{
	HIJACK *hijack;
	FUNC *func;
	unsigned long addr;
	PLT *plts, *plt;
	
	if (argc != 2)
		usage(argv[0]);
	
	hijack = InitHijack();
    ToggleFlag(hijack, F_DEBUG);
    ToggleFlag(hijack, F_DEBUG_VERBOSE);
	AssignPid(hijack, atoi(argv[1]));
	
	if (Attach(hijack) != ERROR_NONE)
	{
		fprintf(stderr, "[-] Couldn't attach!\n");
		exit(EXIT_FAILURE);
	}

	if (LocateAllFunctions(hijack) != ERROR_NONE)
	{
		fprintf(stderr, "[-] Couldn't locate all functions!\n");
		exit(EXIT_FAILURE);
	}

    if (LocateSystemCall(hijack) != ERROR_NONE) {
        fprintf(stderr, "[-] Couldn't locate system call!\n");
        exit(EXIT_FAILURE);
    }

    addr = MapMemory(hijack, NULL, 8192, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_SHARED);
    if (GetErrorCode(hijack) != ERROR_NONE) {
        fprintf(stderr, "[-] %s\n", GetErrorString(hijack));
        perror("ptrace");
    }
	
	printf("[*] PLT/GOT @ 0x%016lx\n", hijack->pltgot);
	printf("[*] Baseaddr @ 0x%016lx\n", hijack->baseaddr);
    printf("[*] Syscall @ 0x%016lx\n", hijack->syscalladdr);
    printf("[*] addr @ 0x%016lx\n", addr);

	Detach(hijack);
	
	return 0;
}
开发者ID:0xDEC0DE8,项目名称:libhijack,代码行数:47,代码来源:MapMemory.c

示例7: switch

void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
	switch (type)
	{
	case GE_ADDON_ATTACH:
		{
			u32 ItemID;
			P.r_u32			(ItemID);
			CInventoryItem*	 ItemToAttach	= smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
			if (!ItemToAttach) break;
			Attach(ItemToAttach,true);
			CActor* pActor = smart_cast<CActor*>(object().H_Parent());
			if (pActor && pActor->inventory().ActiveItem() == this)
			{
				pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
				pActor->inventory().Activate(NO_ACTIVE_SLOT);
				
			}
		}break;
	case GE_ADDON_DETACH:
		{
			string64			i_name;
			P.r_stringZ			(i_name);
			Detach(i_name, true);
			CActor* pActor = smart_cast<CActor*>(object().H_Parent());
			if (pActor && pActor->inventory().ActiveItem() == this)
			{
				pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
				pActor->inventory().Activate(NO_ACTIVE_SLOT);
			};
		}break;	
	case GE_CHANGE_POS:
		{
			Fvector p; 
			P.r_vec3(p);
			CPHSynchronize* pSyncObj = NULL;
			pSyncObj = object().PHGetSyncItem(0);
			if (!pSyncObj) return;
			SPHNetState state;
			pSyncObj->get_State(state);
			state.position = p;
			state.previous_position = p;
			pSyncObj->set_State(state);

		}break;
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:47,代码来源:inventory_item.cpp

示例8: Detach

/*----------------------------------------------------------------------------------------------------------------------
|	Sets all data members to their factory default settings: `inf_open', `logf_open' and `quit_now' are set to false;
|	`message' to the null string, and the pointers `data', `characters', `assumptions', `taxa' and `trees'
|	are all set to NULL. The C-string `next_command' is allocated COMMAND_MAXLEN + 1 bytes if it is currently NULL,
|	and its first byte is set to the null character to create an empty `next_command' string.
*/
void GarliReader::FactoryDefaults()
{
    isEmpty = true;
    inf_open = false;
    logf_open = false;
    quit_now = false;
    message.clear();

    if (trees != NULL)
    {
        Detach(trees);
        delete trees;
        trees = NULL;
    }

    if (taxa != NULL)
    {
        Detach(taxa);
        delete taxa;
        taxa = NULL;
    }

    if (assumptions != NULL)
    {
        Detach(assumptions);
        delete assumptions;
        assumptions = NULL;
    }

    if (distances != NULL)
    {
        Detach(distances);
        delete distances;
        distances = NULL;
    }

    if (characters != NULL)
    {
        Detach(characters);
        delete characters;
        characters = NULL;
    }

    if (data != NULL)
    {
        Detach(data);
        delete data;
        data = NULL;
    }

    if (next_command == NULL)
        next_command = new char[COMMAND_MAXLEN + 1];
    next_command[0] = '\0';
}
开发者ID:rekepalli,项目名称:garli,代码行数:60,代码来源:garlireader.cpp

示例9: DefWindowProc

/**
 * Windows のウィンドウが破棄されるときに非クライアント領域が破棄されると、最後に呼び出されたメンバー関数は、フレームワークによって呼び出されます
 * @param[in] wParam パラメタ
 * @param[in] lParam パラメタ
 */
void CWndProc::OnNcDestroy(WPARAM wParam, LPARAM lParam)
{
	LONG_PTR pfnWndProc = ::GetWindowLongPtr(m_hWnd, GWLP_WNDPROC);
	DefWindowProc(WM_NCDESTROY, wParam, lParam);
	if (::GetWindowLong(m_hWnd, GWLP_WNDPROC) == pfnWndProc)
	{
		if (m_pfnSuper != NULL)
		{
			::SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_pfnSuper));
			m_pfnSuper = NULL;
		}
	}
	Detach();

	// call special post-cleanup routine
	PostNcDestroy();
}
开发者ID:MaddTheSane,项目名称:np2,代码行数:22,代码来源:WndProc.cpp

示例10: Detach

CDataNode& 
CDataNode::operator=( const CDataNode& src )
{GUCEF_TRACE;

    if ( this != &src )
    {
        // detach from our current tree
        Detach();
        DelSubTree();
        
        _name = src._name;
        m_value = src.m_value;
        _atts = src._atts;

    }               
    return *this;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:17,代码来源:CDataNode.cpp

示例11: LOGINFO

void cLuaState::Attach(lua_State * a_State)
{
	if (m_LuaState != NULL)
	{
		LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, m_LuaState);
		if (m_IsOwned)
		{
			Close();
		}
		else
		{
			Detach();
		}
	}
	m_LuaState = a_State;
	m_IsOwned = false;
}
开发者ID:ravenscroftj,项目名称:MCServer,代码行数:17,代码来源:LuaState.cpp

示例12: Detach

dBaseHierarchy::~dBaseHierarchy () 
{
	dBaseHierarchy *ptr;
	dBaseHierarchy *tmp;

	if (m_parent) {
		Detach();
	}

	for (ptr = m_child; ptr; ptr = tmp) {
		tmp = ptr->m_sibling;
		_ASSERTE (0);
		tmp->m_parent = NULL;
		delete ptr;
	}

}
开发者ID:brettminnie,项目名称:BDBGame,代码行数:17,代码来源:dBaseHierarchy.cpp

示例13: Create

 /*
  * Creates a new Mutex object.
  */
  bool Create(LPSECURITY_ATTRIBUTES lpSA = NULL, BOOL bInitialOwn = TRUE,
              const TCHAR *szName = NULL)
  {

    bool r = false;

    Detach();

    if (NULL != (m_hMutex = CreateMutex(lpSA, bInitialOwn, szName))) {

      m_tsName  = szName;
      r         = true;

    }

    return r;
  }
开发者ID:ryanlederman,项目名称:extfilecopy,代码行数:20,代码来源:mutex.hpp

示例14: Detach

void Node::AttachChild(Node * c)
{
 Detach();

 if (child)
 {
  c->next = child;
  c->last = child->last;
  child = c;
 
  child->next->last = child;
  child->last->next = child;  
 }
 else child = c;
 
 child->parent = this;
}
开发者ID:PeterZhouSZ,项目名称:hyperion,代码行数:17,代码来源:node.cpp

示例15: Detach

HRESULT fsShellBrowsersEvents::Attach(SHDocVw::IShellWindowsPtr& spSHWnds)
{
	if (m_bDetaching)
		return S_FALSE;

	if (is_Attached ())
		Detach ();

	LONG cItems = spSHWnds->GetCount ();
	HRESULT hr;

	
	for (LONG i = 0; i < cItems; i++)
	{
		try {
		IDispatchPtr spDisp;
		_variant_t va (i, VT_I4);
		
		spDisp = spSHWnds->Item (va);

		SHDocVw::IWebBrowser2Ptr spBrowser (spDisp);

		if (spBrowser == NULL)
			continue;

		
		fsShellBrowsersEvents* pBrowser = new fsShellBrowsersEvents;
		
		hr = pBrowser->Attach (spBrowser);

		if (FAILED (hr))
		{
			delete pBrowser;
			return hr;
		}

		pBrowser->SetEventFunc (m_pfnEvents, m_lpEventsParam);

		m_vBrowsers.add (pBrowser);
		}
		catch (...) {}
	}
	
	return S_OK;
}
开发者ID:pedia,项目名称:raidget,代码行数:45,代码来源:fsshellbrowsersevents.cpp


注:本文中的Detach函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。