Components of an Integrated Link Service Configuration DLL

The link service configuration DLL must export the following functions:

Exported function Purpose
CommandLineAdd Called from LinkCfg or SnaCfg to parse command-line input.
ConfigAdd Called from LinkCfg or SnaCfg to add the link service from binary configuration information output from CommandLineAdd or from the configuration file.
ConfigureLinkService Called from SNA Manager to add or modify a link service.
ConfigureLinkServiceEx Called from SNA Manager to add or modify a link service, returning a configuration buffer to be added to the configuration file.
DisplayHelpInfo Return a buffer containing command-line syntax for this type of link service.
FormatSnaCfgOutput Format binary configuration information for output to either a command window or a redirected text file. This can be used to build an SnaCfg command file.
RemoveLinkService Called from SNA Manager to remove a link service.
RemoveAllLinkServices Called from Setup to remove all instances of this link service.

The sample linkcfg.cpp DLL is written in C++ using the Microsoft Foundation Classes (MFC) and uses a single property sheet with two property pages as follows:

The two property pages are linked to the link service property sheet in linkcfg.cpp within the ConfigureLS routine. This function is called by the exported ConfigureLinkService and ConfigureLinkServiceEx routines in linkcfg.cpp. An actual link service configuration DLL developed from these sources may require more property pages depending on the information needed to configure the actual link service DLL.

The registry.h include file used by linkcfg.cpp contains a global definition of the registry entries required for the sample generic SDLC link service. The values in this structure will be modified to contain the actual information specified by the user. This structure is added to the registry when a new link service is configured, and this structure is removed when a link service is deleted. The registry values that a developer must modify include the Link Registry Base entry (LINKSERVICE is used in the sample include file), the name of the device driver root (GenSdlc is used in the sample include file and source code), and various software and service registry settings appropriate for the target link service.

Several of the exported link service DLL functions use a configuration buffer, the CONFIG_BUFFER structure defined in linkcfg.h. The format of any CONFIG_BUFFER used by developers must match the structure format of this sample file for the first three parameters. Other parameters may differ for a developer's version of the CONFIG_BUFFER structure based on the target link service.

The sample link service configuration DLL calls a set of general utility functions that are not specific to any target link service. These utility functions are included in a lnktools library (lnktool.cpp) that is linked in as an OBJ file. This lnktools library includes the following utility functions that are useful in developing link service configuration DLLs:

Utility function Purpose
AddPerfmonCounters Add perfmon counters for this link service.
bCreateService Create a service on a computer.
bDeleteService Delete a service on a computer.
bStopService Stop a service running on a computer.
CheckForExistingLinkService Check to see if a link service of this type exists with this title.
ConvertHexStringToDWORD Convert a hexadecimal string to a DWORD value.
ExtractNextParameter Get the next parameter from a buffer.
fAddRegistryEntry Add a new registry value to the registry.
fCanWeAdministerRemoteBox Determine if the user has administrative privileges on the remote computer.
fConnectRegistry Connect to a remote computer's registry and return a handle to the remote registry.
fDisconnectRegistry Disconnect from a remote computer's registry.
fFindAndReplaceString Find and replace a substring within a string.
fFindString Determine if a string exists within a string buffer.
fFindStringInMultiSZ Find a string in a REG_MULTI_SZ string list and return entire string.
fQueryRegistryValue Query a value from the registry.
fRegistryKeyExists Test whether a registry key exists.
fRemoveRegistryEntry Remove a registry key.
fRemoveRegistryValue Remove a registry value.
fStringCompare Determine if two strings compare.
LoadStringResource Load a string from the string resource.
ParseNextField Return the next field from a string.
RemovePerfmonCounters Remove perfmon counters for this link service.
ReturnString Return a pointer to a string resource string.

The sample source code for a generic SDLC link service configuration DLL (linkcfg) includes several functions that may be useful as sample code when developing link service configuration DLLs for other hardware. The following functions are included in the linkcfg.cpp source code that may be of use as examples:

Utility function Purpose
bDetectNetworkCard Detect the remote network card and return the card settings buffer for the sample generic SDLC link service.
bLastGenericDFTLinkService Check for the last generic SDLC link service for the sample generic SDLC link service. This routine is used to determine if the GENSDLC Device Driver (if one existed) can be removed.
ConfigureLS The common link service configuration function used by the sample generic SDLC link service.
fAddAllRegistryValues Add all registry values for the sample generic SDLC link service.
fAddClassAndBindformRegistries Add the "class" and "bindform" registry entries for the sample generic SDLC link service. The bindform and class registry entries can only exist for the first link service of this type.
fEnumerateEventLogSources Enumerate the Event Log sources registry value for the sample generic SDLC link service.
fRemoveAllRegistryValues Remove all registry values for the sample generic SDLC link service.
fReplaceAllRegistryValues Replace all user-provided information in the registry data for the sample generic SDLC link service.
fReplaceRegistryData Replace global registry data for the sample generic SDLC link service.
fReplaceRegistryKeyName Replace global registry structure strings for the registry key name for the sample generic SDLC link service.
fSetupGlobalValues Create or update all user-provided information in the registry data structure for the sample generic SDLC link service.
InitializeGlobalStructure Initialize link service data contained in the global data structure for the sample generic SDLC link service.