views:

492

answers:

2

Hi, does anybody have idea why some windows XP installation would not evaluate path with double backslash in them?

Error is found on some XP (same build, patches, unknown more details). In most everything works, on some PCs following doesn't work:

Querying path (registry or folder) with functions like RegEnumKeyEx, fopen fails if path contains two backslashes, for example "C:\\test\hello.txt".

strPath = "\SOFTWARE\Microsoft\Windows\Currentversion\run" works

strPath = "\SOFTWARE\Microsoft\Windows\Currentversion\\run" doesnt...

Is there some policy option or setting which can affect it?

Any help welcome, RM

A: 

Possibly completely unrelated, but in C/C++ (and other languages too) - "c:\\test\hello.txt" is okay, but "c:\test\hello.txt" is not (because '\t' is parsed as a tab character, so you get a name that doesn't really exist).

Is there a chance the failure happens when the two backslashes don't exist, and things work when they do?

Hexagon
no, the syntax is correct. I mean it doesnt work when in syntax are four backslashes, resulting in two backslashes in actual string. When there are two backslashes (resulting in one backslash in actual string) it does work
A: 

Why don't you simply modify the path to only have a single \ before using it?

Toby Allen
it is not like i cannot do it, but to know why that happens. it makes no sense. i also used it in lot of code in past so it would be good to know