CheckAndSavePKey is failing

Hi. I'm having a problem, trying to activate a Hackintosh computer.I really don't know if it's a Hackintosh problem or not, however, here is the issue.

When I call HRESULT hr = CheckAndSavePKey(data_serial, TA_USER);

hr is always TA_FAIL

What should I do? Thank you.

If you're already activated then CheckAndSavePKey() will fail. Check IsActivated(). If you want to use a new product key then you have to Deactivate() first.

Hi, Thanks for the Reply.

as far as I knew the Computer has never been activated before. (the trial has now expired on that computer) Anyway I checked HRESULT pf = IsActivated(kSPGuid);and the result is TA_FAIL

And I'm still having the same issue, with CheckAndSavePKey

Well, then whatever you're passing into CheckAndSavePKey() is invalid. Let me see what "data_serial" is. Just do a plain old UTF8 string (char*) on Unix, and a WideString (wchar_t*) on Windows.

I'm using this code:

-(BOOL)activateSerial:(NSString*)serial{ char *data_serial = (char *)malloc((serial_length+1)*sizeof(char)); [serial getCString:data_serial maxLength:serial_length+1 encoding:NSUTF8StringEncoding];

the NSString has the correct key. I tried NSLog(@"data_serial %s",data_serial);And It prints the correct key too.

Objective-C is not my strong suit -- I honestly have no idea what is happening there. Just hardcode the string like this:

hr = CheckAndSavePKey("YOUR-SERIAL_HERE", TA_USER);

Tell me if it works. If so, then you know whatever that code is it's not generating a properly null-terminated char* string.

Thank you very much. It did work, which is pretty strange anyway because It is basically the same string, and I've been using that code for more than a year, but... as you said, it may be something with the Null terminated character or I don't know. I'll dig deeper and if I found something I'll publish it here. Thanks again