コード例 #1
0
ファイル: main.c プロジェクト: IcySon55/BootNTR
	if (ret != 0) {
		return ret;
	}
	return 0;
}


u32 patchRemoteProcess(u32 pid, u32 addr, u8* buf, u32 len) {
	u32 hProcess, hFile, ret, i, state, t;
	ret = svc_openProcess(&hProcess, pid);
	if (ret != 0) {
		showMsgPaused("openProcess failed");
		hProcess = 0;
		goto final;
	}
	ret = protectRemoteMemory(hProcess, (void*)((addr / 0x1000) * 0x1000), 0x1000);
	if (ret != 0) {
		showMsgPaused("protect failed");
		goto final;
	}
	ret = copyRemoteMemory(hProcess, (void*)addr, 0xffff8001, buf, len);
	if (ret != 0) {
		showMsgPaused("copy failed");
		goto final;
	}
	final:
	if (hProcess) {
		svc_closeHandle(hProcess);
	}
	return ret;
}
コード例 #2
0
ファイル: pm.c プロジェクト: 44670/3ds_backlight
u32 protectMemory(void* addr, u32 size) {
	return protectRemoteMemory(getCurrentProcessHandle(), addr, size);
}