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

Function win_token_user_query

src/daemon/ipc.c:4322–4339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4320}
4321
4322static void *win_token_user_query(win_security_t *security, HANDLE token, PSID *sid_out) {
4323 DWORD needed = 0;
4324 (void)security->get_token_information(token, TokenUser, NULL, 0, &needed);
4325 if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
4326 return NULL;
4327 }
4328 /* The dynamically-resolved GetTokenInformation call initializes this
4329 * buffer on success. Zero-initialize it as defense in depth and so
4330 * static analysis does not have to infer writes through a function
4331 * pointer before TOKEN_USER is inspected. */
4332 void *buffer = calloc(1, needed);
4333 if (!buffer || !security->get_token_information(token, TokenUser, buffer, needed, &needed)) {
4334 free(buffer);
4335 return NULL;
4336 }
4337 *sid_out = ((TOKEN_USER *)buffer)->User.Sid;
4338 return buffer;
4339}
4340
4341#define RESOLVE_ADVAPI_MEMBER(context, member, type, symbol) \
4342 do { \

Callers 3

win_security_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected