登录窗口应用程序在/System/Library/LaunchDaemons/com.apple.loginwindow.plist中定义为启动配置的一部分。
从理论上讲,您可以用自己的登录窗口替换登录窗口,但我不知道您在新应用程序中必须做什么 - 我认为登录窗口比身份验证和设置用户会话要多一些 -> 除其他外,它看起来它正在做一些与启动相关的家务。
我编译了一个调用CGSCreateLoginSession的应用程序,一旦你运行它,它就会通过旋转立方体转换到登录窗口。我想这就是它需要 CoreGraphics 的原因——它只是一个在最后调用注销的图形函数。
您可以尝试使用 InputManager 并查看登录窗口是否加载代码 -> 如果确实如此,则可以更改 loginwindow NIB ( LoginWindowUI.nib ) 并添加一些按钮以使用用户浏览器显示新窗口。一旦学生选择了他/她自己的照片,您就可以在登录窗口中自动填写用户名和密码字段。
节点这都是理论,它看起来非常脆弱和不安全。
祝你好运。
稍后编辑
请注意,这是非常不安全的,因此请小心使用 - 在尝试这些东西时,我确实用软管冲洗了我的系统几次
这是一个在登录窗口中注入代码的概念验证实现。
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <strings.h>
#include <syslog.h>
#import <Cocoa/Cocoa.h>
#include <execinfo.h>
@interface LLApp:NSApplication
@end
@implementation LLApp
- (void)run
{
syslog(LOG_ERR, "LLApp being run");
[super run];
}
@end
void my_openlog(const char *ident, int logopt, int facility);
typedef struct interpose_s
{
void * new_func;
void * orig_func;
} interpose_t;
int MyNSApplicationMain(int argc, const char ** argv);
static const interpose_t interposers[] __attribute__ ((section("__DATA, __interpose"))) = {
{ (void *) my_openlog, (void *) openlog },
};
void my_openlog(const char *ident, int logopt, int facility)
{
openlog(ident, logopt, facility);
if(!strcmp(ident, "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow"))
{
[LLApp poseAsClass:[NSApplication class]];
}
else
{
syslog(LOG_ERR, "Ignoring unknown indent: >%s<", ident);
}
return;
}
代码编译为:
gcc -Wall -dynamiclib -undefined dynamic_lookup -o ~/Desktop/libinterposers.dylib testin.m -framework Cocoa
代码加载基于插入,因此 loginwindow 的启动定义必须包含一个附加条目(以启用动态链接器中的插入),即:
<key>EnvironmentVariables</key>
<dict>
<key>DYLD_INSERT_LIBRARIES</key>
<string>path_to/Desktop/libinterposers.dylib</string>
</dict>