Game started notifier

This is a discussion on Game started notifier within the Warcraft 3 Hacks, bots and tools board part of the Warcraft 3 forum category; Originally Posted by darksupremo http://www.playdota.com/forums/39083/detecting-when-you-enter-game-warcraft-iii/#post365124 thanks a lot!...

Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 41
  1. #11
    hahahafr is offline Addict
    Array
    Join Date
    Sep 2010
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    27
    Quote Originally Posted by darksupremo View Post
    http://www.playdota.com/forums/39083/detecting-when-you-enter-game-warcraft-iii/#post365124
    thanks a lot!


  2. #12
    DarkSupremo is offline Premium Member
    Array
    Join Date
    Feb 2008
    Posts
    790
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    13
    Reputation
    606
    Source to get the GameState updated to 1.26a:

    Code:
    #define _WIN32_WINNT 0x501
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <iostream>
    #include <stdio.h>
    #include <stdlib.h>
    #include <Tlhelp32.h>
    
    
    #define GS_NOTHING 0
    #define GS_LOBBY 1
    #define GS_LOADING 3
    #define GS_INGAME 4
    #define GS_PAUSEDGAME 6
    
    
    using namespace std;
    HANDLE hProc;
    DWORD GetProcessId (char *prcName)
    {
        PROCESSENTRY32 procEntry;
        BOOL            working=0;
        DWORD            targetPid=0;
        HANDLE snapshot =CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS ,0);
        procEntry.dwSize=sizeof(PROCESSENTRY32);
        if (Process32First(snapshot,&procEntry) )
        {
            do
            {
                if(stricmp(procEntry.szExeFile,prcName)==0)
                {
                    CloseHandle(snapshot);
                    return procEntry.th32ProcessID;
                }
            }
            while (Process32Next(snapshot,&procEntry));
        }
        CloseHandle(snapshot);
        return -1;
    }
    
    
    bool DebugPriviligesEnable()
    {
        HANDLE hToken;
        TOKEN_PRIVILEGES tokPriv;
        LUID dbgValue;
        if ( ! OpenProcessToken( GetCurrentProcess(),
            TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) )
            return false;
        if ( ! LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &dbgValue ) ){
            CloseHandle( hToken );
            return false;
        }
        tokPriv.PrivilegeCount = 1;
        tokPriv.Privileges[0].Luid = dbgValue;
        tokPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
        if ( ! AdjustTokenPrivileges( hToken, FALSE, &tokPriv, sizeof(tokPriv), NULL, NULL ) )
        {
            CloseHandle( hToken );
            return false;
        }
        return true;
    }
    
    
    DWORD GetModuleBaseAddr(char* modName, DWORD procId)
    {
        HANDLE snapMod;
        MODULEENTRY32 me32;
        snapMod = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, procId);
        me32.dwSize = sizeof(MODULEENTRY32);
        if (Module32First(snapMod, &me32)){
            do
            {
                if (stricmp(modName,me32.szModule) == 0){
                    CloseHandle(snapMod);
                    return (DWORD) me32.modBaseAddr;
                }
            }
            while(Module32Next(snapMod,&me32));
        }
        CloseHandle(snapMod);
        return 0;
    }
    
    
    DWORD GetIndex(DWORD BaseAddr)
    {
        DWORD ret;
        ReadProcessMemory(hProc,(LPVOID)(BaseAddr+0xAB7BF4),&ret,sizeof(DWORD),NULL);
        return ret;
    }
    DWORD GetW3TlsForIndex(DWORD index,DWORD BaseAddr,DWORD pid)
    {
        THREADENTRY32 te32;
        HANDLE hSnap=CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, pid );
        te32.dwSize = sizeof(THREADENTRY32);
        if ( Thread32First( hSnap, &te32 ) )
        {
            do
            {
                if ( te32.th32OwnerProcessID == pid )
                {
                    HANDLE hThread = OpenThread( THREAD_ALL_ACCESS, false, te32.th32ThreadID );
                    CONTEXT ctx = { CONTEXT_SEGMENTS };
                    LDT_ENTRY ldt;
                    GetThreadContext( hThread, &ctx );
                    GetThreadSelectorEntry( hThread, ctx.SegFs, &ldt );
                    DWORD dwThreadBase = ldt.BaseLow|(ldt.HighWord.Bytes.BaseMid<<16)|(ldt.HighWord.Bytes.BaseHi<<24);
                    CloseHandle( hThread );
                    if ( dwThreadBase == NULL )
                        continue;
                    DWORD dwTls;
                    ReadProcessMemory(hProc,(LPVOID)(dwThreadBase+0xE10+4*index),&dwTls,4,NULL);
                    printf("Thread: %X , TLS for index %X : %X\n",te32.th32ThreadID,index,(DWORD)dwTls);
                    if ( dwTls == NULL )
                        continue;
                    return (DWORD)dwTls;
    
    
                }
            } while( Thread32Next( hSnap, &te32 ) );
        }
        return NULL;
    }
    DWORD GetGameStateValue(DWORD TlsValue)
    {
        DWORD rt;
        if(!ReadProcessMemory(hProc,(LPVOID)(TlsValue+0x0D*4),&rt,4,NULL))
        return -1;
        if(!ReadProcessMemory(hProc,(LPVOID)(rt+0x10),&rt,4,NULL))
        return -1;
        if(!ReadProcessMemory(hProc,(LPVOID)(rt+0x8),&rt,4,NULL))
        return -1;
        if(!ReadProcessMemory(hProc,(LPVOID)(rt+0x278),&rt,4,NULL))
        return -1;
        return rt;
    }
    int main()
    {
    
    
        if(!DebugPriviligesEnable())
        {
            cout<<"Can't get debug privs, cant read wc3 memory buh bye!\n";
            system("PAUSE");
            return 0;
        }
        DWORD procId = GetProcessId("war3.exe");
        if(procId==-1)
        {
            cout<<"Can't get wc3 process id buh bye!\n";
            system("PAUSE");
            return 0;
        }
        hProc = OpenProcess(PROCESS_VM_READ|PROCESS_QUERY_INFORMATION,FALSE,procId);
        DWORD baseAddr= GetModuleBaseAddr("Game.dll",procId);
        if(!baseAddr)
        {
            cout<<"Can't get Game.dll base address buh bye!\n";
            CloseHandle(hProc);
            system("PAUSE");
            return 0;
        }
        DWORD tlsIndex= GetIndex(baseAddr);
        DWORD tlsValue = GetW3TlsForIndex(tlsIndex,baseAddr,procId);
    
    
        while (1)
        {
            system("cls");
            DWORD GState=GetGameStateValue(tlsValue);
            switch (GState)
            {
                case GS_NOTHING:
                    printf("War3 State: Doing nothing.");
                    break;
                case GS_LOBBY:
                    printf("War3 State: In Lobby.");
                    break;
                case GS_LOADING:
                    printf("War3 State: Game Loading.");
                    break;
                case GS_INGAME:
                    printf("War3 State: Playing.");
                    break;
                case GS_PAUSEDGAME:
                    printf("War3 State: Game paused.");
                    break;
            default:
                printf("War3 State: Closed :\\");
                break;
            }
            Sleep(200);
        }
        CloseHandle(hProc);
        return 0;
    }

    so, now you just need something like:


    If (Playing)
    {
    PlaySound("C:\\play.wav",NULL,SND_FILENAME|SND_ASY NC);
    }
    Last edited by DarkSupremo; 07-12-2011 at 08:39 PM.

  3. The Following 2 Users Say Thank You to DarkSupremo For This Useful Post:


  4. #13
    hahahafr is offline Addict
    Array
    Join Date
    Sep 2010
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    27
    Even nicer, ty.

  5. #14
    ZeD's Avatar
    ZeD
    ZeD is offline RoR 0x266E


    Array
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    1,440
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    14
    Reputation
    698
    Deleted, didn't see the other posts (failed FF v5 browser doesn't let me view page 2)
    Last edited by ZeD; 07-12-2011 at 10:49 PM.

  6. #15
    hahahafr is offline Addict
    Array
    Join Date
    Sep 2010
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    27
    Quote Originally Posted by Dennis View Post
    Deleted, didn't see the other posts (failed FF v5 browser doesn't let me view page 2)
    I just saw the message you posted through email notfications. Ty anyway.
    Last edited by hahahafr; 07-12-2011 at 11:11 PM.

  7. #16
    GoldenOne's Avatar
    GoldenOne is offline Advanced Hacker
    Array
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    7
    Reputation
    110
    Play in fullscreen, the game goes back in when game starts

  8. #17
    hahahafr is offline Addict
    Array
    Join Date
    Sep 2010
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    27
    You mean in windowed mode? Because I play in fullscreen.

    ---------- Post added at 01:50 AM ---------- Previous post was at 124 AM ----------

    gamestatev1.0.exe
    The modified exe compiled version.

    HOW-TO:
    1. Enter Lobby
    2. Alt-Tab
    3. Start as administrator the console app
    4. Minimize the app
    4. Do your things
    5. The minimized app flashes & closes=> The game just started

    Credits to DarkSupremo for finding the code and the offsets. Me for the flashy thing
    Enjoy!

  9. #18
    DarkSupremo is offline Premium Member
    Array
    Join Date
    Feb 2008
    Posts
    790
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    13
    Reputation
    606
    added to garenamaster

    Version: 77.01 - [2011/07/12]
    - New feature added: : "Game Start Notifier" (Play a sound when the game start, like RGC does)
    - Few bugs fix
    - Changed the image asking users to help us keep alive clicking in the arrow...

  10. #19
    Ancient.Deadly's Avatar
    Ancient.Deadly is offline Master Hacker
    Array
    Join Date
    Nov 2010
    Location
    Malaysia
    Posts
    532
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    309
    Quote Originally Posted by DarkSupremo View Post
    added to garenamaster

    Version: 77.01 - [2011/07/12]
    - New feature added: : "Game Start Notifier" (Play a sound when the game start, like RGC does)
    - Few bugs fix
    - Changed the image asking users to help us keep alive clicking in the arrow...
    It would be better.
    "I learned to walk; since then have I let myself run."
    "Freedom is slavery. War is peace. Ignorance is strength."

  11. #20
    GoldenOne's Avatar
    GoldenOne is offline Advanced Hacker
    Array
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    7
    Reputation
    110
    Quote Originally Posted by hahahafr View Post
    You mean in windowed mode? Because I play in fullscreen.

    ---------- Post added at 01:50 AM ---------- Previous post was at 124 AM ----------
    Nope, I really meant fullscreen! My game just tabs back in once game starts, I kind of like it

Page 2 of 5 FirstFirst 1234 ... LastLast

Similar Threads

  1. Getting started at D3scene.com
    By Reinn in forum Entertainment
    Replies: 32
    Last Post: 09-01-2011, 09:26 AM
  2. Chipe_94.....getting started. Hello
    By chip_94 in forum Say Hello
    Replies: 2
    Last Post: 08-20-2010, 07:52 PM
  3. Getting started with Glider
    By hendricius in forum WoW Bots, hacks and exploits
    Replies: 11
    Last Post: 12-06-2008, 03:42 PM
  4. Trying to getting started
    By killoooi in forum WoW Private Servers
    Replies: 2
    Last Post: 07-08-2008, 06:54 PM
  5. Drop-Notifier
    By tschoerk in forum Diablo 2 forum
    Replies: 0
    Last Post: 09-19-2007, 08:42 PM

Posting Permissions

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