Alias for function

2019-06-17 04:39发布

I want to import some functions from kernel32.dll, but I want to use different names. Example function:

[DllImport("kernel32.dll")] private static extern bool ReadProcessMemoryProc64 (...);

private static bool BetterReadableAndWriteableName (...) {
    ReadProcessMemoryProc64(...);
}

Wrapping the function is what I actually don't want, if there is another way.

2条回答
三岁会撩人
2楼-- · 2019-06-17 05:11

Use the EntryPoint property of DllImportAttribute.

[DllImport("kernel32.dll", EntryPoint="ReadProcessMemoryProc64")]
private static extern bool BetterReadableAndWriteableName (...);
查看更多
叼着烟拽天下
3楼-- · 2019-06-17 05:25
[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemoryProc64")] 
private static extern bool MyName(...);
查看更多
登录 后发表回答