Jump to content

RegWrite failed when it has an abnormal path


LynnS
 Share

Recommended Posts

When trying to write an entry into the registry (specifically the Windows Run key) on a Windows XP system, it fails:

$test2 = RegWrite('HKLM\Software\Microsoft\Windows\CurrentVersion\Run', 'FHCServicesPortalUpdate', 'REG_SZ', 'C:\FHC_Tools\new.Portal\new.PortalSvc.exe')
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$test2' & @lf & @lf & 'Return:' & @lf & $test2) ;### Debug MSGBOX
; fails to write

I have tried various things with no success. If I just change the data string slightly that gets written the code works just fine. For example, this code works:

$test2 = RegWrite('HKLM\Software\Microsoft\Windows\CurrentVersion\Run', 'FHCServicesPortalUpdate', 'REG_SZ', 'C:\FHC_Tools\new.Portal2\new.Portal2Svc.exe')
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$test2' & @lf & @lf & 'Return:' & @lf & $test2) ;### Debug MSGBOX
; works just fine

Windows 7 (with the #RequireAdmin) has no problems.

I have already checked the Registry permissions and my "administrator" user has Full access.

Any Ideas why it won't work?

Link to comment
Share on other sites

When trying to write an entry into the registry (specifically the Windows Run key) on a Windows XP system, it fails

Hi,

Can you provide the debug? (error code & return value)

I have tested it on XP and it works fine.

Br, FireFox.

Link to comment
Share on other sites

$return = RegWrite('HKLMSoftwareMicrosoftWindowsCurrentVersionRun', 'FHCServicesPortalUpdate', 'REG_SZ', 'C:FHC_Toolsnew.Portalnew.PortalSvc.exe')
$error = @error

MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$return' & @lf & @lf & 'Return:' & @lf & $return) ;### Debug MSGBOX
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$error' & @lf & @lf & 'Return:' & @lf & $error) ;### Debug MSGBOX

; $return = 0

; $error = 0

It has to be something with that specific test system. Even when I try to import a reg file manually it fails. I also tried stopping the antivirus and manually importing the reg file... Still the same error:

Registry Editor

Cannot import C:Documents and SettingsAdministratorDesktoprunkey.reg: Not all data was successfully written to the registry. Some keys are open by the system or other processes.

Of course, modifying the registry using regedit works fine. Strange behavior, but not an AutoIt thing.

I appreciate that you ran it on a different system, and helped me narrow it further.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...