From ee34715fe597fb60e7e815c44f42c0bc68e17fef Mon Sep 17 00:00:00 2001 From: angryziber Date: Fri, 24 Aug 2007 21:25:44 +0000 Subject: [PATCH] Crippled-down versions of Windows now have their own defaults for some configuration settings. Users are informed of that on the first run. git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@201 375186e5-ef17-0410-b0b6-91563547dcda --- resources/Labels.txt | 4 ++++ src/net/azib/ipscan/config/GlobalConfig.java | 4 ++-- src/net/azib/ipscan/config/Platform.java | 11 ++++++++--- src/net/azib/ipscan/gui/MainWindow.java | 9 +++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/resources/Labels.txt b/resources/Labels.txt index 54dad4ff..60e9559e 100755 --- a/resources/Labels.txt +++ b/resources/Labels.txt @@ -276,3 +276,7 @@ Using the Options dialog, you may configure to display:\n\ Special values (also configurable):\n\ [n/s] - not scanned value that wasn't scanned at all (eg if the host is dead)\n\ [n/a] - the value is not available, but was scanned + +text.crippledWindowsInfo=Thank you for trying Angry IP Scanner!\n\n\ +However, keep in mind that consumer versions of Windows (e.g. Windows XP SP2, Windows Vista) have limited ability to be hosts for scanning, due to removed RawSocket support and TCP connection rate limiting.\n\n\ +Because of that, some configuration options were changed for you, making scanning a lot slower than on full-featured operating systems. See the FAQ on Angry IP Scanner homepage. diff --git a/src/net/azib/ipscan/config/GlobalConfig.java b/src/net/azib/ipscan/config/GlobalConfig.java index fee0103a..7f7db41e 100755 --- a/src/net/azib/ipscan/config/GlobalConfig.java +++ b/src/net/azib/ipscan/config/GlobalConfig.java @@ -46,7 +46,7 @@ public final class GlobalConfig { this.preferences = preferences; isFirstRun = preferences.getBoolean("firstRun", true); - maxThreads = preferences.getInt("maxThreads", 100); + maxThreads = preferences.getInt("maxThreads", Platform.CRIPPLED_WINDOWS ? 10 : 100); threadDelay = preferences.getInt("threadDelay", 20); activeFeeder = preferences.getInt("activeFeeder", 0); scanDeadHosts = preferences.getBoolean("scanDeadHosts", false); @@ -55,7 +55,7 @@ public final class GlobalConfig { pingCount = preferences.getInt("pingCount", 3); skipBroadcastAddresses = preferences.getBoolean("skipBroadcastAddresses", true); portTimeout = preferences.getInt("portTimeout", 2000); - adaptPortTimeout = preferences.getBoolean("adaptPortTimeout", true); + adaptPortTimeout = preferences.getBoolean("adaptPortTimeout", !Platform.CRIPPLED_WINDOWS); minPortTimeout = preferences.getInt("minPortTimeout", 100); portString = preferences.get("portString", ""); notAvailableText = preferences.get("notAvailableText", Labels.getLabel("fetcher.value.notAvailable")); diff --git a/src/net/azib/ipscan/config/Platform.java b/src/net/azib/ipscan/config/Platform.java index 4162cc3c..9c42ef55 100755 --- a/src/net/azib/ipscan/config/Platform.java +++ b/src/net/azib/ipscan/config/Platform.java @@ -12,13 +12,18 @@ package net.azib.ipscan.config; * @author Anton Keks */ public class Platform { + + private static final String OS_NAME = System.getProperty("os.name"); + /** Mac OS detection :-) */ public static final boolean MAC_OS = System.getProperty("mrj.version") != null; /** Linux */ - public static final boolean LINUX = System.getProperty("os.name").indexOf("Linux") >= 0; + public static final boolean LINUX = OS_NAME.indexOf("Linux") >= 0; /** Any Windows version */ - public static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows"); - + public static final boolean WINDOWS = OS_NAME.startsWith("Windows"); + + /** Crippled-down version of Windows (no RawSockets, TCP rate limiting, etc */ + public static final boolean CRIPPLED_WINDOWS = WINDOWS && OS_NAME.indexOf("Server") < 0 && Double.parseDouble(System.getProperty("os.version").substring(0, 3)) >= 5.1; } diff --git a/src/net/azib/ipscan/gui/MainWindow.java b/src/net/azib/ipscan/gui/MainWindow.java index aabea14c..bc62f9bb 100755 --- a/src/net/azib/ipscan/gui/MainWindow.java +++ b/src/net/azib/ipscan/gui/MainWindow.java @@ -8,6 +8,7 @@ package net.azib.ipscan.gui; import net.azib.ipscan.config.Config; import net.azib.ipscan.config.GlobalConfig; import net.azib.ipscan.config.Labels; +import net.azib.ipscan.config.Platform; import net.azib.ipscan.config.Version; import net.azib.ipscan.gui.MainMenu.CommandsMenu; import net.azib.ipscan.gui.actions.StartStopScanningAction; @@ -30,6 +31,7 @@ import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; /** @@ -76,6 +78,13 @@ public class MainWindow { } if (globalConfig.isFirstRun) { + if (Platform.CRIPPLED_WINDOWS) { + // inform crippled windows owners of configuration changes + MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); + box.setText(Version.NAME); + box.setMessage(Labels.getLabel("text.crippledWindowsInfo")); + box.open(); + } new GettingStartedDialog().open(); globalConfig.isFirstRun = false; }