Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[request] few things about dll files
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Mon Nov 05, 2007 6:28 am    Post subject: Reply with quote

ok thanks alot u helped me alot
_________________
Stylo
Back to top
View user's profile Send private message
Renkokuken
GO Moderator
Reputation: 4

Joined: 22 Oct 2006
Posts: 3249

PostPosted: Mon Nov 05, 2007 6:35 am    Post subject: Reply with quote

1qaz wrote:
ok thanks alot u helped me alot
MSDN has hints on it as well, good luck.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Nov 05, 2007 6:58 am    Post subject: Reply with quote

You can do inline ASM in most languages, C/C++ is one of the more common languages to see inline ASM with. VS2005 is a good compiler / IDE if you are looking for one as well. Creating a DLL is easy too. Depending on what you want to make there are certain steps that you need to take for each thing. The main part of any program, including DLLs, is the entry point. In C/C++ the entry point of a DLL will look like:

Code:
BOOL APIENTRY DllMain( HANDLE, DWORD ul_reason_for_call, LPVOID lpReserved )
{
   switch( ul_reason_for_call )
   {
   case DLL_PROCESS_ATTACH:
   case DLL_THREAD_ATTACH:
   case DLL_THREAD_DETACH:
   case DLL_PROCESS_DETACH:
      break;
   }
   return TRUE;
}


From there you would add things that you would need the DLL to do when its first loaded, if anything is done. Or create exported functions that the DLL has that other applications can use.

However, you will also need to read up on calling conventions as there are many different types of them, each having their own purpose and use inside the DLL and outside it in the calling program. The most common convention you will see is __stdcall, as it is required to allow languages like VB to call your exported functions.

Without the __stdcall convention on your exported functions, your exports become "decorated" with the param types and such that VB cannot understand. For example, you can export a function to add two params together, like:

int Add(int a, int b);

When you export it, it will look like:
?Add@@YAHHH@Z

In most cases you can fix this with .DEF files, adding your call to the export list such as:

LIBRARY "YourDLLName"
EXPORTS
Add

In other compilers it's not always the same.

Just some tips and things to look out for.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Nov 05, 2007 6:59 am    Post subject: Reply with quote

Since when did the OP mention anything about visual basic interoperability?
_________________
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Mon Nov 05, 2007 7:08 am    Post subject: Reply with quote

appalsap wrote:
Since when did the OP mention anything about visual basic interoperability?


It was just an example... Jeez.
Back to top
View user's profile Send private message MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Nov 05, 2007 7:10 am    Post subject: Reply with quote

noz3001 wrote:
It was just an example... Jeez.


No, that guide was clearly designed with visual basic in mind, talking about function decoration as if it is a bad thing, and suggesting the OP "fix" modern constructs by taking leaps backwards.

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Nov 05, 2007 7:11 am    Post subject: Reply with quote

appalsap wrote:
Since when did the OP mention anything about visual basic interoperability?


Did I say anything about VB specifically? I said "other languages like VB" as it pertained to exporting of functions which is sometihng he/she will be dealing with. If you are going to try to bash me, try reading first.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Nov 05, 2007 7:14 am    Post subject: Reply with quote

Wiccaan wrote:
appalsap wrote:
Since when did the OP mention anything about visual basic interoperability?


Did I say anything about VB specifically? I said "other languages like VB" as it pertained to exporting of functions which is sometihng he/she will be dealing with. If you are going to try to bash me, try reading first.


Wiccaan wrote:
...as it is required to allow languages like VB to call your exported functions.

...Without the ... and such that VB cannot understand.

_________________
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Mon Nov 05, 2007 7:16 am    Post subject: Reply with quote

ok i have other question
i made a trainer and i saved it as <name>.dll
and i made a file in C# that waiting for the game and when the game is running it will open trainer
now since its a dll file i need to "inject" it i think and i have no idea how i make the injection at c#
that's what i wrote (btw it's for winmine)
Code:

using System;
using System.Diagnostics;

namespace ConsoleApplication6
{
   class Class1
   {
      static void Main(string[] args)
      {
         Console.WriteLine("waiting for winmine..");
         Console.WriteLine("");
         start:
         Process[] myprocess = Process.GetProcessesByName("winmine");
         if (myprocess.Length != 0)
         {
            goto anotherstart;
         }
         goto start;
         anotherstart:
         Console.WriteLine("winmine found");
         Process p = new Process();
         p.StartInfo.FileName = "Hacks.dll";
         p.Start();
      }
   }
}



now i know that the part of "startinfo.filename = "hacks.dll" wont inject it it's just opening the process
so how do i inject this dll file to the game?

_________________
Stylo
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Nov 05, 2007 7:23 am    Post subject: Reply with quote

Use the following API to inject:
- VirtualAllocEx
- WriteProcessMemory
- CreateRemoteThread
- VirtualFreeEx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Mon Nov 05, 2007 7:25 am    Post subject: Reply with quote

and how do i use them exectly? Confused
_________________
Stylo
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Nov 05, 2007 7:28 am    Post subject: Reply with quote

1qaz wrote:
and how do i use them exectly? Confused


I can't give you any C# example as I don't code in C#, but you can take a look at the following C++ examples and see how they are being used and try to convert them to C#.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6388&lngWId=3
http://www.codeguru.com/Cpp/W-P/system/processesmodules/article.php/c5767

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Mon Nov 05, 2007 7:29 am    Post subject: Reply with quote

1qaz wrote:
and how do i use them exectly? Confused

Why don't you just google them?

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Mon Nov 05, 2007 7:46 am    Post subject: Reply with quote

Wiccaan wrote:
1qaz wrote:
and how do i use them exectly? Confused


I can't give you any C# example as I don't code in C#, but you can take a look at the following C++ examples and see how they are being used and try to convert them to C#.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6388&lngWId=3
http://www.codeguru.com/Cpp/W-P/system/processesmodules/article.php/c5767

it's pretty hard to translate it from C++
:S i can bearly understand is there any chance u help me?

_________________
Stylo
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Nov 05, 2007 8:27 am    Post subject: Reply with quote

1qaz wrote:
Wiccaan wrote:
1qaz wrote:
and how do i use them exectly? Confused


I can't give you any C# example as I don't code in C#, but you can take a look at the following C++ examples and see how they are being used and try to convert them to C#.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6388&lngWId=3
http://www.codeguru.com/Cpp/W-P/system/processesmodules/article.php/c5767

it's pretty hard to translate it from C++
:S i can bearly understand is there any chance u help me?


Like I said, I don't program in C#, I also didn't see any examples of DLL injection with C# via google either. Perhaps you should take on a new language instead of C#.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites