Click to See Complete Forum and Search --> : start service before lock on


M**
June 9th, 2008, 02:40 AM
Hi,

How can I get it, that a service starts before the log on?

Thank you for your help!
M**

Marc G
June 9th, 2008, 08:45 AM
What "lock on"?

M**
June 10th, 2008, 12:27 AM
Sorry, I mine log on.

sockman
June 10th, 2008, 01:44 AM
When you create your service using the CreateService function you specify the type of service as SERVICE_AUTO_START. See the doco on CreateService for more details and other options.

s

M**
June 10th, 2008, 01:54 AM
I have done that, but the service starts after the log on and not before.
Or is only the program I started with the service not visible?
M**

sockman
June 10th, 2008, 02:17 AM
What does your service do? Can you explain what you mean by visible?
s

M**
June 10th, 2008, 02:37 AM
My service starts an OnScreenKeyboard, which I need for the log on.
M**

kirants
June 10th, 2008, 07:28 PM
what have you specified for the lpServiceStartName? Better yet, please code you are using to install the service and any service configuration

TheCPUWizard
June 10th, 2008, 07:36 PM
1) "lock on"? - Phasers or PHoton Torpedeos...
2) "Sorry, I mine log on."....You want to lock weapons on a space mine???

(just could not resist...)

A couple of points....

1) Automatic Services start Automatically when they are needed. You can configure for an actual start (once you post your code so we can show a relatively compataible way...).


My service starts an OnScreenKeyboard, which I need for the log on.


HEre is where you are going to run into trouble. The exact nature will depend on your OS and even SP.

Login is done by a special "highly secure" program known as a "GINA". It is specifically designed to minimize tampering for fairly objious reasons.

Even if you get your "On-Screen Keyboard" to START, it is VERY unlikely that you will get it to properly interact with the default GINA.

You will be much better off simply writing a custom GINA that utilizes the functionallity of your application directly.

M**
June 11th, 2008, 01:24 AM
my code:
inline BOOL CServiceModule::Install()
{
if (IsInstalled())
return TRUE;

SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hSCM == NULL)
{
MessageBox(NULL, _T("Couldn't open service manager"), m_szServiceName, MB_OK);
return FALSE;
}

TCHAR szFilePath[150];
::GetModuleFileName(NULL, szFilePath, _MAX_PATH);

SC_HANDLE hService = ::CreateService(hSCM, m_szServiceName, m_szServiceName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, szFilePath, NULL, NULL, NULL, NULL, NULL);

if (hService == NULL)
{
::CloseServiceHandle(hSCM);
MessageBox(NULL, _T("Couldn't create service"), m_szServiceName, MB_OK);
return FALSE;
}

::CloseServiceHandle(hService);
::CloseServiceHandle(hSCM);
return TRUE;
}
M**

M**
June 11th, 2008, 08:05 AM
at http://msdn.microsoft.com/en-us/library/aa380543.aspx I have found that GINA DLLs are ignored in Windows Vista.I need something that works on vista and xp.
M**

M**
June 18th, 2008, 01:12 AM
Can nobody help me??
M**

M**
June 25th, 2008, 12:46 AM
I have an another OSK seen that before the LogOn starts, but apparently does not have its own GINA. On the computer I could not found any unknown GINA. I know only that there is a service. Has anyone of you an idea??
M**

Igor Vartanov
June 26th, 2008, 05:48 AM
Okay-okay, I can't stand your suffering. :)

MSDN, CreateService Function
lpLoadOrderGroup [in, optional]

The names of the load ordering group of which this service is a member. Specify NULL or an empty string if the service does not belong to a group.

The startup program uses load ordering groups to load groups of services in a specified order with respect to the other groups. The list of load ordering groups is contained in the following registry value:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ServiceGroupOrder

A service start order is defined by the group service belongs to. Just create your service with group specification. Base worked fine in my experiments - my service had been started even before main GINA interface had shown login dialog, even in XP which is well known slow goer in aspect of initializing services.

M**
June 27th, 2008, 05:46 AM
Hi Igor Vartanov,

thank you for your post.
I have done what you have wrote, but it doesn't work.
SC_HANDLE hService = ::CreateService(hSCM, m_szServiceName, m_szServiceName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, szFilePath, "Base", NULL, NULL, NULL, NULL ); With this change it takes a littel bit longer before the main GINA interface hade shown the login dialog, but not more.
Can you give me your sample code?

M**

Igor Vartanov
June 27th, 2008, 07:33 AM
Can you give me your sample code?Sure :)

sc.exe create "My Service 0" type= own start= auto group= Base binPath= "<full_path>"

Afraid, your problem may be SERVICE_INTERACTIVE_PROCESS flag. :)

M**
June 30th, 2008, 07:14 AM
Hi Igor Vartanov,

my service started before the logon now.
But how can I get it that the GUI of the programm my service started is on top?

M**

Igor Vartanov
June 30th, 2008, 10:12 AM
Sorry, I'm not sure I understand your question. Please try to re-phrase it.

M**
July 1st, 2008, 01:37 AM
My service starts a program. I would like that this program is displayed before the logon. At the moment it is displayed after the logon.

or in other words

I have a virtual keyboard. I'm looking for a way to use this keyboard for the logon. At the moment the keyboard is hidden before the logon.

M**

Igor Vartanov
July 1st, 2008, 03:41 AM
My service starts a program.
You have to CreateProcessXxx within specific session, window station and on current input desktop. Learn the corresponding topics in MSDN.