Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid pointer error for void *lp parameter #43

Open
avkoli opened this issue Aug 4, 2022 · 0 comments
Open

Invalid pointer error for void *lp parameter #43

avkoli opened this issue Aug 4, 2022 · 0 comments

Comments

@avkoli
Copy link

avkoli commented Aug 4, 2022

I used a 32 bit DLL method that has void *lp parameter. When IntPtr returned by Marshall.StructureToPtr was passed, DLL method returned invalid pointer error.

Solution is to cast structure to byte array, create a pointer in Codefoundry.LegacyWrapper32 process memory and pass this pointer to DLL method.

Process legacyWrapper32 = Process.GetProcessesByName("Codefoundry.LegacyWrapper32")[0];

IntPtr pnt = Internals.VirtualAllocEx(legacyWrapper32.Handle, IntPtr.Zero, buf.Length, Internals.AllocationType.Commit | Internals.AllocationType.Reserve, Internals.MemoryProtection.ReadWrite);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant