- Joined
- Feb 22, 2008
- Messages
- 2,404
- Reaction score
- 724
Assuming this code:
int EDI = 0x1505;
for( int i = 0; i < lstrlen(dir); i++ )
{
if ( dir != '.' && dir != '\' )
{
EDX = EDI * 32;
EDX = EDX + EDI;
EDX = EDX + dir;
EDI = EDX;
}
}
Is it possible to get the string from the generated number? A game that I am developing uses these numbers to access the files inside a bigger file.
I am trying to create a map-tree view of that file, so I guess I will need to decode the numbers to get the actual path.
I already asked in stackoverflow and didnt get good answers, but one guy said it would be possible and gave a pseudo-code, but I can't make it work.
He said this:
I did this (
int EDI = 0x1505;
for( int i = 0; i < lstrlen(dir); i++ )
{
if ( dir != '.' && dir != '\' )
{
EDX = EDI * 32;
EDX = EDX + EDI;
EDX = EDX + dir;
EDI = EDX;
}
}
Is it possible to get the string from the generated number? A game that I am developing uses these numbers to access the files inside a bigger file.
I am trying to create a map-tree view of that file, so I guess I will need to decode the numbers to get the actual path.
I already asked in stackoverflow and didnt get good answers, but one guy said it would be possible and gave a pseudo-code, but I can't make it work.
He said this:
So it would be only possible to reverse strings when dir would be inside a range of 33 (e.g. 0-32 or 97 - 129) and EDX does not overflow.
So, if you could assume that the string only has minuscles (which are ascii 97-122, it might be possible:
This can be further improved by bringing ch into other ranges of the ascii range (e.g. numbers, uppercase letters) if you feel, that the calculated char is incorrect. But this makes the algorithm heuristic then.
- First, subtract 0x1505 from VAL
- Then, calculate ch = VAL % 33
- Calculate ch = ch + n*33. Choose n in a way to get ch into the range 97-129, this is the next char.
- Subtract this char from VAL and divide by 33: VAL = (VAL - ch) / 33
- Iterate from step 2 until VAL is 0.
I did this (
You must be registered to see links
) but "2520255578" is not returning the correct string, which would be "data\map\realworld_r\01_yokohama\105\map_data\105.emr". (Without " )