2

Fiddler uses the .NET JScript language for scripting. Invoking .NET methods and initiating .NET classes is easy, but I can't figure out how to decorate things with attributes, and therefore I don't know how to PInvoke.

Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
  • I now realize that I should look at the [DLLImport](http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute(v=VS.80).aspx) page in the MSDN documentation. The example section seems to indicate that you can't do it from JScript, but I will verify tonight. – Justin Dearing Aug 23 '11 at 14:03
  • May be you can try this - https://gist.github.com/subTee/28b7439d3dfa07053b61 (I've not tested it yet) – npocmaka Mar 21 '16 at 15:44

1 Answers1

1

The default FiddlerScript shows a few sample attributes (e.g. ToolsOptions, RulesOption, etc are all attributes).

But if you're to the point where you're calling PInvoke, you probably want to skip the script engine entirely and write your extension in C# or another richer managed language. See http://www.fiddler2.com/fiddler/dev/IFiddlerExtension.asp for more information.

EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • Eric, I already did that for the real plugin I wrote. However, this is for the example script that saves sessions to an Access database. Like I said on the mailing list, I want to make that script create the database if it does not exist already. Since I got the PInvoke working in [powershell](https://gist.github.com/1166670) based on [C# code I wrote in 2006](https://github.com/zippy1981/plane-disaster/blob/master/PlaneDisaster.Dba/JetSqlUtil.cs) I might as well go all the way on this one. Once you get PInvoke working in one language its pretty easy to translate. – Justin Dearing Aug 23 '11 at 22:25