Zubair Khan
April 6th, 1999, 12:28 PM
I asked a while ago how to hide my program from the Ctrl_alt-Del dialog. I was told to use RegisterServiceProcess. This works. But only in the debug build and not in the Release build. I got the code directly from the MSDN examples here it is:
#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.
DWORD TO = (to) ? RSP_SIMPLE_SERVICE : RSP_UNREGISTER_SERVICE;
typedef DWORD ( *RSPPROC) ( DWORD, DWORD);
RSPPROC RegisterServiceProcess;
HANDLE g_hSvcDll = NULL;
g_hSvcDll = LoadLibrary ("kernel32.dll");
if ( !g_hSvcDll)
{
// error
return FALSE;
}
RegisterServiceProcess = (RSPPROC) GetProcAddress (( HINSTANCE) g_hSvcDll, "RegisterServiceProcess");
if (!RegisterServiceProcess)
{
FreeLibrary ((HINSTANCE) g_hSvcDll);
}
else
{
if (!RegisterServiceProcess (NULL, TO))
{
// error
return FALSE;
}
}
FreeLibrary ( ( HINSTANCE) g_hSvcDll);
----
I thinks it's the call to the function that causes the exceptions. Has anyone got any ideas?
Thanks for any help - Zubair
#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.
DWORD TO = (to) ? RSP_SIMPLE_SERVICE : RSP_UNREGISTER_SERVICE;
typedef DWORD ( *RSPPROC) ( DWORD, DWORD);
RSPPROC RegisterServiceProcess;
HANDLE g_hSvcDll = NULL;
g_hSvcDll = LoadLibrary ("kernel32.dll");
if ( !g_hSvcDll)
{
// error
return FALSE;
}
RegisterServiceProcess = (RSPPROC) GetProcAddress (( HINSTANCE) g_hSvcDll, "RegisterServiceProcess");
if (!RegisterServiceProcess)
{
FreeLibrary ((HINSTANCE) g_hSvcDll);
}
else
{
if (!RegisterServiceProcess (NULL, TO))
{
// error
return FALSE;
}
}
FreeLibrary ( ( HINSTANCE) g_hSvcDll);
----
I thinks it's the call to the function that causes the exceptions. Has anyone got any ideas?
Thanks for any help - Zubair