Archived

This topic is now archived and is closed to further replies.

GetProcAddress() problem

This topic is 5237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#define RSP_SIMPLE_SERVICE 0x00000001 // Registers the process as a simple service process #define RSP_UNREGISTER_SERVICE 0x00000000 // Unregisters the process as a service process. int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { typedef DWORD ( *RSPPROC) (DWORD, DWORD); For some reason GetProcAddress() isn''t working in the code below... I would appreciate it if anyone could tell me what I am doing wrong. RSPPROC RegisterServiceProcess; HANDLE g_hSvcDll = NULL; g_hSvcDll = LoadLibrary ("kernel32.dll"); if (!g_hSvcDll) { MessageBox(0,"Function: LoadLibrary() Failed",0,0); } RegisterServiceProcess = (RSPPROC) GetProcAddress ((HINSTANCE) g_hSvcDll,"RegisterServiceProcess"); if(!RegisterServiceProcess) { int error = GetLastError(); char message[100]; sprintf(message,"Error: GetProcAddress Failed: Error Number: %d",error); MessageBox(0,message,0,0); FreeLibrary ((HINSTANCE) g_hSvcDll); } else { if (!RegisterServiceProcess (GetCurrentProcessId (),1)) { MessageBox(0,"Function: RegisterServiceProcess() Failed",0,0); } } return 0; }

Share this post


Link to post
Share on other sites
IIRC RegisterServiceProcess is for Windows 9x/ME OSes. You're not running Windows 2k or windows XP are you?

[edited by - en dum en on August 14, 2003 3:31:06 AM]

[edited by - en dum en on August 14, 2003 3:32:05 AM]

Share this post


Link to post
Share on other sites
There is this thing called Windows NT/2000 Service Control Manager(SCM). This Service Control Manager is not supported by Windows 95/98/ME. Instead Windows 9x has it''s own scaled-down Service Control Manager which RegisterServiceProcess is part of. XP also has a Service Control Manager but I''m not sure if it''s similar to the NT/2000 SCM search on msdn and you will find.

Share this post


Link to post
Share on other sites