C++ implementation of war3 key algorithms reversed from install.exe. This was an independant effort; it has nothing to do with the other war3 key code floating around. Email questions/comments to
[email protected]Get it at http://cs.smu.ca/~e_brooks/war3/
Future updates (if any) will be posted there.
The IDB is there for IDA 4.5 if anyone is interested in looking at the reversal. Also, an idc script (maketable.idc) is there that was used to format the key tables into an array.
It's not really a C++ implementation if it's mostly inline assembler :p
Quote from: Skywing on November 17, 2004, 10:04 PM
It's not really a C++ implementation if it's mostly inline assembler :p
Figured someone would say that. If I get some time (and interest) i'll convert the remaining parts (see the readme).
Quote from: Eibro[yL] on November 17, 2004, 10:06 PM
Quote from: Skywing on November 17, 2004, 10:04 PM
It's not really a C++ implementation if it's mostly inline assembler :p
Figured someone would say that. If I get some time (and interest) i'll convert the remaining parts (see the readme).
BTW, there are C++ equivalents for what you call multPass -- it's 64-bit math, though.
Quote from: Skywing on November 17, 2004, 11:52 PM
Quote from: Eibro[yL] on November 17, 2004, 10:06 PM
Quote from: Skywing on November 17, 2004, 10:04 PM
It's not really a C++ implementation if it's mostly inline assembler :p
Figured someone would say that. If I get some time (and interest) i'll convert the remaining parts (see the readme).
BTW, there are C++ equivalents for what you call multPass -- it's 64-bit math, though.
Yeah, I figured as much. Though I couldn't get the compiler to emit the correct instructons (see post in the assembly forum)
when we did it, Maddox was stuck on that line for quite awhile. __int64 or long long works in C++ (VS and gcc respectively), and long works in Java.
I used LARGE_INTEGER, which works quite nicely. Translates easily from the assembly. That is, if we're talking about the same bit :)
Ah, that is how I did it the first time through, but it wasn't generating the correct instructions so I scrapped it. I guess now that that problem is solved I should roll back to my previous code.union LargeInt {
struct {
unsigned long low;
unsigned long high;
};
int64 val;
}; */
BTW, we're talking about the code inside what I called 'tableMult' (.text:0041D050)
I can't find anything there in my notes, I may have used TFT though.
Quote from: Skywing on November 17, 2004, 10:04 PM
It's not really a C++ implementation if it's mostly inline assembler :p
Looks more like a C implementation.
This is the way I ended up doing that specific function.
#ifdef WIN32
typedef unsigned __int64 ULONGLONG;
#else
typedef unsigned long long ULONGLONG;
#endif
DWORD Mult(DWORD Rounds, DWORD Mul, DWORD* BufA, DWORD* BufB, DWORD DecodedByte)
{
while(Rounds--)
{
ULONGLONG edxeax = (ULONGLONG)BufA[Rounds] * (ULONGLONG)Mul;
BufB[Rounds] = DecodedByte + (DWORD)edxeax;
DecodedByte = (DWORD)(edxeax >> 32);
}
return DecodedByte;
}
Recommend looking at the UInt32x32To64 macro, and the code it generates (for future reference).
Quote from: Skywing on November 18, 2004, 10:46 PM
Recommend looking at the UInt32x32To64 macro, and the code it generates (for future reference).
Except that is native only to Windows.
Yes. However, you were reverse engineering a Windows program.
Haha...this is what I wound up with when I did my port back to C++ of the code that iago released:
void Mult( int nRounds, int nMulX, LPDWORD lpdwBufferA, LPDWORD lpdwBufferB, DWORD dwDecodedByte ) {
while ( nRounds ) {
unsigned __int64 edxeax = (unsigned __int64)((unsigned __int64)lpdwBufferA[ nRounds - 1 ] * (DWORD)nMulX);
lpdwBufferB[ --nRounds ] = dwDecodedByte + (DWORD)edxeax;
dwDecodedByte = (DWORD)(edxeax >> 32);
}
}
I would guess he called the function slightly differently than you do, since he's using different offsets into the buffers.
Quote from: Maddox on November 18, 2004, 07:49 PM
Quote from: Skywing on November 17, 2004, 10:04 PM
It's not really a C++ implementation if it's mostly inline assembler :p
Looks more like a C implementation.
This is the way I ended up doing that specific function.
#ifdef WIN32
typedef unsigned __int64 ULONGLONG;
#else
typedef unsigned long long ULONGLONG;
#endif
DWORD Mult(DWORD Rounds, DWORD Mul, DWORD* BufA, DWORD* BufB, DWORD DecodedByte)
{
while(Rounds--)
{
ULONGLONG edxeax = (ULONGLONG)BufA[Rounds] * (ULONGLONG)Mul;
BufB[Rounds] = DecodedByte + (DWORD)edxeax;
DecodedByte = (DWORD)(edxeax >> 32);
}
return DecodedByte;
}
I tried to make it easy for C programmers to use.
QuoteI would guess he called the function slightly differently than you do, since he's using different offsets into the buffers.
No, look closer. He indexes the buffer by rounds - 1 (rounds--) while I index as buflen - i - 1 (i++)
Quote from: Skywing on November 19, 2004, 12:20 AM
Yes. However, you were reverse engineering a Windows program.
And?
Quote from: Maddox on November 19, 2004, 04:46 PM
Quote from: Skywing on November 19, 2004, 12:20 AM
Yes. However, you were reverse engineering a Windows program.
And?
And it might be good to be familiar with the kinds of constructs that might appear in a Windows program if you're reversing Windows programs.
Quote from: Skywing on November 19, 2004, 05:47 PM
Quote from: Maddox on November 19, 2004, 04:46 PM
Quote from: Skywing on November 19, 2004, 12:20 AM
Yes. However, you were reverse engineering a Windows program.
And?
And it might be good to be familiar with the kinds of constructs that might appear in a Windows program if you're reversing Windows programs.
Wouldn't it be better to learn what those constructs actually do, rather than just blindly using them because they're native to windows?
Quote from: Maddox on November 19, 2004, 10:10 PM
Wouldn't it be better to learn what those constructs actually do, rather than just blindly using them because they're native to windows?
Just to clarify, that was intended to be implied by "Recommend looking at the UInt32x32To64 macro, and the code it generates (for future reference)."
Am I to assume it's too much to ask why my post was deleted? It's a topic regarding C++ Warcraft 3 cdkey algorithms, and I posted my C++ implementation. You don't like my contribution, fine, it's your forum so I'm not going to argue. Can I at least be told why the post was deleted though?
Quote from: EpicOfTimeWasted on December 02, 2004, 02:33 PM
Am I to assume it's too much to ask why my post was deleted? It's a topic regarding C++ Warcraft 3 cdkey algorithms, and I posted my C++ implementation. You don't like my contribution, fine, it's your forum so I'm not going to argue. Can I at least be told why the post was deleted though?
I'm not a moderator, but I'm pretty sure nobody here wants the so-called "new logon system" account-related things to be posted, or have posts which contain links to websites which have them.
Quote from: UserLoser on December 02, 2004, 05:39 PM
I'm not a moderator, but I'm pretty sure nobody here wants the so-called "new logon system" account-related things to be posted, or have posts which contain links to websites which have them.
I thought others had posted links to their codes for emulating it?
Quote from: Adron on December 03, 2004, 01:20 PM
Quote from: UserLoser on December 02, 2004, 05:39 PM
I'm not a moderator, but I'm pretty sure nobody here wants the so-called "new logon system" account-related things to be posted, or have posts which contain links to websites which have them.
I thought others had posted links to their codes for emulating it?
As far as I know, they were removed.
Quote from: EpicOfTimeWasted on December 02, 2004, 02:33 PM
Am I to assume it's too much to ask why my post was deleted? It's a topic regarding C++ Warcraft 3 cdkey algorithms, and I posted my C++ implementation. You don't like my contribution, fine, it's your forum so I'm not going to argue. Can I at least be told why the post was deleted though?
That is interesting. I didn't see anything wrong with your post either. Oh well.
Quote from: Adron on December 03, 2004, 04:41 PM
Quote from: UserLoser on December 03, 2004, 01:57 PM
As far as I know, they were removed.
Even iago's?
No, pretty sure he only posted that in his forum, where he's the only moderator.