Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / February 2004



Tip: Looking for answers? Try searching our database.

[Q] How to get GUID(globally unique ID) in Mac OS 9 ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SOHN, DONG EON  ?'???? - 23 Feb 2004 07:30 GMT
Hi!

I want to get GUID in Mac OS 9 .
But, I didn't found any API that get GUID like CreateGUID in MS Windows.

How can I get GUID in Mac OS 9 ?

Let me know please....
Thorrsten Froehlich - 23 Feb 2004 11:40 GMT
> Hi!
>
> I want to get GUID in Mac OS 9 .
> But, I didn't found any API that get GUID like CreateGUID in MS Windows.
>
> How can I get GUID in Mac OS 9 ?

What exactly are you trying to do? I cannot think of any use for such
a thing as a unique id in Mac OS 9. If you are trying to do some
interapplication communication, you should be using AppleEvents, where
you don't need such a thing. And all other APIs don't need such a
thing either. So in order to gives you a good hint, knowing what you
are trying to use the id for would really help.

And if you just need an id inside you application, won't someting
along the lines of

unsigned long CreateGUID()
{
static unsigned long guid = 0;
return ++guid;
}

do for you?

   Thorsten
Don Bruder - 23 Feb 2004 18:16 GMT
> > Hi!
> >
[quoted text clipped - 5 lines]
> What exactly are you trying to do? I cannot think of any use for such
> a thing as a unique id in Mac OS 9.

I can think of dozens, perhaps even hundreds, of situations, most of
them involving inter-machine communication, where a truly unique ID
isn't only a good idea, it's absolutely critical.

> If you are trying to do some
> interapplication communication, you should be using AppleEvents, where
> you don't need such a thing. And all other APIs don't need such a
> thing either. So in order to gives you a good hint, knowing what you
> are trying to use the id for would really help.

Not really - Just tell 'im how to do what he wants. Or show him a tool
that will do it for him. This ain't about religion, guy. It's about "he
wants this", not "he wants what you decide he wants". What he wants to
do with it is irrelevant.

> And if you just need an id inside you application, won't someting
> along the lines of
[quoted text clipped - 8 lines]
>
>     Thorsten

It MIGHT work for him, but if he ever hooks up to a network that's
expecting a TURLY unique ID, it's a very real posisbility that this
hideously bad practice of faking a unique ID will kill the rest of the
network. And without question, if I ever came across a program that
wanted a GUID/UUID and found out it settled for that bit of code you
suggest, I'd be dumping that app faster than you can say "Begone!".

The whole point behind a GUID (Globally Unique ID) or UUID (Universally
Unique ID) is that the identifier is indeed unique - not just unique to
the machine the program is running on, but unique across every group of
machines it might have contact with. When done correctly, it should be
either impossible (or as close to it as can be practically measured) for
any machine anywhere on the planet to come up with the same GUID/UUID.
In certain networking situations, this isn't just important, it's
absolutely critical to keeping the network from exploding in your face
when an identifier collision happens. In others, it's just a handy "tag"
to refer to a machine (or even a process on a machine) by, but it's just
as important that you not "cross up" two IDs if you want the system to
keep functioning.

Signature

Don Bruder - dakidd@sonic.net - New Email policy in effect as of Feb. 21, 2004.
For info on this, see <http://www.sonic.net/~dakidd/main/contact.html> Short
form: I'm trashing EVERYTHING that doesn't contain a specific, rotating phrase
in the subject line. Sorry, but spammers have forced me to take this action.

Thorrsten Froehlich - 24 Feb 2004 00:27 GMT
> I can think of dozens, perhaps even hundreds, of situations, most of
> them involving inter-machine communication, where a truly unique ID
> isn't only a good idea, it's absolutely critical.

He did not say anything about the desired application area of the
unique id. This is your assumption.

> > If you are trying to do some
> > interapplication communication, you should be using AppleEvents, where
[quoted text clipped - 6 lines]
> wants this", not "he wants what you decide he wants". What he wants to
> do with it is irrelevant.

All I am doing is asking what he needs it for. Without that
information it might just be that he is porting something and does not
know about some unique Mac OS functionality that will allow him to do
the same job. You assume he wants to do something over a network, and
suggest half a megabyte project. Obviously, if he just needs a local
unique id that would be overkill. I don't understand why you jump the
gun with your "This ain't about religion, guy." - I find it offending.

> > And if you just need an id inside you application, won't someting
> > along the lines of
<snip>
> It MIGHT work for him, but if he ever hooks up to a network that's
> expecting a TURLY unique ID, it's a very real posisbility that this
> hideously bad practice of faking a unique ID will kill the rest of the
> network.

Well, did I even remotely suggest this would be suitable for network
use?  I think "id inside your application" is a really clear
statement!

   Thorsten
Don Bruder - 23 Feb 2004 18:11 GMT
> Hi!
>
[quoted text clipped - 4 lines]
>
> Let me know please....

Email me with an FTP site/access, and/or an address that can handle a
roughly 1/2 meg attachment, and I'll ship you a CW project that will
build you a library that I've been hacking on (Unix-based originally,
fiddled, tweaked, and otherwise ported to run on the Mac under 9.x by
yours truly) to give you 100% function-level compatibility with the
"UUID" stuff that Unix and Windows have.

Note: Place the exact text "PopperAndShadow" (quotes are optional,
spelling, spacing, and capitalization are mandatory, and must be exactly
as shown) anywhere in the subject line of the Email to get past my
filters.

Signature

Don Bruder - dakidd@sonic.net - New Email policy in effect as of Feb. 21, 2004.
For info on this, see <http://www.sonic.net/~dakidd/main/contact.html> Short
form: I'm trashing EVERYTHING that doesn't contain a specific, rotating phrase
in the subject line. Sorry, but spammers have forced me to take this action.

Frederick Cheung - 24 Feb 2004 15:28 GMT
> Hi!
>
[quoted text clipped - 4 lines]
>
> Let me know please....

If you are using carbon, look a CFUUID.h

Fred
Paul Miller - 24 Feb 2004 18:14 GMT
>How can I get GUID in Mac OS 9 ?

#include <CFUUID.h>

CFUUIDRef ref = ::CFUUIDCreate(kCFAllocatorDefault);
CFUUIDBytes bytes = ::CFUUIDGetUUIDBytes(ref);

// do something with the bytes

// convert to canonical string form
CFStringRef str = ::CFUUIDCreateString(kCFAllocatorDefault, ref);

::CFRelease(str);
::CFRelease(ref);
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.