static int
pdbheadRead(PDBHEAD * const pdbHeadP,
            FILE *    const fileP) {

    int retval;

    fread(pdbHeadP->name, 1, 32, fileP);
    pm_readbigshortu(fileP, &pdbHeadP->flags);
    pm_readbigshortu(fileP, &pdbHeadP->version);
    pm_readbiglongu2(fileP, &pdbHeadP->ctime);
    pm_readbiglongu2(fileP, &pdbHeadP->mtime);
    pm_readbiglongu2(fileP, &pdbHeadP->btime);
    pm_readbiglongu2(fileP, &pdbHeadP->mod_num);
    pm_readbiglongu2(fileP, &pdbHeadP->app_info);
    pm_readbiglongu2(fileP, &pdbHeadP->sort_info);
    fread(pdbHeadP->type, 1, 4,  fileP);
    fread(pdbHeadP->id,   1, 4,  fileP);
    pm_readbiglongu2(fileP, &pdbHeadP->uniq_seed);
    pm_readbiglongu2(fileP, &pdbHeadP->next_rec);
    pm_readbigshortu(fileP, &pdbHeadP->num_recs);

    if (!memeq(pdbHeadP->type, IPDB_vIMG, 4) 
        || !memeq(pdbHeadP->id, IPDB_View, 4))
        retval = E_NOTIMAGE;
    else
        retval = 0;

    return retval;
}
Exemple #2
0
static ImgFormat GfxFormatFromData(const char *data, size_t len)
{
    if (!data || len < 12)
        return Img_Unknown;
    // check the most common formats first
    if (str::StartsWith(data, "\x89PNG\x0D\x0A\x1A\x0A"))
        return Img_PNG;
    if (str::StartsWith(data, "\xFF\xD8"))
        return Img_JPEG;
    if (str::StartsWith(data, "GIF87a") || str::StartsWith(data, "GIF89a"))
        return Img_GIF;
    if (str::StartsWith(data, "BM"))
        return Img_BMP;
    if (memeq(data, "MM\x00\x2A", 4) || memeq(data, "II\x2A\x00", 4))
        return Img_TIFF;
    if (tga::HasSignature(data, len))
        return Img_TGA;
    if (memeq(data, "II\xBC\x01", 4) || memeq(data, "II\xBC\x00", 4))
        return Img_JXR;
    if (webp::HasSignature(data, len))
        return Img_WebP;
    if (memeq(data, "\0\0\0\x0CjP  \x0D\x0A\x87\x0A", 12))
        return Img_JP2;
    return Img_Unknown;
}
Exemple #3
0
static void
test_value_parse_value(void) {

    xmlrpc_env env;
    xmlrpc_value * valueP;
    const char * datestring = "19980717T14:08:55";

    xmlrpc_env_init(&env);

    valueP = xmlrpc_build_value(&env, "(idb8ss#6(i){s:i}np(i))",
                                7, 3.14, (xmlrpc_bool)1, datestring,
                                "hello world", "a\0b", (size_t)3,
                                "base64 data", strlen("base64 data"),
                                15, "member9", 9, &valueP, -5);
    
    TEST_NO_FAULT(&env);

    {
        xmlrpc_int32 i;
        xmlrpc_double d;
        xmlrpc_bool b;
        const char * dt_str;
        const char * s1;
        const char * s2;
        size_t s2_len;
        const unsigned char * b64;
        size_t b64_len;
        xmlrpc_value * arrayP;
        xmlrpc_value * structP;
        void * cptr;
        xmlrpc_value * subvalP;

        xmlrpc_parse_value(&env, valueP, "(idb8ss#6ASnpV)",
                           &i, &d, &b, &dt_str, &s1, &s2, &s2_len,
                           &b64, &b64_len,
                           &arrayP, &structP, &cptr, &subvalP);
        
        TEST_NO_FAULT(&env);

        TEST(i == 7);
        TEST(d == 3.14);
        TEST(b == (xmlrpc_bool)1);
        TEST(streq(dt_str, datestring));
        TEST(streq(s1, "hello world"));
        TEST(s2_len == 3);
        TEST(memeq(s2, "a\0b", 3));
        TEST(b64_len == strlen("base64 data"));
        TEST(memeq(b64, "base64 data", b64_len));
        TEST(XMLRPC_TYPE_ARRAY == xmlrpc_value_type(arrayP));
        TEST(XMLRPC_TYPE_STRUCT == xmlrpc_value_type(structP));
        TEST(cptr == &valueP);
        TEST(XMLRPC_TYPE_ARRAY == xmlrpc_value_type(subvalP));

        xmlrpc_DECREF(valueP);
    }
    testFailedParseValue();

    xmlrpc_env_clean(&env);
}
Exemple #4
0
static void
test_value_string_cr(void) {

    xmlrpc_env env;
    xmlrpc_value * v;
    const char * str;
    size_t len;

    xmlrpc_env_init(&env);
    v = xmlrpc_string_new_cr(&env, "foo\r\nbar\r\nbaz");
    TEST_NO_FAULT(&env);
    xmlrpc_read_string(&env, v, &str);
    TEST_NO_FAULT(&env);
    TEST(streq(str, "foo\r\nbar\r\nbaz"));
    xmlrpc_DECREF(v);
    strfree(str);

    v = xmlrpc_string_new_lp_cr(&env, 7, "\0foo\rbar");
    TEST_NO_FAULT(&env);
    xmlrpc_read_string_lp(&env, v, &len, &str);
    TEST_NO_FAULT(&env);
    TEST(len == 7);
    TEST(memeq(str, "\0foo\rbar", len));
    xmlrpc_DECREF(v);
    strfree(str);

    xmlrpc_env_clean(&env);
}
Exemple #5
0
_WCRTLINK CHAR_TYPE *__F_NAME(strstr,wcsstr)( const CHAR_TYPE *s1, const CHAR_TYPE *s2 )
{
    CHAR_TYPE       *end_of_s1;
    size_t          s1len, s2len;

    if( s2[0] == NULLCHAR ) {
        return( (CHAR_TYPE *)s1 );
    } else if( s2[1] == NULLCHAR ) {
        return( __F_NAME(strchr,wcschr)( s1, s2[0] ) );
    }
#ifdef __WIDECHAR__
    end_of_s1 = (CHAR_TYPE*)s1 + wcslen( s1 );
#else
    end_of_s1 = memchr( s1, NULLCHAR, ~0u );
#endif
    s2len = __F_NAME(strlen,wcslen)( s2 );
    for( ;; ) {
        s1len = end_of_s1 - s1;
        if( s1len < s2len )
            break;
#ifdef __WIDECHAR__
        s1 = wcschr( s1, *s2 );  /* find start of possible match */
#else
        s1 = memchr( s1, *s2, s1len );  /* find start of possible match */
#endif
        if( s1 == NULL )
            break;
        if( memeq( s1, s2, s2len ) )
            return( (CHAR_TYPE *)s1 );
        ++s1;
    }
    return( NULL );
}
Exemple #6
0
void table_inc( struct table* T, char* seq )
{
    if( T->m == T->max_m ) rehash( T, T->n*2 );

    uint32_t h = hash(seq, T->read_bytes) % T->n;

    struct hashed_value* u = T->A[h];

    while(u) {
        if( memeq( u->seq, seq, T->read_bytes ) ) {
            u->count++;
            return;
        }

        u = u->next;
    }

    u = malloc(sizeof(struct hashed_value));
    u->seq = strdup(seq);

    u->count = 1;

    u->next = T->A[h];
    T->A[h] = u;

    T->m++;
}
Exemple #7
0
int endpoint_equal(RpcEndpoint *ep1, RpcEndpoint *ep2) {
	int answer = 0;		/* assume not equal */
	if (memeq(&(ep1->addr), &(ep1->addr), sizeof(struct sockaddr_in)))
		if (ep1->subport == ep2->subport)
			answer = 1;
	return answer;
}
Exemple #8
0
void
runtime·memequal(bool *eq, uintptr s, void *a, void *b)
{
	if(a == b) {
		*eq = 1;
		return;
	}
	*eq = runtime·memeq(a, b, s);
}
static int
rechdrRead(RECHDR * const rechdrP,
           FILE *   const fileP) {

    int retval;
    off_t   len;

    pm_readbiglongu2(fileP, &rechdrP->offset);

    len = (off_t)rechdrP->offset - ftell(fileP);
    switch(len) {
    case 4:
    case 12:
        /*
         * Version zero (eight bytes of record header) or version
         * two with a note (two chunks of eight record header bytes).
         */
        fread(&rechdrP->unknown[0], 1, 3, fileP);
        fread(&rechdrP->rec_type,   1, 1, fileP);
        rechdrP->n_extra = 0;
        rechdrP->extra   = NULL;
        retval = 0;
        break;
    case 6:
        /*
         * Version one (ten bytes of record header).
         */
        fread(&rechdrP->unknown[0], 1, 3, fileP);
        fread(&rechdrP->rec_type,   1, 1, fileP);
        rechdrP->n_extra = 2;
        MALLOCARRAY(rechdrP->extra, rechdrP->n_extra);
        if (rechdrP->extra == NULL)
            retval = ENOMEM;
        else {
            fread(rechdrP->extra, 1, rechdrP->n_extra, fileP);
            retval = 0;
        }
        break;
    default:
        /*
         * hmmm.... I'll assume this is the record header
         * for a text record.
         */
        fread(&rechdrP->unknown[0], 1, 3, fileP);
        fread(&rechdrP->rec_type,   1, 1, fileP);
        rechdrP->n_extra = 0;
        rechdrP->extra   = NULL;
        retval = 0;
        break;
    }
    if (retval == 0) {
        if ((rechdrP->rec_type != IMG_REC && rechdrP->rec_type != TEXT_REC)
            || !memeq(rechdrP->unknown, IPDB_MYST, 3))
            retval = E_NOTRECHDR;
    }
    return retval;
}
Exemple #10
0
static void
test_value_string_null(void) {

    xmlrpc_value * v;
    xmlrpc_env env;
    xmlrpc_env env2;
    const char * str;
    size_t len;

    /* Test a string with a '\0' byte. */

    xmlrpc_env_init(&env);

    v = xmlrpc_string_new_lp(&env, 7, "foo\0bar");
    TEST_NO_FAULT(&env);
    TEST(XMLRPC_TYPE_STRING == xmlrpc_value_type(v));
    xmlrpc_read_string_lp(&env, v, &len, &str);
    TEST_NO_FAULT(&env);
    TEST(len == 7);
    TEST(memeq(str, "foo\0bar", 7));
    xmlrpc_DECREF(v);
    strfree(str);

    v = xmlrpc_build_value(&env, "s#", "foo\0bar", (size_t) 7);
    TEST_NO_FAULT(&env);
    TEST(v != NULL);
    TEST(XMLRPC_TYPE_STRING == xmlrpc_value_type(v));

    xmlrpc_decompose_value(&env, v, "s#", &str, &len);
    TEST_NO_FAULT(&env);
    TEST(memeq(str, "foo\0bar", 7));
    TEST(len == 7);
    strfree(str);

    /* Test for type error when decoding a string with a zero byte to a
    ** regular C string. */
    xmlrpc_env_init(&env2);
    xmlrpc_decompose_value(&env2, v, "s", &str);
    TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
    xmlrpc_env_clean(&env2);
    xmlrpc_DECREF(v);

    xmlrpc_env_clean(&env);
}
Exemple #11
0
void GC_CALLBACK misc_sizes_dct(void *obj, void *cd)
{
    unsigned log_size = *(unsigned char *)obj;
    size_t size;

    my_assert(log_size < sizeof(size_t) * 8);
    my_assert(cd == NULL);
    size = (size_t)1 << log_size;
    my_assert(memeq((char *)obj + 1, 0x56, size - 1));
}
Exemple #12
0
// return true if a file starts with string s of size len
bool StartsWithN(const WCHAR *filePath, const char *s, size_t len)
{
    ScopedMem<char> buf(AllocArray<char>(len));
    if (!buf)
        return false;

    if (!ReadN(filePath, buf, len))
        return false;
    return memeq(buf, s, len);
}
Exemple #13
0
bool StartsWith(const WCHAR *filePath, const char *magicNumber, size_t len)
{
    if (len == (size_t)-1)
        len = str::Len(magicNumber);
    ScopedMem<char> header(AllocArray<char>(len));
    if (!header)
        return false;

    ReadAll(filePath, header, len);
    return memeq(header, magicNumber, len);
}
Exemple #14
0
/* compare two struct id values */
bool same_id(const struct id *a, const struct id *b)
{
	a = resolve_myid(a);
	b = resolve_myid(b);

	if (b->kind == ID_NONE || a->kind == ID_NONE)
		return TRUE; /* it's the wildcard */

	if (a->kind != b->kind)
		return FALSE;

	switch (a->kind) {
	case ID_NONE:
		return TRUE; /* repeat of above for completeness */

	case ID_IPV4_ADDR:
	case ID_IPV6_ADDR:
		return sameaddr(&a->ip_addr, &b->ip_addr);

	case ID_FQDN:
	case ID_USER_FQDN:
		/*
		 * assumptions:
		 * - case should be ignored
		 * - trailing "." should be ignored
		 *   (even if the only character?)
		 */
	{
		size_t al = a->name.len,
			bl = b->name.len;

		while (al > 0 && a->name.ptr[al - 1] == '.')
			al--;
		while (bl > 0 && b->name.ptr[bl - 1] == '.')
			bl--;
		return al == bl &&
			strncaseeq((char *)a->name.ptr,
				(char *)b->name.ptr, al);
	}

	case ID_DER_ASN1_DN:
		return same_dn(a->name, b->name);

	case ID_KEY_ID:
		return a->name.len == b->name.len &&
			memeq(a->name.ptr, b->name.ptr, a->name.len);

	default:
		bad_case(a->kind);
	}
	/* NOTREACHED */
	return FALSE;
}
/**
 * Run client to perform echo test
 */
static void run_echo_client(echo_server_config_t *config)
{
	tls_socket_t *tls;
	ssize_t len, rd, wr;
	int fd;
	host_t *host;
	identification_t *server, *client = NULL;
	char buf[128];

	host = host_create_from_string(config->addr, config->port);
	server = identification_create_from_string(config->addr);
	if (config->cauth)
	{
		client = server;
	}

	fd = socket(AF_INET, SOCK_STREAM, 0);
	ck_assert(fd != -1);
	ck_assert(connect(fd, host->get_sockaddr(host),
					  *host->get_sockaddr_len(host)) != -1);
	tls = tls_socket_create(FALSE, server, client, fd, NULL,
							config->version, TRUE);
	ck_assert(tls != NULL);

	wr = rd = 0;
	while (rd < config->data.len)
	{
		len = tls->write(tls, config->data.ptr + wr, config->data.len - wr);
		ck_assert(len >= 0);
		wr += len;

		len = tls->read(tls, buf, sizeof(buf), FALSE);
		if (len == -1 && errno == EWOULDBLOCK)
		{
			continue;
		}
		if (len == 0)
		{
			ck_assert_int_eq(rd, config->data.len);
			break;
		}
		ck_assert(len > 0);
		ck_assert(rd + len <= config->data.len);
		ck_assert(memeq(buf, config->data.ptr + rd, len));
		rd += len;
	}

	tls->destroy(tls);
	close(fd);
	host->destroy(host);
	server->destroy(server);
}
Exemple #16
0
static void
test_value_base64(void) {

    /* Test <base64> data. */

    unsigned char const data1[5] = {'a', '\0', 'b', '\n', 'c'};
    unsigned char const data2[3] = {'a', '\0', 'b'};

    xmlrpc_value * v;
    xmlrpc_env env;
    const unsigned char * data;
    size_t len;

    xmlrpc_env_init(&env);

    TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_BASE64), "BASE64"));

    v = xmlrpc_base64_new(&env, sizeof(data1), data1);
    TEST_NO_FAULT(&env);
    TEST(XMLRPC_TYPE_BASE64 == xmlrpc_value_type(v));
    xmlrpc_read_base64(&env, v, &len, &data);
    TEST_NO_FAULT(&env);
    TEST(memeq(data, data1, sizeof(data1)));
    TEST(len == sizeof(data1));
    xmlrpc_DECREF(v);
    free((void*)data);

    v = xmlrpc_build_value(&env, "6", data2, sizeof(data2));
    TEST_NO_FAULT(&env);
    TEST(XMLRPC_TYPE_BASE64 == xmlrpc_value_type(v));
    xmlrpc_decompose_value(&env, v, "6", &data, &len);
    xmlrpc_DECREF(v);
    TEST_NO_FAULT(&env);
    TEST(len == sizeof(data2));
    TEST(memeq(data, data1, sizeof(data2)));
    free((void *)data);

    xmlrpc_env_clean(&env);
}
/**
 * Described in header.
 */
void *memstr(const void *haystack, const char *needle, size_t n)
{
	unsigned const char *pos = haystack;
	size_t l = strlen(needle);
	for (; n >= l; ++pos, --n)
	{
		if (memeq(pos, needle, l))
		{
			return (void*)pos;
		}
	}
	return NULL;
}
/**
 * See header.
 */
ntru_param_set_t* ntru_param_set_get_by_oid(uint8_t const *oid)
{
	int i;

	for (i = 0; i < countof(ntru_param_sets); i++)
	{
		if (memeq(ntru_param_sets[i].oid, oid, 3))
		{
			return &ntru_param_sets[i];
		}
	}
	return NULL;
}
Exemple #19
0
int endpoint_equal(RpcEndpoint *ep1, RpcEndpoint *ep2) {
	int answer = 0;		/* assume not equal */
    
    /*
     * added by tlodge
     */
    //if (ep1 == NULL || ep2 == NULL)
     //   return answer;
    
	if (memeq(&(ep1->addr), &(ep1->addr), sizeof(struct sockaddr_in)))
		if (ep1->subport == ep2->subport)
			answer = 1;
	return answer;
}
/*
 ****************************************************************
 *	Encerra o uso das entradas da tabela "disktb"		*
 ****************************************************************
 */
int
disktb_remove_partitions (DISKTB *base_up)
{
	DISKTB		*up;
	const DISKTB	*end_up;

	/*
	 *	Prólogo
	 */
	if (base_up == NODISKTB || base_up < disktb || base_up >= next_disktb)
		{ printf ("disktb_remove_partitions: Entrada %P inválida\n", base_up); return (-1); }

	/*
	 *	Não esquece de remover os blocos do CACHE
	 */
	block_free (base_up->p_dev, NOINO);

	/*
	 *	Procura o final do dispositivo
	 */
	for (end_up = base_up; memeq (end_up->p_name, base_up->p_name, 3); end_up++)
	{
		if (end_up->p_nopen > 0)
			{ printf ("disktb_remove_partitions: \"%s\" está aberto\n", end_up->p_name); return (-1); }

		if (end_up->p_sb != NOSB)
			{ printf ("disktb_remove_partitions: \"%s\" está montado\n", end_up->p_name); return (-1); }
	}

	/*
	 *	Remove as entradas selecionadas
	 */
	while (base_up[-1].p_name[0] == '*')
		base_up--;

	while (end_up[0].p_name[0] == '*')
		end_up++;

	memclr (base_up, (char *)end_up - (char *)base_up);

	if (end_up >= next_disktb)
		{ next_disktb = base_up; return (0); }

	for (up = base_up; up < end_up; up++)
		up->p_name[0] = '*';

	return (0);

}	/* end disktb_remove_partitions */
Exemple #21
0
uint64_t table_get( struct table* T, char* seq )
{
    uint32_t h = hash(seq, T->read_bytes) % T->n;

    struct hashed_value* u = T->A[h];
    while(u) {
        if( memeq( u->seq, seq, T->read_bytes ) ) {
            return u->count;
        }

        u = u->next;
    }

    return 0;
}
Exemple #22
0
void test_misc_sizes(void)
{
    static const struct GC_finalizer_closure fc = { misc_sizes_dct, NULL };
    int i;
    for (i = 1; i <= 20; ++i) { /* Up to 1 MiB. */
        void *p = GC_finalized_malloc((size_t)1 << i, &fc);
        if (p == NULL) {
            fprintf(stderr, "Out of memory!\n");
            exit(3);
        }
        my_assert(memeq(p, 0, (size_t)1 << i));
        memset(p, 0x56, (size_t)1 << i);
        *(unsigned char *)p = i;
    }
}
Exemple #23
0
static void BenchMD5Size(void *data, size_t dataSize, char *desc)
{
    unsigned char d1[16], d2[16];
    Timer t1;
    CalcMD5Digest((unsigned char*)data, dataSize, d1);
    double dur1 = t1.GetTimeInMs();

    Timer t2;
    CalcMD5DigestWin(data, dataSize, d2);
    bool same = memeq(d1, d2, 16);
    CrashAlwaysIf(!same);
    double dur2 = t2.GetTimeInMs();
    double diff = dur1 - dur2;
    printf("%s\nCalcMD5Digest   : %f ms\nCalcMD5DigestWin: %f ms\ndiff: %f\n", desc, dur1, dur2, diff);
}
void
runtime·eqstring(String s1, String s2, bool v)
{
#line 192 "/home/pi/go_build/go/src/pkg/runtime/string.goc"

	if(s1.len != s2.len) {
		v = false;
		return;
	}
	if(s1.str == s2.str) {
		v = true;
		return;
	}
	v = runtime·memeq(s1.str, s2.str, s1.len);
	FLUSH(&v);
}
Exemple #25
0
void Database::addDevice(const BtDevice& d) {
	DEVICE dev;
	dev.address = d.address;
	dev.name = d.name;

	//if a device with this address already exists, overwrite it.
	for(int i=0; i<devices.size(); i++) {
		const DEVICE& gd(devices[i]);
		if(memeq(gd.address.a, d.address.a, BTADDR_LEN)) {
			mNServices -= gd.services.size();
			devices[i] = dev;
			return;
		}
	}
	devices.add(dev);
}
Exemple #26
0
static
char*
cache_get(const char* data, size_t size)
{
    if (size == 0)
        carp("Why are we looking up a size 0 thing?");

    for (int ii = 0; ii < MAX_CACHE_SIZE; ++ii) {
        if (cache[ii].size != size)
            continue;

        if (memeq(cache[ii].data, data, size))
            return cache[ii].hash;
    }

    return 0;
} 
Exemple #27
0
END_TEST

/*******************************************************************************
 * build_object
 */

START_TEST(test_asn1_build_object)
{
	typedef struct {
		size_t len;
		size_t size;
		u_char *b;
	} testdata_t;

	u_char b0[] = { 0x05, 0x00 };
	u_char b1[] = { 0x04, 0x7f };
	u_char b2[] = { 0x04, 0x81, 0x80 };
	u_char b3[] = { 0x04, 0x81, 0xff };
	u_char b4[] = { 0x04, 0x82, 0x01, 0x00 };
	u_char b5[] = { 0x04, 0x82, 0xff, 0xff };
	u_char b6[] = { 0x04, 0x83, 0x01, 0x00, 0x00 };

	testdata_t test[] = {
		{     0, sizeof(b0), b0 },
		{   127, sizeof(b1), b1 },
		{   128, sizeof(b2), b2 },
 		{   255, sizeof(b3), b3 },
		{   256, sizeof(b4), b4 },
		{ 65535, sizeof(b5), b5 },
		{ 65536, sizeof(b6), b6 }
	};

	chunk_t a = chunk_empty;
	u_char *pos;
	int i;

	for (i = 0; i < countof(test); i++)
	{
		pos = asn1_build_object(&a, test[i].b[0], test[i].len);
		ck_assert(pos == (a.ptr + test[i].size));
		ck_assert(a.len == test[i].size + test[i].len);
		ck_assert(memeq(a.ptr, test[i].b, test[i].size));
		chunk_free(&a);
	}
}
Exemple #28
0
void
runtime·eqstring(String s1, String s2, bool v)
{
	v = 0;
	FLUSH(&v);
#line 209 "/home/14/ren/source/golang/go/src/pkg/runtime/string.goc"

	if(s1.len != s2.len) {
		v = false;
		return;
	}
	if(s1.str == s2.str) {
		v = true;
		return;
	}
	v = runtime·memeq(s1.str, s2.str, s1.len);
	FLUSH(&v);
}
Exemple #29
0
/**
 * Described in header.
 */
void *memstr(const void *haystack, const char *needle, size_t n)
{
	const u_char *pos = haystack;
	size_t l;

	if (!haystack || !needle || (l = strlen(needle)) == 0)
	{
		return NULL;
	}
	for (; n >= l; ++pos, --n)
	{
		if (memeq(pos, needle, l))
		{
			return (void*)pos;
		}
	}
	return NULL;
}
Exemple #30
0
void Interface::Create(const char *module, const char *name)
{
	auto CreateInterface = (void *(*)(const char *, void *))GetProcAddress(GetModuleHandle(module), "CreateInterface");


	char *start = (char *)GetModuleHandle("client");

	int len = qstrlen(name);
	int nul = qstrlen(name) + 3;

	for (;; start++)
	{
		if (memeq(start, name, len) && *(start + nul) == '\0')
			break;
	}

	thisptr = CreateInterface(start, 0);
	vmthook = new VMT(thisptr);
}