Jump to content
Sign in to follow this  

-1 error with _HexToString

Recommended Posts


Merry Christmas everyone.

I have a small script I am working with to search the registry and find the location of the PST files in Outlook.

Here is the Script :-

#include <string.au3>

For $i= 1 to 1000
    $var = RegEnumKey("HKCU\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles", $i)
        If @error <> 0 then ExitLoop
    $sKeyPath = ("HKCU\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & $var)
    For $ii= 1 to 1000
    $sKey = RegEnumKey($sKeyPath, $ii)
        If @error <> 0 then ExitLoop
    For $iii = 1 to 1000
        $sEnumPath = $sKeyPath & "\" & $sKey
            $sKeyVal = RegEnumVal($sEnumPath, $iii)
        If @error <> 0 Then ExitLoop
        If $sKeyVal = "001f6700" Then
        $sRegVal = RegRead ($sEnumPath, $sKeyVal)
        $PST = _HexToString($sRegVal)

The problem is the HEX string retrieved looks fine and is correct, but when I use _HexToString it gives me a -1 value instead of

the location of the PST file.

Can anyone advise where this is going wrong?


Share this post

Link to post
Share on other sites

The above script is now working better since I installed Autoit v3.3.2.0, previously I was using v3.3.0.0

was this a bug in v3.3.0.0?

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.