예제 #1
0
파일: main.c 프로젝트: barryk/CHDK-SD1200
void createHook (void *pNewTcb)
{
    char *name = (char*)(*(long*)((char*)pNewTcb+0x34));
    long *entry = (long*)((char*)pNewTcb+0x74);

    // always hook first task creation
    // to create SpyProc
    if (!stop_hooking){
	taskprev = (void*)(*entry);
	*entry = (long)task_start_hook;
	stop_hooking = 1;
    } else {
	// hook/replace another tasks
	if (my_ncmp(name, "tSwitchChe", 10) == 0){
	    *entry = (long)mykbd_task;
	}
	if (my_ncmp(name, "tInitFileM", 10) == 0){
	    taskfsprev = (void*)(*entry);
	    *entry = (long)task_fs;
	}

	if (my_ncmp(name, "tCaptSeqTa", 10) == 0){
	    *entry = (long)capt_seq_hook;
	}

	if (my_ncmp(name, "tMovieRecT", 10) == 0){
	    *entry = (long)movie_record_hook;
	}

	core_hook_task_create(pNewTcb);
    }
}
예제 #2
0
int main()
{
	int i, j, index, n, len, high_sum, base, tmp;
	while (scanf("%d", &base) == 1 && base) {
		scanf("%s", num);
		len = strlen(num);
		high_sum = 0;
		for (i = 0; i < 10; i++)
			sum[i] = 0;
		for (i = 0; i < len; i++) {
			num[i] -= '0';
			sum[0] += num[i];
			for (j = 0; sum[j] >= base; j++) {
				sum[j] -= base;
				sum[j + 1] += 1;
			}
			if (j > high_sum)
				high_sum = j;
		}
		for (i = 0; i <= high_sum / 2; i++) {
			tmp = sum[i];
			sum[i] = sum[high_sum - i];
			sum[high_sum - i] = tmp;
		}
		index = 0;
		while (index < len - 1 - high_sum) {
			while (my_ncmp(num + index, sum, high_sum + 1) >= 0)
				my_substract(num + index, sum, high_sum + 1, base);
			while (num[index] > 0)
				my_substract(num + index + 1, sum, high_sum + 1, base);
			index++;
		}
		while (my_ncmp(num + index, sum, high_sum + 1) >= 0)
			my_substract(num + index, sum, high_sum + 1, base);
		for (i = index; i < len; i++)
			if (num[i])
				break;
		if (i < len)
			printf("no\n");
		else
			printf("yes\n");
	}
	return 0;
}
예제 #3
0
파일: main.c 프로젝트: hsherath/chdk-a480
void createHook (void *pNewTcb)
{
    char *name = (char*)(*(long*)((char*)pNewTcb+0x34));
    long *entry = (long*)((char*)pNewTcb+0x74);
    
    //volatile long *p; p=(void*) 0xc02200E0; *p=0x46; //debug led
    
    // always hook first task creation
    // to create SpyTask
    if (!stop_hooking){
        taskprev = (void*)(*entry);
        *entry = (long)task_start_hook;
        stop_hooking = 1;
    }else{
        // hook/replace another tasks
        // Replace the call to "SwitchCheckTask" with our own procedure
        if (my_ncmp(name, "tSwitchChe", 10) == 0){
            *entry = (long)mykbd_task;
        }
        
        // Replace the call to "InitFileModules" with our own procedure
        if (my_ncmp(name, "tInitFileM", 10) == 0){
            taskfsprev = (void*)(*entry);
            *entry = (long)task_fs;
        }
        
        // Replace the call to "CaptSeqTask" with our own procedure
        if (my_ncmp(name, "tCaptSeqTa", 10) == 0){
            *entry = (long)capt_seq_hook;
        }

        if (my_ncmp(name, "tMovieRecT", 10) == 0){
            *entry = (long)movie_record_hook;
        }

core_hook_task_create(pNewTcb);
}
	}