Important: The information in this document is obsolete and should not be used for new development.
GetDefaultUser
TheGetDefaultUserfunction returns the user reference number and the name of the default user.
FUNCTION GetDefaultUser (VAR userRef: LongInt; VAR userName: Str32): OSErr;
userRef- If the
GetDefaultUserfunction completes with no errors, then theuserRefparameter 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 thePPCStartfunction to initiate a session with an application that does not support guest access.If the
GetDefaultUserfunction completes with no errors, then theuserRefparameter returns the user reference number that represents the user name and password of the default user. TheuserNameparameter must containNILor a 32-byte character string. If theuserNameparameter containsNIL, then the user name string is not returned. If theuserNameparameter 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 theGetDefaultUserfunction completes (with no errors).
- WARNING
- If you are using Pascal, you cannot pass
NILfor theuserNameparameter. For example, you cannot passStringPtr(NIL)^because Pascal performs range checking of string bounds.![]()
ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theGetDefaultUserfunction are
Trap macro Selector _PPC $000D The registers on entry and exit for this routine are
Registers on entry A0 Pointer to a GetDefaultUserParamsrecordD0 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 theGetDefaultUserfunction, see Listing 11-20 on page 11-45.