Results 1 to 4 of 4
  1. #1
    VXP's Avatar
    Join Date
    Apr 2012
    Gender
    male
    Posts
    17
    Reputation
    18
    Thanks
    13
    My Mood
    Drunk

    Question (C++) Prototype class from foreign DLL

    My specific help request is this:

    I have a certain DLL file which I've loaded with LoadLibrary, and it works fine.

    I can call a function CalcLpqCheckSum just fine, parameters are CalcLpqCheckSum(void*, int)

    However, other functions all appear to be classes:

    [IMG]kingofkings4.000webhostapp.com/ida_mpgh_q.png[/IMG]

    I can reference them just fine in my code but when I call the function my application freezes and crashes.
    Depending on what I do, I get various 32bit return values.

    [IMG]kingofkings4.000webhostapp.com/ida_mpgh_q2.png[/IMG]

    How do I properly create a prototype of a class from a foreign DLL in my program?

    Also, can anyone tell me what is going on in the first picture? I lack the understanding of how these functions are designed and how to prototype them.

    Even if I prototype directly from a function address I still can't call the LpqSystem function with or without parameters. It crashes regardless.

  2. #2
    ElonTusk's Avatar
    Join Date
    Feb 2020
    Gender
    female
    Posts
    36
    Reputation
    10
    Thanks
    6
    Quote Originally Posted by VXP View Post
    My specific help request is this:

    I have a certain DLL file which I've loaded with LoadLibrary, and it works fine.

    I can call a function CalcLpqCheckSum just fine, parameters are CalcLpqCheckSum(void*, int)

    However, other functions all appear to be classes:

    [IMG]kingofkings4.000webhostapp.com/ida_mpgh_q.png[/IMG]

    I can reference them just fine in my code but when I call the function my application freezes and crashes.
    Depending on what I do, I get various 32bit return values.

    [IMG]kingofkings4.000webhostapp.com/ida_mpgh_q2.png[/IMG]

    How do I properly create a prototype of a class from a foreign DLL in my program?

    Also, can anyone tell me what is going on in the first picture? I lack the understanding of how these functions are designed and how to prototype them.

    Even if I prototype directly from a function address I still can't call the LpqSystem function with or without parameters. It crashes regardless.

    I am a bit confused as to what you're doing. If I understand your post correctly, you have some DLL file, and you are unpacking that file using some library called "LoadLibrary", and then you would like to construct the protoype for a specific class? What exactly are you trying to do? Maybe explain the bigger picture, so that way it will easier for others to chime in and help.

  3. #3
    Azuki's Avatar
    Join Date
    Mar 2015
    Gender
    female
    Location
    京都市
    Posts
    1,109
    Reputation
    195
    Thanks
    19,096
    My Mood
    Angelic
    Quote Originally Posted by VXP View Post
    -snip-
    If you say the parameters are a void pointer and an int, why do you call it like LpqSystem(void*)?
    The void* is also certain the this pointer, so the current object.

    Attach the debugger to CalcLpqCheckSum and check out what variables are passed to LpqSystem, if the void* parameter is the pointer to the current object then that's great and you don't have to call the function with that parameter.

    BTC: 1LLm4gaPYCZsczmi8n1ia1GsEMsDRs2ayy
    ETH: 0x7d8045F6e452045439c831D09BAB19Bf9D5263EE



  4. #4
    VXP's Avatar
    Join Date
    Apr 2012
    Gender
    male
    Posts
    17
    Reputation
    18
    Thanks
    13
    My Mood
    Drunk
    Quote Originally Posted by Azuki View Post
    Attach the debugger to CalcLpqCheckSum and check out what variables are passed to LpqSystem, if the void* parameter is the pointer to the current object then that's great and you don't have to call the function with that parameter.
    So if I called LpqSystem(this*); it should work?
    Sorry for asking I just don't have the time at the moment to mess around, I'll come back to this.
    Check out my official King of Kings III reverse engineering project thread!

    https://www.mpgh.net/forum/showthread.php?t=1367141

Similar Threads

  1. [B]is there a new update from wh.dll[/B]
    By SacredGold in forum CrossFire Discussions
    Replies: 14
    Last Post: 03-21-2010, 01:39 PM
  2. [Help] New Update from WH.dll pls the LINK!!
    By SacredGold in forum CrossFire Hacks & Cheats
    Replies: 19
    Last Post: 02-26-2010, 11:17 AM
  3. [Help] Dealing with pointers from a dll
    By ctpsolo in forum C++/C Programming
    Replies: 11
    Last Post: 01-26-2010, 11:19 PM
  4. Help with hooking from a dll
    By Anddos in forum C++/C Programming
    Replies: 5
    Last Post: 12-21-2009, 08:11 AM
  5. Extracting classes from dynamically loaded libraries.
    By radnomguywfq3 in forum C++/C Programming
    Replies: 3
    Last Post: 03-22-2009, 12:36 AM

Tags for this Thread