Sign in to follow this  
Followers 0
ppat

RegRead, RegWrite bugged in Windows 2000 Pro

18 posts in this topic

I posted this in the bug tracking system, but got no answer whatsoever. I will post here, in case some one else has the same issue or can help me solve the problem.

My environment is Windows 2000 Professionnal SP4. (5.00.2195), using AutoIt v3.3.0.0

:) When I create a new entry in the registry with a registry editor (not AutoIt), then autoit returns the right value with RegRead.

:) When I modify the value in the registry with a registry editor (not Autoit), then autoit returns the right value with RegRead.

^_^ When I change the value with RegWrite, it is not reflected in the registry.

:huh2: When I read the value with RegRead, it reports the changed value, although it is not the real value in the registry.

:lmao: If I delete the key in the registry with the editor, RegRead keeps reporting the previous value.

So it seems that the actual registry and the manipulation by AutoIt are totally disconnected.

Did anyone experience this problem? Any solution?

Please test in the same environment, as this problem obviously does not happen under Windows XP (I just tested it).

Share this post


Link to post
Share on other sites



I posted this in the bug tracking system, but got no answer whatsoever. I will post here, in case some one else has the same issue or can help me solve the problem.

My environment is Windows 2000 Professionnal SP4. (5.00.2195), using AutoIt v3.3.0.0

:) When I create a new entry in the registry with a registry editor (not AutoIt), then autoit returns the right value with RegRead.

:) When I modify the value in the registry with a registry editor (not Autoit), then autoit returns the right value with RegRead.

^_^ When I change the value with RegWrite, it is not reflected in the registry.

:huh2: When I read the value with RegRead, it reports the changed value, although it is not the real value in the registry.

:lmao: If I delete the key in the registry with the editor, RegRead keeps reporting the previous value.

So it seems that the actual registry and the manipulation by AutoIt are totally disconnected.

Did anyone experience this problem? Any solution?

Please test in the same environment, as this problem obviously does not happen under Windows XP (I just tested it).

Are you restarting regedit after you make the change with AutoIt?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

1/ In a registry editor, add a string entry "Dummy" with the value "Initial_Value" in "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

AutoIt Script returns "Initial_Value" (as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

2/ In a registry editor, change the value of "Dummy" to "Modified_by_editor"

AutoIt Script returns "Modified_by_editor" (as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

3/ Modify the value with Autoit

AutoIt Script :

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
RegWrite($key,"Dummy", "REG_SZ", "Value_modified_by_Autoit")

Now check with the editor, unfortunately the value is not changed in the editor.

4/ In a registry editor, change again the value of "Dummy" to "Modified_by_editor_2"

AutoIt Script keeps returning "Value_modified_by_Autoit" (NOT as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

5/ In a registry editor, delete "Dummy"

AutoIt Script keeps returning "Value_modified_by_Autoit" (NOT as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

Conclusion: Once RegWrite is used, AutoIt and the actual registry are totally disconnected (at least in Windows 2000 Pro SP4)

Share this post


Link to post
Share on other sites

Are you restarting regedit after you make the change with AutoIt?

Yes, I am doing a refresh, even restarting the registry editor program (regedit or other).

Share this post


Link to post
Share on other sites

Could someone help me? This is a very serious bug, RegRead and RegWrite do not work in Windows 2000 Pro SP4. I posted this in the bugs section but I got this answer:

The odds of the registry functions being so fundamentally broken as the poster claims seems incredibly unlikely.

How "incredibly unlikely" that may sound, it is the truth. This is a serious enough bug for developpers to tackle. Could someone at least try to reproduce this?

Is there another way to edit the registry keys with Autoit that function in Windows 2000 Pro SP4 (without using regread regwrite)?

Share this post


Link to post
Share on other sites

Why does nobody answer when such a key feature as registry editing in AutoIt is broken in this environment?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

1/ In a registry editor, add a string entry "Dummy" with the value "Initial_Value" in "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

AutoIt Script returns "Initial_Value" (as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

2/ In a registry editor, change the value of "Dummy" to "Modified_by_editor"

AutoIt Script returns "Modified_by_editor" (as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

3/ Modify the value with Autoit

AutoIt Script :

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
RegWrite($key,"Dummy", "REG_SZ", "Value_modified_by_Autoit")

Now check with the editor, unfortunately the value is not changed in the editor.

4/ In a registry editor, change again the value of "Dummy" to "Modified_by_editor_2"

AutoIt Script keeps returning "Value_modified_by_Autoit" (NOT as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

5/ In a registry editor, delete "Dummy"

AutoIt Script keeps returning "Value_modified_by_Autoit" (NOT as expected!)

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
msgbox(0,"Value", regread($key,"Dummy")

Conclusion: Once RegWrite is used, AutoIt and the actual registry are totally disconnected (at least in Windows 2000 Pro SP4)

Have just carried this out in the same environment you have: a Windows 2000 workstation w/SP4 5.00.2195 running AutoIt production version 3.3.0.0.

Behaves correctly (other than that you're missing a closing bracket on your MsgBox() call in Step 1), no disconnect found.

All reads and writes by either AutoIt or external registry editor reflected by the other immediately.

Must be some other issue.

Have you tested with the exact steps you outlined?

Edited by ResNullius

Share this post


Link to post
Share on other sites

This issue is driving me crazy. Seems to be more of a Windows thing, but still I am looking for the way to fix this. I performed more tests with results:

* Test 1 * * * * * * * * * * * * * *

Make a myfolder\proxy.reg file with this content:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] 
"ProxyServer"="myproxy.com:8080"
"ProxyEnable"=dword:00000001

Double clicking on the .reg files prompts "Do you really want to add ... .reg to the registry?". YES -> "The information of ... .reg have been successfully added to the registry". But checking the registry shows no change.

* Test 2 * * * * * * * * * * * * * *

Using strun (www.nirsoft.net), I add a new startup item with this command line:

regedit.exe /s "myfolder\proxy.reg" Executing the command works (changes the value in the registry).

Note: it also works with the command "C:\WINNT\regedit.exe" /s "myfolder\proxy.reg"

* Test 3 * * * * * * * * * * * * * *

In AutoIt, try different scripts

Run('"C:\WINNT\regedit.exe" /s "myfolder\proxy.reg"')

or

ShellExecuteWait( 'C:\WINNT\regedit.exe', '"myfolder\proxy.reg"' , "myfolder", "", @SW_HIDE )

Both of these scripts are executed without error, but nothing changes in the registry. Same result as when using RegWrite.

What could be the reason for the registry not to change despite seeing the message "The information of ... .reg have been successfully added to the registry"?

Share this post


Link to post
Share on other sites

I imagine you have correct permissions... Not sure if it makes a difference though...

Is any Anti-virus stopping it?

Make sure you use full paths in the run/shellexecture commands.

should be C:\myFolder\proxy.reg over what you have.

Cheers,

Brett

Share this post


Link to post
Share on other sites

I am logged in as Administrator and have all permissions. I can manually edit the registry without problem with an editor.

No antivirus running.

I do use full paths, and the command is executed: if I do not use the /s to silent regedit, I do get the usual messages.

I still do not get what is happening...

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Check that Anti-Virus-Program's registry monitor activity.

ex:

Kaspersky's Registry Protection.

try use to 'NirCmd.exe sysrefresh'

Edited by DllParse

Share this post


Link to post
Share on other sites

I do not have any antivirus running, but your remark gave me a hint. There was a service running called "ThinkVantage Registry Monitor Service". I have an IBM X32 laptop. I am not sure what this service does, but I turned it off, rebooted, and it still did not solve anything. However, I suspect other IBM related services to prevent the registry from being edited via command lines. I am in particular suspicious of "TVT backup service" and "TVT backup protection service". However, I cannot turn these services off or stop those services, so I am not sure if their are the source of the problem.

I tried 2 autoit instructions:

Run('"C:\myfolder\NirCmd\nircmd.exe" sysrefresh')
and

Run('"C:\myfolder\NirCmd\nircmd.exe" regsetval sz "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyServer" "myproxy:8080"')

but registry won't change... This is weird. The only action that changed the registry besides manually changing the values in an editor is a command line executed with strun.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I'm having something similar in Windows XP.

$autoadminlogon = regread("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon")

    if ($autoadminlogon == "0") Then
        msgbox(0,"step1","step1")
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultUserName","REG_SZ","installerdeploy")
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultPassword","REG_SZ","password")
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon","REG_SZ","1")
        $result = FileCopy(@ScriptFullPath,@StartupCommonDir & "\",1)
        sleep(10000)
        Exit
;Shutdown(2)
;EndIf
;testing purpose
    Else
        msgbox(0,"step2","step2")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","DefaultUserName","REG_SZ","")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","DefaultPassword","REG_SZ","")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","AutoAdminLogon","REG_SZ","0")
        FileDelete(@startupcommondir & "\" & @ScriptName)
        sleep(10000)
;Shutdown(2)
        Exit
    EndIf
;end testing ---

Executing this will work the first time, as it will replace the correct value.

Running the script afterward will not write to the registry to empty DefaultUsername, DefaultPassword and put back 0 in AutoAdminLogon.

I've check with Regmon to see if something was blocking or putting back the values, but there is no sign of this.

No antivirus on machine, it's just a clean machine, fresh installed. I'm testing the script within a VM. I am logged with a users that has admin rights.

I can change the values manually with Regedit without problem.

Anyone got an idea? is this a bug with AutoIT?

Edited by jeangaud

Share this post


Link to post
Share on other sites

I'm having something similar in Windows XP.

$autoadminlogon = regread("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon")

    if ($autoadminlogon == "0") Then
        msgbox(0,"step1","step1")
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultUserName","REG_SZ","installerdeploy")
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultPassword","REG_SZ","password")
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon","REG_SZ","1")
        $result = FileCopy(@ScriptFullPath,@StartupCommonDir & "\",1)
        sleep(10000)
        Exit
;Shutdown(2)
;EndIf
;testing purpose
    Else
        msgbox(0,"step2","step2")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","DefaultUserName","REG_SZ","")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","DefaultPassword","REG_SZ","")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","AutoAdminLogon","REG_SZ","0")
        FileDelete(@startupcommondir & "\" & @ScriptName)
        sleep(10000)
;Shutdown(2)
        Exit
    EndIf
;end testing ---

Executing this will work the first time, as it will replace the correct value.

Running the script afterward will not write to the registry to empty DefaultUsername, DefaultPassword and put back 0 in AutoAdminLogon.

I've check with Regmon to see if something was blocking or putting back the values, but there is no sign of this.

No antivirus on machine, it's just a clean machine, fresh installed. I'm testing the script within a VM. I am logged with a users that has admin rights.

I can change the values manually with Regedit without problem.

Anyone got an idea? is this a bug with AutoIT?

recheck the registry paths in your code, you'll find they are different.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

recheck the registry paths in your code, you'll find they are different.

It works. Thanks!! I'll pay more attention next time! :)

Share this post


Link to post
Share on other sites

All right, my problem is sorted out now. Now I can edit registry settings both through AutoIt (RegWrite) or running a .reg file. The problem came from a firewall.msc file that I had built. As far as I understand, Windows 2000 Pro does not come with a firewall. This file has a set of rules for IP security, and obviously it prevented registry to be written to, for some reason.

Now I simply do not use this file anymore, and I can write to the registry without problem (but have no firewall protection...). Finally, problem solved!

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  
Followers 0