int recovery_restore(string *args, struct shell_state *sh)
{
	
	mach_error_t ret;
	
	if (args[1] == "")
	{
		ifNotQuiet cout << "args[1] must be RestoreBundlePath" << endl;
		return SHELL_CONTINUE;
	}
	
	D("Building CFMutableDictionary");
	CFMutableDictionaryRef opts;
	D("Getting AMRestoreCreateDefaultOptions");
	opts = AMRestoreCreateDefaultOptions(kCFAllocatorDefault);
	CFStringRef value = CFStringCreateWithCString(kCFAllocatorDefault, args[1].c_str(),
												  kCFStringEncodingMacRoman);
	CFDictionarySetValue(opts, CFSTR("RestoreBundlePath"), value );
	
	//    describe255(opts);

	g_recoveryDevice = sh->recovery_dev;
	ret = AMRestorePerformRecoveryModeRestore(	sh->recovery_dev, opts,
							(void *)recovery_progress_callback, NULL );

	CFRelease(value);
	ifVerbose cout 	<< "AMRestorePerformRecoveryModeRestore: " << ret << endl;
	
	return SHELL_CONTINUE;
}
Esempio n. 2
0
File: itmd.c Progetto: dzhshf/ssh-rd
void recoveryConnect(AMRecoveryModeDevice device, void* ctx)
{
    PITMD_CONTEXT c = (PITMD_CONTEXT)ctx;
    invokeCallback(c, EventRecoveryEnter, device);
    if (c->restoreOptions && c->recoveryAttempts > 0) {
        --c->recoveryAttempts;
        AMRestorePerformRecoveryModeRestore(device, c->restoreOptions, restoreProgressCallback, ctx);
    }
}