Welcome to RaGEZONE - MMORPG Development Forums (sponsored by tfn.gr) Mark forums read | View Forum Leaders
RaGEZONE - MMORPG Development Forums (sponsored by tfn.gr)

Kal Development Discuss, [Guide] C++ DLL injection for Main Server at Kal Online forum; ####################C++######################### bored? yep -.- here uhii now you can get 2 skill points @lvl up gzzz... KalHook.SkillPoints(2); void Hook::SkillPoints(BYTE PTS) ...




Reply
Thread Tools
[Guide] C++ DLL injection for Main Server
 
 
Boring ô_Ô

Rank: Member


Reply With Quote
 
Join Date: Sep 2006
Location: Germany
Posts: 541
07-12-2008, 09:19 PM
 
####################C++#########################

bored? yep -.-

here uhii now you can get 2 skill points @lvl up gzzz...


KalHook.SkillPoints(2);

void Hook::SkillPoints(BYTE PTS)
{
BYTE code[] = {0x83 , 0xC1 , PTS};
MemcpyEx(0x004591B1,(DWORD)&code,3);
}

void SkillPoints(BYTE);


you should know how to use this codes if you have read this topic
###################C++######################
Hook for ChatBox to use IngameCommands (client side)
PHP Code:
DWORD MyChatBack;



void WINAPI MyChatBox(charrw)
{

        if (
rw[0] =='x')
        
Command(rw);
        
}

void Naked MyChatHook()
{
    
__asm
    
{
        
add        esp,4
        mov     eax
esp
        push    eax

        call    MyChatBox

        jmp MyChatBack
;
    }
}

void ChatPrint(char *rw)
{

    
char  string[256]={0};
    
sprintf_s(string,"&\0");
    
strcat_s(string,rw);
    
DWORD adr = (DWORD)&string;
    
__asm 
    
{
        
mov edx,adr
        PUSH EDX
        mov eax
,0x00229518
        push eax
        PUSH 11h
        mov eax
,0x00229518
        call eax
    
    
}
}




void ChatBox() {
    
    
int offset;
    
offset=SearchPattern("83 C4 04 85 C0 74 02 EB 26 8B 55 F8 52 68 x x x x 6A 11 E8 x x x x",0x00400000,0x00700000);

    if (
offset != 0) {
        
Intercept(INST_JMP,offset,(DWORD)MyChatHook,9);
        
MyChatBack offset +9;
    }

#####################Delphi######################
Here hf with this you can load KSM files ^^ not full working it's only a basic oO
PHP Code:
procedure TForm1.Button1Click(SenderTObject);
var
  
myRGB: Array [0..3of Byte;
  
XYInteger;
  
MemStreamTMemoryStream;
begin
  X 
:= 0;
  
:= 0;
  
MemStream := TMemoryStream.Create;
  if 
OpenDialog1.Execute True then
  begin
    MemStream
.LoadFromFile(OpenDialog1.FileName);
    
MemStream.Position := 4;
    
Image1.Picture.Bitmap.Width := 256;
    
Image1.Picture.Bitmap.Height := 256;
    for 
:= 0 to 256 do
    
begin
      
for := 0 to 256 do
      
begin
        MemStream
.Read(myRGB4);
        
Image1.Canvas.Pixels[X,Y] := RGB(myRGB[0],myRGB[1],myRGB[2]);
      
end;
    
end;
    
MemStream.Free;
  
end;
end
 
 
permalink
 

 
KalOnline Grand Old Man

Rank: Alpha Member


Reply With Quote
 
Join Date: Mar 2007
Location: Aarhus, Denmark
Posts: 2,597
07-12-2008, 09:38 PM
 
Neat, regarding the KSM -- The KSM don't contain colour information (that belongs to the KCM), are you sure you aren't mixing them up?

This is how I handle KSM. The KSM handles the different zone types, and how mobs/players behave (collison, pvp, etc.)
Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace KalMapEditor 
{
    class Map 
    {
        public ushort Collision;
        public byte Zone;
        public enum Types {
            World        = 0x00,
            OneWayPortal = 0x01,
            Town         = 0x02,
            TwoWayPortal = 0x03,
            PKFree       = 0x04,
            Castle       = 0x10
        };                             
        
        public Map(ushort collision,byte zone) 
        {
             this.Collision = collision;
             this.Zone      = zone; 
        }
    }
}
Code:
        /// <summary>
        /// Load the map into a grid
        /// </summary>
        private bool LoadMap() 
        {
            ushort collision;
            ushort zone;
            
            try 
            {
                using(FileStream fs = new FileStream(Path.GetFullPath(Filename),FileMode.Open)) 
                using(BinaryReader br = new BinaryReader(fs)) 
                {
                    for(int y=255;y>=0;y--) 
                    for(int x=0;x<256;x++) 
                    {
                        collision = br.ReadUInt16();
                        zone      = br.ReadUInt16();
                        
                        switch((byte)zone)
                        {
                            case (byte)Map.Types.Town:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.Town);
                            break;
                            case (byte)Map.Types.Castle:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.Castle);
                            break;
                            case (byte)Map.Types.OneWayPortal:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.OneWayPortal);
                            break;
                            case (byte)Map.Types.TwoWayPortal:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.TwoWayPortal);
                            break;
                            case (byte)Map.Types.PKFree:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.PKFree);
                            break;
                            case (byte)Map.Types.World:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.World);
                            break;
                            default:
                                Grid[x,y] = new Map(collision,(byte)Map.Types.World);
                            break;
                        }
                    }
                }
            } catch(EndOfStreamException) {
                MessageBox.Show("Invalid File");
                return false;
            }

            return true;
        }
 
 
permalink
 

 
Meow!

Rank: Alpha Member


Reply With Quote
Blog Entries: 3
 
Join Date: Oct 2006
Location: Australia
Posts: 2,238
07-14-2008, 10:26 AM
 
didnt aylen already add this start/stop war in his prem?
 
 
permalink
 

 
ToF ToF is offline
WannaBe

Rank: Member


Reply With Quote
 
Join Date: Jun 2007
Location: Sweden
Posts: 255
07-14-2008, 07:03 PM
 
got problem when im trying to build the .dll file...


look in the .rar file....


EDIT: nvm.. got it working..
Attached Files
File Type: rar BuildLog.rar (1.3 KB, 7 views)

Last edited by ToF; 07-14-2008 at 08:05 PM.
 
 
permalink
 

 
* ~ Jangan ~ *

Rank: Member


Reply With Quote
 
Join Date: Nov 2006
Location: Canada
Posts: 815
07-15-2008, 12:02 AM
 
Quote: Originally Posted by Stup View Post
didnt aylen already add this start/stop war in his prem?
the premium version maybe... never seen the hook posted anywhere...
 
 
permalink
 

 
Monster Member

Rank: New Blood


Reply With Quote
 
Join Date: May 2008
Location: Egypt
Posts: 185
07-15-2008, 10:01 AM
 
Oo don't understand any thing in the C++ or programing XD lol
but may be its good
 
 
permalink
 

 
ToF ToF is offline
WannaBe

Rank: Member


Reply With Quote
 
Join Date: Jun 2007
Location: Sweden
Posts: 255
07-15-2008, 11:16 AM
 
i started to read c++ this week.. (at home)

im still reading about:


Quote:
#include <iostream>

int main()

using namespace std;

cout <<

return 0;

endl;
and what functions they have..

somethimes its very boring but i think when i know a bit more it will be much easyer to understand...
 
 
permalink
 

 
i try to learn

Rank: Member


Reply With Quote
 
Join Date: Oct 2006
Location: Belgium
Posts: 326
07-27-2008, 07:49 PM
 
how can i make that i can select stuff from a listbox?? i mean that i can copy and past the text that is in the listbox and use it on a other place.
ore on what other why i could do it beter .
i hoop that your understand my ugly englische XD but i do my best ;)
 
 
permalink
 

 
KalOnline Grand Old Man

Rank: Alpha Member


Reply With Quote
 
Join Date: Mar 2007
Location: Aarhus, Denmark
Posts: 2,597
07-27-2008, 07:54 PM
 
I would prefer if you would find a tutorial rather than asking here, it's not very related to the thread.

Also, I don't get a clue of what you're saying. Find a tutorial in your native language would do better.
 
 
permalink
 

 
God Of Eggs <3

Rank: Member


Reply With Quote
 
Join Date: Sep 2006
Location: GERMANY
Posts: 214
08-01-2008, 09:23 PM
 
which version of visual c++ i need?
idownloaded Microsoft Visual C++ 6.0 Standard Edition
but it look other then your version on the ss :-O
 
 
permalink
 

 
Boring ô_Ô

Rank: Member


Reply With Quote
 
Join Date: Sep 2006
Location: Germany
Posts: 541
08-01-2008, 09:26 PM
 
get visual studio 2005/8 express
or microsoft visual studio 2008 standart/professional
 
 
permalink
 

 
void;

Rank: Member


Reply With Quote
 
Join Date: Dec 2006
Posts: 823
08-01-2008, 09:27 PM
 
Quote: Originally Posted by slowtrucker View Post
which version of visual c++ i need?
idownloaded Microsoft Visual C++ 6.0 Standard Edition
but it look other then your version on the ss :-O
Visual C++ Express is required.
 
 
permalink
 

 
ToF ToF is offline
WannaBe

Rank: Member


Reply With Quote
 
Join Date: Jun 2007
Location: Sweden
Posts: 255
08-01-2008, 09:32 PM
 
i got visual c++ 2008 pro =D
 
 
permalink
 

 
The Omega

Rank: New Blood


Reply With Quote
 
Join Date: Jan 2007
Location: egypt
Posts: 124
09-14-2008, 06:27 AM
 
u knw man for this tut i will be back into kalonline server dev and client dev and thanks alot it helped realy ^^ god bless you ^^
 
 
permalink
 

 
The Omega

Rank: New Blood


Reply With Quote
 
Join Date: May 2008
Posts: 105
12-30-2008, 03:53 AM
 
Sorry for bumping an old thread, but seeing as it's not even on the second page, I'm not going to worry about it...

I'm trying to do this basically for fun, and to learn more C++.

I'm apparently calling something wrong, because when I start the main server with this DLL hooked, it throws an exception. I know it is this code, because when I take this out, it works. I tried simplifying the process (probably inefficiently because I suck at C++) and it still doesn't work.

PHP Code:
void KalHook::ShowInfo(LPCSTR text)
    {
        
DWORD infoAddress;
        

        
infoAddress 0x00432860
        
        
__asm {
             
push 1
             push text
             call infoAddress
             add esp
,8

        
}
    }; 
PHP Code:
    void KalHook::Attach()
    {
       
this->ShowInfo("Hi");
    } 
PHP Code:
public:
        
void Attach();
        
void Detach();
        
void ShowInfo(LPCSTR text); 
If I've done something glaringly obvious, let me know. I really barely know this language.

I'm using VS 2005 Standard. The server can start okay as long as this code is not in the DLL.

Thanks.

-V
 
 
permalink
 

 
Average Member

Rank: Omicron


Reply With Quote
 
Join Date: Oct 2008
Posts: 54
12-30-2008, 10:42 AM
 
ShowInfo = notice? xD
when not u forgot the color of the ShowInfo ;)
 
 
permalink
 

 
The Omega

Rank: New Blood


Reply With Quote
 
Join Date: May 2008
Posts: 105
12-30-2008, 02:35 PM
 
I thought this was to put a message in the server console...?

What I did is took DeathArt's code and removed the color select parameter that specifies which color to use. Instead, I'm just specifying the function to call in asm. So I've actually simplified it, to no avail.

Any ideas? ><

-V
 
 
permalink
 

 
Average Member

Rank: Omicron


Reply With Quote
 
Join Date: Oct 2008
Posts: 54
12-30-2008, 07:09 PM
 
u must use color lol
 
 
permalink
 

 
KalOnline Grand Old Man

Rank: Alpha Member


Reply With Quote
 
Join Date: Mar 2007
Location: Aarhus, Denmark
Posts: 2,597
01-01-2009, 06:01 PM
 
As BloodX said , the colour is a reqiure parameter.
 
 
permalink
 

 
The Omega

Rank: New Blood


Reply With Quote
 
Join Date: May 2008
Posts: 105
01-01-2009, 07:09 PM
 
I've put the code back in, in its original state. The program still won't run, though I think I've narrowed the problem down to a memory violation on my own computer, as opposed to a programming error on my part.
 
 
permalink
 

Reply

Tags
milek = pizzamonster

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT +1. The time now is 04:51 AM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RaGEZONE © 2001 - 2008





 
Evade Blackbelt School