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 


[Help] compiling dll
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Tue Apr 29, 2008 9:32 am    Post subject: Reply with quote

1qaz wrote:
ok i deleted my .h files and .def file
after that my cpp file was compileable
then i added a new header file and called it myHeader.h
i wrote in it:
Code:

#ifdef __cplusplus
extern "C"

             
#endif

__declspec( dllexport ) bool PostMessage2(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);

#ifdef __cplusplus
}
#endif


now when i compile it i get warning message at the bottom
frame pointer register ebp modified by inline assembly code (but i dont think it matter).

now i #include "myHeader.h" in dllmain.cpp
compiled it and succeeded
in my application i imported the function from my dll and when i run it i get
"attempted to read or write protected memory. this is often an indication that other memory is corrupt"


just do this !!

dllmain.cpp
Code:
#include "windows.h"

DWORD hPMA = (DWORD)GetProcAddress(LoadLibraryA("user32.dll"),"PostMessageA")+5;
DWORD hGPA = (DWORD)GetProcAddress(LoadLibraryA("gdi32.dll"),"GetPixel")+5;

 __declspec(naked) void PMA(void)
   {
      __asm
      {
         mov edi,edi
         push ebp
         mov ebp,esp
         jmp [hPMA]
      }
   }

 __declspec(naked) void GP(void)
 {
    __asm
    {
       mov edi,edi
       push ebp
       mov ebp,esp
       jmp [hGPA]
    }
 }


Exports.def
Code:
LIBRARY PMX2
EXPORTS
PMA @1
GP @2
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: Tue Apr 29, 2008 9:52 am    Post subject: Reply with quote

finally !! =D
thx +rep :]]]]]

_________________
Stylo
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Tue Apr 29, 2008 9:54 am    Post subject: Reply with quote

1qaz wrote:
finally !! =D
thx +rep :]]]]]



i hope you now understand how to export, if you wanna export more from this .dll, just add @+1

@1
@2
@3
@4
@5
@etc.. (
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
Goto page Previous  1, 2, 3
Page 3 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