Important: The information in this document is obsolete and should not be used for new development.
GetDefaultUser
TheGetDefaultUser
function returns the user reference number and the name of the default user.
FUNCTION GetDefaultUser (VAR userRef: LongInt; VAR userName: Str32): OSErr;
userRef
- If the
GetDefaultUser
function completes with no errors, then theuserRef
parameter returns the user reference number that represents the user name and password of the default user.userName
- The name of the default user.
DESCRIPTION
The default user is specified in the Sharing Setup control panel. This function is useful if your application uses thePPCStart
function to initiate a session with an application that does not support guest access.If the
GetDefaultUser
function completes with no errors, then theuserRef
parameter returns the user reference number that represents the user name and password of the default user. TheuserName
parameter must containNIL
or a 32-byte character string. If theuserName
parameter containsNIL
, then the user name string is not returned. If theuserName
parameter is a 32-byte character string, the 32-byte character string contains the user name that is specified in the Sharing Setup control panel when theGetDefaultUser
function completes (with no errors).
- WARNING
- If you are using Pascal, you cannot pass
NIL
for theuserName
parameter. For example, you cannot passStringPtr(NIL)^
because Pascal performs range checking of string bounds.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theGetDefaultUser
function are
Trap macro Selector _PPC $000D The registers on entry and exit for this routine are
Registers on entry A0 Pointer to a GetDefaultUserParams
recordD0 Selector code
Registers on exit D0 Result code RESULT CODES
noErr 0 No error noDefaultUserErr -922 User has not specified owner name in Sharing Setup control panel notLoggedInErr -923 Default user reference number does not yet exist SEE ALSO
For an example of the use of theGetDefaultUser
function, see Listing 11-20 on page 11-45.