Originally Posted by
ssharish2005
I quite dont understand. So you dont know the part of the register, but you partially know it.
Well cant you just construct the path at the run time, once you get to know the registry? Its would rather be pretty easy to construct a string. And then type cast it to LPCTSTR?
ssharish
I already try that typecasting, but it doesn't work.
because while in the actual scenario, calling of this the function could seems like,
Code:
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
TEXT("SYSTEM\\CurrentControlSet\\Enum\\USB\\Vid_0458&Pid_9856\\7654321"),
0,
KEY_READ,
&hKey);
The above function calls executes fine and returns 0.
In my actual scenario, We have to do the type casting on the second parameter TEXT("....").
so what i did,
get the path into "ptr" pointer in the run time, and did the typecasting as
Code:
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
(LPCWSTR)ptr,
0,
KEY_READ,
&hKey);
but this function gets failed and returns 2.
Any suggestions are welcome!!