# Arma2NET

## Recommended Posts

So is this the idea guys? I have a windows dedi server, and I run your scripts/code on it. I then fire up a mission that is coded to use the scripts. I play for a while, and it can record positions/health of everything and I shut down mission and server.

The next day I boot the server, run your scripts and then the mission and VOILA everything is back the way it was when I left ?

If this is so, and you want a noob (so things should be foolproof!) to help out running things .... just ask.

You should be able to do that with a database, as long as you've scripted your mission to do those things.

##### Share on other sites

Why doesn't it work? Is the server running the latest beta? callExtension isn't available in 1.60. .NET bytecode is portable, you won't need to recompile it for a different system.

I presume you're using Arma2NETDev? I can imagine there being some compatibility problems between it and Arma2NET in terms of assembly signing etc - the Arma2NET on the server will be expecting an assembly signed with the same key as itself, otherwise it will sandbox (read effectively cripple) your plugin. If this is the case, I'm more than happy to sign your plugin using my secret key.

The next version of Arma2NET will feature a developer mode, so you can disable sandboxing using a command line parameter and still be working with the real thing. I'll probably release this version within a few days, maybe even today if it's good enough for a stable release. Oh, and I worked on some more documentation, it's on the "Using Arma2NET" page.

Edited by Scott_NZ

##### Share on other sites

@Kremator: Yep, that's the idea.

@Scott_NZ: Yep, using the latest beta and the Arma2NETDev .dll files. I guess I'll install the Windows server version on my computer and check it a little more. I'm still not sure why it wouldn't work on the dedicated server that I was testing it on. If you have any more ideas for things to try, I would appreciate it. Thank you for all the continued work, this is making development much easier. Cheers. :)

##### Share on other sites

Check for an Arma2NET.log file in ArmA 2\Expansion\beta\@Arma2NET on the dedicated server. If it exists, it means Arma2NET was able to load (assuming you didn't copy your own Arma2NET.log file across or something). If it does exist, could you paste the contents of it here?

##### Share on other sites

No file there. Although curiously, my local copy of the game (where Arma2NET is working also does not have this log file...). I noticed in the developer zip that you provided, in ArmA 2\Expansion\beta, there are two included files:

arma2oa.exe.config

NLog.config

Are these required for logging and injecting the dlls into the game? I added these to the appropriate place but still no log file (although now for some reason the game crashes). Ugh. Can't remember what I changed recently. I don't think it was much. Well, I'll keep digging, one step forward and two steps back today. Cheers. :)

##### Share on other sites

NLog.config is used as a configuration file for logging, it stores log filename and logging behaviour etc. It isn't required for Arma2NET to function but if it's missing or misconfigured a log file won't be created.

Edit: I realise what's going on, Windows is probably preventing ArmA 2 from logging to the Program Files ArmA 2 folder. I will make it log to the My Documents ArmA 2 folder instead.

arma2oa.exe.config is needed for Arma2NET to function, it simply describes to the .NET framework where to search for Arma2NET. This belongs in the ArmA 2\Expansion\beta directory, next to the beta game executable. The contents should be as follows:

<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="@Arma2NET"/>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>


If you have a look at the readme it has a diagram of the file structure you need.

Game crashes (caused by Arma2NET or not) will be reported in the Event Viewer under Application -> Windows Logs, regardless of the NLog configuration.

Edited by Scott_NZ

##### Share on other sites

Arma2NET has been updated to version 1.4 with the following changes:

- New command-line parameter "-arma2netdev" can be used to disable sandboxing for development purposes.

- Arma2NET Logs are now stored with the main ArmA 2 logs, in the AppData\Local\ArmA 2 OA\Arma2NET Logs folder.

- Improved input checking for DateTimePlugin and WeatherPlugin.

- Internal Arma2NET improvements.

The new -arma2netdev parameter has made Arma2NetDev redundant. If you specify it, Arma2NET 1.4 will run all of the plugins with full trust. Don't enable this unless unless you know the implications of doing so!

To use, just append it to your startup shortcut or whatever you use for starting the game with:

... -nosplash -mod=Expansion\beta;Expansion\beta\Expansion;...;@Arma2NET -arma2netdev


Logs are now stored in the AppData folder to work around any Windows permission problems with writing them to Program Files.

Edited by Scott_NZ

##### Share on other sites

Alright, I'm not sure if I'm missing something, so I'm going to ask a question.

You mentioned "untrusted" plugins get sandboxed in a non dev environment, meaning they won't work/execute. Then you mentioned a few posts back that you were offering to sign somebody's plugin so it works.

Are we able to have our own private "signatures" and we can sign our own DLLs to work for our usage?

I'm not sure if I'm just misinterpreting something or not.

##### Share on other sites

Yep. It would require a rebuild of Arma2NET using a key file you create so it recognises the DLL you made, or usage of the -arma2netdev command-line option which forces Arma2NET to trust all plugins. DLLs signed using an instance of Arma2NET you built would not be recognised by the official Arma2NET due to differing signatures, so they would be sandboxed. I'm offering to sign trusted third party plugins using my super secret private key file which means that they would be recognised by the official Arma2NET. This is also done with the default plugins distributed with Arma2NET. Untrusted plugins will work to an extent, you just won't be able to do security-sensitive stuff, such as file/network IO for example.

##### Share on other sites
Yep. It would require a rebuild of Arma2NET using a key file you create so it recognises the DLL you made, or usage of the -arma2netdev command-line option which forces Arma2NET to trust all plugins. DLLs signed using an instance of Arma2NET you built would not be recognised by the official Arma2NET due to differing signatures, so they would be sandboxed. I'm offering to sign trusted third party plugins using my super secret private key file which means that they would be recognised by the official Arma2NET. This is also done with the default plugins distributed with Arma2NET. Untrusted plugins will work to an extent, you just won't be able to do security-sensitive stuff, such as file/network IO for example.

So if we build some DLLs for usage with our gamemodes, can I PM you for possible approval?

##### Share on other sites

That sounds like a good idea. You would be able to look over the code to see if there is anything 'nasty' in there first :)

Sounds like things are really progressing. Having a long-term view of this is excellent - being able to use something like this in arma2 and arma3 (or even armaX - if BIS havent put it in by then as standard!) is great.

So, will there be a super-simple (noob oriented) install of everything required for full functionality? The stuff you guys are coming up with is scary and WAY over my head :)

##### Share on other sites
So if we build some DLLs for usage with our gamemodes, can I PM you for possible approval?

Sure, ideally I need the whole solution/project folder.

@ Kremator:

I created a full installer for Arma2NET which is very streamlined, and it's trivial to add other things people might want in the future.

##### Share on other sites

Nice to see such awesome progress Scott!

On the note of signatures;

It would be more flexible if users can add keys from authors they trust.

You could argue it is less secure, on the other hand Scott might have ill intent someday, or his system might become compromised.

So there is always a chance of issues, and it's what trust-chain is all about.

Signing things with Scott's own key seems to be playing with fire - If one mistake is let through, the key, and all content signed by it would become insecure/invalidated.

Another aspect that makes the protection less useful I reckon is the fact that BI didn't add protection for the DLL's yet, so users with malicious intent would still be able to achieve their goals, regardless of Arma2Net's protection features.

But I guess it's a good design choice regardless, and we may hope BI will provide a mechanism for security for CallExtension dll's etc.

##### Share on other sites

Another aspect that makes the protection less useful I reckon is the fact that BI didn't add protection for the DLL's yet, so users with malicious intent would still be able to achieve their goals, regardless of Arma2Net's protection features.

I whish BI would address this in detail.

##### Share on other sites

Arma2NET has been updated to version 1.5 with the following changes:

- Arma2NET log now displays the correct version.

- Arma2NET will now return its version if an empty string is passed to it via callExtension.

- New Bridge.GetDeveloperMode() and Bridge.GetVersion() methods.

- Installer now checks for an installation of the .NET 4 Client Profile before continuing.

- Arma2NetMethodAddIn now throws the correct exception if matching parameters can't be found.

- Added arma2oaserver.exe.config for use with servers.

##### Share on other sites

New version frontpaged on the Armaholic homepage.

Edited by Foxhound
mirror was already updated to v1.6

##### Share on other sites

Arma2NET has been updated to version 1.6 with the following changes:

- Arma2NET consolidated into a single modfolder, improving portability and allowing Arma2NET to be used with Arma 2 1.61 stable. arma2oa.exe.config and arma2oaserver.exe.config removed.

Please report any issues/crashes you have, I have made changes which might prove to be fragile. In my testing it all works but every machine is different.

##### Share on other sites

Tested 1.6, haven't found any bugs or problems. Thanks for the continued work. :)

##### Share on other sites

Speaking of bugs, I've moved the bug tracker over to https://dev-heaven.net/projects/a2n/issues which should be more familiar/easy to use for you guys.

##### Share on other sites

Get an exception when calling any arma2net funtction (buildin, not developed).

Arma2Net Version: 1.6

Can anyone help with this ?

Exception: System.IO.FileNotFoundException

Stack:

at <Module>.Arma2Net.Unmanaged.RunInternal(SByte*, Int32, SByte*)

at <Module>.Arma2Net.Unmanaged.Run(SByte*, Int32, SByte*)

##### Share on other sites

It seems like Arma2Net.Unmanaged can't find Arma2Net.Managed.

Use the Fusion log viewer - http://msdn.microsoft.com/en-us/library/e74a18c4.aspx - if you can't find it you may need to download the Windows SDK.

Open it

Make sure Settings -> Log all binds to disk is checked

Make sure Log Location is set to Default, Log Categories is set to Default

Click Delete All, all of the entries should disappear if there are any

Reproduce your exception in-game and then click Refresh in the Fusion log viewer

Some entries should populate it. Double click on an entry to view it.

Taken from the Microsoft website, here's an example of a log. We are looking for a log in the Fusion log viewer that looks roughly like this, but the last few lines should say Arma2Net.Managed.dll etc in them.

If you find a log like this, could you paste it here?

*** Assembly Binder Log Entry (3/5/2007 @ 12:54:20 PM) ***

The operation failed.

Bind result: hr = 0x80070002. The system cannot find the file specified.

Running under executable C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\graphic\cs\graphicfailtest.exe

--- A detailed error log follows.

=== Pre-bind state information ===

LOG: DisplayName = graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null

(Fully-specified)

LOG: Appbase = C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\graphic\cs\

LOG: Initial PrivatePath = NULL

LOG: Dynamic Base = NULL

LOG: Cache Base = NULL

LOG: AppName = NULL

Calling assembly : graphicfailtest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.

===

LOG: Processing DEVPATH.

LOG: DEVPATH is not set. Falling through to regular bind.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Post-policy reference: graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null

LOG: All probing URLs attempted and failed.

##### Share on other sites

Hi Scott_NZ!

don't ask me why... today it is working.

Only a reboot was between the trys...

Tryed to regenerate the error... without success.

Great work... i hope i will have a lot of fun working with this great addin framework!

HeliJunkie

Edited by HeliJunkie
spelling

##### Share on other sites

Arma2NET has been updated to version 1.7 with the following changes:

- New function CompareVersion to compare versions, e.g. is version 1.7.0.0 higher than 1.6.0.0?

- Improved the plugin activation/deactivation system, where only one plugin is activated as needed.

- Overhauled SQF/object formatting.

- Fixed a couple of bugs related to sandboxed plugins.

- Internal code and design improvements.

or

Existing plugins will need to be recompiled for use with 1.7 as there are some breaking changes (especially with the Format class). Better sooner rather than later, this is a WIP after all :)

Feel free to contribute to the new Dev-Heaven Issue Tracker at https://dev-heaven.net/projects/a2n/issues

##### Share on other sites

Scott, do you have Skype?

I need some help with figuring out how some ArmA2Net stuff works (passing arguments from ingame to my code).

EDIT 2: I've pmed you

Edited by GossamerSolid

##### Share on other sites

Arma2NET has been updated to version 1.7.1 with the following changes:

- Fixed bug where all auto-activated plugins were ignoring Developer mode.