I will like to be able to call a VBScript from an NT Service. The path of the VBScript will be stored in the registry, and I will like to read the registry, get the path of the script and call the vbs file from a function in my NT Service. Please can any one help?
This is my code so far:
BOOL CMyService::OnInit()
{
// Read the registry parameters
// Try opening the registry and getting key:
// HKEY_LOCAL_MACHINE\SOFTWARE\ICL\FTMS\GiroBank\ProcessCtr
HKEY hkey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\ICL\\FTMS\\Push1\\GiroBank\\ProcessCtrl",
0,
KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS) {
// Yes we are installed
DWORD dwType = 0;
DWORD dwSize = sizeof(m_iScriptParam);
RegQueryValueEx(hkey,
"Script",
NULL,
&dwType,
(BYTE*)&m_iScriptParam,
&dwSize);
dwSize = sizeof(m_iIncParam);
RegQueryValueEx(hkey,
"Inc",
NULL,
&dwType,
(BYTE*)&m_iIncParam,
&dwSize);
RegCloseKey(hkey);
}
else
DebugMsg("Something is wrong"
;
return TRUE;
}
void CMyService::Run()
{
//while (m_bIsRunning) {
// THIS IS WHERE I WANT TO EXECUTE THE SCRIPT ONCE}
}
Thanks in advance
This is my code so far:
BOOL CMyService::OnInit()
{
// Read the registry parameters
// Try opening the registry and getting key:
// HKEY_LOCAL_MACHINE\SOFTWARE\ICL\FTMS\GiroBank\ProcessCtr
HKEY hkey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\ICL\\FTMS\\Push1\\GiroBank\\ProcessCtrl",
0,
KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS) {
// Yes we are installed
DWORD dwType = 0;
DWORD dwSize = sizeof(m_iScriptParam);
RegQueryValueEx(hkey,
"Script",
NULL,
&dwType,
(BYTE*)&m_iScriptParam,
&dwSize);
dwSize = sizeof(m_iIncParam);
RegQueryValueEx(hkey,
"Inc",
NULL,
&dwType,
(BYTE*)&m_iIncParam,
&dwSize);
RegCloseKey(hkey);
}
else
DebugMsg("Something is wrong"
return TRUE;
}
void CMyService::Run()
{
//while (m_bIsRunning) {
// THIS IS WHERE I WANT TO EXECUTE THE SCRIPT ONCE}
}
Thanks in advance