欢迎来到 嗅灵易学

零基础也能上手的脚本技术课,一对一答疑带你入门

答复

答复

不同的操作系统是有点不一样的,可能是2000的系统判断没那么严格
看看windows源码里面的imagechk.c就知道大概是怎么回事了
比如
  NumberOfSubsections = NtHeader->FileHeader.NumberOfSections;
  PreferredImageBase = NtHeader->OptionalHeader.ImageBase;
  
  //
  // At this point the object table is read in (if it was not
  // already read in) and may displace the image header.
  //
  
  OffsetToSectionTable = sizeof(ULONG) + sizeof(IMAGE_FILE_HEADER) + NtHeader->FileHeader.SizeOfOptionalHeader;
  SectionTableEntry = (PIMAGE_SECTION_HEADER)((PCHAR)NtHeader + OffsetToSectionTable);
  
  if (ImageAlignment < PageSize)
  {
    // The image header is no longer valid, TempPte is
    // used to indicate that this image alignment is
    // less than a PageSize.
    
    //
    // Loop through all sections and make sure there is no
    // unitialized data.
    //
    
    while (NumberOfSubsections > 0)
    {
      if (SectionTableEntry->Misc.VirtualSize == 0)
      {
        SectionVirtualSize = SectionTableEntry->SizeOfRawData;
      }
      else
      {
        SectionVirtualSize = SectionTableEntry->Misc.VirtualSize;
      }
      
      //
      // If the pointer to raw data is zero and the virtual size
      // is zero, OR, the section goes past the end of file, OR
      // the virtual size does not match the size of raw data, then
      // return an error.
      //
      
      if (((SectionTableEntry->PointerToRawData != SectionTableEntry->VirtualAddress))
        ||
        ((SectionTableEntry->SizeOfRawData + SectionTableEntry->PointerToRawData) > 
        FileInfo.nFileSizeLow)
        ||
        (SectionVirtualSize > SectionTableEntry->SizeOfRawData))
      {
        printf("invalid BSS/Trailingzero section/file size\n");
        
        ImageOk = FALSE;
        goto NeImage;
      }
      SectionTableEntry += 1;
      NumberOfSubsections -= 1;
    }
    goto PeReturnSuccess;
  }
其实没什么秘密

注意:上传附件及图片大小不得大于30M。

⚠️ 版权声明:
本博客所有内容(含教程、源码、工具)仅供个人技术学习与研究交流使用,严禁商用、倒卖、二次分发及非法用途
未经作者书面授权,任何组织或个人不得转载、复制或用于其他平台,违者将追究相关责任。

0 0 0 举报
复制成功