Home   Index   About
Ultimate Pack


Custom Search
Overview
Group
Quick Info

Windows NT
Yes
Win95
No
Win32s
Yes
Import Library
advapi32.lib
Header File
lmserver.h
Unicode
No
Platform Notes
None

SetServiceBits

The SetServiceBits function registers a service's service type with the Service Control Manager and the Server service. The Server service can then announce the registered service type as one it currently supports. The LAN Manager functions NetServerGetInfo and NetServerEnum obtain a specified machine's supported service types.

A service type is represented as a set of bit flags; the SetServiceBits function sets or clears combinations of those bit flags.

BOOL SetServiceBits(

SERVICE_STATUS_HANDLE hServiceStatus,
// service status handle
DWORD dwServiceBits,
// service type bits to set or clear
BOOL bSetBitsOn,
// flag to set or clear the service type bits
BOOL bUpdateImmediately
// flag to announce server type immediately
);

Parameters

hServiceStatus

A handle to the Service Control Manager's status information structure for a service. A service obtains a SERVICE_STATUS_HANDLE value by calling the RegisterServiceCtrlHandler function. It is the service's handle for making calls to the Service Control Manager.

dwServiceBits

A set of bit flags that specifies a service type.

Certain bit flags (0xC00F3F7B) are reserved for use by Microsoft. The SetServiceBits function fails with the error ERROR_INVALID_DATA if any of these bit flags are set in dwServiceBits. There are 18 of these bit flags:

Bit Flag Constant
Value
SV_TYPE_WORKSTATION
  1. x00000001
SV_TYPE_SERVER
  1. x00000002
SV_TYPE_DOMAIN_CTRL
0x00000008
SV_TYPE_DOMAIN_BAKCTRL
0x00000010
SV_TYPE_TIME_SOURCE
0x00000020
SV_TYPE_AFP
0x00000040
SV_TYPE_DOMAIN_MEMBER
0x00000100
SV_TYPE_PRINTQ_SERVER
0x00000200
SV_TYPE_DIALIN_SERVER
0x00000400
SV_TYPE_XENIX_SERVER
0x00000800
SV_TYPE_SERVER_UNIX
0x00000800
SV_TYPE_NT
0x00001000
SV_TYPE_WFW
0x00002000
SV_TYPE_POTENTIAL_BROWSER
0x00010000
SV_TYPE_BACKUP_BROWSER
0x00020000
SV_TYPE_MASTER_BROWSER
0x00040000
SV_TYPE_DOMAIN_MASTER
0x00080000
SV_TYPE_LOCAL_LIST_ONLY
0x40000000
SV_TYPE_DOMAIN_ENUM
0x80000000

Certain bit flags (0x00300084) are defined by Microsoft, but are not specifically reserved for systems software. There are four of these bit flags:

Bit Flag Constant
Value
SV_TYPE_SV_TYPE_SQLSERVER
0x00000004
SV_TYPE_NOVELL
0x00000080
SV_TYPE_DOMAIN_CTRL
0x00100000
SV_TYPE_DOMAIN_BAKCTRL
0x00200000

Certain bit flags (0x3FC0C000) are not defined by Microsoft, and their use is not coordinated by Microsoft. Developers of applications that use these bits should be aware that other applications may also use them, thus creating a conflict. There are 10 of these bit flags:

Value
Value
0x00004000
0x02000000
0x00008000
0x04000000
0x00400000
0x08000000
0x00800000
0x10000000
0x01000000
0x20000000

bSetBitsOn

A BOOLEAN that specifies whether the function is to set or clear the bit flags that are set in dwServiceBit. The value TRUE specifies that the bits are to be set; FALSE specifies clearing.

bUpdateImmediately

A BOOLEAN that specifies whether the Server service is to perform an immediate update, announcing the new service type. The value TRUE specifies an immediate update; FALSE specifies otherwise.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

See Also

NetServerGetInfo
, NetServerEnum, RegisterServiceCtrlHandler, SetServiceStatus


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2011 Free Tech Secrets ;) greatis just4fun network just4fun