Sign in to follow this  
Followers 0
LOULOU

JPM Following of my question about Regread

3 posts in this topic

#1 ·  Posted (edited)

#include <String.au3>
$usb = DriveGetDrive( "REMOVABLE" )
If NOT @error Then
     For $i = 1 to $usb[0]
        $usbdev = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices", "\DosDevices\" & StringUpper($usb[$i]))
$usbrealdev = _HexToString($usbdev)
If StringInStr ( $usbrealdev, "STORAGE#RemovableMedia#" ) then
     If DriveGetFileSystem ( $usb[$i] ) <> "NTFS" then MsgBox(0,"USB-Drive", $usb[$i])
    Endif
    Next

$usbrealdev must receive the entire key transform in String with _hexString in fact because of what is reading by regread with binary type it return only the first digits of the key because after the first digits there is a 00 value which means end of string

My question in fact was Is Regread functionning well with a reg_binary type because when i want to read the entire var i am obliged to supress each pair of "00"

I dont'know if this is a bug or not . Thanks JPM for your answer

Edited by LOULOU

Share this post


Link to post
Share on other sites



#include <String.au3>
$usb = DriveGetDrive( "REMOVABLE" )
If NOT @error Then
     For $i = 1 to $usb[0]
        $usbdev = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices", "\DosDevices\" & StringUpper($usb[$i]))
$usbrealdev = _HexToString($usbdev)
If StringInStr ( $usbrealdev, "STORAGE#RemovableMedia#" ) then
     If DriveGetFileSystem ( $usb[$i] ) <> "NTFS" then MsgBox(0,"USB-Drive", $usb[$i])
    Endif
    Next

$usbrealdev must receive the entire key transform in String with _hexString in fact because of what is reading by regread with binary type it return only the first digits of the key because after the first digits there is a 00 value which means end of string

My question in fact was Is Regread functionning well with a reg_binary type because when i want to read the entire var i am obliged to supress each pair of "00"

I dont'know if this is a bug or not . Thanks JPM for your answer

What you see is not what you have.

Check if the return string is not a binarystring (isbinaryString())

is so use String() to convert it back to a displayable info.

in your case what you really need in a _ConvUnicodeToAnsi UDF

B)

Share this post


Link to post
Share on other sites

What you see is not what you have.

Check if the return string is not a binarystring (isbinaryString())

is so use String() to convert it back to a displayable info.

in your case what you really need in a _ConvUnicodeToAnsi UDF

B)

Thanks JPM Now i understand your answer

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