The NetAliasAdd API creates an alias definition.
Restrictions
This API can be called from DLS and OS/2 workstations, but DLS workstations can issue this call only to a remote LAN Server workstation. This remote call can also be issued to an OS/2 Warp Server or Directory and Security Server workstation.
A successful call to NetAliasAdd requires one of the following:
#include <netcons.h>#include <dcdb.h> #include <lsdceerr.h> /* DSS only */ NetAliasAdd(pszTarget, sLevel, buf, usBuflen); /* 16 bit */ Net32AliasAdd(pszTarget, ulLevel, buf, ulBuflen, pStatusbuf); /* 32 bit */Parameters
See Common Parameter Definitions for descriptions of parameters not defined here.
pszTarget
null or \\servername
For DSS, see Alias Level 2 or Alias Level 12.
The following table lists the return codes most significant to this API.
(See API Return Codes for a complete
list of return codes.) ┌───────────────────────────┬───────┬──────────────────────────────────────────┐│SYMBOLICCONSTANT
│VALUE│MEANING │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_FILE_NOT_FOUND │ 2 │ The file was not found. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_TOO_MANY_OPEN_FILES │ 4 │ The maximum number of open files was
│
│ │ │ exceeded. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_ACCESS_DENIED │ 5 │ Administrator privilege is required. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_NOT_ENOUGH_MEMORY │ 8 │ Sufficient memory is not available.
│
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_INVALID_DATA │ 13 │ The specified data is not valid. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_INVALID_LEVEL │ 124 │ The sLevel parameter is not valid. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_BAD_PATHNAME │ 161 │ Path name not valid. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_BufTooSmall │ 2123 │ The buffer is too small for fixed-length
│
│ │ │ data. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_InvalidAPI │ 2142 │ The requested API is not supported on
│
│ │ │ the remote server. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_AliasExists │ 2782 │ The alias to be added already exists.
│
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_DCDBError │ 2786 │ A domain control database is unreadable
│
│ │ │ or cannot be accessed at this time. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_NotPrimaryDCDB │ 2795 │ An attempt was made to access a domain
│
│ │ │ control database file on a machine that │
│ │ │ is not the domain controller. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_DCEError │ 7500 │ DCE error status returned. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_DCEErrorLogged │ 7501 │ DCE error status has been logged.
│
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_ResDomNotfound │ 7503 │ The specified resource domain does not
│
│ │ │ exist. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_InvalidObjGlobalName │ 7504 │ The specified object global name is
not │
│ │ │ valid. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_InvalidResDomName │ 7505 │ The specified resource domain name
is │
│ │ │ not valid. │
└───────────────────────────┴───────┴──────────────────────────────────────────┘
Other codes could be returned from the following functions:
An alias that is created with an ai2_mode value of ALIAS_MODE_STARTUP is not shared by the NetAliasAdd API. Refer to Share - NetShareAdd for information about sharing resources.
For information about: