Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2008

Tip: Looking for answers? Try searching our database.

Registry reading problem vb.net 2005

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sid Price - 27 Mar 2008 16:03 GMT
I am having an issue reading a string value from the registry, with the
following code I get a pair of double quotes ("") at the start and end of
the string, this causes the method that processes the string to fail. Can
anyone advise what I am doing wrong please? Note that when I use regedit to
look at the value of the entry I do see it delimited by double quotes
("C:\Data Root\Projects\Pacific\Code\VistaMax\Tools 500 Series\VistaMax
Network Manager\VistaMaxRDS\bin\Release\VistaMaxRDS.exe"). The value
returned by GetValue is displayed like this in a watch window ""C:\Data
Root\Projects\Pacific\Code\VistaMax\Tools 500 Series\VistaMax Network
Manager\VistaMaxRDS\bin\Release\VistaMaxRDS.exe"".
Dim strRegKey As String = Registry.LocalMachine.ToString &
"\System\CurrentControlSet\Services\" _

& mService.ServiceName

Dim strImagePath As String = Registry.GetValue(strRegKey, "ImagePath", "")

Dim strPathOnly As String = System.IO.Path.GetFullPath(strImagePath)    <-
this fails

Thanks,

Sid.
Phil Wilson - 27 Mar 2008 20:29 GMT
You may not be doing anything wrong. Some service paths in the registry are
indeed quoted in the registry, so your code will need to deal with that.
There's a security issue with unquoted paths that can be used to run the
wrong  program, and quotes correct it.
Signature

Phil Wilson
[MVP Windows Installer]

>I am having an issue reading a string value from the registry, with the
>following code I get a pair of double quotes ("") at the start and end of
[quoted text clipped - 19 lines]
>
> Sid.
Sid Price - 27 Mar 2008 20:34 GMT
> You may not be doing anything wrong. Some service paths in the registry
> are indeed quoted in the registry, so your code will need to deal with
> that. There's a security issue with unquoted paths that can be used to run
> the wrong  program, and quotes correct it.
That is what I figured too, I have added code to detect and remove the extra
quotation marks and my application now operates as expected.
Thanks,
Sid.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.