Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to get loaded native Modules in an IL2CPP build?!

Discussion in 'Scripting' started by techmage, Jun 25, 2021.

  1. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    I am going crazy on this I have tried

    Code (CSharp):
    1. Process.GetCurrentProcess().Modules
    That gives this error on Il2CPP
    Code (CSharp):
    1. ArgumentNullException: Collection cannot be null.
    2. Parameter name: c
    3.   at System.Collections.ArrayList.InsertRange (System.Int32 index, System.Collections.ICollection c) [0x00000] in <00000000000000000000000000000000>:0
    4.   at System.Diagnostics.Process.get_Modules () [0x00000] in <00000000000000000000000000000000>:0
    Then I tried psapi.h, this method works to get handles `EnumProcessModulesEx`, but when I try to call `GetModuleFileNameEx` in order to get the name of module. It gives error code 6. Don't know whats wrong. Works in editor, but not IL2CPP.

    Then I also tried doing this through powershell with Process.Start, but Process.Start does not work on IL2CPP.

    How can I get a list of loaded native modules on IL2CPP?
     
  2. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    try this one
    AppDomain.CurrentDomain.GetAssemblies()