Jump to content

Recommended Posts

Posted

The tip of @Luigi was very good yes and I was able to release the file just to run and can no longer copy the file!

  • 2 years later...
Posted (edited)
On 10/5/2017 at 8:53 AM, Belini said:

The tip of @Luigi was very good yes and I was able to release the file just to run and can no longer copy the file!

Hi, How did You manage to realese the file just to run. I have the same trouble and need to prevent running exe from been copied

Edited by kader1303
Posted (edited)
On 9/17/2017 at 2:47 PM, Belini said:

@UEZ _WinAPI_LockFile () can prevent copying but does not let the player play the video too and if I put the video to play before _WinAPI_LockFile () can not protect because the video is already playing!

 

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIFiles.au3>

Example()

Func Example()
    Local $iW = 600, $iH = 400, $iW2 = $iW / 2, $iH2 = $iH / 2
    Local $hGUI = GUICreate("GDI+ Example", 600, 400)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()

    ;lock the file
    Local $file = @ScriptDir & "\video.mp4"
    ;-----------------------------------------------------------
    Local $hFile = _WinAPI_CreateFile($file, 2, 2, 0)
    _WinAPI_LockFile($hFile, 0, FileGetSize($file))
    ;-----------------------------------------------------------

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    _GDIPlus_Shutdown()

    ;Unlock the file
    ;-----------------------------------------------------------
    _WinAPI_UnlockFile($hFile, 0, FileGetSize($file))
    _WinAPI_CloseHandle($hFile)
    ;-----------------------------------------------------------
EndFunc   ;==>Example

 

Is happening to me as Bellini sayd here, if I locked file before running can't execute it, and if I do it after, isn't blocked then, as per his final post here I understand that he was able to lock file before run it and then release it just for read.

Edited by kader1303
Posted

@kader1303 for executable files I never tried, what I was trying to block were video files during the execution of it because they are encrypted but they are decrypted when you are going to run this unencrypted file, i managed to disable this file if someone can copy it while it is running.

Posted
17 minutes ago, Belini said:

@kader1303 for executable files I never tried, what I was trying to block were video files during the execution of it because they are encrypted but they are decrypted when you are going to run this unencrypted file, i managed to disable this file if someone can copy it while it is running.

Mabe I can do the same, how did you disable your file while running for being copied? can You share some example code, anyway i'll keep testing and share final results

Posted

I used the _WinAPI_LockFile () that @argumentum indicated above but it will not work with executable files.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...