Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: ProcessSerialNumber on PPC vs Intel, byte swapping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ProcessSerialNumber on PPC vs Intel, byte swapping



It seems like a bug in the way the Process Manager or whatever (CPS) packs the PSN into the CFDictionary.

Since it seems like a bug or oversight to me, I'd get the pid from the CFDictionary and call GetProcessForPID() to get the PSN.

And of course, there are better ways to get the current PSN. Like GetProcessForPID(0) or GetCurrentProcess() unless I am missing something.

Ack, at 3/14/07, Sean McBride said:

>It seems to me that the real problem is that the NSDictionary stores
the PSN as a UInt64 instead of as a pair of UInt32s.

I guess. Or that the dictionary is storing it as a big endian UInt64 instead of native endianness. So I suppose the solution is to use CFSwapInt64BigToHost() like so:

 	NSDictionary*	currDict = (NSDictionary*)
    ProcessInformationCopyDictionary (&currPSN,
      kProcessDictionaryIncludeAllInformationMask);

 	unsigned long long	temp =
    [[currDict objectForKey:@"PSN"] unsignedLongLongValue];
  temp = CFSwapInt64BigToHost (temp); // NEW

Does that seem best?

--


Sincerely, Rosyna Keller Technical Support/Carbon troll/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >ProcessSerialNumber on PPC vs Intel, byte swapping (From: "Sean McBride" <email@hidden>)
 >Re: ProcessSerialNumber on PPC vs Intel, byte swapping (From: John Stiles <email@hidden>)
 >Re: ProcessSerialNumber on PPC vs Intel, byte swapping (From: "Sean McBride" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.