Sign in to follow this  
Followers 0
hgeras

DllCall() issues

3 posts in this topic

#1 ·  Posted (edited)

I know not much about dll's but i can realize how im goin to call one once i have the reference for it ...But i have some issues with nvcpl.dll...

From Nvidia:

NvCplGetThermalSettings()

Function Prototype

BOOL CDECL NvCplGetThermalSettings

(IN UINT nWindowsMonitorNumber,

OUT DWORD* pdwCoreTemp,

OUT DWORD* pdwAmbientTemp,

OUT DWORD* pdwUpperLimit);

Parameters In UINT nWindowsMonitorNumber -- The display number shown on

the Windows Display Properties->Settings page.

A value of 0 indicates the current primary Windows display device.

DWORD* must be a valid pointer --

pdwCoreTemp -- GPU temperature in degrees Celsius.

pdwAmbientTemp -- Ambient temperature in degrees Celsius.

pdwUpperLimit -- Upper limit of the GPU temperature specification.

Return Values True on success.

False on failure.

How am i supposed to work with pointers? I tried this:

$test=DllOpen("Nvcpl.dll")
$ret=DllCall($test,"int","NvCplGetThermalSettings","int",0,"int_ptr","","int_ptr","","int_ptr","")
if @error then MsgBox(0,"","ERROR")
MsgBox(0,"",$ret[0] & ret[1]& ret[2])

I always get "ERROR"...I have tried many variations of it and nothing seems to work...Should i use DllStruct()? And if yes how am i goin to use it in DllCall()?

Thanx in advance.

C ya

Edited by hgeras

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Sorry to bump this thread, but since I was searching for how to read GPU temperature and found this and other outdated code, I had to come up with a solution by myself, I thought I'd share:

The part that got me stuck was that I needed to change calling convention from stdcall to cdecl, a problem I have been suffering for some time (DOH!!), like so:

$ret = DllCall($test,"int:cdecl", "NvC....

Dim $pdwCoreTemp
Dim $pdwAmbientTemp
Dim $pdwUpperLimit
$nWindowsMonitorNumber=0

$test=DllOpen("Nvcpl.dll")
$ret = DllCall($test,"int:cdecl", "NvCplGetThermalSettings", "int",$nWindowsMonitorNumber, "long*", $pdwCoreTemp, "long*", $pdwAmbientTemp, "long*", $pdwUpperLimit)
if @error then MsgBox(0,"","ERROR")
MsgBox(0,"",$ret[0] & " " & $ret[1] & " " & $ret[2])

Ofcourse knowing if you have to call with INTs or LONGs is also good. :)

Edited by Manko

Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

Sorry to bump this thread, but since I was searching for how to read GPU temperature and found this and other outdated code, I had to come up with a solution by myself, I thought I'd share:

The part that got me stuck was that I needed to change calling convention from stdcall to cdecl, a problem I have been suffering for some time (DOH!!), like so:

$ret = DllCall($test,"int:cdecl", "NvC....

Dim $pdwCoreTemp
Dim $pdwAmbientTemp
Dim $pdwUpperLimit
$nWindowsMonitorNumber=0

$test=DllOpen("Nvcpl.dll")
$ret = DllCall($test,"int:cdecl", "NvCplGetThermalSettings", "int",$nWindowsMonitorNumber, "long*", $pdwCoreTemp, "long*", $pdwAmbientTemp, "long*", $pdwUpperLimit)
if @error then MsgBox(0,"","ERROR")
MsgBox(0,"",$ret[0] & " " & $ret[1] & " " & $ret[2])

Ofcourse knowing if you have to call with INTs or LONGs is also good. :)

you should be able to replace $pdwCoreTemp, $pdwAmbientTemp and $pdwUpperLimit with 0 as the return array has the values

can't test it though, one of my machines has an older Nvidia card (non gaming) that doesn't report temps


I see fascists...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0