Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2017 in all areas

  1. Hi I was looking for a way to detect if the workstation is locked on all Windows platforms and could not find a working solution in this thread. The original thread seems to have diverted from its original topic, so I thought a new topic would be more appropriate. So after reading this and this and this and this and this and this, I wrote the following which seems to work, and I'd like to hear your opinion (perhaps it can be improved). Btw, IsWorkstationLockedModern() seems more resource consuming than IsWorkstationLockedLegacy() but if, for some reason, it is preferred over the latter, it may still be used on Windows 7 and Windows Server 2008 R2, by excluding them from IsLegacyOS(), and checking for SessionFlags==1 instead of 0 (due to a Windows bug; this is explained in the last "this" link). Func IsWorkstationLocked() If (IsLegacyOS()) Then Return IsWorkstationLockedLegacy() Else Return IsWorkstationLockedModern() EndIf EndFunc Func IsLegacyOS() Return ((@OSVersion == "WIN_2008R2") OR (@OSVersion == "WIN_2008") OR (@OSVersion == "WIN_7") OR (@OSVersion == "WIN_VISTA") OR (@OSVersion == "WIN_2003") OR (@OSVersion == "WIN_XP") OR (@OSVersion == "WIN_XPe") OR (@OSVersion == "WIN_2000")) EndFunc Func IsWorkstationLockedLegacy() Local Const $DESKTOP_SWITCHDESKTOP = 0x100 Local $hUser32dll = DllOpen("user32.dll") Local $hDesktop = DllCall($hUser32dll, "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) If ((@error) OR ($hDesktop[0] == 0)) Then Return SetError(1, 0, False) EndIf Local $result = DllCall($hUser32dll, "int", "SwitchDesktop", "int", $hDesktop[0]) Local $isLocked = ($result[0] == 0) DllCall($hUser32dll, "int", "CloseDesktop", "int", $hDesktop[0]) DllClose($hUser32dll) Return $isLocked EndFunc Func IsWorkstationLockedModern() Local Const $WTS_CURRENT_SERVER_HANDLE = 0 Local Const $WTS_CURRENT_SESSION = -1 Local Const $WTS_SESSION_INFO_EX = 25 Local $hWtsapi32dll = DllOpen("Wtsapi32.dll") Local $result = DllCall($hWtsapi32dll, "int", "WTSQuerySessionInformation", "int", $WTS_CURRENT_SERVER_HANDLE, "int", $WTS_CURRENT_SESSION, "int", $WTS_SESSION_INFO_EX, "ptr*", 0, "dword*", 0) If ((@error) OR ($result[0] == 0)) Then Return SetError(1, 0, False) EndIf Local $buffer_ptr = $result[4] Local $buffer_size = $result[5] Local $buffer = DllStructCreate("uint64 SessionId;uint64 SessionState;int SessionFlags;byte[" & $buffer_size - 20 & "]", $buffer_ptr) Local $isLocked = (DllStructGetData($buffer, "SessionFlags") == 0) $buffer = 0 DllCall($hWtsapi32dll, "int", "WTSFreeMemory", "ptr", $buffer_ptr) DllClose($hWtsapi32dll) Return $isLocked EndFunc
    1 point
  2. Can you make a generic script to reproduce issue so i can test on my w10 system?
    1 point
  3. Appreciate that tip. Good idea @Earthshine Thanks will do.
    1 point
  4. That was exactly it. Thanks @Earthshine
    1 point
  5. Ya right ... appple or was it circles ... I forgot but that has to do with my age. I am out too unless this needs locking. Jos
    1 point
  6. Instead of disabling UAC for the whole system, you could just disable it for Admins to allow run your script. Local Computer Policy -> Windows Settings -> Security Settings -> Local Policies -> Security Options -> User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode |-> Elevate without prompting. Adam
    1 point
  7. I know I formulated the previous post with tongue in cheek , but it looks you didn't really catch nor cared and continue the same none informative line of questioning. So let me be clearer this time: Supply some proper information on what you want to do and what you have tried so far that isn't working. Then... and only then... people might be compelled to help with a useful answer. Jos
    1 point
  8. @ttt480 typically when people are being as purposely vague as you have been, there is a reason for it. Please ensure you have read the forum rules, and that your thread does not run afoul of them. Beyond that, good luck in your endeavor - perhaps someone with more patience for teeth pulling will drop in to assist you.
    1 point
  9. I have a Dev lable because I maintain the SciTE4AutoIt3 stuff around here, but do Moderation on the forum as well since a long time. Jos
    1 point
  10. I understand. I just heard about UDF : ImageSearch, PixelSearch, PixelGetColor, PixelChecksum, BmpSearch. And I thought that it is possible to use this UDF.
    1 point
  11. @ttt480 So you have a script that does at least part of what you want already. Why would you go 19 posts into a thread without sharing that?! How about showing us what you have, so we can see what you're trying to do rather than asking us to guess?
    1 point
  12. So show a screenshot of the "certain symbols", and what are they contained in (application, web app, etc.). Again, having to pull teeth is not going to get you the help you seek
    1 point
  13. Why use apples when you really want to use something else? Jos
    1 point
  14. @ttt480 are you really searching for pictures of apples and pears, or something else? Please explain in more detail what you are trying to do, what you have tried on your own, what application this is in, and what your desired end result would be. There may be multiple ways to skin this particular cat, depending on your answers. Help us help you
    1 point
  15. Welcome to AutoIt and the forum! What have you tried so far? We do not spoon feed users here, we teach them to fish
    1 point
  16. FileListToArray() works great. I also use RegEx if I plan to only have one installer at any given time but the numbers change so that it can match any number. If your version numbers end up being set in a way that you cant not always get the correct result with an ascending/descending list, use FileGetTime() and then you can sort by modified/created dates.
    1 point
  17. I should have remembered to update this thread, when I found the solution - but I didn't. The solution was to edit the Group Policy for admin users, default it's set to Enabled Local Computer Policy -> Windows Settings -> Security Settings -> Local Policies -> Security Options -> User Account Control: Run All administrators in Admin Approval Mode |-> Disabled Changing the above, made my script work as it did in server 2008 (apparently I had changed the above in 2k8 also) I haven't checked if it works in win10, course I don't have win10 installed. Cheers /Rex
    1 point
  18. NutBuster

    GImageX ADK10 x64

    MODERATOR THIS TOPIC CAN BE DELETED, THIS ISSUES WAS MY MISTAKE.
    1 point
  19. Earthshine and everyone else, thank you for all your help!
    1 point
  20. @BigDaddyO, taking your description literally, it cannot be done. you cannot give a user permission to execute the script & read the credentials source, but deny the ability to uncover the credentials. however, it is possible if you define your scenario properly. for an adequate solution, the following conditions must be considered: 1) is your script desktop-oriented, or can it execute at the background (headless)? if it is desktop-oriented, can it be converted to work headless? 2) is the user (person) executing your script also need to interact with it? 3) does your script work differently for each user? do you need to log who is the user executing your script? 4) how heterogeneous are those production systems? e.g. are they all Windows-based? in the same AD domain? off hand i'd say, in a simple scenario, you can schedule your script to execute at startup with a dedicated AD account that has access to the credentials data (or has the credentials stored in its Credential Manager). define your scenario properly, and you may get better suggestions.
    1 point
  21. here (https://www.autoitscript.com/forum/topic/181014-a-naive-question/?do=findComment&comment=1299979) you can find a simple implementation of the Bresenham's Algorithm, translated in AutoIt, to plot lines, circles, ellipses and Bézier curves plotted pixel by pixel (or character by character on a text box as well if you prefer)
    1 point
  22. Why do you want to automate the GUI? More reliable is the Excel UDF that comes with AutoIt.
    1 point
  23. If the numbers are always 4 digits (or an equal number of digits), then you could just filter part of the file name (using _FileListToArray) and then use _ArraySort(). The last array element ought to be the latest version. You could try this approach to see if it works in your situation, and find out if there are any extra steps needed.
    1 point
  24. Use RegRead to get the default value listed within the CLSID key...? Local $sCLSID = "{09799AFB-AD67-11d1-ABCD-00C04FC30936}" msgbox(0,"",_GetCLSIDDefaultValue($sCLSID)) Func _GetCLSIDDefaultValue($sCLSID) Local $sValue = RegRead("HKCR\CLSID\" & $sCLSID,"") Return SetError(@error, @extended, $sValue) EndFunc
    1 point
  25. Again, all the functionality you need is built into msiexec, no need to go to a third party product. Logging is not enabled unless you tell it to with the /l switch. So /lv <path to log file> will give you verbose logging of the uninstall.
    1 point
  26. https://scotch.io/tutorials/the-ins-and-outs-of-token-based-authentication
    1 point
  27. That's faster and works, provided the structure of the IDs complies with the pattern I guessed (else adapt the pattern) : CheckForDupsOnlyLookingAtSampleID() Func CheckForDupsOnlyLookingAtSampleID() $sFileName = "left.txt" Local $sText = FileRead($sFileName) $sText = StringRegExpReplace($sText, "(?m)^(\w{7}-\w{4} \w{3}\.\w{3})(\s<.*\R)(\g1\R?)", "$1$2") ConsoleWrite($sText & @LF) EndFunc ;==>CheckForDupsOnlyLookingAtSampleID
    1 point
  28. While 1 For every post in the "is my exe really infected" thread, there is an article about malware authors compiling with AutoIt to obfuscate signatures. Wend
    1 point
  29. Let me give you the same amount of info as you did in the question: Yes. Welcome by the way. Jos
    1 point
  30. I'm not sure if it's possible to give less information in a request than this. Please try and explain what it is you're looking for with as much detail as possible, including what application, what you've tried (regardless of whther it's working or not.)
    1 point
×
×
  • Create New...