Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 20:09

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Search data type

Discussion on Search data type within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
RunzelEier's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 1,196
Received Thanks: 682
Search data type

hi,

im looking for a data type.
this might sound a bit strange, so i will try to explain it to you.

i want to write a dll for a game, which reads some memoryvalues.
but strings are stored in a very weird way.

if the length of the string is smaller than 7 the string is directly stored in the object. But if the length of the string is bigger than 6 it is stored as a pointer to the string.

so here is what i do:
i wrote my own class which trys to recreate this behavior: cMyString
it looks like this:
cMyString.h
PHP Code:
#ifndef CMYCLASS_H
#define CMYCLASS_H
    
class cMyString
    
{
    public:
        
std::wstring getText();
    private:
        
std::wstring text;
        
DWORD nothing[3];//to get the right offset for len
        
int len;
    };
#endif 
cMyString.cpp
PHP Code:
#include "stdafx.h"
#include "cMyString.h"

std::wstring cMyString::getText()
{
    if(
len 7)
    {
        return 
text//i would need to dereference this and make it into a wstring
    
}else{
        return 
text;//only this works
    
}

How i use it:
e.g. to get the name of the mob: i search the mob's address in memory, cast it to my mob class, and then i add a offset to get to its name and cast this to a cMyString* and try to get the text
PHP Code:
std::wstring cEntity::getName()
{
    return ((
cMyString*)(this+NameOffset))->getText();

But i have no clue how i should make the string smaller than 7 Character work.

So my question is, how could i make it work
or even better
is there already a data type which beheaves like that, because i can hardly believe the game developers made up such a weird data type
RunzelEier is offline  
Old 10/26/2012, 17:29   #2
 
elite*gold: 5
Join Date: Sep 2006
Posts: 385
Received Thanks: 218
That's some pretty strange behaviour, are you sure about that?

Anyway, let me think about it.
The first thing I noticed is, that you're using std::wstring inside your class. I'm not sure how you're using it to interoperate with the game, but sizeof(std::wstring) != sizeof(wchar_t*). If the games class stores a pointer to an array of wchars, it will not work.
Furthermore, where in the games class is the pointer stored and where are the 6 characters? This is important to mention, because we don't know anything about said class. And if the code is just 1 byte off, it won't work.

From what I gathered it might be something like this:

Code:
class WeirdAssString
{
private:
	wchar_t* mTextPointer;
	wchar_t mText[6];
	BYTE mUnk[22];
	int mLength;
};
But again, you didn't provide enough information, so we can't help you.
Nightblizard is offline  
Old 10/26/2012, 21:47   #3
 
RunzelEier's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 1,196
Received Thanks: 682
solved the problem by using wchar_t*

PHP Code:
wchar_tcMyString::getText()
{
    if(
len 7)
    {
        return (
wchar_t*)&text;
    } else {
        return 
text;
    }

RunzelEier is offline  
Reply


Similar Threads Similar Threads
SEARCH - UNPACKER FOR TYPE 3
01/03/2012 - Metin2 Private Server - 0 Replies
Hi, SEARCH UNPACKER FOR TYPE 3 ALSO x I give LZO FROM M2M
[SEARCH] PW element.data server/client
12/06/2009 - Perfect World - 0 Replies
Hello everyone, Like i explained in the title of this topic, i'm searching for an element.data server & client above the 1.3.6 version (1.4.9 the best version you can send me). I'm searching those files in english only like my private server is an internationnal one. I can give some help for Iweb or XML editing (editing armors, weapons, set cultivation lvl,...) in exchange of the element.data files (server and client). I thanks you now for your help. Ela
[Help]Type and Data parameters for Tq Binary
08/19/2009 - CO2 Private Server - 10 Replies
I was wondering if someone can help me with Type and Data parameters in tq binarys and explain the action each one does,Help appreciated. :handsdown:
Data Search and adresses for cabal hack?
07/29/2009 - Cabal Online - 1 Replies
hey all, i've been looking for quite some time, and i couldn't find any thing on MHS prgrame from L.spiro and how to search data search and sub search hacks for cabal and what the hack does. please post the adresses to search data search type and how many bytes etc..... and what it does. also i've just read a thread about range hack and i don't get what it means quote: -Chrome- '860AA0 should be the key.' quote robciante 'magic key is-



All times are GMT +1. The time now is 20:09.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.