Esempio n. 1
0
bool LogServer::Start()
{
	while(!IsTerminate())
	{
		ProcessNetEvent(10);
		int64_t nNowMS = XTime::MSTime();
		Service::Update(nNowMS);
		ProcessTimer(nNowMS);
		ProcessHttpMessage();
	}
	return true;
}
Esempio n. 2
0
int TestDetourCopyInstruction(PBYTE pbSrcInstruction, PCHAR pszFunction)
{
    PBYTE pbSrc = pbSrcInstruction;
    ULONG nIns = 0;

    if (pszFunction) {
        printf("%s:\n", pszFunction);
    }
    for (; nIns < 4096; nIns++) {
        BYTE rbDst[128];
        PVOID pbDstPool = (PVOID)(rbDst + sizeof(rbDst));
        LONG lExtra = 0;
        PVOID pbTarget = NULL;
        ULONG cbStep = (ULONG)((PBYTE)DetourCopyInstruction(rbDst, &pbDstPool, pbSrc,
                                                            &pbTarget, &lExtra) - pbSrc);

        printf("    %p:", pbSrc);
        DumpMemoryFragment(rbDst, cbStep, 10);
        printf(" ");
        DumpMemoryFragment(rbDst, cbStep, 10);
        if (pbTarget) {
            if (pbTarget == DETOUR_INSTRUCTION_TARGET_DYNAMIC) {
                printf("  Dynamic\n");
            }
            else {
                printf(" %p%c\n", pbTarget,
                       (pbTarget >= s_pbBegin && pbTarget < s_pbLimit) ? ' ' : '!');
            }
        }
        else {
            printf("\n");
        }

        if (pbTarget && pbTarget != DETOUR_INSTRUCTION_TARGET_DYNAMIC) {
            if (pbTarget > pbSrc &&
                pbTarget >= s_pbBegin &&
                pbTarget < s_pbLimit
               ) {
                (void) new BasicBlockLink((PBYTE)pbTarget, NULL);
            }
        }

        if (IsTerminate(pbSrc)) {
            break;
        }

        pbSrc += cbStep;
    }
    return nIns;
}
Esempio n. 3
0
void TestDetourCopyInstruction(PBYTE pbSrcInstruction, PCHAR pszFunction)
{
	PBYTE pbSrc = pbSrcInstruction;

	if (pszFunction) {
		printf("%s:\n", pszFunction);
	}
	for (ULONG nIns = 0; nIns < 4096; nIns++) {
		BYTE rbDst[128];
		LONG lExtra = 0;
		PBYTE pbTarget = NULL;
		ULONG cbStep = DetourCopyInstructionEx(rbDst, pbSrc,
											   &pbTarget, &lExtra) - pbSrc;

		printf("    %8lx:", pbSrc);
		DumpMemoryFragment(rbDst, cbStep, 10);
		printf(" ");
		DumpMemoryFragment(rbDst, cbStep, 10);
		if (pbTarget) {
			if (pbTarget == DETOUR_INSTRUCTION_TARGET_DYNAMIC) {
				printf("  Dynamic\n");
			}
			else {
				printf(" %8lx\n", pbTarget);
			}
		}
		else {
			printf("\n");
		}
		
		if (pbTarget && pbTarget != DETOUR_INSTRUCTION_TARGET_DYNAMIC) {
			if (pbTarget > pbSrc) {
				(void) new BasicBlockLink(pbTarget, NULL);
			}
		}
		
		if (IsTerminate(pbSrc)) {
			break;
		}

		pbSrc += cbStep;
	}
}
Esempio n. 4
0
void CEasyThread::Execute()
{
	while((!IsTerminate())&&(OnRun()))
	{
	}	
}