Page 1 of 1

need help to debug fancontrol

Posted: Sun Apr 22, 2007 1:58 am
by dino
I run fancontrol as a regular program.

Once in a while the program dies and the fan is stuck in
whatever speed it was set. Very dangerous if that value
is zero.

So, I thought I'd give it a shot at debugging but I'm not a C++
developer. I recompiled fancontrol with Visual Studio in debug
mode and then waited. After two weeks, it finally died and I got
some debug data to work with.


Here is the stack:
> fancontrol.exe!FANCONTROL::Trace(const char * text=0x0012fcd8) Line 237 + 0x14 bytes C++
fancontrol.exe!FANCONTROL::SetFan(const char * source=0x004a0e70, int fanctrl=1, int final=0) Line 325 C++
fancontrol.exe!FANCONTROL::SmartControl() Line 260 + 0x13 bytes C++
fancontrol.exe!FANCONTROL::HandleData() Line 195 C++
fancontrol.exe!FANCONTROL::DlgProc(HWND__ * hwnd=0x0001070e, unsigned long msg=1031, unsigned int mp1=1, long mp2=0) Line 405 C++
fancontrol.exe!FANCONTROL::BaseDlgProc(HWND__ * hwnd=0x0001070e, unsigned long msg=1031, unsigned int mp1=1, long mp2=0) Line 250 + 0x18 byt




the value of this in SetFan method is 0x0012f814

but the value of this in Trace method (Called by SetFan) is 0x000a0d29(Appears to be the cause of the segmentation fault)

Maybe I'm mistaken but should the value of this be the same?

I'm going to try look at it some more but any advice would be great.

Thanks

Posted: Sun Apr 22, 2007 2:44 am
by dino
I think I found it if anyone is interested.


FANCONTROL::Trace(const char *text)
{
char trace[8192]= "", datebuf[128]= "", line[256]= "";

this->CurrentDateTimeLocalized(datebuf, sizeof(datebuf));

::GetDlgItemText(this->hwndDialog, 9200, trace, sizeof(trace));

if (strlen(text))
sprintf(line, "[%s] %s\r\n", datebuf, text); // probably acpi reading conflict
else
strcpy(line, "\r\n");

strcat(trace, line);


In my instance, I think strcat is overflowing trace if GetDlgItem's Text size is greater than sizeof(trace)+strlen(line)

Im fairly sure of this because this got changed to 0x000a0d29 and the line string ends with )\r\n\0 which is 0x29 0x0d 0x0a 0x00[/i]

Posted: Sun Feb 10, 2008 5:14 pm
by a.campanella
:? I am a T43 fancontrol occasional user.

Just now, on starting fancontrol, I have the following screen

[2/10/2008 5:00:24 PM] Current Config:
[2/10/2008 5:00:25 PM] Active= 0, Cycle= 5, FanBeep= 440 50, MaxReadErrors= 10
[2/10/2008 5:00:26 PM] IconLevels= 50 55 60, IgnoreSensors=
[2/10/2008 5:00:26 PM] Levels= 50°C -> 0, 55°C -> 3, 60°C -> 5, 65°C -> 7, 70°C -> 0x80

[2/10/2008 5:01:07 PM] Warning: Can't read Status (possible conflict with other software)

So I have not much to offer yet.

When my TP43 was new (October 2005), the fan cycled as expected.

Now the fan now runs all the time. In the summer, I thought it was due to high office heat (80F, 27C). But now, winter, (65F, 18C) it still runs all the time.

Some sound tone relief is caused by changing the height of the TP above the desk. I think that the bottom air inlet emits fan tone sound. You all can experiment with TP spacing from desk plane by setting TP on small objects.

It has been some time since I downloaded fancontrol.exe and installed it a year ago. Perhaps there is an update?

Angelo Campanella