Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 80260 Details for
Bug 168597
[Vista] HTTP Recorder requires work-around on Windows Vista for Internet Explorer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for org.eclipse.hyades.test.core
bugzilla168597.txt (text/plain), 25.25 KB, created by
DuWayne Morris
on 2007-10-12 14:06:02 EDT
(
hide
)
Description:
Patch for org.eclipse.hyades.test.core
Filename:
MIME Type:
Creator:
DuWayne Morris
Created:
2007-10-12 14:06:02 EDT
Size:
25.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.core >Index: src/org/eclipse/hyades/execution/recorder/local/appadapters/InternetExplorerAdapter.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/src/org/eclipse/hyades/execution/recorder/local/appadapters/InternetExplorerAdapter.java,v >retrieving revision 1.11 >diff -u -r1.11 InternetExplorerAdapter.java >--- src/org/eclipse/hyades/execution/recorder/local/appadapters/InternetExplorerAdapter.java 26 Apr 2007 21:03:39 -0000 1.11 >+++ src/org/eclipse/hyades/execution/recorder/local/appadapters/InternetExplorerAdapter.java 12 Oct 2007 17:50:40 -0000 >@@ -27,6 +27,8 @@ > import org.eclipse.hyades.test.core.internal.resources.TestCorePluginResourceBundle; > > >+ >+ > /** > * This object is the client object for a RecorderApplication extension point (point org.eclipse.hyades.execution.recorder.RecorderApplication) > * it contains logic for initializing, starting, and stopping Internet Explorer. In particular, this object is able >@@ -78,13 +80,38 @@ > // bugzilla 165310 mdd > final String mylocalhost = "127.0.0.1:"; > >+ // bugzilla 168597 >+ /* Later we may want to change this to always use native code >+ * to get and set Internet Explorer registry settings. >+ * >+ * For this defect fix, we will determine that our attempt to run regedit.exe >+ * has failed running on Vista without using "Run as Administrator" elevated privileges >+ * >+ * When this happens, we will set the boolean below true and create an instance of JNIWrapper class. >+ * The JNIWrapper class will load the native DLL and make the calls into native code. >+ * >+ */ >+ private boolean bUseNativeRegistryInterface = false; >+ private boolean bRunningVista = false; >+ private JNIWrapper jniWrapper = null; >+ > public void init(String initInfo) throws RecorderApplicationAdapterException > { >+ StringBuffer inputFileContents; >+ > // bugzilla 114253 set the path of temp files to the workspace path > setTempFilePaths(); > >- parseInitInfo(initInfo); >- StringBuffer inputFileContents = getRegistryInfo(); >+ parseInitInfo(initInfo); >+ checkOSVersion(); >+ >+ // Bugilla 168597 >+ if (bUseNativeRegistryInterface) >+ inputFileContents = getRegistryInfoUsingNativeAPI(); >+ else >+ inputFileContents = getRegistryInfo(); >+ >+ createOriginalRegSettingsFile(inputFileContents); > > StringBuffer outputFileContents = new StringBuffer(); > // new mdd hyades 1.3 check for http >@@ -101,16 +128,19 @@ > StringTokenizer lineTokenizer = new StringTokenizer(line,":");//$NON-NLS-1$ > newLine=lineTokenizer.nextToken(); > newLine+=":00000001";//$NON-NLS-1$ >+ setNativeRegistryValue(newLine); >+ outputFileContents.append(newLine+"\r\n");//$NON-NLS-1$ > if (isProxyEnabled){ > // newLine+="\r\n\"ProxyServer\"=\"http=localhost:" + portnum;//$NON-NLS-1$ >- newLine+="\r\n\"ProxyServer\"=\"http=" + mylocalhost+ portnum;//$NON-NLS-1$ >+ newLine="\"ProxyServer\"=\"http=" + mylocalhost+ portnum;//$NON-NLS-1$ > newLine += ";https=" + mylocalhost + portnum + "\""; > } > else { > // newLine+="\r\n\"ProxyServer\"=\"socks=localhost:";//$NON-NLS-1$ >- newLine+="\r\n\"ProxyServer\"=\"socks=" + mylocalhost;//$NON-NLS-1$ >+ newLine="\"ProxyServer\"=\"socks=" + mylocalhost;//$NON-NLS-1$ > newLine+=portnum+"\"";//$NON-NLS-1$ >- } >+ } >+ > } > else if(line.startsWith("\"ProxyHttp1.1"))//$NON-NLS-1$ > { >@@ -121,6 +151,7 @@ > } > else if(line.startsWith("\"ProxyServer"))//$NON-NLS-1$ > { >+ > //it has been found that if the target computer has never been pointed to a proxy. This > //entry may not be present. Therefore, we will ignore it if it is there and always create it from scratch. > newLine=null; >@@ -176,36 +207,92 @@ > } > newLine = null; //don't update this > } >- if(newLine!=null) >- outputFileContents.append(newLine+"\r\n");//$NON-NLS-1$ >+ if(newLine!=null){ >+ if (bUseNativeRegistryInterface) >+ setNativeRegistryValue(newLine); >+ else >+ outputFileContents.append(newLine+"\r\n");//$NON-NLS-1$ >+ } > } > > > >- createRegSettingsFile(outputFileContents); >+ if (bUseNativeRegistryInterface){ >+ launchPath = launchPath.replaceAll("%1", ""); >+ int n = launchPath.indexOf("\\\\"); //replaceAll doesn't work for these cases >+ int m = launchPath.indexOf("\\\""); >+ while (n > -1 || m > -1) >+ { >+ if (n > -1) >+ { >+ launchPath = launchPath.substring(0, n) + launchPath.substring(n+1, launchPath.length()); >+ >+ } >+ else if (m > -1) //wait until next loop (have to reassign indeces) >+ { >+ launchPath = launchPath.substring(0, m) + launchPath.substring(m+1, launchPath.length()); >+ >+ } >+ n = launchPath.indexOf("\\\\"); >+ m = launchPath.indexOf("\\\""); >+ } >+ System.out.println(launchPath); >+ } >+ > > try > { >- pushRegFile(tempSettingsFilePath); >+ if (!bUseNativeRegistryInterface){ >+ createRegSettingsFile(outputFileContents); >+ pushRegFile(tempSettingsFilePath); >+ } > } > catch (Exception e) > { >- // below is for bugzilla 177396 mdd >- String currentOS = Platform.getOS(); >- if (currentOS.equals("win32")) { >- String myVersion = System.getProperty("os.version"); >- String myError = ""; >- if (myVersion.startsWith("6")) { >- myError = TestCorePluginResourceBundle.RecorderClientApp_VISTA_ADMIN_ERROR; >- } >- else { >- myError = TestCorePluginResourceBundle.RecorderClientApp_WINDOWS_ADMIN_ERROR; >- } >+ String myError = TestCorePluginResourceBundle.RecorderClientApp_WINDOWS_ADMIN_ERROR; > throw new RecorderApplicationAdapterException(myError + "\n" + e.getMessage()); >+ } >+ >+ } >+ >+ private void checkOSVersion(){ >+ String currentOS = Platform.getOS(); >+ if (currentOS.equals("win32")) { >+ String myVersion = System.getProperty("os.version"); >+ if (myVersion.startsWith("6")) { >+ try{ >+ // Bugilla 168597, use native registry calls >+ // instead of displaying an error message >+ bRunningVista = true; >+ jniWrapper = new JNIWrapper(); >+ if ((jniWrapper.isProcessRunningElevated()) == false) >+ bUseNativeRegistryInterface = true; >+ } >+ // so, if we can't load our DLL, we will throw the old >+ // error message out so the user can perform a recording by >+ // running eclipse using "Run as Administrator >+ // this should never happen >+ catch (UnsatisfiedLinkError e2){ >+ StringBuffer inputFileContents = new StringBuffer(); >+ inputFileContents.append("VISTA_ADMIN_ERROR"); >+ } > } >- throw new RecorderApplicationAdapterException(e.getMessage()); > } > >+ } >+ >+ private void setNativeRegistryValue(String newLine){ >+ if (bUseNativeRegistryInterface){ >+ int index1 = 1; // next character after beginning quote >+ int index2 = newLine.indexOf("="); >+ String keyname = newLine.substring(index1, index2 - 1); >+ String value = newLine.substring(index2 + 1); >+ if (value.charAt(0) == '\"') >+ value = value.substring(1); >+ if (value.endsWith("\"")) >+ value = value.substring(0, value.length() - 1); >+ jniWrapper.setInternetSetting(keyname, value); >+ } > } > > /* >@@ -291,6 +378,36 @@ > > } > >+ /** >+ * method which creates a registry settings file (*.reg) >+ * @param StringBuffer ouputFileContents >+ */ >+ private void createOriginalRegSettingsFile(StringBuffer inputFileContents) >+ { >+ // Bugzilla 114253 - use new path for temp files to put them in workspace >+ File newFile = new File(originalSettingsFilePath); >+ >+ try >+ { >+ OutputStreamWriter outputWriter = new OutputStreamWriter(new FileOutputStream(newFile),"UnicodeLittle");//$NON-NLS-1$ >+ outputWriter.write(inputFileContents.toString()); >+ outputWriter.close(); >+ } >+ catch (UnsupportedEncodingException e1) >+ { >+ e1.printStackTrace(); >+ } >+ catch (FileNotFoundException e1) >+ { >+ e1.printStackTrace(); >+ } >+ catch (IOException e) >+ { >+ e.printStackTrace(); >+ } >+ >+ } >+ > > /** > * method which exports the registry keys of interested into a file using regedit and then reads the file >@@ -299,6 +416,7 @@ > private StringBuffer getRegistryInfo() > { > >+ > String[] regInfo = {"\"HKEY_CLASSES_ROOT\\Applications\\iexplore.exe\\shell\\open\\command\"", > "\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\"", > "\"HKEY_CURRENT_USER\\Software\\Microsoft\\Java VM\""}; >@@ -307,12 +425,15 @@ > // bugzilla 127536 mark d dunn put quotes around file name due to spaces in workspace path > String cmdLine = "regedit /e "+"\"" + originalSettingsFilePath+ "\" ";//$NON-NLS-1$//$NON-NLS-2$ > String consolecmdLine = "regedit /e "+"\""+consoleSettingsFilePath+ "\" "; >+ >+ jniWrapper = new JNIWrapper(); > > InputStreamReader inputReader=null; > File file = null; > File consoleFile = null; > Process registryChange = null; > StringBuffer inputFileContents = new StringBuffer(); >+ > try > { > // bugzilla 114253 - write temp files in workspace instead of eclipse instance location >@@ -326,14 +447,18 @@ > > for (int i = 0; i < regInfo.length; i++) > { >- if (i == 2){ >+ if (i == 2 && bRunningVista == false){ // the Java command console registry setting is not available on Vista > registryChange = Runtime.getRuntime().exec(consolecmdLine + regInfo[i],null); >+ > } > else { > registryChange = Runtime.getRuntime().exec(cmdLine + regInfo[i],null); > } >+ > registryChange.waitFor(); >- if (i == 2){ >+ if (i == 2 && bRunningVista == false){ >+ // the Java command console registry setting is not available on Vista >+ // so this was throwing a File I/O exception > inputReader= new InputStreamReader(new FileInputStream(consoleFile),"UTF-16");//$NON-NLS-1$ > } else > { >@@ -373,7 +498,36 @@ > } > return inputFileContents; > } >- >+ //Bugilla 168597 >+ StringBuffer getRegistryInfoUsingNativeAPI(){ >+ bUseNativeRegistryInterface = true; >+ >+ StringBuffer inputFileContents = new StringBuffer(); >+ // fire up an instance of the JNI layer to start using native code >+ launchPath = jniWrapper.getIEPath(); >+ String str = jniWrapper.getErrorMessage(); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "ProxyEnable"); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "AutoConfigURL"); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "ProxyServer"); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "ProxyOverride"); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "ProxyHttp1.1"); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "WarnOnBadCertRecving"); >+ AddSettingToBuffer(jniWrapper, inputFileContents, "WarnOnZoneCrossing"); >+ >+ // left out ZonesMixedContent for now, that would require reading many more keys >+ // to set all that >+ >+ return inputFileContents; >+ } >+ >+ private void AddSettingToBuffer(JNIWrapper jniWrapper, StringBuffer inputFileContents, String name){ >+ String setting = jniWrapper.getInternetSetting(name); >+ if (setting != null && setting.length() > 0){ >+ inputFileContents.append("\"" + name + "\"=" + setting + "\r\n"); >+ } >+ return; >+ } >+ > > /** > * method called by the recorder to start the target application (Internet Explorer) >@@ -384,8 +538,12 @@ > ieProcess = null; > try > { >+ String strStart = launchPath + " " + startupURL;//$NON-NLS-1$ > //TODO derive path to iexplore.exe using registry. >- ieProcess = Runtime.getRuntime().exec(launchPath + " " + startupURL);//$NON-NLS-1$ >+ if (bUseNativeRegistryInterface == true) >+ jniWrapper.startIE(startupURL); >+ else >+ ieProcess = Runtime.getRuntime().exec(strStart); > } > catch (IOException e) > { >@@ -404,9 +562,40 @@ > { > // bugzilla 114253 - write temp files in workspace instead of eclipse instance location > // use the new path for the temp files >- pushRegFile(originalSettingsFilePath); >- >- pushRegFile(consoleSettingsFilePath); >+ if (bUseNativeRegistryInterface){ >+ try { >+ StringBuffer inputFileContents = new StringBuffer(); >+ String str; >+ byte [] buffer = new byte[4096]; >+ int bytes_read; >+ File newFile = new File(originalSettingsFilePath); >+ FileInputStream inputStream = new FileInputStream(newFile);//$NON-NLS-1$ >+ while ((bytes_read = inputStream.read(buffer)) != -1){ >+ str = new String(buffer, 0, bytes_read, "UnicodeLittle"); >+ inputFileContents.append(str); >+ } >+ inputStream.close(); >+ StringTokenizer fileTokenizer = new StringTokenizer(inputFileContents.toString(),"\r\n");//$NON-NLS-1$ >+ while(fileTokenizer.hasMoreTokens()) >+ { >+ String line=fileTokenizer.nextToken(); >+ // check to see if it is a real setting or a blank line >+ int index = line.indexOf('='); >+ if (index > 0) >+ setNativeRegistryValue(line); >+ } >+ } >+ catch (IOException eio){ >+ // file not found is ok because cleanup gets called twice if stopping from the GUI >+ // rather than by closing IE. >+ } >+ >+ } >+ else{ >+ pushRegFile(originalSettingsFilePath); >+ >+ pushRegFile(consoleSettingsFilePath); >+ } > } > catch (Exception e) > { >@@ -430,7 +619,13 @@ > */ > public void stop() throws RecorderApplicationAdapterException > { >- ieProcess.destroy(); >+ if (ieProcess == null){ >+ if (jniWrapper != null) >+ jniWrapper.terminateIE(); >+ >+ }else{ >+ ieProcess.destroy(); >+ } > } > > //init format: >@@ -589,5 +784,15 @@ > public void setApplicationPath(String str) { > TestCorePlugin.getDefault().getPluginPreferences().setValue("RECORDER_IE_PATH", str); > } >+ // added this method to be called by the RecorderDataProcessorHelper class >+ // when the client connects, we will look for a new instance of IE if >+ // we are using the Native DLL code to control the recording >+ public void clientConnectNotification(){ >+ >+ if (bUseNativeRegistryInterface && jniWrapper != null){ >+ jniWrapper.clientConnectNotification(); >+ } >+ >+ } > > } >Index: src/org/eclipse/hyades/internal/execution/recorder/local/RecorderStopper.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/src/org/eclipse/hyades/internal/execution/recorder/local/RecorderStopper.java,v >retrieving revision 1.3 >diff -u -r1.3 RecorderStopper.java >--- src/org/eclipse/hyades/internal/execution/recorder/local/RecorderStopper.java 2 May 2007 19:36:14 -0000 1.3 >+++ src/org/eclipse/hyades/internal/execution/recorder/local/RecorderStopper.java 12 Oct 2007 17:50:40 -0000 >@@ -11,6 +11,8 @@ > **********************************************************************/ > package org.eclipse.hyades.internal.execution.recorder.local; > >+import org.eclipse.hyades.execution.recorder.local.appadapters.JNIWrapper; >+ > /** > * Thread which monitors the application being recorded > * when the application being recorded terminates, this threads shuts down the >@@ -38,7 +40,13 @@ > { > bActive = true; > System.err.println("about to wait for process"); //$NON-NLS-1$ >- process.waitFor(); >+ if (process == null){ >+ JNIWrapper jniWrapper = new JNIWrapper(); >+ jniWrapper.waitForIE(); >+ }else{ >+ process.waitFor(); >+ } >+ > bActive = false; > System.err.println("process terminated"); //$NON-NLS-1$ > client.stopRecording(); >@@ -48,6 +56,9 @@ > //this is an expected occurance when the user selects the stop button. > > } >+ catch (NullPointerException e){ >+ >+ } > > } > >Index: src/org/eclipse/hyades/internal/execution/recorder/local/RecorderDataProcessorHelper.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/src/org/eclipse/hyades/internal/execution/recorder/local/RecorderDataProcessorHelper.java,v >retrieving revision 1.4 >diff -u -r1.4 RecorderDataProcessorHelper.java >--- src/org/eclipse/hyades/internal/execution/recorder/local/RecorderDataProcessorHelper.java 2 May 2007 19:36:14 -0000 1.4 >+++ src/org/eclipse/hyades/internal/execution/recorder/local/RecorderDataProcessorHelper.java 12 Oct 2007 17:50:40 -0000 >@@ -17,10 +17,11 @@ > > import org.eclipse.hyades.execution.recorder.IRecorderDataProcessor; > import org.eclipse.hyades.execution.recorder.IRecorderListenerFullFeedback; >+import org.eclipse.hyades.execution.recorder.Recorder; > import org.eclipse.hyades.execution.recorder.RecorderFactory; > import org.eclipse.hyades.internal.execution.local.common.DataProcessor; > import org.eclipse.hyades.internal.execution.recorder.remote.IRecorderMessageTypes; >- >+import org.eclipse.hyades.execution.recorder.local.appadapters.InternetExplorerAdapter; > /** > * Object which contains data management and direction functionality. It receives incoming messages from the Agent Controller and sends them to the > * appropriate API in the contained IRecorderDataProcessor >@@ -52,6 +53,12 @@ > */ > private Date lastReceivedReportTime = null; > >+ /** >+ * Adding this boolean to identify when the incomming data indicates a client >+ * connection has taken place >+ */ >+ private boolean clientConnected = false; >+ > > /** > * constructor >@@ -80,7 +87,18 @@ > switch(controlByte) > { > case MESSAGE_TYPE_DATA: >- loadTestDataProcessor.processData(buffer); >+ loadTestDataProcessor.processData(buffer); >+ if (!clientConnected){ >+ String tStr = new String(buffer); >+ if (tStr.contains("Client Connected") == true){ >+ clientConnected = true; >+ Object recorder = RecorderFactory.getInstance().getActiveRecorder().getRecorderClient().appAdapter; >+ if (recorder instanceof InternetExplorerAdapter){ >+ InternetExplorerAdapter rec = (InternetExplorerAdapter)recorder; >+ rec.clientConnectNotification(); >+ } >+ } >+ } > updateBytesRecievedControl(bufferLength, false); > break; > case MESSAGE_TYPE_CONTROL_STRING: >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/META-INF/MANIFEST.MF,v >retrieving revision 1.27 >diff -u -r1.27 MANIFEST.MF >--- META-INF/MANIFEST.MF 16 Apr 2007 17:33:05 -0000 1.27 >+++ META-INF/MANIFEST.MF 12 Oct 2007 17:50:40 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: org.eclipse.hyades.test.core; singleton:=true >-Bundle-Version: 4.2.200.qualifier >+Bundle-Version: 4.2.202.qualifier > Bundle-ClassPath: hexteh.jar, > hexrecr.jar, > test-core.jar >Index: src/org/eclipse/hyades/execution/recorder/Recorder.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/src/org/eclipse/hyades/execution/recorder/Recorder.java,v >retrieving revision 1.6 >diff -u -r1.6 Recorder.java >--- src/org/eclipse/hyades/execution/recorder/Recorder.java 2 May 2007 19:36:13 -0000 1.6 >+++ src/org/eclipse/hyades/execution/recorder/Recorder.java 12 Oct 2007 17:50:40 -0000 >@@ -178,6 +178,13 @@ > { > return id; > } >+ /** >+ * >+ * returns the active recorder client application adapter >+ */ >+ public RecorderClient getRecorderClient(){ >+ return client; >+ } > > /** > * called to initiate a recording with this recording. Before this method is called, all valid information for this >Index: src/org/eclipse/hyades/execution/recorder/local/appadapters/JNIWrapper.java >=================================================================== >RCS file: src/org/eclipse/hyades/execution/recorder/local/appadapters/JNIWrapper.java >diff -N src/org/eclipse/hyades/execution/recorder/local/appadapters/JNIWrapper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/execution/recorder/local/appadapters/JNIWrapper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,205 @@ >+/********************************************************************** >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * $Id: JNIWrapper.java,v 1 2007/08/24 1:03:39 dmorris Exp $ >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.execution.recorder.local.appadapters; >+ >+ >+import java.net.URL; >+ >+import org.eclipse.core.runtime.FileLocator; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Platform; >+import org.osgi.framework.Bundle; >+ >+import java.io.FileInputStream; >+import java.io.FileOutputStream; >+import java.io.IOException; >+import java.io.File; >+import java.io.OutputStreamWriter; >+ >+ >+// added this file for bugzilla 168597 >+ >+public class JNIWrapper { >+ >+ private static final native String getLastError(); >+ private static final native String getIEAppPath(); >+ private static final native String getEnableJavaConsole(); >+ private static final native String getIESetting(String name); >+ private static final native int setIESetting(String name, String value, int type); >+ private static final native int launchIE(String url); >+ private static final native int waitForIEProcess(); >+ private static final native int killIEProcess(); >+ private static final native int isProcessElevated(); >+ private static final native int lookForNewBrowser(); >+ private static final native int isIERunning(); >+ >+ public static final int REG_SZ = 1; >+ public static final int REG_DWORD = 4; >+ >+ public static String pluginPath; >+ public static String blankURL = null; >+ >+ public synchronized String getIEPath(){ >+ >+ String path = getIEAppPath(); >+ return path; >+ } >+ >+ public synchronized String getEnableJava(){ >+ >+ String path = getEnableJavaConsole(); >+ return path; >+ } >+ >+ >+ public synchronized String getInternetSetting(String name){ >+ String setting = getIESetting(name); >+ //if (setting == null || setting.length() == 0) >+ //getErrorMessage(); >+ >+ >+ return setting; >+ } >+ >+ public synchronized boolean setInternetSetting(String name, String value){ >+ int i = 0; >+ >+ if (value.startsWith("dword:", 0)){ >+ int index = value.indexOf(":"); >+ index++; >+ value = value.substring(index); >+ value = value.trim(); >+ Integer intVal = new Integer(value); >+ value = intVal.toString(); >+ i = setIESetting(name, value, REG_DWORD); >+ >+ >+ }else{ >+ i = setIESetting(name, value, REG_SZ); >+ } >+ if (i > 0) >+ return true; >+ else >+ return false; >+ } >+ >+ public synchronized String getErrorMessage(){ >+ String errorMsg = getLastError(); >+ System.out.println(errorMsg); >+ return errorMsg; >+ >+ } >+ >+ public boolean startIE(String url){ >+ int retCode = 0; >+ // we create a temporary blank.html file on the fly >+ // using IELaunchURL with about:blank fails and we generally >+ // want a blank page to come up so the users default URL page won't end up >+ // being a part of every recording >+ if (url.compareTo("about:blank") == 0){ >+ blankURL = null; >+ try { >+ File tfile = File.createTempFile("blank", ".html"); >+ blankURL = tfile.getPath(); >+ if (!tfile.exists()){ >+ tfile.createNewFile(); >+ OutputStreamWriter outputWriter = >+ new OutputStreamWriter(new FileOutputStream(tfile),"UnicodeLittle");//$NON-NLS-1$ >+ outputWriter.write("<HTML></HTML>");//$NON-NLS-1$ >+ outputWriter.close(); >+ } >+ } >+ catch (IOException e){ >+ // we will just launch IE with the user default page if there is an exception creating >+ // the temp file. >+ } >+ >+ //blankURL = pluginPath + "blank.htm"; >+ retCode = launchIE(blankURL); >+ }else{ >+ retCode = launchIE(url); >+ } >+ >+ if (retCode == 0) >+ return false; >+ else >+ return true; >+ } >+ >+ public boolean waitForIE(){ >+ int retCode = 0; >+ >+ retCode = waitForIEProcess(); >+ if (blankURL != null){ >+ File tfile = new File(blankURL); >+ if (tfile.exists()) >+ tfile.delete(); >+ } >+ if (retCode == 0) >+ return false; >+ else >+ return true; >+ >+ } >+ >+ public boolean terminateIE(){ >+ int retCode = 0; >+ >+ retCode = killIEProcess(); >+ if (retCode == 0) >+ return false; >+ else >+ return true; >+ >+ } >+ >+ public boolean isProcessRunningElevated(){ >+ int i = isProcessElevated(); >+ if (i == 0) >+ return false; >+ else >+ return true; >+ } >+ >+ public void clientConnectNotification(){ >+ lookForNewBrowser(); >+ } >+ >+ public boolean isBrowserRunning(){ >+ int i = isIERunning(); >+ if (i == 0) >+ return false; >+ else >+ return true; >+ } >+ >+ >+ static { >+ // load our utility dll, it should be in the org.eclipse.hyades.test.core plugin directory >+ try{ >+ Bundle b = Platform.getBundle("org.eclipse.hyades.test.core"); >+ URL u = FileLocator.resolve(b.getEntry("/")); >+ String path = u.getPath(); >+ path = path.substring(1); >+ pluginPath = path; >+ String finalPath = path + "TPTPRecUtil.dll"; >+ System.load(finalPath); >+ } >+ catch (IOException e){ >+ >+ } >+ } >+ >+} >+ >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 168597
:
76930
|
76931
|
80259
|
80260
|
80261
|
80262
|
80270
|
80900
|
80901
|
80902