MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / win_token_user_query

Function win_token_user_query

src/daemon/ipc.c:3625–3642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3623}
3624
3625static void *win_token_user_query(win_security_t *security, HANDLE token, PSID *sid_out) {
3626 DWORD needed = 0;
3627 (void)security->get_token_information(token, TokenUser, NULL, 0, &needed);
3628 if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
3629 return NULL;
3630 }
3631 /* The dynamically-resolved GetTokenInformation call initializes this
3632 * buffer on success. Zero-initialize it as defense in depth and so
3633 * static analysis does not have to infer writes through a function
3634 * pointer before TOKEN_USER is inspected. */
3635 void *buffer = calloc(1, needed);
3636 if (!buffer || !security->get_token_information(token, TokenUser, buffer, needed, &needed)) {
3637 free(buffer);
3638 return NULL;
3639 }
3640 *sid_out = ((TOKEN_USER *)buffer)->User.Sid;
3641 return buffer;
3642}
3643
3644#define RESOLVE_ADVAPI_MEMBER(context, member, type, symbol) \
3645 do { \

Callers 3

win_security_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected