Exemple #1
0
static void de_run_gemmeta(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	de_int64 pos;
	de_int64 hdrlen_words;
	de_int64 version;
	de_int64 imgflag;
	de_int64 bytesused;

	d = de_malloc(c, sizeof(lctx));
	de_msg(c, "Note: GEM VDI Metafiles can be parsed, but no files can be extracted from them.\n");

	pos = 0;
	hdrlen_words = de_getui16le(pos+2);
	de_dbg(c, "header length: %d words\n", (int)hdrlen_words);
	version = de_getui16le(pos+4);
	de_dbg(c, "version number: %d\n", (int)version);
	// TODO: Read more header fields.
	imgflag = de_getui16le(pos+28);
	de_dbg(c, "image flag: %d\n", (int)imgflag);

	pos += hdrlen_words*2;

	while(1) {
		if(pos >= c->infile->len) break;
		if(!do_record(c, d, pos, &bytesused)) break;
		if(bytesused<=0) break;
		pos += bytesused;
	}
	de_free(c, d);
}
Exemple #2
0
void *uzrecv(void *ptr)
{
    pthread_detach(pthread_self());
    
    rcvbuf_t* revbuf = (rcvbuf_t*)ptr;
    
    char* uzbuf = (char*)MALLOC(char, MAX_PACKET_LEN);
    memset(uzbuf, '\0', MAX_PACKET_LEN);
    long uzlen = MAX_PACKET_LEN;
    int ret = uncompress((Bytef *)uzbuf, (uLongf *)&uzlen,(Bytef *) revbuf->buffer+7, revbuf->data_len);
    if( ret == Z_OK)  
    { 
        //printf("%s\n",uzbuf);
        do_record(uzbuf, uzlen);
    }  
    else
    {
        printf("zlib uncompress failed, len:%d status:%d\n", revbuf->data_len, ret);
    }

    free(revbuf->buffer);
    free(revbuf);
    free(uzbuf);
        
	pthread_exit(NULL);
}