Jump to content

Recommended Posts

Posted (edited)

I working on sandbox protector. I creating a file. I controlling this file. This file can be found in multiple folders. That's why I'm keeping a list of folders took control with a loop. But the _filelisttoarray function does not work. I'm codes below. I'm waiting for your help. Thanks to everyone.

#include <array.au3>
#include <file.au3>

Func sandboxcontrol()
    
    $sandbox = 0

    $rand = Random(0, "999999999", 1)

    FileWrite(@UserProfileDir & "\" & $rand, "")

    $hFilesFolders = _FileListToArray(@HomeDrive & "\Sandbox\" & @UserName, 'P*.*')

    For $v In $hFilesFolders

        $file = FileExists(@HomeDrive & "\Sandbox\" & @UserName & "\" & $v & "\user\current\" & $rand)

        If $file = true Then
            $sandbox = 1
        EndIf

    Next
    
    If $sandbox = 1 Then
        Return True
    Else
        Return False
    EndIf

    FileDelete(@UserProfileDir & "\" & $rand)

EndFunc

If sandboxcontrol() Then
    MsgBox(0, "", "Sandboxie detected!")
Else
    MsgBox(0, "", "Sandboxie didn't detect.")
EndIf
Edited by sanaldosya
Posted

_FileListToArray sets @error when there is a problem. What's the value of @error when you run your script?

My UDFs and Tutorials:

  Reveal hidden contents

 

  • Solution
Posted (edited)

I solved the problem. I replaced 

$hFilesFolders = _FileListToArray(@HomeDrive & "\Sandbox\" & @UserName, 'P*.*')

to

$hFilesFolders = _FileListToArray(@HomeDrive & "\Sandbox\" & @UserName, '*', 2)

Good coding.

Edited by sanaldosya
Posted

Don't forget the missing $ in the variable.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I am curious though how you came about P*.* as being valid?

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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...