How do I convert a LPWSTR to a GUID?

I’m working with the Windows 7 audio APIs, and I’ve hit a wall.

Basically, I need to take an IAudioSessionControl2* and get an ISimpleAudioVolume* out of it.

Now, it looks like I can call on IAudioSessionManager->GetSimpleAudioVolume() using the value of IAudioSessionControl2->GetSessionInstanceIdentifier(…). Note that this isn’t exactly spelled out as such in the docs, but it seems like a reasonable behavior.

The problem, GetSimpleAudioVolume() takes a GUID* and GetSessionInstanceIdentifier() spits out a LPWSTR. Through debugging I’ve confirmed that the return’d value from GetSessionInstanceIdentifier() at least looks like a GUID.

So, the actual question is how would I convert the LPWSTR I’ve got into a GUID? I realise this is pretty trivial if I marshal across into some managed code and use built-in GUID, but there’s got to be a C++ way of doing this.


Ok, these APIs definitely do not work the way I say they do in the above text dump. However, the basic question of String -> GUID is answered so I’m not going to delete the question.

How do I convert a LPWSTR to a GUID?