问题描述
在我看来,它将始终为4GB,因为它使用相同大小的数据类型(A DWORD)? SizeOfImage
的DWORD不是总是32位吗?还是我对此限制有误?
It seems to me it's always going to be 4GB, because it uses the same size datatype (A DWORD)? Isn't a DWORD for the SizeOfImage
always going to be 32-bits? Or am I mistaken about this limitation?
4GB确实确实是所有便携式可执行文件(32位和64位PE +)。
4GB does indeed to seem to be the hard limit of ALL Portable Executable's (32-bit and 64-bit PE+).
推荐答案
根据对于PE32 +,它是32位无符号值
According to the spec it is 32-bit unsigned value for a PE32+ image just like a PE32 image.
但是,在我对Windows 7 SP1 Home Premium x64上的32位和64位应用程序(PE32 / PE32 +文件)进行测试时,这两个文件的最大文件大小都在 1.8-1.85GB 之间。
However, in my testing with both 32-bit and 64-bit applications (PE32/PE32+ files) on Windows 7 SP1 Home Premium x64, the maximum file size for either is between 1.8-1.85GB.
我通过用Visual Studio创建一个非常基本的C可执行文件(32位为〜8K,64位为9K)进行了测试,并向PE标头,直到Windows不再加载它,然后二进制搜索限制。查看vmmap的过程后发现,几乎整个前2GB的地址空间几乎都是映像(包括任何随后加载的DLL,例如kernel32.dll)。我的32位和64位进程的限制是相同的。 64位进程确实在NT标头的文件标头部分中设置了标记,表明它可以处理大于2GB的地址。它还可以为2GB以上的非图像部分分配内存。
I tested by creating a very basic C executable with Visual Studio (~8K for 32-bit and 9K for 64-bit) and the added an empty code section to the PE header until Windows would no longer load it, and then binary searched for the limit. Looking at the process with vmmap showed that almost all of the entire first 2GB of address space were the image (including any subsequently loaded DLLs such as kernel32.dll). The limit was the same for me with both 32 and 64-bit processes. The 64-bit process did have the flag set in it's NT Header's File Header's section stating that it could handle addresses >2GB. It also could allocate memory for non-image sections above the 2GB limit.
该进程的图像必须在较低的2GB VA空间中完全容纳,这意味着SizeOfImage正在被处理为签名的32位整数由加载程序有效地执行。
It seems like the image is required to fit in it's entirety in the lower 2GB of VA space for the process, which means the SizeOfImage is being treated a signed 32-bit integer by the loader effectively.
这篇关于在64位Windows上,PE文件的最大大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!