bnasmmbaker
12-05-2005, 11:35 AM
Hello,
I came across an odd bug in use of SessionVar.Expand. The expansion takes place, and I get what looks like a valid string using Debug.Print. However, passing this value to Registry.GetValue results in a no key found error. If I replace SessionVar.Expand with SessionVar.Get and just use string concatenation, it works just fine.
Buggy code:
g_RegRoot = SessionVar.Expand("Software\\BNA Software\\%ProductName%\\Application State";
Debug.Print( g_RegRoot );
local v = Registry.GetValue(HKEY_CURRENT_USER,g_RegRoot,"Setting",false);
Good code:
Buggy code:
g_RegRoot = "Software\\BNA Software\\"..SessionVar.Get("%ProductName%").."\\Application State";
Debug.Print( g_RegRoot );
local v = Registry.GetValue(HKEY_CURRENT_USER,g_RegRoot,"Setting",false);
Thanks
Mark
I came across an odd bug in use of SessionVar.Expand. The expansion takes place, and I get what looks like a valid string using Debug.Print. However, passing this value to Registry.GetValue results in a no key found error. If I replace SessionVar.Expand with SessionVar.Get and just use string concatenation, it works just fine.
Buggy code:
g_RegRoot = SessionVar.Expand("Software\\BNA Software\\%ProductName%\\Application State";
Debug.Print( g_RegRoot );
local v = Registry.GetValue(HKEY_CURRENT_USER,g_RegRoot,"Setting",false);
Good code:
Buggy code:
g_RegRoot = "Software\\BNA Software\\"..SessionVar.Get("%ProductName%").."\\Application State";
Debug.Print( g_RegRoot );
local v = Registry.GetValue(HKEY_CURRENT_USER,g_RegRoot,"Setting",false);
Thanks
Mark