-
Posts
33 -
Joined
-
Last visited
AvvA's Achievements
Seeker (1/7)
7
Reputation
-
SupaNewb reacted to a post in a topic:
adding items to windows 7 taskbar
-
argumentum reacted to a post in a topic:
UAC Pass - bypass UAC prompts only for specific programs
-
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
Hi I've just released an 1.8 version, only to correct 2 annoying bugs, one with the help system since Windows 8 (because of a missing Windows' system file), and another on x64 Windows with some system paths (because of the way UAC Pass was compiled). I can't test the 32 bits version on a 32 bits system, the problem may still be there with this version, here are the steps to reproduce it: - try to make a shortcut on your desktop of an application located in "C:\Program Files\whatever folder\", - drop this shortcut on UAC Pass, - drop the new free-shortcut on UAC Pass, - check the new-new shortcut properties: the path should be "C:\Program Files(x86)" if the bug is still here, or "C:Program Files" if the bug vanished. If someone can do the test on an x86 OS (with UAC Pass 1.8 - 32 bits), I'd be glad to hear the results (on an x64 one, it bugs), I'll then know that I can remove this version, or not. If not, no problem, I recommend to DL the 64 bits version anyway ^^. Nothing fancy in this version, but it's here anyway, feel free to use it! program : https://sites.google.com/site/freeavvarea/UACPass-en#features-and-download (Source files are at the bottom, as usual with AutoIt and/or UPX, some AV spot nasty things in the 32 bits version) -
AnonymousX reacted to a post in a topic:
controlling button border color
-
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
Hi Sorry for the URL, I tried to reach all sites where I talk about UAC Pass to tell them the "new" URL and forget the very source: here! For the story, I was using a free DNS redirection via freedns.afraid.org*, because I tried a lot of hosts and it was hard to tell everyone, each time I changed, what was the new URL. Only having to change the redirection was a good solution, was I thinking ^^. But... The domain owner didn't renew the domain name so all links shut down in January 2014. Actually the domain name was re-bought but not re-share. So, after giving up on free hosting services (no, google site isn't like a classic hosting service ^^, you can't use your own CMS), I'm giving up on free DNS redirection as well. Anyway, as long I can share, it's not really important! *Which is a free Domain Name Service where users can share their domain for other users to be free to create subdomains on them. -
Yes, your loop allows to check any file size, but at a cost of a lot of time when original trancexx function doesn't work with this file size. It comes from the results I gave in the first, well, the second "code block". You can check it with file 1, 2 and 3. Of course, files of this size aren't common, but the results are here ^^. The guess was a "memory available" guess (on DllCall("advapi32.dll", "none", "MD5Update",...), and I was talking about checksum calculation speed. To resume it: If trancexx OP function fails, your trancexx-loop is slower than AutoIt and Ward functions (and a lot slower: +1/3). I already planned to have a look at SMF (and its source). I keep it for when I'll have finished my program to compare the duplicates "find time", it shouldn't be very long from now.
-
Hello I'm making a duplicate unifier program which requires a lot of checksum calculation, so I did some tests with what AutoIt proposes to do so. I put the results here so this OP function gets what it deserves, a lot of flowers , because it is from far the fastest way: ;AutoIt 3.3.8.0 / core2duo e8500 (3GHz) with 4GB RAM ;file number - file size ;Returned result (MD5 or Error code) / what algorythm was used / time in second(s) ;~ empty reference ;~ -1 AutoIt: 0.00804 ;~ 0xD41D8CD98F00B204E9800998ECF8427E Ward: 0.00125 ;~ 0x trancexx: 7e-005 --error code: 1 ;~ 0xD41D8CD98F00B204E9800998ECF8427E trancexx KaFu loop: 0.00687 ;~ file 1 - 18 421 716 284 bytes ;~ 0xF4E9DD62A332BA84B117CF28724F6C60 AutoIt: 208.96297 ;~ 0xF4E9DD62A332BA84B117CF28724F6C60 Ward: 228.21975 ;~ 0x trancexx: 0.00029 --error code: 3 ;~ 0xF4E9DD62A332BA84B117CF28724F6C60 trancexx KaFu loop: 349.84716 ;~ file 2 - 4 544 836 158 bytes ;~ 0x58537EC5AE153A7329233273601C2021 AutoIt: 52.01713 ;~ 0x58537EC5AE153A7329233273601C2021 Ward: 57.13209 ;~ 0x trancexx: 0.00025 --error code: 3 ;~ 0x58537EC5AE153A7329233273601C2021 trancexx KaFu loop: 83.66316 ;~ file 3 - 4 269 469 696 bytes ;~ 0x7FD7DB11C916BBDE489AF65773A18EDA AutoIt: 63.08034 ;~ 0x7FD7DB11C916BBDE489AF65773A18EDA Ward: 63.29612 ;~ 0x trancexx: 0.00028 --error code: 3 ;~ 0x7FD7DB11C916BBDE489AF65773A18EDA trancexx KaFu loop: 90.67639 ;~ file 4 - 1 691 638 535 bytes ;~ 0x5300F75099D47E275A9F6C43AC501469 AutoIt: 19.84701 ;~ 0x5300F75099D47E275A9F6C43AC501469 Ward: 16.96491 ;~ 0x5300F75099D47E275A9F6C43AC501469 trancexx: 3.74323 ;~ 0x5300F75099D47E275A9F6C43AC501469 trancexx KaFu loop: 4.37193 ;~ file 5 - 1 061 624 491 bytes ;~ 0x0DA1C47D0666154B8CA0F717F272DF68 AutoIt: 11.75191 ;~ 0x0DA1C47D0666154B8CA0F717F272DF68 Ward: 10.53561 ;~ 0x0DA1C47D0666154B8CA0F717F272DF68 trancexx: 2.34701 ;~ 0x0DA1C47D0666154B8CA0F717F272DF68 trancexx KaFu loop: 2.74187 ;~ file 6 - 874 719 232 bytes ;~ 0xB9803CCA589DDD2282FC72A98DB190C5 AutoIt: 11.08526 ;~ 0xB9803CCA589DDD2282FC72A98DB190C5 Ward: 8.85178 ;~ 0xB9803CCA589DDD2282FC72A98DB190C5 trancexx: 1.94553 ;~ 0xB9803CCA589DDD2282FC72A98DB190C5 trancexx KaFu loop: 2.27487 ;~ file 7 - 502 623 560 bytes ;~ 0xCBA697798DF0F97F7F77F69323844305 AutoIt: 6.16212 ;~ 0xCBA697798DF0F97F7F77F69323844305 Ward: 4.99015 ;~ 0xCBA697798DF0F97F7F77F69323844305 trancexx: 1.11381 ;~ 0xCBA697798DF0F97F7F77F69323844305 trancexx KaFu loop: 1.30208 ;~ file 8 - 465 462 751 bytes ;~ 0x5C853441C5607BC368AF1A3AB6F9197C AutoIt: 5.07992 ;~ 0x5C853441C5607BC368AF1A3AB6F9197C Ward: 4.8146 ;~ 0x5C853441C5607BC368AF1A3AB6F9197C trancexx: 1.03213 ;~ 0x5C853441C5607BC368AF1A3AB6F9197C trancexx KaFu loop: 1.21896 ;~ file 9 - 417 966 540 bytes ;~ 0xE4CF02FF783E6F8E43C457F1D0B18C2A AutoIt: 4.48574 ;~ 0xE4CF02FF783E6F8E43C457F1D0B18C2A Ward: 4.17559 ;~ 0xE4CF02FF783E6F8E43C457F1D0B18C2A trancexx: 0.92816 ;~ 0xE4CF02FF783E6F8E43C457F1D0B18C2A trancexx KaFu loop: 1.08682 ;~ file 10 - 308 718 465 bytes ;~ 0x4CE09676A6DCD8861C72E08C1F5CD674 AutoIt: 3.02671 ;~ 0x4CE09676A6DCD8861C72E08C1F5CD674 Ward: 3.0758 ;~ 0x4CE09676A6DCD8861C72E08C1F5CD674 trancexx: 0.68433 ;~ 0x4CE09676A6DCD8861C72E08C1F5CD674 trancexx KaFu loop: 0.80289 ;~ file 11 - 257 518 137 bytes ;~ 0xA3BFA6A0446153943BE1BC0A42B36049 AutoIt: 3.38988 ;~ 0xA3BFA6A0446153943BE1BC0A42B36049 Ward: 2.58057 ;~ 0xA3BFA6A0446153943BE1BC0A42B36049 trancexx: 0.5766 ;~ 0xA3BFA6A0446153943BE1BC0A42B36049 trancexx KaFu loop: 0.68594 ;~ file 12 - 154 540 032 bytes ;~ 0xBE0EF9F1417B402C704A96C4E1ACBC3F AutoIt: 1.7613 ;~ 0xBE0EF9F1417B402C704A96C4E1ACBC3F Ward: 1.55319 ;~ 0xBE0EF9F1417B402C704A96C4E1ACBC3F trancexx: 0.3431 ;~ 0xBE0EF9F1417B402C704A96C4E1ACBC3F trancexx KaFu loop: 0.41976 ;~ file 13 - 103 694 336 bytes ;~ 0xC613B584EEDAA2EBDAA632D4FEA384E0 AutoIt: 1.17679 ;~ 0xC613B584EEDAA2EBDAA632D4FEA384E0 Ward: 1.04872 ;~ 0xC613B584EEDAA2EBDAA632D4FEA384E0 trancexx: 0.2305 ;~ 0xC613B584EEDAA2EBDAA632D4FEA384E0 trancexx KaFu loop: 0.27598 ;~ file 14 - 51 460 096 bytes ;~ 0x1EC05C6087BCC09B206E955765D36AA5 AutoIt: 0.58349 ;~ 0x1EC05C6087BCC09B206E955765D36AA5 Ward: 0.52024 ;~ 0x1EC05C6087BCC09B206E955765D36AA5 trancexx: 0.11452 ;~ 0x1EC05C6087BCC09B206E955765D36AA5 trancexx KaFu loop: 0.1405 ;~ file 15 - 23 477 240 bytes ;~ 0x09B4DF75B57669F89F7B0AAA542B5701 AutoIt: 0.2437 ;~ 0x09B4DF75B57669F89F7B0AAA542B5701 Ward: 0.23622 ;~ 0x09B4DF75B57669F89F7B0AAA542B5701 trancexx: 0.05252 ;~ 0x09B4DF75B57669F89F7B0AAA542B5701 trancexx KaFu loop: 0.06804 ;~ file 16 - 16 777 234 bytes ;~ 0x7E54D27E183ECAADCD40CC3678A88D00 AutoIt: 0.21001 ;~ 0x7E54D27E183ECAADCD40CC3678A88D00 Ward: 0.16981 ;~ 0x7E54D27E183ECAADCD40CC3678A88D00 trancexx: 0.03751 ;~ 0x7E54D27E183ECAADCD40CC3678A88D00 trancexx KaFu loop: 0.04984 ;~ file 17 - 11 171 648 bytes ;~ 0x7629625F3CAA89F2E49FFB6A546FD3B5 AutoIt: 0.13932 ;~ 0x7629625F3CAA89F2E49FFB6A546FD3B5 Ward: 0.11384 ;~ 0x7629625F3CAA89F2E49FFB6A546FD3B5 trancexx: 0.02517 ;~ 0x7629625F3CAA89F2E49FFB6A546FD3B5 trancexx KaFu loop: 0.0355 ;~ file 18 - 5 592 560 bytes ;~ 0x6F44D565E29560EA0EB60564F78D3F05 AutoIt: 0.08437 ;~ 0x6F44D565E29560EA0EB60564F78D3F05 Ward: 0.05616 ;~ 0x6F44D565E29560EA0EB60564F78D3F05 trancexx: 0.0127 ;~ 0x6F44D565E29560EA0EB60564F78D3F05 trancexx KaFu loop: 0.02193 ;~ file 19 - 2 348 343 bytes ;~ 0xF0DBB928FF2F13E256E78519BE115AA7 AutoIt: 0.04418 ;~ 0xF0DBB928FF2F13E256E78519BE115AA7 Ward: 0.0231 ;~ 0xF0DBB928FF2F13E256E78519BE115AA7 trancexx: 0.00562 ;~ 0xF0DBB928FF2F13E256E78519BE115AA7 trancexx KaFu loop: 0.01193 ;~ file 20 - 1 081 045 bytes ;~ 0xE69D04B2D335AE2902388DE5B1AE4ADD AutoIt: 0.08075 ;~ 0xE69D04B2D335AE2902388DE5B1AE4ADD Ward: 0.01595 ;~ 0xE69D04B2D335AE2902388DE5B1AE4ADD trancexx: 0.00419 ;~ 0xE69D04B2D335AE2902388DE5B1AE4ADD trancexx KaFu loop: 0.01144 ;~ file 21 - 523 938 bytes ;~ 0xAB7A34FD227F297F87E00BA480995970 AutoIt: 0.08225 ;~ 0xAB7A34FD227F297F87E00BA480995970 Ward: 0.00772 ;~ 0xAB7A34FD227F297F87E00BA480995970 trancexx: 0.00232 ;~ 0xAB7A34FD227F297F87E00BA480995970 trancexx KaFu loop: 0.00912 ;~ file 22 - 272 006 bytes ;~ 0xD47914C5C493FF6CDC72A8F5E12BC278 AutoIt: 0.00359 ;~ 0xD47914C5C493FF6CDC72A8F5E12BC278 Ward: 0.00292 ;~ 0xD47914C5C493FF6CDC72A8F5E12BC278 trancexx: 0.0009 ;~ 0xD47914C5C493FF6CDC72A8F5E12BC278 trancexx KaFu loop: 0.00772 ;~ file 23 - 262 104 bytes ;~ 0x608DA9EF056FFCC4A801B02D60C1F4F6 AutoIt: 0.06753 ;~ 0x608DA9EF056FFCC4A801B02D60C1F4F6 Ward: 0.00315 ;~ 0x608DA9EF056FFCC4A801B02D60C1F4F6 trancexx: 0.00135 ;~ 0x608DA9EF056FFCC4A801B02D60C1F4F6 trancexx KaFu loop: 0.00799 ;~ file 24 - 129 514 bytes ;~ 0x78C1F2C312EEBE871F5EA2DF4A379DDD AutoIt: 0.06359 ;~ 0x78C1F2C312EEBE871F5EA2DF4A379DDD Ward: 0.00197 ;~ 0x78C1F2C312EEBE871F5EA2DF4A379DDD trancexx: 0.00095 ;~ 0x78C1F2C312EEBE871F5EA2DF4A379DDD trancexx KaFu loop: 0.00756 ;~ file 25 - 65 180 bytes ;~ 0x9375FB719F32BE2997291ADF30251A9F AutoIt: 0.06624 ;~ 0x9375FB719F32BE2997291ADF30251A9F Ward: 0.00109 ;~ 0x9375FB719F32BE2997291ADF30251A9F trancexx: 0.00065 ;~ 0x9375FB719F32BE2997291ADF30251A9F trancexx KaFu loop: 0.00782 ;~ file 26 - 32 641 bytes ;~ 0x25F9184E7C1504D4D772F6E7FBD26EBE AutoIt: 0.00227 ;~ 0x25F9184E7C1504D4D772F6E7FBD26EBE Ward: 0.00071 ;~ 0x25F9184E7C1504D4D772F6E7FBD26EBE trancexx: 0.00056 ;~ 0x25F9184E7C1504D4D772F6E7FBD26EBE trancexx KaFu loop: 0.00729 ;~ file 27 - 16 235 bytes ;~ 0xCB62BF22679273F50688032240B4C9FF AutoIt: 0.00119 ;~ 0xCB62BF22679273F50688032240B4C9FF Ward: 0.00057 ;~ 0xCB62BF22679273F50688032240B4C9FF trancexx: 0.00055 ;~ 0xCB62BF22679273F50688032240B4C9FF trancexx KaFu loop: 0.00732 ;~ file 28 - 6 357 bytes ;~ 0xE19B7AF1827971780B398917B2547A93 AutoIt: 0.01017 ;~ 0xE19B7AF1827971780B398917B2547A93 Ward: 0.00028 ;~ 0xE19B7AF1827971780B398917B2547A93 trancexx: 0.00028 ;~ 0xE19B7AF1827971780B398917B2547A93 trancexx KaFu loop: 0.00531 ;~ file 29 - 1 120 bytes ;~ 0x254505EFA186EB805BFB53DF215170E5 AutoIt: 0.00848 ;~ 0x254505EFA186EB805BFB53DF215170E5 Ward: 0.00025 ;~ 0x254505EFA186EB805BFB53DF215170E5 trancexx: 0.00027 ;~ 0x254505EFA186EB805BFB53DF215170E5 trancexx KaFu loop: 0.00533 ;~ file 30 - 832 bytes ;~ 0x7DB8F0455C4540F2C8D4D4AA54F3A6BF AutoIt: 0.01178 ;~ 0x7DB8F0455C4540F2C8D4D4AA54F3A6BF Ward: 0.00025 ;~ 0x7DB8F0455C4540F2C8D4D4AA54F3A6BF trancexx: 0.00028 ;~ 0x7DB8F0455C4540F2C8D4D4AA54F3A6BF trancexx KaFu loop: 0.00551 ;~ file 31 - 41 bytes ;~ 0xDF23D4FCFBD134ABA539FEC167EFFF42 AutoIt: 0.00063 ;~ 0xDF23D4FCFBD134ABA539FEC167EFFF42 Ward: 0.00024 ;~ 0xDF23D4FCFBD134ABA539FEC167EFFF42 trancexx: 0.00028 ;~ 0xDF23D4FCFBD134ABA539FEC167EFFF42 trancexx KaFu loop: 0.00606 ;~ file 32 - 0 bytes ;~ 0xD41D8CD98F00B204E9800998ECF8427E AutoIt: 0.00055 ;~ 0xD41D8CD98F00B204E9800998ECF8427E Ward: 0.00016 ;~ 0x trancexx: 0.00011 --error code: 2 ;~ 0xD41D8CD98F00B204E9800998ECF8427E trancexx KaFu loop: 0.00616 Here is the code I used to do these tests: #include <crypt.au3> ;for AutoIt way #include <md5.au3> ;for Ward way Func numbersplit($number, $separator = ' ') $number = Round($number) $count = StringLen($number) If $count < 4 Then Return $number $countsplit = Ceiling($count / 3) $firstsplit = Mod($count, 3) $finalstring = StringLeft($number, $firstsplit) If $firstsplit <> 0 Then $finalstring &= $separator For $i=0 To $countsplit Step 1 $start = 1 + $firstsplit + 3*$i $finalstring &= StringMid($number, $start, 3) If $i < $countsplit-1 Then $finalstring &= $separator Next If $firstsplit <> 0 Then $finalstring = StringTrimRight($finalstring, 1) Return $finalstring EndFunc #include<winapiex.au3> ; #FUNCTION# ;=============================================================================== ; ; Name...........: _MD5ForFile ; Description ...: Calculates MD5 value for the specific file. ; Syntax.........: _MD5ForFile ($sFile) ; Parameters ....: $sFile - Full path to the file to process. ; Return values .: Success - Returns MD5 value in form of hex string ; - Sets @error to 0 ; Failure - Returns empty string and sets @error: ; |1 - CreateFile function or call to it failed. ; |2 - CreateFileMapping function or call to it failed. ; |3 - MapViewOfFile function or call to it failed. ; |4 - MD5Init function or call to it failed. ; |5 - MD5Update function or call to it failed. ; |6 - MD5Final function or call to it failed. ; Author ........: trancexx ; ;========================================================================================== Func _MD5ForFile($sFile) ;_WinAPI_Wow64EnableWow64FsRedirection(False) ;It's only for system files redirected by WOW3264, don't use it for every files. Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _ "wstr", $sFile, _ "dword", 0x80000000, _ ; GENERIC_READ "dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE "ptr", 0, _ "dword", 3, _ ; OPEN_EXISTING "dword", 0, _ ; SECURITY_ANONYMOUS "ptr", 0) If @error Or $a_hCall[0] = -1 Then ; _WinAPI_Wow64EnableWow64FsRedirection(True) ;it's only for system files redirected by WOW3264 Return SetError(1, 0, "") EndIf ;_WinAPI_Wow64EnableWow64FsRedirection(True) ;it's only for system files redirected by WOW3264 Local $hFile = $a_hCall[0] $a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _ "hwnd", $hFile, _ "dword", 0, _ ; default security descriptor "dword", 2, _ ; PAGE_READONLY "dword", 0, _ "dword", 0, _ "ptr", 0) If @error Or Not $a_hCall[0] Then DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Return SetError(2, 0, "") EndIf DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Local $hFileMappingObject = $a_hCall[0] $a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _ "hwnd", $hFileMappingObject, _ "dword", 4, _ ; FILE_MAP_READ "dword", 0, _ "dword", 0, _ "dword", 0) If @error Or Not $a_hCall[0] Then DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Return SetError(3, 0, "") EndIf Local $pFile = $a_hCall[0] ;_WinAPI_Wow64EnableWow64FsRedirection(False) Local $iBufferSize = FileGetSize($sFile) ;_WinAPI_Wow64EnableWow64FsRedirection(True) Local $tMD5_CTX = DllStructCreate("dword i[2];" & _ "dword buf[4];" & _ "ubyte in[64];" & _ "ubyte digest[16]") DllCall("advapi32.dll", "none", "MD5Init", "ptr", DllStructGetPtr($tMD5_CTX)) If @error Then DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Return SetError(4, 0, "") EndIf DllCall("advapi32.dll", "none", "MD5Update", _ "ptr", DllStructGetPtr($tMD5_CTX), _ "ptr", $pFile, _ "dword", $iBufferSize) If @error Then DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Return SetError(5, 0, "") EndIf DllCall("advapi32.dll", "none", "MD5Final", "ptr", DllStructGetPtr($tMD5_CTX)) If @error Then DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Return SetError(6, 0, "") EndIf DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Local $sMD5 = Hex(DllStructGetData($tMD5_CTX, "digest")) Return SetError(0, 0, $sMD5) EndFunc ;==>_MD5ForFile #include<WinAPI.au3> Func md5_KaFu($Checksum_Filename) local $nBytes ;$Checksum_Filename = @ScriptDir & "\Testfile.exe" Local $MD5_CTX = DllStructCreate("dword i[2];" & _ "dword buf[4];" & _ "ubyte in[64];" & _ "ubyte digest[16]") DllCall("advapi32.dll", "none", "MD5Init", "ptr", DllStructGetPtr($MD5_CTX)) ;_WinAPI_Wow64EnableWow64FsRedirection(False) $hFile = _WinAPI_CreateFile($Checksum_Filename, 2, 2) ;_WinAPI_Wow64EnableWow64FsRedirection(True) ;_WinAPI_Wow64EnableWow64FsRedirection(False) $iFileGetSize_Save = FileGetSize($Checksum_Filename) ;_WinAPI_Wow64EnableWow64FsRedirection(True) $iBuffersize = 1024 * 1024 * 10 Local $tBuffer = DllStructCreate("byte[" & $iBuffersize & "]") For $i = 1 To Ceiling($iFileGetSize_Save / $iBuffersize) _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $iBuffersize, $nBytes) DllCall("advapi32.dll", "none", "MD5Update", _ "ptr", DllStructGetPtr($MD5_CTX), _ "ptr", DllStructGetPtr($tBuffer), _ "dword", $nBytes) Next If IsHWnd($hFile) Then _WinAPI_CloseHandle($hFile) DllCall("advapi32.dll", "none", "MD5Final", "ptr", DllStructGetPtr($MD5_CTX)) ;ConsoleWrite('MD5 = 0x' & Hex(DllStructGetData($tMD5_CTX, "digest")) & @crlf) Return '0x' & Hex(DllStructGetData($MD5_CTX, "digest")) EndFunc ;~ ;WarD way Local $BufferSize = 0x100000 Func md5_w($sFile) $State = _MD5Init() Dim $hFile = FileOpen($sFile, 16) For $i = 1 To Ceiling(FileGetSize($sFile) / $BufferSize) _MD5Input($State, FileRead($hFile, $BufferSize)) Next $digest = _MD5Result($State) FileClose($hFile) ;ConsoleWrite(@LF & $bDigest & " - " & $sFile & ' Ward') Return $digest EndFunc ;~ ;AutoIt way Func md5_ai($sFile, $iALG_ID=$CALG_MD5) $bDigest=_Crypt_HashFile($sFile,$iALG_ID) ;ConsoleWrite(@LF & $bDigest & " - " & $sFile & ' AutoIt') Return $bDigest EndFunc Local $aFiles[2] = ["c:\windows\explorer.exe","c:\windows\regedit.exe"] Local $stat = '', $stats = '' For $i = 0 To UBound($aFiles)-1; Step -1 $stat = @LF & 'file ' & $i+1 & ' ' & $aFiles[$i] & " - " & numbersplit(FileGetSize($aFiles[$i])) & ' bytes' ConsoleWrite($stat) $stats &= $stat $timee = TimerInit() ;_Crypt_Startup() $digest = md5_ai($aFiles[$i]) $time = TimerDiff($timee)/1000 ;_Crypt_Shutdown() $stat = @LF & $digest & ' ' & ' autoit:' & @TAB & Round($time, 5) $stats &= $stat ConsoleWrite($stat) $timee = TimerInit() $digest = md5_w($aFiles[$i]) $time = TimerDiff($timee)/1000 $stat = @LF & $digest & ' ' & ' ward:' & @TAB & Round($time, 5) $stats &= $stat ConsoleWrite($stat) $timee = TimerInit() $digest = md5_kafu($aFiles[$i]) $time = TimerDiff($timee)/1000 $stat = @LF & $digest & ' ' & ' tx_kafu:' & @TAB & Round($time, 5) $stats &= $stat ConsoleWrite($stat) $timee = TimerInit() $digest = _MD5ForFile($aFiles[$i]) $error = @error $time = TimerDiff($timee)/1000 $stat = @LF & '0x' & $digest & ' ' & ' tx:' & @tab & Round($time, 5) & ' --error code: ' & $error $stats &= $stat ConsoleWrite($stat & @lf) Next These tests allowed me to spot several things: - trancexx MD5 (OP) is the fastest for 6KB files and upper, up to, I guess, memory available. - Ward (here) is the fastest for files below 6KB (but really close to trancexx results). - Kafu loop with trancexx idea (post #13) is slower than OP function, but really faster than Ward and AutoIt function above 1MB but only up to, I guess, memory available, afterward it becomes the slowest. So, I decided to use trancexx function, and if @error was different from 0, switch to AutoIt or Ward way. This way I could get a fast MD5 calculator without doing further test (trancexx error code is returned really fast). Then I felt on some problems with trancexx OP function: - the function doesn't read target informations from reparse points (which it should do with CreateFileW parameters given), funky thing is that it returns a correct empty file hash ^^, there is no problem for files that are part of a folder RP. -> a quick solution is to send the target path if the file is a reparse point. - the function makes AutoIt do a fatal error (read in protected memory 0xC0000005) with, i.e. regedit.exe, but I assume with all system files that are redirected by WOW3264. -> a way to avoid this error is to de-activate the WOW3264 redirection. (Like in code example for trancexx and KaFu loop functions, with _WinAPI_Wow64EnableWow64FsRedirection() edit: The pink text is still half-true, the thing is I was mistaken about the source of the problem: I got other file with this error after modifying the code: this 2nd system error was send because in trancexx code (and KaFu loop) there is a FileGetSize() to get the memory to allocate and which also requires to de-activate system redirections. So the problem was partly with allocation size, it seems. Even if I found workarounds, I'd like to know if there are other ways to do: - Is it possible to modify trancexx function so that it reads RP target instead of RP itself ? - Is it possible to make it work with system protected files, like others methods do? In other words, is it possible to make the function works with WOW3264 redirection? I think the global question would be: Why this function bypass the file system (NTFS) and Windows system (WOW3264) redirections? - Is it possible to catch the real limitor of OP function, I mean what makes it return an error code if filesize is too big? What (memory?) variable should we check? Anyway, thanks a lot for this function, it's unbelievably fast! edit: - added _WinAPI_Wow64EnableWow64FsRedirection() in posted code at filegetsize() levels, still only for trancexx and KaFu loop in order to compare what it gives with redirections. - commented my post ^^
-
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
Hello I hope you found your answers before today... Even if it's far too late, I answer in case someone else comes with the same questions. @ hiho You can use it via command line, the arguments are explained on my site (-ondk, -startup, -pin2tb, -pin2sm), the link to my site is in my signature. @ comc49 I think my program won't help you because of the remote context, I may be wrong because I don't know exactly what you're doing, and because I'm not an expert of remote deployment. Perhaps you could get something with secpol.msc if looking at UAC's parameters? -
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
Yes, probably because of the main domain I'm using : r00t.la But, I'm not owning it, just using a subdomain Please, read your warning details in order to know what it is about. About the forbidden access I'm sorry, it's not under my control. I'm moving my site, against my will but for the better at the end. You can already access https://sites.google.com/site/freeavvarea/UACPass-en It's now on google site, it's on its way back to kind of what it was, as I'm cut from any php now. Edit: The site is ready, but I wasn't able to make a "true" direct link to the files, so I link the tool page instead and hope it won't get you bored too much to do 2 more clics to get your download. -
shaqan reacted to a post in a topic:
UAC Pass - bypass UAC prompts only for specific programs
-
n1maS reacted to a post in a topic:
UAC Pass - bypass UAC prompts only for specific programs
-
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
By default, a scheduled task can only be run by someone having at least the same privilege level as the one required by the task. With UAC Pass it is required to be an administrator to create, delete or use the tasks created. It is possible to grant access to an administrative task to a common user, but the task will run on the creator's session. I think there is no way for a common user to run an administrative task on his session without the administrator's login/password, because if it was possible, UAC would be useless. I hope I'm right, but I'm not sure, as always with software. -
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
Sorry for the late reply, I guess I missed the warning ^^'. About optional parameters on .exe dropping: anyway you'll have to enter data, and this idea would make me code almost the same as a shortcut creation, because if I propose parameters, I could also propose name, comment and so on. Because it's already available and easy to do I think it's better to make a clean shortcut, with an appropriate name, comment and parameters, and then drop it onto UAC Pass, but I'll keep this idea in mind for the next time I'll be on this tool, thanks. The batch file created with the "startup option" only intends to remove the task, don't drop it onto UAC Pass, launch it then delete it. Before v1.7 there wasn't "Show UAC freeing tasks" panel (which allows to execute and/or delete any UAC freeing task from within UAC Pass), so this batch file was made to give an easy way of removing the task. It isn't necessary anymore, I'll remove it from the preset default. Thank you -
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
First, I'm very sorry for the late reply, it seems that this forum doesn't allow to follow a topic more than a few days (weeks?)... Both of you, thanks for the flowers ^^. Philpav, I think you can't use UAC Pass to resolve your problem because a scheduled task, when launched, can't receive any other parameter (or at least I didn't find how). Let me know if you found a way. -
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
I updated links in first post to version 1.7a. This version correct a bug that was happening when you drag&drop some files onto UAC Pass GUI without the integrated tasks' list opened. Sorry, it happend because I only tested with this window opened... It was a very basic error, I corrected it by adding at line 1260: GUISwitch($lat_win) 2nd edit to main post: changed the lettercase of the source code link... sorry -
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
Updated first post to fit latest update (from today). About False positives alerts on my site, please consider that I'm not owning r00t.la domain, I only use a subdomain freely, thus I'm not related to any other subdomain than freeavvarea.r00t.la. -
AvvA reacted to a post in a topic:
Taskplaner/Taskscheduler COM UDF
-
Hello I hope I won't be redundant, I didn't find any answer with my several searches with search engines and the forum. The context is the following: I need to know if the current folder from where my script is running is a system protected folder or not, in order to determine where to write the .ini file which will keep settings of this script. This script is running elevated so I can't just test to write a file from it as it would always work in any folder. In case it is in a protected folder, I would write the .ini file in the current user's folder, like Microsoft says. In case it isn't, as my script is portable, I would write it next to the script itself. Here is the workaround I found, I hope it can help or give ideas to others. It only tests if given folder is protected or not. #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator ; #FUNCTION# ==================================================================================================================== ; Name ..........: _IsProtectedFolder ; Description ...: Test with a script running elevated if a folder is (system) protected. ; It tries to create a file in user mode via task scheduler in the folder defined, if created it is not protected else it is. ; Syntax ........: _IsProtectedFolder($Folder) ; Parameters ....: $folder -> The folder to test ; Return values .: False: not protected folder ; True: protected folder ; Sets @error to 1 If folder doesn't exist ; Author ........: AvvA ; Remarks .......: Must be run from an elevated script. ; Windows Vista and Seven OSes. ; The '/SC ONSTART' argument of the created task is irrelevant, it only permits to not define other parameters like start/end hour. ; The '/RL LIMITED' is facultative as by default it should create a limited rights task ; Link ..........: http://www.autoitscript.com/forum/topic/138227-determine-from-an-elevated-script-if-current-folder-is-system-write-protected/ ; Example .......: Yes ; =============================================================================================================================== Func _IsProtectedFolder($Folder) ;mandatory tests ;you can remove this following test If Not IsAdmin() Then ;you must run this script elevated MsgBox(0, "Error", "You must run this function with administrative privileges." & @LF&@LF & "Add this line to the top of your script:" & @LF & "#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator" & @LF&@LF & "Or run SciTE elevated.") Exit EndIf ;you shouldn't remove the 2 following tests If StringRight($Folder, 1) == '' Then $Folder = StringTrimRight($Folder, 1) ;remove an eventual anti-slash at the end of folder name If Not FileExists($Folder) Then ;the folder to test should exists ^^ SetError(1) Return EndIf ;generate random names for the task and the test file Local $TestFileName = $Folder & '' & Random(100000000, 999999999, 1) & '-' & Random(100000000, 999999999, 1) & '-testingprotectedfolderfile.txt' Local $TaskName = Random(100000000, 999999999, 1) & '-randomtaskname' ;create a scheduled task which will try a file write in the folder defined ShellExecuteWait('schtasks.exe', '/Create /TN ' & $TaskName & ' /RL LIMITED /F /SC ONSTART /NP /TR "cmd /C ''type /? > ''' & $TestFileName & '''''"', '', '', @SW_HIDE) ShellExecuteWait('schtasks.exe', '/run /TN ' & $TaskName, '', '', @SW_HIDE) ;launch this task ;Sleep(500) ;leave time for the file to be written, ie: if you comment the line below, you'll always get 'protected folder' answer ShellExecuteWait('schtasks.exe', '/delete /TN ' & $TaskName & ' /F', '', '', @SW_HIDE) ;delete this task If FileExists($TestFileName) Then ;test if file was written FileDelete($TestFileName) ;delete this test file Return False ;folder isn't protected Else Return True ;folder is protected EndIf EndFunc ;Example ;$Folder = @SystemDir & 'UsersPublic' ;this folder most likely doesn't exist ;$Folder = @HomeDrive & 'UsersPublic' ;it is not a protected folder ;$Folder = EnvGet("systemdrive") ;usually C: -> it is a protected folder ;$Folder = EnvGet("windir") ;usually C:Windows -> it is a protected folder $Folder = @ScriptDir $Protected = _IsProtectedFolder($Folder) If @error Then $Result = 'not existing' ElseIf $Protected Then $Result = 'protected' Else $Result = 'not protected' EndIf MsgBox(0, "Test protected folder", $Folder & ' folder is ' & $Result)
-
Finally I was too kind to myself, this was only the inattention... Thank you for showing me the place where it was. Also, I updated to the latest version... ...and the gradient works fine with the PNG picture, but it still doesn't with the BMP one. To me it's not important, so thank you for this update! I took a look at your GDI+ example scripts topic, I'll look further later, but for now this remembered me the ST/Amiga demo scene back in the 90s, sinus scroller, plasma, star war scroller... Excellent! I love it! I would never have though that GDI+ was able to do this kind of things!
- 164 replies
-
- base64
- code generator
-
(and 3 more)
Tagged with:
-
Hello Thanks a lot for this genius script, it's really a nice way to avoid to write pics in a temp dir. I guess because I'm not at ease with DLL calls and GDI, I fall on some problems. I join a kind of test case which contains all pictures required and transform them in files @ScriptDir, _SetPic() is a simple function to group each possibilities your script offers (compressed, Hbitmap or not, pic or button), it is at line 104. I was having problems with opacity in a small BMP pic which I use to put over some icons (top-left), I converted it to PNG and then the problem has changed (top-right): where the BMP has no transparency but all colors with Load_BMP_From_Mem(), exactly like with the Windows picture viewer, the PNG is transparent but doesn't respect the gradient (Windows viewer hasn't this problem). This makes me try to show the pic with different functions than your way. The top-left pic is my old way of doing: 1x21 BMP and GuiCtrlCreatePic() over GuiCtrlCreateIcon(). Top-right is with your way and a 1x21 PNG, it makes an uniform layer (no gradient), line 52 and 53 can replace 56 and 57 to see that the opacity levels and colors are respected with a "normal" PNG pic (look at the shadow below the text). To test the opaque BMP use lines 55 and 57. Bottom-left pic is the GDI gradient alone, bottom-right is GDI gradient over the icon, I had to create a 10x21 gradient in order it works, else it was filling the square strangely (replace the $bimggradient3 by $bimggradient2 at line 37 and 10,21 by 1,21 at lines 73 and 74 to see it). If you comment line 69 and uncomment line 66 to test your function, the gradient isn't shown at all. So, I would like to know how to use the result of Load_BMP_From_Mem() with GDI functions? Yet I didn't succeed and am forced to use a file with _GDIPlus_BitmapCreateFromFile(), but if I understood, your function with 2nd argument at False returns a bitmap handle like this GDI+ function does, doesn't it? Also, perhaps you understand why the gradient doesn't work with the 1x21 PNG and/or BMP and know a workaround? Thanks for reading! testcase.7z
- 164 replies
-
- base64
- code generator
-
(and 3 more)
Tagged with:
-
AvvA reacted to a post in a topic:
File to Base64 String Code Generator v1.20 Build 2020-06-05 (embed your files easily)
-
KaFu reacted to a post in a topic:
UAC Pass - bypass UAC prompts only for specific programs
-
UAC Pass - bypass UAC prompts only for specific programs
AvvA replied to AvvA's topic in AutoIt Example Scripts
I updated the first post (and my site) to correct the source code linked which wasn't exactly the latest one. I also did some cleaning because I often speak to much to explain things that don't really need to be explained... Hi, can you be more precise on the warning you're receiving?I have to update the google +1 button as much as the drupal core, may be that... anyway I would like to know details in order to know exactly from where it comes, if you don't mind.