I have a C ++ project in visual studio 2008 on Windows 7 where I am trying to launch a new service. I am running visual studio as an administrator. I can not start the service (serviceMain is not even called).
this is my main function:
wchar_t str[] = {'s','e','s','m'}; int _tmain(int argc, _TCHAR* argv[]) { SERVICE_TABLE_ENTRY dispTable[] = { {(wchar_t*)str, ServiceWork::ServiceMain}, {NULL, NULL} }; int i = StartServiceCtrlDispatcher(dispTable); int j = GetLastError(); return 0; }
output:
. ,.
'SessionMonitor.exe': loaded 'C: \ Windows \ SysWOW64 \ cryptbase.dll'
'SessionMonitor.exe': Loaded 'C: \ Windows \ SysWOW64 \ imm32.dll'
'SessionMonitor.exe': Loaded 'C: \ Windows \ SysWOW64 \ msctf.dll'
First chance exception in 0x7638b9bc in SessionMonitor.exe: 0x00000005: access is denied. The thread "Win32 Thread" (0x129c) exited with code 0 (0x0). The program '[2492] SessionMonitor.exe: Native' exited with code 0 (0x0).
during debugging, j - 1063 - ERROR_FAILED_SERVICE_CONTROLLER_CONNECT
Has anyone encountered this problem before? any solution?
Thank you liron
source share