Jump to content

Prevent files from being copied


Belini
 Share

Recommended Posts

13 minutes ago, czardas said:

I think I got it

Your French is improving!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

French is my worst foreign language. Let's try without Google then you can laugh:
Je doit parler plus français! :ph34r:

Edit: The red letters were added after I checked my mistakes. I actually thought it was like that. If I practice, what I learned will come back to me.

Edited by czardas
Link to comment
Share on other sites

That's just like my own Welsh (Cymraeg llenyddol)

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@czardas & @jchd: Ladies, aren't we getting a bit off-topic here?;)

@Belini: I fear your quest is completely futile. If it's on screen, it can be copied. Never heard of screen recording software?

Link to comment
Share on other sites

Quote

I would have thought _Crypt_DecryptData() would suffice (I haven't used it, so I'm not sure). Unfortunately videos are likely to require too much RAM. I'm also not sure how you would then play the video(s) after that. I'm sure it's doable though. If it were just plain text, it would be easy.

really should spend a lot of memory because they are videos for 5 to 10 minutes!

Quote

In fact the final answer has been posted to the French forum, where the OP is duplicating his request.

They are not equal topics, here I want to know how to prevent copying and ln the French forum I asked how to know when the copy started!

I think knowing when the copy started will be the best alternative because then I can use Shutdown(1) and avoid copying the whole file!

Link to comment
Share on other sites

25 minutes ago, RTFC said:

@czardas & @jchd: Ladies, aren't we getting a bit off-topic here?;)

@Belini: I fear your quest is completely futile. If it's on screen, it can be copied. Never heard of screen recording software?

In this case not because there are more than 8,000 videos and would have to play all the way to the end to copy!

If copying the unprotected file does not need to capture what is on the screen and does not touch it all to copy so I want to avoid direct copying of the decrypted file!

if I know when the file copy was started I can turn off the pc and avoid copying it!

Link to comment
Share on other sites

16 minutes ago, Belini said:

there are more than 8,000 videos and would have to play all the way to the end to copy!

Funny you should perceive this as an obstacle on an AutoIt forum (Automate anything!). ^_^

AFAIK: 1) GetDC() does not trigger any windows message, interrupt, or anything else you can reliably hook into, 2) you cannot possibly detect every possible screen recorder software available (or written on-the-fly) as running process; 3) Using Skype, TeamViewer, or plain RDP, you can set up a 1-to-1 screen duplicate to any other machine, and record from there.

Edited by RTFC
Link to comment
Share on other sites

It gives to automate yes but it would take a lot of time, my concern is just to avoid direct copy of the same file!

Link to comment
Share on other sites

Is this working?

#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()
    Local $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    _GDIPlus_GraphicsClear($hGraphics, 0xFF000000)

    Local $hIA = _GDIPlus_ImageAttributesCreate()
    Local Const $fGamma = 0.00005
    _GDIPlus_ImageAttributesSetGamma($hIA, $fGamma, 1)

    Local $hBrush = _GDIPlus_BrushCreateSolid(0xB0FF0000)

    _GDIPlus_GraphicsFillEllipse($hGraphics, $iW2 - 100, $iH2 - 150, 200, 200, $hBrush)
    _GDIPlus_BrushSetSolidColor($hBrush, 0xB000FF00)
    _GDIPlus_GraphicsFillEllipse($hGraphics, $iW2, $iH2 - 50, 200, 200, $hBrush)
    _GDIPlus_BrushSetSolidColor($hBrush, 0xB00000FF)
    _GDIPlus_GraphicsFillEllipse($hGraphics, $iW2 - 150, $iH2 - 50, 200, 200, $hBrush)

    _GDIPlus_GraphicsDrawImageRectRect($hCanvas, $hBitmap, 0, 0, $iW, $iH, 0, 0, $iW, $iH, $hIA)
    
    
    ;lock the file
    ;-----------------------------------------------------------
    Local $hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 2, 0)
    _WinAPI_LockFile($hFile, 0, FileGetSize(@ScriptFullPath))
    ;-----------------------------------------------------------
    
    
    
    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_ImageAttributesDispose($hIA)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hCanvas)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    
    ;Unlock the file
    ;-----------------------------------------------------------
    _WinAPI_UnlockFile($hFile, 0, FileGetSize(@ScriptFullPath))
    _WinAPI_CloseHandle($hFile)
    ;-----------------------------------------------------------
EndFunc   ;==>Example

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_ImageAttributesSetGamma
; Description ...: Sets the gamma value for a specified category.
; Syntax ........: _GDIPlus_ImageAttributesSetGamma($hImageAttributes[, $fGamma = 0[, $iColorAdjustType = 0[, $bEnable = True]]])
; Parameters ....: $hImageAttributes    - a handle value.
;                  $fGamma              - [optional] a floating point value. Single precision value number that specifies the gamma value.
;                                         Default is 0.
;                  $iColorAdjustType    - [optional] an integer value. Default is 0. -> https://msdn.microsoft.com/en-us/library/windows/desktop/ms534089(v=vs.85).aspx
;                  $bEnable             - [optional] a boolean value. Boolean value that specifies whether a separate gamma is enabled
;                                         for the category specified by the type parameter. Default is True.
; Return values .: Success: True
;                  Failure: 0 and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*).
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://msdn.microsoft.com/en-us/library/windows/desktop/ms535432(v=vs.85).aspx
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_ImageAttributesSetGamma($hImageAttributes, $fGamma = 0, $iColorAdjustType = 0, $bEnable = True)
    Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesGamma", "handle", $hImageAttributes, "ubyte", $iColorAdjustType, "bool", $bEnable, "float", $fGamma)
    If @error Then Return SetError(@error, @extended, False)
    If $aResult[0] Then Return SetError(10, $aResult[0], False)
    Return True
EndFunc   ;==>_GDIPlus_ImageAttributesSetGamma

 

The GDI+ stuff around is just a code to run.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

@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

 

Edited by Belini
Link to comment
Share on other sites

4 hours ago, RTFC said:

Funny you should perceive this as an obstacle on an AutoIt forum

I totally agree, espacially since 'screen recorder software' was the obvious answer I provided on the french forum
1 file for 8000 videos, does that mean that your program displays parts on demand depending on given parameters ?
Sooo easy to automate  :)

Link to comment
Share on other sites

15 hours ago, mikell said:

I totally agree, espacially since 'screen recorder software' was the obvious answer I provided on the french forum
1 file for 8000 videos, does that mean that your program displays parts on demand depending on given parameters ?
Sooo easy to automate  :)

To use a screen recorder would need to know when a file started and when it finished and also put the right name on each file captured or capture all and then go hacking, it would need to have a good knowledge to do and not everyone has!

I really need to know when a copy was started, how can I know when a file is being copied?

Edited by Belini
Link to comment
Share on other sites

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Link to comment
Share on other sites

Not only created but opened as well.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Link to comment
Share on other sites

So ?

When a second thread/process will want to open it for itself, won't it invoke CreateFile()? Yes it will since that's the only way to access a file.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

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