Пример #1
0
BOOL    CBkServiceCallImp::VerifyExePath( LPCWSTR lpwszExePath )
{
    BOOL    bRet = FALSE;
    HRESULT hr = S_OK;
    CString instpath;
    WinMod::CWinPath    path;

    path.m_strPath = lpwszExePath;

    bRet = path.IsExisting();
    if ( !bRet )
    {
        return bRet;
    }

    hr = CAppPath::Instance().GetLeidianAppPath( instpath );
    if ( SUCCEEDED( hr ) )
    {
        path.RemoveFileSpec();

        path.m_strPath.MakeLower();
        instpath.MakeLower();

        if ( wcsstr( path, instpath ) )
        {
            bRet = TRUE;
        }
    }

    return bRet;
}
Пример #2
0
HRESULT CBkBackupProxy::Initialize()
{
    HRESULT hr = E_FAIL;

    WinMod::CWinPath    Path;

    //
    hr = CAppPath::Instance().GetLeidianAppPath( Path.m_strPath ); 
    if ( SUCCEEDED(hr) )
    {   
        Path.Append( BACKUP_DLL_NAME );
        hr = _LoadBkBackup( Path.m_strPath );
        if ( SUCCEEDED(hr) )
        {
            //成功返回
            return hr;
        }
    }
    //执行到这说名之前失败。
    hr = Path.GetModuleFileName(NULL);
    if ( SUCCEEDED(hr) )
    {
        Path.RemoveFileSpec();
        Path.Append( BACKUP_DLL_NAME );
        hr = _LoadBkBackup( Path.m_strPath );
        if ( SUCCEEDED(hr) )
        {
            //成功返回
            return hr;
        }
    }
    //
    return hr;
}
Пример #3
0
BOOL    CBkServiceCallImp::VerifyProcess( DWORD dwProcId )
{
    BOOL    bRet = FALSE;
    DWORD   dwRet = 0;
    HRESULT hr = S_OK;
    HANDLE  hProcess = NULL;

    hProcess = OpenProcess(
        PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
        FALSE,
        dwProcId 
        );
    if ( hProcess )
    {
        TCHAR   wszBuf[ MAX_PATH + 1 ] = { 0 };

        dwRet = GetModuleFileNameEx( hProcess, NULL, wszBuf, MAX_PATH );
        if ( dwRet )
        {
            CString             instpath;
            WinMod::CWinPath    path;

            path.m_strPath = wszBuf;

            WinMod::CWinPathApi::ExpandLongPathName( path.m_strPath );

            hr = CAppPath::Instance().GetLeidianAppPath( instpath );
            if ( SUCCEEDED( hr ) )
            {
                path.RemoveFileSpec();

                path.m_strPath.MakeLower();

                instpath.MakeLower();

                if ( wcsstr( path, instpath ) )
                {
                    bRet = TRUE;
                }
            }
        }
    }

    if ( hProcess )
    {
        CloseHandle( hProcess );
        hProcess = NULL;
    }

    return bRet;
}