Jump to content

AdamUL

Active Members
  • Posts

    715
  • Joined

  • Last visited

  • Days Won

    3

AdamUL last won the day on February 6 2020

AdamUL had the most liked content!

1 Follower

About AdamUL

  • Birthday 12/07/1976

Profile Information

  • Location
    Louisville, KY

Recent Profile Visitors

1,439 profile views

AdamUL's Achievements

  1. @Valnurat Sorry about that. I forgot that some function were not in the original UDF. The one ptrex linked is the one. I updated the UDF to use Unicode. That is the one I'm using. Here is the link. Adam
  2. @Valnurat Here is you an example, using the UDF. #include <Debug.au3> #include <Security.au3> #include 'Permissions.au3' Global $sFile = @ScriptDir & '\test.txt' FileWrite($sFile, 'test') MsgBox(0, "File", "Created") _InitiatePermissionResources() ;Get the file's DACL. ;Do not include inherited permissions. ;~ $pDACL = _GetObjectDacl($sFile) ;~ If @error Then Exit MsgBox(16, "ERROR", "Error _GetObjectDacl") ;Include inherited permissions. $pDACL = _GetObjectDaclIncludeInherit($sFile) If @error Then MsgBox(16, "ERROR", "Error _GetObjectDaclIncludeInherit") ;Create an empty array to fill with the DACL read from the object. Global $aPerm[0][4] $iRet = _MergeDaclToArray($pDACL, $aPerm) ;If there are no explicit permissions, and only inherited, the return valuse will be 0, if you used _GetObjectDacl. MsgBox(0, '', '_MergeDaclToArray return value: ' & $iRet) If $iRet = 0 Then Exit 2 ;SIDs are DLL structs so they show up as blank strings in the array. Pemissions show up as signed integers. ;$array[n][0] - SID structure. ;$array[n][1] - The access type. A value of 1 grants acecess, 0 denies access. ;$array[n][2] - The access mask. _DebugArrayDisplay($aPerm, $sFile) ;Show users and groups in the DACL array as strings. Global $aAcct Global $pAcct Global $sAcct For $i = 0 To UBound($aPerm, 1) - 1 $pAcct = DllStructGetPtr($aPerm[$i][0]) ;Convert SIDs to users and groups strings. $aAcct = _Security__LookupAccountSid($pAcct) If Not IsArray($aAcct) Then $aPerm[$i][0] = _Security__SidToStringSid($pAcct) ;Put SID string for unknown SID. ContinueLoop EndIf $sAcct = ($aAcct[1] <> "" ? $aAcct[1] & "\" : "" ) & $aAcct[0] ConsoleWrite($sAcct & " _Security__IsValidSid: " & _Security__IsValidSid($pAcct) & @CRLF) ;Replace struct with string. $aPerm[$i][0] = $sAcct Next _ClosePermissionResources() ;User and group names changed to strings to be viewable and searchable. _DebugArrayDisplay($aPerm, $sFile) FileDelete($sFile) MsgBox(0, "File", "Deleted") @ptrex I would like to see and example using Powershell. If possible, I would like to see how to get the users' or groups' specific permissions. Thanks. Adam
  3. Sorry, but currently I do not know of any functions in this UDF that will give the individual permissions directly. You can read them with the UDF. I have examples in this thread that show how to search for a user or group and change their permissions. Functions would need to be created to show the individual permissions. Adam
  4. Here is a example using GUICreate. #include <Constants.au3> #include <WindowsConstants.au3> ;~ Global $hWnd = GUICreate("", -1, -1, 50, 50, $WS_POPUP) ;Left = 50, Top = 50 Global $hWnd = GUICreate("", -1, -1, @DesktopWidth / 4, @DesktopHeight / 4, $WS_POPUP) ;Centered Global $sFilePath = FileOpenDialog("", "", "CSV (*.csv)|Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST, "", $hWnd) If @error Then Exit GUIDelete($hWnd) ConsoleWrite(@CRLF & $sFilePath & @CRLF & @CRLF) Adam
  5. You could also use the Local Account UDF. Example below. #RequireAdmin #include <LocalAccount.au3> Global $sUserName = "Admin" _AccountDisableProperty($sUserName, $ADS_UF_LOCKOUT) If @error Then ConsoleWrite(@error & @CRLF) Adam
  6. You could try using Tidy with the /gd switch to generate docs for each test script. The report is a text file, but it might be something you could work with. https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/Tidy.html Adam
  7. This is not a bug, but a feature. https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine Adam
  8. Have you rebooted the machine after running it, or logging out and back in again? Also, have you tried connecting to the PC from another PC? Adam
  9. @graybags I have updated my code above. Sorry about that, I copied it from a larger script without using Au3Check, and missed adding the additional code. Adam
  10. Here is a function that I use to enable file and print sharing on Windows 7 and Windows 10 PC. #RequireAdmin #include <Constants.au3> #include <WinAPIFiles.au3> Global Const $sSystemDir = @WindowsDir & "\System32" ;@SystemDir returns @WindowsDir & "\SYSWOW64" with a 32 bit script. Func _EnableFileAndPrintSharing() ;Enable File and Print Sharing. ;Disable x86 redirection mechanism for a 32-bit script. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDNetsh = Run('netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes', $sSystemDir, @SW_HIDE, $STDERR_MERGED) ;Enable File and Print Sharing ;Enable x86 redirection mechanism for a 32-bit script. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) ProcessWaitClose($iPIDNetsh) Local $sNetshOutput = StringStripWS(StdoutRead($iPIDNetsh), $STR_STRIPLEADING + $STR_STRIPTRAILING) If StringRegExp($sNetshOutput, "Updated \d+ rule\(s\)\.\s*Ok\.") Then Return True Return SetError(1, 0, False) EndFunc ;==>_EnableFileAndPrintSharing Adam
  11. You are using Switch incorrectly, use Select or If instead. #include <Timers.au3> While 1 $CurrIdleTime = _Timer_GetIdleTime() Select Case $CurrIdleTime >= 10001 MsgBox(64,"Current Idle Time",$CurrIdleTime) Exit EndSelect WEnd Adam
  12. Have a look at engine's HKCUReg UDF. It allow you to write to all user profiles or only certain ones. It will do the registry hive load and unload within the UDF. Adam
  13. "M" is getting converted to 0. That is why it is showing 8 M's, when it is actually 8 0's. Use the following instead for a case sensitive string compare. If $aArray[$i][1] == "M" Then Adam
  14. Maybe you are thinking of a session file. You could use a session file for each project. Load all the file you want to work with for a project, then File->Save Session..., give it your project name, and save it in the directory with you project. Then to load it, open SciTE and then File->Load Session... You will just need to remember to save the session file if you create or open new files for the project. Also, a session file is automatically saved in your user profile "%USERPROFILE%\AppData\Local\AutoIt v3\SciTE" as a "SciTE.session" file. Adam
×
×
  • Create New...