This file contains hidden or 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
#import <Foundation/Foundation.h> | |
// Useful references: | |
// -[SMProcess webKitActiveURLs] implementation used in Activity Monitor on 10.9 (search for it using Hopper) | |
// http://opensource.apple.com/source/WebKit2/WebKit2-7537.71/WebProcess/mac/WebProcessMac.mm | |
// https://github.com/rodionovd/RDProcess/blob/master/RDProcess.m | |
const CFStringRef kLSActivePageUserVisibleOriginsKey = CFSTR("LSActivePageUserVisibleOriginsKey"); | |
const int kLSMagicConstant = -1; |
This file contains hidden or 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 <mach/task.h> | |
#include <mach/mach_init.h> | |
#include <stdbool.h> | |
static bool amIAnInferior(void) | |
{ | |
mach_msg_type_number_t count = 0; | |
exception_mask_t masks[EXC_TYPES_COUNT]; | |
mach_port_t ports[EXC_TYPES_COUNT]; | |
exception_behavior_t behaviors[EXC_TYPES_COUNT]; |
This file contains hidden or 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
// task_for_pid leak | |
// **IMPORTANT** To reproduce this bug, you have to sign this program with a developer ID -- do not use a self-signed certificate or run as root! | |
// This code will cause taskgated's memory usage to grow (see activity monitor) | |
// Link to Xcode project with included info.plist: http://tinyurl.com/kps28av | |
// Radar 16230826 | |
#include <mach/mach_init.h> | |
#include <mach/task.h> | |
#include <mach/mach_port.h> |
This file contains hidden or 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
#import "ZGAppDelegate.h" | |
@interface ZGAppDelegate () | |
@property (nonatomic) NSTimer *timer; | |
@property (assign) IBOutlet NSProgressIndicator *progressIndicator; | |
@end | |
@implementation ZGAppDelegate |
This file contains hidden or 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
template <typename T, typename P> | |
void ZGSearchWithFunctionHelperRegular(T *searchValue, bool (*comparisonFunction)(ZGSearchData *, T *, T *), ZGSearchData * __unsafe_unretained searchData, ZGMemorySize dataIndex, ZGMemorySize dataAlignment, ZGMemorySize endLimit, P pointerSize, NSMutableData * __unsafe_unretained resultSet, ZGMemoryAddress address, void *bytes) | |
{ | |
const ZGMemorySize maxSteps = 4096; | |
while (dataIndex <= endLimit) | |
{ | |
ZGMemorySize numberOfVariablesFound = 0; | |
P memoryAddresses[maxSteps]; | |
ZGMemorySize numberOfStepsToTake = MIN(maxSteps, (endLimit + dataAlignment - dataIndex) / dataAlignment); |
This file contains hidden or 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
template <typename T, typename P> | |
void ZGSearchWithFunctionHelperDirect(T *searchValue, bool (*comparisonFunction)(ZGSearchData *, T *, T *), ZGSearchData * __unsafe_unretained searchData, ZGMemorySize dataIndex, ZGMemorySize dataSize, ZGMemorySize dataAlignment, ZGMemorySize endLimit, P pointerSize, NSMutableData * __unsafe_unretained resultSet, ZGMemoryAddress address, void *bytes) | |
{ | |
ZGMemorySize maxSteps = 4096; | |
while (dataIndex <= endLimit) | |
{ | |
ZGMemorySize numberOfVariablesFound = 0; | |
P memoryAddresses[maxSteps]; | |
for (ZGMemorySize stepIndex = 0; stepIndex < maxSteps && dataIndex <= endLimit; stepIndex++) | |
{ |
This file contains hidden or 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
template <typename T, typename P> | |
void ZGSearchWithFunctionHelperDirect(T *searchValue, bool (*comparisonFunction)(ZGSearchData *, T *, T *), ZGSearchData * __unsafe_unretained searchData, ZGMemorySize dataIndex, ZGMemorySize dataSize, ZGMemorySize dataAlignment, ZGMemorySize endLimit, P pointerSize, NSMutableData * __unsafe_unretained resultSet, ZGMemoryAddress address, void *bytes) | |
{ | |
//dataIndex is 'position' in the data, endLimit is (region_size) - (datatype_size) | |
//dataAlignment is amount to advance dataIndex for each iteration | |
while (dataIndex <= endLimit) | |
{ | |
if (comparisonFunction(searchData, (T *)((int8_t *)bytes + dataIndex), searchValue)) | |
{ | |
P memoryAddress = (P)(address + dataIndex); |
NewerOlder