NETAPI.LIB
NETAPI.LIB is the import library for the OS/2 LAN Manager-compatible Network Administration API, distributed with the IBM OS/2 Developer's Toolkit. It provides linker stubs for the IBM LAN Server / OS/2 Warp LAN Services network API implemented in NETAPI.DLL.
File size in the OS/2 Warp 4.52 Toolkit 4.5: 25,600 bytes (2001-09-14). Source DLL: NETAPI.DLL.
NETAPI.DLL is compatible with the Microsoft LAN Manager 2.x API specification. It provides remote-procedure-call-based functions for user account management, shared resources, server administration, sessions, groups, messaging, audit logs, and workstation control — all operable against local or remote IBM LAN Server / OS/2 Warp servers.
Calling Convention
All Net* API functions follow these conventions:
- Function names are in uppercase with no leading underscore (e.g.
NetUserGetInfois exported asNETUSERGETINFO). - Calling convention is PASCAL (
_Pascal/APIENTRY): parameters pushed left-to-right, callee cleans the stack. - The first parameter of most functions is
pszServer— a pointer to a server name string in UNC format (e.g.\\\\SERVER1). Passing NULL or an empty string targets the local computer. - All functions return an
API_RET_TYPE(unsigned short): 0 (NERR_Success) on success, or a LAN Manager error code in theNERR_*range (2100–5999) or a standard OS/2 error code (1–99). - Enumeration functions use a double-ended information-level model: the caller specifies a
sLevelinteger (0, 1, 2, …) to select the data structure size and detail to return.
Include Files
| Header | Contents |
|---|---|
netcons.h |
Core LAN Manager constants: UNCLEN, CNLEN, UNLEN, path length limits, MAX_PATH, NERR_Success
|
neterr.h |
All NERR_* error code definitions (NERR_Success=0, NERR_BASE=2100)
|
netbios.h |
NetBIOS constants and NCB structure for direct NetBIOS access
|
access.h |
access_info_*, access_list_* structures; ACCESS_* permission bit constants
|
alert.h |
STD_ALERT, ADMIN_OTHER_INFO, ERRLOG_OTHER_INFO, PRINT_OTHER_INFO, USER_OTHER_INFO alert data structures
|
audit.h |
audit_entry structure; AE_* audit event type constants
|
chardev.h |
chardev_info_*, chardevQ_info_* structures
|
config.h |
config_info_0 structure
|
connection.h |
connection_info_* structures
|
errlog.h |
error_log structure
|
group.h |
group_info_*, group_users_info_* structures
|
message.h |
msg_info_* structures; messenger service constants
|
remutil.h |
time_of_day_info structure
|
server.h |
server_info_* structures; SV_* type constants
|
service.h |
service_info_* structures; SERVICE_* status constants
|
session.h |
session_info_* structures
|
shares.h |
share_info_* structures; STYPE_* share type constants
|
stats.h |
stat_workstation_*, stat_server_* statistics structures
|
use.h |
use_info_* structures; USE_* connection type constants
|
user.h |
user_info_* structures; UF_* user flags; AF_* logon assignment flags
|
wksta.h |
wksta_info_* structures; WKSTA_* constants
|
lmerr.h |
Compatibility alias for neterr.h
|
API Groups
Access Control
Controls per-resource (file/directory/print queue) access control lists (ACLs) on the LAN Server.
NetAccessAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Creates a new ACL entry for a resource path.
sLevel=0 usesaccess_info_0(path only);sLevel=1 usesaccess_info_1(path + ACL entries withACCESS_*permission bits).
NetAccessDel(pszServer, pszResource)- Removes the ACL for a resource.
NetAccessEnum(pszServer, pszBasePath, fsRecursive, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates ACLs under
pszBasePath.fsRecursive=TRUE descends subdirectories.
NetAccessGetInfo(pszServer, pszResource, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns the ACL for a specific resource.
NetAccessSetInfo(pszServer, pszResource, sLevel, pbBuffer, cbBuffer, parmnum)- Updates an existing ACL.
parmnum=PARMNUM_ALL replaces the entire ACL; individual parm numbers update specific fields.
NetAccessCheck(pszReserved, pszUserName, pszResource, usOperation, pusResult)- Checks whether a named user has a specified permission (
ACCESS_READ,ACCESS_WRITE,ACCESS_CREATE,ACCESS_EXEC,ACCESS_DELETE,ACCESS_ATRIB,ACCESS_PERM) on a resource. Fills*pusResultwith the access decision.
NetAccessGetUserPerms(pszServer, pszUGname, pszResource, pusPerms)- Returns the effective permission mask for a specific user or group on a resource.
NetAccessApply(pszServer, pszResource, sLevel, pbBuffer, cbBuffer)- Applies an ACL to a resource, creating it if it does not exist.
Access permission constants
| Constant | Bit | Meaning |
|---|---|---|
ACCESS_READ |
0x01 | Read file/directory contents |
ACCESS_WRITE |
0x02 | Write to file/directory |
ACCESS_CREATE |
0x04 | Create files/subdirectories |
ACCESS_EXEC |
0x08 | Execute programs |
ACCESS_DELETE |
0x10 | Delete files/subdirectories |
ACCESS_ATRIB |
0x20 | Change file attributes |
ACCESS_PERM |
0x40 | Change permissions (administer) |
ACCESS_ALL |
0x7F | All permissions |
ACCESS_NONE |
0x00 | No permissions (explicit deny) |
Alerts
The alert facility allows server components and services to broadcast administrative notifications to listening alert names.
NetAlertRaise(pszEvent, pbBuffer, cbBuffer, ulTimeout)- Sends an alert of type
pszEvent(e.g.ALERT_ADMIN_EVENT,ALERT_ERRORLOG_EVENT,ALERT_MESSAGE_EVENT,ALERT_PRINT_EVENT,ALERT_USER_EVENT).pbBuffercontains aSTD_ALERTheader followed by event-specific data.
NetAlertStart(pszEvent, pszRecipient, cbMaxData)- Registers the calling process as a recipient for alerts of the named type.
NetAlertStop(pszEvent, pszRecipient)- Deregisters a previously registered alert recipient.
Aliases
LAN Server directory aliases expose a UNC share under an alternate name.
NetAliasAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Creates a new alias.
sLevel=0:alias_info_0(name only);sLevel=1:alias_info_1(name + target + comment + permissions).
NetAliasDel(pszServer, pszAliasName)- Removes an alias.
NetAliasEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates all aliases on the server.
NetAliasGetInfo(pszServer, pszAliasName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a specific alias.
NetAliasSetInfo(pszServer, pszAliasName, sLevel, pbBuffer, cbBuffer, parmnum)- Modifies an alias.
Applications
LAN Server application management — registered applications that appear in the LAN Server workplace objects.
NetAppAdd,NetAppDel,NetAppEnum,NetAppGetInfo,NetAppSetInfo- Standard add/delete/enumerate/get/set pattern for registered applications.
Audit
Reads and manages the server audit trail.
NetAuditClear(pszServer, pszBackupFile, pszService)- Clears the audit log, optionally backing it up to
pszBackupFile.
NetAuditOpen(pszServer, phAudit, pszService)- Opens the server audit log for sequential reading. Returns a handle.
NetAuditRead(pszServer, pszService, phAudit, ulOffset, pbBuffer, cbBuffer, poffset, pcbReturned)- Reads audit records from the log. Each record is an
audit_entrystructure with anae_typefield (AE_SRVSTATUS,AE_SESSLOGON,AE_SESSLOGOFF,AE_SESSPWERR,AE_CONNSTART,AE_CONNSTOP,AE_CONNREJ,AE_RESACCESS,AE_RESACCESSREJ,AE_CLOSEFILE,AE_SERVICESTAT,AE_ACLMOD,AE_UASMOD,AE_NETLOGON,AE_NETLOGOFF,AE_NETLOGDENIED,AE_ACCLIMITEXCD,AE_LOCKOUT,AE_ADMINUNLOCK).
NetAuditWrite(sType, pbBuffer, cbBuffer, pszService, pbReserved)- Writes an application-defined audit record to the server audit log.
NetBIOS
Direct access to the NetBIOS interface layer.
NetBiosOpen(pszDevName, pszReserved, usOpenOpt, phDevName)- Opens a NetBIOS device (e.g.
NET1:,NET2:) for use withNetBiosSubmit.usOpenOpt:NB_REGULARorNB_PRIVILEGED.
NetBiosClose(hDevName, usReserved)- Closes a NetBIOS device handle.
NetBiosEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates available NetBIOS LAN adapters and their configuration.
NetBiosGetInfo(pszServer, pszNetBiosName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a specific NetBIOS adapter.
NetBiosSubmit(hDevName, usNcbOpt, pNCB)- Submits a Network Control Block (NCB) to the NetBIOS driver. The
NCBstructure specifies the command (NCBCALL,NCBLISTEN,NCBHANGUP,NCBSEND,NCBRECV,NCBADDNAME, etc.), buffer, name, and session number. This is the primary function for direct NetBIOS programming without sockets.
Character Devices
Serial and parallel port sharing.
NetCharDevControl(pszServer, pszDevName, usOpCode)- Controls a shared character device (e.g.
CHARDEV_CLOSEto force-disconnect a user from the device).
NetCharDevEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates shared character devices on the server.
NetCharDevGetInfo(pszServer, pszDevName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a shared character device.
NetCharDevQEnum,NetCharDevQGetInfo,NetCharDevQPurge,NetCharDevQPurgeSelf,NetCharDevQSetInfo- Manage character device queues. Queues hold requests from multiple users waiting for a device.
Purgeremoves all pending requests;PurgeSelfremoves only the caller's requests.
Configuration
NetConfigGet(pszServer, pszReserved, pszComponent, pszParameter, pbBuffer, cbBuffer, pcbTotalAvail)- Reads a single configuration parameter from a component's section (e.g. component
"LanServer", parameter"maxusers") from the IBMLAN.INI configuration file.
NetConfigGetAll(pszServer, pszReserved, pszComponent, pbBuffer, cbBuffer, pcbTotalAvail)- Reads all parameters for a component section.
NetConfigGet2- Extended version supporting additional parameter types and remote access.
Connections
NetConnectionEnum(pszServer, pszQualifier, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates active connections to the server or to a specific share or client.
pszQualifiermay be a share name (e.g."APPS") or a computer name (e.g."\\\\CLIENT1"). Returnsconnection_info_0(connection ID only) orconnection_info_1(full detail: user, share, connection type, open files, connection time).
DASD (Disk Quotas)
IBM LAN Server DASD management controls per-user disk space quotas.
NetDasdAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Creates a DASD (disk quota) entry for a user.
NetDasdCheck(pszServer, pszPath)- Checks whether DASD controls are in effect for a path.
NetDasdCtl(pszServer, pszPath, sLevel, pbBuffer, cbBuffer, ulAction)- Performs a control operation (enable, disable, query) on DASD for a path.
NetDasdDel(pszServer, pszPath, pszUserName)- Removes a DASD entry.
NetDasdEnum(pszServer, pszPath, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates DASD entries.
NetDasdGetInfo,NetDasdSetInfo- Get/set DASD quota values for a user on a path.
Error Log
NetErrorLogClear(pszServer, pszBackupFile, pszReserved)- Clears the server error log, optionally writing a backup copy.
NetErrorLogOpen(pszServer, phErrorLog, pszReserved)- Opens the server error log for reading.
NetErrorLogRead(pszServer, pszReserved, phErrorLog, ulOffset, pbBuffer, cbBuffer, poffset, pcbReturned)- Reads error log entries. Each entry is an
error_logstructure.
NetErrorLogWrite(pszReserved, usCode, pszComponent, pbBuffer, cbBuffer, pszStrBuf, cStrBuf, pszReserved2)- Writes an error log entry. Used by services and drivers to record errors.
Files
NetFileClose(pszServer, ulFileId)- Forcibly closes an open file on the server (identified by file ID from
NetFileEnum).
NetFileEnum(pszServer, pszBasePath, pszUserName, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail, phEnum)- Enumerates files currently open on the server.
sLevel=2 returnsfile_info_2(file ID only);sLevel=3 returnsfile_info_3(ID + permissions + lock count + path + user).
NetFileGetInfo(pszServer, ulFileId, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a specific open file.
Groups
NetGroupAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Creates a new user group.
sLevel=0:group_info_0(name only);sLevel=1:group_info_1(name + comment).
NetGroupDel(pszServer, pszGroupName)- Deletes a group and removes all its user memberships.
NetGroupEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates all groups.
NetGroupGetInfo(pszServer, pszGroupName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns group information.
NetGroupSetInfo(pszServer, pszGroupName, sLevel, pbBuffer, cbBuffer, parmnum)- Updates group attributes.
NetGroupAddUser(pszServer, pszGroupName, pszUserName)- Adds a user to a group.
NetGroupDelUser(pszServer, pszGroupName, pszUserName)- Removes a user from a group.
NetGroupGetUsers(pszServer, pszGroupName, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Returns the list of users in a group.
NetGroupSetUsers(pszServer, pszGroupName, sLevel, pbBuffer, cbBuffer, cEntries)- Replaces the complete membership list of a group.
Messages (Messenger Service)
Sends pop-up messages to users and workstations on the network. Requires the Messenger service to be running.
NetMessageBufferSend(pszServer, pszRecipient, pszReserved, pbBuffer, cbBuffer)- Sends a text message to a named recipient (user name, computer name, or alias).
NetMessageFileSend(pszServer, pszRecipient, pszReserved, pszFileName)- Sends the contents of a file as a message to a recipient.
NetMessageNameAdd(pszServer, pszMessageName, pszReserved)- Registers a message alias name on the workstation for receiving messages.
NetMessageNameDel(pszServer, pszMessageName, pszReserved)- Removes a registered message name.
NetMessageNameEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates registered message names.
NetMessageNameFwd(pszServer, pszMessageName, pszForwardName, pszReserved)- Forwards messages addressed to
pszMessageNametopszForwardName.
NetMessageNameGetInfo(pszServer, pszMessageName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a registered message name.
NetMessageNameUnFwd(pszServer, pszMessageName, pszReserved)- Cancels a forwarding set by
NetMessageNameFwd.
NetMessageLogFileGet/NetMessageLogFileSet- Get/set the file path to which received messages are appended.
Profiles
NetProfileLoad(pszProfile, pszPassword)- Loads a LAN Server user profile (reconnects drives and printers defined in the profile).
NetProfileSave(pszProfile, pszPassword)- Saves the current set of redirected resources to a named profile file.
Remote Utilities
NetRemoteCopy(pszSourcePath, pszDestPath, pszSourcePassword, pszDestPassword, fsOpen, fsCreate, usFlags)- Copies a file between two servers (or between a server and the local machine) using the LAN Server file copy API.
NetRemoteExec(pszReserved, pszServerName, pbEnv, pszCmdLine, psRedir, pszInFile, psExecBuf)- Remotely executes a command on a LAN Server machine.
NetRemoteMove(pszSourcePath, pszDestPath, pszSourcePassword, pszDestPassword, fsOpen, fsCreate, usFlags)- Moves (renames across servers) a file.
NetRemoteTOD(pszServer, pbBuffer, cbBuffer)- Returns the time of day from a remote server's clock. The buffer receives a
time_of_day_infostructure with fields for elapsed seconds, hundredths, timezone offset, hours, minutes, seconds, day, month, year, weekday.
NetRemoteTODSet(pszServer, pbBuffer, cbBuffer)- Sets the time on a remote server (privileged operation).
Server
NetServerEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail, flServerType, pszDomain)- Enumerates servers on the network filtered by
flServerTypebitmask:
| Constant | Value | Meaning |
|---|---|---|
SV_TYPE_WORKSTATION |
0x00000001 | LAN Manager workstation |
SV_TYPE_SERVER |
0x00000002 | LAN Manager server |
SV_TYPE_SQLSERVER |
0x00000004 | SQL Server |
SV_TYPE_DOMAIN_CTRL |
0x00000008 | Primary domain controller |
SV_TYPE_DOMAIN_BAKCTRL |
0x00000010 | Backup domain controller |
SV_TYPE_TIME_SOURCE |
0x00000020 | Time source server |
SV_TYPE_AFP |
0x00000040 | AppleTalk Filing Protocol server |
SV_TYPE_PRINTQ_SERVER |
0x00000200 | Print queue server |
SV_TYPE_DIALIN_SERVER |
0x00000400 | Dial-in server |
SV_TYPE_ALL |
0xFFFFFFFF | All server types |
NetServerGetInfo(pszServer, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a server.
sLevel=0 (name), 1 (+ version, type, comment), 2 (+ active sessions, users, disk info), 3 (+ security settings).
NetServerSetInfo(pszServer, sLevel, pbBuffer, cbBuffer, parmnum)- Sets server configuration parameters such as the server comment, auto-disconnect time, and auditing flags.
NetServerDiskEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Enumerates disk drives on the server.
NetServerAdminCommand(pszServer, pszCommand, pReturnStatus, pbBuffer, cbBuffer, pcbTotalAvail)- Executes a LAN Server administrative command string on a remote server.
NetServerNameAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Adds an alternate server name (alias).
NetServerNameDel(pszServer, pszServerName)- Removes a server name alias.
NetServerNameEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Lists all names (primary and aliases) of a server.
Services
NetServiceControl(pszServer, pszService, usOpCode, usArg, pbBuffer, cbBuffer)- Sends a control code to a running LAN service.
usOpCode:SERVICE_CTRL_INTERROGATE(query status),SERVICE_CTRL_PAUSE,SERVICE_CTRL_CONTINUE,SERVICE_CTRL_UNINSTALL, or an application-defined code.
NetServiceEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Lists all installed services and their status.
NetServiceGetInfo(pszServer, pszService, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns status information for a named service. Status codes:
SERVICE_UNINSTALLED,SERVICE_INSTALL_PENDING,SERVICE_UNINSTALL_PENDING,SERVICE_INSTALLED,SERVICE_PAUSED.
NetServiceInstall(pszServer, pszService, pszCmdArgs, pbBuffer, cbBuffer)- Starts a named LAN service, passing optional command-line arguments.
NetServiceStatus(pbBuffer, cbBuffer)- Called by a service itself to report its current status to the service controller. Used during startup (
SERVICE_INSTALL_PENDING) and when acknowledging control requests.
Sessions
NetSessionDel(pszServer, pszClientName, pszUserName)- Forcibly terminates a session from a client computer.
NetSessionEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Lists active sessions.
sLevel=0 (client name only); 1 (+ user, opens, time, idle time, password-encrypted flag); 2 (+ client type string).
NetSessionGetInfo(pszServer, pszClientName, pszUserName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a specific session from a named client.
NetShareAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Creates a new shared resource.
sLevel=2:share_info_2— name, type (STYPE_DISKTREE,STYPE_PRINTQ,STYPE_DEVICE,STYPE_IPC), comment, permissions, max users, current users, path, password.
NetShareDel(pszServer, pszNetName, usReserved)- Removes a shared resource.
NetShareEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Lists all shares on a server.
NetShareGetInfo(pszServer, pszNetName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a specific share.
NetShareSetInfo(pszServer, pszNetName, sLevel, pbBuffer, cbBuffer, parmnum)- Updates share attributes (comment, max users, permissions, password).
NetShareCheck(pszServer, pszDeviceName, pusType)- Checks whether a device path is shared and returns its share type.
Statistics
NetStatisticsGet(pszServer, pszService, ulReserved, usLevel, flOptions, pbBuffer, cbBuffer, pcbTotalAvail)- Returns network statistics.
pszService="WORKSTATION"returnsstat_workstation_0;"SERVER"returnsstat_server_0.
NetStatisticsClear(pszServer, pszService, ulReserved, flOptions)- Resets statistical counters.
Workstation statistics include: bytes received/transmitted, SMBs received/transmitted, read/write operations, raw reads/writes, network errors, connections made, reconnections, server disconnects, sessions started/failed, use counts, failed use counts.
Server statistics include: bytes received/sent, SMBs received/sent, file opens/device opens/print opens, jobs queued, bytes read/written, errors: access permissions/grant/system, password violations, file/lock/network I/O errors, sessions started/failed/broken, session reconnects.
Use (Redirected Resources)
NetUseAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Connects a local drive letter or device name to a remote shared resource (UNC path).
sLevel=1:use_info_1— local name (e.g."G:"), UNC remote name (e.g."\\\\SERVER\\SHARE"), password, server name, use type (USE_DISKDEV,USE_SPOOLDEV,USE_CHARDEV,USE_IPC), open files count, flags.
NetUseDel(pszServer, pszUseName, usForceLevel)- Disconnects a redirected resource.
usForceLevel:USE_NOFORCE(fail if files open),USE_FORCE(close open files),USE_LOTS_OF_FORCE(close and delete cached credentials).
NetUseEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Lists all current redirected resources.
NetUseGetInfo(pszServer, pszUseName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about a specific redirection.
Users
The user account API manages accounts in the User Accounts System (UAS) database.
NetUserAdd(pszServer, sLevel, pbBuffer, cbBuffer)- Creates a new user account.
sLevel=1:user_info_1(name, password, password age, privilege, home directory, comment, flags, script path).sLevel=2:user_info_2(adds full name, logon hours, logon workstations, max storage, expiry date, logon server, country code, code page). Privilege levels:USER_PRIV_GUEST(0) — limited guest accountUSER_PRIV_USER(1) — standard userUSER_PRIV_ADMIN(2) — administrator
NetUserDel(pszServer, pszUserName)- Deletes a user account.
NetUserEnum(pszServer, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Lists all user accounts.
NetUserGetInfo(pszServer, pszUserName, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns account details for a specific user. Level 10 returns a reduced set (name, comment, user comment, full name) suitable for non-privileged queries.
NetUserSetInfo(pszServer, pszUserName, sLevel, pbBuffer, cbBuffer, parmnum)- Updates user account attributes.
NetUserPasswordSet(pszServer, pszUserName, pszOldPassword, pszNewPassword)- Changes a user's password. Non-privileged users can change only their own password and must supply the correct old password.
NetUserModalsGet(pszServer, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns global user account policy: minimum password length, maximum password age, minimum password age, forced logoff time, uniqueness count.
NetUserModalsSet(pszServer, sLevel, pbBuffer, cbBuffer, parmnum)- Updates global user account policy.
NetUserGetGroups(pszServer, pszUserName, sLevel, pbBuffer, cbBuffer, pcEntriesRead, pcTotalAvail)- Returns the list of groups to which a user belongs.
NetUserSetGroups(pszServer, pszUserName, sLevel, pbBuffer, cbBuffer, cEntries)- Replaces a user's complete group membership list.
NetUserValidate(pszServer, sLevel, pbBuffer, cbBuffer)- Validates a username/password pair and optionally retrieves logon script and home directory information.
NetUserGetLogonAsn/NetUserSetLogonAsn- Get/set logon assignment (which server a user logs on to by default).
NetUserGetAppSel/NetUserSetAppSel- Get/set the application selection list associated with a user account in LAN Server's application management system.
NetUserInit- Initializes the User Accounts System for local access. Must be called before UAS functions are used without a running LAN Server.
NetUserDCDBInit- Initializes the Domain Controller database for a server.
Workstation
NetWkstaGetInfo(pszServer, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about the local (or remote) workstation.
sLevel=1: computer name, username, LAN group/domain, version numbers, root path.sLevel=10: adds logged-on user details and domain/server name.
NetWkstaSetInfo(pszServer, sLevel, pbBuffer, cbBuffer, parmnum)- Updates workstation configuration (comment, character wait, collection time, max collection count, keep connection setting, max commands, session timeout, etc.).
NetWkstaSetUID/NetWkstaSetUID2/NetWkstaSetUIDU- Set the user identity (logon credentials) for the workstation.
NetWkstaLogon2(pszServer, pszReserved, sLevel, pbBuffer, cbBuffer)- Performs an interactive logon for a workstation user.
NetWkstaLogoff2(pszServer, pszReserved, sLevel, pbBuffer, cbBuffer)- Performs a workstation logoff.
NetWkstaUserLogon/NetWkstaUserLogoff- Logon/logoff for a user from a workstation session (non-interactive).
NetWkstaAnnounce(usApplType, pbBuffer, cbBuffer)- Broadcasts a workstation's presence on the network (used during startup to join the browsing list).
NetWkstaInit2(pszReserved, sLevel, pbBuffer, cbBuffer)- Initializes the workstation component of the LAN Manager redirector.
RIPL (Remote IPL)
Remote Initial Program Load allows diskless workstations to boot from the server:
NetCreateRIPLMachine, NetDeleteRIPLMachine, NetEnumRIPLMachine, NetGetRIPLMachineInfo, NetSetRIPLMachineInfo
Each machine record associates a hardware network address (MAC address) with a boot disk image and configuration profile stored on the server.
RAM Semaphores
NetRamSemRequest(psmSem, lTimeOut)- Requests ownership of a LAN-aware RAM semaphore with a timeout.
NetRamSemClear(psmSem)- Releases a RAM semaphore.
NetFsRamSemRequest/NetFsRamSemClear- File-system-level RAM semaphore variants for use in file server contexts.
Handle Information
NetHandleGetInfo(handle, sLevel, pbBuffer, cbBuffer, pcbTotalAvail)- Returns information about an open network handle (file or print job).
NetHandleSetInfo(handle, sLevel, pbBuffer, cbBuffer, parmnum)- Sets attributes on an open network handle (e.g. read-ahead hint, pipe state).
Workgroup (W*) Functions
The W-prefixed variants are workgroup-mode equivalents for IBM LAN Server's peer networking services (IBM LAN Server Entry / DOS LAN Services compatible mode). They operate on peer workgroup databases rather than a domain controller's UAS:
WGroupAdd, WGroupAddUser, WGroupDel, WGroupDelUser, WGroupEnum, WGroupGetInfo, WGroupGetUsers, WGroupSetInfo, WGroupSetUsers
WUserAdd, WUserAdd2, WUserDel, WUserEnum, WUserGetGroups, WUserGetInfo, WUserModalsGet, WUserModalsSet, WUserPasswordSet, WUserPasswordSet2, WUserSetGroups, WUserSetInfo, WUserSetInfo2
WMessageBufferSend, WMessageFileSend, WMessageNameAdd, WMessageNameDel, WMessageNameGetInfo
WServiceEnum, WServiceGetInfo
WNetBiosEnum
WWkstaGetInfo
Internal Functions
Functions prefixed I_ are internal implementation functions not intended for direct application use. They are exported for inter-component use between LAN Server services, the redirector, and the UAS:
I_CryptPass, I_GetNetAccHandle, I_GetSetUserPassHist, I_GetUserPassword, I_IAmServer, I_InitServerApi, I_NetAccessEnum, I_NetAdminProcessRegister, I_NetAliasEnum, I_NetCalloutCall, I_NetCalloutDump, I_NetCalloutEnum, I_NetDasdEnum, I_NetDasdEnumTerminate, I_NetDasdSetInfo2, I_NetErrorLogWrite, I_NetGetCdNames, I_NetLanProbe, I_NetListCanonicalize, I_NetListTraverse, I_NetLogonDomainAdd, I_NetLogonDomainDel, I_NetNameCanonicalize, I_NetNameCompare, I_NetNameValidate, I_NetPathCanonicalize, I_NetPathCompare, I_NetPathType, I_NetPopup, I_NetRamSemInit, I_NetServerEnum, I_NetServerEnum2, I_NetServiceEnum, I_NetServiceGetInfo, I_NetSetLocalUser, I_NetShareAdd, I_NetSSIGetInfo, I_NetUserCache, I_NetUserCacheGetInfo, I_NetUserEnum2, I_NetUserLogonCheck, I_NetUserPurge, I_NetUserRemoteLogonCheck, I_NetUserSetInfo, I_NetUserValidate2, I_NetWriteChangeLog, I_SecSyncClear, I_SecSyncSet, I_TerminateActiveEnums
Usage
IBM VisualAge C++ / ILINK
icc -O2 -Gm -c myapp.c ilink /PM:VIO myapp.obj os2386.lib netapi.lib
OpenWatcom
wcl386 -bt=os2 -mf -c myapp.c wlink system os2v2 file myapp.obj library os2386.lib library netapi.lib
EMX/GCC
gcc -Zomf -c myapp.c gcc -Zomf -o myapp.exe myapp.o -los2386 -lnetapi
#define INCL_NETERRORS
#define INCL_NETSHARE
#include <lan.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pszServer = (argc > 1) ? argv[1] : NULL;
char *pbBuf;
unsigned short cbBuf = 4096;
unsigned short cRead = 0;
unsigned short cTotal = 0;
pbBuf = malloc(cbBuf);
unsigned short rc = NetShareEnum(pszServer, 1,
pbBuf, cbBuf,
&cRead, &cTotal);
if (rc == NERR_Success || rc == ERROR_MORE_DATA) {
struct share_info_1 *p = (struct share_info_1 *)pbBuf;
unsigned short i;
for (i = 0; i < cRead; i++, p++) {
printf("%-15s %-20s %s\n",
p->shi1_netname,
(p->shi1_type == STYPE_DISKTREE) ? "[Disk]" :
(p->shi1_type == STYPE_PRINTQ) ? "[Print]" :
(p->shi1_type == STYPE_IPC) ? "[IPC]" : "[Other]",
p->shi1_remark ? p->shi1_remark : "");
}
if (rc == ERROR_MORE_DATA)
printf("... and %u more entries.\n", cTotal - cRead);
} else {
printf("NetShareEnum error %u\n", rc);
}
free(pbBuf);
return 0;
}
Error Codes
| Constant | Value | Meaning |
|---|---|---|
NERR_Success |
0 | No error |
NERR_NetNotStarted |
2102 | LAN Manager services not started |
NERR_UnknownServer |
2103 | Server name not found |
NERR_ShareNotFound |
2204 | Share does not exist |
NERR_UserNotFound |
2221 | User account not found |
NERR_GroupNotFound |
2220 | Group not found |
NERR_ACFNotFound |
2219 | Access control file not found |
NERR_PasswordTooShort |
2245 | Password too short for policy |
NERR_BadPassword |
2203 | Invalid password |
NERR_ServiceNotInstalled |
2184 | Specified service not installed |
ERROR_MORE_DATA |
234 | Buffer too small; partial data returned — reallocate and retry, or use pcTotalAvail
|
ERROR_ACCESS_DENIED |
5 | Caller does not have administrative privilege |
Version History
| Version | Product | Date | Notes |
|---|---|---|---|
| 2.x | IBM LAN Manager for OS/2 / LAN Server 1.x | 1988–1990 | Initial API compatible with Microsoft LAN Manager 2.0: users, groups, shares, sessions, files, messages, services, workstation. |
| 3.x | IBM LAN Server 3.0 | 1992 | Added DASD quotas, aliases, RIPL, application management, domain controller replication functions (I_Net*), audit expanded.
|
| 4.x | IBM LAN Server 4.0 / OS/2 Warp Connect | 1994–1995 | Added workgroup (W*) peer functions for LAN Server Entry. Callout API for third-party authentication. Enhanced statistics. |
| 5.x (final) | IBM LAN Server 5.0 / OS/2 Warp Server for e-business | 1999–2001 | Final IBM release. Security synchronization (I_SecSync*), user cache functions. File in Toolkit 4.5: 25,600 bytes (2001-09-14).
|