Results 1 to 4 of 4
  1. #1
    Grooguz
    Grooguz is offline
    BanHammer Holder
    Grooguz's Avatar
    Join Date
    2010 May
    Posts
    678
    Thanks Thanks Given 
    152
    Thanks Thanks Received 
    537
    Thanked in
    167 Posts
    Rep Power
    14

    Perfect World D3D AutoPot Ingame Menu

    this is a little tool I've been working on lately. I have always been interested in adding an actual ingame menu for my tools, as a well integrated tool makes for much easier usage and a better overall 'feel' to using it.

    The easiest way to manage this (as far as I know) is by injecting a dll into the elementclient process. You can do this on startup, or while a process is running. I picked the 'Inject the dll on startup' method as described in detail on here. On that page you can also download an easy to use example for injection, which I used pretty much verbatim in my own injector. No need to reinvent the weel

    Having created the injector, we now need a dll to inject. The injector will call a function 'Initialize()' from this dll, wait for it to return, and then exit. So in the dll we will have a function Initialize() spawn a new thread, so it can return as soon as possible, which will contain our main loop. Before initializing everything the thread waits for the main window to be created; it does this by checking for the hWnd in memory. You need the hWnd of the window for any win32 API calls you wish to make.

    A game using Direct3D for its graphics will render all the objects between calls to BeginScene and EndScene. So if you want to render your own objects you hook the function call to endscene and add your own objects just before it is called. This way your own objects will be rendered in every frame (and on top for the menus). Luckily there are a lot of guides on how to hook the EndFrame function for the different versions of D3D. PWI uses D3D8 so you just google for a method to hook that if you aren't interested in learning how it works precisely (which I wasn't). As I will be posting the source code for this little tool, you can simply look in there.

    Having done that we can simply create some wrapper classes to create the different controls necessary for a basic window (like buttons, labels, checkboxes, etc.). So.... now we can draw a menu, but we still have to somehow detect when a user clicks on a button for example, or drags the menu around. You also don't want the clicks intended for your controls to fall through to the basic game, so it is important to intercept them before that happens. Luckily the win32 API provides us with an easy method:
    Code:
    WNDPROC wpOrigEditProc = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG) WndProc);
    Where WndProc is your own function for handling any windows messages such as mousebuttons / keys, and wpOrigEditProc is PWI's function. What you then do is check whether any messages sent to PWI are likely intended for your own controls, and if not you call wpOrigEditProc with the same parameters, so the game receives all the necessary messages for running normally.

    Well, those are the basic building blocks for creating ingame menus. For the rest simply look at the source code to see how it works (the actual functionality is of course moot, as a 2 minute autoIt script could do the same thing). The structures were created with a program called "ReClass" which can be found here. It's a nifty tool for exploring the game's structures in memory.

    The attached AutoPot.rar contains the injector + dll + resources necessary for drawing the ingame menu. Simply extract it in the element directory (the one that contains elementclient.exe)

    Note: To actually compile the Dll you will need the D3D8 SDK

    HowTo:
    • Please extract the AutoPot.rar into the ..\element directory of your PWI install. For example: C:\Program Files\Perfect World Entertainment\Perfect World International\element
    • After extracting the files "AutoPot.exe" and "PWdll.dll" should be in the same directory as your "elementclient.exe" file. Apart from these two files, a folder named "Resources" should have been created in this same directory.
    • The "Resources" folder contains the images necessary for displaying the buttons and menu in the game, as well as the basic PWI fonts, in case they are not registered on your system.
    • After unpacking the rar file, you should now run the "AutoPot.exe" file for every instance of PWI you wish to have the AutoPot enabled. It will inject the "PWdll.dll" on starting of the PWI client, which will enable a button next to your chat screen.
    • By pressing this button (which looks like the cleric icon) you will open a menu in which you can select the options necessary for the AutoPot to function. These are very basic options so it shouldn't be too difficult


    Note: This program uses hardcoded offsets and addresses, it might not work soon after any patches. This program is merely created in order to learn basic menu creation within the game via EndScene hooking.

    Author: Interest07


    Virustotal result: 0%

    Please register or login to download attachments.

    Last edited by Grooguz; 2011-12-03 at 10:13 AM.

  2. #2
    Grooguz
    Grooguz is offline
    BanHammer Holder
    Grooguz's Avatar
    Join Date
    2010 May
    Posts
    678
    Thanks Thanks Given 
    152
    Thanks Thanks Received 
    537
    Thanked in
    167 Posts
    Rep Power
    14
    This stuff should work on every servers, because d3d hooking is used. Check the source code for better understanding

  3. #3
    interest07
    interest07 is offline
    Guest
    Join Date
    2011 Dec
    Posts
    1
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0
    Being the original author, I can tell you that this will not work for any of the current versions of PWI, as it has some hardcoded offsets / addresses (i.e. inventory structure and sendpacket function). The source code for the dll itself is also not provided in this post, although I believe I posted it on the epvp forums where you found this.

    I don't generally code "plug 'n play" type programs, but more show possible things to inspire others to perhaps use that train of thought. I'll usually provide source code though. I'm real bad when it comes to maintaining programs such as this with regards to offsets / addresses, so my stuff will usually not work soon after its posted, unless somebody convinces me to update it lol

  4. #4
    joshuu
    Guest
    nice work....

    ---------- Post added at 01:44 PM ---------- Previous post was at 01:43 PM ----------

    nice work.......

Similar Threads

  1. [Bot] Perfect World RemBot
    By Dwar in forum Perfect World Bots, Cheats
    Replies: 19
    Last Post: 2011-11-22, 12:06 PM
  2. Perfect World Crafting
    By philips_lee in forum Perfect World
    Replies: 0
    Last Post: 2011-10-25, 10:12 PM
  3. Replies: 0
    Last Post: 2010-12-15, 01:40 PM
  4. How to create Perfect World Hack?
    By NeTBuS in forum Perfect World
    Replies: 4
    Last Post: 2010-11-22, 03:28 PM
  5. this is one of the best bots made for perfect world
    By flamepattern in forum Trash Bin
    Replies: 0
    Last Post: 2010-11-01, 08:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •