PE_Info 之DIY

Redis精通系列——info 指令用法 本文已收录于专栏 ❤️《Redis精通系列》❤️ 上千人点赞收藏,全套Redis学习资料,大厂必备技能! 目录 1、简介 2、info/info all 3、info server 4、info clients 5、info memory 6、info persistence 7、AOF 8、loading 9、status 10、info replication 11、info CPU 12、info cluster 13、info keyspace 1、简介 Re.. 阅读详情

 自己写的PE 信息查看工具(C代码),不甚完美,希望可以帮助初学PE 的读者从编程的角度认识PE文件,Good Luck!
       下面是源代码:

/*///////////////////////////////////////////////////////////////////////////////
This program will output the values of important members in the PE file
Good Luck!
///////////////////////////////////////////////////////////////////////////////*/
/*///////////////////////////////////////////////////////////////////////////////
USAGE: peinfo.exe  DestinationFileName
///////////////////////////////////////////////////////////////////////////////*/

#include<windows.h>
#include<stdio.h>
#include<shlwapi.h>

/*////////////////////////////////////////////////////////////////////////////
This function is used for outputting the error information 
Please use GetLastError() to retrieve the dwErrorCode,Gook Luck!*/
void OutputErrorInfo(DWORD dwErrorCode)
{
TCHAR FormattedErrorInfo[MAX_PATH];
RtlZeroMemory(FormattedErrorInfo,MAX_PATH);//Initialization

  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
    0,
    dwErrorCode,
    MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),//English
    //            0, //The default language of the current system
    FormattedErrorInfo,MAX_PATH,NULL);
    
      //    printf("/nCopyFile()'s ErrorInformation:%s/n",FormattedErrorInfo);
      MessageBox(NULL,FormattedErrorInfo,"Error",MB_OK|MB_ICONINFORMATION);
}
/*//////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////*/
//Notice the file pointer all the time,this is very important.


void main(int argc,char *argv[])
{
  HANDLE hDestinationFile=NULL;
//////////////////////////////////////////////////////////////////////
  DWORD i=0;
  DWORD j=0;
  DWORD k=0;
  DWORD NumberOfBytesRead=0;   //Number of bytes read
  WORD MZSignature=0; // MZ signature
  DWORD ImageNtSignature=0;  //PE signature
  DWORD OffsetOfNewHeader=0;
  DWORD NumberOfSections=0;
  DWORD SizeOfOptionalHeader=0;
  DWORD SizeOfSectionTable=0;           //size of section table

  HANDLE hGlobalAllocatedMemory=NULL;  //use GlobalAlloc();
  HANDLE hGlobalAllocatedMemoryOfDataDirectory=NULL;

  PIMAGE_SECTION_HEADER pImageSectionHeader=NULL; //a pointer to IMAGE_SECTION_TABLE
  PIMAGE_DATA_DIRECTORY  pImageDataDirectory; //a pointer to IMAGE_DATA_DIRECTORY

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  IMAGE_DOS_HEADER ImageDosHeader;
  IMAGE_NT_HEADERS ImageNTHeaders;
  IMAGE_FILE_HEADER ImageFileHeader;

  IMAGE_OPTIONAL_HEADER ImageOptionalHeader;
  IMAGE_SECTION_HEADER ImageSectionHeader;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  IMAGE_EXPORT_DIRECTORY ImageExportDirectory;  //Export and Import
  IMAGE_IMPORT_DESCRIPTOR ImageImportDescriptor;
  PIMAGE_EXPORT_DIRECTORY pImageExportDirectory=NULL;
  PIMAGE_IMPORT_DESCRIPTOR pImageImportDescriptor=NULL;

  DWORD *pExportAddressTableEntry=NULL; //pointer
  DWORD *pExportNamePointerTableEntry=NULL;
  WORD *pExportOrdinalTableEntry=NULL;


  DWORD SizeOfRawData=0;
  DWORD PointerToRawData=0;
    DWORD VirtualAddress=0;
  DWORD CountOfImportDirectoryEntries=0;

  DWORD RvaOfExportDirectoryTable=0;  
  DWORD RvaOfImportDirectoryTable=0;
  DWORD DestinationSectionPosition=0; //Destination Section Position

  DWORD FilePointerToIMAGE_EXPORT_DERECTORY=0; //file pointer
  DWORD FilePointerToImportDirectoryTable=0;
  DWORD FilePointerOfExportedDllName=0;
  TCHAR ExportedDllName[MAX_PATH];
  TCHAR ImportedDllName[MAX_PATH]; //Imported Dll Name

  DWORD FilePointerOfExportAddressTable=0;  //file pointer
  DWORD FilePointerOfExportOrdinalTable=0;
  DWORD FilePointerOfExportNamePointerTable=0;
  
  HANDLE hGlobalMemoryForExportAddressTable=NULL; //Global memory allocated
  HANDLE hGlobalMemoryForExportOrdinalTable=NULL;
  HANDLE hGlobalMemoryForExportNamePointerTable=NULL;

  HANDLE hGlobalMemoryForImportDirectoryTable=NULL;
  HANDLE hGlobalMemoryForImportDirectoryTable2=NULL;
  HANDLE hGlobalMemoryForCount=NULL;

  

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  RtlZeroMemory(&ImageDosHeader,sizeof(IMAGE_DOS_HEADER));
  RtlZeroMemory(&ImageNTHeaders,sizeof(IMAGE_NT_HEADERS));
  RtlZeroMemory(&ImageFileHeader,sizeof(IMAGE_FILE_HEADER));

  RtlZeroMemory(&ImageOptionalHeader,sizeof(IMAGE_OPTIONAL_HEADER));
  RtlZeroMemory(&ImageSectionHeader,sizeof(IMAGE_SECTION_HEADER));

  RtlZeroMemory(&ImageExportDirectory,sizeof(IMAGE_EXPORT_DIRECTORY));  //Export and Import
  RtlZeroMemory(&ImageImportDescriptor,sizeof(IMAGE_IMPORT_DESCRIPTOR));


  if(argc!=2)
  {
    printf("Error./nUSAGE:peinfo.exe DestinationFileName/n");
    return;
  }

  hDestinationFile=CreateFile(argv[1],
    FILE_WRITE_DATA|FILE_READ_DATA,
    FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_ARCHIVE,NULL);

  OutputErrorInfo(GetLastError());

//  OpenFile(DestinationPEFile,NULL,NULL);
  if(hDestinationFile==INVALID_HANDLE_VALUE)
  {
    printf("/nCreateFile() fails!Can't open file. Please try again!/n");
    return;
  }

  if(!ReadFile(hDestinationFile,&MZSignature,2,&NumberOfBytesRead,NULL))
  {
    printf("/nReadFile() fails! Please try again./n");
    return;
  }
  if(NumberOfBytesRead!=2)
  {
    printf("/nReadFile() fails! Can't get the MZSignature./n");
    return;
  }

  if(MZSignature!=0x5A4D)
  {
    printf("/nThis file is not a valid PE file./n");
    printf("/nThe value of MZSignature is:%#x/n",MZSignature);
    return;
  }
  SetFilePointer(hDestinationFile,0,NULL,FILE_BEGIN); //Revert the file pointer,this is very important.

  ReadFile(hDestinationFile,&ImageDosHeader,
         sizeof(IMAGE_DOS_HEADER),&NumberOfBytesRead,NULL);
  if(NumberOfBytesRead!=sizeof(IMAGE_DOS_HEADER))
  {
    printf("/nReadFile() fails! Can't get IMAGE_DOS_HEADER./n");
    return;
  }
  else
  {
    printf("/nGet IMAGE_DOS_HEADER successfully!/n");
  }
  ////////////////////////////////////Output the information in the IMAGE_DOS_HEADER
  printf("ImageDosHeader.e_magic: %#x/n",ImageDosHeader.e_magic);
  printf("ImageDosHeader.e_crlc: %#x/n",ImageDosHeader.e_crlc); //Relocations
  printf("ImageDosHeader.e_ss: %#x/n",ImageDosHeader.e_ss);
  printf("ImageDosHeader.e_sp: %#x/n",ImageDosHeader.e_sp); 
  printf("ImageDosHeader.e_csum: %#x/n",ImageDosHeader.e_csum); //check sum
  printf("ImageDosHeader.e_ip: %#x/n",ImageDosHeader.e_ip); 
  printf("ImageDosHeader.e_cs: %#x/n",ImageDosHeader.e_cs);
  printf("ImageDosHeader.e_lfarlc: %#x/n",ImageDosHeader.e_lfarlc); //File address of relocation table
  printf("ImageDosHeader.e_oemid: %#x/n",ImageDosHeader.e_oemid);
  printf("ImageDosHeader.e_oeminfo: %#x/n",ImageDosHeader.e_oeminfo); 
  printf("ImageDosHeader.e_lfanew: %#x/n",ImageDosHeader.e_lfanew); //file address of new exe header
//  printf("ImageDosHeader.e_crlc%#x/n",ImageDosHeader.e_sp); 
  //......



  if(ImageDosHeader.e_magic!=MZSignature)  //MZ header
  {
    printf("/nValue of ImageDosHeader.e_magic is:");
    printf("%#x,%#d/n",ImageDosHeader.e_magic,ImageDosHeader.e_magic);
  }

  OffsetOfNewHeader=ImageDosHeader.e_lfanew; //File address of new exe header

  SetFilePointer(hDestinationFile,(LONG)OffsetOfNewHeader,NULL,FILE_BEGIN);
//  OutputErrorInfo(GetLastError());

  ReadFile(hDestinationFile,&ImageNTHeaders,
    sizeof(IMAGE_NT_HEADERS),&NumberOfBytesRead,NULL); //Retrieve IMAGE_NT_HEADERS
  if(NumberOfBytesRead!=sizeof(IMAGE_NT_HEADERS))
  {
    printf("/nReadFile() fails! Cant' get IMAGE_NT_HEADER./n");
    return;
  }
  else
  {
    printf("/nGet IMAGE_NT_HEADERS successfully!/n");
  }
  //Output the information in IMAGE_NT_HEADER
  printf("ImageNTHeaders.Signature: %#x/n",ImageNTHeaders.Signature);


  SetFilePointer(hDestinationFile,OffsetOfNewHeader+4,NULL,FILE_BEGIN);  //Set the file pointer to point to IMAGE_FILE_HEADER
  ReadFile(hDestinationFile,&ImageFileHeader,
    sizeof(IMAGE_FILE_HEADER),&NumberOfBytesRead,NULL); //Retrieve IMAGE_FILE_HEADER
  if(NumberOfBytesRead!=sizeof(IMAGE_FILE_HEADER))
  { 
    printf("/nReadFile() fails! Can't get IMAGE_FILE_HEADER./n");
    return;
  }
  else
  {
    printf("/nGet IMAGE_FILE_HEADER successfully!/n");
  }
  //Output the information in IMAGE_FILE_HEADER
  printf("ImageFileHeader.Machine: %#x/n",ImageFileHeader.Machine);
  printf("ImageFileHeader.NumberOfSections: %#x/n",ImageFileHeader.NumberOfSections);
  printf("ImageFileHeader.TimeDateStamp: %#x/n",ImageFileHeader.TimeDateStamp);
  printf("ImageFileHeader.SizeOfOptionalHeader: %#x/n",ImageFileHeader.SizeOfOptionalHeader);
    printf("ImageFileHeader.Characteristics: %#x/n",ImageFileHeader.Characteristics);



  ReadFile(hDestinationFile,&ImageOptionalHeader,
    sizeof(IMAGE_OPTIONAL_HEADER),&NumberOfBytesRead,NULL); //Retrieve IMAGE_OPTIONAL_HEADER
  if(NumberOfBytesRead!=sizeof(IMAGE_OPTIONAL_HEADER))
  {
    printf("/nReadFile() fails! Can't get IMAGE_OPTIONAL_HEADER./n");
    return;
  }
  else
  {
    printf("/nGet IMAGE_OPTIONAL_HEADER successfully!/n");
  }
  //Output the information in the IMAGE_OPTIONAL_HEADER
  //
  //Standard fields.
  //
  printf("--------------------------------------------->>>Standard fields/n");
  printf("ImageOptionalHeader.Magic: %#x/n",ImageOptionalHeader.Magic); //Standard fields
  printf("ImageOptionalHeader.MajorLinkerVersion: %#x/n",ImageOptionalHeader.MajorLinkerVersion);
  printf("ImageOptionalHeader.MinorLinkerVersion: %#x/n",ImageOptionalHeader.MinorLinkerVersion);
  printf("ImageOptionalHeader.SizeOfCode: %#x/n",ImageOptionalHeader.SizeOfCode);
  printf("ImageOptionalHeader.SizeOfInitializedData: %#x/n",ImageOptionalHeader.SizeOfInitializedData);
  printf("ImageOptionalHeader.SizeOfUninitializedData: %#x/n",ImageOptionalHeader.SizeOfUninitializedData);
  printf("ImageOptionalHeader.AddressOfEntryPoint: %#x/n",ImageOptionalHeader.AddressOfEntryPoint);
  printf("ImageOptionalHeader.BaseOfCode: %#x/n",ImageOptionalHeader.BaseOfCode);
  printf("ImageOptionalHeader.BaseOfData: %#x/n",ImageOptionalHeader.BaseOfData);
  //
  ////NT additional fields
  //
  printf("---------------------------------------------->>>NT additional fields/n");
  printf("ImageOptionalHeader.ImageBase: %#x/n",ImageOptionalHeader.ImageBase);
  printf("ImageOptionalHeader.SectionAlignment: %#x/n",ImageOptionalHeader.SectionAlignment); 
  printf("ImageOptionalHeader.FileAlignment: %#x/n",ImageOptionalHeader.FileAlignment);
  printf("ImageOptionalHeader.MajorOperatingSystemVersion: %#x/n",ImageOptionalHeader.MajorOperatingSystemVersion);
  printf("ImageOptionalHeader.MinorOperatingSystemVersion: %#x/n",ImageOptionalHeader.MinorOperatingSystemVersion);
  printf("ImageOptionalHeader.MajorImageVersion: %#x/n",ImageOptionalHeader.MajorImageVersion);
  printf("ImageOptionalHeader.MinorImageVersion: %#x/n",ImageOptionalHeader.MinorImageVersion);
  printf("ImageOptionalHeader.MajorSubsystemVersion: %#x/n",ImageOptionalHeader.MajorSubsystemVersion);
  printf("ImageOptionalHeader.MinorSubsystemVersion: %#x/n",ImageOptionalHeader.MinorSubsystemVersion);
  printf("ImageOptionalHeader.Win32VersionValue: %#x/n",ImageOptionalHeader.Win32VersionValue);
  printf("ImageOptionalHeader.SizeOfImage: %#x/n",ImageOptionalHeader.SizeOfImage); 
  printf("ImageOptionalHeader.SizeOfHeaders: %#x/n",ImageOptionalHeader.SizeOfHeaders);
  printf("ImageOptionalHeader.CheckSum: %#x/n",ImageOptionalHeader.CheckSum);
  printf("ImageOptionalHeader.Subsystem: %#x/n",ImageOptionalHeader.Subsystem);
  printf("ImageOptionalHeader.DllCharacteristics: %#x/n",ImageOptionalHeader.DllCharacteristics);
  printf("ImageOptionalHeader.SizeOfStackReserve: %#x/n",ImageOptionalHeader.SizeOfStackReserve);
  printf("ImageOptionalHeader.SizeOfStackCommit: %#x/n",ImageOptionalHeader.SizeOfStackCommit);
  printf("ImageOptionalHeader.SizeOfHeapReserve: %#x/n",ImageOptionalHeader.SizeOfHeapReserve);
  printf("ImageOptionalHeader.SizeOfHeapCommit: %#x/n",ImageOptionalHeader.SizeOfHeapCommit);
  printf("ImageOptionalHeader.LoaderFlags: %#x/n",ImageOptionalHeader.LoaderFlags);
  printf("ImageOptionalHeader.NumberOfRvaAndSizes: %#x/n",ImageOptionalHeader.NumberOfRvaAndSizes);

  //Add the information in IMAGE_DATA_DIRECTORY to complete it.
  printf("-------------------------------------------------------------------/n");
  printf("Information in IMAGE_DATA_DIRECTORY/n");
  hGlobalAllocatedMemoryOfDataDirectory=GlobalAlloc(GPTR,
                                  sizeof(IMAGE_DATA_DIRECTORY)*ImageOptionalHeader.NumberOfRvaAndSizes); //Allocate memory and initialize with zero
  pImageDataDirectory=(PIMAGE_DATA_DIRECTORY)hGlobalAllocatedMemoryOfDataDirectory;

  RtlCopyMemory(pImageDataDirectory,ImageOptionalHeader.DataDirectory, //Get IMAGE_DATA_DIRECTORY
    sizeof(IMAGE_DATA_DIRECTORY)*ImageOptionalHeader.NumberOfRvaAndSizes);


  

  for(i=0;i<ImageOptionalHeader.NumberOfRvaAndSizes;i++)
  {
    printf("-------------------------------------/n");
    switch(i)
    {
    case 0:
      printf("Export Table:/n");
      break;
    case 1:
      printf("Import Table:/n");
      break;
    case 2:
      printf("Resource Table:/n");
      break;
    case 3:
      printf("Exception Table:/n");
      break;
    case 4:
      printf("Certificate Table:/n");
      break;
    case 5:
      printf("Base Relocation Table:/n");
      break;
    case 6:
      printf("Debug:/n");
      break;
    case 7:
      printf("Architecture:/n");
      break;
    case 8:
      printf("Global Ptr:/n");
      break;
    case 9:
      printf("TLS Table:/n");
      break;
    case 10:
      printf("Load Config Table:/n");
      break;
    case 11:
      printf("Bound Import:/n");
      break;
    case 12:
      printf("IAT:/n");
      break;
    case 13:
      printf("Delay Import Descriptor:/n");
      break;
    case 14:
      printf("CLR Runtime Header:/n");
      break;
    case 15:
      printf("Reserved, must be zero:/n");
      break;
    }
    printf("VirtualAddress: %#x/n",(pImageDataDirectory+i)->VirtualAddress);
    printf("Size: %#x/n",(pImageDataDirectory+i)->Size);
//    printf("-------------------------------------/n");
  }


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  NumberOfSections=ImageFileHeader.NumberOfSections; //Number of sections
  SizeOfOptionalHeader=ImageFileHeader.SizeOfOptionalHeader; //size of optional header

  if(SizeOfOptionalHeader!=sizeof(IMAGE_OPTIONAL_HEADER))
  {
    printf("/nThere is an error./nThe value of ImageFileHeader.SizeOfOptionalHeader is incorrect!/n");
  }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  SizeOfSectionTable=sizeof(IMAGE_SECTION_HEADER)*NumberOfSections; //Get the size of Section Table

  hGlobalAllocatedMemory=GlobalAlloc(GPTR,SizeOfSectionTable);      //Allocate memory and initialize with zero
  if(hGlobalAllocatedMemory==NULL)
  {
    printf("/nGlobalAlloc() failed! Please try again./n"); //if failed,return
    return;
  }

//  RtlZeroMemory(hGlobalAllocatedMemory,SizeOfSectionTable); //Initialize with zero,this operation has been completed!

    pImageSectionHeader=(PIMAGE_SECTION_HEADER)hGlobalAllocatedMemory; //Convert a handle to a pointer to IMAGE_SECTION_HEADER

  for(i=0;i<NumberOfSections;i++)  //Retrieve the Section Table
  {
    ReadFile(hDestinationFile,pImageSectionHeader+i,
      sizeof(IMAGE_SECTION_HEADER),&NumberOfBytesRead,NULL); 
    if(NumberOfBytesRead!=sizeof(IMAGE_SECTION_HEADER))
    {
      printf("Error.Can't get IMAGE_SECTION_HEADER./n");
    }
  }
  printf("------------------------------------------------------/n");
  printf("------------------------------------------------------/n");
  printf("/nGet IMAGE_SECTION_HEADER successfully!/n");
/* 
//The following code fragment has the identical effect to the above for()
  ReadFile(hDestinationFile,pImageSectionHeader,
    SizeOfSectionTable,NULL,NULL); //Retrieve the Section Table
*/
  for(i=0;i<NumberOfSections;i++)
  {
    printf("/nThe name of the section%d: ",i);
    printf("%s/n",(*(pImageSectionHeader+i)).Name);

    printf("Misc:%#x/n",(*(pImageSectionHeader+i)).Misc);
    printf("VirtualAddress: %#x/n",(*(pImageSectionHeader+i)).VirtualAddress);
    printf("SizeOfRawData: %#x/n",(*(pImageSectionHeader+i)).SizeOfRawData);
    printf("PointerToRawData: %#x/n",(*(pImageSectionHeader+i)).PointerToRawData);
    printf("PointerToRelocations: %#x/n",(*(pImageSectionHeader+i)).PointerToRelocations);
    printf("PointerToLinenumbers: %#x/n",(*(pImageSectionHeader+i)).PointerToLinenumbers);
    printf("NumberOfRelocations: %#x/n",(*(pImageSectionHeader+i)).NumberOfRelocations);
    printf("NumberOfLinenumbers: %#x/n",(*(pImageSectionHeader+i)).NumberOfLinenumbers);

    printf("Characteristics: %#x/n",(*(pImageSectionHeader+i)).Characteristics);
      printf("------------------------------------------------------");
  }
  //Output  information of .idata section
  for(i=0;i<NumberOfSections;i++)
  {
    if(StrCmp((*(pImageSectionHeader+i)).Name,".idata")==0)
    {
      SizeOfRawData=(*(pImageSectionHeader+i)).SizeOfRawData;
      PointerToRawData=(*(pImageSectionHeader+i)).PointerToRawData;
      VirtualAddress=(*(pImageSectionHeader+i)).VirtualAddress;
      SetFilePointer(hDestinationFile,PointerToRawData,NULL,FILE_BEGIN);

      hGlobalMemoryForCount=GlobalAlloc(GPTR,sizeof(IMAGE_IMPORT_DESCRIPTOR)); //Allocate memory and initialize with zero
            
      do 
      {
        ReadFile(hDestinationFile,hGlobalMemoryForCount,sizeof(IMAGE_IMPORT_DESCRIPTOR),&NumberOfBytesRead,NULL);
        if(*((DWORD*)hGlobalMemoryForCount)==0 && *((DWORD*)hGlobalMemoryForCount+1)==0)
        {
          break;
        }
        else
          CountOfImportDirectoryEntries++;
      } while (1);
      GlobalFree(hGlobalMemoryForCount); //Free the allocated memory

      if(CountOfImportDirectoryEntries==0)
      {
        printf("/nThe count of Import Directory Entries is 0/n");//*******************************************/
        return;
      }
      hGlobalMemoryForImportDirectoryTable=GlobalAlloc(GPTR,
                                                  sizeof(IMAGE_IMPORT_DESCRIPTOR)*CountOfImportDirectoryEntries);
      pImageImportDescriptor=(PIMAGE_IMPORT_DESCRIPTOR)hGlobalMemoryForImportDirectoryTable;
      SetFilePointer(hDestinationFile,PointerToRawData,NULL,FILE_BEGIN);
      ReadFile(hDestinationFile,hGlobalMemoryForImportDirectoryTable,
        sizeof(IMAGE_IMPORT_DESCRIPTOR)*CountOfImportDirectoryEntries,
        &NumberOfBytesRead,NULL);  //Get ImportDirectoryTable
      if(NumberOfBytesRead==sizeof(IMAGE_IMPORT_DESCRIPTOR)*CountOfImportDirectoryEntries)
      {
        printf("/n/nGet Import Directory Table successfully!/n");
      }
      else
      {
        printf("/nCan't get Import Directory Table./n");
        return;
      }

      printf("/n");
      for(j=0;j<CountOfImportDirectoryEntries;j++)
      {
        DWORD temp=0;
        DWORD CountOfImportLookupTableEntries=0;
        DWORD *PointToLookupTableEntries=NULL;
        HANDLE GlobalMemoryForImportLookupTableEntries=NULL;
        TCHAR DllName[MAX_PATH];

        //Output Import Directory Table entries
        printf("IMAGE_IMPORT_DESCRIPTOR.Characteristics: %#x/n",(*(pImageImportDescriptor+j)).Characteristics);
        printf("IMAGE_IMPORT_DESCRIPTOR.FirstThunk: %#x/n",(*(pImageImportDescriptor+j)).FirstThunk);
        printf("IMAGE_IMPORT_DESCRIPTOR.ForwarderChain: %#x/n",(*(pImageImportDescriptor+j)).ForwarderChain);
        printf("IMAGE_IMPORT_DESCRIPTOR.Name: %#x/n",(*(pImageImportDescriptor+j)).Name);
        printf("IMAGE_IMPORT_DESCRIPTOR.OriginalFirstThunk: %#x/n",(*(pImageImportDescriptor+j)).OriginalFirstThunk);
        printf("IMAGE_IMPORT_DESCRIPTOR.TimeDateStamp: %#x/n",(*(pImageImportDescriptor+j)).TimeDateStamp);
    
        //Output the corresponding dll name
        temp=(*(pImageImportDescriptor+j)).Name-VirtualAddress+PointerToRawData;
                SetFilePointer(hDestinationFile,temp,NULL,FILE_BEGIN);
        ReadFile(hDestinationFile,DllName,MAX_PATH,&NumberOfBytesRead,NULL);
        printf("/n%s/n",DllName);
        ///////////////////////////////////////////////////////////////////////////////////////////
        temp=(*(pImageImportDescriptor+j)).Characteristics-VirtualAddress+PointerToRawData; //Get file pointer
        SetFilePointer(hDestinationFile,temp,NULL,FILE_BEGIN);
        do 
        {
          ReadFile(hDestinationFile,&temp,4,&NumberOfBytesRead,NULL);
          if(temp==0)
          {
            break;
          }
          else
            CountOfImportLookupTableEntries++;
        } while (1);
        GlobalMemoryForImportLookupTableEntries=GlobalAlloc(GPTR,CountOfImportLookupTableEntries*4);
        temp=(*(pImageImportDescriptor+j)).Characteristics-VirtualAddress+PointerToRawData; //Get file pointer
        SetFilePointer(hDestinationFile,temp,NULL,FILE_BEGIN);
        ReadFile(hDestinationFile,GlobalMemoryForImportLookupTableEntries,
          CountOfImportLookupTableEntries*4,&NumberOfBytesRead,NULL); //Retrieve Import Lookup Table

        PointToLookupTableEntries=(DWORD*)GlobalMemoryForImportLookupTableEntries;
        printf("/n/n");
               printf("Rva||Ordinal--Hint----ImportedFunctionName/n");/////88888
        for(k=0;k<CountOfImportLookupTableEntries;k++)
        {
          WORD Ordinal=0;
          TCHAR FunctionName[MAX_PATH];
          printf("%-4d%#-8x",k,*(PointToLookupTableEntries+k)); //Output Import Lookup Table entries
          temp=*(PointToLookupTableEntries+k)-VirtualAddress+PointerToRawData;
          SetFilePointer(hDestinationFile,temp,NULL,FILE_BEGIN);
          ReadFile(hDestinationFile,&Ordinal,2,&NumberOfBytesRead,NULL); //Get the ordinal in hint/name table
          printf(" %#-8x ",Ordinal);
          ReadFile(hDestinationFile,FunctionName,MAX_PATH,&NumberOfBytesRead,NULL);
          printf("%s/n",FunctionName);
        }
        printf("-------------------------------------------------------/n");
      }
      
    } //if end
  }
  //Output the information in the .edata section
  if((*(pImageDataDirectory+0)).VirtualAddress!=0 && (*(pImageDataDirectory+0)).Size!=0)
  {
    RvaOfExportDirectoryTable=(*(pImageDataDirectory+0)).VirtualAddress;   //Get the RVA of ExportDirectoryTable*****
    printf("/nThis file has Export Directory Table./n");
  }
  else
  {
    printf("/nThis file has no Export Directory Table./n");
    goto next;
  }

  for(i=0;i<NumberOfSections;i++)
  {
    if(RvaOfExportDirectoryTable>=(pImageSectionHeader+i)->VirtualAddress)
    {
      if(  RvaOfExportDirectoryTable<=(pImageSectionHeader+i)->VirtualAddress+(pImageSectionHeader+i)->SizeOfRawData)
      {
        DestinationSectionPosition=i;
          break;
      }
    }
  }
  FilePointerToIMAGE_EXPORT_DERECTORY= (*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData+
    RvaOfExportDirectoryTable-
    (*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;  //Notice the priority
  SetFilePointer(hDestinationFile,FilePointerToIMAGE_EXPORT_DERECTORY,NULL,FILE_BEGIN);
  ReadFile(hDestinationFile,&ImageExportDirectory,sizeof(IMAGE_EXPORT_DIRECTORY),
            &NumberOfBytesRead,NULL);
  if(NumberOfBytesRead==sizeof(IMAGE_EXPORT_DIRECTORY))
  {
    printf("/nGet IMAGE_EXPORT_DIRECTORY successfully!/n");
  }
  else
  {
    printf("/nCan't get IMAGE_EXPORT_DIRECTORY./n");
    return;
  }
  printf("ImageExportDirectory.Characteristics: %#x/n",ImageExportDirectory.Characteristics);
  printf("ImageExportDirectory.TimeDateStamp: %#x/n",ImageExportDirectory.TimeDateStamp);
  printf("ImageExportDirectory.MajorVersion: %#x/n",ImageExportDirectory.MajorVersion);
  printf("ImageExportDirectory.MinorVersion: %#x/n",ImageExportDirectory.MinorVersion);
  printf("ImageExportDirectory.Name: %#x/n",ImageExportDirectory.Name);
  printf("ImageExportDirectory.Base: %#x/n",ImageExportDirectory.Base);
  printf("ImageExportDirectory.NumberOfFunctions: %#x/n",ImageExportDirectory.NumberOfFunctions);
  printf("ImageExportDirectory.NumberOfNames: %#x/n",ImageExportDirectory.NumberOfNames);
  printf("ImageExportDirectory.AddressOfFunctions: %#x/n",ImageExportDirectory.AddressOfFunctions);
  printf("ImageExportDirectory.AddressOfNames: %#x/n",ImageExportDirectory.AddressOfNames);
  printf("ImageExportDirectory.AddressOfNameOrdinals: %#x/n",ImageExportDirectory.AddressOfNameOrdinals);

  FilePointerOfExportedDllName=(*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData+
    ImageExportDirectory.Name-
    (*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;
  SetFilePointer(hDestinationFile,FilePointerOfExportedDllName,NULL,FILE_BEGIN);
  ReadFile(hDestinationFile,ExportedDllName,MAX_PATH,
            &NumberOfBytesRead,NULL);
  printf("/n%s/n",ExportedDllName);


  //Get the corresponding file pointer
  FilePointerOfExportAddressTable=(*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData+
    ImageExportDirectory.AddressOfFunctions-(*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;
  FilePointerOfExportNamePointerTable=(*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData+
    ImageExportDirectory.AddressOfNames-(*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;
  FilePointerOfExportOrdinalTable=(*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData+
    ImageExportDirectory.AddressOfNameOrdinals-(*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;

  //Allocate memory
  hGlobalMemoryForExportAddressTable=GlobalAlloc(GPTR,ImageExportDirectory.NumberOfFunctions*4); 
  hGlobalMemoryForExportNamePointerTable=GlobalAlloc(GPTR,ImageExportDirectory.NumberOfNames*4);
  hGlobalMemoryForExportOrdinalTable=GlobalAlloc(GPTR,ImageExportDirectory.NumberOfNames*2);

  //Set file pointer and read data from file 
  SetFilePointer(hDestinationFile,FilePointerOfExportAddressTable,NULL,FILE_BEGIN);
  ReadFile(hDestinationFile,hGlobalMemoryForExportAddressTable,ImageExportDirectory.NumberOfFunctions*4,
    &NumberOfBytesRead,NULL);

  SetFilePointer(hDestinationFile,FilePointerOfExportNamePointerTable,NULL,FILE_BEGIN);
  ReadFile(hDestinationFile,hGlobalMemoryForExportNamePointerTable,ImageExportDirectory.NumberOfNames*4,
    &NumberOfBytesRead,NULL);
  SetFilePointer(hDestinationFile,FilePointerOfExportOrdinalTable,NULL,FILE_BEGIN);
  ReadFile(hDestinationFile,hGlobalMemoryForExportOrdinalTable,ImageExportDirectory.NumberOfNames*2,
    &NumberOfBytesRead,NULL);

  pExportAddressTableEntry=(DWORD*)hGlobalMemoryForExportAddressTable;
  pExportNamePointerTableEntry=(DWORD*)hGlobalMemoryForExportNamePointerTable;
  pExportOrdinalTableEntry=(WORD*)hGlobalMemoryForExportOrdinalTable;


  printf("/nOrdinal-Index--RVA----------------FunctionName/n");
  for(i=0;i<ImageExportDirectory.NumberOfFunctions;i++)
  {
    TCHAR ExportedFunctionName[MAX_PATH];
    DWORD FilePointerOfExportedFunctionName=0;
    printf("%#-7x ",*(pExportOrdinalTableEntry+i)+ImageExportDirectory.Base);
    printf("%#-6x ",*(pExportOrdinalTableEntry+i));
    printf("%#-8x ",*(pExportAddressTableEntry+i));
    printf("%#-6x ",*(pExportNamePointerTableEntry+i));
        printf("-->");
    FilePointerOfExportedFunctionName=*(pExportNamePointerTableEntry+i)-
      (*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress+
      (*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData;
    SetFilePointer(hDestinationFile,FilePointerOfExportedFunctionName,NULL,FILE_BEGIN);
    ReadFile(hDestinationFile,ExportedFunctionName,MAX_PATH,
            &NumberOfBytesRead,NULL);
    printf(" %s",ExportedFunctionName);

    printf("/n");
  }


  //Close handle to free allocated memory
  CloseHandle(hGlobalMemoryForExportAddressTable);   
    CloseHandle(hGlobalMemoryForExportNamePointerTable);
    CloseHandle(hGlobalMemoryForExportOrdinalTable);
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  //Output the information in .idata section
next:
  if((*(pImageDataDirectory+1)).VirtualAddress!=0 && (*(pImageDataDirectory+1)).Size!=0)
  {
    RvaOfImportDirectoryTable=(*(pImageDataDirectory+1)).VirtualAddress;   //Get the RVA of ImportDirectoryTable*****
    printf("/nThis file has Import Directory Table./n");
  }
  else
  {
    printf("/nThis file has no Import Directory Table./n");
    goto over;
  }

  for(i=0;i<NumberOfSections;i++) //Search the destination section
  {
    if(RvaOfImportDirectoryTable>=(pImageSectionHeader+i)->VirtualAddress)
    {
      if(  RvaOfImportDirectoryTable<=(pImageSectionHeader+i)->VirtualAddress+(pImageSectionHeader+i)->SizeOfRawData)
      {
        DestinationSectionPosition=i;
        break;
      }
    }
  }
  //Get the file pointer of Import Directory Table
  SizeOfRawData=(*(pImageSectionHeader+DestinationSectionPosition)).SizeOfRawData;
  PointerToRawData=(*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData;
  VirtualAddress=(*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;

  FilePointerToImportDirectoryTable= (*(pImageSectionHeader+DestinationSectionPosition)).PointerToRawData+
    RvaOfImportDirectoryTable-
    (*(pImageSectionHeader+DestinationSectionPosition)).VirtualAddress;  //Notice the operator's priority
  SetFilePointer(hDestinationFile,FilePointerToImportDirectoryTable,NULL,FILE_BEGIN); //Set the file pointer

  CountOfImportDirectoryEntries=0; //Initialize with zero
  hGlobalMemoryForCount=GlobalAlloc(GPTR,sizeof(IMAGE_IMPORT_DESCRIPTOR));

  do 
  {
    ReadFile(hDestinationFile,hGlobalMemoryForCount,sizeof(IMAGE_IMPORT_DESCRIPTOR),&NumberOfBytesRead,NULL);
    if(*((DWORD*)hGlobalMemoryForCount)==0 && *((DWORD*)hGlobalMemoryForCount+1)==0) //Why ?Unhandled Exception
    {
      break;
    }
    else
      CountOfImportDirectoryEntries++;
  } while (1);

  if(CountOfImportDirectoryEntries==0) 
  {
    printf("/nThe count of Import Directory Entries is 0/n");//Output error information
    return;
  }
  else
  {
    printf("/nCount of ImportDirectoryEntries is:%d/n",CountOfImportDirectoryEntries);
  }

  hGlobalMemoryForImportDirectoryTable2=GlobalAlloc(GPTR,sizeof(IMAGE_IMPORT_DESCRIPTOR)*
                                                    CountOfImportDirectoryEntries);

  pImageImportDescriptor=(PIMAGE_IMPORT_DESCRIPTOR)hGlobalMemoryForImportDirectoryTable2;
  SetFilePointer(hDestinationFile,FilePointerToImportDirectoryTable,NULL,FILE_BEGIN); //Set the file pointer
  /*Notice : To set the file pointer before calling ReadFile() is very important.*/

  ReadFile(hDestinationFile,hGlobalMemoryForImportDirectoryTable2,
    sizeof(IMAGE_IMPORT_DESCRIPTOR)*CountOfImportDirectoryEntries,
    &NumberOfBytesRead,NULL);  //Get ImportDirectoryTable
  if(NumberOfBytesRead==sizeof(IMAGE_IMPORT_DESCRIPTOR)*CountOfImportDirectoryEntries)
  {
    printf("Get Import Directory Table successfully!/n/n");
  }
  else
  {
    printf("/nCan't get Import Directory Table./n");
    return;
  }
  for(i=0;i<CountOfImportDirectoryEntries;i++)
  {
    DWORD FilePointerOfImportedDllName=0;
    DWORD FilePointerOfImportLookupTable=0;
    WORD temp=0;
    DWORD CountOfImportLookupTableEntries=0;
    DWORD *PointerToImportLookupTableEntry=NULL; //pointer to Import Lookup Table entry
    HANDLE hGlobalMemoryForImportLookupTable=NULL;
    //Output Import Directory Table entries
    printf("IMAGE_IMPORT_DESCRIPTOR.Characteristics: %#x(union)/n",(*(pImageImportDescriptor+i)).Characteristics);
      printf("IMAGE_IMPORT_DESCRIPTOR.OriginalFirstThunk: %#x(union)/n",(*(pImageImportDescriptor+i)).OriginalFirstThunk);
    printf("IMAGE_IMPORT_DESCRIPTOR.TimeDateStamp: %#x/n",(*(pImageImportDescriptor+i)).TimeDateStamp);
    printf("IMAGE_IMPORT_DESCRIPTOR.ForwarderChain: %#x/n",(*(pImageImportDescriptor+i)).ForwarderChain);
    printf("IMAGE_IMPORT_DESCRIPTOR.Name: %#x/n",(*(pImageImportDescriptor+i)).Name);
    printf("IMAGE_IMPORT_DESCRIPTOR.FirstThunk: %#x/n",(*(pImageImportDescriptor+i)).FirstThunk);

    FilePointerOfImportedDllName=(*(pImageImportDescriptor+i)).Name-VirtualAddress+PointerToRawData; 
    SetFilePointer(hDestinationFile,FilePointerOfImportedDllName,NULL,FILE_BEGIN);
    RtlZeroMemory(ImportedDllName,MAX_PATH);
    ReadFile(hDestinationFile,ImportedDllName,MAX_PATH,&NumberOfBytesRead,NULL); 
    printf("/n%s/n",ImportedDllName); //output dll name

    FilePointerOfImportLookupTable=(*(pImageImportDescriptor+i)).Characteristics-VirtualAddress+PointerToRawData;//file pointer
    SetFilePointer(hDestinationFile,FilePointerOfImportLookupTable,NULL,FILE_BEGIN); //Set file pointer
    do 
    {
      ReadFile(hDestinationFile,&temp,4,&NumberOfBytesRead,NULL); 
      if(temp==0)
      {
        break;
      }
      else
        CountOfImportLookupTableEntries++;
    } while (1);
    if(CountOfImportLookupTableEntries==0)
    {
      printf("Error.Count of ImportLookupTableEntries is 0./n");
      return;
    }
    SetFilePointer(hDestinationFile,FilePointerOfImportLookupTable,NULL,FILE_BEGIN); //Set file pointer
    hGlobalMemoryForImportLookupTable=GlobalAlloc(GPTR,CountOfImportLookupTableEntries*4);
    ReadFile(hDestinationFile,hGlobalMemoryForImportLookupTable,CountOfImportLookupTableEntries*4,
          &NumberOfBytesRead,NULL); 
    if(NumberOfBytesRead!=CountOfImportLookupTableEntries*4)
    {
      printf("/nError.Can't get ImportLookupTable./n");
      return;
    }
    PointerToImportLookupTableEntry=(DWORD*)hGlobalMemoryForImportLookupTable;
    printf("/nInformation in ImportLookupTable./n/n");
    printf("Rva||Ordinal--Hint----ImportedFunctionName/n");
    for(j=0;j<CountOfImportLookupTableEntries;j++)
    {
      DWORD Bitwise=0;
      WORD Hint=0;
      DWORD FilePoinerOfNameTable=0;
      TCHAR ImportedFunctionName[MAX_PATH];
      printf("%-4d %#-8x ",j,*(PointerToImportLookupTableEntry+j));
      Bitwise=*(PointerToImportLookupTableEntry+j);
      Bitwise=Bitwise & 0x80000000;
      if(Bitwise!=0)
      {
      }
      else
      {
      }
      FilePoinerOfNameTable=*(PointerToImportLookupTableEntry+j)-VirtualAddress+PointerToRawData;
      SetFilePointer(hDestinationFile,FilePoinerOfNameTable,NULL,FILE_BEGIN); //Set file pointer
            ReadFile(hDestinationFile,&Hint,sizeof(WORD),
          &NumberOfBytesRead,NULL);
      printf("%#-8x ",Hint);
      ReadFile(hDestinationFile,ImportedFunctionName,MAX_PATH,
          &NumberOfBytesRead,NULL);
      printf("%s/n",ImportedFunctionName);

    }

      
    printf("-------------------------------------------------------/n");
  }


  //Free the memory allocated
over:
  GlobalFree(hGlobalMemoryForImportDirectoryTable2);
  GlobalFree(hGlobalMemoryForImportDirectoryTable);
  GlobalFree(hGlobalAllocatedMemory);
  GlobalFree(hGlobalAllocatedMemoryOfDataDirectory);
  CloseHandle(hDestinationFile);
}

PE文件查看器(PEInfo)v1.0.0.1绿色免费版 PE文件查看器(PEInfo)是一款Windows可执行文件信息查看软件,可查看.exe .dll .sys .ocx等PE格式的程序内部信息。 立即下载

相关推荐

PE查看器 PEinfo

用来查看PE文件详细信息的小工具,PE_info

工具篇 PEinfo第一讲

1,编程思路:文件格式检查-〉

刘明智的专栏 1083

VS2010写的PEinfo(PE文件查看器)源码.rar

学习了某论坛的解密系列教程,使用Visual Studio 2010写的PEinfo(PE文件信息查看器),实现了启动软件的‘闪屏’功能,就是打开软件时先出一个图片,图片消失后再出程序界面,附全套源码,欢迎一起学习和研究。

概述 - 基础篇01|解密系列

概述 - 基础篇01 让编程改变世界 Change the world by program 软件安全是信息安全领域的重要内容,本系列视频教程将涉及到软件相关的加密、解密、逆向分析、漏洞分析、安全编程以及病毒分析防范等。 目前,鉴于国内高校对安全教育重视程度不够,许多知识还是空白。 随着互联网病毒查杀、网游安全、网络安全、个人信息安全等方面人才缺口很大,相关职位待遇高…...

weixin_33755649的博客 175

PE文件查看器PE_Info中文版.rar

软件介绍: PE_Info是一款用于查看PE文件详细信息的软件。查看前需要先载入PE文件。可以查看区块(表)以及数据目录表。可查看运行平台及区块数目、创建时间及日期、程序执行入口及DOS、PE头 区块表。内存中区块对齐值、文件中的区块对齐值、文件子系统、映像校验及DLL特征。

PEInfo 源码

获取PE文件的PE信息

WINDOWS+PE权威指南读书笔记(19)

目录 三个小工具的编写 构造基本窗口程序: 构造窗口界面: 编写相关的资源文件: 通用程序框架的实现: PEDump 的实现: 编程思路: PEDump 代码中的数据结构: PEDump 编码: 运行PEDump: PEComp 的实现: 编程思路: 定义资源文件: PEComp 编码: 运行 PEComp: PElnfo 的实现: PElnfo 编码: 运行 PElnfo: 小结: 三个小工具的编写 这三个小工具分别是: 口 PEDump: PE 文件字节码

沐一 · 林 的博客 1117

PEInfo源码

PEInfo源码,小甲鱼课程的,我重新编写了一些导入表和导出表,功能增加了不少。

PE结构->【输入表】Import【上】

使用工具:PEinfo.exe, hello.exe,UE输入函数 在代码分析或编程中经常遇到“输入函数(Import Functions,也称导入函数)”的概念。 这里我们就来解释下,输入函数就是被程序调用但其执行代码又不在程序中的函数,这些函数的代码位于相关的DLL 文件中,在调用者程序中只保留相关的函数信息(如函数名、DLL 文件名等)就可以。 以上是咱这次实验的小青蛙哈~灰常简单

u011513939的博客 408

FPGA领域四大顶级会议全景解读:从架构到应用的技术风向标

本文全景解读FPGA领域四大顶级会议(FPGA、FCCM、FPL、FPT),剖析其各自定位与技术风向。FPGA会议聚焦架构与工具创新,FCCM专攻硬件加速与定制计算,FPL覆盖从理论到应用的广泛领域,FPT则重点关注亚太市场与前沿应用。跟踪这些会议是把握FPGA技术演进、寻找创新灵感和应用方案的高效途径。

weixin_29274969的博客 336

[小技巧] 如何复制知乎电子书中的文字和图片

文章目录一、背景二、复制文字1.最简单的方法(适合短小文字)2. 进阶方法(适合大段文字)三、复制图片四、注意事项 一、背景 有时候希望从书中摘录一部分文字作为笔记,但是知乎电子书阅读时候是禁止copy的,要么手打,要么OCR,给学习带来了一些不便。 审查元素后发现,知乎电子书是把文字分成一段一段的,试图F12直接copy不太方便。 本问将以谷歌Chrome浏览器为例,给出复制小技巧。 二、复制文字 1.最简单的方法(适合短小文字) 选中你需要的文字,左键单击不放,直接拖到地址栏。 然后可以从地址栏中

江南蜡笔小新 9251

【转载】PE_Info 之DIY

from:http://blog.youkuaiyun.com/iiprogram/article/details/4792390 自己写的PE 信息查看工具(C代码),不甚完美,希望可以帮助初学PE 的读者从编程的角度认识PE文件,Good Luck!       下面是源代码:/*//////////////////////////////////////////////////////////////...

weixin_34101229的博客 109

将赛灵思 SDK 工程移植到 Vitis 的分步指南

注:本文转自赛灵思中文社区论坛,源文链接在此。本文原作者为XILINX工程师。 以下为个人译文,仅供参考,如有疏漏之处,还请不吝赐教。 您是赛灵思软件开发套件 (SDK) 用户吗? 您是否正在计划将自己的工程移植到 Vitis 软件平台? 那么本篇工程移植分步指南将能祝您一臂之力。 从 2019.2 版开始,赛灵思 SDK 开发环境已统一整合到全功能一体化的 Vitis™ 统一软件平台中。 尊敬的 SDK 用户,您只需轻点几下鼠标即可体验这一功能丰富的工具! 马上开始将工程从赛灵思 S

weixin_45825101的博客 1733

redis的INFO命令使用详解

Redis 版本至 1.0.0 起可用。 info 指令提供可供人类阅读的关于Redis Server相关的信息和统计。同时提供一些可选参数来过滤选择你想要了解的信息。 Info 1、 一般形式: INFO [section] 2、可选参数(section部分): server: General information about the Redis server clients: Cli...

我弟是个程序员 3567

不用写触发器!帆软填报报表自动记录创建/修改时间的终极方案

本文详细介绍了帆软填报报表中无需编写数据库触发器,即可自动记录数据创建时间和修改时间的终极方案。该方案利用帆软内置函数和单元格条件属性,在应用层实现日期自动生成,有效规避了触发器带来的权限、维护和部署难题,为数据填报提供了更轻量、灵活且易于维护的解决方案。

weixin_28040125的博客 368

TC3XX - MCAL知识点(四十二):AURIX™ TC3xx实现多相电机需要多核配合使用的场景与实操分析

本文探讨了多相电机控制系统中的关键技术问题,重点分析了多核处理器在电机控制中的应用。针对十二相电机等复杂应用场景,提出了同步采样、多核协同等解决方案。文章详细阐述了相电流同步采样原理及EBTresos配置方法,分析了ADC硬件触发机制和多核配合策略。通过Core0和Core1的协同工作设计,解决了位置信息采集与FOC算法执行的时序问题,并提供了代码实现示例。实验验证了采用ATOM0_7同时触发两个核ADC中断的可行性,为多相电机控制系统的实现提供了技术参考。

梦想技术家 501

Redis INFO命令详解

INFO命令会返回Redis服务器的状态信息和统计数据,计算机可以很简单地解析这些返回数据,用户也可以轻松地阅读这些返回数据。 可以通过以下的可选参数,选择查看特定分段的服务器信息: server:Redis服务器相关的通用信息 clients:客户端连接的相关信息 memory:内存消耗的相关信息 persistence:RDB(Redis DataBase)和AOF(Append-O...

zc520yzy的博客 2279

OP-TEE虚拟化支持详解

OP-TEE虚拟化支持解析 OP-TEE提供实验性虚拟化方案,支持多虚拟机共享安全执行环境。核心特性包括: 配置选项:CFG_VIRTUALIZATION启用虚拟化,CFG_VIRT_GUEST_COUNT限制虚拟机数量并分配均等内存资源; Hypervisor协作:需实现虚拟机生命周期通知、SMC参数转换、内存固定等关键协议; 当前限制:仅支持Armv8架构,硬件资源共享有限,采用静态内存配额机制; 架构实现:通过MMU分区切换和扩展内存分配器实现多租户隔离,Nexus核心层管理虚拟机上下文。该方案适用于

Linux内核架构师 109

【Redis】做Redis监控必须要了解的INFO命令

文章目录一、初识INFO1.1.INFO命令简介1.2.INFO返回信息二、返回信息详解2.1.Server部分2.2.clients部分2.3.memory部分2.4.persistence部分2.5.stats部分2.6.replication部分2.7.cpu部分2.8.commandstats部分2.9.cluster部分2.10.keyspace部分 一、初识INFO 1.1.INFO命令简介 ​ 根据官网,可总结为一句话:INFO命令以一种易于理解和阅读的格式,返回关于Redis服务器的各种信

浩瀚宇宙的一粒尘埃 1659

滑模观测器与锁相环结合应用:让电机“无感”也能精准旋转的奥秘

本文介绍了永磁同步电机无传感器控制中的滑模观测器(SMO)结合锁相环(PLL)技术。SMO通过创建虚拟电机模型,利用电流误差产生控制信号来估计反电动势;PLL则从反电动势中解码转子位置和速度信息。该组合方案兼具SMO的鲁棒性和PLL的高精度,计算量小且硬件要求低。文章详细阐述了原理、数学模型、参数整定方法及实际实现技巧,包括离散化处理、符号函数替代等优化手段,并分析了低速性能限制、抖振问题等常见挑战及解决方案。最后指出该技术未来将与人工智能、多观测器融合等方向结合发展。

汽车软件开发 196

Buck电源设计常见的一些问题(四)MOS管振荡抑制方法(二)

另一方面,开关振铃为远超开关频率的高频振铃,并伴随很高的 dV/dt,会带来传导和辐射的 EMI 问题,可能会使得终端产品不能通过 EMI 标准测试,更严重时甚至会干扰开关电源自身的信号电路或临近的其他功能电路的正常工作。选用二极管反向特性好的器件;该电路可等效成图 3 中 LC 谐振电路,新的 LR和 CR为 Lp1、Lp5,Lp3, Lp4, CD等所有参与振铃的寄生感容的复合值。通常 Snubber 的 Csnub取值在数 nF 以上,在振铃频率 fR(加了 snubber 后)下的阻抗很小。

小幽余生不加糖 2894

Redis INFO 说明

背景 前面几篇文章介绍完了 Redis相关的一些说明,现在看看如何查看Redis的一些性能指标和统计信息,也可以看官网说明,本文基于Redis 5.0.5。 INFO[section] INFO命令返回有关服务器的信息和统计信息,带上参数ALL可以返回所有部分,默认default,仅返回默认部分集如果未提供任何参数,则采用默认选项。 > INFO ALL 或 > INFO...

Z875983491的专栏 209

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Redis之info指令

场景 redis提供了info指令,可以帮助用户查询redis服务运行期间内部的参数以及实时信息,根据这些信息可以帮助用户诊断问题或查看服务负载、内存压力等维度方面的信息。 info指令显示的信息繁多,分为9大块,每块都有非常多的参数,9大块如下: Server:服务器运行的环境参数。 Clients:客户端相关信息。 Memory:服务器运行内存统计数据。 Persistence:持久化信息。 Stats:通用统计数据。 Replication:主从复制相关信息。 CPU:CPU使用情况

cainiao1412的博客 1618

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

20210609 redis中info命令使用

info命令使用总结 一,info Server 包含了Redis服务本身的一些信息,例如版本号、运行模式、操作系统的版本、TCP端口等。

陈如水的专栏 3022

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

上一篇: cyclotron's Win32 PE Library
下一篇: Make your owner PE Protector
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值