1 /* Veency - VNC Remote Access Server for iPhoneOS
2 * Copyright (C) 2008-2012 Jay Freeman (saurik)
5 /* GNU Affero General Public License, Version 3 {{{ */
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 fprintf(stderr, "_trace()@%s:%u[%s]\n", __FILE__, __LINE__, __FUNCTION__)
24 #define _likely(expr) \
25 __builtin_expect(expr, 1)
26 #define _unlikely(expr) \
27 __builtin_expect(expr, 0)
29 #include <CydiaSubstrate.h>
32 #include <rfb/keysym.h>
34 #include <mach/mach_port.h>
36 #include <sys/sysctl.h>
38 #import <QuartzCore/CAWindowServer.h>
39 #import <QuartzCore/CAWindowServerDisplay.h>
41 #import <CoreGraphics/CGGeometry.h>
42 #import <GraphicsServices/GraphicsServices.h>
43 #import <Foundation/Foundation.h>
44 #import <IOMobileFramebuffer/IOMobileFramebuffer.h>
45 #import <IOKit/IOKitLib.h>
46 #import <UIKit/UIKit.h>
48 #import <SpringBoard/SBAlertItemsController.h>
49 #import <SpringBoard/SBDismissOnlyAlertItem.h>
50 #import <SpringBoard/SBStatusBarController.h>
52 extern "C" void CoreSurfaceBufferFlushProcessorCaches(CoreSurfaceBufferRef buffer);
55 static size_t height_;
56 static NSUInteger ratio_ = 0;
58 static const size_t BytesPerPixel = 4;
59 static const size_t BitsPerSample = 8;
61 static CoreSurfaceAcceleratorRef accelerator_;
62 static CoreSurfaceBufferRef buffer_;
63 static CFDictionaryRef options_;
65 static NSMutableSet *handlers_;
66 static rfbScreenInfoPtr screen_;
71 static unsigned clients_;
73 static CFMessagePortRef ashikase_;
76 static rfbPixel *black_;
78 static void VNCBlack() {
79 if (_unlikely(black_ == NULL))
80 black_ = reinterpret_cast<rfbPixel *>(mmap(NULL, sizeof(rfbPixel) * width_ * height_, PROT_READ, MAP_ANON | MAP_PRIVATE | MAP_NOCACHE, VM_FLAGS_PURGABLE, 0));
81 screen_->frameBuffer = reinterpret_cast<char *>(black_);
84 static bool Ashikase(bool always) {
85 if (!always && !cursor_)
88 if (ashikase_ == NULL)
89 ashikase_ = CFMessagePortCreateRemote(kCFAllocatorDefault, CFSTR("jp.ashikase.mousesupport"));
90 if (ashikase_ != NULL)
97 static CFDataRef cfTrue_;
98 static CFDataRef cfFalse_;
106 static MouseEvent event_;
107 static CFDataRef cfEvent_;
110 MouseMessageTypeEvent,
111 MouseMessageTypeSetEnabled
114 static void AshikaseSendEvent(float x, float y, int buttons = 0) {
117 event_.buttons = buttons;
118 event_.absolute = true;
120 CFMessagePortSendRequest(ashikase_, MouseMessageTypeEvent, cfEvent_, 0, 0, NULL, NULL);
123 static void AshikaseSetEnabled(bool enabled, bool always) {
124 if (!Ashikase(always))
127 CFMessagePortSendRequest(ashikase_, MouseMessageTypeSetEnabled, enabled ? cfTrue_ : cfFalse_, 0, 0, NULL, NULL);
130 AshikaseSendEvent(x_, y_);
133 MSClassHook(SBAlertItemsController)
134 MSClassHook(SBStatusBarController)
137 static Class $VNCAlertItem;
139 static rfbNewClientAction action_ = RFB_CLIENT_ON_HOLD;
140 static NSCondition *condition_;
141 static NSLock *lock_;
143 static rfbClientPtr client_;
145 static void VNCSetup();
146 static void VNCEnabled();
148 @interface VNCBridge : NSObject {
151 + (void) askForConnection;
152 + (void) removeStatusBarItem;
153 + (void) registerClient;
157 @implementation VNCBridge
159 + (void) askForConnection {
160 [[$SBAlertItemsController sharedInstance] activateAlertItem:[[[$VNCAlertItem alloc] init] autorelease]];
163 + (void) removeStatusBarItem {
164 AshikaseSetEnabled(false, false);
166 if ($SBStatusBarController != nil)
167 [[$SBStatusBarController sharedStatusBarController] removeStatusBarItem:@"Veency"];
169 [[UIApplication sharedApplication] removeStatusBarImageNamed:@"Veency"];
172 + (void) registerClient {
173 // XXX: this could find a better home
175 UIScreen *screen([UIScreen mainScreen]);
176 if ([screen respondsToSelector:@selector(scale)])
177 ratio_ = [screen scale];
183 AshikaseSetEnabled(true, false);
185 if ($SBStatusBarController != nil)
186 [[$SBStatusBarController sharedStatusBarController] addStatusBarItem:@"Veency"];
188 [[UIApplication sharedApplication] addStatusBarImageNamed:@"Veency"];
191 + (void) performSetup:(NSThread *)thread {
192 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
193 [thread autorelease];
201 MSInstanceMessage2(void, VNCAlertItem, alertSheet,buttonClicked, id, sheet, int, button) {
206 action_ = RFB_CLIENT_ACCEPT;
208 @synchronized (condition_) {
209 [VNCBridge registerClient];
214 action_ = RFB_CLIENT_REFUSE;
223 MSInstanceMessage2(void, VNCAlertItem, configure,requirePasscodeForActions, BOOL, configure, BOOL, require) {
224 UIModalView *sheet([self alertSheet]);
225 [sheet setDelegate:self];
226 [sheet setTitle:@"Remote Access Request"];
227 [sheet setBodyText:[NSString stringWithFormat:@"Accept connection from\n%s?\n\nVeency VNC Server\nby Jay Freeman (saurik)\nsaurik@saurik.com\nhttp://www.saurik.com/\n\nSet a VNC password in Settings!", client_->host]];
228 [sheet addButtonWithTitle:@"Accept"];
229 [sheet addButtonWithTitle:@"Reject"];
232 MSInstanceMessage0(void, VNCAlertItem, performUnlockAction) {
233 [[$SBAlertItemsController sharedInstance] activateAlertItem:self];
236 static mach_port_t (*GSTakePurpleSystemEventPort)(void);
237 static bool PurpleAllocated;
240 static void FixRecord(GSEventRecord *record) {
242 memmove(&record->windowContextId, &record->windowContextId + 1, sizeof(*record) - (reinterpret_cast<uint8_t *>(&record->windowContextId + 1) - reinterpret_cast<uint8_t *>(record)) + record->size);
245 static void VNCSettings() {
246 NSDictionary *settings([NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.Veency.plist", NSHomeDirectory()]]);
248 @synchronized (lock_) {
249 for (NSValue *handler in handlers_)
250 rfbUnregisterSecurityHandler(reinterpret_cast<rfbSecurityHandler *>([handler pointerValue]));
251 [handlers_ removeAllObjects];
254 @synchronized (condition_) {
258 [reinterpret_cast<NSString *>(screen_->authPasswdData) release];
259 screen_->authPasswdData = NULL;
262 if (NSString *password = [settings objectForKey:@"Password"])
263 if ([password length] != 0)
264 screen_->authPasswdData = [password retain];
266 NSNumber *cursor = [settings objectForKey:@"ShowCursor"];
267 cursor_ = cursor == nil ? true : [cursor boolValue];
270 AshikaseSetEnabled(cursor_, true);
274 static void VNCNotifySettings(
275 CFNotificationCenterRef center,
284 static rfbBool VNCCheck(rfbClientPtr client, const char *data, int size) {
285 @synchronized (condition_) {
286 if (NSString *password = reinterpret_cast<NSString *>(screen_->authPasswdData)) {
287 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
288 rfbEncryptBytes(client->authChallenge, const_cast<char *>([password UTF8String]));
289 bool good(memcmp(client->authChallenge, data, size) == 0);
298 static void VNCPointer(int buttons, int x, int y, rfbClientPtr client) {
302 CGPoint location = {x, y};
304 if (width_ > height_) {
319 int diff = buttons_ ^ buttons;
320 bool twas((buttons_ & 0x1) != 0);
321 bool tis((buttons & 0x1) != 0);
324 rfbDefaultPtrAddEvent(buttons, x, y, client);
326 if (Ashikase(false)) {
327 AshikaseSendEvent(x, y, buttons);
331 mach_port_t purple(0);
333 if ((diff & 0x10) != 0) {
334 struct GSEventRecord record;
336 memset(&record, 0, sizeof(record));
338 record.type = (buttons & 0x10) != 0 ?
339 GSEventTypeHeadsetButtonDown :
340 GSEventTypeHeadsetButtonUp;
342 record.timestamp = GSCurrentEventTimestamp();
345 GSSendSystemEvent(&record);
348 if ((diff & 0x04) != 0) {
349 struct GSEventRecord record;
351 memset(&record, 0, sizeof(record));
353 record.type = (buttons & 0x04) != 0 ?
354 GSEventTypeMenuButtonDown :
355 GSEventTypeMenuButtonUp;
357 record.timestamp = GSCurrentEventTimestamp();
360 GSSendSystemEvent(&record);
363 if ((diff & 0x02) != 0) {
364 struct GSEventRecord record;
366 memset(&record, 0, sizeof(record));
368 record.type = (buttons & 0x02) != 0 ?
369 GSEventTypeLockButtonDown :
370 GSEventTypeLockButtonUp;
372 record.timestamp = GSCurrentEventTimestamp();
375 GSSendSystemEvent(&record);
378 if (twas != tis || tis) {
380 struct GSEventRecord record;
382 struct GSEventRecordInfo info;
383 struct GSPathInfo path;
387 memset(&event, 0, sizeof(event));
389 event.record.type = GSEventTypeMouse;
390 event.record.locationInWindow.x = x;
391 event.record.locationInWindow.y = y;
392 event.record.timestamp = GSCurrentEventTimestamp();
393 event.record.size = sizeof(event.data);
395 event.data.info.handInfo.type = twas == tis ?
396 GSMouseEventTypeDragged :
398 GSMouseEventTypeDown :
401 event.data.info.handInfo.x34 = 0x1;
402 event.data.info.handInfo.x38 = tis ? 0x1 : 0x0;
405 event.data.info.pathPositions = 1;
407 event.data.info.x52 = 1;
409 event.data.path.x00 = 0x01;
410 event.data.path.x01 = 0x02;
411 event.data.path.x02 = tis ? 0x03 : 0x00;
412 event.data.path.position = event.record.locationInWindow;
416 if (CAWindowServer *server = [CAWindowServer serverIfRunning]) {
417 NSArray *displays([server displays]);
418 if (displays != nil && [displays count] != 0)
419 if (CAWindowServerDisplay *display = [displays objectAtIndex:0])
420 port = [display clientPortAtPosition:location];
425 purple = (*GSTakePurpleSystemEventPort)();
429 FixRecord(&event.record);
430 GSSendEvent(&event.record, port);
433 if (purple != 0 && PurpleAllocated)
434 mach_port_deallocate(mach_task_self(), purple);
437 GSEventRef (*$GSEventCreateKeyEvent)(int, CGPoint, CFStringRef, CFStringRef, id, UniChar, short, short);
438 GSEventRef (*$GSCreateSyntheticKeyEvent)(UniChar, BOOL, BOOL);
440 static void VNCKeyboard(rfbBool down, rfbKeySym key, rfbClientPtr client) {
445 case XK_Return: key = '\r'; break;
446 case XK_BackSpace: key = 0x7f; break;
452 CGPoint point(CGPointMake(x_, y_));
454 UniChar unicode(key);
455 CFStringRef string(NULL);
457 GSEventRef event0, event1(NULL);
458 if ($GSEventCreateKeyEvent != NULL) {
459 string = CFStringCreateWithCharacters(kCFAllocatorDefault, &unicode, 1);
460 event0 = (*$GSEventCreateKeyEvent)(10, point, string, string, nil, 0, 0, 1);
461 event1 = (*$GSEventCreateKeyEvent)(11, point, string, string, nil, 0, 0, 1);
462 } else if ($GSCreateSyntheticKeyEvent != NULL) {
463 event0 = (*$GSCreateSyntheticKeyEvent)(unicode, YES, YES);
464 GSEventRecord *record(_GSEventGetGSEventRecord(event0));
465 record->type = GSEventTypeKeyDown;
470 if (CAWindowServer *server = [CAWindowServer serverIfRunning]) {
471 NSArray *displays([server displays]);
472 if (displays != nil && [displays count] != 0)
473 if (CAWindowServerDisplay *display = [displays objectAtIndex:0])
474 port = [display clientPortAtPosition:point];
477 mach_port_t purple(0);
481 purple = (*GSTakePurpleSystemEventPort)();
486 GSSendEvent(_GSEventGetGSEventRecord(event0), port);
488 GSSendEvent(_GSEventGetGSEventRecord(event1), port);
491 if (purple != 0 && PurpleAllocated)
492 mach_port_deallocate(mach_task_self(), purple);
501 static void VNCDisconnect(rfbClientPtr client) {
502 @synchronized (condition_) {
504 [VNCBridge performSelectorOnMainThread:@selector(removeStatusBarItem) withObject:nil waitUntilDone:YES];
508 static rfbNewClientAction VNCClient(rfbClientPtr client) {
509 @synchronized (condition_) {
510 if (screen_->authPasswdData != NULL) {
511 [VNCBridge performSelectorOnMainThread:@selector(registerClient) withObject:nil waitUntilDone:YES];
512 client->clientGoneHook = &VNCDisconnect;
513 return RFB_CLIENT_ACCEPT;
519 [VNCBridge performSelectorOnMainThread:@selector(askForConnection) withObject:nil waitUntilDone:NO];
520 while (action_ == RFB_CLIENT_ON_HOLD)
522 rfbNewClientAction action(action_);
523 action_ = RFB_CLIENT_ON_HOLD;
526 if (action == RFB_CLIENT_ACCEPT)
527 client->clientGoneHook = &VNCDisconnect;
531 extern "C" bool GSSystemHasCapability(NSString *);
533 static CFTypeRef (*$GSSystemCopyCapability)(CFStringRef);
534 static CFTypeRef (*$GSSystemGetCapability)(CFStringRef);
536 static void VNCSetup() {
539 @synchronized (condition_) {
541 char *arg0(strdup("VNCServer"));
542 char *argv[] = {arg0, NULL};
543 screen_ = rfbGetScreen(&argc, argv, width_, height_, BitsPerSample, 3, BytesPerPixel);
549 screen_->desktopName = strdup([[[NSProcessInfo processInfo] hostName] UTF8String]);
551 screen_->alwaysShared = TRUE;
552 screen_->handleEventsEagerly = TRUE;
553 screen_->deferUpdateTime = 1000 / 25;
555 screen_->serverFormat.redShift = BitsPerSample * 2;
556 screen_->serverFormat.greenShift = BitsPerSample * 1;
557 screen_->serverFormat.blueShift = BitsPerSample * 0;
559 $GSSystemCopyCapability = reinterpret_cast<CFTypeRef (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemCopyCapability"));
560 $GSSystemGetCapability = reinterpret_cast<CFTypeRef (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemGetCapability"));
564 if ($GSSystemCopyCapability != NULL) {
565 opengles2 = (*$GSSystemCopyCapability)(CFSTR("opengles-2"));
566 } else if ($GSSystemGetCapability != NULL) {
567 opengles2 = (*$GSSystemGetCapability)(CFSTR("opengles-2"));
568 if (opengles2 != NULL)
573 bool accelerated(opengles2 != NULL && [(NSNumber *)opengles2 boolValue]);
576 CoreSurfaceAcceleratorCreate(NULL, NULL, &accelerator_);
578 if (opengles2 != NULL)
579 CFRelease(opengles2);
581 if (accelerator_ != NULL)
582 buffer_ = CoreSurfaceBufferCreate((CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys:
583 @"PurpleEDRAM", kCoreSurfaceBufferMemoryRegion,
584 [NSNumber numberWithBool:YES], kCoreSurfaceBufferGlobal,
585 [NSNumber numberWithInt:(width_ * BytesPerPixel)], kCoreSurfaceBufferPitch,
586 [NSNumber numberWithInt:width_], kCoreSurfaceBufferWidth,
587 [NSNumber numberWithInt:height_], kCoreSurfaceBufferHeight,
588 [NSNumber numberWithInt:'BGRA'], kCoreSurfaceBufferPixelFormat,
589 [NSNumber numberWithInt:(width_ * height_ * BytesPerPixel)], kCoreSurfaceBufferAllocSize,
594 //screen_->frameBuffer = reinterpret_cast<char *>(mmap(NULL, sizeof(rfbPixel) * width_ * height_, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_NOCACHE, VM_FLAGS_PURGABLE, 0));
596 CoreSurfaceBufferLock(buffer_, 3);
597 screen_->frameBuffer = reinterpret_cast<char *>(CoreSurfaceBufferGetBaseAddress(buffer_));
598 CoreSurfaceBufferUnlock(buffer_);
600 screen_->kbdAddEvent = &VNCKeyboard;
601 screen_->ptrAddEvent = &VNCPointer;
603 screen_->newClientHook = &VNCClient;
604 screen_->passwordCheck = &VNCCheck;
606 screen_->cursor = NULL;
609 static void VNCEnabled() {
613 if (NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.Veency.plist", NSHomeDirectory()]])
614 if (NSNumber *number = [settings objectForKey:@"Enabled"])
615 enabled = [number boolValue];
617 if (enabled != running_)
620 screen_->socketState = RFB_SOCKET_INIT;
621 rfbInitServer(screen_);
622 rfbRunEventLoop(screen_, -1, true);
624 rfbShutdownServer(screen_, true);
631 static void VNCNotifyEnabled(
632 CFNotificationCenterRef center,
641 void (*$IOMobileFramebufferIsMainDisplay)(IOMobileFramebufferRef, int *);
643 static IOMobileFramebufferRef main_;
644 static CoreSurfaceBufferRef layer_;
646 static void OnLayer(IOMobileFramebufferRef fb, CoreSurfaceBufferRef layer) {
647 if (_unlikely(width_ == 0 || height_ == 0)) {
649 IOMobileFramebufferGetDisplaySize(fb, &size);
652 height_ = size.height;
654 if (width_ == 0 || height_ == 0)
657 NSThread *thread([NSThread alloc]);
660 initWithTarget:[VNCBridge class]
661 selector:@selector(performSetup:)
666 } else if (_unlikely(clients_ != 0)) {
668 if (accelerator_ != NULL)
669 memset(screen_->frameBuffer, 0, sizeof(rfbPixel) * width_ * height_);
673 if (accelerator_ != NULL)
674 CoreSurfaceAcceleratorTransferSurface(accelerator_, layer, buffer_, options_);
676 CoreSurfaceBufferLock(layer, 2);
677 rfbPixel *data(reinterpret_cast<rfbPixel *>(CoreSurfaceBufferGetBaseAddress(layer)));
679 CoreSurfaceBufferFlushProcessorCaches(layer);
681 /*rfbPixel corner(data[0]);
685 screen_->frameBuffer = const_cast<char *>(reinterpret_cast<volatile char *>(data));
686 CoreSurfaceBufferUnlock(layer);
690 rfbMarkRectAsModified(screen_, 0, 0, width_, height_);
694 static bool wait_ = false;
696 MSHook(kern_return_t, IOMobileFramebufferSwapSetLayer,
697 IOMobileFramebufferRef fb,
699 CoreSurfaceBufferRef buffer,
706 if (_unlikely(buffer == NULL))
708 else if (_unlikely(fb == NULL))
710 else if ($IOMobileFramebufferIsMainDisplay == NULL)
713 (*$IOMobileFramebufferIsMainDisplay)(fb, &main);
723 return _IOMobileFramebufferSwapSetLayer(fb, layer, buffer, bounds, frame, flags);
726 // XXX: beg rpetrich for the type of this function
727 extern "C" void *IOMobileFramebufferSwapWait(IOMobileFramebufferRef, void *, unsigned);
729 MSHook(void *, IOMobileFramebufferSwapWait, IOMobileFramebufferRef fb, void *arg1, unsigned flags) {
730 void *value(_IOMobileFramebufferSwapWait(fb, arg1, flags));
736 MSHook(void, rfbRegisterSecurityHandler, rfbSecurityHandler *handler) {
737 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
739 @synchronized (lock_) {
740 [handlers_ addObject:[NSValue valueWithPointer:handler]];
741 _rfbRegisterSecurityHandler(handler);
747 template <typename Type_>
748 static void dlset(Type_ &function, const char *name) {
749 function = reinterpret_cast<Type_>(dlsym(RTLD_DEFAULT, name));
753 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
755 MSHookSymbol(GSTakePurpleSystemEventPort, "_GSGetPurpleSystemEventPort");
756 if (GSTakePurpleSystemEventPort == NULL) {
757 MSHookSymbol(GSTakePurpleSystemEventPort, "_GSCopyPurpleSystemEventPort");
758 PurpleAllocated = true;
761 if (dlsym(RTLD_DEFAULT, "GSLibraryCopyGenerationInfoValueForKey") != NULL)
763 else if (dlsym(RTLD_DEFAULT, "GSKeyboardCreate") != NULL)
765 else if (dlsym(RTLD_DEFAULT, "GSEventGetWindowContextId") != NULL)
771 sysctlbyname("hw.machine", NULL, &size, NULL, 0);
773 sysctlbyname("hw.machine", machine, &size, NULL, 0);
774 iPad1_ = strcmp(machine, "iPad1,1") == 0;
776 dlset($GSEventCreateKeyEvent, "GSEventCreateKeyEvent");
777 dlset($GSCreateSyntheticKeyEvent, "_GSCreateSyntheticKeyEvent");
778 dlset($IOMobileFramebufferIsMainDisplay, "IOMobileFramebufferIsMainDisplay");
780 MSHookFunction(&IOMobileFramebufferSwapSetLayer, MSHake(IOMobileFramebufferSwapSetLayer));
781 MSHookFunction(&rfbRegisterSecurityHandler, MSHake(rfbRegisterSecurityHandler));
784 MSHookFunction(&IOMobileFramebufferSwapWait, MSHake(IOMobileFramebufferSwapWait));
786 $VNCAlertItem = objc_allocateClassPair(objc_getClass("SBAlertItem"), "VNCAlertItem", 0);
787 MSAddMessage2(VNCAlertItem, "v@:@i", alertSheet,buttonClicked);
788 MSAddMessage2(VNCAlertItem, "v@:cc", configure,requirePasscodeForActions);
789 MSAddMessage0(VNCAlertItem, "v@:", performUnlockAction);
790 objc_registerClassPair($VNCAlertItem);
792 CFNotificationCenterAddObserver(
793 CFNotificationCenterGetDarwinNotifyCenter(),
794 NULL, &VNCNotifyEnabled, CFSTR("com.saurik.Veency-Enabled"), NULL, 0
797 CFNotificationCenterAddObserver(
798 CFNotificationCenterGetDarwinNotifyCenter(),
799 NULL, &VNCNotifySettings, CFSTR("com.saurik.Veency-Settings"), NULL, 0
802 condition_ = [[NSCondition alloc] init];
803 lock_ = [[NSLock alloc] init];
804 handlers_ = [[NSMutableSet alloc] init];
809 cfTrue_ = CFDataCreate(kCFAllocatorDefault, reinterpret_cast<UInt8 *>(&value), sizeof(value));
812 cfFalse_ = CFDataCreate(kCFAllocatorDefault, reinterpret_cast<UInt8 *>(&value), sizeof(value));
814 cfEvent_ = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<UInt8 *>(&event_), sizeof(event_), kCFAllocatorNull);
816 options_ = (CFDictionaryRef) [[NSDictionary dictionaryWithObjectsAndKeys: