JamesMenetrey / MemorySharp

A C# based memory editing library targeting Windows applications, offering various functions to extract and inject data and codes into remote processes to allow interoperability.
Other
634 stars 135 forks source link

64 support?Really? #20

Open zengfr opened 4 years ago

zengfr commented 4 years ago

i see in project code https://github.com/ZenLulz/MemorySharp/blob/deepening-project/src/MemorySharp/Modules/ModuleCore.cs

var module = Process.GetCurrentProcess().Modules.Cast().FirstOrDefault Process.Modules Process.MainModule if in 64 is error "A 32 bit processes cannot access modules of a 64 bit process"

lolp1 commented 4 years ago

i see in project code https://github.com/ZenLulz/MemorySharp/blob/deepening-project/src/MemorySharp/Modules/ModuleCore.cs

var module = Process.GetCurrentProcess().Modules.Cast().FirstOrDefault Process.Modules Process.MainModule if in 64 is error "A 32 bit processes cannot access modules of a 64 bit process"

Did you compile your own project as x64?

zcanann commented 4 years ago

Hey I'm familiar with this problem -- see my answer on stackoverflow: https://stackoverflow.com/questions/36431220/getting-a-list-of-dlls-currently-loaded-in-a-process-c-sharp/41402293#41402293

Process.Modules() is not a good solution

Edit: Also what lolp1 said, your program needs to be x64 too

zengfr commented 4 years ago

i see in project code https://github.com/ZenLulz/MemorySharp/blob/deepening-project/src/MemorySharp/Modules/ModuleCore.cs var module = Process.GetCurrentProcess().Modules.Cast().FirstOrDefault Process.Modules Process.MainModule if in 64 is error "A 32 bit processes cannot access modules of a 64 bit process"

Did you compile your own project as x64?

yes platform target " x64" ."x86"","anycpu" ,select x64.

lolp1 commented 4 years ago

i see in project code https://github.com/ZenLulz/MemorySharp/blob/deepening-project/src/MemorySharp/Modules/ModuleCore.cs var module = Process.GetCurrentProcess().Modules.Cast().FirstOrDefault Process.Modules Process.MainModule if in 64 is error "A 32 bit processes cannot access modules of a 64 bit process"

Did you compile your own project as x64?

yes platform target " x64" ."x86"","anycpu" ,select x64.

Seems to work fine for me. Make sure you are using a x86 process compile (or x64) and enumerating the process modules of a compatible architecture. Though no idea what this issue has to do with MemorySharp for.

System.Diagnostics.Process.GetCurrentProcess().Modules.MainModule is a .net library function and not memorysharp.