how to run dll using Rundll32.exe [modified]
-
i have 2 exprted functions in a dll ( Win32 dynamiclink dll project )
void __stdcall MsgBox()
{
MessageBox( NULL , "Hello" , "" , MB_OK ) ;
}
void __stdcall MsgBox1( LPSTR a )
{
MessageBox( NULL , a , "" , MB_OK ) ;
}//i tried following commands , the first one works but the not the secnd one, can any one tell where is the problem ? //{ rundll32.exe mydll.dll,MsgBox rundll32.exe mydll.dll,MsgBox1 "hi" //} //def file //{ LIBRARY MyDll EXPORTS MsgBox MsgBox1 //} Thanks
modified on Monday, April 7, 2008 3:35 AM
-
i have 2 exprted functions in a dll ( Win32 dynamiclink dll project )
void __stdcall MsgBox()
{
MessageBox( NULL , "Hello" , "" , MB_OK ) ;
}
void __stdcall MsgBox1( LPSTR a )
{
MessageBox( NULL , a , "" , MB_OK ) ;
}//i tried following commands , the first one works but the not the secnd one, can any one tell where is the problem ? //{ rundll32.exe mydll.dll,MsgBox rundll32.exe mydll.dll,MsgBox1 "hi" //} //def file //{ LIBRARY MyDll EXPORTS MsgBox MsgBox1 //} Thanks
modified on Monday, April 7, 2008 3:35 AM
nitin3 wrote:
MessageBox( NULL , T , "" , MB_OK ) ;
And what is the output you're expecting from?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
nitin3 wrote:
MessageBox( NULL , T , "" , MB_OK ) ;
And what is the output you're expecting from?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
nitin3 wrote:
MessageBox( NULL , T , "" , MB_OK ) ;
And what is the output you're expecting from?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkeyou have eyes of vulture.. :)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/codeProject$$>
-
sorry that was a mistake, i modified the code. my problem is the second function MsgBox1 function does not displays the text i entered, or its shows a message "An exception occured while trying to run "mydllfile.dll"
Thanks & Regards
To exploit the
rundll32.exe
your exported function must follow some rules, for instance the prototype must be like the followingvoid CALLBACK MsgBoxW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow);
then a working sample (at least, on XP it works...) will be
void CALLBACK MsgBoxW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
{
MessageBox(hwnd, lpszCmdLine, L"MyMessageBox", MB_OK);
}with
def
fileLIBRARY "MyDLL"
EXPORTS
MsgBoxW @1for a complete discussion see [^] :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke