Preamble
I'm trying to disassemble and reverse-engineer a program whose author is long gone. The program provides some unique features that I have yet to find elsewhere and... I'm curious and intrigued by reverse-engineering the program. If you're just gonna try and help me find another program... don't bother.
The Problem
I'm using IDA Pro w/ Hex-Rays Decompiler to get some half-way decent pseudocode to try and speed up the reverse-engineering. One big thing that I think will help speed up things is to figure out what strings mean. So far, this is what I'm finding for strings that are more than 4 characters longer:
dword_131894E = 54264588;
dword_131894A = 51381002;
dword_1318946 = 51380998;
dword_1318942 = 52429571;
dword_131893E = 52298503;
runtimeVersion[0] = 836;
szIndex = 0;
do
{
runtimeVersion[szIndex] = (runtimeVersion[szIndex] - 1) ^ (szIndex + 882) ^ 0x47;
++szIndex;
}
while ( szIndex < 11 );
From looking at similar pseudocode for strings that are three characters, and using the Hex-Rays hover overs for type information, here's how I'm understanding this:
- runtimeVersion is a const wchar
- this means it has Unicode characters (UTF-16)
- the string is embedded in memory, but in this case, weakly encrypted (XOR?)
The above pseudocode is the same for all the big strings except the constant "882" is different for every string. I'm assuming this is some sort compile-time encryption or macro that finds strings one by one and "encrypts" them uniquely. The problem is, though, that I can't seem to get a proper looking string by replicating the pseudocode. Here's what I have in C#:
ushort[] newCharArray = new ushort[rawCharacters.Length];
// Go through and decode all of the characters.
ushort i = 0;
do {
newCharArray[i] = (ushort)((i + 882) ^ (rawCharacters[i] - 1) ^ 0x47);
++i;
}
while (i < 11);
'rawCharacters' is a ushort array. I split each of those dword entries in half and treat each one as a ushort. I put them in the array starting from the bottom to the top... So the value assigned to runtimeVersion[0] gets added to my array first, then the value from dword_131893E, then dword_1318942, etc.
I'm not sure what I'm missing here. This seems like it's so simple that it should be cake to reverse and recover the strings, but I'm getting stumped on the conversion from the pseudocode to actual code.
Thoughts?
rawCharacters
incorrectly. Can you include the source that shows the loading of the data in your C# and the Hex-Rays output of the declaration ofRuntimeVersion
? – Allmandword_131894E
and other similar variables related to the problem? DoesruntimeVersion
gets initialized from these? – Oilstone