Visual Basic :
Map Resigning -
Code: Select all
Dim BR As New BinaryReader(New FileStream(Open.FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
Dim BW As New BinaryWriter(New FileStream(Open.FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
Dim Signature As Int32 = 0
Dim MapSize As Long = BR.BaseStream.Length
BR.BaseStream.Position = 2048
For i As Integer = 2048 To MapSize - 4 Step 4
Signature = Signature Xor BR.ReadInt32
Next
BW.BaseStream.Position = 720
BW.Write(Signature)
BR.Close()
BW.Close()
MsgBox("Encryption signature fixed. New signature is 0x" & Hex(Signature))
Code: Select all
Dim BR As New BinaryReader(New FileStream(Open.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
BR.BaseStream.Position = 408
MapName.Text = BR.ReadChars(32)
BR.BaseStream.Position = 720
MapSig.Text = "0x" & Hex(BR.ReadInt32)
BR.Close()
Map Resigning -
Code: Select all
BinaryReader BR = new BinaryReader(new FileStream(Open.FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite));
BinaryWriter BW = new BinaryWriter(new FileStream(Open.FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite));
Int32 Signature = 0;
long MapSize = BR.BaseStream.Length;
BR.BaseStream.Position = 2048;
for (int i = 2048; i <= MapSize - 4; i += 4)
{
Signature = Signature ^ BR.ReadInt32();
}
BW.BaseStream.Position = 720;
BW.Write(Signature);
BR.Close();
BW.Close();
MessageBox.Show("Encryption signature fixed. New signature is 0x" + Signature.ToString("X"));
Code: Select all
BinaryReader BR = new BinaryReader(new FileStream(Open.FileName, FileMode.Open, FileAccess.Read, FileShare.Read));
BR.BaseStream.Position = 408;
char[] charBuf = BR.ReadChars(32);
MapName.Text = new string(charBuf);
BR.BaseStream.Position = 720;
Int32 int32Buf = BR.ReadInt32();
MapSig.Text = int32Buf.ToString("X");
BR.Close();
Map Resigning -
Code: Select all
BinaryReader^ BR = gcnew BinaryReader( gcnew FileStream(open->FileName, FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite));
BinaryWriter^ BW = gcnew BinaryWriter( gcnew FileStream(open->FileName, FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite));
Int32 Signature = 0;
long MapSize = BR->BaseStream->Length;
BR->BaseStream->Position = 2048;
for (int i = 2048; i <= MapSize - 4; i+=4 )
{
Signature ^= BR->ReadInt32();
}
BW->BaseStream->Position = 720;
BW->Write(Signature);
MessageBox::Show("Encryption signature fixed. New signature is 0x" + Signature.ToString("X"));
BR->Close();
BW->Close();
Code: Select all
BinaryReader^ BR = gcnew BinaryReader( gcnew FileStream(open->FileName, FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite));
BR->BaseStream->Position = 408;
MapName->Text = gcnew String( BR->ReadChars(32) );
BR->BaseStream->Position = 720;
Int32^ Signature = BR->ReadInt32();
MapSig->Text = "0x" + Signature->ToString("X");
BR->Close();
It opens the map for binary reading and writing. It starts at dec 2048 and xors each dec to the end of the map. Then it writes the xored variable to dec 720.
How does getting the map name and signature work?
It opens the map for binary reading, it reads the map name at dec 408. (Reading characters). Then it positions itself at dec 720 and reads the signature int32.
How can I find the map signature with a hex editor?
-The blue is blank data
-The darker blue at the bottom is the dec/hex offset.
-The teal is non-blank data
-The red is the actual signature. When your reading the red with Int32, it will read it differently.
This couldnt have been possible without the help of Anthony, High6, and TfAv.