Giter VIP home page Giter VIP logo

modernsubclassingthunk's Introduction

modernsubclassingthunk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modernsubclassingthunk's Issues

Random crashes with thunk.

Hey there, you pointed me to this from StackOverflow.

I managed to get this kind of working, but the VB6 IDE randomly crashes for me. Often on the third run, but not always. It often follows this pattern, but it also depends on whether there are debug statements and if I initiate vb6 from Visual Studio or not. But in all cases, it eventually crashes.

  1. I run my program, close it (properly).
  2. I run my program, close it (properly).
  3. I run my program and get a crash while loading

I don't quite understand the underlying thing that makes this work so it's tough for me to debug. I'm only using the Subclassing thunk in my main form. It seems more stable if I put a debug statement on the Set SubClass = nothing that I have on program close, but it still crashes eventually.

How might I diagnose this?

64-bit VBA7 support

I know this is for VB6 not VBA. I'm just wondering if it's likely to be at all possible to get this working for 64 bit VBA. At the assembly level I think there start to be some key differences so I think the thunk code might have to change.

I'm not actually trying to subclass but I am trying to get some code working that uses WinAPI timers to call VBA methods and this approach you outline I'm pretty sure could allow the debugger to work cleanly in those (right now if I have an End statement in the callback method then that crashes the VBA host)

Shot in the dark asking! But I'm sure you know enough of the internals to figure it out ;)

Unhandled Exception during Compile/Test under VS2019 / Win10

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:

hWnd=00A256CC
hThunk=00CA0000
THUNK_SIZE=250

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.