Skip to content

Commit

Permalink
funcguard: add Scintilla DllMain guard
Browse files Browse the repository at this point in the history
- Add trace to the main entry point and resource load/release for
  SciLexer.dll.  This patch does _not_ enable the funcguard output,
  it only adds the guards to the source.

[#32]

Signed-off-by: Thell Fowler <git@tbfowler.name>
  • Loading branch information
Thell Fowler committed Oct 30, 2010
1 parent d664039 commit 36f8d10
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scintilla/src/MISC/Debug/FuncGuards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,10 @@

// FUNCGUARD_BLOCK_START << Do not alter or remove

#ifdef FUNCGUARD_NPPCR_DLLMAIN
func_guard_enable_cat(guardDllMain);
#else
func_guard_disable_cat(guardDllMain);
#endif

// FUNCGUARD_BLOCK_END << Do not alter or remove
2 changes: 2 additions & 0 deletions scintilla/src/MISC/Debug/FuncGuardsImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@
#ifndef MISC_DEBUG_FUNCGUARDIMPORT_H
#define MISC_DEBUG_FUNCGUARDIMPORT_H

func_guard_import_cat(guardDllMain);

#endif // MISC_DEBUG_FUNCGUARDS_H
4 changes: 4 additions & 0 deletions scintilla/src/MISC/Debug/FuncGuards_skel.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,9 @@

#ifndef SHIPPING

// func_guard(guardDllMain);
// Description: Traces main entry point of SciLexer.dll
//#define FUNCGUARD_NPPCR_DLLMAIN

#endif // SHIPPING
#endif // MISC_DEBUG_FUNCGUARD_H
3 changes: 3 additions & 0 deletions scintilla/win32/ScintillaWin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2769,6 +2769,7 @@ sptr_t PASCAL ScintillaWin::SWndProc(
// This function is externally visible so it can be called from container when building statically.
// Must be called once only.
int Scintilla_RegisterClasses(void *hInstance) {
func_guard(guardDllMain);
Platform_Initialise(hInstance);
bool result = ScintillaWin::Register(reinterpret_cast<HINSTANCE>(hInstance));
#ifdef SCI_LEXER
Expand All @@ -2779,13 +2780,15 @@ int Scintilla_RegisterClasses(void *hInstance) {

// This function is externally visible so it can be called from container when building statically.
int Scintilla_ReleaseResources() {
func_guard(guardDllMain);
bool result = ScintillaWin::Unregister();
Platform_Finalise();
return result;
}

#ifndef STATIC_BUILD
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) {
func_guard(guardDllMain);
//Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason);
if (dwReason == DLL_PROCESS_ATTACH) {
if (!Scintilla_RegisterClasses(hInstance))
Expand Down

0 comments on commit 36f8d10

Please sign in to comment.