我正在使用PInvoke和DllImport属地,使用外部未经管理的损失。 例如。
[DllImport("mcs_apiD.dll", CharSet = CharSet.Auto)]
private static extern byte start_api(byte pid, byte stat, byte dbg, byte ka);
我很想知道,如果想利用另一个版本的弹道,是否有可能以某种方式改变弹道档案细节(例如:mcs_apiD.dll)
我正在使用PInvoke和DllImport属地,使用外部未经管理的损失。 例如。
[DllImport("mcs_apiD.dll", CharSet = CharSet.Auto)]
private static extern byte start_api(byte pid, byte stat, byte dbg, byte ka);
我很想知道,如果想利用另一个版本的弹道,是否有可能以某种方式改变弹道档案细节(例如:mcs_apiD.dll)
是的,你必须完成P/Invoke marshaller所做的部分工作。 移至DLL并找到出口功能的切入点。 首先是申报其签名与出口职能相符的代表:
private delegate byte start_api(byte pid, byte stat, byte dbg, byte ka);
然后使用这样的法典:
using System.ComponentModel;
using System.Runtime.InteropServices;
...
static IntPtr dllHandle;
...
if (dllHandle == IntPtr.Zero) {
dllHandle = LoadLibrary("mcs_apiD.dll");
if (dllHandle == IntPtr.Zero) throw new Win32Exception();
}
IntPtr addr = GetProcAddress(dllHandle, "_start_api@16");
if (addr == IntPtr.Zero) throw new Win32Exception();
var func = (start_api)Marshal.GetDelegateForFunctionPointer(addr, typeof(start_api));
var retval = func(1, 2, 3, 4);
...
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr LoadLibrary(string name);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
private static extern IntPtr GetProcAddress(IntPtr hModule, string name);
当然,如何纠正这一错误。 请注意,你必须使用利比里亚国防部队的实际出口名称,你不再得到P/Invoke marshaller的帮助,帮助填写国名。 如果你无法确定出口名称如何,则使用DLL。
您可以更改批次的名称,但您可以改变正在装上图书馆的道路(如从登记处或组合档案中读取),并人工装上<代码>LoadLibrary kernel32 s功能:。 我的回答是。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...