AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Why Cant Start A service.

Ein Thema von ZuBi · begonnen am 21. Jun 2005 · letzter Beitrag vom 20. Aug 2005
Antwort Antwort
Seite 1 von 2  1 2      
ZuBi

Registriert seit: 21. Jun 2005
8 Beiträge
 
#1

Why Cant Start A service.

  Alt 21. Jun 2005, 14:27
i wrote an service, now when trying to run him i get this:

Code:
C:\svch\dll>net start xmldrv
The Who care ha it service is starting.
The Who care ha it service could not be started.

A system error has occurred.

System error 127 has occurred.

The specified procedure could not be found.
i have regsitred service main and i dont know what couse that, did anyone mess with somthingg like this ?

Main code:

Code:
begin
installservice;
//uninstallservice;

FillChar(DispatchTable, SizeOf(DispatchTable), 0);
DispatchTable[0].lpServiceName:= PChar(S_Name);
DispatchTable[0].lpServiceProc:= @ServiceProc;
StartServiceCtrlDispatcher(DispatchTable[0]);
end.
what can be wrong ?
  Mit Zitat antworten Zitat
runger
(Gast)

n/a Beiträge
 
#2

Re: Why Cant Start A service.

  Alt 21. Jun 2005, 14:31
Hallo,

ich nehm mal an, dass deine Muttersprache deutsch ist, soviele Fehler kann ein Engländer niemals machen.
Bitte formuliere das ganze in deutsch!

rainer
  Mit Zitat antworten Zitat
Benutzerbild von alcaeus
alcaeus

Registriert seit: 11. Aug 2003
Ort: München
6.537 Beiträge
 
#3

Re: Why Cant Start A service.

  Alt 21. Jun 2005, 14:37
Hello rainer,

Zitat von runger:
ich nehm mal an, dass deine Muttersprache deutsch ist, soviele Fehler kann ein Engländer niemals machen.
Bitte formuliere das ganze in deutsch!
there are more localized versions of Delphi than just the German one. Therefore, it is easily possible that a French person would program with Delphi. However, English questions are accepted on this board to a certain extent, so I don't think there's a reason to go off like that.

@ZuBi: Are you sure that the problem is in the Code you posted? What does the installservice method do? I don't think that those 4 lines of code cause your service to crash

Greetz
alcaeus
Andreas B.
Die Mutter der Dummen ist immer schwanger.
Ein Portal für Informatik-Studenten: www.infler.de
  Mit Zitat antworten Zitat
21. Jun 2005, 14:37
Dieses Thema wurde von "alcaeus" von "Object-Pascal / Delphi-Language" nach "Windows API / MS.NET Framework API" verschoben.
Und ab zur WinAPI. Ist dort wohl besser aufgehoben.
ZuBi

Registriert seit: 21. Jun 2005
8 Beiträge
 
#5

Re: Why Cant Start A service.

  Alt 21. Jun 2005, 15:05
Zitat von alcaeus:
Hello rainer,

Zitat von runger:
ich nehm mal an, dass deine Muttersprache deutsch ist, soviele Fehler kann ein Engländer niemals machen.
Bitte formuliere das ganze in deutsch!
there are more localized versions of Delphi than just the German one. Therefore, it is easily possible that a French person would program with Delphi. However, English questions are accepted on this board to a certain extent, so I don't think there's a reason to go off like that.

@ZuBi: Are you sure that the problem is in the Code you posted? What does the installservice method do? I don't think that those 4 lines of code cause your service to crash

Greetz
alcaeus
i quite sure the problem is in there, there for i debug it

Delphi-Quellcode:
FillChar(DispatchTable, SizeOf(DispatchTable), 0);
DispatchTable[0].lpServiceName:= PChar(S_Name);
DispatchTable[0].lpServiceProc:= @ServiceProc;
If not StartServiceCtrlDispatcher(DispatchTable[0]) Then AddToMessageLog('StartServiceCtrlDispatcher error');
Log:
Code:
[16:02:13] StartServiceCtrlDispatcher error
its seems its not passing this so the problem comes from there, i tryed to see if its somthing with ServiceProc but when i put there a log, its ont wrting anything so its not getting to there, i am trying to implent service in a dll( is it other method ? ).

i know its to know the problem from this few lines i have posted, there for i will post all soon.

Ps: It seems it cant register the proc (@ServiceProc) so it cant find the procedure, i dont know why.

[edit=alcaeus]Replaced code-tags with delphi-tags. Mfg, alcaeus[/edit]
  Mit Zitat antworten Zitat
Olli
(Gast)

n/a Beiträge
 
#6

Re: Why Cant Start A service.

  Alt 23. Jun 2005, 21:02
Zitat von ZuBi:
i quite sure the problem is in there, there for i debug it

Delphi-Quellcode:
FillChar(DispatchTable, SizeOf(DispatchTable), 0);
DispatchTable[0].lpServiceName:= PChar(S_Name);
DispatchTable[0].lpServiceProc:= @ServiceProc;
If not StartServiceCtrlDispatcher(DispatchTable[0]) Then AddToMessageLog('StartServiceCtrlDispatcher error');
Straight from this code there's no obvious mistake!

Zitat von ZuBi:
Log:
Code:
[16:02:13] StartServiceCtrlDispatcher error
its seems its not passing this so the problem comes from there, i tryed to see if its somthing with ServiceProc but when i put there a log, its ont wrting anything so its not getting to there,
So control is not passed to the SCM?

Zitat von ZuBi:
i am trying to implent service in a dll( is it other method ? ).
I doubt that will work, since DLLs and PE/EXE files share only the structure but differ by many flags. The SCM was made to get control over an EXE file, not a DLL.

Zitat von ZuBi:
i know its to know the problem from this few lines i have posted, there for i will post all soon.

Ps: It seems it cant register the proc (@ServiceProc) so it cant find the procedure, i dont know why.
Could you please add a GetLastError() after the IF-condition and tell us the error code?! There must be one.
  Mit Zitat antworten Zitat
ZuBi

Registriert seit: 21. Jun 2005
8 Beiträge
 
#7

Re: Why Cant Start A service.

  Alt 30. Jun 2005, 01:12
Zitat von Olli:
Zitat von ZuBi:
i quite sure the problem is in there, there for i debug it

Delphi-Quellcode:
FillChar(DispatchTable, SizeOf(DispatchTable), 0);
DispatchTable[0].lpServiceName:= PChar(S_Name);
DispatchTable[0].lpServiceProc:= @ServiceProc;
If not StartServiceCtrlDispatcher(DispatchTable[0]) Then AddToMessageLog('StartServiceCtrlDispatcher error');
Straight from this code there's no obvious mistake!

Zitat von ZuBi:
Log:
Code:
[16:02:13] StartServiceCtrlDispatcher error
its seems its not passing this so the problem comes from there, i tryed to see if its somthing with ServiceProc but when i put there a log, its ont wrting anything so its not getting to there,
So control is not passed to the SCM?

Zitat von ZuBi:
i am trying to implent service in a dll( is it other method ? ).
I doubt that will work, since DLLs and PE/EXE files share only the structure but differ by many flags. The SCM was made to get control over an EXE file, not a DLL.

Zitat von ZuBi:
i know its to know the problem from this few lines i have posted, there for i will post all soon.

Ps: It seems it cant register the proc (@ServiceProc) so it cant find the procedure, i dont know why.
Could you please add a GetLastError() after the IF-condition and tell us the error code?! There must be one.
hello, the problem comes when trying to implent dll as service, it is possible and works at C. the SCM can control dll, as micrsoft doind it with loaders (svchost), there is no dubet the error comes when trying to reg the procedure, if i covert it to exe it works like it shuold, seince it dll and delphi doesnt speak with win like c, i tryd using stcall to make it like c, since nobody if its really works, its not. and i still cant make it as a service. the problem its possible becouse same thing works with c code posted artclie i saw some where. now can u sper few min and try slove it ? with code. u dont need alot just proc for install then to reg it(StartServiceCtrlDispatcher). if u want my codes let me know.
  Mit Zitat antworten Zitat
Olli
(Gast)

n/a Beiträge
 
#8

Re: Why Cant Start A service.

  Alt 30. Jun 2005, 10:06
Zitat von ZuBi:
hello, the problem comes when trying to implent dll as service, it is possible and works at C. the SCM can control dll, as micrsoft doind it with loaders (svchost), there is no dubet the error comes when trying to reg the procedure, if i covert it to exe it works like it shuold, seince it dll and delphi doesnt speak with win like c, i tryd using stcall to make it like c, since nobody if its really works, its not. and i still cant make it as a service. the problem its possible becouse same thing works with c code posted artclie i saw some where. now can u sper few min and try slove it ? with code. u dont need alot just proc for install then to reg it(StartServiceCtrlDispatcher). if u want my codes let me know.
Thanks for the hint. You are right. MS uses this method (starting with W2K or WXP) to run different services in different instances of "svchost.exe".

Can you please post the link to the article (with C code). Maybe it will bring the enlightening moment ... thanks.
  Mit Zitat antworten Zitat
ZuBi

Registriert seit: 21. Jun 2005
8 Beiträge
 
#9

Re: Why Cant Start A service.

  Alt 1. Jul 2005, 02:19
Zitat von Olli:
Zitat von ZuBi:
hello, the problem comes when trying to implent dll as service, it is possible and works at C. the SCM can control dll, as micrsoft doind it with loaders (svchost), there is no dubet the error comes when trying to reg the procedure, if i covert it to exe it works like it shuold, seince it dll and delphi doesnt speak with win like c, i tryd using stcall to make it like c, since nobody if its really works, its not. and i still cant make it as a service. the problem its possible becouse same thing works with c code posted artclie i saw some where. now can u sper few min and try slove it ? with code. u dont need alot just proc for install then to reg it(StartServiceCtrlDispatcher). if u want my codes let me know.
Thanks for the hint. You are right. MS uses this method (starting with W2K or WXP) to run different services in different instances of "svchost.exe".

Can you please post the link to the article (with C code). Maybe it will bring the enlightening moment ... thanks.
i am sorry but the article is down atm or deleted i will tr y to find u
anyway here is a link might help http://support.microsoft.com/?kbid=314056

first u create a service, then spfic it to svchost, and add feild called servicedll that has your dll
after that u just make the service - < not works

ps. i will try to reserch it again.. couse i need it too i am days on it and nothing.

{
// Articles:
// 1. HOWTO Create a service dll used by svchost.exe by bingle, at: http://www.BingleSite.net/article/sv...l-service.html
// 2. Inside Win32 Services, Part 2 by: Mark Russinovich, at: http://www.winnetmag.com/Articles/In...leID=8943&pg=3
// 3. Platform SDK: Tools - Rundll32, at: http://msdn.microsoft.com/library/en...s/rundll32.asp

}
  Mit Zitat antworten Zitat
Olli
(Gast)

n/a Beiträge
 
#10

Re: Why Cant Start A service.

  Alt 1. Jul 2005, 11:18
The perhaps most interesting thing (which you did wrong as well) is, that you MUST NOT use StartServiceCtrlDispatcher(). Actually this function does nothing more than passing the dispatcher function address to the SCM. The SCM calls it and the service EXE is no more than a "quasi-DLL" of the SCM from this point.

So this was your first mistake. You don't need to call this function because it is only needed if your service was located in an EXE file!

... to be continued ...
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz