Jump to content

Search the Community

Showing results for tags 'wipe'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 1 result

  1. This function rewrite whole content of given file by defined (implicitly 0x0) character and finally delete it, it's called as secure deleting. This should be VERY fast!! Just note that there is no error checking inside FileWipe() Maybe I will post later also version with error checking. You can comment line FileDelete($sFileName) to see how it's rewritten before deletion. EDIT: There can be problems with too big files (>2GB or > amount of RAM) see post #8 by Kafu #include <WinAPI.au3> ; prepare testing file FileDelete('1.txt') FileWrite('1.txt','123abc') FileWipe('1.txt') Func FileWipe($sFileName, $nByte = 0x0) If Not FileExists($sFileName) Then Return $iSize = FileGetSize($sFileName) $hFile = _WinAPI_CreateFile($sFileName, 2, 6) $hMapping = _WinAPI_CreateFileMapping($hFile) $pAddress = _WinAPI_MapViewOfFile($hMapping) MemSet($pAddress, $nByte, $iSize) _WinAPI_UnmapViewOfFile($pAddress) _WinAPI_CloseHandle($hMapping) _WinAPI_CloseHandle($hFile) FileDelete($sFileName) EndFunc Func MemSet($pDest, $nChar, $nCount) DllCall("msvcrt.dll", "ptr:cdecl", "memset", "ptr", $pDest, "int", $nChar, "int", $nCount) If @error Then Return SetError(1,0,False) Return True EndFunc ; from WinAPIEx - just simplified for this purpose Func _WinAPI_CreateFileMapping($hFile) Local $Ret = DllCall('kernel32.dll', 'ptr', 'CreateFileMappingW', 'ptr', $hFile, 'ptr', 0, 'dword', 0x4, 'dword', 0, 'dword', 0, 'ptr', 0) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) Return $Ret[0] EndFunc Func _WinAPI_MapViewOfFile($hMapping) Local $Ret = DllCall('kernel32.dll', 'ptr', 'MapViewOfFile', 'ptr', $hMapping, 'dword', 0x6, 'dword', 0, 'dword', 0, 'dword', 0) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) Return $Ret[0] EndFunc Func _WinAPI_UnmapViewOfFile($pAddress) DllCall('kernel32.dll', 'int', 'UnmapViewOfFile', 'ptr', $pAddress) If @error Then Return SetError(1, 0, 0) Return 1 EndFunc Here is my first test version without memory mapped files: Func FileWipe($sFileName, $nByte = 0x0) If Not FileExists($sFileName) Then Return $iSize = FileGetSize($sFileName) $tBuffer = DLLStructCreate("byte[" & $iSize & "]") MemSet(DLLStructGetPtr($tBuffer), $nByte, $iSize) $hFile = _WinAPI_CreateFile($sFileName, 2, 6) _WinAPI_WriteFile($hFile, DLLStructGetPtr($tBuffer), $iSize, $iSize) _WinAPI_CloseHandle($hFile) FileDelete($sFileName) EndFunc
×
×
  • Create New...