Skip to content

Commit 4b94b52

Browse files
authored
Merge pull request #2 from FlashpointProject/dev
Dev
2 parents 027ed1a + 202ded0 commit 4b94b52

13 files changed

Lines changed: 86 additions & 56 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ mono_crash.*
3131
#[Oo]bj/
3232
#[Ll]og/
3333
#[Ll]ogs/
34+
Debug.zip
35+
Release.zip
3436

3537
# Visual Studio 2015/2017 cache/options directory
3638
.vs/

FlashpointSecurePlayer/CustomSecurityManager.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ int InternetInterfaces.IInternetSecurityManager.GetSecuritySite(out IntPtr pSite
6262
}
6363

6464
int InternetInterfaces.IInternetSecurityManager.MapUrlToZone([MarshalAs(UnmanagedType.LPWStr)] string pwszUrl, ref uint pdwZone, uint dwFlags) {
65-
pdwZone = 0;
66-
return INET_E_DEFAULT_ACTION;
65+
// behave like local intranet
66+
pdwZone = 1;
67+
return S_OK;
6768
}
6869

6970
int InternetInterfaces.IInternetSecurityManager.GetSecurityId([MarshalAs(UnmanagedType.LPWStr)] string pwszUrl, [MarshalAs(UnmanagedType.LPArray)] byte[] pbSecurityId, ref uint pcbSecurityId, uint dwReserved) {
@@ -77,7 +78,6 @@ int InternetInterfaces.IInternetSecurityManager.ProcessUrlAction([MarshalAs(Unma
7778
dwAction == URLACTION_HTML_MIXED_CONTENT || // block HTTPS content on HTTP websites for Flashpoint Proxy
7879
dwAction == URLACTION_CLIENT_CERT_PROMPT || // don't allow invalid certificates
7980
dwAction == URLACTION_AUTOMATIC_ACTIVEX_UI || // do not display the install dialog for ActiveX Controls
80-
dwAction == URLACTION_ALLOW_RESTRICTEDPROTOCOLS || // use same settings for every protocol
8181
dwAction == URLACTION_ALLOW_APEVALUATION || // the phishing filter is not applicable to this application
8282
dwAction == URLACTION_LOWRIGHTS || // turn off Protected Mode
8383
dwAction == URLACTION_ALLOW_ACTIVEX_FILTERING) { // don't allow ActiveX filtering
@@ -90,14 +90,20 @@ int InternetInterfaces.IInternetSecurityManager.ProcessUrlAction([MarshalAs(Unma
9090
return S_OK;
9191
}
9292

93+
pPolicy = 0x00010000;
94+
95+
if (dwAction == 0x00002007) { // undocumented action: permissions for components with manifests
96+
return S_OK;
97+
}
98+
9399
pPolicy = URLPOLICY_ALLOW;
94100

95101
if ((dwAction >= URLACTION_DOWNLOAD_MIN && dwAction <= URLACTION_DOWNLOAD_MAX) || // allow downloading ActiveX Controls, scripts, etc.
96102
(dwAction >= URLACTION_ACTIVEX_MIN && dwAction <= URLACTION_ACTIVEX_MAX) || // allow ActiveX Controls
97103
(dwAction >= URLACTION_SCRIPT_MIN && dwAction <= URLACTION_SCRIPT_MAX) || // allow scripts
98104
(dwAction >= URLACTION_HTML_MIN && dwAction <= URLACTION_HTML_MAX) || // allow forms, fonts, meta elements, etc.
99105
(dwAction >= URLACTION_JAVA_MIN && dwAction <= URLACTION_JAVA_MAX) || // allow Java applets
100-
dwAction == URLACTION_COOKIES || // allow all cookies, which are not in fact dangerous and are in fact harmless plaintext files that don't have any code in them
106+
dwAction == URLACTION_COOKIES || // allow all cookies
101107
dwAction == URLACTION_COOKIES_SESSION ||
102108
dwAction == URLACTION_COOKIES_THIRD_PARTY ||
103109
dwAction == URLACTION_COOKIES_SESSION_THIRD_PARTY ||
@@ -108,6 +114,7 @@ int InternetInterfaces.IInternetSecurityManager.ProcessUrlAction([MarshalAs(Unma
108114
dwAction == URLACTION_DOTNET_USERCONTROLS || // allow .NET user controls
109115
dwAction == URLACTION_FEATURE_DATA_BINDING || // allow databinding
110116
dwAction == URLACTION_FEATURE_CROSSDOMAIN_FOCUS_CHANGE || // allow crossdomain
117+
dwAction == URLACTION_ALLOW_RESTRICTEDPROTOCOLS || // allow active content regardless of if the protocol is restricted
111118
dwAction == URLACTION_ALLOW_AUDIO_VIDEO || // allow audio and video always
112119
dwAction == URLACTION_ALLOW_AUDIO_VIDEO_PLUGINS ||
113120
dwAction == URLACTION_ALLOW_CROSSDOMAIN_DROP_WITHIN_WINDOW || // allow crossdomain, again

FlashpointSecurePlayer/EnvironmentVariables.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
namespace FlashpointSecurePlayer {
1515
class EnvironmentVariables : Modifications {
16+
const string COMPATIBILITY_LAYER = "__COMPAT_LAYER";
17+
1618
public EnvironmentVariables(Form Form) : base(Form) { }
1719

18-
new public void Activate(string name) {
20+
public void Activate(string name, string server, string applicationMutexName) {
1921
base.Activate(name);
2022
ModificationsElement modificationsElement = GetModificationsElement(true, Name);
2123
EnvironmentVariablesElement environmentVariablesElement = null;
@@ -27,15 +29,28 @@ public EnvironmentVariables(Form Form) : base(Form) { }
2729
throw new EnvironmentVariablesFailedException();
2830
}
2931

32+
string compatibilityLayer = null;
33+
3034
try {
31-
Environment.SetEnvironmentVariable(environmentVariablesElement.Name, RemoveVariablesFromValue(environmentVariablesElement.Value) as string);
32-
} catch (ArgumentNullException) {
35+
compatibilityLayer = Environment.GetEnvironmentVariable(COMPATIBILITY_LAYER);
36+
} catch (ArgumentException) {
3337
throw new EnvironmentVariablesFailedException();
38+
} catch (SecurityException) {
39+
throw new TaskRequiresElevationException();
40+
}
41+
42+
try {
43+
Environment.SetEnvironmentVariable(environmentVariablesElement.Name, RemoveVariablesFromValue(environmentVariablesElement.Value) as string);
3444
} catch (ArgumentException) {
3545
throw new EnvironmentVariablesFailedException();
3646
} catch (SecurityException) {
3747
throw new TaskRequiresElevationException();
3848
}
49+
50+
if (environmentVariablesElement.Name == COMPATIBILITY_LAYER && String.IsNullOrEmpty(compatibilityLayer) && !String.IsNullOrEmpty(server)) {
51+
RestartApplication(false, Form, applicationMutexName);
52+
throw new InvalidModificationException();
53+
}
3954
}
4055
}
4156

@@ -58,8 +73,6 @@ public EnvironmentVariables(Form Form) : base(Form) { }
5873

5974
try {
6075
Environment.SetEnvironmentVariable(environmentVariablesElement.Name, null);
61-
} catch (ArgumentNullException) {
62-
throw new EnvironmentVariablesFailedException();
6376
} catch (ArgumentException) {
6477
throw new EnvironmentVariablesFailedException();
6578
} catch (SecurityException) {

FlashpointSecurePlayer/FlashpointSecurePlayer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class FlashpointSecurePlayer : Form {
2525
private readonly ModeTemplates ModeTemplates;
2626
private readonly EnvironmentVariables EnvironmentVariables;
2727
private readonly DownloadsBefore DownloadsBefore;
28-
private readonly RegistryBackup RegistryBackup;
28+
private readonly RegistryBackups RegistryBackup;
2929
private readonly SingleInstance SingleInstance;
3030
string ModificationsName = ACTIVE_EXE_CONFIGURATION_NAME;
3131
bool RunAsAdministratorModification = false;
@@ -42,7 +42,7 @@ public FlashpointSecurePlayer() {
4242
ModeTemplates = new ModeTemplates(this);
4343
EnvironmentVariables = new EnvironmentVariables(this);
4444
DownloadsBefore = new DownloadsBefore(this);
45-
RegistryBackup = new RegistryBackup(this);
45+
RegistryBackup = new RegistryBackups(this);
4646
SingleInstance = new SingleInstance(this);
4747
}
4848

@@ -181,7 +181,7 @@ private async Task ActivateModificationsAsync(string commandLine, ErrorDelegate
181181

182182
if (modificationsElement.EnvironmentVariables.Count > 0) {
183183
try {
184-
EnvironmentVariables.Activate(ModificationsName);
184+
EnvironmentVariables.Activate(ModificationsName, Server, APPLICATION_MUTEX_NAME);
185185
} catch (EnvironmentVariablesFailedException) {
186186
errorDelegate(Properties.Resources.EnvironmentVariablesFailed);
187187
} catch (System.Configuration.ConfigurationErrorsException) {

FlashpointSecurePlayer/FlashpointSecurePlayer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<Compile Include="RunAsAdministrator.cs" />
9393
<Compile Include="SingleInstance.cs" />
9494
<Compile Include="ProcessSync.cs" />
95-
<Compile Include="RegistryBackup.cs" />
95+
<Compile Include="RegistryBackups.cs" />
9696
<Compile Include="Server.cs">
9797
<SubType>Form</SubType>
9898
</Compile>

FlashpointSecurePlayer/FlashpointSecurePlayerConfigs/activex.abcisland.abcisland.dll.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<flashpointSecurePlayer>
77
<modifications>
88
<modification name="activex\abcisland\abcisland.dll">
9+
<environmentVariables>
10+
<environmentVariable name="__COMPAT_LAYER" value="Win2000Sp2" />
11+
</environmentVariables>
912
<registryBackups binaryType="SCS_32BIT_BINARY">
1013
<registryBackup type="VALUE" keyName="HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\ATLBOXWORDCTL.ATLBOXWORDCTLATTRIB.1"
1114
valueName="" value="AtlBoxWordCtlAttrib Class" valueKind="String" />

FlashpointSecurePlayer/FlashpointSecurePlayerConfigs/activex.mjolauncher2.mjolauncher.dll.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<flashpointSecurePlayer>
77
<modifications>
88
<modification name="activex\mjolauncher2\mjolauncher.dll">
9+
<environmentVariables>
10+
<environmentVariable name="__COMPAT_LAYER" value="Win2000Sp2" />
11+
</environmentVariables>
912
<registryBackups binaryType="SCS_32BIT_BINARY">
1013
<registryBackup type="VALUE" keyName="HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\MJOLAUNCHER.MJLAUNCHERCTRL.1"
1114
valueName="" value="MJLauncherCtrl Class" valueKind="String" />

FlashpointSecurePlayer/FlashpointSecurePlayerConfigs/activex.raptisoftgameloader.rsgameloader.dll.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<flashpointSecurePlayer>
77
<modifications>
88
<modification name="activex\raptisoftgameloader\rsgameloader.dll">
9+
<environmentVariables>
10+
<environmentVariable name="__COMPAT_LAYER" value="Win2000Sp2" />
11+
</environmentVariables>
912
<registryBackups binaryType="SCS_32BIT_BINARY">
1013
<registryBackup type="VALUE" keyName="HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\RSGAMELOADER.RSGAMELOADERCTRL.1"
1114
valueName="" value="CRSGameLoaderCtrl Object" valueKind="String" />

FlashpointSecurePlayer/FlashpointSecurePlayerConfigs/java.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modeTemplates>
1111
<softwareModeTemplate hideWindow="true">
1212
<regexes>
13-
<regex name="(.+)" replace="Java\JDK_1.8.0_181\bin\appletviewer.exe -J-Dhttp.proxyHost=127.0.0.1 -J-Dhttp.proxyPort=8888 -J-Dhttps.proxyHost=127.0.0.1 -J-Dhttps.proxyPort=8888 $1" />
13+
<regex name="^\s*(?:(&quot;[^\\&quot;]*(?:\\&quot;[^\\&quot;]*)*&quot;?)\s*(.*)$)?([^\\&quot;\s]*(?:\\&quot;[^\\&quot;\s]*)*)\s*(.*)$" replace="Java\JDK_1.8.0_181\bin\appletviewer.exe -J-Dhttp.proxyHost=127.0.0.1 -J-Dhttp.proxyPort=22500 -J-Dhttps.proxyHost=127.0.0.1 -J-Dhttps.proxyPort=22500 -J-Dftp.proxyHost=127.0.0.1 -J-Dftp.proxyPort=22500 -J-DsocksProxyHost=127.0.0.1 -J-DsocksProxyPort= -J-Xbootclasspath/a:..\jre\lib\deploy.jar;..\jre\lib\javaws.jar;..\jre\lib\plugin.jar $2$4 $1$3" />
1414
</regexes>
1515
</softwareModeTemplate>
1616
</modeTemplates>

FlashpointSecurePlayer/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ public DownloadBeforeElementCollection DownloadsBefore {
546546

547547
public class RegistryBackupElementCollection : ModificationsConfigurationElementCollection {
548548
public class RegistryBackupElement : ConfigurationElement {
549-
[ConfigurationProperty("type", DefaultValue = RegistryBackup.TYPE.KEY, IsRequired = false)]
550-
public RegistryBackup.TYPE Type {
549+
[ConfigurationProperty("type", DefaultValue = global::FlashpointSecurePlayer.RegistryBackups.TYPE.KEY, IsRequired = false)]
550+
public RegistryBackups.TYPE Type {
551551
get {
552-
return (RegistryBackup.TYPE)base["type"];
552+
return (RegistryBackups.TYPE)base["type"];
553553
}
554554

555555
set {

0 commit comments

Comments
 (0)