On Sep 27, 2004, at 2:11 PM, Sean Arney wrote:
That probably would work out nicely - the Mac is more the issue as far
as Im concerned... I am sure as GAMoore said, there are ways to do it,
but I just havent had time to dig it up yet. Any ideas for OSX?
Without using declares, you can get a lot of useful information... for
example, you can use the REALbasic System.Gestalt() function to access
some properties directly from the OS.
Take a look at this Apple Developer page which gives an overview of the
Gestalt OS calls:
http://developer.apple.com/documentation/mac/OSUtilities/OSUtilities
-10.html
More specifics at:
http://developer.apple.com/documentation/mac/OSUtilities/OSUtilities
-11.html
Gestalt items such as listed below might be used to determine the
uniqueness of the system.
gestaltLogicalRAMSize = 'lram'; {logical RAM size}
gestaltPhysicalRAMSize = 'ram '; {physical RAM size}
gestaltNativeCPUtype = 'cput'; {native CPU type}
gestaltKeyboardType = 'kbd '; {keyboard type code}
gestaltSlotAttr = 'slot'; {slot attributes}
gestaltHardwareAttr = 'hdwr'; {hardware attributes}
gestaltMachineType = 'mach'; {Macintosh model code}
gestaltROMSize = 'rom '; {ROM size}
gestaltROMVersion = 'romv'; {ROM version}
Other such tricks can be the physical size of the primary hard drive
and the hard drive Creation Date (captured via FolderItem). There is
also a 'MacVRefNum' property for FolderItem which according to the
language reference will return the "Macintosh volume reference number
(Mac only)"; but I haven't tried to use it. Another trick is to
compare the Absolute Path of the program (App.Executable.AbsolutePath).
Normally, an AbsolutePath is not very practical (because
drive/directory/file names can change), but it might be useful as part
of a test of variables.
If you have 6 items that you use to check against, you might require
that at least 4 match what is stored in your preference file -- if not,
then you require the user to enter the serial number again.
I used the following code:
Dim gstalt(), gstaltname(), result as String
Dim gstaltrtn as Integer
Dim k as Integer
gstalt = Array("lram", "ram ", "cput", "kbd ", "slot", "hdwr",
"mach", "rom ", "romv")
gstaltname() = Array("logical RAM size", "physical RAM size", "native
CPU type", _
"keyboard type code", "slot attributes", "hardware attributes",
"Macintosh model code", _
"ROM size", "ROM version")
For k = 0 To 8
If System.Gestalt(gstalt(k), gstaltrtn) Then
result = result + gstaltname(k) + " = " + Str(gstaltrtn) +
EndOfLine
End If
Next
Me.Text = result
Gives me the following output on a Powerbook G4:
logical RAM size = 2.147480e+9
physical RAM size = 5.368709e+8
native CPU type = 268
keyboard type code = 195
And on a Dual G5 2.0 Ghz:
logical RAM size = 2.147480e+9
physical RAM size = 1.073742e+9
native CPU type = 313
keyboard type code = 204
So some of the Gestalt values no longer work (too bad), but from the
main list you might find others that would work for you.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|