Jump to content

BinaryToString


Recommended Posts

Hi,

I am trying to get a list of all websites in a users compatibility view list but they are all in binary and I'm trying to convert them into strings.

It will show me the binary but not the string.

This is what I have so far.

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
Local $Binary = RegRead("HKCU\SOFTWARE\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData", "UserFilter")
MsgBox(0, "Binary Data", $Binary)
For $i = 0 To UBound($Binary) -1
    Local $String = BinaryToString($Binary, "")
Next
MsgBox(0, "String", $String)

 

Link to comment
Share on other sites

This might work for you, at least it converts it to a semi-usable string.

#include <MsgBoxConstants.au3>
Local $Binary = RegRead("HKCU\SOFTWARE\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData", "UserFilter")
$Binary = StringReplace(String($Binary), "00", ASC("."))
MsgBox(0, "Binary Data", $Binary)
Local $String = BinaryToString($Binary)
MsgBox(0, "String", $String)

The problem with the BinaryToString function is that it stops as soon as it hits a NULL, which is why only part of your string would show in the second msgbox.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Actually that did work, if you look at the end of the string in the MsgBox you will see the msn.com in between all the "F"s in it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You can do this...

 

#include <Array.au3>

Local $aUrls = _GetUsersCompatibilityViewList()

_ArrayDisplay($aUrls)

Func _GetUsersCompatibilityViewList()
    Local Const $sTag_UserFilter = "byte Dummy[8];dword NumberOfEntries;"
    Local Const $sTag_Entry = "byte Dummy[16];word Length;"
    Local $aList[0]
    Local $sBinary = RegRead("HKCU\SOFTWARE\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData", "UserFilter")
    If @error Then Return
    Local $tData = DllStructCreate("byte Data[" & BinaryLen($sBinary) & "]")
    $tData.Data = $sBinary


    Local $tInInfo = DllStructCreate($sTag_UserFilter, DllStructGetPtr($tData))
    Local $nEntries = $tInInfo.NumberOfEntries
    ReDim $aList[$nEntries]



    Local $tEntryInfo = 0
    Local $NextIndex = 24
    Local $iLength = 0
    Local $tUrl = 0

    For $i = 1 To $nEntries
        $tEntryInfo = DllStructCreate($sTag_Entry, DllStructGetPtr($tData) + $NextIndex)
        $iLength = DllStructGetData($tEntryInfo, 2)
        $tUrl = DllStructCreate("wchar String[" & $iLength & "]", DllStructGetPtr($tEntryInfo) + 18)
        $aList[$i - 1] = $tUrl.String
        $NextIndex += ($iLength * 2) + 18
    Next
    Return $aList
EndFunc   ;==>_GetUsersCompatibilityViewList

Saludos

 

Link to comment
Share on other sites

  • 1 year later...

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...