Running Windows Services

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
duja
Level 1
Level 1
Posts: 6
Joined: Thu Mar 19, 2009 8:43 am

Running Windows Services

Post by duja »

Im trying to run a windows service application with wine (downloaded with apt on Debian 4.0, I believe its 1.0.1).

The application can install itself by typing "wine app.exe -install". This will return a successfull message saying that the app is installed as a service.

When I try to start (wine net start app) the service it says that its already running, which is not.

I've looked in the documentation/wiki/forum but haven't found anything that describing how to start/stop a service etc.

Am I doing it the right way? Any tip would be helpful!

/ E
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Running Windows Services

Post by vitamin »

duja wrote:Am I doing it the right way?
Yes. Use 'ps x' to verify if it's running or not. Also try with newer Wine version.
duja
Level 1
Level 1
Posts: 6
Joined: Thu Mar 19, 2009 8:43 am

Post by duja »

Should I see it running as a seperate app like if I start my service named "app" should I then see app.exe in the "ps x" -list?

EDIT: Is there anyway in wine to see all the installed services?
Martin Gregorie

Running Windows Services

Post by Martin Gregorie »

On Thu, 2009-03-19 at 09:50 -0500, duja wrote:
Should I see it running as a seperate app like if I start my service named "app" should I then see app.exe in the "ps x" -list?
Yes, if you're logged in as the same user.

ps -u user

shows all processes for 'user', and

ps -ef

shows all processes on the computer. I find

ps -ef | grep progname

a useful command. It lists all processes and filters that list with grep
to show onlt the process(es) you're interested in. It produces one or
more lines. One is the grep process itself and the others are the
processes you wanted to know about. If you use it a lot, write a small
script:

========start of filterps script file =========
#!/bin/bash
ps -ef | grep $1
========end of filterps script file =========

Put it in the search path and make it executable:

cp filterps /usr/local/bin
chmod uga+rx filterps

and to run it:

filterps app

/usr/local/bin is usually your the search path.


Martin
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

duja wrote:Should I see it running as a seperate app like if I start my service named "app" should I then see app.exe in the "ps x" -list?
Yes, as well as few Wine own processes (explorer.exe, wineserver, etc).
duja wrote:EDIT: Is there anyway in wine to see all the installed services?
The only way for now is to look under this registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services]

Some entries are not services however but just some registry data. You should for entries with "DisplayName".
duja
Level 1
Level 1
Posts: 6
Joined: Thu Mar 19, 2009 8:43 am

Post by duja »

Thanks for the answers :)

Here's what I've done.

I looked in [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services] and did see that the service is installed.

When I try to start the service with the following:

Code: Select all

user@computer03:~/.wine/drive_c/$ wine net start App
The App service is starting.
Service already running
and when I look in the ps list I cant find it, obviously its NOT started :/
  • user 4146 1 0 09:09 ? 00:00:01 /home/user/.wine/drive_c/windows/regedit.exe
    user 4151 1 0 09:09 ? 00:00:01 /usr/lib/wine/wineserver
    user 4154 1 0 09:09 ? 00:00:00 C:\windows\system32\services.exe
    user 4158 4154 0 09:09 ? 00:00:00 C:\windows\system32\winedevice.exe MountMgr
    user 4166 1 0 09:09 ? 00:00:00 C:\windows\system32\explorer.exe /desktop
    root 4288 2845 0 09:15 ? 00:00:00 [bandwidthd] <defunct>
    root 4337 2844 0 09:18 ? 00:00:00 [bandwidthd] <defunct>
    user 4340 3746 0 09:20 pts/0 00:00:00 ps -ef
When i try to stop it:

Code: Select all

user@computer03:~/.wine/drive_c/Program Files/user/Monitor$ wine net stop App
The App service is stopping.
fixme:service:EnumDependentServicesA 0x11a5b8 0x00000001 (nil) 0x00000000 0x33ee08 0x33ee04 - stub
Invalid service control
I can run my app in console mode but I really need it as a service.

Any ideas?
duja
Level 1
Level 1
Posts: 6
Joined: Thu Mar 19, 2009 8:43 am

Post by duja »

bump :)
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

duja wrote:bump :)
Why do you need it as service? If it runs from console - then run it that way.
duja
Level 1
Level 1
Posts: 6
Joined: Thu Mar 19, 2009 8:43 am

Post by duja »

Its designed to run as a service and has features that uses the Service-ability. I could run it in console-mode but that would force us to change the application design. It would be smooth to have the same application on windows and linux and not change the application code/design.

But it seems that running it as a service is a bit tricky, it doesn't just run :/

Fyi,
this is what I get when installing the service:
fixme:advapi:DeregisterEventSource (0xcafe4242) stub
although it installs ok.

It also looks like that the first time when I do net start I get a access denied like this:

Code: Select all

$ wine net start App
The App service is starting.
Access denied
Any ideas on what could cause this behaviour?
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

duja wrote:$ wine net start App
The App service is starting.
It tells me the service started successfully. However keep in mind Wine will kill all services if there are no other apps left running.
austin987
Wine Developer
Wine Developer
Posts: 2383
Joined: Fri Feb 22, 2008 8:19 pm

Running Windows Services

Post by austin987 »

On Mon, Mar 23, 2009 at 9:07 AM, vitamin <[email protected]> wrote:
duja wrote:
$ wine net start App
The App service is starting.
It tells me the service started successfully. However keep in mind Wine will kill all services if there are no other apps left running.
To avoid that, run 'wine notepad' or 'wine winemine' to keep a small
program running.

--
-Austin
duja
Level 1
Level 1
Posts: 6
Joined: Thu Mar 19, 2009 8:43 am

Post by duja »

I tried to run it as you said, with "wine winemine" running and then starting the server. But it didn't work :/
Btw, why does wine kill the service if no wine app is running? Shouldnät a service run in the background like in Windows?

/ E
austin987
Wine Developer
Wine Developer
Posts: 2383
Joined: Fri Feb 22, 2008 8:19 pm

Running Windows Services

Post by austin987 »

On Fri, Mar 27, 2009 at 3:40 AM, duja <[email protected]> wrote:
Btw, why does wine kill the service if no wine app is running? Shouldnät a service run in the background like in Windows?
Wine isn't a complete OS. It's a compatibility layer to run your applications.

--
-Austin
Locked