t-hack.com

English - X300T / X301T / DIT9719 / KISS KMM / BT Vision / Bluewin TV-Box / V-BOX/ VIP 1216 or similar Hardware => Software => Topic started by: is0-mick on 05. May 2008, 22:17

Title: Recompiling TV2Client.exe
Post by: is0-mick on 05. May 2008, 22:17
Hi All,
I decompiled TV2Client.exe with reflector and the decompiler plugin, but due to some errors it wont recompile.
Have any of you guys managed to make your version or our version recompile?

I know a little C# and can do stuff like make the LED's flash etc..

http://img87.imageshack.us/img87/49/dsc01224lz4.jpg

TV2Engine_SetLED(TV2LED.Recording, TV2LEDmode.Blink);
TV2Engine_SetLED(TV2LED.IrReceive, TV2LEDmode.On);
TV2Engine_SetLED(TV2LED.On, TV2LEDmode.Blink);
TV2Engine_SetLED(TV2LED.Messages, TV2LEDmode.On);
TV2Engine_SetVolume(65535, false);
TV2Engine_PlayUISound(@"\Hard Disk\test.wav");

But I couldn't get a sound to play :(

So has anyone got anywhere recompiling the original application?

If so can someone help me?

Thanks
Mick

Title: Re: Recompiling TV2Client.exe
Post by: mce2222 on 05. May 2008, 22:34
I tried that sometime last year... but there are some problems with the decompilation:

watch out for static member variables. they are initialized in the order as found in the c# file... the decompilers usually order them by name and the
stupid visual studio does not recognize when one static member references another static member that get initialized at a later time.

another problem are the exception handlers. at several occasions the decompilers were unable to rebuild the exception handlers and instead created code that does not even compile.

I spent many hours fixing all the compile errors, but in the end it still does not work.
so I see two options:

if you want to keep the original application ... use Reflexil to manipulate specific parts of the application (like disabling the content recording prevention)
but the only long term option is to create a completely new c# application or c++ application and only use the hardware access DLLs as much as needed.

btw. I think there is some init needed before any sound or video output works.
haven't really looked into that yet.
Title: Re: Recompiling TV2Client.exe
Post by: redband on 05. May 2008, 23:33
Funny, I went for the LEDs first too.  Although I couldn't get them to react.  How are you executing you code?  running an exe from the http interface? or modified booterce?
Title: Re: Recompiling TV2Client.exe
Post by: is0-mick on 05. May 2008, 23:47
I let the box boot until the error msg saying it couldnt connect or whatever..

Then I used visual studio to connect to the box.. attach to process (tv2client)... then kill all.
If i use remote process viewer then kill it .. it seems to reset the box, that above way doesnt.

Then i used the http interface to execute.

Here is my code...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace Devicetest
{
public partial class Form1 : Form
{

public Form1()
{
InitializeComponent();
TV2Engine_SetLED(TV2LED.Recording, TV2LEDmode.Blink);
TV2Engine_SetLED(TV2LED.IrReceive, TV2LEDmode.On);
TV2Engine_SetLED(TV2LED.On, TV2LEDmode.Blink);
TV2Engine_SetLED(TV2LED.Messages, TV2LEDmode.On);
TV2Engine_SetVolume(65535, false);
TV2Engine_PlayUISound(@"\Hard Disk\test.wav");

while (true)
{
}

}

public enum TV2LED : uint
{
Connected = 0,
HiDef = 4,
IrReceive = 5,
Max = 6,
Messages = 6,
On = 3,
Recording = 2,
Standby = 1
}

public enum TV2LEDmode : uint
{
Blink = 2,
Off = 0,
On = 1
}


[DllImport("TV2Engine.dll", CharSet=CharSet.Auto)]
public static extern bool TV2Engine_PlayUISound(string fileName);
[DllImport("TV2Engine.dll")]
private static extern void TV2Engine_SetLED(TV2LED led, TV2LEDmode mode);
[DllImport("TV2Engine.dll")]
private static extern void TV2Engine_SetVolume(int volume, [MarshalAs(UnmanagedType.U1)] bool mute);

private void Form1_Load(object sender, EventArgs e)
{
}

}
}


Mick
Title: Re: Recompiling TV2Client.exe
Post by: mce2222 on 06. May 2008, 10:59
there is a watchdog process running in the CPU that resets the box when the application does not respond for a while.

I think the watchdog is started when the tv2engine.dll is initialised... not sure.
anyway, that has to be kept in mind when building a new application.