Bonjour à tous,
J'ai un problème sur lequel je suis bloqué depuis 2 jours !
Dans la fonction ci dessous, AAttrs est OK avant l'appel à la fonction SmartRcvDriveData, puis "Cannot access memory" après.
J'ai changé le type de paramètre dans la déclaration de la fonction "out AAttrs: TSmartAttrs" et "var AAttrs: TSmartAttrs", ça fait rien.
Je vous mets le code de SmartRcvDriveData, au cas où...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 function SmartReadAttributeValues(const AHandle: THandle; const ADriveNumber: byte; out AAttrs: TSmartAttrs): boolean; var vInP: TSendCmdInParams; vOutP: TSendCmdOutParams; pAttrs,pAAttrs: PSmartAttrs; vB: boolean; begin pAAttrs:=@AAttrs; // pour debug // Dans points de suivi : // ici pAAttrs = psmartatts($00000000013FEA80) // ici AAttrs = record TSMARTATTRS { A = 85, B = 85, RESULTS = { { ID = 85, ...... 85, 85, 85, 85}, RESERVED = 85} <repeats 30 times>}, RESERVED = {}} vB:=SmartRcvDriveData( AHandle,ADriveNumber,SMART_CMD,READ_ATTRIBUTES,1,1, SMART_CYL_LOW,SMART_CYL_HI, READ_ATTRIBUTE_BUFFER_SIZE,vOutP); // !!!! ici AAttrs = record TSMARTATTRS Cannot access memory at address 0x3209000000174181 POURQUOI????? if vB then begin pAttrs:=@vOutP.bBuffer; AAttrs:=pAttrs^; //Erreur SIGSEG end; Result:=vB; end;
Si vous avez une idée... Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 function SmartRcvDriveData( const AHandle: THandle; const ADriveNumber: byte; const ACommand, AFeatures, ASecCount, ASecNum, ACylLow, ACylHigh: byte; const ABufferSize: integer; out AOutParams: TSendCmdOutParams): TIOCTLResult; var vInP: TSendCmdInParams; vRecBytes: dword; begin FillChar(vInP, Sizeof(TSendCmdInParams), 0); vInP.cBufferSize := ABufferSize; vInP.bDriveNumber := ADriveNumber; vInP.irDriveRegs.bFeaturesReg := AFeatures; vInP.irDriveRegs.bSectorCountReg := ASecCount; vInP.irDriveRegs.bSectorNumberReg := ASecNum; vInP.irDriveRegs.bCylLowReg := ACylLow; vInP.irDriveRegs.bCylHighReg := ACylHigh; vInP.irDriveRegs.bDriveHeadReg := $A0 or ((ADriveNumber and 1) shl 4); vInP.irDriveRegs.bCommandReg := ACommand; vRecBytes := 0; Result := DeviceIoControl(AHandle, SMART_RCV_DRIVE_DATA, @vInP, sizeof(vInP), @AOutParams, sizeof(AOutParams)+ABufferSize, vRecBytes, nil); end;
Partager