kosamja Posted October 30, 2017 Share Posted October 30, 2017 (edited) I would like to use FormatEx to format usb drive, but this dllcall crashes script. How to call FormatEx function so that i doesnt crash script? ;~ https://github.com/hacksysteam/ShellcodeOfDeath/blob/master/ShellcodeOfDeath.c ;~ https://www.experts-exchange.com/questions/10500798/Quickformat-Disk-using-API.html ;~ http://www.purebasic.fr/english/viewtopic.php?p=145229 ;~ http://forum.codenet.ru/q59720?nowrap=1&s= #NoTrayIcon #RequireAdmin #include <Array.au3> $a = DllCall("fmifs.dll", "long", "FormatEx", "wstr", 'G:\', "dword", 11, "wstr", "NTFS", "wstr", "", "bool", True, "dword", 0, "ptr", 0) MsgBox(0,@error, $a[0]) _ArrayDisplay($a) Edited October 30, 2017 by kosamja Link to comment Share on other sites More sharing options...
RTFC Posted October 30, 2017 Share Posted October 30, 2017 (edited) Quote TheFormatEx function in FMIFS.DLL is prototyped like this: VOID FormatEx ( PWCHAR DriveRoot, DWORD MediaFlag , PWCHAR Format, PWCHAR Label, BOOL QuickFormat, DWORD ClusterSize, PFMIFSCALLBACK Callback); where the FMIFSCALLBACK is: typedef BOOLEAN (__stdcall *PFMIFSCALLBACK)( CALLBACKCOMMAND Command, DWORD SubAction, PVOID ActionInfo ); So your dll calling parameters are incorrect. If you had done a proper websearch, you would instantly have found this site, from which source code (that would have to be adapted for AutoIt) can still be downloaded. The rest is up to you... Edited October 30, 2017 by RTFC link updated My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
kosamja Posted October 30, 2017 Author Share Posted October 30, 2017 15 minutes ago, RTFC said: So your dll calling parameters are incorrect. If you had done a proper websearch, you would instantly have found this site, from which source code (that would have to be adapted for AutoIt) can still be downloaded. The rest is up to you... I dont see nothing useful on site you linked, but If you meant about C examples where FormatEx is used I already found that and since I dont know to read C I obviously cant adapt it to autoit. Thats why I asked here for help... Link to comment Share on other sites More sharing options...
RTFC Posted October 30, 2017 Share Posted October 30, 2017 You have to set up a dll CallBack for this to work. If you're familiar with PowerBasic, here's a source code example you might be able to adapt. AFAIK, there's no existing AutoIt source code for this particular function on the forums. But someone else may have something lying around, if you're lucky. kosamja 1 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
Danyfirex Posted October 30, 2017 Share Posted October 30, 2017 Hello. I have not time to see too much. But base in RTFC's first post This could be a start... Local $hHandle = DllCallbackRegister("_PFMIFSCALLBACK", "long", "long;dword;ptr") Local $pCallBack = DllCallbackGetPtr($hHandle) DllCall("yourdll.ll", "none", "FormatEx", "dword", $MediaFlag, "wstr", $Format, "wstr", $Label, "bool", $QuickFormat, "dword", $ClusterSize, "ptr", $pCallBack) DllCallbackFree($hHandle) Func _PFMIFSCALLBACK($Command, $SubAction, $ActionInfo) EndFunc ;==>_PFMIFSCALLBACK Saludos kosamja 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now