Exemplo n.º 1
0
void CCmdLog::FreeLog()
{
	Destroy();		// Destory the log window first .
	freecon();		// Destory pipe logging system ..
	Destroysorteddata(&m_Table.sorted);
	DeleteCriticalSection(&m_csShare);
}
Exemplo n.º 2
0
// OllyDbg calls this obligatory function once during startup. Place all
// one-time initializations here. If all resources are successfully allocated,
// function must return 0. On error, it must free partially allocated resources
// and return -1, in this case plugin will be removed. Parameter ollydbgversion
// is the version of OllyDbg, use it to assure that it is compatible with your
// plugin; hw is the handle of main OllyDbg window, keep it if necessary.
// Parameter features is reserved for future extentions, do not use it.
extc int _export cdecl ODBG_Plugininit(int ollydbgversion, HWND hw, ulong *features)
{
	// This plugin uses all the newest features, check that version of OllyDbg is
	// correct. I will try to keep backward compatibility at least to v1.99.
	if (ollydbgversion < PLUGIN_VERSION)
		return -1;
	// Keep handle of main OllyDbg window. This handle is necessary, for example,
	// to display message box.
	hwmain = hw;
	// Initialize bookmark data. Data consists of elements of type t_bookmark,
	// we reserve space for 10 elements. If necessary, table will allocate more
	// space, but in our case maximal number of bookmarks is 10. Elements do not
	// allocate memory or other resources, so destructor is not necessary.
	if (Createsorteddata(&(bookmark.data), "Bookmarks",
	                     sizeof(t_bookmark), 10, (SORTFUNC *)Bookmarksortfunc, NULL) != 0)
		return -1;                         // Unable to allocate bookmark data
	// Register window class for MDI window that will display plugins. Please
	// note that formally this class belongs to instance of main OllyDbg program,
	// not a plugin DLL. String bookmarkwinclass gets unique name of new class.
	// Keep it to create window and unregister on shutdown.
	if (Registerpluginclass(bookmarkwinclass, NULL, hinst, Bookmarkwinproc) < 0)
	{
		// Failure! Destroy sorted data and exit.
		Destroysorteddata(&(bookmark.data));
		return -1;
	};
	// Plugin successfully initialized. Now is the best time to report this fact
	// to the log window. To conform OllyDbg look and feel, please use two lines.
	// The first, in black, should describe plugin, the second, gray and indented
	// by two characters, bears copyright notice.
	Addtolist(0, 0, "Bookmarks sample plugin v1.10 (plugin demo)");
	Addtolist(0, -1, "  Copyright (C) 2001-2004 Oleh Yuschuk & Piérrot !");
	// OllyDbg saves positions of plugin windows with attribute TABLE_SAVEPOS to
	// the .ini file but does not automatically restore them. Let us add this
	// functionality here. I keep information whether window was open when
	// OllyDbg terminated also in ollydbg.ini. This information is saved in
	// ODBG_Pluginclose. To conform to OllyDbg norms, window is restored only
	// if corresponding option is enabled.
	if (Plugingetvalue(VAL_RESTOREWINDOWPOS) != 0 &&
	        Pluginreadintfromini(hinst, "Restore bookmarks window", 0) != 0)
		Createbookmarkwindow();
	return 0;
};
Exemplo n.º 3
0
void ODBG2_Plugindestroy(void)
{
	Destroysorteddata(&(handletable.sorted));
}
Exemplo n.º 4
0
// OllyDbg calls this optional function once on exit. At this moment, all MDI
// windows created by plugin are already destroyed (and received WM_DESTROY
// messages). Function must free all internally allocated resources, like
// window classes, files, memory and so on.
extc void _export cdecl ODBG_Plugindestroy(void)
{
	Unregisterpluginclass(bookmarkwinclass);
	Destroysorteddata(&(bookmark.data));
};