G
gaxjyxq
Guest
I want to get the visited folder info from Registry, the location is "HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU". I need to decode the binary values in Registry, I can decode most binary values in Registry use the function below.
Dim rk As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU\0")
Dim b() As Byte = rk.GetValue("0")
Dim ptr As IntPtr = Marshal.AllocHGlobal(b.Length)
Dim dataLenth As Int32 = b.Length
Marshal.Copy(b, 0, ptr, dataLenth)
Dim path As New StringBuilder(512)
SHGetPathFromIDList(ptr, path)
Marshal.Release(ptr)
MessageBox.Show(path.ToString)
but some binary values cannot be decoded, for example the value below
The return value should be "F:\", but I cannot use the function above to get the value.
Continue reading...
Dim rk As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU\0")
Dim b() As Byte = rk.GetValue("0")
Dim ptr As IntPtr = Marshal.AllocHGlobal(b.Length)
Dim dataLenth As Int32 = b.Length
Marshal.Copy(b, 0, ptr, dataLenth)
Dim path As New StringBuilder(512)
SHGetPathFromIDList(ptr, path)
Marshal.Release(ptr)
MessageBox.Show(path.ToString)
but some binary values cannot be decoded, for example the value below
The return value should be "F:\", but I cannot use the function above to get the value.
Continue reading...