OSX 上的键盘输入 [英] Keyboard input on OSX
问题描述
我想知道是否可以从某个地方读取 OSx 上的键盘输入,例如带有/dev/input 文件的 GNU/Linux.
I was wondering if it was possible to read the keyboards input, on OSx from somewhere, such as GNU/Linux with the /dev/input files.
这样做的目的是制作一个非常简单的键盘记录器,(学习目的),或者如果有一个我可以在 C 中调用的函数.
The purpose of this is to make a very simple keylogger, (learning purpose), or if there is a function that i could call in C.
谢谢.
推荐答案
由于并非所有读者都像您一样有好意,我不会详细介绍,而是为您指出正确的方向.
Since not all readers have good intentions as you, I won't get into details, but rather point you to the right direction.
您可能知道,WindowServer 在两种环境下工作:Carbon(旧)和 Cocoa(新).这些是各自的 API:
As you may know, the WindowServer works over two environments: Carbon (old) and Cocoa (new). These are the respective APIs:
- Carbon →
InstallEventHandler(链接已损坏由于年龄?无论如何,参考书是学习碳,第6章 - 碳事件) - Cocoa → addGlobalMonitorForEventsMatchingMask
- Carbon →
InstallEventHandler(link is broken due to age? Anyway, the referenced book is Learning Carbon, Chapter 6 - Carbon Events) - Cocoa → addGlobalMonitorForEventsMatchingMask
这篇关于OSX 上的键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!