Jump to content
Sign in to follow this  
aleeksunder

RegDelete bug ? Deleting values from keys without write access rights

Recommended Posts

Hello!

I've found some not obvious behaivor of RegDelete() function. So If we already have created registry key 'HKEY_LOCAL_MACHINE\SYSTEM\Test' _without_ 'value' in it. RegDelete() will will raise an Error with code = 1 ( according to documentation 1 means - Unable to open requested key ), instead of code = -2 ( unable to delete requested key/value ).

This code running under account without administrative right, will return @error = 1 even if 'HKEY_LOCAL_MACHINE\SYSTEM\Test' already existing key and no 'value' in it.

$i_regdelete_result = RegDelete( 'HKEY_LOCAL_MACHINE\SYSTEM\Test' , 'value' ) ; = 2
MsgBox( 0 , 'ERROR' , @error ) ; = 1

Maybe this is due to RegDelete() tries to open target key with write access and gets denied. So I thought that this is not so obvious as it can be. And naturally $i_regdelete_result must have 0 in this scenario ( according to documenatation 0 means Special return value of RegDelete when key/value does not exist )

Edited by aleeksunder

Share this post


Link to post
Share on other sites

The special return is when you have access successfuly to the key

which is not the case as you don't run i admin mode

For me AutoIT behavior is OK

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jahar
      I have an AutoIT script It monitors 2 websites for content that applys to me and the services that I provide. One site is : www.Freelancer.com The other: www.PeoplePerHour.com Both sites publish new jobs on their site hourly or so. My AutoIT app, will view those sites and present new jobs to me in a grid that pops up on my screen. Lately, the app has stopped showing me any jobs from PeoplePerHour.
       
      For freelancer.com,  Inetget is giving full html but for peopleperhour, now its not coming.
      Func _CheckPPH()
          Local Static $hTimer = 0
          Local Static $hDownload = 0
          Local $aTitlesandUrls = 0
          Local Static $sTempFile = ""
          If $hTimer = 0 Then $hTimer = TimerInit()
          If $hDownload = 0 Then
              $sTempFile = _WinAPI_GetTempFileName(@TempDir)
              ConsoleWrite("Checking PPH..." & @CRLF)
              ConsoleWrite(">Downloading..." & @CRLF)
      ;~         $hDownload = InetGet("http://www.peopleperhour.com/freelance-jobs", $sTempFile, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
              $hDownload = InetGet("http://www.peopleperhour.com/freelance-jobs", $sTempFile, $INET_FORCERELOAD)
      ;~         Return 0
          EndIf
      ;~     Sleep(30)
      ;~     Local $isCompleted = InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
      ;~     Local $isError = InetGetInfo($hDownload, $INET_DOWNLOADERROR)
      ;~     Sleep(30)
      ;~     If TimerDiff($hTimer) > 3000 And $isError Then
      ;~         ConsoleWrite("!PPH Fail" & @CRLF)
      ;~         InetClose($hDownload)
      ;~         $hDownload = 0
      ;~         Return 0
      ;~     EndIf
      ;~     Sleep(30)
          Local $Show = 0
      ;~     If TimerDiff($hTimer) > 3000 And $isCompleted Then
          If $hDownload > 0 Then
              ConsoleWrite("+Downloaded..." & @CRLF)
              Local $sPPHHtml = FileRead($sTempFile)
              $aTitlesandUrls = _StringBetween($sPPHHtml, '"title">' & @LF, 'time>')
      ;~         _ArrayDisplay($aTitlesandUrls)
              Local $aPPH[0][4]
              Local $sTitle = ""
              Local $sUrl = ""
              Local $sID = ""
              Local $sDate = ""
              Local $iRet=0
              Sleep(30)
              For $i = 0 To UBound($aTitlesandUrls) - 1
                  $sTitle = _StringBetween($aTitlesandUrls[$i], '<a title="', '" class')
                  $sUrl = _StringBetween($aTitlesandUrls[$i], 'href="', '">')
                  $sDate = _GetDate($aTitlesandUrls[$i])
                  If IsArray($sTitle) And IsArray($sUrl) Then
                      $sID = _GetID($sUrl[0])
      ;~                 _ArrayAdd($aPPH, $sDate & "|" & $sTitle[0] & "|" & $sUrl[0] & "|" & $sID)
                      $iRet = _BuildPopupsPPH($sID, $sDate, "PPH: " & $sTitle[0], $sUrl[0])
                      If $iRet Then $Show+=1
                  EndIf
              Next
              Sleep(30)
      ;~         If $Show > 0 Then ShowLatestJobs()
      ;~         _ArrayDisplay($aPPH)
              FileDelete($sTempFile)
              InetClose($hDownload)
              $hDownload = 0
              $hTimer = 0
              Return $Show
          EndIf
          Sleep(30)
      EndFunc   ;==>_CheckPPH
    • By malicioussoap
      back when I was still doing autohotkey you could write (in code) spanisha::á
      and whenever you were in google docs or notepad you could type (in the document) spanisha  and it instantly turns it into á 
      I tried doing this in autoit, here's what I have so far (my entire code so if this language requires a main function or a return/exit to function properly please let me know):
      ;is this a proper comment? HotKeySet ( "spanisha" , "SendAltered" ) Func SendAltered() Send("á", flag = 0); EndFunc I assume that autoit follows a sort of contemporary hotkey pressing model where you have to hold all keys at the same time? which makes this impossible. So
      I'm wondering if anyone has a workaround for this? or maybe an alternative to HotKeySet()
      I have a vague memory of someone saying that doing something like spanisha:á would work. I don't know if I'm slightly off syntax but this doesn't work.
      Also I tried doing 
      ;is this a proper comment? ;HotKeySet ( "a" , "SendAltered" ) ;spanisha::á Func SendAltered() Send("á"); EndFunc just to try and debug,
      I'm also wondering if my approach is fundamentally wrong since HotKeySet() was made for something like !^A. Or if Send() is syntactically wrong.
      I'm also noticing on these forums that specifying installation is important so to whom it may concern I downloaded both installers, editor and main files. Although I'm about to be real mad if the editor installation makes a difference.
    • By shelly
      I have to press tab to reach a selected button then double click on that
      Here's my script but its not working:
      WinActivate("Policy Decisions -- Webpage Dialog","")
      Sleep(3000)
      Send("{TAB}")
      Send("{TAB}")
      Send("{TAB}")                    // at this point its working according to my need  but double click is not working
      Mouseclick("Left",510, 320, 2, 0)

    • By TheDcoder
      See this thread for info:
    • By nooneclose
      Why can I not click on either of my input fields?
      #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 730, 437, 192, 124) ;GUISetFont(14, 800, 0, "MS Sans Serif") GUISetBkColor(0xC0DCC0) Global $Label1 = GUICtrlCreateLabel("Enter your Password. UserName is auto filled", 62, 40, 604, 41, $SS_CENTER) GUICtrlSetFont(-1, 26, 800, 0, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("User Name:", 120, 130, 604, 31, $SS_LEFT) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") Global $Label3 = GUICtrlCreateLabel("Password:", 135, 210, 604, 31, $SS_LEFT) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") Global $Input1 = GUICtrlCreateInput(@UserName, 274, 130, 185, 32) GUICtrlSetFont(-1, 14, 800, 1, "MS Sans Serif") Global $Input2 = GUICtrlCreateInput("Password", 274, 210, 185, 32, $ES_PASSWORD) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") Global $OK = GUICtrlCreateButton("OK", 274, 270, 185, 57) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK Global $UserName = GUICtrlRead($Input1) Global $PassWord = GUICtrlRead($Input2) ExitLoop EndSwitch WEnd ; Delete the GUI window GUIDelete()  
×
×
  • Create New...