1

I am making an app in visualstudios's VB to autoinstall the printer in windows. Problem is, that the printer needs a login and pass. I found registry entry, where this is stored, but the password is stored in REG_BINARY format.

Here is how it looks after manually writing the password into printer settings - see UserPass: enter image description here

Please could you tell me how to convert password (in string) into the reg_binary (see attachement - red square)?

The password in this case was 09882 and it has been stored as 98 09 e9 4c c3 24 26 35 14 6f 83 67 8c ec c4 90. Is there any function in VB to convert 09882 into this REG_BINARY format please?

3

1 Answer 1

2

REG_BINARY means that it is binary data and binary data in .NET is represent by a Byte array. The values you see in RegEdit are the hexadecimal values of the individual bytes, which is a common representation because every byte can be represented by two digits. You need to convert your String to a Byte array and then save it to the Registry like any other data.

How you do that depends on what the application expects. Maybe it is simply converting the text to Bytes based on a specific encoding, e.g. Encoding.ASCII.GetBytes. Maybe it's a hash. You might need to research and/or experiment to find out exactly what's expected.

Sign up to request clarification or add additional context in comments.

3 Comments

Oh thank you very much, this helps me at least where to start. Thank you!
For the record, I tested and determined that that sequence of bytes does not represent the ASCII, UTF8 or Unicode encoding of that password or the SHA1 or MD5 hash of any of those.
That's what I was affraid of. Thank you for your investigation! Really helped me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.