cwbCO_GetUserIDEx

Purpose

This function gets the current user ID that is associated with a specified system object. This is the user ID that is being used for connections to the iSeries™ server.

Syntax

UINT CWB_ENTRY cwbCO_GetUserIDEx(
                              cwbCO_SysHandle    system,
                              LPSTR              userID,
                              PULONG             length );

Parameters

cwbCO_SysHandle system - input
Handle returned previously from cwbCO_CreateSystem or cwbCO_CreateSystemLike. It identifies the iSeries system.
LPSTR userID - output
Pointer to a buffer that will contain the NULL-terminated user ID. The user ID will be at most CWBCO_MAX_USER_ID characters long.
PULONG length - input/output
Pointer to the length of the userID buffer. If the buffer is too small to hold the user ID, including space for the terminating NULL, the size of the buffer needed will be filled into this parameter.

Return Codes

The following list shows common return values.

CWB_OK
Successful completion.
CWB_INVALID_API_HANDLE
Invalid system handle.
CWB_INVALID_POINTER
One of the pointer parameters passed in is NULL.
CWB_BUFFER_OVERFLOW
The userID buffer is not large enough to hold the entire user ID name.

Usage

The user ID may or may not have been validated on the iSeries system yet. To make sure it has been, call cwbCO_Signon or cwbCO_Connect before calling this API.

If no user ID has been set and a signon has not occurred for the system object, the returned user ID will be the empty string, even if a default user ID has been configured for the iSeries system.