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

Function activation_windows_user

src/cli/activation_transaction.c:345–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345static bool activation_windows_user(void **information_out, PSID *sid_out) {
346 *information_out = NULL;
347 *sid_out = NULL;
348 HANDLE token = NULL;
349 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) {
350 return false;
351 }
352 DWORD needed = 0;
353 (void)GetTokenInformation(token, TokenUser, NULL, 0, &needed);
354 if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
355 (void)CloseHandle(token);
356 return false;
357 }
358 void *information = calloc(1, needed);
359 bool ok =
360 information && GetTokenInformation(token, TokenUser, information, needed, &needed) != 0;
361 (void)CloseHandle(token);
362 if (!ok) {
363 free(information);
364 return false;
365 }
366 PSID sid = ((TOKEN_USER *)information)->User.Sid;
367 if (!sid || !IsValidSid(sid)) {
368 free(information);
369 return false;
370 }
371 *information_out = information;
372 *sid_out = sid;
373 return true;
374}
375
376static bool activation_windows_security_init(activation_windows_security_t *security) {
377 memset(security, 0, sizeof(*security));

Calls

no outgoing calls

Tested by

no test coverage detected