Skip to content

Instantly share code, notes, and snippets.

@timsutton
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsutton/3d45f359ab6509c4fc62 to your computer and use it in GitHub Desktop.
Save timsutton/3d45f359ab6509c4fc62 to your computer and use it in GitHub Desktop.
Hopper pseudo-code from from SoftwareUpdate private framework
function methImpl_SUSharedPrefs_isCheckScheduled {
r14 = *objc_msgSend;
rax = [rdi objectForAnyUserPreference:@"AutomaticCheckEnabled" usingManaged:0x1 usingDefaultOverride:0x1];
rbx = rax;
rax = [NSNumber class];
rax = [rbx isKindOfClass:rax];
rcx = rax;
rax = 0x1;
if (rcx != 0x0) {
rax = [rbx boolValue];
}
rax = SIGN_EXTEND(rax);
return rax;
}
function methImpl_SUSharedPrefs_objectForAnyUserPreference_usingManaged_usingDefaultOverride_ {
r15 = r8;
r12 = rdx;
var_0 = rdi;
CFPreferencesSynchronize(*_SUPrefDomain, **kCFPreferencesAnyUser, **kCFPreferencesCurrentHost);
if (rcx == 0x0) goto loc_297b6;
goto loc_2978f;
loc_297b6:
rax = CFPreferencesCopyValue(r12, *_SUPrefDomain, r13, rbx);
if ((rax == 0x0) && (r15 != 0x0)) {
rbx = *objc_msgSend;
rax = [var_0 _valueFromDefaultOverridePlist:r12];
rax = [rax retain];
rbx = rax;
rax = 0x0;
if (rbx != 0x0) {
_SUDebugLogVerbose(@"Found override value %@ for key %@", rbx, r12);
rax = rbx;
}
}
loc_29819:
rax = [rax autorelease];
return rax;
loc_2978f:
rax = CFPreferencesAppValueIsForced(r12, *_SUPrefDomain);
if (rax == 0x0) goto loc_297b6;
rax = CFPreferencesCopyAppValue(r12, *_SUPrefDomain);
if (rax != 0x0) goto loc_29819;
goto loc_297b6;
}
function methImpl_SUBackgroundManager__evaluateScanRequirements {
rbx = rdi;
rbx._doCriticalAndConfigDataOnly = 0x0;
rbx._timeToScan = 0x0;
r13 = *objc_msgSend;
rax = [SUSharedPrefs sharedPrefManager];
rax = [rax isCheckScheduled];
if (rax != 0x0) {
r13 = *objc_msgSend;
var_0 = rbx;
rax = (r13)(*objc_classref_SUSharedPrefs, @selector(sharedPrefManager));
rax = (r13)(rax, @selector(doesBackgroundDownload));
r15 = @"NO";
if (rax != 0x0) {
r15 = @"YES";
}
r13 = *objc_msgSend;
rax = (r13)(*objc_classref_SUSharedPrefs, @selector(sharedPrefManager));
rax = (r13)(rax, @selector(doesAutomaticConfigDataInstall));
r12 = @"NO";
if (rax != 0x0) {
r12 = @"YES";
}
r13 = *objc_msgSend;
rax = (r13)(*objc_classref_SUSharedPrefs, @selector(sharedPrefManager));
rax = (r13)(rax, @selector(doesAutomaticCriticalUpdateInstall));
if (rax != 0x0) {
rbx = @"YES";
}
r13 = *objc_msgSend;
_SUDebugLogAlways(@"BackgroundActions: Automatic check parameters: autoDownload=%@, autoConfigData=%@, autoCriticalInstall=%@", r15, r12, rbx);
rax = (r13)(*objc_classref_SUSharedPrefs, @selector(sharedPrefManager));
rax = (r13)(rax, @selector(shouldPeriodicCheckFireNow));
if (rax != 0x0) {
var_0._timeToScan = 0x1;
rbx = 0x1;
}
else {
r13 = *objc_msgSend;
rax = (r13)(*objc_classref_SUSharedPrefs, @selector(sharedPrefManager));
rax = (r13)(rax, @selector(shouldCriticalAndConfigDataCheckFireNow));
rbx = 0x1;
if (rax != 0x0) {
rcx = var_0;
rcx._timeToScan = 0x1;
rcx._doCriticalAndConfigDataOnly = 0x1;
}
}
}
else {
rbx = 0x0;
_SUDebugLogAlways(@"BackgroundActions: Automatic checking disabled");
}
rax = rbx & 0xff;
return rax;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment