Jump to content

[help] Speedfan intergration with Sysstats?


Recall

Recommended Posts

Speedfan doesn't have an API as such but it does use a shared memory area which can be accessed by third party software. One issue is that it can only be accessed by processes with admin privileges. As I can only get SysStats to work on XP with admin privileges (using YZDock w. v2.0.1, the link says 2.0.3 but they only seem to host 2.0.1) this wouldn't be problem, but IF, as I hope, SysStats is modified so it will work with limited privileges then it could be.

This problem can be alleviated by running a simple service which copies the shared memory to another shared memory area which has an appropriate security descriptor for limited user access, at say 1 second intervals. Or alternatively a service which exposes a COM+ interface that limited processes can access could simply read the shared memory and provide the info on request.

The developer can provide the shared mem info (maybe you could persuade him to use a security descriptor when he creates his shared mem too!), or if you're really stuck I might be able to help.

Simon

Link to comment

The shared memory area is published as 'SFSharedMemory_ALM' and is the following format:

type

TSharedMem = packed record

version:word;

flags :word;

MemSize:integer;

handle :THandle;

NumTemps:word;

NumFans :word;

NumVolts:word;

temps:array[0..31] of integer;

fans :array[0..31] of integer;

volts:array[0..31] of integer;

end;

It's Delphi code, I know you chaps use C++ generally, I can usually convert C to Delphi but I can't do the reverse I'm afraid, but I'm sure you'll manage!

I used the following to access the area:

var

pSFSharedMem, pSvcSharedMem: ^TSharedMem;

hSFMapFile, hSvcMapFile: THandle;

SecurityDesc: TSecurityDescriptor;

SecurityAttr: TSecurityAttributes;



const

SFVirtualFileName = 'SFSharedMemory_ALM';

DataSize = sizeof(TSharedMem);

SECURITY_DESCRIPTOR_REVISION = 1; { Win32 constant not defined in Delphi }



procedure CreateSecurityDescriptor;

begin

{ By default on Windows NT, created mutexes are accessible only by the user

running the process. We need our mutexes to be accessible to all users, so

that the mutex detection can work across user sessions in Windows XP. To

do this we use a security descriptor with a null DACL. }

InitializeSecurityDescriptor(@SecurityDesc, SECURITY_DESCRIPTOR_REVISION);

// This null (delphi nil) ACL will give security conscious coders heart-attacks!

SetSecurityDescriptorDacl(@SecurityDesc, True, nil, False);

SecurityAttr.nLength := SizeOf(SecurityAttr);

SecurityAttr.lpSecurityDescriptor := @SecurityDesc;

SecurityAttr.bInheritHandle := False;

end;

Here's a basic hack to demonstrate usage of the area and copying it to another shared memory area available to

all users. More work could probably be done with the ACL if tighter security was required.

procedure TForm1.Button1Click(Sender: TObject);

begin

try

// Open SpeedFan's shared memory area

hSFMapFile := OpenFileMapping(FILE_MAP_READ, false, SFVirtualFileName);



// get the pointer to the actual data

if hSFMapFile <> 0 then

pSFSharedMem := MapViewOfFile(hSFMapFile, FILE_MAP_READ, 0, 0, DataSize);



// Create the service's shared memory area (for limited users to read)

CreateSecurityDescriptor;

hSvcMapFile :=

CreateFileMapping($FFFFFFFF, @SecurityAttr, PAGE_READWRITE, 0, DataSize, 'SFSvcSharedMem');

if hSvcMapFile <> 0 then

pSvcSharedMem := MapViewOfFile(hSvcMapFile, FILE_MAP_WRITE, 0, 0, DataSize);



// Copy Speedfans protected data to our services data area for use by limited users

pSvcSharedMem^ := pSFSharedMem^;



// Do something with the data

showmessage('Get SFSvcSharedMem');



finally

// Clean up

UnmapViewOfFile(pSFSharedMem);

CloseHandle(hSFMapFile);

UnmapViewOfFile(pSvcSharedMem);

CloseHandle(hSvcMapFile);

end;//finally

end;

Hope this helps,

Simon

Link to comment

I've coded a basic docklet for YZdock that displays a temp over the icon and up to 3 fan speeds in the text label above it but have a few loose ends to tie up (a read me and the legal stuff). It relies on speedfan being installed as a service and the docklet comes with another service which needs to be installed too.

The total size of the package is small but I can't host it myself. If anyone could give me a few pointers as to where it could be hosted for download (here somewhere, or maybe I should approach speedfan's developer) I'd be grateful.

Simon

Link to comment

That would be great, look forward to seeing it. I'll be posting the YZ docklet soon in the meantime (when I can get my hand on a printscreen button or find another way to capture YZDock).

Good luck with the job hunting, may your next be lucrative!

Simon

Link to comment
That would be great, look forward to seeing it. I'll be posting the YZ docklet soon in the meantime (when I can get my hand on a printscreen button or find another way to capture YZDock).

Good luck with the job hunting, may your next be lucrative!

Simon

Wow excellent, I gave up hope after the first reply seeing as it was from the man himself. You have given me hope though. :)

Look forward to it, I just hope that avedesks next version is not so buggy.

Link to comment

I submitted it a while ago but...

1. A service is part of the package - I included an incorrect one that doesn't work and can't correct the problem until the account is activated.

2. I've tried emailing but all attempts bouce with 'mailbox full' so..

I guess the manager of the site has his hands too full to deal with it at the mo.

However, I have developed an OD docklet and submitted it (it includes the correct service too!) at wincustomize.com (yesterday) but again they say it takes up to 5 days, so all I can say is keep your fingers crossed.

The OD docklet is here

Simon

Link to comment
I submitted it a while ago but...

1. A service is part of the package - I included an incorrect one that doesn't work and can't correct the problem until the account is activated.

2. I've tried emailing but all attempts bouce with 'mailbox full' so..

I guess the manager of the site has his hands too full to deal with it at the mo.

However, I have developed an OD docklet and submitted it (it includes the correct service too!) at wincustomize.com (yesterday) but again they say it takes up to 5 days, so all I can say is keep your fingers crossed.

The OD docklet is here

Simon

Could you email the fixed version to me? Pm for my email, I really wanna try this :D

Link to comment

Judge, I hope you don't mind, but with the OD version available at wincustomize.com for the screenshot I used your 'meter' icon. The icon's not included as part of the download, and I've commented and acknowledged your Systats work so folks will know about your excellent work!

Simon

Link to comment

Recall, for a limited time only I'll upload it to my webspace so you can download it from there. It won't be there long 'cos they may stop my service for the rest of the month if my quota is exceeded! I'll edit this post with the url, the readme should cover everything but if not then start a new thread in the YZ dock section and I'll respond when I can.

Simon

Now here at Dockex.com

Link to comment
Recall, for a limited time only I'll upload it to my webspace so you can download it from there. It won't be there long 'cos they may stop my service for the rest of the month if my quota is exceeded! I'll edit this post with the url an start a new thread in the right spot at aqua-soft.

Simon

Thanks mate :)

Link to comment
You can download the latest version of syststats here.

It has the followig improvements:

  • A speedfan meter - clearly you should run speedfan before you try and use it.
  • Doesn't leak memory like a sieve any more
  • Has much faster load/save times.
  • If you change the update interval of a meter it will take immediate effect.

You should consider this to be a beta (I've tested it extensively on one machine only!).

To install, quit anything that is using SysStats and unzip directly into your AveDesk/ObjectDock folder. Or for AveDesk you can rename the .zip to .aveinst and double-click it.

I would be interested (though depressed) by any bug reports.

I cant seem to find the speedfan config? I feel like a klutz, coul you point me where it is?

EDIT> Ok I found them in where you manually add a meter in configure, but where would I get the images from to get the readings? For example MM5 has its own docklet? I very much appreciate your work, just need pointing in the right direction :)

dk5qi.th.jpg

Link to comment

Thanks gratefully, but I just cannot get it to work :( I am not sure why, but when I add your speedfan.ini the image is blank? All I get is the owrd sysstat appear on the desktop.

Here is my speedfan ini for my mobo, maybe this will help?

xxx version 2.01

xxx Link UniqueID=ISA@$290

Name=ISA

Address=$290

xxx end

xxx Link UniqueID=PCI@$0

Name=PCI

Address=$0

xxx end

xxx Link UniqueID=SMBusnForce2@$4C00

Name=SMBus

Address=$4C00

xxx end

xxx Link UniqueID=SMBusnForce2@$4C40

Name=SMBus

Address=$4C40

xxx end

xxx Link UniqueID=SMBusI2CNVidia@$3D403E3F

Name=SMBus

Address=$3D403E3F

xxx end

xxx Link UniqueID=SMBusI2CNVidia@$3D403637

Name=SMBus

Address=$3D403637

xxx end

xxx Link UniqueID=SMBusI2CNVidia@$3D405051

Name=SMBus

Address=$3D405051

xxx end

xxx Link UniqueID=SMART@$0

Name=SMART

Address=$0

xxx end

xxx Sensor UniqueID=Winbond W83627THF@$290(onISA@$290)

Name=Winbond W83627THF

UsedBUS=ISA

Address=$290

Link=ISA

StickyProps=3

Property=13 |PWM 1 mode| set to |Manual PWM Control|

Property=14 |PWM 2 mode| set to |Manual PWM Control|

Property=19 |PWM 3 mode| set to |Manual PWM Control|

xxx end

xxx Sensor UniqueID=MAX6648@$4C(onSMBusI2CNVidia@$3D405051)

Name=MAX6648

UsedBUS=I2CNVidia SMBus

Address=$4C

Link=SMBus

StickyProps=0

xxx end

xxx Sensor UniqueID=WDC WD800JB-00ETA0WD-WCAHL6044608

Name=HD0 (80.0GB)

UsedBUS=SMART

Address=$0

Link=SMART

StickyProps=0

xxx end

xxx Sensor UniqueID=NikimiA6W2183587

Name=HD1 (30.0GB)

UsedBUS=SMART

Address=$1

Link=SMART

StickyProps=0

xxx end

xxx Sensor UniqueID=SAMSUNG SP1614C0696J1FX908334

Name=HD2 (160.0GB)

UsedBUS=SMART

Address=$2

Link=SMART

StickyProps=0

xxx end

xxx the end

xxx Pwm 2 from Winbond W83627THF@$290(onISA@$290)

name=CPU

active=true

min=40

max=100

variate=true

xxx end

xxx Pwm 1 from Winbond W83627THF@$290(onISA@$290)

name=System

active=true

min=85

max=100

variate=true

xxx end

xxx Pwm 3 from Winbond W83627THF@$290(onISA@$290)

name=Case

active=true

min=0

max=100

variate=false

xxx end

xxx Temp 2 from Winbond W83627THF@$290(onISA@$290)

name=CPU

active=true

wanted=50

warning=70

offset=0

intray=true

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Temp 1 from Winbond W83627THF@$290(onISA@$290)

name=System

active=true

wanted=50

warning=60

offset=0

intray=false

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Temp 3 from Winbond W83627THF@$290(onISA@$290)

name=Case

active=true

wanted=40

warning=50

offset=0

intray=false

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Temp 1 from MAX6648@$4C(onSMBusI2CNVidia@$3D405051)

name=Local Temp

active=false

wanted=40

warning=50

offset=0

intray=false

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Temp 2 from MAX6648@$4C(onSMBusI2CNVidia@$3D405051)

name=Remote Temp

active=false

wanted=40

warning=50

offset=0

intray=false

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Temp 1 from WDC WD800JB-00ETA0WD-WCAHL6044608

name=HD0

active=false

wanted=40

warning=50

offset=0

intray=false

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Temp 1 from SAMSUNG SP1614C0696J1FX908334

name=HD2

active=false

wanted=40

warning=50

offset=0

intray=false

UsedPwms=3

pwm=2 from Winbond W83627THF@$290(onISA@$290)

pwm=1 from Winbond W83627THF@$290(onISA@$290)

pwm=3 from Winbond W83627THF@$290(onISA@$290)

logged=false

xxx end

xxx Fan 2 from Winbond W83627THF@$290(onISA@$290)

name=CPU Fan

active=true

logged=false

xxx end

xxx Fan 1 from Winbond W83627THF@$290(onISA@$290)

name=System Fan

active=true

logged=false

xxx end

xxx Fan 3 from Winbond W83627THF@$290(onISA@$290)

name=Case

active=true

logged=false

xxx end

xxx Volt 1 from Winbond W83627THF@$290(onISA@$290)

name=Vcore

active=true

logged=false

xxx end

xxx Volt 2 from Winbond W83627THF@$290(onISA@$290)

name=+12V

active=true

logged=false

xxx end

xxx Volt 3 from Winbond W83627THF@$290(onISA@$290)

name=3.3V

active=true

logged=false

xxx end

xxx Volt 4 from Winbond W83627THF@$290(onISA@$290)

name=Vcc

active=true

logged=false

xxx end

xxx Volt 5 from Winbond W83627THF@$290(onISA@$290)

name=Vin2

active=true

logged=false

xxx end

xxx Volt 6 from Winbond W83627THF@$290(onISA@$290)

name=5Vsb

active=true

logged=false

xxx end

xxx Volt 7 from Winbond W83627THF@$290(onISA@$290)

name=Vbat

active=true

logged=false

xxx end

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...