⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdb readerdlg.cpp

📁 PALM PDB文件阅读器源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    else
        strTemp += _T("-");
    
    if (uctHeader.intAttr & dmHdrAttrBackup)
        strTemp += _T("B");
    else
        strTemp += _T("-");
    
    if (uctHeader.intAttr & dmHdrAttrOKToInstallNewer)
        strTemp += _T("N");
    else
        strTemp += _T("-");
    
    if (uctHeader.intAttr & dmHdrAttrResetAfterInstall)
        strTemp += _T("A");
    else
        strTemp += _T("-");
    
    if (uctHeader.intAttr & dmHdrAttrOpen)
        strTemp += _T("O)");
    else
        strTemp += _T("-)");
    
    lstTemp->AddString(strTemp);

    lstTemp->AddString(CString(_T("\tVersion = ")) + itoa(uctHeader.intVers, strConv, 10));
    lstTemp->AddString(CString(_T("\tCreation Date = ")) + ltoa(uctHeader.lngCreate, strConv, 10));
    lstTemp->AddString(CString(_T("\tModification Date = ")) + ltoa(uctHeader.lngMod, strConv, 10));
    lstTemp->AddString(CString(_T("\tLast Backup Date = ")) + ltoa(uctHeader.lngBackUp, strConv, 10));
    lstTemp->AddString(CString(_T("\tModifiction Number = ")) + ltoa(uctHeader.lngModNum, strConv, 10));
    lstTemp->AddString(CString(_T("\tAppInfo Area = ")) + ltoa(uctHeader.lngAppInfoArea, strConv, 10));
    lstTemp->AddString(CString(_T("\tSortInfo Area = ")) + ltoa(uctHeader.lngSortArea, strConv, 10));
    lstTemp->AddString(CString(_T("\tType = ")) + uctHeader.strType);
    lstTemp->AddString(CString(_T("\tCreator = ")) + uctHeader.strCreator);
    lstTemp->AddString(CString(_T("\tUnique ID Seed = ")) + ltoa(uctHeader.lngSeed, strConv, 10));
    lstTemp->AddString(CString(_T("\tNextRecordList ID = ")) + ltoa(uctHeader.lngNextRec, strConv, 10));
    lstTemp->AddString(CString(_T("\tNumber of Records = ")) + itoa(uctHeader.intNumRecs, strConv, 10));

	arrRecInfo.SetSize(uctHeader.intNumRecs, 10);

	for (i = 0; i < uctHeader.intNumRecs; i++)
		GetRecInfo(filInput, &arrRecInfo[i]);

	for (i = 0; i < uctHeader.intNumRecs; i++) {
        lstTemp->AddString(CString(_T("")));
        lstTemp->AddString(CString(_T("Record Information for Record #")) + ltoa(i + 1, strConv, 10));

        lstTemp->AddString(CString(_T("\tOffset = ")) + ltoa(arrRecInfo[i].lngOffset, strConv, 10));
        
        strTemp = _T("\tAttr = ");
		strTemp += itoa(arrRecInfo[i].bytAttr, strConv, 10);
		strTemp += _T("\t");
		strTemp += _T("Cat: ");
		strTemp += itoa(arrRecInfo[i].bytAttr & dmRecAttrCategoryMask, strConv, 10);
 		strTemp += _T("\t");
       
        if (arrRecInfo[i].bytAttr & dmRecAttrSecret)
            strTemp += _T("(S");
        else
            strTemp += _T("(-");
        
        if (arrRecInfo[i].bytAttr & dmRecAttrBusy)
            strTemp += _T("B");
        else
            strTemp += _T("-");
        
        if (arrRecInfo[i].bytAttr & dmRecAttrDirty)
            strTemp += _T("D");
        else
            strTemp += _T("-");
        
        if (arrRecInfo[i].bytAttr & dmRecAttrDelete)
            strTemp += _T("X)");
        else
            strTemp += _T("-)");
    
		lstTemp->AddString(strTemp);
        
        lstTemp->AddString(CString(_T("\tUnique ID = ")) + ultoa(arrRecInfo[i].lngUniqueID, strConv, 10));

	        
        filInput.Seek(arrRecInfo[i].lngOffset, CFile::begin);
        
        if (arrRecInfo[i].bytAttr & dmRecAttrDelete)
			lstTemp->AddString (CString(_T("\t* Record Deleted *")));
		else
			for (j = 0; j <= thisApp->arrFields.GetUpperBound(); j++) {
				if ( (thisApp->arrFields[j].Type == CString(_T("Boolean")))
					|| (thisApp->arrFields[j].Type == CString(_T("UChar")))
					|| (thisApp->arrFields[j].Type == CString(_T("Byte"))) )
				{
					filInput.Read(&ubytTemp, 1);
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + itoa(ubytTemp, strConv, 10));
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("SByte")))
					|| (thisApp->arrFields[j].Type == CString(_T("Char"))) )
				{
					filInput.Read(&bytTemp, 1);
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + itoa(bytTemp, strConv, 10));
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("Long")))
					|| (thisApp->arrFields[j].Type == CString(_T("SDWord")))
					|| (thisApp->arrFields[j].Type == CString(_T("Int32"))) )
				{
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + ltoa(GetLong(filInput), strConv, 10));
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("ULong")))
					|| (thisApp->arrFields[j].Type == CString(_T("UInt32")))
					|| (thisApp->arrFields[j].Type == CString(_T("DWord")))
					|| (thisApp->arrFields[j].Type == CString(_T("LocalID"))) )
				{
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + ultoa(GetULong(filInput), strConv, 10));
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("SWord")))
					|| (thisApp->arrFields[j].Type == CString(_T("Int16")))
					|| (thisApp->arrFields[j].Type == CString(_T("Int")))
					|| (thisApp->arrFields[j].Type == CString(_T("Short")))
					|| (thisApp->arrFields[j].Type == CString(_T("Err"))) )
				{
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + ltoa(GetInt(filInput), strConv, 10));
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("Word")))
					|| (thisApp->arrFields[j].Type == CString(_T("UInt16")))
					|| (thisApp->arrFields[j].Type == CString(_T("UInt")))
					|| (thisApp->arrFields[j].Type == CString(_T("UShort"))) )
				{
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + ltoa(GetUInt(filInput), strConv, 10));
				}
				else if (thisApp->arrFields[j].Type == CString(_T("String")))
				{
					lstTemp->AddString (CString(_T("\t")) + thisApp->arrFields[j].Name + _T(": ") + GetString(filInput, thisApp->arrFields[j].Length));
				}
			}
	}

	filInput.Close();
}

void CPDBReaderDlg::DumpPDBFile(ofstream &filOutput)
{
	CFile		filInput;

	CString		strTemp;
	_TCHAR		strConv[20];

	char			bytTemp;
	unsigned char	ubytTemp;

	long		i;
	long		j;

	filInput.Open(strFileName, CFile::modeRead);

	filOutput << _T("Index,Unique ID,Category");
	for (j = 0; j <= thisApp->arrFields.GetUpperBound(); j++) {
		filOutput << _T(",") + thisApp->arrFields[j].Name;
	}
	filOutput << endl;

	for (i = 0; i < uctHeader.intNumRecs; i++) {
        if (! (arrRecInfo[i].bytAttr & dmRecAttrDelete) ) {
			filOutput << ltoa(i + 1, strConv, 10);
			filOutput << _T(",");
			filOutput << ultoa(arrRecInfo[i].lngUniqueID, strConv, 10);
			filOutput << _T(",");
			filOutput << ltoa(arrRecInfo[i].bytAttr & dmRecAttrCategoryMask, strConv, 10);
				
			filInput.Seek(arrRecInfo[i].lngOffset, CFile::begin);
        
			for (j = 0; j <= thisApp->arrFields.GetUpperBound(); j++) {
				filOutput << _T(",");

				if ( (thisApp->arrFields[j].Type == CString(_T("Boolean")))
					|| (thisApp->arrFields[j].Type == CString(_T("UChar")))
					|| (thisApp->arrFields[j].Type == CString(_T("Byte"))) )
				{
					filInput.Read(&ubytTemp, 1);
					filOutput << itoa(ubytTemp, strConv, 10);
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("SByte")))
					|| (thisApp->arrFields[j].Type == CString(_T("Char"))) )
				{
					filInput.Read(&bytTemp, 1);
					filOutput << itoa(bytTemp, strConv, 10);
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("Long")))
					|| (thisApp->arrFields[j].Type == CString(_T("SDWord")))
					|| (thisApp->arrFields[j].Type == CString(_T("Int32"))) )
				{
					filOutput << ltoa(GetLong(filInput), strConv, 10);
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("ULong")))
					|| (thisApp->arrFields[j].Type == CString(_T("UInt32")))
					|| (thisApp->arrFields[j].Type == CString(_T("DWord")))
					|| (thisApp->arrFields[j].Type == CString(_T("LocalID"))) )
				{
					filOutput << ltoa(GetULong(filInput), strConv, 10);
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("SWord")))
					|| (thisApp->arrFields[j].Type == CString(_T("Int16")))
					|| (thisApp->arrFields[j].Type == CString(_T("Int")))
					|| (thisApp->arrFields[j].Type == CString(_T("Short")))
					|| (thisApp->arrFields[j].Type == CString(_T("Err"))) )
				{
					filOutput << ltoa(GetInt(filInput), strConv, 10);
				}
				else if ( (thisApp->arrFields[j].Type == CString(_T("Word")))
					|| (thisApp->arrFields[j].Type == CString(_T("UInt16")))
					|| (thisApp->arrFields[j].Type == CString(_T("UInt")))
					|| (thisApp->arrFields[j].Type == CString(_T("UShort"))) )
				{
					filOutput << ltoa(GetUInt(filInput), strConv, 10);
				}
				else if (thisApp->arrFields[j].Type == CString(_T("String")))
				{
					strTemp = GetString(filInput, thisApp->arrFields[j].Length);
					strTemp.Replace('\n', '\266');

					filOutput << "\"" << strTemp << "\"";
				}
			}
		
			filOutput << endl;
		}
	}

	filInput.Close();
}

void CPDBReaderDlg::OnSize(UINT nType, int cx, int cy) 
{
	CListBox*		lstTemp;
	WINDOWPLACEMENT	wplTemp;

	CDialog::OnSize(nType, cx, cy);

	if (this->IsWindowVisible())
		switch (nType) {
			case SIZE_MINIMIZED:
			case SIZE_MAXHIDE:
				break;

			case SIZE_RESTORED:
			case SIZE_MAXIMIZED:
			case SIZE_MAXSHOW:
				lstTemp = (CListBox *) GetDlgItem(IDC_RESULT_LIST);

				wplTemp.length = sizeof(WINDOWPLACEMENT);
				lstTemp->GetWindowPlacement(&wplTemp);

				GetClientRect(&wplTemp.rcNormalPosition);

				lstTemp->SetWindowPlacement(&wplTemp);

				break;
		}
	
}

void CPDBReaderDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CListBox*		lstTemp;
	WINDOWPLACEMENT	wplTemp;

	CDialog::OnShowWindow(bShow, nStatus);

	if (bShow) {
		lstTemp = (CListBox *) GetDlgItem(IDC_RESULT_LIST);

		wplTemp.length = sizeof(WINDOWPLACEMENT);
		lstTemp->GetWindowPlacement(&wplTemp);

		GetClientRect(&wplTemp.rcNormalPosition);

		lstTemp->SetWindowPlacement(&wplTemp);
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -