Skip to content

Instantly share code, notes, and snippets.

@hym3242
Last active June 14, 2024 08:33
Show Gist options
  • Save hym3242/7b7431b2fe3c78ff6d967120f3ab1335 to your computer and use it in GitHub Desktop.
Save hym3242/7b7431b2fe3c78ff6d967120f3ab1335 to your computer and use it in GitHub Desktop.
Create and switch WindowServer sessions with SkyLight private functions (no need for Fast User Switching, hooray!!!), compile with `cc xxx.c -g -o xxx -framework Carbon -undefined dynamic_lookup`.
#include <stdio.h>
int SLSCreateLoginSession(int *outSession); //courtesy of NUIKit/CGSInternal
int main(){
int outsession;
int ret = SLSCreateLoginSession(&outsession);
printf("login session created: %d\n",outsession);
return ret;
}
#include <stdlib.h>
int SLSSessionSwitchToSessionID(int); // original discovery by dumping EXT symbols of SkyLight and trial&error
int main(int argc, char** argv){
return SLSSessionSwitchToSessionID(atoi(argv[1]));
}
@hym3242
Copy link
Author

hym3242 commented Jun 14, 2024

Tested pass on Ventura 13.4 22F66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment