Src/Pscx.Core/Interop/RunningObjectTable/RunningObjectTableHelper.cs
/// <summary>
/// Converts a COM class ID into a prog id.
/// </summary>
/// <param name="classId">The class id to convert to a prog id.</param>
/// <returns>Returns the matching class id or null if it wasn't found.</returns>
Converts a COM class ID into a prog id.
Converts a COM class ID into a prog id .
public static string ConvertClassIdToProgId(string classId)
        {
            Guid testGuid = new Guid(classId.Replace("!", ""));
            string progId = null;
            int result = 0;
            try
            {
                result = NativeMethods.ProgIDFromCLSID(ref testGuid, out progId);
                if ((result == -2147221164 ) && PscxContext.Instance.Is64BitProcess)
                {
                    throw new ArgumentException("Could not retrieve ProgID for Class Id: " + classId + 
                        ". Try running under the 32 bit PowerShell console.");
                }
            }
            catch (Exception)
            {
                if (result == -2147221164 )
                {
                    throw;
                }
                return null;
            }
            return progId;
        }
public static string ConvertClassIdToProgId ( string classId ) { Guid testGuid = new Guid ( classId . Replace ( " " , " " ) ) ; string progId = null ; int result = 0 ; try { result = NativeMethods . ProgIDFromCLSID ( ref testGuid , out progId ) ; if ( ( result == - 2147221164 ) && PscxContext . Instance . Is64BitProcess ) { throw new ArgumentException ( " " + classId + " " ) ; } } catch ( Exception ) { if ( result == - 2147221164 ) { throw ; } return null ; } return progId ; }
Converts a COM class ID into a prog id.
Converts a COM class ID into a prog id .
// class factory not found /*0x80040154*/ /*0x80040154*/ // rethrow
Returns the matching class id or null if it wasn't found.
Returns the matching class id or null if it wasn ' t found .
classId
string
The class id to convert to a prog id.
The class id to convert to a prog id .