LPCTSTR psz,
    CLSID *pclsid);

The function is ANSI in Windows builds and Unicode in NT builds.


The psz argument is the address of an array of characters which begin with a string representation of the CLSID, or may be NULL.

The pclsid argument is the address of a 10h-byte buffer that is to receive the binary representation of the CLSID.

Return Value

The function returns zero for success, else an error code.


The function assumes it is given an output buffer, and initialises it with CLSID_NULL. The function explicitly provides for being given no input buffer: if the psz argument is NULL, there is no string representation to convert and the function succeeds.

Except for that provision, the function is nowadays a wrapper around the SHLWAPI function GUIDFromString, and succeeds or fails according to whether the called function succeeds or fails. The error code for failure is necessarily CLASS_E_CLASSSTRING. The contents of the output buffer are undefined on failure.


In all versions before 5.00, the called GUIDString function is coded in SHELL32 (and is itself an exported function in version 4.71 and higher).

Initialisation of the output buffer begins with version 5.00.


The SHCLSIDFromString function is exported from SHELL32.DLL as ordinal 147 in version 4.00 and higher.

This function was documented among the Settlement Program Interfaces in December 2002, but with Windows 2000 cited as the minimum operating system, despite many years of earlier availability.