Examples of IJIWinReg


Examples of org.jinterop.winreg.IJIWinReg

    /**
     * Returns true if the .NET framework of the given version (or grater) is installed
     * on a remote machine.
     */
    public static boolean isInstalled(int major, int minor, String targetMachine, IJIAuthInfo session) throws JIException, UnknownHostException {
        IJIWinReg registry = JIWinRegFactory.getSingleTon().getWinreg(session,targetMachine,true);
        JIPolicyHandle hklm=null;
        JIPolicyHandle key=null;

        try {
            hklm = registry.winreg_OpenHKLM();
            key = registry.winreg_OpenKey(hklm,"SOFTWARE\\Microsoft\\.NETFramework", IJIWinReg.KEY_READ );

            for( int i=0; ; i++ ) {
                String keyName = registry.winreg_EnumKey(key,i)[0];
                if(matches(keyName,major,minor))
                    return true;
            }
        } catch (JIException e) {
            if(e.getErrorCode()==2)
                return false;       // not found
            throw e;
        } finally {
            if(hklm!=null)
                registry.winreg_CloseKey(hklm);
            if(key!=null)
                registry.winreg_CloseKey(key);
            registry.closeConnection();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.