ufrisk / LeechCore

LeechCore - Physical Memory Acquisition Library & The LeechAgent Remote Memory Acquisition Agent
GNU General Public License v3.0
517 stars 92 forks source link

Access Violation on program ending #15

Closed N0x61r0x6Bo0x6E closed 4 years ago

N0x61r0x6Bo0x6E commented 4 years ago

Hey,

I'm getting access violation while main method ending execution. It's because probably unloading is not properly executed:

VOID DeviceFPGA_Close()
{
    PDEVICE_CONTEXT_FPGA ctx = (PDEVICE_CONTEXT_FPGA)ctxDeviceMain->hDevice;
    if(!ctx) { return; }
    if(ctx->dev.hFTDI) { ctx->dev.pfnFT_Close(ctx->dev.hFTDI); }
    if(ctx->dev.hModule) { FreeLibrary(ctx->dev.hModule); } <------ HERE IS ACCESS VIOLATION
    LocalFree(ctx->rxbuf.pb);
    LocalFree(ctx->txbuf.pb);
    LocalFree(ctx);
    ctxDeviceMain->hDevice = 0;
}

What can be wrong?

The flow looks like:

int main() {
    memory_manager * mm = new memory_manager("process-name.exe"); <-- here is the VMMDLL_Initialize

return 0; <--- after this, above access violation exception being thrown 
}
ufrisk commented 4 years ago

Thanks, that should not happen. I'll look into it. But with a bit of luck I'll do a major rewrite of these parts so hopefully it will go away. I hope it's not bothering you too much as-is right now since there may still be some time away before I'll be able to fix it.

ufrisk commented 4 years ago

does my new release just released resolve this issue?

N0x61r0x6Bo0x6E commented 4 years ago

Hey, I will check soon :) Thx

N0x61r0x6Bo0x6E commented 4 years ago

Problem solved :-) @ufrisk

ufrisk commented 4 years ago

Thanks for reporting this issue. I wish you good luck with your future DMA related ventures. Please let me know if you should stumble upon something in the future again.


Also, if you find PCILeech / MemProcFS useful please consider sponsoring the project here on Github. I see people purchasing hardware for hundreds of dollars (of which I receive absolutely zero dollars for - since I'm not related to hardware sales) just to be able to run my free open source software. Sponsorships go for as little as $2 and Github is matching it - a $2 sponsorship for you is a $4 sponsorship for me. Thank You :sparkling_heart: