flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > DeviceIoControl fails when send ATA Command 0F1h

Author
Thread Post new topic Reply to topic
bruno



Joined: 14 Apr 2018
Posts: 2
Location: TOR Network
i want write a tool that set a password onto HDD with DeviceIoControl but when i try to issue the SET SECURITY PASSWORD ATA Command(0F1h) fails with ERROR_INVALID_PARAMETER. see the source that i code:
Code:
proc SET_SECURITY_PASSWORD invoke CreateFileA,PHYSICALDRIVE1,GENERIC_ALL,3,0,3,0,0 MOV [hDevice],EAX MOV EAX,28h MOV [PTE.Length1],AX MOV EAX,0Ah MOV [PTE.TimeOutValue],EAX MOV EAX,512 MOV [PTE.DataTransferLength],EAX MOV EAX,SIZEOF.ATA_PASS_THRU MOV [PTE.DATABUFFEROFFSET],EAX MOV AL,0F1h MOV [PTE.Ata2.Command],AL MOV AX,4h MOV [PTE.AtaFlags],AX invoke strcpy,PTE.DATABUFFEROFFSET+4, pwd invoke DeviceIoControl,[hDevice],4D02Ch,PTE,228h,PTE,228h,NIL,0 invoke CloseHandle,[hDevice] RET ENDP

WHERE IS WRONG IN THIS SOURCE? WHY DEVICEIOCONTROL RETURNS ERROR_INVALID_PARAMETER?
Post 14 Apr 2018, 19:38
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1240
Location: Icarian Sea
hi,

I see a possible error.

Use either invoke lstrcpy... or cinvoke strcpy...

Hope that helps.
Post 15 Apr 2018, 14:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15871
Location: 162173 Ryugu
You might need to give your code a permission. Even if you run it as admin you still need to explicitly enable some permissions each time it runs.


Last edited by revolution on 16 Apr 2018, 12:03; edited 1 time in total
Post 15 Apr 2018, 14:17
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 683
Location: Adelaide
ATA security functions are blocked in Windows 8 and above.
Post 15 Apr 2018, 15:51
View user's profile Send private message Reply with quote
bruno



Joined: 14 Apr 2018
Posts: 2
Location: TOR Network
i run my code onto windows 7 and the DeviceIoControl works returning 1 and it should to lock HDD with a password set by me, however nothing happens and HDD dont have a password. why?
Post 19 Apr 2018, 17:34
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.