Created
April 12, 2013 11:50
-
-
Save alesleoignis/5371475 to your computer and use it in GitHub Desktop.
get information about current session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreFoundation/CoreFoundation.h> | |
#include <ApplicationServices/ApplicationServices.h> | |
CFStringRef shortUserName; | |
CFNumberRef userUID; | |
CFBooleanRef userIsActive; | |
CFBooleanRef loginCompleted; | |
int MyCGGetSessionInfo | |
{ | |
CFDictionaryRef sessionInfoDict; | |
sessionInfoDict = CGSessionCopyCurrentDictionary(); | |
if (sessionInfoDict == NULL) | |
{ | |
printf("Unable to get session dictionary."); | |
return(1); | |
} | |
shortUserName = CFDictionaryGetValue(sessionInfoDict, | |
kCGSessionUserNameKey); | |
userUID = CFDictionaryGetValue(sessionInfoDict, | |
kCGSessionUserIDKey); | |
userIsActive = CFDictionaryGetValue(sessionInfoDict, | |
kCGSessionOnConsoleKey); | |
loginCompleted = CFDictionaryGetValue(sessionInfoDict, | |
kCGSessionLoginDoneKey); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment