Node *DeleteNode(Node *first, timeData time, strData str) { Node *node, *iter; if (first == NULL) return first; if (fabs(first->Data.time - time) < 0.001) { node = first; strcpy(str, first->Data.str); first = first->next; DestroyNode(node); return first; } iter = first; while (iter->next) { if (fabs(iter->next->Data.time - time) < 0.001) { node = iter->next; strcpy(str, iter->next->Data.str); iter->next = iter->next->next; DestroyNode(node); return first; } iter = iter->next; } return first; }
static void DestroyNode(TNode *node) { for (int i=0; i<CHILD_NODE_NUM; i++) { if (node->childNode[i]) DestroyNode(node->childNode[i]); } free(node); }
void CPyramidAllocator::DestroyNode(void* pNode, uint32 nLevel) { if(nLevel == 0) { CLeafNode* pLeaf = (CLeafNode*)pNode; uint8* pBuf = pLeaf->pObjects; for(uint32 i=0; i<32; ++i) { m_pClass->DestructInstance(pBuf); pBuf += m_nInstanceSize; } CMalloc::Free(pLeaf->pObjects); CMalloc::Free(pLeaf); } else { CBranchNode* pBranch = (CBranchNode*)pNode; for(uint32 i=0; i<32; ++i) { if(pBranch->pNodes[i]) DestroyNode(pBranch->pNodes[i], nLevel - 1); } CMalloc::Free(pBranch); } }
void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { DEBUG_LOG("BattleGroundAV: player destroyed point node %i", node); // despawn banner DestroyNode(node); PopulateNode(node); UpdateNodeWorldState(node); uint32 owner = m_Nodes[node].Owner; if (IsTower(node)) { uint8 tmp = node - BG_AV_NODES_DUNBALDAR_SOUTH; // despawn marshal (one of those guys protecting the boss) SpawnEvent(BG_AV_MARSHAL_A_SOUTH + tmp, 0, false); UpdateScore(BattleGroundTeamId(owner^0x1), (-1) * BG_AV_RES_TOWER); RewardReputationToTeam(BATTLEGROUND_AV, m_RepTowerDestruction, owner); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), owner); RewardXpToTeam(0, 0.91, owner); SendYell2ToAll(LANG_BG_AV_TOWER_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( owner == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE); } else { SendYell2ToAll(LANG_BG_AV_GRAVE_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( owner == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE); } }
void DestroyNode(Node **theNode) { Node * oneNode; Node *thisNode = *theNode; if(!thisNode) return; // destroy Node list oneNode = StartLoop(thisNode->nodeChilds); while(oneNode) { DestroyNode(&oneNode); // Recursive call oneNode = GetNext(thisNode->nodeChilds); } DestroyList(&thisNode->nodeChilds); DestroyBBox(&thisNode->container_WC); DestroyTrfm3D(&thisNode->placement); DestroyTrfm3D(&thisNode->placement_WC); thisNode->gObject = NULL; thisNode->theLight = NULL; thisNode->theShader = NULL; thisNode->parent = NULL; free( thisNode ); *theNode = NULL; }
BOOL WriteString( LPCWSTR pszSection, LPCWSTR pszKey, LPCWSTR pszValue) { Node* pSection = GetNode(&m_pRoot, pszSection, (pszKey != NULL) ? CREATE_NODE : DELETE_NODE); if (pszKey == NULL) return TRUE; if (pSection == NULL) return FALSE; Node* pKey = GetNode(&pSection->pChild, pszKey, (pszValue != NULL) ? CREATE_NODE : DELETE_NODE); if (pszValue == NULL) return TRUE; if (pKey == NULL) return FALSE; Node* pValue = pKey->pChild; DWORD dwSize = sizeof(WCHAR) * wcslen(pszValue); if (pValue) { if (Equal(pValue, (LPCVOID)pszValue, dwSize)) return TRUE; DestroyNode(pValue); } pKey->pChild = CreateNode((LPCVOID)pszValue, dwSize); if (pKey->pChild == NULL) return FALSE; return TRUE; }
void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { DEBUG_LOG("BattleGroundAV: player destroyed point node %i", node); MANGOS_ASSERT(m_Nodes[node].Owner != BG_AV_TEAM_NEUTRAL) BattleGroundTeamIndex ownerTeamIdx = BattleGroundTeamIndex(m_Nodes[node].Owner); Team ownerTeam = ownerTeamIdx == BG_TEAM_ALLIANCE ? ALLIANCE : HORDE; // despawn banner DestroyNode(node); PopulateNode(node); UpdateNodeWorldState(node); if (IsTower(node)) { uint8 tmp = node - BG_AV_NODES_DUNBALDAR_SOUTH; // despawn marshal (one of those guys protecting the boss) SpawnEvent(BG_AV_MARSHAL_A_SOUTH + tmp, 0, false); UpdateScore(GetOtherTeamIndex(ownerTeamIdx), (-1) * BG_AV_RES_TOWER); RewardReputationToTeam((ownerTeam == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, m_RepTowerDestruction, ownerTeam); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), ownerTeam); SendYell2ToAll(LANG_BG_AV_TOWER_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), (ownerTeam == ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE); } else { SendYell2ToAll(LANG_BG_AV_GRAVE_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), (ownerTeam == ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE); } }
void Trie_Destroy(TTrie *hTrie) { assert(hTrie->isDead == false); DestroyNode(hTrie->root); hTrie->isDead = true; free(hTrie); }
TMsmmNodeBase::~TMsmmNodeBase() { OstTraceFunctionEntry0( TMSMMNODEBASE_TMSMMNODEBASE_DES_ENTRY ); // Remove current node from the parent node and destroy it. DestroyNode(); OstTraceFunctionExit0( TMSMMNODEBASE_TMSMMNODEBASE_DES_EXIT ); }
// 第一个公共结点在链表中间 // 1 - 2 - 3 \ // 6 - 7 // 4 - 5 / void Test1() { ListNode* pNode1 = CreateListNode(1); ListNode* pNode2 = CreateListNode(2); ListNode* pNode3 = CreateListNode(3); ListNode* pNode4 = CreateListNode(4); ListNode* pNode5 = CreateListNode(5); ListNode* pNode6 = CreateListNode(6); ListNode* pNode7 = CreateListNode(7); ConnectListNodes(pNode1, pNode2); ConnectListNodes(pNode2, pNode3); ConnectListNodes(pNode3, pNode6); ConnectListNodes(pNode4, pNode5); ConnectListNodes(pNode5, pNode6); ConnectListNodes(pNode6, pNode7); Test("Test1", pNode1, pNode4, pNode6); DestroyNode(pNode1); DestroyNode(pNode2); DestroyNode(pNode3); DestroyNode(pNode4); DestroyNode(pNode5); DestroyNode(pNode6); DestroyNode(pNode7); }
/*---------------------------------------------------------------------*/ VOID DestroyList(LIST * list) { NODE *node; ASSERT(list != NULL); /* Release the list */ if ((node = FirstNode(list)) != NULL) while ((node = DestroyNode(node)) != NULL); return; }
bool CPyramidAllocator::ApplyNode(uint32 pIndex[7], void* pNode[7]) { uint32 i, nStart; nStart = 6 - m_nLevel; for(i=0; i<nStart; ++i) { pNode[i] = NULL; pIndex[i] = 0xFFFFFFFF; } void* pTmp = m_pNode; for(; i<7; ++i) { uint32 nIndex; pNode[i] = pTmp; if(FindFreeChild(*(CMask*)pTmp, nIndex)) { CBranchNode* pBranch = (CBranchNode*)pTmp; if(i < 6) { pTmp = pBranch->pNodes[nIndex]; if(pTmp == NULL) { pTmp = pBranch->pNodes[nIndex] = CreateNode(6 - i); if(pTmp == NULL) return false; } } pIndex[i] = nIndex; } else { if(m_nLevel == 6 || i>nStart) FocpAbort(("CPyramidAllocator::ApplyNode() failure")); void* pNew = CreateNode(6 - i); if(pNew == NULL) return false; CBranchNode* pBranch = (CBranchNode*)CreateNode(7 - i); if(pBranch == NULL) { DestroyNode(pNew, 6-i); return false; } pBranch->pNodes[0] = m_pNode; pBranch->pNodes[1] = pNew; pBranch->nMask.pFlag[0] |= 1; m_pNode = pBranch; ++m_nLevel; pTmp = m_pNode; i = 6 - m_nLevel - 1; } } return true; }
// destroy node and all its childs void DestroyNode(Node* pNode) { while (pNode != NULL) { if (pNode->pChild != NULL) DestroyNode(pNode->pChild); Node* pTmp = pNode; pNode = pNode->pNext; free(pTmp); } }
void DestroyTest() { struct node *head = NULL; Push(&head, 12); Push(&head, 13); Push(&head, 14); Push(&head, 15); printf("\nDeleting node %d: ", head->next->next->data); DestroyNode(head, head->next->next); while (head != NULL) { printf("%d ", head->data); head = head->next; } printf("\n"); }
void RemoveElemIf(t_list *list, int (*func)(void *, void *), void (*free_func)(void *), void *elem) { t_node *iter; t_node *save; if (!list || list->is_empty(list)) return ; iter = list->begin(list); while (iter) { save = iter; iter = iter->next; if ((*func)(save->contain, elem)) DestroyNode(ExtractElem(list, save), free_func); } }
// find a node with the given value, create one if it does not exist // and fCreate is specified Node* GetNode(Node** ppNode, LPCVOID pValue, DWORD dwSize, Action action) { Node* pNode = *ppNode; while (pNode != NULL) { if (Equal(pNode, pValue, dwSize)) break; ppNode = &pNode->pNext; pNode = *ppNode; } switch (action) { case CREATE_NODE: if (pNode == NULL) { pNode = CreateNode(pValue, dwSize); *ppNode = pNode; } break; case DELETE_NODE: if (pNode != NULL) { *ppNode = pNode->pNext; pNode->pNext = NULL; DestroyNode(pNode); } break; default: _ASSERTE(action == FIND_NODE); } return pNode; }
INT_PTR CALLBACK DotNetAsmPageDlgProc( _In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ) { LPPROPSHEETPAGE propSheetPage; PPH_PROCESS_PROPPAGECONTEXT propPageContext; PPH_PROCESS_ITEM processItem; PASMPAGE_CONTEXT context; if (PhPropPageDlgProcHeader(hwndDlg, uMsg, lParam, &propSheetPage, &propPageContext, &processItem)) { context = propPageContext->Context; } else { return FALSE; } switch (uMsg) { case WM_INITDIALOG: { PPH_STRING settings; HWND tnHandle; context = PhAllocate(sizeof(ASMPAGE_CONTEXT)); memset(context, 0, sizeof(ASMPAGE_CONTEXT)); propPageContext->Context = context; context->WindowHandle = hwndDlg; context->ProcessItem = processItem; context->ClrVersions = 0; PhGetProcessIsDotNetEx(processItem->ProcessId, NULL, 0, NULL, &context->ClrVersions); tnHandle = GetDlgItem(hwndDlg, IDC_LIST); context->TnHandle = tnHandle; TreeNew_SetCallback(tnHandle, DotNetAsmTreeNewCallback, context); TreeNew_SetExtendedFlags(tnHandle, TN_FLAG_ITEM_DRAG_SELECT, TN_FLAG_ITEM_DRAG_SELECT); PhSetControlTheme(tnHandle, L"explorer"); SendMessage(TreeNew_GetTooltips(tnHandle), TTM_SETMAXTIPWIDTH, 0, MAXSHORT); PhAddTreeNewColumn(tnHandle, DNATNC_STRUCTURE, TRUE, L"Structure", 240, PH_ALIGN_LEFT, -2, 0); PhAddTreeNewColumn(tnHandle, DNATNC_ID, TRUE, L"ID", 50, PH_ALIGN_RIGHT, 0, DT_RIGHT); PhAddTreeNewColumn(tnHandle, DNATNC_FLAGS, TRUE, L"Flags", 120, PH_ALIGN_LEFT, 1, 0); PhAddTreeNewColumn(tnHandle, DNATNC_PATH, TRUE, L"Path", 600, PH_ALIGN_LEFT, 2, 0); // don't use path ellipsis - the user already has the base file name PhAddTreeNewColumn(tnHandle, DNATNC_NATIVEPATH, TRUE, L"Native image path", 600, PH_ALIGN_LEFT, 3, 0); settings = PhGetStringSetting(SETTING_NAME_ASM_TREE_LIST_COLUMNS); PhCmLoadSettings(tnHandle, &settings->sr); PhDereferenceObject(settings); PhSwapReference(&context->TnErrorMessage, PhCreateString(L"Loading .NET assemblies...")); TreeNew_SetEmptyText(tnHandle, &context->TnErrorMessage->sr, 0); if ( !IsProcessSuspended(processItem->ProcessId) || PhShowMessage(hwndDlg, MB_ICONWARNING | MB_YESNO, L".NET assembly enumeration may not work properly because the process is currently suspended. Do you want to continue?") == IDYES ) { CreateDotNetTraceQueryThread( hwndDlg, context->ClrVersions, processItem->ProcessId ); } else { PhSwapReference(&context->TnErrorMessage, PhCreateString(L"Unable to start the event tracing session because the process is suspended.") ); TreeNew_SetEmptyText(tnHandle, &context->TnErrorMessage->sr, 0); InvalidateRect(tnHandle, NULL, FALSE); } } break; case WM_DESTROY: { PPH_STRING settings; ULONG i; settings = PhCmSaveSettings(context->TnHandle); PhSetStringSetting2(SETTING_NAME_ASM_TREE_LIST_COLUMNS, &settings->sr); PhDereferenceObject(settings); if (context->NodeList) { for (i = 0; i < context->NodeList->Count; i++) DestroyNode(context->NodeList->Items[i]); PhDereferenceObject(context->NodeList); } if (context->NodeRootList) PhDereferenceObject(context->NodeRootList); PhClearReference(&context->TnErrorMessage); PhFree(context); PhPropPageDlgProcDestroy(hwndDlg); } break; case WM_SHOWWINDOW: { PPH_LAYOUT_ITEM dialogItem; if (dialogItem = PhBeginPropPageLayout(hwndDlg, propPageContext)) { PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_LIST), dialogItem, PH_ANCHOR_ALL); PhEndPropPageLayout(hwndDlg, propPageContext); } } break; case WM_COMMAND: { switch (LOWORD(wParam)) { case ID_COPY: { PPH_STRING text; text = PhGetTreeNewText(context->TnHandle, 0); PhSetClipboardString(context->TnHandle, &text->sr); PhDereferenceObject(text); } break; } } break; case UPDATE_MSG: { ULONG result = (ULONG)wParam; PASMPAGE_QUERY_CONTEXT queryContext = (PASMPAGE_QUERY_CONTEXT)lParam; if (result == 0) { PhSwapReference(&context->NodeList, queryContext->NodeList); PhSwapReference(&context->NodeRootList, queryContext->NodeRootList); DestroyDotNetTraceQuery(queryContext); TreeNew_NodesStructured(context->TnHandle); } else { PhSwapReference(&context->TnErrorMessage, PhConcatStrings2(L"Unable to start the event tracing session: ", PhGetStringOrDefault(PhGetWin32Message(result), L"Unknown error")) ); TreeNew_SetEmptyText(context->TnHandle, &context->TnErrorMessage->sr, 0); InvalidateRect(context->TnHandle, NULL, FALSE); } } break; } return FALSE; }
void VRML_DeleteFieldPointer(void *field, u32 FieldType) { SFNode *node; switch (FieldType) { case FT_SFBool: case FT_SFFloat: case FT_SFDouble: case FT_SFTime: case FT_SFInt32: case FT_SFVec3f: case FT_SFVec3d: case FT_SFVec2f: case FT_SFVec2d: case FT_SFColor: case FT_SFColorRGBA: case FT_SFRotation: break; case FT_SFString: if ( ((SFString *)field)->buffer) free(((SFString *)field)->buffer); break; case FT_SFImage: SFImage_Del(* ((SFImage *)field)); break; case FT_SFNode: node = *(SFNode **) field; if (node) DestroyNode(node); return; case FT_SFCommandBuffer: SFCommandBuffer_Del(*(SFCommandBuffer *)field); break; case FT_MFBool: MFBool_Del( * ((MFBool *) field)); break; case FT_MFFloat: MFFloat_Del( * ((MFFloat *) field)); break; case FT_MFDouble: MFDouble_Del( * ((MFDouble *) field)); break; case FT_MFTime: MFTime_Del( * ((MFTime *)field)); break; case FT_MFInt32: MFInt32_Del( * ((MFInt32 *)field)); break; case FT_MFString: MFString_Del( *((MFString *)field)); break; case FT_MFVec3f: MFVec3f_Del( * ((MFVec3f *)field)); break; case FT_MFVec2f: MFVec2f_Del( * ((MFVec2f *)field)); break; case FT_MFVec3d: MFVec3d_Del( * ((MFVec3d *)field)); break; case FT_MFVec2d: MFVec2d_Del( * ((MFVec2d *)field)); break; case FT_MFColor: MFColor_Del( * ((MFColor *)field)); break; case FT_MFColorRGBA: MFColorRGBA_Del( * ((MFColorRGBA *)field)); break; case FT_MFRotation: MFRotation_Del( * ((MFRotation *)field)); break; case FT_MFURL: MFURL_Del( * ((MFURL *) field)); break; //used only in proto since this field is created by default for regular nodes case FT_MFNode: while (ChainGetCount((Chain *)field)) { node = ChainGetEntry((Chain *)field, 0); DestroyNode(node); ChainDeleteEntry((Chain *)field, 0); } DeleteChain((Chain *)field); return; default: assert(0); return; } //free pointer free(field); }
/* DestroyInternalParsingTree frees all allocated memory used by a parsing * tree. The structure itself is not freed. */ void DestroyInternalParsingTree(const tsd_t *TSD, internal_parser_type *ipt) { ttree *tr, *th; otree *otr, *oh; lineboxptr lr, lh; labelboxptr ar, ah; unsigned long i; if (!ipt) return; /* Cleanup all the nodes */ if (ipt->nodes != NULL) { tr = ipt->nodes; while (tr) { for (i = 0; i < tr->num; i++) DestroyNode(TSD, tr->elems + i); th = tr->next; FreeTSD(tr->elems); FreeTSD(tr); tr = th; } ipt->nodes = NULL; } ipt->root = NULL; /* not really needed */ /* Cleanup all the lineboxes */ if (ipt->first_source_line != NULL) { lr = ipt->first_source_line; while (lr) { lh = lr->next; Free_stringTSD(lr->line); FreeTSD(lr); lr = lh; } ipt->first_source_line = ipt->last_source_line = NULL; } /* Cleanup all the labelboxes */ if (ipt->first_label != NULL) { ar = ipt->first_label; while (ar) { ah = ar->next; FreeTSD(ar); ar = ah; } ipt->first_label = ipt->last_label = NULL; } if (ipt->sort_labels != NULL) { FreeTSD(ipt->sort_labels); ipt->sort_labels = NULL; } /* Cleanup the incore sourceline informations */ /* Cleanup all the nodes */ if (ipt->srclines != NULL) { otr = ipt->srclines; while (otr) { oh = otr->next; FreeTSD(otr->elems); FreeTSD(otr); otr = oh; } ipt->srclines = NULL; } if (ipt->kill) Free_stringTSD(ipt->kill); ipt->kill = NULL; }
CPyramidAllocator::~CPyramidAllocator() { DestroyNode(m_pNode, m_nLevel); m_pNode = NULL; }
SConfig::~SConfig() { SaveConfig(ConfigPath); DestroyNode(); log.Log("SConfig:~SConfig",COMMON,"SConfig结束"); }
INT_PTR CALLBACK DotNetAsmPageDlgProc( __in HWND hwndDlg, __in UINT uMsg, __in WPARAM wParam, __in LPARAM lParam ) { LPPROPSHEETPAGE propSheetPage; PPH_PROCESS_PROPPAGECONTEXT propPageContext; PPH_PROCESS_ITEM processItem; PASMPAGE_CONTEXT context; if (PhPropPageDlgProcHeader(hwndDlg, uMsg, lParam, &propSheetPage, &propPageContext, &processItem)) { context = propPageContext->Context; } else { return FALSE; } switch (uMsg) { case WM_INITDIALOG: { ULONG result = 0; PPH_STRING settings; LARGE_INTEGER timeout; HWND tnHandle; context = PhAllocate(sizeof(ASMPAGE_CONTEXT)); memset(context, 0, sizeof(ASMPAGE_CONTEXT)); propPageContext->Context = context; context->WindowHandle = hwndDlg; context->ProcessItem = processItem; context->ClrVersions = GetProcessDotNetVersions(processItem->ProcessId); context->NodeList = PhCreateList(64); context->NodeRootList = PhCreateList(2); tnHandle = GetDlgItem(hwndDlg, IDC_LIST); context->TnHandle = tnHandle; TreeNew_SetRedraw(tnHandle, FALSE); TreeNew_SetCallback(tnHandle, DotNetAsmTreeNewCallback, context); TreeNew_SetExtendedFlags(tnHandle, TN_FLAG_ITEM_DRAG_SELECT, TN_FLAG_ITEM_DRAG_SELECT); PhSetControlTheme(tnHandle, L"explorer"); SendMessage(TreeNew_GetTooltips(tnHandle), TTM_SETMAXTIPWIDTH, 0, MAXSHORT); PhAddTreeNewColumn(tnHandle, DNATNC_STRUCTURE, TRUE, L"Structure", 240, PH_ALIGN_LEFT, -2, 0); PhAddTreeNewColumn(tnHandle, DNATNC_ID, TRUE, L"ID", 50, PH_ALIGN_RIGHT, 0, DT_RIGHT); PhAddTreeNewColumn(tnHandle, DNATNC_FLAGS, TRUE, L"Flags", 120, PH_ALIGN_LEFT, 1, 0); PhAddTreeNewColumn(tnHandle, DNATNC_PATH, TRUE, L"Path", 600, PH_ALIGN_LEFT, 2, 0); // don't use path ellipsis - the user already has the base file name PhAddTreeNewColumn(tnHandle, DNATNC_NATIVEPATH, TRUE, L"Native Image Path", 600, PH_ALIGN_LEFT, 3, 0); settings = PhGetStringSetting(SETTING_NAME_ASM_TREE_LIST_COLUMNS); PhCmLoadSettings(tnHandle, &settings->sr); PhDereferenceObject(settings); SetCursor(LoadCursor(NULL, IDC_WAIT)); if (context->ClrVersions & CLR_VERSION_1_0) { AddFakeClrNode(context, L"CLR v1.0.3705"); // what PE displays } if (context->ClrVersions & CLR_VERSION_1_1) { AddFakeClrNode(context, L"CLR v1.1.4322"); } timeout.QuadPart = -10 * PH_TIMEOUT_SEC; if (context->ClrVersions & CLR_VERSION_2_0) { context->ClrV2Node = AddFakeClrNode(context, L"CLR v2.0.50727"); result = UpdateDotNetTraceInfoWithTimeout(context, TRUE, &timeout); } if (context->ClrVersions & CLR_VERSION_4_ABOVE) { result = UpdateDotNetTraceInfoWithTimeout(context, FALSE, &timeout); } TreeNew_NodesStructured(tnHandle); TreeNew_SetRedraw(tnHandle, TRUE); SetCursor(LoadCursor(NULL, IDC_ARROW)); if (result != 0) { ShowWindow(tnHandle, SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_ERROR), SW_SHOW); if (result == ERROR_ACCESS_DENIED) { SetDlgItemText(hwndDlg, IDC_ERROR, L"Unable to start the event tracing session. Make sure Process Hacker is running with administrative privileges."); } else { SetDlgItemText(hwndDlg, IDC_ERROR, PhaConcatStrings2(L"Unable to start the event tracing session: %s", PhGetStringOrDefault(PhGetWin32Message(result), L"Unknown error"))->Buffer); } } } break; case WM_DESTROY: { PPH_STRING settings; ULONG i; settings = PhCmSaveSettings(context->TnHandle); PhSetStringSetting2(SETTING_NAME_ASM_TREE_LIST_COLUMNS, &settings->sr); PhDereferenceObject(settings); for (i = 0; i < context->NodeList->Count; i++) DestroyNode(context->NodeList->Items[i]); PhDereferenceObject(context->NodeList); PhDereferenceObject(context->NodeRootList); PhFree(context); PhPropPageDlgProcDestroy(hwndDlg); } break; case WM_SHOWWINDOW: { PPH_LAYOUT_ITEM dialogItem; if (dialogItem = PhBeginPropPageLayout(hwndDlg, propPageContext)) { PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_LIST), dialogItem, PH_ANCHOR_ALL); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_ERROR), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT | PH_LAYOUT_FORCE_INVALIDATE); PhEndPropPageLayout(hwndDlg, propPageContext); } } break; case WM_COMMAND: { switch (LOWORD(wParam)) { case ID_COPY: { PPH_STRING text; text = PhGetTreeNewText(context->TnHandle, DNATNC_MAXIMUM); PhSetClipboardStringEx(context->TnHandle, text->Buffer, text->Length); PhDereferenceObject(text); } break; } } break; } return FALSE; }
~IniFile() { DestroyNode(m_pRoot); }