View previous topic :: View next topic |
Author |
Message |
kyle.kwp How do I cheat? Reputation: 0
Joined: 28 Nov 2017 Posts: 6
|
Posted: Tue Nov 28, 2017 1:33 am Post subject: 6.7 source loadlibrary |
|
|
Hi, I am trying to modify
the code in the newkernelhandler.pas
initialization part, loadlibrary.
it looks like I can only load win32 libraries.
can I load custom dll ?
I'v spent 8hours on trying to make "loadlibrary("mydll.dll")" work but
debugger always give me 0 (failed to load).
for example,
Code: | myVar:=LoadLibrary(pchar(CheatEngineDir+'\win64\myDLL.dll')); |
doesn't work ..[/code]
ofc, I defined myVar as THandle above
_________________
kwp |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Tue Nov 28, 2017 1:40 am Post subject: |
|
|
is cheat engine compiled as 64 bit?
is your dll compiled as 64-bit ?
does your dll import other dlls? and if so, can they be found ?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
kyle.kwp How do I cheat? Reputation: 0
Joined: 28 Nov 2017 Posts: 6
|
Posted: Tue Nov 28, 2017 12:27 pm Post subject: |
|
|
cheat engine compiled - 64bit
dll compiled - 64bit
my dll doesn't import other dll.
I forgot to mention dll I was trying to load was written with c++.
after the post, I made dll with pascal, it was successfully loaded
I used dumpbin /export to check pe headers it looks like
headers from dll written with pascal and written with c++, they are different -.-
but loadlibrary can be used for kernel32.dll or dbghelp.dll...
I took string-mix(?) eg) __(name)@20 into consideration by defining .def file and calling conventions
anyways.. dll written with pascal works great but it's pain in the ass to write everything from scratch something originally written in c++ ...
is there anyway to load c++ written dll
Dark Byte wrote: | is cheat engine compiled as 64 bit?
is your dll compiled as 64-bit ?
does your dll import other dlls? and if so, can they be found ? |
_________________
kwp |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Nov 29, 2017 1:10 pm Post subject: |
|
|
Try compiling it as C instead of C++
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
kyle.kwp How do I cheat? Reputation: 0
Joined: 28 Nov 2017 Posts: 6
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri Dec 01, 2017 4:52 am Post subject: |
|
|
Are you on a normal windows system or on an emulator like Wine ?
You're sure you're debugging loadlibrary and not the loadplugin code ?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
kyle.kwp How do I cheat? Reputation: 0
Joined: 28 Nov 2017 Posts: 6
|
Posted: Fri Dec 01, 2017 1:58 pm Post subject: |
|
|
Dark Byte wrote: | Are you on a normal windows system or on an emulator like Wine ?
You're sure you're debugging loadlibrary and not the loadplugin code ? |
Code: | program test1212;
uses windows, Classes,sysutils;
type TReadProcessMemory=function(hProcess: THandle; lpBaseAddress, lpBuffer: Pointer; nSize: DWORD; var lpNumberOfBytesRead: PTRUINT): BOOL; stdcall;
var
WindowsKernel: Thandle;
krpm: TReadProcessMemory;
begin
WindowsKernel:=LoadLibrary(pchar('phyDLL.dll'));
Pointer(krpm):=GetProcAddress(WindowsKernel,'krpm');
end.
|
this simple Program runs but while debugging, windowsKernel points to 0
but if I use LoadLibrary(pchar('kernel32.dll'));, it points to proper address
in this case phyDLL.dll is C++/C dll which cannot be loaded .
any other pascal written dll can be loaded.
[/code]
_________________
kwp |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri Dec 01, 2017 3:07 pm Post subject: |
|
|
you are sure ce is compiled as 64-bit ? because what you describe is exactly that. (also, don't compile your dll as 'managed')
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
kyle.kwp How do I cheat? Reputation: 0
Joined: 28 Nov 2017 Posts: 6
|
Posted: Fri Dec 01, 2017 9:16 pm Post subject: |
|
|
Dark Byte wrote: | you are sure ce is compiled as 64-bit ? because what you describe is exactly that. (also, don't compile your dll as 'managed') |
yes. project option - compiler option target-OS 64bit, target cpu-x86_64 (both in CE and my test delphi app), running with administration priv
yes c++ dll, I am not using clr, I even tried pragma managed push off method + no clr support option. dll is compiled in 64 bit as well.
I am gonna try to simulate the same on the other machine as well .
I am using 3.0.2 fpc, 1.6.4 lazarus windows 10 64bit
loadlibrary only loads system32 subsystem dll written by ms, or pascal written dll -.-
you don't have this issue right? loadlibrary in lazarus
of course, I can load every dll using loadlibrary in c++ program using ms visual studio. it only happens with lazarus, pascal language.
(edit) by the what I am trying to achieve is, direct rpm/wpm physical memory through vulnerable asus driver, I'v already made export functions in dll form, I just want to replace default rpm/wpm in CE by loading dll in newKernelHandler. as kernel rwpm given in CE has to be run in test sign mode or need a certificate.
_________________
kwp |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sat Dec 02, 2017 3:58 am Post subject: |
|
|
check in the taskmanager that your program is actually 64 bit (or make sure sizeof(pointer) is 8 )
do you test your c++ app by copying the dll to the corresponding location just like in pascal ? (could be that the dll only works if some other file is present in that folder)
do you give full paths to the files, or do you use relative paths or based on a variable. (if based on a var, print out the final path, could be missing a path selerator)
are you compiling using unicode ?
you mentioned something about Delphi earlier and , if you meant the new one(after 7), that one tends to force your code to unicode, so it would likely be calling loadlibraryW and pchar converts it to ascii
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|