Leaderboard
Popular Content
Showing content with the highest reputation on 11/04/2011 in all areas
-
Valik, Please do not tar us all with the same brush - it is a very small (albeit vocal) minority who are doing that. The rest of us are extremely grateful for the work that has been done to get the COM implementation to work correctly - just as we are when any other unseen "gotcha"s are fixed. If any such work to produce a more stable AutoIt results in a performance hit then I personally (although I am sure I speak for many others too) am quite prepared to put up with it. Although any Dev promises of possible future speed improvements are always welcome and make it easier to accept. M232 points
-
Hi. I've been working on this for a while. I think now it's good enough to post it here. Functions to do most everything with the DACL and ownership on all types of objects: Files or folders, Registry keys, services, Kernel and WMI objects, etc. Here's a good example to test: #include 'Permissions.au3' _InitiatePermissionResources() FileWrite(@ScriptDir&'test.txt','Test') Local $TI = TimerInit() Local $ret = _DenyAllAccess(@ScriptDir&'test.txt',$SE_FILE_OBJECT,@UserName) Local $TD = TimerDiff($TI) MsgBox(0,'','Deny all access to test.txt and take ownership:'&@CRLF&@CRLF& _ '_DenyAllAccesss return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() $ret = _GrantReadAccess(@ScriptDir&'test.txt',$SE_FILE_OBJECT,'Administrators') $TD = TimerDiff($TI) MsgBox(0,'','Grant everyone read access, all access to admins and system, and set the owner: Admins group'&@CRLF&@CRLF& _ '_GrantReadAccesss return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() $ret = _GrantAllAccess(@ScriptDir&'test.txt') $TD = TimerDiff($TI) MsgBox(0,'','Grant everyone access'&@CRLF&@CRLF& _ '_GrantAllAccesss return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() $ret = _CopyFullDacl(@ScriptDir&'test.txt',$SE_FILE_OBJECT,@ScriptDir) $TD = TimerDiff($TI) MsgBox(0,'','Restore all inherited permissions'&@CRLF&@CRLF& _ '_CopyFullDacl return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() Local $aPerm[2][3] = [['Restricted',1,$GENERIC_ALL],['Users',1,$GENERIC_ALL]] $ret = _EditObjectPermissions(@ScriptDir&'test.txt',$aPerm) $TD = TimerDiff($TI) MsgBox(0,'','Add two granted access aces: Restricted and Users'&@CRLF&@CRLF& _ '_EditObjectPermissions return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() Dim $aPerm[2][3] = [['Restricted',1,$GENERIC_READ],['Users',1,$GENERIC_READ]] $ret = _EditObjectPermissions(@ScriptDir&'test.txt',$aPerm) $TD = TimerDiff($TI) MsgBox(0,'','Give only read access to the Restricted and Users groups'&@CRLF&@CRLF& _ '_EditObjectPermissions return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() Dim $aPerm[2][3] = [['Restricted',0,$GENERIC_ALL],['Users',0,$GENERIC_ALL]] $ret = _EditObjectPermissions(@ScriptDir&'test.txt',$aPerm) $TD = TimerDiff($TI) MsgBox(0,'','Deny access to the Restricted and Users groups'&@CRLF&@CRLF& _ '_EditObjectPermissions return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the file permissons before closing the message box.') $TI = TimerInit() Local $Hndl = _Permissions_OpenProcess(@AutoItPID) Local $SDBefore = _GetObjectStringSecurityDescriptor($Hndl,$SE_KERNEL_OBJECT) Local $CODRet = _ClearObjectDacl($Hndl,$SE_KERNEL_OBJECT) Local $DARet = _DenyAllAccess($Hndl,$SE_KERNEL_OBJECT) Local $SDAfter = _GetObjectStringSecurityDescriptor($Hndl,$SE_KERNEL_OBJECT) $TD = Round(TimerDiff($TI),2) MsgBox(0,'', 'Deny everyone access to the current process:'&@CRLF&@CRLF& _ '@AutoItPID original security descriptor: '&@CRLF&$SDBefore&@CRLF&@CRLF& _ '_ClearObjectDacl return value: '&$CODRet&@CRLF&@CRLF& _ '_DenyAllAccess_ return value: '&$DARet&@CRLF&@CRLF& _ 'New @AutoItPID security descriptor: '&@CRLF& _ $SDAfter&@CRLF&@CRLF& 'Time taken: '&$TD&' miliseconds.') _Permissions_CloseHandle($Hndl) FileDelete(@ScriptDir&'test.txt') _ClosePermissionResources()I'm planning to add functions to deal with the Sacl in the future, even though I don't think it's very important. Edit: Let me know if you need an example for the registry. Updated: Fixed a bug in the _ClearObjectDacl function. I thought that adding a null DACL would work fine, but it causes problems later when adding a new DACL. Those who have downloaded, please update. Shoot! Now it wasn't clearing the DACL at all. Updated again. I think it's fixed now. Updated 9/11/2011 - Added the security descriptor functions and removed unnecessary constants. Updated 10/11/2011 - There were some functions missing in the index, and some parameters in the comments. Also removed the "MustDeclareVars" option. (About 50 total downloads before) Update 12/12/2011 - Added more functions: New Update 12/12/2011 - Missing declaration keywords in 3 constants. Sorry Update 16/12/2011 - Added support for all object types, including window and process handles. Added more functions, modified most of them, and removed one. Here's the new function list: Updated 22/2/2012.. This time I'm including SecurityConstants.au3 and FileConstants.au3 to prevent constants conflicts. Added a few more functions and fixed a few bugs. Also added the ability to include the inherited aces in the _EditObjectPermissions function. Now the permissions array can have four elements (optional). It will still work with three elements arrays though. The fourth element is intended to have the inheritance flag for the corresponding ace. Here's the new list of functions: 400 previous downloads Permissions.au31 point
-
I'd say you're probably seeing a problem where the quotes are being stripped off. I'd say, trying to create a GUI that way will never work. I'd think what you're attempting is never going to work the way you wan tit to.1 point
-
Latest Beta
jaberwacky reacted to Valik for a topic
It's fine to question it. But when we explain the choices are "slower speed" and "not working" then that's the point where everybody should shut up and be like, "Yeah, having something that works is far more important than something that's fast but is broken". That didn't happen. This is only tangentially related to her InterfaceDispatch. Okay, more than tangentially. We did have further discussions about InterfaceDispatch via PM which convinced me to allow it to go in. Without that she wouldn't have had current editions of one of the main COM files. Having those files allowed her to see the problems in AutoIt's implementation which was causing some things not to work and she was able to fix it (eventually). Here's the key fact, though: We do know the facts and we've told you guys what you need to know but that's apparently not enough for some people. Beyond that, though, there's always this: When a developer of a product tells you not to use something and why you shouldn't use it... it's probably best to fucking listen to them, especially when said developer (me) does not have a reputation for bullshitting people. That alone should be enough to silence all of you but I went beyond that and explained (along with trancexx) some of the more technical reasons. I don't rule out that it will get faster. I only assert that it is unlikely to ever be as fast as it used to be. We've already discussed her re-writing COM from scratch doing things right in all places (Rather than these band-aids built on top of other code). I think you can extrapolate the reason I'm holding her back on this if you've paid attention to the MVP forum the past couple weeks. For all I know she already has it done and is just waiting for me to let her commit it. I didn't really discuss COM speed directly. My post was a criticism to the people who put so little faith in us as to question us incessantly about a subject we've explained ad nauseum. Your post, however, does explicitly reference the COM speed issue so I think that means you are gay and dumb and gay.1 point -
Importing text file into array
dickjones007 reacted to enaiman for a topic
#include <file.au3> ; open file for reading $readfile = "c:\ipaddr.txt" ;Read in lines of text into array until the EOF is reached Dim $text If Not _FileReadToArray("c:\ipaddr.txt", $text) Then MsgBox(4096, "Error", " Error reading text file to Array error:" & @error) Exit EndIf ;define 2 arrays - one for old IP's and the other for new IP's Dim $old_ip[UBound($text)] Dim $new_ip[UBound($text)] ;put the number of elements in the element 0 of each array $old_ip[0] = $text[0] $new_ip[0] = $text[0] For $x = 1 To $text[0] $array = StringSplit($text[$x], ",") $old_ip[$x] = $array[1] $new_ip[$x] = $array[2] Next ; Close file FileClose($readfile)1 point