Get type of binary on filesystem via C# running in 64 bit
问题 I have a C# application, compiled in Visual Studio 2017 on the 'Any CPU' target, with the 'Prefer 32-bit' option disabled. In this application, I am trying to pinvoke kernel32!GetBinaryType(). When running with 'Prefer 32-bit' enabled, it works fine. When running in either 32 or 64-bit mode from a C++ executable, it works fine. I am not sure what I am doing wrong with the 64-bit C# application. This is my pinvoke signature: [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError =