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 


[C++] Error: Entry point must be defined

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

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sun Nov 30, 2008 9:30 am    Post subject: [C++] Error: Entry point must be defined Reply with quote

This is my source:
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

bool Unlimited_Attack_Switch = false;
bool Auto_Skill_Switch = false;

DWORD _PMA = ((DWORD)GetProcAddress(LoadLibrary("user32.dll"), "PostMessageA")) + 5;

DWORD dwAddress = 0x00400000;
DWORD dwLen = 0x7FFFFFFF;

__declspec(naked) BOOL WINAPI _PostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   __asm
   {
      mov edi, edi
      push ebp
      mov ebp, esp
      jmp dword ptr ds:[_PMA]
   }
}

__inline ULONG_PTR ReadPointer(ULONG_PTR* ulBase, INT nOffset){
   if ( !IsBadReadPtr((VOID*)ulBase, sizeof(ULONG_PTR)) )
        if ( !IsBadReadPtr((VOID*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)) )
            return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
    return 0;
}

bool comp(const BYTE* pData, const BYTE* bMask, const char* szMask)
{
    for(;*szMask;++szMask,++pData,++bMask)
        if(*szMask=='x' && *pData!=*bMask )
            return false;
    return (*szMask) == NULL;
}

DWORD dwFindPattern(DWORD dwAddress, DWORD dwLen, BYTE *bMask, char* szMask, DWORD dwOffset)
{
    for(DWORD i=0; i < dwLen; i++)
        if( comp( (BYTE*)( dwAddress+i ),bMask,szMask) )
            return (DWORD)(dwAddress+i+dwOffset);
   
    return 0;
}

void Unlimited_Attack()
{
   char Unlimited_Attack_Bytes[17] = "\x8B\x0D\x00\x00\x00\x00\x8B\x01\xFF\x50\x00\x8B\xC8\xE8\x00\x00";
   char Unlimited_Attack_Offset_Bytes[26] = "\x8B\x8B\x00\x00\x00\x00\x83\xF9\x00\x8D\x83\x00\x00\x00\x00\x0F\x00\x00\x00\x00\x00\x41\x89\x08\x68";
   DWORD Unlimited_Attack_Address = *(DWORD*)dwFindPattern(dwAddress, dwLen, (BYTE*)Unlimited_Attack_Bytes, "xx????xxxx?xxx??", 2);
   DWORD Unlimited_Attack_Offset_Address = *(DWORD*)dwFindPattern(dwAddress, dwLen, (BYTE*)Unlimited_Attack_Offset_Bytes, "xx????xx?xx????x?????xxxx", 2);
   
   // GMS v62
   // DWORD Item_P_Address = 0x00978358;
   // DWORD Item_Base_Offset_Address = 0xD58;
   char Item_P_Bytes[17] = "\xA1\x00\x00\x00\x00\x3B\xC7\x74\x00\x8B\xC8\x83\xC0\x00\xF7\xD9"; // A1 ? ? ? ? 3B C7 74 ? 8B C8 83 C0 ? F7 D9
   char Item_Base_Offset_Bytes[17] = "\x89\x8F\x00\x00\x00\x00\x8B\x48\x00\x6A\x00\x89\x8F\x00\x00\x00"; // 89 8F ? ? ? ? 8B 48 ? 6A ? 89 8F ? ? ?
   DWORD Item_P_Address = *(DWORD*)dwFindPattern(dwAddress, dwLen, (BYTE*)Item_P_Bytes, "x????xxx?xxxx?xx", 0);
   DWORD Item_Base_Offset_Address = *(DWORD*)dwFindPattern(dwAddress, dwLen, (BYTE*)Item_Base_Offset_Bytes, "xx????xx?x?xx???", 0);
   
   char Character_Bytes[17] = "\x8B\x0D\x00\x00\x00\x00\x50\x57\x8D\x45\x00\x50\x53\xE8\x00\x00";
   char Character_X_Bytes[17] = "\x8B\x86\x00\x00\x00\x00\x3B\xC3\x89\x5D\x00\x00\x00\x8B\x08\x8D";
   DWORD Character_Address = *(DWORD*)dwFindPattern(dwAddress, dwLen, (BYTE*)Character_Bytes, "xx????xxxx?xxx??", 2);
   DWORD Character_X_Address = *(DWORD*)dwFindPattern(dwAddress, dwLen, (BYTE*)Character_X_Bytes, "xx????xxxx???xxx", 2);

   int Old_X_Position = 0;

   for(;;Sleep(10))
   {
      if (Unlimited_Attack_Switch == true)
      {
         if (ReadPointer((ULONG_PTR*)Unlimited_Attack_Address, Unlimited_Attack_Offset_Address) >= 99)
         {
            Old_X_Position = ReadPointer((ULONG_PTR*)Character_Address, Character_X_Address);
            while (ReadPointer((ULONG_PTR*)Unlimited_Attack_Address, Unlimited_Attack_Offset_Address) >= 99)
            {   
               *(DWORD*)(*(DWORD*)Item_P_Address + Item_Base_Offset_Address) = Old_X_Position - 15;
               Sleep(1);
            }
         }
         Sleep (100);
      }
   }
}

void Auto_Skill()
{
   for(;;Sleep(10))
   {
      if (Auto_Skill_Switch == true)
      {
         HWND hMSWindow = FindWindow("MapleStoryClass", 0);
         if (hMSWindow != NULL)
         {
            Sleep(40000);
            // _PostMessageA(hMSWindow, WM_KEYDOWN, 0x56, (MapVirtualKey(0x56, 0) << 16));
            _PostMessageA(hMSWindow, WM_KEYDOWN, 0x56, NULL);
            Sleep(3000);
            _PostMessageA(hMSWindow, WM_KEYUP, 0x56, NULL);
         }
         Sleep(10);
      }
   }
}

void MainThread()
{
   for(;;Sleep(10))
   {
      if (GetAsyncKeyState(VK_F11))
      {
         if (Unlimited_Attack_Switch == false)
         {
            Unlimited_Attack_Switch = true;
            Sleep(500);
         }
         else
         {
            Unlimited_Attack_Switch = false;
            Sleep(500);
         }
      }
      if (GetAsyncKeyState(VK_F12))
      {
         if (Auto_Skill_Switch == false)
         {
            Auto_Skill_Switch = true;
            Sleep(500);
         }
         else
         {
            Auto_Skill_Switch = false;
            Sleep(500);
         }
      }
   }
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
   switch (ul_reason_for_call)
   {
      case DLL_PROCESS_ATTACH:
         DisableThreadLibraryCalls(hModule);
         CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MainThread, hModule, 0, NULL);
         CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Unlimited_Attack, hModule, 0, NULL);
         CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Auto_Skill, hModule, 0, NULL);
         break;
      case DLL_PROCESS_DETACH:
         break;
   }
   return TRUE;
}


This is the error I get:
Code:
LINK : fatal error LNK1561: entry point must be defined


Does anyone know what is wrong?

Edit: I see what I did wrong.


Last edited by Innovation on Sun Nov 30, 2008 9:59 am; edited 4 times in total
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Nov 30, 2008 9:35 am    Post subject: Reply with quote

Go to project settings and in General change the Configuration Type to Dynamic-Link Library. (.dll)

If it's already a DLL, then check your settings in Linker -> Advanced.

Umm, let me guess... you only learn C++ to make MapleStory bots... Rolling Eyes
Back to top
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sun Nov 30, 2008 9:41 am    Post subject: Reply with quote

Also, you defined WIN32_LEAN_AND_MEAN after including windows.h...first learn why people use it.

(I'm not copying you Symbol ._.)
Back to top
View user's profile Send private message MSN Messenger
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sun Nov 30, 2008 9:52 am    Post subject: Reply with quote

Symbol wrote:
Go to project settings and in General change the Configuration Type to Dynamic-Link Library. (.dll)

If it's already a DLL, then check your settings in Linker -> Advanced.

Umm, let me guess... you only learn C++ to make MapleStory bots... Rolling Eyes


Thanks! It was set to create an executable. LOL. I am not really good at exploring compiler settings. Yes, I did learn C++ to make hacking tools. I learned Delphi for other reasons though also.

Zerith wrote:
Also, you defined WIN32_LEAN_AND_MEAN after including windows.h...first learn why people use it.

(I'm not copying you Symbol ._.)


I know it is used to get rid of rarely used things from the windows header. I'll just take it out.


Last edited by Innovation on Sun Nov 30, 2008 9:54 am; edited 1 time in total
Back to top
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sun Nov 30, 2008 9:53 am    Post subject: Reply with quote

inoobzx wrote:
Symbol wrote:
Go to project settings and in General change the Configuration Type to Dynamic-Link Library. (.dll)

If it's already a DLL, then check your settings in Linker -> Advanced.

Umm, let me guess... you only learn C++ to make MapleStory bots... Rolling Eyes


Thanks! It was set to create an executable. LOL. I am not really good at exploring compiler settings. Yes, I did learn C++ to make hacking tools. I learned Delphi for other reasons though also.

Zerith wrote:
Also, you defined WIN32_LEAN_AND_MEAN after including windows.h...first learn why people use it.

(I'm not copying you Symbol ._.)


I know it is used to get rid of rarely used things. I'll just take it out. -.-


No..,just define it before including windows.h, look in windows.h and you will see why.
Back to top
View user's profile Send private message MSN Messenger
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sun Nov 30, 2008 9:58 am    Post subject: Reply with quote

Zerith wrote:
inoobzx wrote:
Symbol wrote:
Go to project settings and in General change the Configuration Type to Dynamic-Link Library. (.dll)

If it's already a DLL, then check your settings in Linker -> Advanced.

Umm, let me guess... you only learn C++ to make MapleStory bots... Rolling Eyes


Thanks! It was set to create an executable. LOL. I am not really good at exploring compiler settings. Yes, I did learn C++ to make hacking tools. I learned Delphi for other reasons though also.

Zerith wrote:
Also, you defined WIN32_LEAN_AND_MEAN after including windows.h...first learn why people use it.

(I'm not copying you Symbol ._.)


I know it is used to get rid of rarely used things. I'll just take it out. -.-


No..,just define it before including windows.h, look in windows.h and you will see why.


I see your point.
Back to top
View user's profile Send private message
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