void CtrlThreadList::GetColumnText(wchar_t* dest, int row, int col) { switch (col) { case TL_NAME: wcscpy(dest, ConvertUTF8ToWString(threads[row].name).c_str()); break; case TL_PROGRAMCOUNTER: switch (threads[row].status) { case THREADSTATUS_DORMANT: case THREADSTATUS_DEAD: wcscpy(dest, L"N/A"); break; default: wsprintf(dest, L"0x%08X",threads[row].curPC); break; }; break; case TL_ENTRYPOINT: wsprintf(dest,L"0x%08X",threads[row].entrypoint); break; case TL_PRIORITY: wsprintf(dest,L"%d",threads[row].priority); break; case TL_STATE: switch (threads[row].status) { case THREADSTATUS_RUNNING: wcscpy(dest,L"Running"); break; case THREADSTATUS_READY: wcscpy(dest,L"Ready"); break; case THREADSTATUS_WAIT: wcscpy(dest,L"Waiting"); break; case THREADSTATUS_SUSPEND: wcscpy(dest,L"Suspended"); break; case THREADSTATUS_DORMANT: wcscpy(dest,L"Dormant"); break; case THREADSTATUS_DEAD: wcscpy(dest,L"Dead"); break; case THREADSTATUS_WAITSUSPEND: wcscpy(dest,L"Waiting/Suspended"); break; default: wcscpy(dest,L"Invalid"); break; } break; case TL_WAITTYPE: wcscpy(dest, ConvertUTF8ToWString(getWaitTypeName(threads[row].waitType)).c_str()); break; } }
void CtrlThreadList::handleNotify(LPARAM lParam) { LPNMHDR mhdr = (LPNMHDR) lParam; if (mhdr->code == NM_DBLCLK) { LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam; u32 address; switch (threads[item->iItem].status) { case THREADSTATUS_DORMANT: case THREADSTATUS_DEAD: address = threads[item->iItem].entrypoint; break; default: address = threads[item->iItem].curPC; break; } SendMessage(GetParent(wnd),WM_DEB_GOTOWPARAM,address,0); return; } if (mhdr->code == NM_RCLICK) { const LPNMITEMACTIVATE item = (LPNMITEMACTIVATE)lParam; showMenu(item->iItem, item->ptAction); return; } if (mhdr->code == LVN_GETDISPINFO) { NMLVDISPINFO* dispInfo = (NMLVDISPINFO*)lParam; int index = dispInfo->item.iItem; stringBuffer[0] = 0; switch (dispInfo->item.iSubItem) { case TL_NAME: wcscpy(stringBuffer, ConvertUTF8ToWString(threads[index].name).c_str()); break; case TL_PROGRAMCOUNTER: switch (threads[index].status) { case THREADSTATUS_DORMANT: case THREADSTATUS_DEAD: wcscpy(stringBuffer, L"N/A"); break; default: wsprintf(stringBuffer, L"0x%08X",threads[index].curPC); break; }; break; case TL_ENTRYPOINT: wsprintf(stringBuffer,L"0x%08X",threads[index].entrypoint); break; case TL_PRIORITY: wsprintf(stringBuffer,L"%d",threads[index].priority); break; case TL_STATE: switch (threads[index].status) { case THREADSTATUS_RUNNING: wcscpy(stringBuffer,L"Running"); break; case THREADSTATUS_READY: wcscpy(stringBuffer,L"Ready"); break; case THREADSTATUS_WAIT: wcscpy(stringBuffer,L"Waiting"); break; case THREADSTATUS_SUSPEND: wcscpy(stringBuffer,L"Suspended"); break; case THREADSTATUS_DORMANT: wcscpy(stringBuffer,L"Dormant"); break; case THREADSTATUS_DEAD: wcscpy(stringBuffer,L"Dead"); break; case THREADSTATUS_WAITSUSPEND: wcscpy(stringBuffer,L"Waiting/Suspended"); break; default: wcscpy(stringBuffer,L"Invalid"); break; } break; case TL_WAITTYPE: wcscpy(stringBuffer, ConvertUTF8ToWString(getWaitTypeName(threads[index].waitType)).c_str()); break; } if (stringBuffer[0] == 0) wcscat(stringBuffer,L"Invalid"); dispInfo->item.pszText = stringBuffer; } }