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

Function win_token_user_query

src/daemon/ipc.c:3634–3651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

win_security_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected