registering own commands menu

User Tag List

Results 1 to 3 of 3
  1. #1
    zdohdds's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2013
    Posts
    46
    Thanks G/R
    19/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    registering own commands

    Hello. I'm trying to write registration and use own commands, but how to do it i don't know.

    Example for use from the game:
    .help <----- default command

    .settodo [x] <------ my command
    On the forum I found interesting functions like:

    Code:
    // 3.3.5a 12340
    00769100    ConsoleCommandRegister
    007689E0    ConsoleCommandUnregister
    but my attempts somehow to use them nor to no avail.

    C++
    Code:
    //00769100    ConsoleCommandRegister
    //int __cdecl sub_769100(char *a1, int a2, int a3, int a4)
    int ConsoleCommandRegister(char *a1, int a2, int a3, int a4)
    {
    	return ((int(__cdecl*)(char*, int, int, int))0x769100)(a1, a2, a3, a4);
    }
    
    void Kek()
    {
    	MessageBox("i'm here");
    }
    
    //...
    ConsoleCommandRegister("kek", (DWORD)Kek, 4, 0);
    //...
    PS: sorry for my bad English.

    registering own commands
  2. #2
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    The function you found is to register Lua functions. The commands you're mentioning are commands processed by the server, not the client.

    If you want to process .commands you certainly can. You merely need to intercept the function which sends chat messages to the server, and if it is a command, process it, and prevent the message from being sent to the server. Careful with how you do this though. Be sure that the message isn't encrypted or you will defund your crypto session with the server.

  3. Thanks zdohdds (1 members gave Thanks to namreeb for this useful post)
  4. #3
    zdohdds's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2013
    Posts
    46
    Thanks G/R
    19/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by namreeb View Post
    You merely need to intercept the function which sends chat messages to the server...
    Thank you for the idea.

    I started search with lua_SendChatMessage and found this function:

    Code:
    // 3.3.5a 12340
    int __usercall lua_SendChatMessage@<eax>(int edi0@<edi>, int a1)
    {
    	//...
    	sub_577D00(*(int *)v37, &v31, 0x100u);
    	//...
    }
    where 0x100u it's length the input text

    I tried to hook it like:

    Code:
    //int __cdecl sub_577D00(int a1, _BYTE *a2, unsigned int a3)
    typedef int(__cdecl* WoWSendMessageDelegate)(char*, int, int);
    WoWSendMessageDelegate WoWSendMessage = (WoWSendMessageDelegate)0x577D00;
    BYTE WSM_original_bytes[5] = { 0, 0, 0, 0, 0 };
    BYTE WSM_hook_bytes[5] = { 0, 0, 0, 0, 0 };
    DWORD WSM_original_protection = 0;
    
    int __cdecl WoWSendMessageHook(char* pText, int unk_1, int textSize)
    {
    	memcpy(WoWSendMessage, WSM_original_bytes, 5);
    	MyMessageBox(pText);
    	int ret = 0;
    	if (pText[0] == '.') // <----- some command for the test. Example: ".test"
    	{
    		ret = WoWSendMessage(pText, unk_1, 0);
    	}
    	else ret = WoWSendMessage(pText, unk_1, textSize);
    	memcpy(WoWSendMessage, WSM_hook_bytes, 5);
    
    	return ret;
    }
    
    void WoWSendMessageInitHook()
    {
    	memcpy(WSM_original_bytes, WoWSendMessage, 5);
    	WSM_hook_bytes[0] = 0xE9;
    	DWORD addr = (DWORD)WoWSendMessageHook - (DWORD)WoWSendMessage - 5;
    	memcpy(WSM_hook_bytes + 1, &addr, 5);
    	VirtualProtect(WoWSendMessage, 8, PAGE_EXECUTE_READWRITE, &WSM_original_protection);
    	memcpy(WoWSendMessage, WSM_hook_bytes, 5);
    }
    And it's work. If it's my command, not sent to the server.

Similar Threads

  1. Own MMowned Private Server.
    By Bossman4 in forum Suggestions
    Replies: 38
    Last Post: 11-09-2006, 09:46 PM
  2. Kill your own factions NPC's
    By Matt in forum World of Warcraft Exploits
    Replies: 9
    Last Post: 08-18-2006, 04:05 PM
  3. [Guide] Command List
    By oninuva in forum World of Warcraft Guides
    Replies: 5
    Last Post: 05-17-2006, 08:28 PM
  4. Attack your own NPC's
    By oninuva in forum World of Warcraft Guides
    Replies: 0
    Last Post: 04-23-2006, 02:24 PM
All times are GMT -5. The time now is 04:16 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search