ufrisk / MemProcFS

MemProcFS
GNU Affero General Public License v3.0
2.81k stars 352 forks source link

VMMDLL_VfsReadW X86 #239

Closed zijingsh closed 7 months ago

zijingsh commented 7 months ago

Hello ufrisk VMMDLL_VfsReadW in x86 Calling the subroutine crashes example: const size_t cbSize = 1024 1024 1024; // выделение 1 МБ const size_t buffer_size = cbSize; BYTE* bytes = new BYTE[buffer_size]; DWORD j = 0; auto nt = VMMDLL_VfsReadW(vmm_handle, (LPWSTR)L"\misc\procinfo\dtb.txt", bytes, buffer_size - 1, &j, 0);

ufrisk commented 7 months ago

Hi, your buffer, bytes, must not be NULL. It's specified as _In_ (and not _In_opt_) in the header file which means it must not be NULL when calling this function.

I suspect the memory allocation in your code will fail in your code since it's not really possible to allocate 1GB of memory on 32-bit x86 and that you then pass NULL to VMMDLL_VfsReadW which would violate the API contract.

zijingsh commented 7 months ago

I'll take a hard look at my code

ufrisk commented 7 months ago

Awesome, I think you try to allocate 1MB (from the comment) but you try to allocate 1GB instead.

Anyway, I'll be closing this issue since the issue most likely is resolved.

Best wishes with your DMA project and please let me know should you run into any more issues.