Nologic

PFS Shell via AutoIt

Jan 11th, 2022 (edited)
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.30 KB | None | 0 0
  1.  
  2. #RequireAdmin
  3. #include <AutoItConstants.au3>
  4.  
  5. #cs ----------------------------------------------------------------------------
  6.  
  7. Get VAR from CMD:
  8.     wmic diskdrive get Caption, DeviceID, InterfaceType
  9.  
  10. #ce ----------------------------------------------------------------------------
  11. $sMyDiskDrive = '\\.\PHYSICALDRIVE6'
  12.  
  13.  
  14. MsgBox( 0 , '' , _PFSshell( $sMyDiskDrive , 'ls' ))
  15.  
  16.  
  17. #cs ----------------------------------------------------------------------------
  18.  
  19. Comment the line above & uncomment the lines below to get a better example
  20.  
  21. Edit OPLpart & POPpart to your prefered size
  22.  
  23. !!!!!!!!!! WARNING THIS WILL NUKE EVERYTHING ON THE DRIVE !!!!!!!!!!
  24.  
  25. #ce ----------------------------------------------------------------------------
  26. ;$sNukeHdd = 'initialize yes'
  27. ;$sOPLpart = 'mkpart +OPL 12G'
  28. ;$sOPLfolders = 'mount +OPL|mkdir APPS|mkdir ART|mkdir CFG|mkdir CHT|mkdir DVD|mkdir LNG|mkdir POPS|mkdir THM|mkdir VMC|umount'
  29. ;$sPOPfolders = 'mount __common|mkdir POPS|umount'
  30. ;$sPOPpart = 'mkpart __.POPS 40G'
  31.  
  32. ;_PFSshell( $sMyDiskDrive , $sNukeHdd )
  33. ;_PFSshell( $sMyDiskDrive , $sOPLpart )
  34. ;_PFSshell( $sMyDiskDrive , $sOPLfolders )
  35. ;_PFSshell( $sMyDiskDrive , $sPOPfolders )
  36. ;_PFSshell( $sMyDiskDrive , $sPOPpart )
  37.  
  38. ;MsgBox( 0 , '' , _PFSshell( $sMyDiskDrive , 'ls -l' ))
  39.  
  40.  
  41. #cs ----------------------------------------------------------------------------
  42.  
  43. Executes a STRING of commands using PFSshell upon a PS2 HDD
  44.  
  45. Returns STRING log of executed commands.
  46.  
  47. Requires
  48.     #RequireAdmin
  49.     #include <AutoItConstants.au3>
  50.  
  51. #ce ----------------------------------------------------------------------------
  52. Func _PFSshell( $sDiskDrive , $sCommands , $sPFSshellAppPath = @ScriptDir & '\Bin\PFS Shell\' )
  53.     Local $iPID = Run( @ComSpec & ' /C pfsshell' , $sPFSshellAppPath , @SW_HIDE , $STDIN_CHILD + $STDOUT_CHILD )
  54.     ProcessWait( 'pfsshell.exe' )
  55.     StdinWrite( $iPID , 'device ' & $sDiskDrive & @CRLF )
  56.     Local $aCommands = StringSplit( $sCommands , '|' )
  57.     For $ii = 1 To $aCommands[0]
  58.         StdinWrite( $iPID , $aCommands[$ii] & @CRLF )
  59.     Next
  60.     StdinWrite( $iPID , 'exit' & @CRLF )
  61.     ProcessWaitClose( 'pfsshell.exe' )
  62.     ProcessClose( $iPID )
  63.     Local $sPID = StdoutRead( $iPID )
  64.     ; Strip the First 11 lines
  65.     $sPID = StringTrimLeft( $sPID , StringInStr( $sPID , @CRLF , 0 , 11 ) + 1 )
  66.  
  67.     Return $sPID
  68. EndFunc
  69.  
Add Comment
Please, Sign In to add comment