Re: Checking for Hackintosh
Re: Checking for Hackintosh
- Subject: Re: Checking for Hackintosh
- From: Scott Lahteine <email@hidden>
- Date: Wed, 30 Jul 2008 14:34:39 -0400
Hi,
There are a couple of ways to definitively test for a hackintosh. You
could look at the IO Registry for unusual hardware configurations. But
as it happens, the latest Hackintosh kernels all use custom Machine
Type strings. So you can test to see if it's one of the known Mac
models, and if it isn't you can assume it's probably a Hackintosh.
Unfortunately, this breaks if future Macs introduce new Machine Type
strings, which is almost certain. You'll notice I'm not testing for
AppleTV, for example, because I don't happen to know its string.
The following is what I use in "TabletMagic" to detect a TabletPC :
- (BOOL)detectHackintosh
{
SInt32 gestaltReturnValue;
BOOL is_known_mac = NO;
if (!Gestalt(gestaltUserVisibleMachineName, &gestaltReturnValue))
{
char *known_machines[] =
{"AAPL","iMac","PowerBook","PowerMac","RackMac",
"Macmini","MacPro","MacBookPro","MacBook"};
StringPtr pmach = (StringPtr)gestaltReturnValue;
int i, len = pmach[0];
char *machine_string = (char*)malloc(len+2);
strncpy(machine_string, (char*)&pmach[1], len+1);
for (i=sizeof(known_machines)/sizeof(known_machines[0]); i--;)
if (!strncmp(machine_string, known_machines[i],
strlen(known_machines[i]))) { is_known_mac = YES; break; }
free(machine_string);
}
if (is_known_mac)
{
// delete the tab having identifier "6"
[ tabview removeTabViewItem: [ tabview tabViewItemAtIndex:
[ tabview indexOfTabViewItemWithIdentifier: @"6" ] ] ];
}
return !is_known_mac;
}
--
Scott Lahteine Thinkyhead Software
email@hidden http://www.thinkyhead.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden