May 08, 2024, 02:55:14 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Interfacing your DLL's with rundll32

Started by sapero, May 06, 2009, 10:03:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sapero

Rundll and rundll32 allow you to invoke a function exported from a DLL.
' rundll32 interfacing demo
' compile as rundlldemo.dll
' from the command prompt execute following command
' rundll32 rundlldemo.dll,PlayFile %windir%\media\tada.wav

export PlayFile
export PlayFileW ' if the 'W' version is exported, it will be called first on NT platforms

sub PlayFile(int hwnd, int hinst, string lpszCmdLine, int nCmdShow)
'MessageBox 0, lpszCmdLine, "PlayFile"
PlayWave lpszCmdLine, @SNDSYNC
endsub

sub PlayFileW(int hwnd, int hinst, wstring lpszCmdLine, int nCmdShow)
'MessageBox 0, w2s(lpszCmdLine), "PlayFileW"
PlayWave w2s(lpszCmdLine), @SNDSYNC
endsub

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q164787&;

Really I didn't know how it works, always assumed the dll function calls GetCommandLine and checks if process name is rundll32.