我想将C ++代码转换为vb.net

时间:2014-08-19 14:30:38

标签: vb.net

这是用c ++测试我的shell代码的代码,我试图将它转换为程序,但它没有工作,提前感谢答案

enter code here
int main (int argc, char **argv)
{

int (*ret)();


ret = (int(*)())shellcode;  
     (int)(*ret)();             
}

这是我使用程序转换时产生的代码,但它在我的visual studio 2010中没有用:

在这里输入代码

Imports System

Shared Sub Main(ByVal args() As String)

enter code here
'C++ TO VB CONVERTER TODO TASK: This delegate declaration (converted from the original            function pointer) must be moved outside of this method:


Private Delegate Function retDelegate() As Integer ' ret is a function pointer



Dim ret As retDelegate



ret = ()shellcode ' ret points to our shellcode
                               ' shellcode is type caste as a function 
CInt(Math.Truncate(ret())) ' execute, as a function, shellcode[]

End Sub

1 个答案:

答案 0 :(得分:0)

为什么不马上调用shellcode?而不是获取它的指针并通过指针调用它。

如果你想在VB.NET中做类似的事情,它将会是这样的。

Function Func() As Integer

    Return 1
End Function

Delegate Function FuncDelegate() As Integer

Sub Main()

    Dim ret As FuncDelegate

    ret = AddressOf Func
    Console.WriteLine(ret())

End Sub