本文整理匯總了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();
}
示例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);
}
}
}
示例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
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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';
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}