VB.NET中嵌入式DLL中的调用函数

时间:2019-07-02 14:51:15

标签: vb.net dll compilation stub


我的目标/我的问题。


我想将内置DLL中包含的函数调用到我的.exe项目中。该DLL当前为in Resource。但是我不知道该怎么做。我尝试在互联网上搜索,但找不到指南,可以结束我的工作。


我找到的东西


我发现的唯一问题是“ ILMerge”。但是,我遇到几个问题:我不是实现目标的必经之路。此外,它的文档不在VB.NET中,我更加难以理解我该怎么做..

您能指导我找到解决方法吗?

我还指定了更多问题

我意识到一个包含了我的函数Dissimulation.dll的.DLL完整的“ variable_17”。 这是其中的内容:

Option Strict Off
Option Explicit Off

Imports System.Reflection

Imports System.IO


Imports System.Security.Cryptography

Namespace Dissimulation

    Public Class Dissimulation
        Public Shared Function variable_17(ByVal variable_55 As Byte(), ByVal variable_56 As Byte()) As Byte()
            '///AES FUNCTION///

            Dim variable_57 As Byte() = Nothing
            Dim variable_58 As Byte() = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
            Using variable_59 As New MemoryStream()
                While True
                    Using variable_60 As New RijndaelManaged
                        variable_60.KeySize = 256
                        variable_60.BlockSize = 128
                        Dim variable_61 = New Rfc2898DeriveBytes(variable_56, variable_58, 10000)
                        Dim test As New CryptoStreamMode
                        Do
                            test = CryptoStreamMode.Write
                            variable_60.Key = variable_61.GetBytes(variable_60.KeySize / 8)
                            variable_60.IV = variable_61.GetBytes(variable_60.BlockSize / 8)
                            variable_60.Mode = CipherMode.CBC
                            Using variable_62 = New CryptoStream(variable_59, variable_60.CreateDecryptor(), test)
                                variable_62.Write(variable_55, 0, variable_55.Length)
                                variable_62.Close()
                                variable_57 = variable_59.ToArray
                                Return variable_57
                            End Using
                            Exit Do
                        Loop
                    End Using
                End While
            End Using
        End Function
    End Class
End Namespace

我想在源文件variable_17中调用此函数dissimulation.DLL(在source.vb中)。 这是我的方法:

Dim Al = Assembly.Load("Dissimulation")
Dim type = Al.GetType("Dissimulation.Dissimulation.variable_17")
Dim dynamicObject As Object = Activator.CreateInstance(type)
Dim returnValue = DirectCast(type.InvokeMember("getParamValue", BindingFlags.InvokeMethod Or BindingFlags.Static Or BindingFlags.Public, Nothing, dynamicObject, {variable_55, variable_56}), Byte())

仍然,我在编译时仍然遇到错误。 这是此错误:

The 'System.Type' class can not be indexed because it does not have a default property

此错误修复了以下行:

Dim type = Al.GetType ("Dissimulation.variable_17")

该错误显然意味着它找不到“ Dissimulation”程序集。但是他很好地融入了我不了解的资源中。

您能帮我解决这个问题吗? 非常感谢您

0 个答案:

没有答案