Hi @Varun Dixit ,
Thank you for your question. Your understanding is correct: embedding a large binary as RCDATA in .rsrc increases the executable’s SizeOfImage, even if you access it “on demand.”
According to the PE/COFF specification, SizeOfImage represents the total virtual address range reserved when the PE is mapped (https://learn.microsoft.com/en-us/windows/win32/debug/pe-format). Any data in .rsrc contributes to this, regardless of whether it’s touched at runtime.
The Win32 resource APIs (FindResource, LoadResource, LockResource) operate on data already mapped by the loader (https://learn.microsoft.com/en-us/windows/win32/menurc/finding-and-loading-resources). “Loaded on demand” refers only to physical memory paging, which means pages are faulted in when accessed, but the virtual address space is reserved at load time.
Overall, embedding resources always increases SizeOfImage. If your goal is a single EXE without inflating the mapped image, you’d need to append the payload after the PE image and read it manually at runtime.