Win32::Daemon

Win32::Daemon

am 20.12.2007 12:10:03 von Ferry Bolhar

Good day,

has anyone experience with the modulen named in the subject, especially
with its SetServiceBits() function?

A service can use this function to declare a computer as "responsible"
for a specific task (for example, as a Microsoft SQL Server) by setting
a particular bit given as argument. There are, however, 10 bits available
for user-specific purpopes.

I want to use this function to register systems on which a special service
is installed. Using the Win32::NetAdmin::GetServers() function, I could
then specify the approbiate bit in its $flag argument to obtain just a list
of systems on which my service is installed:

In my service:

use Win32::Daemon;
....
Win32::Daemon::SetServiceBits(USER_SERVICE_BITS_1);

In the script to lookup for systems running my service:

use Win32::NetAdmin;
use Win32::Daemon;
my $dom = 'Wien1';
my $pdc = 'MASTER';
Win32::NetAdmin::GetServers($pdc, $dom, USER_SERVICE_BITS_1, \my @servers);

In my service code, I can invoke SetServiceBits() without problems.
The function returns 1, indicating success.

However, when running the above lookup script, I get no error, but the
@servers array remains empty, indicating that the system on which my
service is running wasn't found.

What's wrong here? Have I made a mistake?

In addition, can someone explain the purpose of the Win32::Daemon

ShowService() and
HideService()

functions?

Many thanks for your answers & kind greetings,

--
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: ferdinand.bolhar-nordenkampf@wien.gv.at