delphi convert
-
hi every body i have problem with this code : //////////////////////////////// ///code in delphi function doGetStat(aCallBackStatsParser:dfCallBackStatsParser; var strError:string):boolean; var startTime : DWORD; begin result := true; if SysHandle=0 then exit; startTime := GetTickCount; repeat if abs(GetTickCount - startTime) > 1000 then break; // Have driver fill Stats buffer with information if not DeviceIoControl(SysHandle, IOCTL_FILEMON_GETSTATS, nil, 0, @Stats, sizeof(Stats), StatsLen, nil) then begin strError := 'Couldn''t access device driver. errorCode =' +IntToStr(GetLastError); result := false; exit; end; if StatsLen=0 then break; if assigned(aCallBackStatsParser) then aCallBackStatsParser; until false; end; ////////////////////////////////////// // Code in VC BOOL CDriverApp::doGetStatvoid(*aCallBackStatsParser)(void) , CString *strError) { DWORD startTime ; result = TRUE; if (SysHandle==0 ) return FALSE ; startTime= GetTickCount() ; while(TRUE) { if( abs(GetTickCount() - startTime) > 1000 ) break ; // Have driver fill Stats buffer with information if (! DeviceIoControl(SysHandle, IOCTL_FILEMON_GETSTATS, NULL, 0, &Stats, sizeof(Stats), &StatsLen, NULL) ) { strError->Format("Couldnt access device driver.\n errorCode = %d" ,GetLastError()) ; result = FALSE ; return FALSE ; } if(GetLastError()== ERROR_INSUFFICIENT_BUFFER) strError->Format("small buffer") ; if ( StatsLen == 0 ) { return result ;} if (aCallBackStatsParser!= NULL) (*aCallBackStatsParser)() ; } return TRUE ; } /////////////////////////////////////////// it is working in delphi but not in VC why ??