What is the minimum PE (exe) file size on Windows? And the minimum memory allocation?

What is the minimum PE (exe) file size on Windows? And the minimum memory allocation?

I have compiled (using MASM (ml.exe) and link.exe that come with VS 10) the following code: I cannot help but leave kernel32.lib and ExitProcess, if I do this, the program will fail.

; Assmebly options
.386
.MODEL FLAT, STDCALL
option casemap:none

; Include Libs
includelib kernel32.lib

; Imported symbols
ExitProcess PROTO :Dword
Sleep PROTO :Dword

; Code
.CODE

start:
    invoke Sleep, 10000
    invoke ExitProcess, 0
END start

The Sleep command is enabled only to read memory before the program ends.

Now I am measuring the following: the .exe file is 2.5 KB in size (if I include user32.lib and MessageBoxA, does it become 3 KB → blocks?), And the application uses 136 KB of RAM when it is (Vista 32bit).

Isn't that so much memory for such a simple program? Why is the exe file so large and the RAM requirements are much larger than the exe file?

? ? , 0,5 , 0,5 , ?

( http://msdn.microsoft.com/en-us/magazine/cc301805.aspx, )?

( )

+3
3

ntdll.dll . . LdrpInitializeProcess; :

  • .
  • .
  • . .

, DLL , (, kernel32.dll, user32.dll), , DllMain -.

EDIT: , :

Minimal program

( Win32) ntdll.dll: NtDelayExecution NtTerminateProcess. , , , - 100 . 2,5 , .

+6

, , " 136 " , . , , .. Windows , RAM, .

+1

Source: https://habr.com/ru/post/1777564/


All Articles