SHLWAPI.DLLのバージョンの取得[ATL]

(2001.07.02)
// Shell Lightweight Utility API Versions:
static HRESULT AtlGetShlwapiVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
{
    ATLASSERT(pdwMajor != NULL && pdwMinor != NULL);
    if(::IsBadWritePtr(pdwMajor, sizeof(DWORD)) || ::IsBadWritePtr(pdwMinor, sizeof(DWORD)))
        return E_INVALIDARG;
    
    DLLVERSIONINFO dvi;
    ::ZeroMemory(&dvi, sizeof(dvi));
    dvi.cbSize = sizeof(dvi);
    HRESULT hRet = AtlGetDllVersion(_T("Shlwapi.dll"), &dvi);
    
    if(SUCCEEDED(hRet))
    {
        *pdwMajor = dvi.dwMajorVersion;
        *pdwMinor = dvi.dwMinorVersion;
    }
    else if(hRet == E_NOTIMPL)
    {
        // If DllGetVersion is not there, then the DLL is a version
        // previous to the one shipped with IE 3.x
        *pdwMajor = 4;
        *pdwMinor = 0;
        hRet = S_OK;
    }
    
    return hRet;
};
一覧に戻る
© 2003 WAC.com All Right Reserved.