Creating a 32-bit process mini-disk running on a 64-bit OS

I have a .net application that is designed to work in a 32-bit environment and runs on a 64-bit OS in a wow64 environment.

Now I am creating a utility (32 bit) to dump the application.

I use the following code to dump.

[DllImport("dbghelp.dll", EntryPoint = "MiniDumpWriteDump", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] static extern bool MiniDumpWriteDump(IntPtr hProcess, uint processId, SafeHandle hFile, uint dumpType, ref MiniDumpExceptionInformation expParam, IntPtr userStreamParam, IntPtr callbackParam); 

This API call executes perfectly on a 32-bit OS, but does not work on a 64-bit OS.

Has anyone dumped a 32-bit application on a 64-bit OS? Help for Pls.

+4
source share
1 answer

Make sure you have Pack = 4 in the structure definition for your MiniDumpExceptionInformation structure.

This is what I used in 32 and 64 bit C # applications:

 [StructLayout(LayoutKind.Sequential, Pack=4)] public struct MINIDUMP_EXCEPTION_INFORMATION { public uint ThreadId; /// PEXCEPTION_POINTERS->_EXCEPTION_POINTERS* public IntPtr ExceptionPointers; [MarshalAs(UnmanagedType.Bool)] public bool ClientPointers; } 

But we always use appropriate architectures (32-bit application for creating crash dumps on 32-bit processes, etc.).

+1
source

Source: https://habr.com/ru/post/1441355/


All Articles