Jump to content
Tuts 4 You

CreateDialog() inside OllyDbg Plugin


akrutsinger

Recommended Posts

I'm wanting to create a settings dialog inside of my OllyDbg 2.xx plugin, but I'm stuck at the very first part; creating the dialog...

This is the code I'm using right now (and have successfully used in many other win32 projects before)


hSettings = CreateDialog(hollyinst, MAKEINTRESOURCE(IDD_SETTINGS), hwollymain, (DLGPROC)SettingsDialogProc);
if(hSettings != NULL){
ShowWindow(hSettings, SW_SHOW);
}else{
MessageBox(hwollymain, L"CreateDialog returned NULL", L"OllyID", MB_OK | MB_ICONINFORMATION);
}

With this hSettings always returns NULL. What am I missing?

Link to comment

Hi

I cannot c++ but have you try remove (DLGPROC)

example:

hSettings = CreateDialog(hollyinst, MAKEINTRESOURCE(IDD_SETTINGS), hwollymain, SettingsDialogProc);

or with &SettingsDialogProc

greets

Link to comment

From MSDN:

HWND WINAPI CreateDialog(

_In_opt_ HINSTANCE hInstance,

_In_ LPCTSTR lpTemplate,

_In_opt_ HWND hWndParent,

_In_opt_ DLGPROC lpDialogFunc

);

Parameters

hInstance [in, optional] A handle to the module whose executable file contains the dialog box template.

You have resources in your DLL, not in Ollydbg.exe, right? Replace hollyinst with hinstYourPluginDLL and it will work just fine. :)

  • Like 1
Link to comment

Got it working. Used a modal dialog (Thanks RaMMicHaeL).


HINSTANCE hSettingsInstance = (HINSTANCE)GetModuleHandle(L"OllyID.dll");
DialogBox(hSettingsInstance, MAKEINTRESOURCE(IDD_SETTINGS), hwollymain, (DLGPROC)SettingsDialogProc);
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...