与 PSECURITY_STRING 不兼容
我正在尝试使用 中的代码http://msdn.microsoft.com/en-us/library/windows/desktop/aa380536(v=VS.85).aspx
的行AcquireCredentialsHandle 表示第二个参数与 PSECURITY_STRING 不兼容。有人知道我在这里能做什么吗?
I'm trying to use code from http://msdn.microsoft.com/en-us/library/windows/desktop/aa380536(v=VS.85).aspx
The line for AcquireCredentialsHandle says that the second argument is not compatible with PSECURITY_STRING. Anyone know what I can do here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与大多数带有字符串参数的 Win32 API 函数一样,
AcquireCredentialsHandle()
映射到AcquireCredentialsHandleA()
或AcquireCredentialsHandleW()
,具体取决于UNICODE
已定义,因此它分别需要char*
或wchar_t*
指针。另一方面,SECURITY_STRING
是根据UNICODE_STRING
结构 - 两者均仅包含 UTF-16 编码的 Unicode 数据。要将
SECURITY_STRING
值传递给AcquireCredentialsHandleA()
,您需要先将SECURITY_STRING::Buffer
成员的内容转换为 Ansi:一个
SECURITY_STRING
值到AcquireCredentialsHandleW()
,您需要传递SECURITY_STRING::Buffer
成员按原样:无论哪种方式,您都不会传递指向
SECURITY_STRING
本身的指针。Like with most Win32 API functions with string parameters,
AcquireCredentialsHandle()
maps to eitherAcquireCredentialsHandleA()
orAcquireCredentialsHandleW()
depending on whetherUNICODE
is defined, so it expectschar*
orwchar_t*
pointers, respectively. ASECURITY_STRING
, on the other hand, is a structure that is modeled after theUNICODE_STRING
structure - both of which contain UTF-16 encoded Unicode data only.To pass a
SECURITY_STRING
value toAcquireCredentialsHandleA()
, you need to convert the contents of theSECURITY_STRING::Buffer
member to Ansi first:To pass a
SECURITY_STRING
value toAcquireCredentialsHandleW()
, you need to pass theSECURITY_STRING::Buffer
member as-is:Either way, you do not pass a pointer to the
SECURITY_STRING
itself.