Thread: GetPerformanceInfo

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    37

    GetPerformanceInfo

    if i call GetPerformanceInfo
    directly out from the psapi.dll it returns
    Code:
    error 24, The Programm puts out an Command but the Command length is wrong!
    whats wrong?



    #### Just for additional information
    the Performance struct is defined!!
    Code:
    HANDLE PSAPI;
     PSAPI=LoadLibrary("PSAPI.DLL");
    if(!PSAPI){
     ErrorExit("<EF> LoadLibrary");
    }
    
    GetPerformanceInfo=(GetPerformanceInfoPtr)GetProcAddress(PSAPI,"GetPerformanceInfo");
    if(!GetPerformanceInfo){
    	ErrorExit("<EF> Cant do GetPerformanceInfo [psapi.dll]!\n");
    }
    it loads well there is no probolem Loading the Function!!
    Last edited by punkywow; 10-26-2009 at 04:19 AM.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Error 24 is a ERROR_BAD_LENGTH. It usually means that the call to GetPerformanceInfo cannot properly return all the information. Have you cleared and then initialized the structure prior to calling GetPerformanceInfo?

    Example:

    Code:
    PERFORMANCE_INFORMATION pi;
    
    	ZeroMemory (&pi, sizeof(PERFORMANCE_INFORMATION));
    	pi.cb = sizeof(PERFORMANCE_INFORMATION);
    
    	if (!p_GetPerformanceInfo (&pi, sizeof(PERFORMANCE_INFORMATION)))
    	{
                        printf("Failed\n");
                }

Popular pages Recent additions subscribe to a feed