bossmann
bossmann

Reputation: 49

RegOpenKeyEx returns bad path name error (code 161)

I'm using this solution to read 32-bit registry on a 64-bit machine. I'm using it like this:

GetKeyValue("\\software\\company", name);

where name is the name of the retrieved property. But the code returns the 161 code. I also tried appending the backslash at the end of the path, but the result is the same. I can confirm that the key exist there in regedit. What's wrong?

Upvotes: 2

Views: 1840

Answers (1)

Harry Johnston
Harry Johnston

Reputation: 36318

There shouldn't be a backslash at the beginning of the path (or at the end). This should work:

GetKeyValue("SOFTWARE\\company", name);

Upvotes: 1

Related Questions