C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-26-2009, 03:29 AM   #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.
punkywow is offline   Reply With Quote
Old 10-26-2009, 06:28 AM   #2
Registered User
 
Join Date: Mar 2005
Location: Mountaintop, Pa
Posts: 1,054
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");
            }
BobS0327 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 10:00 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22