<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Dienste auflisten]]></title><description><![CDATA[<p>Hallo!</p>
<p>Hab mich mal dran gemacht einen Dienste-Manager zu schreiben.</p>
<p>Leider hab ich ein Problem bei der Pramameterübergabe.</p>
<p>Wär nett wenn ihr mir helfen könntet.</p>
<p>Hier mal der Source:</p>
<pre><code class="language-cpp">enumservices(void);

int services(void)

{

enumservices();

	return 0;
}

int enumservices(void)
{
typedef struct _ENUM_SERVICE_STATUS {
  LPTSTR lpServiceName;
  LPTSTR lpDisplayName;
  SERVICE_STATUS ServiceStatus;
} ENUM_SERVICE_STATUS,
 *LPENUM_SERVICE_STATUS;

 LPDWORD pcbBytesNeeded;
 LPDWORD lpServicesReturned;
 LPDWORD lpResumeHandle;

SC_HANDLE schSCManager;

schSCManager = OpenSCManager( 
    NULL,                    
    NULL,                    
    SC_MANAGER_ALL_ACCESS); 

if (NULL == schSCManager) 
{return 1;}

EnumServicesStatusEx(schSCManager,SC_ENUM_PROCESS_INFO,
		                        SERVICE_WIN32,SERVICE_STATE_ALL,
		                         LPENUM_SERVICE_STATUS,sizeof(ENUM_SERVICE_STATUS),
		                          pcbBytesNeeded,lpServicesReturned,lpResumeHandle,NULL);

return 0;
}
</code></pre>
<p>und hier die Fehlermeldungen:</p>
<pre><code>Illegal use of type name 'LPENUM_SERVICE_STATUS'.
Type error in argument 5 to a function; found 'struct _ENUM_SERVICE_STATUS *' expected 'unsigned char *'.
</code></pre>
<p>Ausserdem:<br />
Muss ich beim struct ein struct array deklarieren?</p>
<p>Hoffe ihr könnt mir helfen, mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/172877/dienste-auflisten</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 06:34:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/172877.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Feb 2007 09:43:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 09:43:01 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Hab mich mal dran gemacht einen Dienste-Manager zu schreiben.</p>
<p>Leider hab ich ein Problem bei der Pramameterübergabe.</p>
<p>Wär nett wenn ihr mir helfen könntet.</p>
<p>Hier mal der Source:</p>
<pre><code class="language-cpp">enumservices(void);

int services(void)

{

enumservices();

	return 0;
}

int enumservices(void)
{
typedef struct _ENUM_SERVICE_STATUS {
  LPTSTR lpServiceName;
  LPTSTR lpDisplayName;
  SERVICE_STATUS ServiceStatus;
} ENUM_SERVICE_STATUS,
 *LPENUM_SERVICE_STATUS;

 LPDWORD pcbBytesNeeded;
 LPDWORD lpServicesReturned;
 LPDWORD lpResumeHandle;

SC_HANDLE schSCManager;

schSCManager = OpenSCManager( 
    NULL,                    
    NULL,                    
    SC_MANAGER_ALL_ACCESS); 

if (NULL == schSCManager) 
{return 1;}

EnumServicesStatusEx(schSCManager,SC_ENUM_PROCESS_INFO,
		                        SERVICE_WIN32,SERVICE_STATE_ALL,
		                         LPENUM_SERVICE_STATUS,sizeof(ENUM_SERVICE_STATUS),
		                          pcbBytesNeeded,lpServicesReturned,lpResumeHandle,NULL);

return 0;
}
</code></pre>
<p>und hier die Fehlermeldungen:</p>
<pre><code>Illegal use of type name 'LPENUM_SERVICE_STATUS'.
Type error in argument 5 to a function; found 'struct _ENUM_SERVICE_STATUS *' expected 'unsigned char *'.
</code></pre>
<p>Ausserdem:<br />
Muss ich beim struct ein struct array deklarieren?</p>
<p>Hoffe ihr könnt mir helfen, mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225525</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 09:43:01 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 09:52:18 GMT]]></title><description><![CDATA[<p>schau dir die parameter nochmal genau an<br />
<a href="http://msdn2.microsoft.com/fr-fr/library/ms682640.aspx" rel="nofollow">http://msdn2.microsoft.com/fr-fr/library/ms682640.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225535</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Fri, 09 Feb 2007 09:52:18 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:14:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke hab ich, hab jetzt den Structname mal auf _ENUM_SERVICE_STATUS_PROCESS geändert aber das eigentliche Problem finde ich nicht da ich nicht schlauer als zuvor aus diesen Beschreibungen (MSDN) werde.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225549</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:14:57 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:24:55 GMT]]></title><description><![CDATA[<p>k, sry habs gesehen, ich selbst soll einen Buffer zur Verfügung stellen.</p>
<p>danke,mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225561</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:24:55 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:25:48 GMT]]></title><description><![CDATA[<p>Kannst du mir trotzdem ob dieser buffer irgendwie speziell beschaffen sein muss bzw wie ich später die dienste auslesen kann (aus dem buffer mein ich)?</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225562</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:25:48 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:27:04 GMT]]></title><description><![CDATA[<p>So wie ich das lese erwartet er als 5. Parameter einen Pointer zu einen Puffer. Guck mal was du übergibst? Das ist doch nen define oder sowas aus ner Header Datei <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Du musst Speicher für einen Puffer anlegen und diesen übergeben und als 6. Parameter die größe des Puffers.</p>
<p>MfG schirrmie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225564</guid><dc:creator><![CDATA[schirrmie]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:27:04 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:35:45 GMT]]></title><description><![CDATA[<p>achso,ja genau,pointer hab ich gemeint :),</p>
<p>dh einfach lpword/char[100000] reicht das?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225569</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:35:45 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:37:30 GMT]]></title><description><![CDATA[<p>Ich weiss leider sogar nicht wie ich das mit dem puffer handlen soll.</p>
<p>vor allem wieso legt man hier nicht strct arrays an sondern einen buffer??</p>
<p>und wie soll ich dann aus dem auslesen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225571</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:37:30 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 10:50:13 GMT]]></title><description><![CDATA[<p>lesen</p>
<p>msdn schrieb:</p>
<blockquote>
<p>lpServices<br />
[out] Pointer to the buffer that receives the status information. The format of this data depends on the value of the InfoLevel parameter.</p>
<p>The maximum size of this array is 256K bytes. To determine the required size, specify NULL for this parameter and 0 for the cbBufSize parameter. The function will fail and GetLastError will return ERROR_MORE_DATA. The pcbBytesNeeded parameter will receive the required size.</p>
<p>Windows Server 2003 and Windows XP: The maximum size of this array is 64K bytes. This limit was increased as of Windows Server 2003 SP1 and Windows XP SP2.</p>
</blockquote>
<p>als parameter erwartet er einen zeiger auf ein char array. bsp: char buffer[256];</p>
<p>Kazuum schrieb:</p>
<blockquote>
<p>und wie soll ich dann aus dem auslesen?</p>
</blockquote>
<p>zb: printf(&quot;bufferinhalt %s \n&quot;, buffer);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225584</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225584</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Fri, 09 Feb 2007 10:50:13 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 11:24:52 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>hab jetzt mal bei google/codesearch gsucht und is doch n struct array. char wär irgendwie auch zu umständlich gewesen.</p>
<p>aufjedenfall hab ich das mal erarbeitet und das Programm findet auch etwas nur leider wurde nur ein String richtig ausgegeben alle anderen haben kryptische Ausgaben.</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt; 
#include &lt;time.h&gt; 
#include &lt;windows.h&gt;
#include &lt;string.h&gt;

int listenupservices(void)
{
unsigned long int *i=0;

ENUM_SERVICE_STATUS buffer[100];

 LPDWORD pcbBytesNeeded=0;
 LPDWORD lpServicesReturned;
 LPDWORD lpResumeHandle=0;

SC_HANDLE schSCManager;

schSCManager = OpenSCManager( 
    NULL,                   
    NULL,                   
    SC_MANAGER_ALL_ACCESS);  

if (NULL == schSCManager) 
{return 1;}

EnumServicesStatusEx(schSCManager,SC_ENUM_PROCESS_INFO,
		     SERVICE_WIN32,SERVICE_STATE_ALL,
	            (LPBYTE)buffer,sizeof(ENUM_SERVICE_STATUS),
		     pcbBytesNeeded,lpServicesReturned,lpResumeHandle,0);

printf(&quot;%s&quot;,buffer[0].lpServiceName);

return 0;
}

int main()

{

listenupservices();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1225612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225612</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 11:24:52 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 11:33:54 GMT]]></title><description><![CDATA[<p>Kazuum schrieb:</p>
<blockquote>
<p>hab jetzt mal bei google/codesearch gsucht und is doch n struct array. char wär irgendwie auch zu umständlich gewesen.</p>
</blockquote>
<p>dann schau dir doch mal die struktur an und verrate mir was als erste im speicher steht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
<a href="http://msdn2.microsoft.com/en-us/library/ms682651.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms682651.aspx</a></p>
<p>dein buffer ist grösser, sprich</p>
<pre><code class="language-cpp">sizeof(ENUM_SERVICE_STATUS) * 100
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1225613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225613</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Fri, 09 Feb 2007 11:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 11:49:54 GMT]]></title><description><![CDATA[<p>k <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> dann haben wir eh das selbe gemeint, ich dachte es wäre gemeint NUR ein char buffer in den dann alles wie service status etc reingeschrieben werden.</p>
<p>Hmm hab das mal gemacht thx, aber wie vorhin gibt es noch immer so kryptische Strings.</p>
<p>Hab da echt keinen Plan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225621</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 11:49:54 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 12:51:04 GMT]]></title><description><![CDATA[<p>so habs mal verändert und durch den debugger geschickt.</p>
<p>Das interessante:</p>
<p>in den variablen werden tatsächlich viele dienste gespeichert jedoch oft nur einer der beiden Namen und oft auch unregelmäßig also manche dazwischenliegenden arrayelemente sind einfach leer.</p>
<p>Hier mal der Code:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;time.h&gt;
#include &lt;windows.h&gt;
#include &lt;string.h&gt;

int listenupservices(void)
{
int i=0;
int k=0;

ENUM_SERVICE_STATUS buffer[100];

unsigned long int pcbBytesNeeded=0;
unsigned long int lpServicesReturned;
unsigned long int lpResumeHandle;

SC_HANDLE schSCManager;

schSCManager = OpenSCManager(
    NULL,                  
    NULL,                  
    SC_MANAGER_ALL_ACCESS);  

if (NULL == schSCManager)
{return 1;}

EnumServicesStatusEx(schSCManager,SC_ENUM_PROCESS_INFO,
             SERVICE_WIN32,SERVICE_STATE_ALL,
             (char *)buffer,sizeof(buffer),
             &amp;pcbBytesNeeded,&amp;lpServicesReturned,&amp;lpResumeHandle,NULL);

 EnumServicesStatusEx(schSCManager,SC_ENUM_PROCESS_INFO,
             SERVICE_WIN32,SERVICE_STATE_ALL,
             (char *)buffer,sizeof(buffer),
             &amp;pcbBytesNeeded,&amp;lpServicesReturned,&amp;lpResumeHandle,NULL);                          

printf(&quot;%s&quot;,buffer[3].lpServiceName);

return 0;
}

int main ()

{

listenupservices();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1225664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225664</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Fri, 09 Feb 2007 12:51:04 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Fri, 09 Feb 2007 14:18:10 GMT]]></title><description><![CDATA[<p>*push* <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1225723</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225723</guid><dc:creator><![CDATA[Kazuu]]></dc:creator><pubDate>Fri, 09 Feb 2007 14:18:10 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Sat, 10 Feb 2007 07:00:54 GMT]]></title><description><![CDATA[<p>Echt keiner ne Idee wie man das richtig macht?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226050</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226050</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Sat, 10 Feb 2007 07:00:54 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Sat, 10 Feb 2007 19:08:23 GMT]]></title><description><![CDATA[<p>Naja ich weiss pushen nervt aber ich steck da echt in einer Sackgasse, natürlich spiel ich mich selbst auch damit aber bisjetzt bin ich noch nicht wirklich weitergekommen, daher bitte ich euch nochmal um Hilfe.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226430</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226430</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Sat, 10 Feb 2007 19:08:23 GMT</pubDate></item><item><title><![CDATA[Reply to Dienste auflisten on Sat, 10 Feb 2007 19:54:24 GMT]]></title><description><![CDATA[<p>hat sich erledigt- hab einfach enumservicestatus genommen.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226458</guid><dc:creator><![CDATA[Kazuum]]></dc:creator><pubDate>Sat, 10 Feb 2007 19:54:24 GMT</pubDate></item></channel></rss>