A
auldh
i'm trying to read a registry key in both local and remote machines. for
example the HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES\LANMANWORKSTATION there is
a key called "imagepath" this is a "reg_expand_sz" and it will look like:
"%systemroot%\system32\svchost.exe -k netsvcs".
when i run my code on either local or remote machine it will convert
"%systemroot%" to the local machine system drive, in my cast
"e:\system32\svchost.exe -k netsvcs". so now my output is incorrect.
here is a sample of my code: if (t ==
System.Type.GetType("System.String"))
{
string sval = (string)regvalue;
//Trace.WriteLine(String.Format("Value Name: {0}; Type:
{1}", valueName, t));
//Trace.WriteLine(String.Format("Value Data: {0}", sval));
sw.WriteLine(String.Format("\t\t{0} = (REG_SZ) {1}",
valueName, sval));
regexportreg_sz(sval, valueName, sw2);
}
when "string sval = (string)regvalue" reads that key it converts it. however
if you run the regedit export to text file it does not.
is there away to read the data to maintain its appearance?
example the HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES\LANMANWORKSTATION there is
a key called "imagepath" this is a "reg_expand_sz" and it will look like:
"%systemroot%\system32\svchost.exe -k netsvcs".
when i run my code on either local or remote machine it will convert
"%systemroot%" to the local machine system drive, in my cast
"e:\system32\svchost.exe -k netsvcs". so now my output is incorrect.
here is a sample of my code: if (t ==
System.Type.GetType("System.String"))
{
string sval = (string)regvalue;
//Trace.WriteLine(String.Format("Value Name: {0}; Type:
{1}", valueName, t));
//Trace.WriteLine(String.Format("Value Data: {0}", sval));
sw.WriteLine(String.Format("\t\t{0} = (REG_SZ) {1}",
valueName, sval));
regexportreg_sz(sval, valueName, sw2);
}
when "string sval = (string)regvalue" reads that key it converts it. however
if you run the regedit export to text file it does not.
is there away to read the data to maintain its appearance?