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

Function win_token_user_query

src/daemon/ipc.c:3570–3587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3568}
3569
3570static void *win_token_user_query(win_security_t *security, HANDLE token, PSID *sid_out) {
3571 DWORD needed = 0;
3572 (void)security->get_token_information(token, TokenUser, NULL, 0, &needed);
3573 if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
3574 return NULL;
3575 }
3576 /* The dynamically-resolved GetTokenInformation call initializes this
3577 * buffer on success. Zero-initialize it as defense in depth and so
3578 * static analysis does not have to infer writes through a function
3579 * pointer before TOKEN_USER is inspected. */
3580 void *buffer = calloc(1, needed);
3581 if (!buffer || !security->get_token_information(token, TokenUser, buffer, needed, &needed)) {
3582 free(buffer);
3583 return NULL;
3584 }
3585 *sid_out = ((TOKEN_USER *)buffer)->User.Sid;
3586 return buffer;
3587}
3588
3589#define RESOLVE_ADVAPI_MEMBER(context, member, type, symbol) \
3590 do { \

Callers 3

win_security_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected