“Parameter count mismatch” on running exe from memory

前端 未结 1 558
野趣味
野趣味 2021-01-22 01:27

This is my working code for running a simple self-made .Net executable from memory :

        FileStream fs = new FileStream(@"simple.exe",FileMode.Open)         


        
相关标签:
1条回答
  • 2021-01-22 01:50

    The entry-point is the Main() method or equivalent. There are multiple signatures allowed for this; you can have a parameterless Main(), but you can also have Main(string[]). So: you should probably check the parameters on the method (GetParameters()), and pass in something - presumably an empty string[].

    Note that entry-points are generally static; there is no need to pass in an o, and your existing CreateInstance code is non-sensical (it passes a method name to something that expects a type name). You can just pass null as the first parameter.

    0 讨论(0)
提交回复
热议问题