Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 11 - Program-to-Program Communications Toolbox / PPC Toolbox Reference
PPC Toolbox Routines / Locating a Default User and Invalidating a User


GetDefaultUser

The GetDefaultUser 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 the userRef 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 the PPCStart function to initiate a session with an application that does not support guest access.

If the GetDefaultUser function completes with no errors, then the userRef parameter returns the user reference number that represents the user name and password of the default user. The userName parameter must contain NIL or a 32-byte character string. If the userName parameter contains NIL, then the user name string is not returned. If the userName 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 the GetDefaultUser function completes (with no errors).

WARNING
If you are using Pascal, you cannot pass NIL for the userName parameter. For example, you cannot pass StringPtr(NIL)^ because Pascal performs range checking of string bounds.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the GetDefaultUser function are
Trap macroSelector
_PPC$000D

The registers on entry and exit for this routine are
Registers on entry
A0Pointer to a GetDefaultUserParams record
D0Selector code
Registers on exit
D0Result code

RESULT CODES
noErr0No error
noDefaultUserErr-922User has not specified owner name in Sharing Setup control panel
notLoggedInErr-923Default user reference number does not yet exist
SEE ALSO
For an example of the use of the GetDefaultUser function, see Listing 11-20 on page 11-45.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996