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 


Binder

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Jan 12, 2009 10:04 am    Post subject: Binder Reply with quote

Anyone know of a good binder ? I have a DLL and an EXE that I want to bind to become one. I tried MoleBoxPro but it's fucking up the DLL so the direct memory access writes to the wrong address..
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jan 12, 2009 10:43 am    Post subject: Reply with quote

Just include the dll as a resource.
In the resource file (.rc) as RC_DATA or something like that.
Then use the api's like LoadResource and FindResource to either write the dll to a temporary file and then load it with LoadLibrary or load it directly into memory.
Back to top
View user's profile Send private message
FerrisBuellerYourMyHero
Master Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 401
Location: Inside your <kernel>

PostPosted: Mon Jan 12, 2009 1:13 pm    Post subject: Reply with quote

I do a similar thing as tombana wrote. Except I don't embed it as a resource and just as binary. I just use hex workshop because it already does it. But you could even write your own application that does it. Basically you select all the bytes and goto copy as-> C Source

it will give you an unsigned char array like this:

Code:

// Generated by BreakPoint Software's Hex Workshop v4.20
//   http://www.hexworkshop.com
//   http://www.bpsoft.com
//
//  Source File: SomeDll.dll
//         Time: 1/12/2009 1:00 PM
// Orig. Offset: 0 / 0x00000000
//       Length: 156160 / 0x00026200 (bytes)
unsigned char rawData[156160] =
{
    0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
} ;


That isn't the whole thing I had to cut most if it out because its so big it wouldn't let me post it. But you can just copy that unsigned char array into your application and that binary will be embedded in the final executable. You can then just dump it to a file and call loadlibrary. (if its a dll) That's exactly what I did with my directx trainer, embed the .png images like that and you call D3DXCreateTextureFromFileInMemory()

Code:

FILE* f = fopen("SomeDll.dll", "wb");

fwrite(rawData, sizeof(rawData), 1, f);

fclose(f);


Its a good way to not be dependent on a dll or something being in the same folder as your application. Just recreate it as necessary.

I think my hex workshop trial is about to expire, so I quickly whipped up a freeware app that creates the unsigned char arrays from a binary file

Code:

#include <windows.h>
#include <stdio.h>

void CreateArray();

FILE* f = 0;
char* buff = 0;
char* filebuff = 0;
long filesize = 0;

int main()
{
   SetConsoleTitleA("Binary Binder Array Maker");
   buff = new char[260];

   printf("Type the path to the file: ");
   gets(buff);

   f = fopen(buff, "rb");

   if(!f)
   {
      printf("File path not valid!");
      Sleep(3000);
      return 0;
   }

   fseek(f, 0, SEEK_END);
   filesize = ftell(f);
   rewind(f);

   filebuff = new char[filesize];

   fread(filebuff, filesize, 1, f);

   CreateArray();

   printf("\n\nSuccessfully generated binary array!\nYou can now embed it in your application.");

   Sleep(3000);

   delete[] buff;
   delete[] filebuff;

   return 1;
}

void CreateArray()
{
   BYTE x = 0, z = 0;

   FILE* f2 = fopen("GeneratedArray.txt", "wb");

   fwrite("// FerrisSoft\r\n", 15, 1, f2);
   fwrite("// Source File: ", 16, 1, f2);
   fwrite(buff, strlen(buff), 1, f2);
   fwrite("\r\n", 2, 1, f2);

   sprintf(buff, "//        Size: %u bytes / 0x%p\r\n//<--\r\n", filesize, filesize);
   fwrite(buff, strlen(buff), 1, f2);

   sprintf(buff, "unsigned char BinaryData[%u] = \r\n{\r\n\t", filesize);
   fwrite(buff, strlen(buff), 1, f2);

   for(long i = 0; i < filesize; i++)
   {
      x = filebuff[i];

      if(z == 16)
      {
         fwrite("\r\n\t", 3, 1, f2);
         z = 0;
      }

      if(i == (filesize - 1))
      {
         sprintf(buff, "0x%02X\r\n};\r\n//-->", x);
         fwrite(buff, strlen(buff), 1, f2);
      }
      else
      {
         sprintf(buff, "0x%02X, ", x);
         fwrite(buff, strlen(buff), 1, f2);
      }

      z++;
   }
}


As you can see it doesn't really take much to do it. To format it for use with other languages besides c/c++ would be pretty simple too, but I only have use for this in c.

_________________
You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!

Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
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