程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> PE查看器

PE查看器

編輯:C++入門知識

主要界面如下:

主要代碼如下:

    
          
     SetIcon(m_hIcon, TRUE);            
     SetIcon(m_hIcon, FALSE);         
     
  
      TRUE;  
  
   
 
                 CPaintDC dc(); 
 
         SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()),  
         
          cxIcon =          cyIcon =          GetClientRect(&          x = (rect.Width() - cxIcon + ) /           y = (rect.Height() - cyIcon + ) /  
         
       
     
  
        static_cast<HCURSOR>  
 
       
     ((CEdit*)GetDlgItem(IDC_EDIT_FILEPATH))->     m_strPathName =               AfxMessageBox(_T(           
       (FALSE ==          AfxMessageBox(_T(              
       
   
       
     CFileDialog FileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, _T(      CString strPathName =     ((CEdit*)GetDlgItem(IDC_EDIT_FILEPATH))->  
 BOOL CPEParseDlg::FileCreate(      BOOL bRet = 
     m_hFile = CreateFile(m_strPathName.GetBuffer(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |      (INVALID_HANDLE_VALUE ==            
     m_hMap = CreateFileMapping(m_hFile, NULL, PAGE_READWRITE, ,       (NULL ==             
     m_lpBase = MapViewOfFile(m_hMap, FILE_MAP_READ | FILE_MAP_WRITE, , ,       (NULL ==              
     bRet =       
  CPEParseDlg::InitSectionList(       m_ctrlSections.GetClientRect(&     m_ctrlSections.SetExtendedStyle(m_ctrlSections.GetExtendedStyle() | LVS_EX_FULLROWSELECT |     m_ctrlSections.InsertColumn(, _T(     m_ctrlSections.InsertColumn(, _T(     m_ctrlSections.InsertColumn(, _T(     m_ctrlSections.InsertColumn(, _T(     m_ctrlSections.InsertColumn(, _T(     m_ctrlSections.InsertColumn(, _T(     m_ctrlSections.SetColumnWidth(, Rect.Width() /      m_ctrlSections.SetColumnWidth(, Rect.Width() /      m_ctrlSections.SetColumnWidth(, Rect.Width() /      m_ctrlSections.SetColumnWidth(, Rect.Width() /      m_ctrlSections.SetColumnWidth(, Rect.Width() /      m_ctrlSections.SetColumnWidth(, Rect.Width() /   
 BOOL CPEParseDlg::IsPeFileAndGetPePointer(      BOOL bRet = 
     m_pDosHeader =      (IMAGE_DOS_SIGNATURE != m_pDosHeader->            
     m_pNtHeaders = (PIMAGE_NT_HEADERS)((DWORD)m_lpBase + m_pDosHeader->      (IMAGE_NT_SIGNATURE != m_pNtHeaders->            
     m_pSectionHeader = (PIMAGE_SECTION_HEADER)((DWORD)&(m_pNtHeaders->OptionalHeader) + m_pNtHeaders-> 
     bRet =       
  CPEParseDlg::ParseBasePe(      m_strEntryPoint.Format(_T(), m_pNtHeaders->     m_strImageBase.Format(_T(), m_pNtHeaders->     m_strLinkerVersion.Format(_T(), m_pNtHeaders->OptionalHeader.MajorLinkerVersion, m_pNtHeaders->     m_strSectionNum.Format(_T(), m_pNtHeaders->     m_strFileAlignment.Format(_T(), m_pNtHeaders->     m_strSectionAlignment.Format(_T(), m_pNtHeaders->   
  CPEParseDlg::EnumSections(   
       iSectionNumber = m_pNtHeaders->     
      ( i = ; i < iSectionNumber; ++          strTemp =  
         strTemp.Format(_T(         m_ctrlSections.SetItemText(i,  
         strTemp.Format(_T(         m_ctrlSections.SetItemText(i,  
         strTemp.Format(_T(         m_ctrlSections.SetItemText(i,  
         strTemp.Format(_T(         m_ctrlSections.SetItemText(i,  
         strTemp.Format(_T(         m_ctrlSections.SetItemText(i,    
       
     m_nSelected =      ((CEdit*)GetDlgItem(IDC_EDIT_VA))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_RVA))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_FILEOFFSET))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_VA))->     ((CEdit*)GetDlgItem(IDC_EDIT_RVA))->     ((CEdit*)GetDlgItem(IDC_EDIT_FILEOFFSET))->  
       
     m_nSelected =      ((CEdit*)GetDlgItem(IDC_EDIT_VA))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_RVA))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_FILEOFFSET))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_VA))->     ((CEdit*)GetDlgItem(IDC_EDIT_RVA))->     ((CEdit*)GetDlgItem(IDC_EDIT_FILEOFFSET))->  
       
     m_nSelected =      ((CEdit*)GetDlgItem(IDC_EDIT_VA))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_RVA))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_FILEOFFSET))->SetWindowText(_T(     ((CEdit*)GetDlgItem(IDC_EDIT_VA))->     ((CEdit*)GetDlgItem(IDC_EDIT_RVA))->     ((CEdit*)GetDlgItem(IDC_EDIT_FILEOFFSET))->  
       
     m_strImageBase =               AfxMessageBox(_T(           
      ((CEdit*)GetDlgItem(IDC_EDIT_FILEPATH))->      (strPathName !=          AfxMessageBox(_T(           
     DWORD dwAddr =      dwAddr =      nInNum =   
 DWORD CPEParseDlg::GetAddr(      TCHAR szAddr[] = {     DWORD dwAddr =                      GetDlgItemText(IDC_EDIT_VA, szAddr,          HexStrToInt(szAddr, &                        GetDlgItemText(IDC_EDIT_RVA, szAddr,          HexStrToInt(szAddr, &                        GetDlgItemText(IDC_EDIT_FILEOFFSET, szAddr,          HexStrToInt(szAddr, &           
       
        nInNum =       nSectionNum = m_pNtHeaders->                          DWORD dwImageBase = m_pNtHeaders->              (nInNum = ; nInNum < nSectionNum; nInNum++                   (dwAddr >= dwImageBase +                     && dwAddr <= dwImageBase +                     +                                                      (nInNum = ; nInNum < nSectionNum; nInNum++               (dwAddr >=                 && dwAddr <=                 +                                             (nInNum = ; nInNum < nSectionNum; nInNum++               (dwAddr >=                 && dwAddr <=                 +                               
      -  
  CPEParseDlg::CalcAddr(      DWORD dwVa =      DWORD dwRva =      DWORD dwFileOffset =  
                     dwVa =         dwRva = dwVa - m_pNtHeaders->         dwFileOffset = m_pSectionHeader[nInNum].PointerToRawData + (dwRva -                        dwVa = dwAddr + m_pNtHeaders->         dwRva =         dwFileOffset = m_pSectionHeader[nInNum].PointerToRawData + (dwRva -                        dwFileOffset =         dwRva = m_pSectionHeader[nInNum].VirtualAddress + (dwFileOffset -         dwVa = dwRva + m_pNtHeaders->           
  
      str.Format(_T(  
     str.Format(_T(  
     str.Format(_T(   
  CPEParseDlg::HexStrToInt(TCHAR* szAddr, DWORD*       iLen =     *pdwAddr =  
      ( i = ; i < iLen; i++           (szAddr[i] >= _T() && szAddr[i] <= _T(              *pdwAddr = ((*pdwAddr) << ) | (szAddr[i] - _T(            (szAddr[i] >= _T() && szAddr[i] <= _T(              *pdwAddr = ((*pdwAddr) << ) | (szAddr[i] - _T() +             (szAddr[i] >= _T() && szAddr[i] <= _T(              *pdwAddr = ((*pdwAddr) << ) | (szAddr[i] - _T() +     
    
     
      (NULL !=        
      (NULL !=    
      (INVALID_HANDLE_VALUE !=     
 HBRUSH CPEParseDlg::OnCtlColor(CDC* pDC, CWnd*      HBRUSH hbr = 
                               
     
       
       
     m_strImageBase =               AfxMessageBox(_T(           
      ((CEdit*)GetDlgItem(IDC_EDIT_FILEPATH))->      (strPathName !=          AfxMessageBox(_T(           
     TCHAR szSectionName[] = {      nSectionSize =  
     GetDlgItemText(IDC_EDIT_SECTIONNAME, szSectionName,      nSectionSize = 
   
  CPEParseDlg::AddSection(TCHAR* szSectionName,        nSectionNum = m_pNtHeaders->     DWORD dwFileAlignment = m_pNtHeaders->     DWORD dwSectionAlignment = m_pNtHeaders-> 
     PIMAGE_SECTION_HEADER pTempSection = m_pSectionHeader + 
      nLen = WideCharToMultiByte(CP_ACP, , (LPCWSTR)szSectionName, -, NULL,       *pszSectionNameA =       WideCharToMultiByte(CP_ACP, , szSectionName, -, pszSectionNameA, nLen * (     
     strncpy((*)(pTempSection->Name), pszSectionNameA,       pszSectionNameA =     
     pTempSection->Misc.VirtualSize =     
     pTempSection->VirtualAddress = m_pSectionHeader[nSectionNum -          + AlignSize(m_pSectionHeader[nSectionNum -      
     pTempSection->SizeOfRawData =     
     pTempSection->PointerToRawData = m_pSectionHeader[nSectionNum -          + AlignSize(m_pSectionHeader[nSectionNum -      
     m_pNtHeaders->FileHeader.NumberOfSections++     
     m_pNtHeaders->OptionalHeader.SizeOfImage += pTempSection->     
     FlushViewOfFile(m_lpBase,      
     AddSectionData(pTempSection-> 
      str.Format(_T(), m_pNtHeaders->     ((CEdit*)GetDlgItem(IDC_EDIT_SECTIONNUM))->   
 DWORD CPEParseDlg::AlignSize(       nSize =      (nSize % dwAlignment !=           nSectionSize = (nSize / dwAlignment + ) *  
       
  CPEParseDlg::AddSectionData(      PBYTE pByte =     pByte =  
     DWORD dwNum =      SetFilePointer(m_hFile, ,      WriteFile(m_hFile, pByte, nSectionSize, &  
  }

下載地址如下:

http://pan.baidu.com/s/1hqBR06S

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved