コード例 #1
0
ファイル: file_taint.cpp プロジェクト: AmesianX/panda
void windows_read_return(CPUState *cpu, target_ulong pc, uint32_t FileHandle, uint32_t Event, uint32_t UserApcRoutine, uint32_t UserApcContext, uint32_t IoStatusBlock, uint32_t Buffer, uint32_t BufferLength, uint32_t ByteOffset, uint32_t Key) {
    CPUArchState *env = (CPUArchState*)cpu->env_ptr;
    if (env->regs[R_EAX] != STATUS_SUCCESS) return;
    IO_STATUS_BLOCK io_status_block;
    uint32_t actual_count = BufferLength;
    if (panda_virtual_memory_rw(cpu, IoStatusBlock, (uint8_t *)&io_status_block, sizeof(io_status_block), 0) != -1) {
        actual_count = io_status_block.Information;
    } else {
        if (debug) printf("file_taint: failed to read IoStatusBlock @ %x\n", IoStatusBlock);
    }
    read_return(cpu, pc, Buffer, actual_count);
}
コード例 #2
0
ファイル: parser.cpp プロジェクト: UIKit0/pyston
AST_stmt* readASTStmt(BufferedReader *reader) {
    uint8_t type = reader->readByte();
    if (VERBOSITY("parsing") >= 2)
        printf("type = %d\n", type);
    if (type == 0)
        return NULL;

    uint8_t checkbyte = reader->readByte();
    assert(checkbyte == 0xae);

    switch (type) {
        case AST_TYPE::Assign:
            return read_assign(reader);
        case AST_TYPE::AugAssign:
            return read_augassign(reader);
        case AST_TYPE::Break:
            return read_break(reader);
        case AST_TYPE::ClassDef:
            return read_classdef(reader);
        case AST_TYPE::Continue:
            return read_continue(reader);
        case AST_TYPE::Expr:
            return read_expr(reader);
        case AST_TYPE::For:
            return read_for(reader);
        case AST_TYPE::FunctionDef:
            return read_functiondef(reader);
        case AST_TYPE::Global:
            return read_global(reader);
        case AST_TYPE::If:
            return read_if(reader);
        case AST_TYPE::Import:
            return read_import(reader);
        case AST_TYPE::ImportFrom:
            return read_importfrom(reader);
        case AST_TYPE::Pass:
            return read_pass(reader);
        case AST_TYPE::Print:
            return read_print(reader);
        case AST_TYPE::Return:
            return read_return(reader);
        case AST_TYPE::While:
            return read_while(reader);
        case AST_TYPE::With:
            return read_with(reader);
        default:
            fprintf(stderr, "Unknown stmt node type (parser.cpp:" STRINGIFY(__LINE__) "): %d\n", type);
            exit(1);
            break;
    }
}
コード例 #3
0
ファイル: main.c プロジェクト: sacerise/fillit
static int	read_tetris(int fd,
                        t_tetri list[NB_LIST_TETRI_MAX], size_t *nb_tetri)
{
    int		ret;
    char	buf[BUF_SIZE];
    t_tetri	tetri;

    *nb_tetri = 0;
    while (*nb_tetri < NB_LIST_TETRI_MAX)
    {
        if (read_fuck(fd, buf, BUF_SIZE) != 1)
            return (-1);
        if (parse(buf, &tetri) == ERROR)
            return (-1);
        list[*nb_tetri] = tetri;
        (*nb_tetri)++;
        if ((ret = read_return(fd)) != 1)
            return (ret);
    }
    return (-1);
}
コード例 #4
0
ファイル: file_taint.cpp プロジェクト: AmesianX/panda
void linux_read_return(CPUState *cpu, target_ulong pc,
        uint32_t fd, uint32_t buf, uint32_t count) {
    CPUArchState *env = (CPUArchState*)cpu->env_ptr;
    read_return(cpu, pc, buf, env->regs[R_EAX]);
}