Jump to content

AvvA

Active Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by AvvA

  1. 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)
  2. 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.
  3. 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.
  4. 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 ^^
  5. 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?
  6. 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.
  7. 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.
  8. 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
  9. 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.
  10. 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
  11. 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.
  12. 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)
  13. 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!
  14. 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
  15. 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.
  16. Thanks you. I think similarly to this, obviously, if I didn't this little tool wouldn't be here. I did pass some time on this, but I would prefer that you use different criteria than this to evaluate it ^^' Don't worry about my handle, it gets hit whatever the spelling is, I use an advanced visual decoder called myopia, it renders the concept of edge inexistent
  17. Hi! UAC Pass aims to make UAC-free shortcuts. It was made to reduce the hassle of UAC prompts for frequently used applications requiring elevation, without shutting down the UAC protection (UAC is a great step forward about security). UAC-free shortcuts are shortcuts pointing to scheduled tasks, these scheduled tasks being run with their creator's rights, it bypasses the prompt usually made by User Account Control. Out of typical features related to scheduled tasks (session's start and multiple/single instance), I also implemented in 1.5 an easy way to use UAC Pass with programs located on a removable device such as a USB stick, it consists of storing into a batch file the relative path to shortcuts stored on the removable device that will produce UAC-free shortcuts on batch execution. With version 1.7 I added a list of freeing-tasks created, where you can launch and delete them, it aims to ease the USB Mode usage. The script in itself works well under Windows 7 x64 and x86, theoretically all versions (Pro, family...), it should also work well under Vista despite I already get returns about something that doesn't work and which you can know about by reading the FAQ (Time pass and still no more return about Vista, as I don't have access to it, perhaps it was occasional bugs, or permanent ones, I can't know without Vista's users feedback). It requires to be logged in with an administrative account, It is fully portable, It works with drag & drop, single or multiple files, It can make shortcut to almost anything (not only applications), it keeps shortcuts' parameters, it can restore the original shortcut (and destroy the scheduled task & UAC-free shortcut), it has support for command-line. it has several working modes (Command Line, direct D&D onto uacpass.exe or a shortcut to it, or D&D over main gui). It is useless for people that can't log in as administrators, it is also useless for people that want to make shortcuts that would bypass this UAC prompt under a common user account. Despite it is only in English and in French, It should work with any localized Windows language (I would welcome feedback about pinning, or about non-ANSI characters in shortcut names). I welcome any correction to English language. About additional translations, I will welcome you to send me all translated variables and leave me update my program so it takes in account your language. The source code is available and modifiable, but please, remember that UAC Pass itself is under Creative Commons (BY-NC-ND). If you wish to make a custom version, either to only change colors settings or to translate it in another language, please contact me. Before asking anything, please, read UAC Pass inline help, it should cover everything. Also read the main page and the FAQ. A changelog can be found in the UAC Pass sub-menus on the top left of the main page. You can come to my site to download the tool or its sources*. https://sites.google.com/site/freeavvarea/UACPass-en *Thanks to UEZ, the source code is now only 3 files: the icon, the main au3 program, and a second au3 which contains every pictures as binary strings. I'd like to thanks: (click on their names to see the pieces of code) - taz742 (multiple files drag&amp;amp;drop) - trancexx (drag&amp;amp;drop with elevation) - UEZ (load image to/from memory, seriously, it's Enormous!) Obviously I didn't used the version linked, but the 14-01-2012 one, whatever, it fulfill its purpose! - Allow2010 (I used and modified some of the task scheduler COM functions he made) - KaFu (Thanks for the suggestions about UEZ and Allow2010 work) Cheers! edit, 27 April 2012: - Update to version 1.7a, compiled program and source code (re-updated links ^^'). This version correct a bug that was happening when you drag&amp;amp;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) edit, 12 March 2014: Changed URLs to the site. Note that compiled version as much as source code still have a pointer to the dead URL "freeavvarea.r00t.la" in the about pane.
  18. I'm confused, sorry Yashied and thanks wraithdu. I looked at a folder like if it was a file, like it is physically, wrong angle... I succeed to use this flag with _WinAPI_CreateFileEx() (can' figure it out with _WinAPI_CreateFile), and indeed now I've got the target paths of junctions and symbolic links, that's great! Thanks a lot for answering my newbie question.
  19. It wasn't, you added FindFirstFile/FindNextFile() but not FindFirstFileName/FindNextFileName(). But anyway, the important part of my previous message was, excluding the thanks part, the problem with _WinAPI_GetFinalPathNameByHandleEx()
  20. Hello Thanks a lot for this library, it makes me avoid hours of mind torture to convert MSDN functions to AutoIt able to use these functions ^^'. I've got a problem with _WinAPI_GetFinalPathNameByHandleEx() (I also tried with _WinAPI_GetFinalPathNameByHandle() ), I'm using Win7 x64 and AutoIt 3.3.8 x86. It works perfectly with files but doesn't with folders. I'm trying to use this function to retrieve easily the target of a symbolic link or a junction. By the way, as I'm here, would it be possible for you to add the FindFirstFileName() and FindNextFileName() functions? I already try several times to convert them without success, it seems easy to do but in fact it isn't.. at least for me. Their purpose is to find all filenames (and their paths) attached to an MFT entry, it is useful to list all hard links attached to a single file. Cheers!
  21. Hi KaFu, Thank you about explaining what was going wrong, it is always interesting to understand things. About UAC Pass, thanks for the flowers . I guess it is a shy attitude, this is really an insignificant tool compared to SMF. Also the source are a bit messy... well, they are messy, and I see you, AutoIt MVP, coming with your whips ^^. Well, it makes me realize that I push back this moment since the beginning (cleaning the source code), I'll publish them on my site as they are, and then I'll make a topic here. I'll buy protection against whips, and clean the sources when I will have finished my current project. I take advantage of this post to propose some ideas about SMF. I see 2 things which could be nice, the first could help me with my current duplicates project (as I try a lot, without success, to convert the functions to AutoIt), the second could make it useless, but I don't care - Why not list all hard links to a file in a tooltip when hovering the hard link number of a file (FindFirstFileNameW / FindNextFileNameW), - Why not propose, after auto-selecting the 1st duplicate of a file, to hard link the other dupes to the 1st one? (either with a DLL call, either with integrated AutoIt FileCreateNTFSLink() ) This second idea includes that dupes must be on the same drive, which must be NTFS formatted. Cheers, AvvA
  22. Hi, I'm using the v1.8 portable on a win7 Pro x64 and I perhaps found a small bug. I find out that full MD5 hashes aren't right. I tested with big and small files too, to check with short MD5 and it seems to have the same problem. I used my own program to check out (which uses default AutoIt _Crypt_HashFile() ), the CorZ checksum, and an online md5() too, just to be sure. The hashes seem to be consistent, but the numbers returned aren't right. By consistent I mean that, in example, when doing a duplicate search the dupe files returned are alright. I'll follow this topic, but as it doesn't keep this setting for long, don't hesitate to ask me by PM if you need informations, or reprimand me because I made a big wrong discovery .
  23. Thank you M23 picea892, when seeing your marvelous scripts I feel a bit like a hobbit at war with my dirty WEB trick... Well, it's different because the work with my example is made with GIMP, whereas all by code lines with yours, which I find quite delicious despite it requires more inclusions. In all case thanks for pointing out your scripts, they're really beautiful and seem quite customizable.
  24. Thank you Melba23 for the label idea, this helped me a lot to see things under a different angle. I give a simple solution to draw custom colored borders and to add a gradient over the label. I like that it doesn't require to include something special to work. Custom colored Border: It consists of creating a 24 bits BMP picture of 1x1 pixel and to extend it to the height and width of the label, +1 pixel. Below 24 bits it seems not to work, but I only tested on Windows 7. Pictures get the Click events, I had to move the behavior on the border control, except for the 1st and last buttons which only use a gradient over the label, but which is a picture of the exact same size on top of the label, and the behavior is still on the label and working, but it isn't for the ones with a border, I didn't get it.). I attach 2 BMP pictures, one black and one red, 1x1 pixel, 100% opacity. Gradient: It consists of creating an image of 1 pixel width and approximatively "the size of a button" height. Then rotate this image 90°, fill it with a gradient from white to black, rotate back 90°, reduce opacity to something which will please you, save as a BMP 32 bits. 32 bits is important to keep opacity. I give 2 sample images, the first sizing 1x21 pixel, top black -> white bottom (to match with $SS_SUNKEN), 20% opacity, the second 64x64, "glass effect", 31% opacity (made by S187). -------------- I took Melba23 sample code and add a hand cursor on mouse over and a sunken border for some "label-buttons". Then I read the control position and size and apply the gradient resized to the control size on top of it. For custom border I create them first (for them to be background of the label), then create the label, then get size and position of this label and adapt the previously created border picture to slightly overlap the label (by 1px in my examples). Don't forget to put the attached files near script file. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 350, 180) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetBkColor(0x505050) GUICtrlSetDefColor(0xcccccc) ; only gradient with default sunken border (which are also victims of the gradient) $label = GUICtrlCreateLabel("Browse 1", 10, 10, 60, 25, BitOr($SS_NOTIFY, $SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN)) ;$SS_SUNKEN for the bi-coloured border GUICtrlSetOnEvent(-1, "Hi") GUICtrlSetBkColor(-1, 0x414141) GUICtrlSetCursor(-1, 0) ;set a hand cursor on mouse over $ctrlpos = ControlGetPos($hGUI, "", $label) ;retrieve the control left,top, width and height GUICtrlCreatePic(@ScriptDir & '\' & "gradient.bmp", $ctrlpos[0],$ctrlpos[1], $ctrlpos[2],$ctrlpos[3]) ; apply gradient to the whole label ; when you know the size of the control - gradient on label only, and a black border GUICtrlCreatePic("black.bmp", 79,9, 62,27) ;make a rectangle larger and longer than the label of 1 pixel GUICtrlSetCursor(-1, 0) GUICtrlSetOnEvent(-1, "Hi") $label0 = GUICtrlCreateLabel("Browse 2", 80,10, 60,25, BitOr($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x414141) $ctrlpos = ControlGetPos($hGUI, "", $label0) GUICtrlCreatePic(@ScriptDir & '\' & "gradient.bmp", $ctrlpos[0],$ctrlpos[1], $ctrlpos[2],$ctrlpos[3]) ; apply gradient to the whole label ; when you know the size of the control - gradient on label, sunken borders, black borders GUICtrlCreatePic("black.bmp", 159,9, 62,27) ;make a rectangle larger and longer than the label of 1 pixel GUICtrlSetCursor(-1, 0) GUICtrlSetOnEvent(-1, "Hi") $label1 = GUICtrlCreateLabel("Browse 3", 160,10, 60,25, BitOr($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN)) GUICtrlSetBkColor(-1, 0x414141) $ctrlpos = ControlGetPos($hGUI, "", $label1) GUICtrlCreatePic(@ScriptDir & '\' & "gradient.bmp", $ctrlpos[0],$ctrlpos[1], $ctrlpos[2],$ctrlpos[3]) ; apply gradient to the whole label ; only gradient resized to overlap label size by one pixel, thus making a border $label2 = GUICtrlCreateLabel("Browse 4", 230, 10, 60, 25, BitOr($SS_NOTIFY, $SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetOnEvent(-1, "Hi") GUICtrlSetBkColor(-1, 0x414141) GUICtrlSetCursor(-1, 0) $ctrlpos = ControlGetPos($hGUI, "", $label2) ;retrieve the control left,top, width and height GUICtrlCreatePic(@ScriptDir & '\' & "gradient.bmp", $ctrlpos[0]-1,$ctrlpos[1]-1, $ctrlpos[2]+2,$ctrlpos[3]+2) ; apply gradient to the whole label + 1 pixel ; when you don't know the size of the control - gradient applied to label only, red border $border = GUICtrlCreatePic("red.bmp", 1,1, 1,1) ; prepare the border GUICtrlSetOnEvent(-1, "Ouille") GUICtrlSetCursor(-1, 0) $label3 = GUICtrlCreateLabel("Don't do that", 10,50, -1,-1, BitOr($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x991010) $ctrlpos = ControlGetPos($hGUI, "", $label3) GUICtrlSetPos($border, $ctrlpos[0]-1,$ctrlpos[1]-1, $ctrlpos[2]+2,$ctrlpos[3]+2) ;make the background color to the size of the control +1 pixel GUICtrlCreatePic(@ScriptDir & '\' & "gradient.bmp", $ctrlpos[0],$ctrlpos[1], $ctrlpos[2],$ctrlpos[3]) ;apply gradient to label only ; when you don't know the size of the control - gradient applied to label and to border $border1 = GUICtrlCreatePic("red.bmp", 1,1, 1,1) GUICtrlSetCursor(-1, 0) GUICtrlSetOnEvent(-1, "Ouille") $label4 = GUICtrlCreateLabel("I... I wonder... no, don't!", 90,50, -1,40, BitOr($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x991010) $ctrlpos = ControlGetPos($hGUI, "", $label4) GUICtrlSetPos($border1, $ctrlpos[0]-1,$ctrlpos[1]-1, $ctrlpos[2]+2,$ctrlpos[3]+2) GUICtrlCreatePic(@ScriptDir & '\' & "gradient.bmp", $ctrlpos[0]-1,$ctrlpos[1]-1, $ctrlpos[2]+2,$ctrlpos[3]+2) ;apply gradient to whole label and border ; when you don't know the size of the control - special gradient applied to label, no border $label5 = GUICtrlCreateLabel("Let me enlarge this button a bit...", 90,100, -1,70, BitOr($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x991010) GUICtrlSetCursor(-1, 0) GUICtrlSetOnEvent(-1, "Hi") $ctrlpos = ControlGetPos($hGUI, "", $label5) GUICtrlCreatePic(@ScriptDir & '\' & "ombre.bmp", $ctrlpos[0],$ctrlpos[1], $ctrlpos[2],$ctrlpos[3]) ;apply gradient to whole label GUISetState() While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc Func Ouille() MsgBox(0, "", "What was written already?") EndFunc Func Hi() MsgBox(0, "", "Hi!") EndFunc Border and gradient are similar, it is possible to use the gradient to do a better border, and as you do the gradient you can choose how it should be, but it costs room if you want something beautiful. The advantage of the color dot and the gradient bar is in their sizes. I hope it could help . It gives this: gradient.bmp black.bmp red.bmp ombre.bmp
  25. Thanks for this topic, and all those which link to it. Nevertheless I feel it misses something... Kiboost did tell it without telling it: these text Verbs() are localized. As I like to do world-apps, at least at usage level, here is the way I found to get the current system strings from Windows shell32.dll (thanks to google I found and this here by searching "Pin to Tas&kbar" : http://www.win7dll.info/shell32_dll.html). Thanks to all involved people. The code below allows to pin or unpin to/from Start Menu or TaskBar, and allows to define argument(s) for pinned applications, in any language. As I don't have a Enterprise or Ultimate Windows Seven, I wasn't able to test if this was suitable to each and every localized Windows 7, but as I'm confident Windows doesn't work by magic, it should be international. But, as a matter of fact, Windows is sometimes strange, so I would like Spanish, Russian, Endian and any other language than French to be confirmed as working with this method, if you're kind enough to do so, thanks. #include-once #include <WinAPI.au3> #include <Constants.au3> Func _pinunpin($filepath, $action = 'p2sm', $arguments = '') $clean = 0 If Not FileExists($filepath) Or @OSBuild < 7600 Then Exit ; to arrange to your liking, SetError() & co ;split path, filename and extension $pathsplit = StringSplit($filepath, '\') $lastp = $pathsplit[0] $file = $pathsplit[$lastp] $path = StringReplace($filepath, $file, '') $path = StringTrimRight($path, 1) $filesplit = StringSplit($file, ".") $last = $filesplit[0] $fileext = $filesplit[$last] $filename = StringReplace($file, '.' & $fileext, '', 1) ;define code to use depending on action choosen Switch $action Case 'pin2SM', 'p2sm' ;pin to Start Menu $code = 5381 Case 'unpinFromSM', 'up2sm' ;unpin from Start Menu $code = 5382 Case 'pin2TB', 'p2tb' ;pin to Task Bar $code = 5386 Case 'unpinFromTB', 'up2tb' ;unpin from Task Bar $code = 5387 EndSwitch ;if arguments, make a shortcut, pin it then mark it for deletion If $arguments <> '' And $code <> 5382 And $code <> 5387 Then $linkfile = @DesktopDir & '\' & $filename & '.lnk' FileCreateShortcut($filepath, $linkfile, $path, $arguments, $filename & ' ' & $arguments, $filepath) $path = @DesktopDir $file = $filename & '.lnk' $clean = 1 EndIf ;retrieve Localized text for action $hInstance = _WinAPI_LoadLibraryEx('shell32.dll', $LOAD_LIBRARY_AS_DATAFILE) If $hInstance Then $localizedstring = _WinAPI_LoadString($hInstance, $code) ;If @error Then MsgBox(0, "Error", _WinAPI_GetLastErrorMessage()) ;debug _WinAPI_FreeLibrary($hInstance) EndIf ;when unpining from Start Menu, use the shortcut that is effectively pinned to do so, if argument(s) they are ignored If $code == 5382 Then $path = @UserProfileDir & '\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu' $file = $filename & '.lnk' EndIf ;pin or unpin $objShell = ObjCreate('Shell.Application') $objFolder = $objShell.Namespace($path) $objFolderItem = $objFolder.ParseName($file) For $val in $objFolderItem.Verbs() If StringInStr($val(), $localizedstring) Then $val.DoIt() Next ;clean temporary shortcut If $clean Then FileDelete($linkfile) EndIf EndFunc ;usage _pinunpin('C:\Windows\System32\calc.exe') ;pin Windows' calculator to taskbar. _pinunpin('C:\Windows\System32\notepad.exe', 'p2tb', 'C:\Windows\system.ini') ;pin notepad to start menu with system.ini file as argument (completely useless, but this file should be on any win7) This code can't switch between pin/unpin, you have to tell it the right action to do, or adapt the Switch part to enable unpin/pin switching.
×
×
  • Create New...