Jump to content
Sign in to follow this  
feeks

RegRead uac information

Recommended Posts

feeks

Hi

I hope someone can clarify an issue that I am having with regread reporting under W7 were I have administrative rights on the machine

The situation is that I am performing the following code in a for loop against an ini file under but I am getting contradictory results depending on whether I engage UAC for the script

$Transaction = RegWrite($vidBranchPath & "\" & $iniFileSectionUSB[$i][1])
$Transaction = RegRead($vidBranchPath & "\" & $iniFileSectionUSB[$i][1], "")

If I run the script without UAC the script does not error branch even though the previous regwrite has not successfully completed the write task. If I engage UAC the registry entries are created.

My concern is not that the entries are not being created but that under non-UAC the regread is reporting their existence.

Share this post


Link to post
Share on other sites
Juvigy

What happens i think is that whithout UAC it writes the registry with Regwrite, and reads the values with Regread , but doesnt save the changes,

so when the script finishes there are no changes to the registry done. You can test it by rinning the script with NO UAC and manually checking the registry

after script finishes.

Share this post


Link to post
Share on other sites
feeks

What happens i think is that whithout UAC it writes the registry with Regwrite, and reads the values with Regread , but doesnt save the changes,

so when the script finishes there are no changes to the registry done. You can test it by rinning the script with NO UAC and manually checking the registry

after script finishes.

Juvigy

Thanks for the response. I had already tested this anomally but was not able to site temporary registry entry creation by examining the registry as the script was running. At no time did there appear registry entries to match the coding. At this point it is not a major concern as the script was developed for an XP environment but at some point we will move forward to W7

If your suspicion is correct then I am wondering how long the entries would exist for if indeed this is the case or if regread is actually returning a false result? Is this a question I should be asking in dev?

Share this post


Link to post
Share on other sites
Juvigy

I think as long as the exe is running the values will exist for it. But those entries wont be available to other apps or processes. What are you trying to accomplish exactly ?

Share this post


Link to post
Share on other sites
feeks

At the basic level certainty of operation so a test of true existence on non-existence, and as indicated previously there will be a requirement to support this functionality in the W7 environment which is probably the same thing that that is certainty of success of failure of an operation.

Share this post


Link to post
Share on other sites
Juvigy

I didnt get anything.

Wild guess:Put this in the beginning of your script

#RequireAdmin

Share this post


Link to post
Share on other sites
feeks

This had already been done. The rub is that in developing the script for xp without the #RequireAdmin in W7 for the XP environment still indicated that there were no errors when testing and developing the script. Doing the regread to confirm key entry was returning a true result while the key had not been written permanent hence the original question "How long do they exist for and when could a valid test be performed that would return a result of false without the #RequireAdmin in the W7 environment for use in the W7 environment

Share this post


Link to post
Share on other sites
Juvigy

As loong as the script/exe is running you will get TRUE when checking.When the script has finished and you check manually or with another script you will get FALSE.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • GeorgeB
      By GeorgeB
      I'm writing a little applet that basically tells you when Windows was installed.  There is a REG_DWORD in Windows that gives you this. It's basically a value that is the # of seconds from 1970.
      The location is:  "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate"
      So if I run this in AutoIT, I should get the value displayed within the msgbox:
      MsgBox($MB_SYSTEMMODAL, "InstallDate Test", RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate"))
      However, what happens is it always returns a value of "0"  I tried this on several machines (Windows 8, Windows 8.1 and Windows 10). 
      Am I missing something?  If I manually view this REG_DWORD with RegEdit, it shows me the HEX value, or I can view the Decimal value. I don't care which value AutoIT reads, as I can always convert back and forth, but I just don't see why it can't read a value from this REG_DWORD.  As a test, I've read other REG_DWORD values, and with most it doesn't return any value, not even a 0.
      Please, even if you guys have some other (perhaps better) way to read the Windows install date, I would still like to find a resolution to this problem, because I want to understand why I am having so much difficulty with reading REG_DWORD values from the Windows Registry with AutoIT.
      Thanks for any help!
       
       
       
       
       
    • timmy2
      By timmy2
      I want to determine if AutoLogon is enabled on a Windows 10 Pro (64-bit) system. It's my understanding that the following registry key will exist and equal 1 if autologon is enabled, or equal 0 if disabled. 
      Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon So l looked up RegRead in AutoIt's help file and tested the example.
      #include <MsgBoxConstants.au3> Local $sVar = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") MsgBox($MB_SYSTEMMODAL, "Program files are in:", $sVar) The resulting message box says:  C:\Program Files (x86)
      Regedit says the value in ProgramFilesDir is C:\Program Files. "C:\Program Files (x86)" is in a nearby key "ProgramFilesDir(x86)", which makes sense.
      I ignored this anomaly and tried RegRead in my own script:
      #include <MsgBoxConstants.au3> $isEnabled = RegRead("Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon") If $isEnabled = 1 then MsgBox($MB_SYSTEMMODAL, "", "Autologon enabled.") Else MsgBox($MB_SYSTEMMODAL, "", "Autologon disabled.") EndIf My punishment for ignoring the problem with the Help file example is that regardless of whether the AutoAdminLogon key equals 0 or 1 in reality, my script's $isEnabled variable returns 0.
      Despite the problem with the RegRead example I still figure I'm at fault, but I would appreciate someone pointing out my mistake, please. 
       
       
    • griefman
      By griefman
      Hi everyone,
      i am writing to you after a very long struggle i had while trying to figure out how to send a simple click inside a virtual machine running in vmware workstation 14.
      i have an autoit script running on my host machine watching for the UAC prompt to be displayed in a running vm. Both the host and the guest OS are Windows 10. This script worked perfectly with virtual box. It recognized the UAC prompt and clicked inside and the UAC was accepted. Since i switched to VMware Workstation 14, the script no longer clicks inside the VM successfully. It acts as if it clicks, but it doesn't. 
      I tried sending key combinations instead of a click, so that the VM can grab the input, but it also did not work. Every attempt that i made to send clicks or keys from the host inside the VM did not work. I tried using:
      MouseClick
      ControlClick
      MouseMove
      _WinAPI_Mouse_Event
      _WinAPI_Keybd_Event
       
      I also noticed that while the cursor moves to the target which has to be cilcked when my vmware worstation window is not focused, it even doesn't do that when i WinActivate the vmware workstation window first.
       
      Did anyone experience such an issue, or maybe could give me a hint, what else i could use to send a key combination or a mouse click in a vmware workstation 14 pro guest window?
       
      here is my code, which works with virtualbox:
       
      #AutoIt3Wrapper_Icon=".\uac.ico" #include <ImageSearchSubrogated.au3> FileInstall(".\ImageSearchDLL.dll", ".\ImageSearchDLL.dll", 0) FileInstall(".\UAC_ginloSetup.bmp", ".\UAC_ginloSetup.bmp", 0) FileInstall(".\UAC_Yes.bmp", ".\UAC_Yes.bmp", 0) ; set global variables for the coordinates, which should be delivered global $x1 = 0, $y1 = 0 global $x2 = 0, $y2 = 0 global $counter1 = 0 global $counter2 = 0 global $sleep = 10000 global $smallSleep = 5000 ; execute the script in a loop, so that it will hopefully recover from some unexpected errors While $counter1 < 1 checkForImage() WEnd #cs ------------ Functions #ce ------------ Func checkForImage() While $counter2 < 1 ; search for the UAC in the entire screen - 2 screens supported local $searchUac = _ImageSearchArea('UAC_ginloSetup.bmp', 1, -2568, -8, 5136, 1440, $x1, $y1, 0) If $searchUac = 1 Then ; if the UAC was found search for the Yes button in a an area 200 x 200 from the middle of the found UAC image local $searchYes = _ImageSearchArea('UAC_Yes.bmp', 1, $x1, $y1, $x1 + 200, $y1 + 200, $x2, $y2, 0) If $searchYes = 1 Then ; if the Yes button was found click it and pause the script for $sleep seconds MouseClick("left", $x2, $y2, 1,0) Sleep($sleep) Else ; if the Yes button was not found retry from the beginning in $smallSleep seconds MsgBox(0, "UAC found error", "UAC was found but the 'Yes' button was not found. Script will retry in " & $smallSleep & " seconds.", $smallSleep) EndIf ; another way to accept the UAC - via shortcut ;Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") ;Send("!y") Else ; if UAC was not found try again in $sleep seconds Sleep($sleep) EndIf WEnd ; if some error occured which expired the loop, pause the script for $sleep seconds MsgBox(0, "Error", "Some Error expired the timer and the script could not recover. The script will restart in " & $sleep & " seconds.", $sleep) EndFunc  
    • tcurran
      By tcurran
      Here's a short UDF that will, at least in most cases, detect whether a window can be copied from or pasted to programmatically--for example, by Send()ing ctl-c, ctl-v. This is often disabled when programs (like your AutoIt script) run at a lower UAC integrity level than the application they are trying to operate on.
      #include <WinAPI.au3> Func _WindowIsPasteable($handle) ;accepts window handle; returns true or false whether a window will accept Ctl-C, Ctl-V Local $bCanPaste = True Local $hTestWindowPID = 0 Local $hTestWindowTID = _WinAPI_GetWindowThreadProcessId($handle, $hTestWindowPID) _WinAPI_AttachThreadInput(_WinAPI_GetCurrentThreadId(), $hTestWindowTID, True);attach to window we want to paste into $bCanPaste = _WinAPI_GetFocus() ;Test whether window is paste-able--returns False if it is not _WinAPI_AttachThreadInput(_WinAPI_GetCurrentThreadId, $hTestWindowTID, False);detach from window thread Return $bCanPaste EndFunc Pass it a window handle; it returns true or false whether a window will accept programmatic pasting. The function may not work on the CMD window, since it handles the clipboard uniquely.
      This function works by attaching to the program thread of the window whose handle it receives, then attempting to perform a GetFocus on that thread. In most cases, the attempt will fail if the window will not accept programmatic copy-paste.
    • dreivilo47
      By dreivilo47
      When I use the following code I receive an UAC message:
       
      #RequireAdmin RunWait("msiexec /i winzip205-64.msi /quiet") Exit How can I hide (bypass) the UAC message?
×