AcquireCredentialsHandle win32 api 函数需要 C# 签名
我以某种方式为这个 api 调用提供了签名,但是该调用没有按预期方式工作。 一些重要的数据结构没有正确填充,因此我没有得到预期的输出。 我使用的签名是:
[DllImport("secur32.dll", SetLastError = true)]
static extern ulong AcquireCredentialsHandle(
string pszPrincipal,
string pszPackage,
ulong fCredentialsUse,
IntPtr pvLogonID,
ref SEC_WINNT_AUTH_IDENTITY pAuthData,
//IntPtr pAuthData,
IntPtr pGetKeyFn,
IntPtr pGetArgumentKey,
//ref SecHandle phCredential,
IntPtr phCredential,
ref TimeStamp ptsExpiry);
请忽略评论。
我用于参考的基于c的函数调用可以找到 在这里。 我想知道我做错了什么...
I have somehow come out with a signature for this api call, but the call does not work in the expected fashion. Some vital data structures are not get populated properly hence I am not getting intended output. The signature I've used is:
[DllImport("secur32.dll", SetLastError = true)]
static extern ulong AcquireCredentialsHandle(
string pszPrincipal,
string pszPackage,
ulong fCredentialsUse,
IntPtr pvLogonID,
ref SEC_WINNT_AUTH_IDENTITY pAuthData,
//IntPtr pAuthData,
IntPtr pGetKeyFn,
IntPtr pGetArgumentKey,
//ref SecHandle phCredential,
IntPtr phCredential,
ref TimeStamp ptsExpiry);
Please ignore the comments.
The c-based function call I used for reference can be found here. I want to know what did I do wrong...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否在 pinvoke.net 上尝试过此操作?
Did you tried this at pinvoke.net?
上面的结构似乎不正确,因为 API1 文档指出
这意味着上面的代码将在 32 位上运行,但应该
在 32 位和 64 位模式上运行。
其余部分将与以前相同
您还应该小心释放句柄,因为它是非托管的。
The struct above doesn't seem correct as the API1 the documentation states
That means that the code above will work on 32bit but should be
This will work on both 32bit and 64bit modes.
The rest will be the same as previously
You should also be careful to free the handle as it is unmanaged.
来自 pInvoke.net
From pInvoke.net