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 


Plugin Crashes CE Without Error/Info

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source -> Plugin development
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 137

Joined: 25 Jan 2006
Posts: 7292
Location: 127.0.0.1

PostPosted: Mon Aug 28, 2017 12:38 am    Post subject: Plugin Crashes CE Without Error/Info Reply with quote

Working on a basic plugin that doesn nothing but hooks a few local API within CE as a means to bypass some common anti-cheat detections. However, just having the plugin load within CE is causing it to crash without warning/error.

At the moment, the only thing I have hooked as a test is:
- LoadLibraryA
- LoadLibraryW

Debug output shows:

Code:

< MESSAGES RELATED TO CE STARTUP >

    custom_ce_name.exe   Offset of LBR_Count=760
    custom_ce_name.exe   sizeof fxstate = 512
    custom_ce_name.exe   TSymhandler.create
    custom_ce_name.exe   TSymhandler.create 1
    custom_ce_name.exe   TSymhandler.create 2
    custom_ce_name.exe   TSymhandler.create 3
    custom_ce_name.exe   TSymbolListHandler.create 1
    custom_ce_name.exe   TSymbolListHandler.create 2
    custom_ce_name.exe   TSymbolListHandler.create exit
    custom_ce_name.exe   TSymhandler.create exit
    custom_ce_name.exe   TSymhandler.create
    custom_ce_name.exe   TSymhandler.create 1
    custom_ce_name.exe   TSymhandler.create 2
    custom_ce_name.exe   TSymhandler.create 3
    custom_ce_name.exe   TSymbolListHandler.create 1
    custom_ce_name.exe   TSymbolListHandler.create 2
    custom_ce_name.exe   TSymbolListHandler.create exit
    custom_ce_name.exe   TSymhandler.create exit
    custom_ce_name.exe   TSymhandler.reinitialize
    custom_ce_name.exe   loadmodulelist or force was true
    custom_ce_name.exe   Invalid vmx
    custom_ce_name.exe   CreateScanfolder
    custom_ce_name.exe   fScanResultFolder=C:\Users\atom0s\AppData\Local\Temp\custom cheat engine name here\
    custom_ce_name.exe   symbolloader thread finished
    custom_ce_name.exe   Symbolhandler: sync: Calling finishedloadingsymbols
    custom_ce_name.exe   after finishedloadingsymbols
    custom_ce_name.exe   finishedLoadingSymbols called
    custom_ce_name.exe   Symbol loader thread has finished without errors
    custom_ce_name.exe   exit finishedLoadingSymbols()

< MESSAGES RELATED TO LOADING PLUGIN >

    custom_ce_name.exe   shell\comdlg32\fileopensave.cpp(14274)\comdlg32.dll!774A2833: (caller: 774D211C) ReturnHr(1) tid(403c) 80004005 Unspecified error
    custom_ce_name.exe       CallContext:[\PickerModalLoop]
    custom_ce_name.exe   Hello world
    custom_ce_name.exe   Deleting C:\Users\atom0s\AppData\Local\Temp\custom cheat engine name here\{EA0AAD77-FD59-414F-B73D-FD5B956097E3}
    custom_ce_name.exe   deleted the scanresults
    custom_ce_name.exe   <process started at 23:06:28.235 has now terminated>


No error/warning is shown, it just terminates instantly when trying to load. CE does display the plugin's information after adding it to the list, freezes for about 5 seconds then closes.

Plugin is coded in C++ (MSVC++ 2015 Update 3).

Exports look like:
Code:

BOOL __stdcall CEPlugin_GetVersion(PPluginVersion pv, int sizeofpluginversion)
{
    pv->version = CESDK_VERSION;
    pv->pluginname = g_PluginName;

    return TRUE;
}
BOOL __stdcall CEPlugin_InitializePlugin(PExportedFunctions ef, int pluginid)
{
    g_ExportedFuncs = ef;
    g_Hwnd = (HWND)g_ExportedFuncs->GetMainWindowHandle();

    return Initialize();
}
BOOL __stdcall CEPlugin_DisablePlugin(void)
{
    Cleanup();
    return TRUE;
}


Initialize() is a function that handles the two API hooks. Method used is not public so I can't share it here. But this method is not a problem in other processes so I do not believe it is the problem.

Another issue is after loading any plugin, I seem to get 'Access Violation' errors opening and closing the options window of CE.

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

Joined: 25 Jan 2006
Posts: 7292
Location: 127.0.0.1

PostPosted: Mon Aug 28, 2017 1:11 am    Post subject: Reply with quote

To pin point this issue a bit more, it does appear to be an issue with hooking LoadLibraryA regardless of what hooking library or method is used. I tried several and all cause CE to have various issues/errors.

I'll get various pop-ups between different libraries ranging from:
- Crash/Close without error.
- Access violation
- Privileged Instruction

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 341

Joined: 09 May 2003
Posts: 20023
Location: The netherlands

PostPosted: Mon Aug 28, 2017 2:21 am    Post subject: Reply with quote

without seeing the code I can't say much.

if you're hooking loadlibrary, make sure you're also sanitizing the parameters given. e.g the path might be NULL

Also, don't use exception handling in your dll. When an exception happens, CE/fpc tries to handle it, regardless of your own exception handler

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
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 -> Cheat Engine Source -> Plugin development 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