Tengo un Problema. por favor, ¿Puede alguien ayudarme?
He decompilado un programa en .Net y sólo quiero que funcione estas 2 lineas en el form_load.
ucVEarth1.HTMLLocation = "C:\?" + rec_path.Text + "VirtualEarth.html?"
xtraTabControl1.SelectedTabPageIndex = &HB
He intentado hacerlo pero siempre borro mas de lo necesario y me da error.
El cambio quiero realizarlo en el EXE, es decir, con un editor Hexadecimal cambiar los valores.
Este es el codigo VB .Net:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim flag1 As Boolean = False
Dim s1 As String = System.String.Empty
Dim flag2 As Boolean = Not license.ValidateLicenseAtStartup(System.String.Empty, ByRef flag1, ByRef s1)
If Not flag2 Then
GoTo label_0
End If
DisplayLicenseForm()
Close()
Try
Dim textReader1 As System.IO.TextReader = New System.IO.StreamReader("C:\?" + rec_path.Text + "monitor.XML?")
Dim i1 As Integer = 2
Dim sArr1 As String() = New string(i1) {}
Dim i2 As Integer = 1
While flag2
sArr1(i2) = textReader1.ReadLine()
i2 = i2 + 1
flag2 = i2 < i1
End While
textReader1.Close()
flag2 = (sArr1(1)) Is Nothing
If flag2 Then
GoTo label_0
End If
comboBoxEdit1.Text = sArr1(1)
Try
ucVEarth1.HTMLLocation = "C:\?" + rec_path.Text + "VirtualEarth.html?"
Catch
End Try
Catch
System.Windows.Forms.MessageBox.Show("Problem reading Monitor Number?", "Contact support@simtouch.eu?", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand)
End Try
xtraTabControl1.SelectedTabPageIndex = &HB
End Sub
Este es el codigo Decompilado:
.method private hidebysig instance void Form1_Load(object sender,
class [mscorlib]System.EventArgs e) cil managed
// SIG: 20 02 01 1C 12 25
{
// Method begins at RVA 0xe4c4
// Code size 265 (0x109)
.maxstack 4
.locals init (bool V_0,
string V_1,
class [mscorlib]System.IO.TextReader V_2,
int32 V_3,
string[] V_4,
int32 V_5,
bool V_6)
IL_0000: /* 00 | */ nop
IL_0001: /* 16 | */ ldc.i4.0
IL_0002: /* 0A | */ stloc.0
IL_0003: /* 7E | (0A)00008F */ ldsfld string [mscorlib]System.String::Empty
IL_0008: /* 0B | */ stloc.1
IL_0009: /* 02 | */ ldarg.0
IL_000a: /* 7B | (04)0000E3 */ ldfld class SimTouch_Screen.LicenseValidator SimTouch_Screen.Form1::license
IL_000f: /* 7E | (0A)00008F */ ldsfld string [mscorlib]System.String::Empty
IL_0014: /* 12 | 00 */ ldloca.s V_0
IL_0016: /* 12 | 01 */ ldloca.s V_1
IL_0018: /* 6F | (06)00019D */ callvirt instance bool SimTouch_Screen.LicenseValidator::ValidateLicenseAtStartup(string,
bool&,
string&)
IL_001d: /* 16 | */ ldc.i4.0
IL_001e: /* FE01 | */ ceq
IL_0020: /* 13 | 06 */ stloc.s V_6
IL_0022: /* 11 | 06 */ ldloc.s V_6
IL_0024: /* 2D | 04 */ brtrue.s IL_002a
IL_0026: /* 00 | */ nop
IL_0027: /* 00 | */ nop
IL_0028: /* 2B | 10 */ br.s IL_003a
IL_002a: /* 00 | */ nop
IL_002b: /* 02 | */ ldarg.0
IL_002c: /* 28 | (06)0003BF */ call instance void SimTouch_Screen.Form1::DisplayLicenseForm()
IL_0031: /* 00 | */ nop
IL_0032: /* 02 | */ ldarg.0
IL_0033: /* 28 | (0A)000096 */ call instance void [System.Windows.Forms]System.Windows.Forms.Form::Close()
IL_0038: /* 00 | */ nop
IL_0039: /* 00 | */ nop
.try
{
IL_003a: /* 00 | */ nop
IL_003b: /* 72 | (70)003F6F */ ldstr "C:\\"
IL_0040: /* 02 | */ ldarg.0
IL_0041: /* 7B | (04)00038D */ ldfld class [System.Windows.Forms]System.Windows.Forms.Label SimTouch_Screen.Form1::rec_path
IL_0046: /* 6F | (0A)000090 */ callvirt instance string [System.Windows.Forms]System.Windows.Forms.Control::get_Text()
IL_004b: /* 72 | (70)00403D */ ldstr "monitor.XML"
IL_0050: /* 28 | (0A)000095 */ call string [mscorlib]System.String::Concat(string,
string,
string)
IL_0055: /* 73 | (0A)000156 */ newobj instance void [mscorlib]System.IO.StreamReader::.ctor(string)
IL_005a: /* 0C | */ stloc.2
IL_005b: /* 18 | */ ldc.i4.2
IL_005c: /* 0D | */ stloc.3
IL_005d: /* 09 | */ ldloc.3
IL_005e: /* 8D | (01)00006D */ newarr [mscorlib]System.String
IL_0063: /* 13 | 04 */ stloc.s V_4
IL_0065: /* 17 | */ ldc.i4.1
IL_0066: /* 13 | 05 */ stloc.s V_5
IL_0068: /* 2B | 13 */ br.s IL_007d
IL_006a: /* 00 | */ nop
IL_006b: /* 11 | 04 */ ldloc.s V_4
IL_006d: /* 11 | 05 */ ldloc.s V_5
IL_006f: /* 08 | */ ldloc.2
IL_0070: /* 6F | (0A)000157 */ callvirt instance string [mscorlib]System.IO.TextReader::ReadLine()
IL_0075: /* A2 | */ stelem.ref
IL_0076: /* 00 | */ nop
IL_0077: /* 11 | 05 */ ldloc.s V_5
IL_0079: /* 17 | */ ldc.i4.1
IL_007a: /* 58 | */ add
IL_007b: /* 13 | 05 */ stloc.s V_5
IL_007d: /* 11 | 05 */ ldloc.s V_5
IL_007f: /* 09 | */ ldloc.3
IL_0080: /* FE04 | */ clt
IL_0082: /* 13 | 06 */ stloc.s V_6
IL_0084: /* 11 | 06 */ ldloc.s V_6
IL_0086: /* 2D | E2 */ brtrue.s IL_006a
IL_0088: /* 08 | */ ldloc.2
IL_0089: /* 6F | (0A)000158 */ callvirt instance void [mscorlib]System.IO.TextReader::Close()
IL_008e: /* 00 | */ nop
IL_008f: /* 11 | 04 */ ldloc.s V_4
IL_0091: /* 17 | */ ldc.i4.1
IL_0092: /* 9A | */ ldelem.ref
IL_0093: /* 14 | */ ldnull
IL_0094: /* FE01 | */ ceq
IL_0096: /* 13 | 06 */ stloc.s V_6
IL_0098: /* 11 | 06 */ ldloc.s V_6
IL_009a: /* 2D | 12 */ brtrue.s IL_00ae
IL_009c: /* 00 | */ nop
IL_009d: /* 02 | */ ldarg.0
IL_009e: /* 7B | (04)000308 */ ldfld class ['DevExpress.XtraEditors.v8.3']DevExpress.XtraEditors.ComboBoxEdit SimTouch_Screen.Form1::comboBoxEdit1
IL_00a3: /* 11 | 04 */ ldloc.s V_4
IL_00a5: /* 17 | */ ldc.i4.1
IL_00a6: /* 9A | */ ldelem.ref
IL_00a7: /* 6F | (0A)00008E */ callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_00ac: /* 00 | */ nop
IL_00ad: /* 00 | */ nop
.try
{
IL_00ae: /* 00 | */ nop
IL_00af: /* 02 | */ ldarg.0
IL_00b0: /* 7B | (04)0001DE */ ldfld class [VEarth]VEarth.ucVEarth SimTouch_Screen.Form1::ucVEarth1
IL_00b5: /* 72 | (70)003F6F */ ldstr "C:\\"
IL_00ba: /* 02 | */ ldarg.0
IL_00bb: /* 7B | (04)00038D */ ldfld class [System.Windows.Forms]System.Windows.Forms.Label SimTouch_Screen.Form1::rec_path
IL_00c0: /* 6F | (0A)000090 */ callvirt instance string [System.Windows.Forms]System.Windows.Forms.Control::get_Text()
IL_00c5: /* 72 | (70)004055 */ ldstr "VirtualEarth.html"
IL_00ca: /* 28 | (0A)000095 */ call string [mscorlib]System.String::Concat(string,
string,
string)
IL_00cf: /* 6F | (0A)000159 */ callvirt instance void [VEarth]VEarth.ucVEarth::set_HTMLLocation(string)
IL_00d4: /* 00 | */ nop
IL_00d5: /* 00 | */ nop
IL_00d6: /* DE | 05 */ leave.s IL_00dd
} // end .try
catch [mscorlib]System.Object
{
IL_00d8: /* 26 | */ pop
IL_00d9: /* 00 | */ nop
IL_00da: /* 00 | */ nop
IL_00db: /* DE | 00 */ leave.s IL_00dd
} // end handler
// HEX: 00 00 00 00 AE 00 00 00 2A 00 00 00 D8 00 00 00 05 00 00 00 02 00 00 01
IL_00dd: /* 00 | */ nop
IL_00de: /* 00 | */ nop
IL_00df: /* DE | 18 */ leave.s IL_00f9
} // end .try
catch [mscorlib]System.Object
{
IL_00e1: /* 26 | */ pop
IL_00e2: /* 00 | */ nop
IL_00e3: /* 72 | (70)004079 */ ldstr "Problem reading Monitor Number"
IL_00e8: /* 72 | (70)0040B7 */ ldstr "Contact support@simtouch.eu"
IL_00ed: /* 16 | */ ldc.i4.0
IL_00ee: /* 1F | 10 */ ldc.i4.s 16
IL_00f0: /* 28 | (0A)00015A */ call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string,
string,
valuetype [System.Windows.Forms]System.Windows.Forms.MessageBoxButtons,
valuetype [System.Windows.Forms]System.Windows.Forms.MessageBoxIcon)
IL_00f5: /* 26 | */ pop
IL_00f6: /* 00 | */ nop
IL_00f7: /* DE | 00 */ leave.s IL_00f9
} // end handler
// HEX: 00 00 00 00 3A 00 00 00 A7 00 00 00 E1 00 00 00 18 00 00 00 02 00 00 01
IL_00f9: /* 00 | */ nop
IL_00fa: /* 02 | */ ldarg.0
IL_00fb: /* 7B | (04)00010A */ ldfld class ['DevExpress.XtraEditors.v8.3']DevExpress.XtraTab.XtraTabControl SimTouch_Screen.Form1::xtraTabControl1
IL_0100: /* 1F | 0B */ ldc.i4.s 11
IL_0102: /* 6F | (0A)00015B */ callvirt instance void ['DevExpress.XtraEditors.v8.3']DevExpress.XtraTab.XtraTabControl::set_SelectedTabPageIndex(int32)
IL_0107: /* 00 | */ nop
IL_0108: /* 2A | */ ret
} // end of method Form1::Form1_Load
Este es el codigo Hexadecimal del fichero EXE:
Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F Ascii
0000C6C0 02 00 00 01 1B 30 04 00 09 01 00 00 39 00 00 11 ..0....9..
0000C6D0 00 16 0A 7E 8F 00 00 0A 0B 02 7B E3 00 00 04 7E ..~...{ã..~
0000C6E0 8F 00 00 0A 12 00 12 01 6F 9D 01 00 06 16 FE 01 ....o.þ
0000C6F0 13 06 11 06 2D 04 00 00 2B 10 00 02 28 BF 03 00 -..+.(¿.
0000C700 06 00 02 28 96 00 00 0A 00 00 00 72 6F 3F 00 70 .(–......ro?.p
0000C710 02 7B 8D 03 00 04 6F 90 00 00 0A 72 3D 40 00 70 {.o...r=@.p
0000C720 28 95 00 00 0A 73 56 01 00 0A 0C 18 0D 09 8D 6D (•...sV..
0000C730 00 00 01 13 04 17 13 05 2B 13 00 11 04 11 05 08 ..+.
0000C740 6F 57 01 00 0A A2 00 11 05 17 58 13 05 11 05 09 oW..¢.X.
0000C750 FE 04 13 06 11 06 2D E2 08 6F 58 01 00 0A 00 11 þ-oX...
0000C760 04 17 9A 14 FE 01 13 06 11 06 2D 12 00 02 7B 08 šþ-.{
0000C770 03 00 04 11 04 17 9A 6F 8E 00 00 0A 00 00 00 02 .šoŽ......
0000C780 7B DE 01 00 04 72 6F 3F 00 70 02 7B 8D 03 00 04 {Þ.ro?.p{.
0000C790 6F 90 00 00 0A 72 55 40 00 70 28 95 00 00 0A 6F o...rU@.p(•...o
0000C7A0 59 01 00 0A 00 00 DE 05 26 00 00 DE 00 00 00 DE Y....Þ&..Þ...Þ
0000C7B0 18 26 00 72 79 40 00 70 72 B7 40 00 70 16 1F 10 &.ry@.pr·@.p
0000C7C0 28 5A 01 00 0A 26 00 DE 00 00 02 7B 0A 01 00 04 (Z..&.Þ..{..
0000C7D0 1F 0B 6F 5B 01 00 0A 00 2A 00 00 00 01 1C 00 00 o[...*.....
Podrias poner un salto incondicional (jmp) a las instrucciones para asi ejecutar sólo lo que quieres.
Seria algo asi:
IL_0000 2B AC br.s IL_00ae
-- aqui va el codigo original
Creo que el valor AC es correcto (172 bytes) pero verifícalo por las dudas.
No he probado este código, pero es una idea... :P
Saludos!
Perfecto!!!!!
Me diste la Idea!!!!, con el salto voy directamente a donde quiero :)
Muchísimas gracias.