PATH Documentation > Hardware

 

Computer Identification

Rather than reading the box flag or the model string and then making assumptions about the computer's features, applications that need to find out the features of the machine should use Gestalt calls to test for the features they require. Applications can also use the Name Registry with Mac OS 9 or the IORegistry with Mac OS X.

Asset management software that reports the kind of machine it is run on can obtain the value of the property at Devices:device-tree:compatible in the Name Registry. The model string is the first program-usable string in the array of C strings in the compatible field. For the iMac, the value of the string in the compatible property is PowerMac4,1 (the same as the current models).

The string obtained from the compatible property cannot be displayed to the computer user. If it is available, you can use the result from calling Gestalt ('mnam', &result) where result is a string pointer. This call returns a Pascal style string that can be displayed to the user.


 


© 2001 Apple Computer, Inc. (Last Updated October 24, 2001)