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

Function activation_windows_user

src/cli/activation_transaction.c:356–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354}
355
356static bool activation_windows_user(void **information_out, PSID *sid_out) {
357 *information_out = NULL;
358 *sid_out = NULL;
359 HANDLE token = NULL;
360 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) {
361 return false;
362 }
363 DWORD needed = 0;
364 (void)GetTokenInformation(token, TokenUser, NULL, 0, &needed);
365 if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
366 (void)CloseHandle(token);
367 return false;
368 }
369 void *information = calloc(1, needed);
370 bool ok =
371 information && GetTokenInformation(token, TokenUser, information, needed, &needed) != 0;
372 (void)CloseHandle(token);
373 if (!ok) {
374 free(information);
375 return false;
376 }
377 PSID sid = ((TOKEN_USER *)information)->User.Sid;
378 if (!sid || !IsValidSid(sid)) {
379 free(information);
380 return false;
381 }
382 *information_out = information;
383 *sid_out = sid;
384 return true;
385}
386
387static bool activation_windows_security_init(activation_windows_security_t *security) {
388 memset(security, 0, sizeof(*security));

Calls

no outgoing calls

Tested by

no test coverage detected