I want to make an app that reads GPU Voltage thru Riva

Discussion in 'RivaTuner Advanced Discussion forum' started by king-dubs, Jun 20, 2009.

  1. king-dubs

    king-dubs Ancient Guru

    Messages:
    2,385
    Likes Received:
    2
    GPU:
    3090 FE
    As said in the title... I want to make an app that reads GPU Voltage thru Riva.

    Here's my test-app:
    Code:
    #include <windows.h>
    #include <iostream>
    #include "RivaTunerExports.h"
    using namespace std;
    
    READ_I2C_EX_PROC ReadI2CEx = NULL;
    GET_HOST_APP_VERSION_PROC GetHostAppVersion = NULL;
    GET_I2C_BUS_NUM_EX_PROC GetI2CBusNumEx = NULL;
    
    int main(int argc, char**argv) {
    	HMODULE hRiva = LoadLibrary("C:\\Program Files (x86)\\RivaTuner v2.24\\RivaTuner.exe");
    	if(hRiva)
    		cout << "RivaTuner successfully found and loaded." << endl;
    	GetHostAppVersion = (GET_HOST_APP_VERSION_PROC)GetProcAddress(hRiva, "GetHostAppVersion");
    	GetI2CBusNumEx = (GET_I2C_BUS_NUM_EX_PROC)GetProcAddress(hRiva, "GetI2CBusNumEx");
    	ReadI2CEx = (READ_I2C_EX_PROC)GetProcAddress(hRiva, "ReadI2CEx");
    	if(!(GetHostAppVersion && GetI2CBusNumEx && ReadI2CEx)) {
    		cout << "Error locating function pointers" << endl;
    		return 1;
    	}
    	cout << "Version: " << GetHostAppVersion() << endl;
    	BYTE test = NULL;
    	if(ReadI2CEx(0, 0x01, 0x70, 0x18, &test))
    		cout << "Data: " << (int*)test << endl;
    	else
    		cout << "FAIL" << endl;
    	return 0;
    }
    
    Any way to get this to work (without turning it into a DLL plugin)? Currently, it crashes upon reaching the call to the ReadI2CEx function.

    As I said, it's a test-app, so I did not code a GUI for it just yet, so I'm using Win32 Console.
     
  2. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,195
    Likes Received:
    6,846
    You cannot load an executable file with LoadLibrary, it won't work.
     
  3. king-dubs

    king-dubs Ancient Guru

    Messages:
    2,385
    Likes Received:
    2
    GPU:
    3090 FE
    So I'll have to resort to attaching to the process?
     

Share This Page