📄 tmgmondlg.cpp
字号:
}
}
pcTmmon->ExeRun(path_buffer,m_taskArguments.GetBuffer(_MAX_PATH));
m_taskFile.ReleaseBuffer();
m_taskArguments.ReleaseBuffer();
}
// Button "Stop"
void CTmgmonDlg::OnButton4()
{
// TODO: Add your control notification handler code here
pcTmmon->ExeStop( );
}
// Button "Display"
void CTmgmonDlg::OnButton5()
{
// TODO: Add your control notification handler code here
DWORD phyAdr;
extern int globalmemtype;
CString cstr;
UpdateData(TRUE);
cstr = m_phymem;
if( m_phymem.IsEmpty() )
{
tmmanDSPInfo* pDSPCaps;
tmmanMemoryBlock* pSDRAM;
pDSPCaps = &(pcTmmon->m_CurrentDSPInfo);
pSDRAM = &pDSPCaps->SDRAM;
phyAdr = pSDRAM->PhysicalAddress;
}
else
{
sscanf(m_phymem.GetBuffer(100),"%x",&phyAdr);
m_phymem.ReleaseBuffer();
}
if(pcTmmon->ctc_mem(m_hWnd,phyAdr,m_memoption,1))
if(m_memoption != 2 && globalmemtype==2) //MMIO
{
m_memoption=2;
UpdateData(FALSE);
}
}
void CTmgmonDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
pcTmmon->ctc_mem(m_hWnd,0,m_memoption,0);
}
void CTmgmonDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
pcTmmon->ctc_mem(m_hWnd,0,m_memoption,0);
}
void CTmgmonDlg::OnRadio3()
{
// TODO: Add your control notification handler code here
int x;
UpdateData(TRUE);
x=m_memoption;
pcTmmon->ctc_mem(m_hWnd,0,m_memoption,0);
}
void CTmgmonDlg::OnCheck4()
{
}
void CTmgmonDlg::OnCheck5()
{
}
void CTmgmonDlg::OnCheck6()
{
}
void CTmgmonDlg::OnButton9()
{
// TODO: Add your control notification handler code here
CEdit* pEdit=(CEdit* )GetDlgItem(IDC_EDIT6);
UpdateData(TRUE);
if(m_tracefile.IsEmpty() || !m_trace)
pcTmmon->ctc_trace(pEdit,NULL);
else
{
CString str;
str=m_tracefile;
pcTmmon->ctc_trace(pEdit,str.GetBuffer(_MAX_PATH));
str.ReleaseBuffer();
}
}
void CTmgmonDlg::OnErrspaceEdit6()
{
// TODO: Add your control notification handler code here
AfxMessageBox("Cannot Display Complete Trace Buffer\n"
"Redirect Output to Trace File");
tracefull=TRUE;
}
// Button "Trace File"
void CTmgmonDlg::OnButton11()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(
TRUE, // Open File Dialog
NULL, // Default extension
NULL, // No default filename
OFN_HIDEREADONLY | OFN_NOCHANGEDIR, // OPENFILENAME flags
"All Files|*.*||"); // Filter strings
if (dlg.DoModal() == IDOK)
SetDlgItemText(IDC_EDIT8,dlg.GetPathName());
}
void CTmgmonDlg::OnMaxtextEdit6()
{
// TODO: Add your control notification handler code here
AfxMessageBox("Cannot Display Complete Trace Buffer.\n"
"Buffer Has Been Truncated");
}
void CTmgmonDlg::OnDeltaposSpinnum(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
UINT no;
extern DWORD dwDSPNumber;
no=pNMUpDown->iPos+pNMUpDown->iDelta;
if(no >= 0 && no < dwDSPCount )
{
dwDSPNumber=no;
if(!pcTmmon->ExeDSP (dwDSPNumber)) // Not successful
PostQuitMessage(0);
else
pcTmmon->ShowProcessorInfo(this);
}
*pResult = 0;
}
void CTmgmonDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
pcTmmon->ctc_exit();
RegistryWrite();
CDialog::OnClose();
}
void CTmgmonDlg::OnDestroy()
{
CDialog::OnDestroy();
if(pcTmmon)
delete pcTmmon;
}
void CTmgmonDlg::OnEndSession(BOOL bEnding )
{
// TODO: Add your message handler code here and/or call default
if(bEnding)
RegistryWrite();
CDialog::OnEndSession(bEnding);
}
void CTmgmonDlg::RegistryRead()
{
HKEY RegistryHandle;
DWORD Disposition;
if ( ERROR_SUCCESS == RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
constTMGmonRegistryPath,
0,
KEY_READ,
&RegistryHandle ) )
{
DWORD BytesXfered;
char *Path, *PathBuffer;
// BytesXfered = 0;
// Read File List
if ( ERROR_SUCCESS != RegQueryValueEx(
RegistryHandle,
TEXT("FileList"),
NULL,
NULL,
NULL,
&BytesXfered ) )
{
RegCloseKey ( RegistryHandle );
return;
}
if ( NULL == ( PathBuffer = (char *)malloc ( BytesXfered ) ) )
{
RegCloseKey ( RegistryHandle );
return;
}
if ( ERROR_SUCCESS != RegQueryValueEx(
RegistryHandle,
TEXT("FileList"),
NULL,
NULL,
(PBYTE)PathBuffer,
&BytesXfered ) )
{
free ( PathBuffer );
RegCloseKey ( RegistryHandle );
return;
}
for ( Path = PathBuffer ; *Path ; Path += ( strlen ( Path ) + 1 ) )
{
m_taskFileList.AddString(Path);
}
free ( PathBuffer );
// Read Arguments List
if ( ERROR_SUCCESS != RegQueryValueEx(
RegistryHandle,
TEXT("ArgumentsList"),
NULL,
NULL,
NULL,
&BytesXfered ) )
{
RegCloseKey ( RegistryHandle );
return;
}
if ( NULL == ( PathBuffer = (char *)malloc ( BytesXfered ) ) )
{
RegCloseKey ( RegistryHandle );
return;
}
if ( ERROR_SUCCESS != RegQueryValueEx(
RegistryHandle,
TEXT("ArgumentsList"),
NULL,
NULL,
(PBYTE)PathBuffer,
&BytesXfered ) )
{
free ( PathBuffer );
RegCloseKey ( RegistryHandle );
return;
}
for ( Path = PathBuffer ; *Path ; Path += ( strlen ( Path ) + 1 ) )
{
m_taskArgumentsList.AddString(Path);
}
free ( PathBuffer );
RegCloseKey ( RegistryHandle );
return;
}
else
RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
constTMGmonRegistryPath,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&RegistryHandle,
&Disposition
);
}
void CTmgmonDlg::RegistryWrite()
{
char *str;
char *ptr;
char listText[_MAX_PATH];
int length;
int i;
HKEY RegistryHandle;
if ( ERROR_SUCCESS == RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
constTMGmonRegistryPath,
0,
KEY_WRITE,
&RegistryHandle ) )
{
// Write File List
length=0;
for(i=0;i<m_taskFileList.GetCount() && i < constMaxRegistryEntries;i++)
{
m_taskFileList.GetLBText(i,listText);
length = length + strlen(listText) + 1;
}
length++;
str=(char *)malloc(length);
if(str == NULL)
{
RegCloseKey ( RegistryHandle );
return;
}
ptr=str;
for(i=0;i<m_taskFileList.GetCount() && i < constMaxRegistryEntries;i++)
{
m_taskFileList.GetLBText(i,listText);
memcpy(ptr,listText,strlen(listText)+1);
ptr = ptr + strlen(listText) + 1;
}
*ptr=0;
RegSetValueEx(RegistryHandle,"FileList",0,REG_MULTI_SZ,(CONST BYTE *)str,length);
free(str);
// Write Arguments List
length=0;
for(i=0;i<m_taskArgumentsList.GetCount() && i < constMaxRegistryEntries;i++)
{
m_taskArgumentsList.GetLBText(i,listText);
length = length + strlen(listText) + 1;
}
length++;
str=(char *)malloc(length);
if(str == NULL)
{
RegCloseKey ( RegistryHandle );
return;
}
ptr=str;
for(i=0;i<m_taskArgumentsList.GetCount() && i < constMaxRegistryEntries;i++)
{
m_taskArgumentsList.GetLBText(i,listText);
memcpy(ptr,listText,strlen(listText)+1);
ptr = ptr + strlen(listText) + 1;
}
*ptr=0;
RegSetValueEx(RegistryHandle,"ArgumentsList",0,REG_MULTI_SZ,(CONST BYTE *)str,length);
free(str);
RegCloseKey ( RegistryHandle );
}
}
void CTmgmonDlg::OnWorkingDir()
{
// TODO: Add your control notification handler code here
// TODO: Add your control notification handler code here
char szDisplayName[MAX_PATH];
BROWSEINFO bi;
bi.hwndOwner = m_hWnd; // Handle of the owner window
bi.pidlRoot = NULL; // Desktop folder is used
bi.lpszTitle = "Select Working Directory"; // Title of the dialog box
bi.pszDisplayName = szDisplayName; // Buffer for selected folder name
bi.ulFlags = BIF_RETURNONLYFSDIRS; // Only returns file system directories
bi.lpfn = NULL; bi.lParam = 0;
char workingDir[MAX_PATH];
LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bi);
if (pItemIDList)
{
m_workingDir.GetWindowText(workingDir,MAX_PATH);
if (SHGetPathFromIDList(pItemIDList, workingDir))
{
m_workingDir.SetWindowText(workingDir);
}
// Avoid memory leaks by deleting the PIDL using the shell's task allocator
IMalloc* pMalloc;
if (SHGetMalloc(&pMalloc) != NOERROR)
{
TRACE("Failed to get pointer to shells task allocator");
return;
}
pMalloc->Free(pItemIDList);
if (pMalloc)
pMalloc->Release();
}
}
void CTmgmonDlg::OnCheckAppDir()
{
// TODO: Add your control notification handler code here
m_checkappdir=!m_checkappdir;
if(m_checkappdir)
{
m_workingDir.EnableWindow(FALSE);
m_browseWorkingDir.EnableWindow(FALSE);
}
else
{
m_workingDir.EnableWindow(TRUE);
m_browseWorkingDir.EnableWindow(TRUE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -