GetTokenInformation()第一个电话。做什么的? [英] GetTokenInformation() first call. What for?

查看:173
本文介绍了GetTokenInformation()第一个电话。做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找 GetTokenInformation()和<一个HREF =htt​​p://msdn.microsoft.com/en-us/library/aa446670(v=VS.85).aspx相对=nofollow>获取登录SID 例如GetTokenInformation()的需求被调用两次。第一呼叫是获得的缓冲区大小。

Looking at MSDN documentaion for GetTokenInformation() and the Getting the Logon SID example, GetTokenInformation() needs to be called twice. The first call is to get the buffer size.

因此​​,缓冲区大小的是什么?只是说我用TokenUser作为其第二个参数,我看到,第一次调用返回的dwReturnLength不是TOKEN_USER结构的大小。

So, buffer size of what? Just say I use TokenUser as its second parameter, I see that the dwReturnLength returned by first call is not the size of TOKEN_USER structure.

在此先感谢

推荐答案

TOKEN_USER 结构包含指针(特别指向一个 SID 本身具有可变长度)。这些指针必须从某个地方点。 API函数将期望足够大的缓冲区来保存,不仅在 TOKEN_USER 结构,而且所有的东西,结构分。该功能会告诉你它需要多少内存为的所有的。这都将驻留在相邻的存储。

The TOKEN_USER structure contains pointers (in particular, a pointer to a SID that itself has variable length). Those pointers have to point somewhere. The API function will expect a buffer big enough to hold not only the the TOKEN_USER structure, but also all the things that structure points to. The function tells you how much memory it needs for everything. It will all reside in adjacent memory.

这篇关于GetTokenInformation()第一个电话。做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆