int GetColExtFirstColOrdinal()
{
	int		iRetVal = -1;

	// enumerate all the keys in the IE col handlers key...

	HKEY		hCU;
	if ( ::RegOpenKeyEx(HKEY_CLASSES_ROOT, 
		"Folder\\Shellex\\ColumnHandlers", 
		0, KEY_ENUMERATE_SUB_KEYS,
		&hCU) != ERROR_SUCCESS )
	{
		return -1;
	}
	else
	{
		// get a list of all the guids of the column handlers...

		charstring_vector		vcsColHandlers;

		int			iEnumIndex = 0;
		while ( TRUE )
		{
			// enumerate

			char		szName[ MAX_PATH ];

			LONG		lREVRes = ::RegEnumKey( hCU,
				iEnumIndex ++,
				szName, sizeof( szName ) );

			if ( lREVRes != ERROR_SUCCESS )
				break;

			vcsColHandlers.push_back( szName );
		}

		::RegCloseKey( hCU );

		// iterate through the list of guids...

		HRESULT		hr;

		int			iColGranTot = 0;
		std::vector< std::pair< GUID, std::vector< DWORD > > >		vpidvdwPids;

		for ( int i=0; i<vcsColHandlers.size(); i++ )
		{
			// parse the guid string...

			CLSID		ciClsID;

			hr = ::CLSIDFromString(
				const_cast<LPOLESTR>( ::CharStringToWideString( vcsColHandlers[ i ] ).c_str() ),
				& ciClsID );

			if ( FAILED( hr ) == FALSE )
			{
				// check if we have to exit now...

				if ( ciClsID == CLSID_ColumnHandler )
				{
					OSVERSIONINFO		osver;
					osver.dwOSVersionInfoSize = sizeof( osver );
					::GetVersionEx( & osver );

					BOOL		bXP = ( osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1 );

					iRetVal = iColGranTot + (bXP ? 8 : 5);

					break;
				}

				// create the object

				CComPtr< IColumnProvider >		pColumnProvider;
				hr = ::CoCreateInstance( ciClsID, NULL, CLSCTX_INPROC_SERVER, IID_IColumnProvider, (LPVOID*) & pColumnProvider );

				if ( FAILED( hr ) == FALSE )
				{
					// get the number of columns in the handler...

					for ( int j=0; ; j++ )
					{
						SHCOLUMNINFO		shciColInfo;

						::memset( & shciColInfo, 0, sizeof( shciColInfo ) );
						hr = pColumnProvider->GetColumnInfo( j, & shciColInfo );

						if ( hr == S_FALSE || FAILED( hr ) )
							break;

						BOOL	bFmtIdFound = FALSE;

						if ( shciColInfo.scid.fmtid != ciClsID )
						{
							for ( int h=0; h<vpidvdwPids.size(); h++ )
							{
								if ( vpidvdwPids[ h ].first == shciColInfo.scid.fmtid )
								{
									BOOL		bFound = FALSE;

									for ( int k=0; k<vpidvdwPids[ h ].second.size(); k++ )
										if ( vpidvdwPids[ h ].second[ k ] == shciColInfo.scid.pid )
										{
											bFound = TRUE;
											break;
										}

									if ( bFound == FALSE )
									{
										vpidvdwPids[ h ].second.push_back( shciColInfo.scid.pid );
										iColGranTot ++;
									}

									bFmtIdFound = TRUE;
									break;
								}
							}
						}

						if ( bFmtIdFound == FALSE )
						{
							if ( shciColInfo.scid.fmtid != ciClsID )
							{
								std::vector< DWORD >		vdw;
								vdw.push_back( shciColInfo.scid.pid );
								vpidvdwPids.push_back( std::make_pair( shciColInfo.scid.fmtid, vdw ) );
							}
							iColGranTot ++;
						}
					}
				}
			}
		}
	}

	// return to the caller

	return iRetVal;
}
