-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled Exception during Compile/Test under VS2019 / Win10 #2
Comments
When the You'll need a separate breakpoint at the |
Got it - thanks - Here's what I've found (so far): Following your recommendation (thanks for the hint - I should have taken a break to get a fresh perspective).
Console displays:
When I disassemble the allocated page at
Which explains the faulting address location in the above (Access Violation).
I see something odd - The source address of I noticed that I have the build mode in "Debug" - and changed it to "Release". Resolution: Build/run in x86/RELEASE mode only. Thanks for the hints! |
I'm trying to generate/use the Subclassing thunk and although I have been able to compile each of them using VS2019 / x86 - I'm running into a problem during the Test step of main().
If I step through the code, everything appears to function correctly UP TO the CallWindowProc test which throws the following "Unhandled exception"
Exception thrown at 0x00CA0944 in thunks.exe: 0xC0000005: Access violation writing location 0x00000000.
The output window shows:
The only change I could find that seemed most appropriate was to include
MEM_COMMIT
on the VirtualAlloc function:void *hThunk = VirtualAlloc(0, 0x10000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
I've stared at it for hours trying to follow the logic (including the assembly of SubclassingFunc). Since the faulting address appears to be inside of the SubclassingThunk Code which has been copied to the dynamically-allocated page, Moreover, the fault appears to be outside of the range of the THUNK_SIZE that's been copied into that allocated space. So that seems odd to me and having walked through the listing, nothing is jumping out at me. Because I'm unclear about the best means of debugging this any further, I thought I'd ask here. Any guidance would be welcome.
Attached is the compiler listing for the file including assembler output. If I can provide or try anything else, I'll be happy to provide.
thunks.zip
Thanks!
The text was updated successfully, but these errors were encountered: