this is a copypast from code I just had to write:
* HOLY FUCK. so pretty much everything in windows is a GUID,
* buy they don’t have any standard API’s to deal with GUID’s.
* for converting GUID’s to strings I had to use some api from
* ObjBase (all ugly com crap). it has no api to covert strings
* to GUID’s however.
* so I look on msdn, and after a long search I find http://msdn.microsoft.com/en-us/library/bb776431(VS.85).aspx
* which is GUIDFromString(), this is hidden in shell32.dll.
* so I try to use it, but the code simply won’t link. I go back to
* that msdn page and see the following at the end of the page: ”
* This function is not declared in a header or exported by name from a .dll file.
* It must be loaded from Shell32.dll as ordinal 703 for GUIDFromStringA and ordinal 704 for GUIDFromStringW.
* It can also be accessed from Shlwapi.dll as ordinal 269 for GUIDFromStringA and ordinal 270 for GUIDFromStringW.”
* ARE YOU KIDDING ME ??? so I spend an hour or so, trying to
* find api’s to import functions by ordinal, rather than by name
* it turns out there is no GetProcAddress() equivalent for
* ordinals. SON OF A BITCH !!!
* so I’m just going to write my own GUIDFromString() api’s
man, this really pissed me off. not that converting back and forth from a string to a GUID is hard, it’s just that they should have a decent set of api’s for this, and they simply don’t. (atleast not for C code).
after rereading the GetProcAddress() manpage, it turns out you can specify an ordinal value, if you pass it’s value along as the namepointer effectively encoding the value in a pointer *PUKE*.