|
-
November 6th, 2004, 08:06 PM
#1
rundll32 implementation
hello there,
i have the following problem:
i want to implement my own function just like rundll32, so
i could open from my funtion for example the "System Clock Properties Window" (double click over the clock icon) just like
with rundll32 (e.g.: c:\>rundll32 shell32,Control_RunDLL TimeDate.cpl,,0 -> opens
the Clock properties...), so
i read the documentation in MSDN about how rundll32 works and
wrote the following code:
Code:
#define LEAN_AND_MEAN
#include <windows.h>
#include <winbase.h>
typedef LPVOID (CALLBACK* DLLFUNC)(LPSTR);
int main()
{
HMODULE hMod = NULL;
DLLFUNC ProcAdd = NULL;
hMod = LoadLibrary("c:\\winnt\\system32\\shell32.dll");
if (hMod != NULL)
{
if (hMod)
{
ProcAdd = (DLLFUNC) GetProcAddress(hMod, "Control_RunDLL");
if (ProcAdd)
{
(DLLFUNC) ProcAdd("TimeDate.cpl,,0");
}
}
FreeLibrary(hMod);
}
return 0;
}
but the program crash after calling "(DLLFUNC) ProcAdd(..." code line.
i've tried also to declare the DLLFUNC like this "EntryPoint function" just like in MSDN with the 4 parameters (hwnd, hInstance, etc.) but didn't work also ...
I think the problem is, because "Control_RunDLL" takes somehow different parameters and i can't call the function correct.
Does anyone have an idea what's going on and how should i implement this correct?
thank you in advance,
typecast
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|