Page 1 of 1

setRegistry and queryRegistry not working with "\"

Posted: Sat Feb 23, 2008 8:47 am
by Ocean
It appears that setRegistry and getRegistry do not work at all if the character "\" is present in the name of the value.

For instance, I am trying to set the following registry key, but am unable to do so via Revolution:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Name: C:\Path\To\My\App.exe
Type: REG_SZ
Data: WIN98

1. What is the correct setRegistry command to do this?

The following command does not work (Revolution thinks the "\" in the application path belongs to the registry path rather than to the value name):

Code: Select all

setRegistry("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Path\To\My\App.exe","WIN98")
This doesn't work either (attempting to use an additional "\" to "escape" the original "\"):

Code: Select all

setRegistry("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\\Path\\To\\My\\App.exe","WIN98")
2. What is the correct getRegistry command to verify the current setting of the above data?

The following command does not work:

Code: Select all

getRegistry("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Path\To\My\App.exe")
Thanks in advance.

Posted: Sat Feb 23, 2008 10:19 am
by Mark
Hi Ocean,

This might help (I know it works):

http://article.gmane.org/gmane.comp.ide ... +name+path

Best,

Mark

Posted: Sat Feb 23, 2008 10:41 am
by Ocean
Thanks for the link. Unfortunately, in that article the "\" is in the data of the value rather than in the name of the value (which is what we need). :?

Posted: Sat Feb 23, 2008 11:52 am
by Mark
Hi Ocean,

If you read the post I linked to, you'll see that

1) you need to define a name
2) an application path to that name
and now you also want to
3) define a compatibility flag for that name

Best,

Mark

Posted: Sat Feb 23, 2008 9:23 pm
by Ocean
Hey Mark, :)

I've taken a look at the article again and can confirm that it does not contain the solution (the path to the app is definitely in the data of the value rather than in the name of the value).

It appears no one has actually needed to put the path of an app in the name of a value using Revolution prior to this, and so this is the first time this error (possibly a Revolution bug) is being encountered.

In the meantime, we've implemented a workaround (using reg.exe to manipulate the registry via the command line instead).

Thanks anyway! :)

Posted: Sat Feb 23, 2008 10:06 pm
by Mark
Ocean,

There is a reason why nobody ever need to enter a path! As I wrote, you must define compatibility flags for the NAME and not for the PATH.

Best,

Mark

Posted: Sat Feb 23, 2008 10:48 pm
by Ocean
Could you provide some examples of what you mean by "compatibility flags for the NAME and not for the PATH"? Thanks! :)

Posted: Sun Feb 24, 2008 12:36 am
by Mark
Ocean,

After following all instructions given under aforementioned link, you should be able to execute code similar to

Code: Select all

setRegistry("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\TestApp","WIN98")
Looking in the registry on my PC, I don't see this path (I mean the path to the registry key, not the path to the application). Are you sure the path is correct?

Best,

Mark

Posted: Sun Feb 24, 2008 4:26 am
by Ocean
Mark wrote:Ocean,

After following all instructions given under aforementioned link, you should be able to execute code similar to

Code: Select all

setRegistry("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\TestApp","WIN98")
Looking in the registry on my PC, I don't see this path (I mean the path to the registry key, not the path to the application). Are you sure the path is correct?

Best,

Mark
Aye. Normally that registry path only shows up if you have at least one program to which you have set special compatibility settings (at the Properties window).

Just right-click any exe on your drive, click Properties, then Compatibility, then select "Windows 98" or any other option from the menu, and save. Close and re-open RegEdit and you'll see the registry path show up. :)

You'll then also see what I mean by the program path being in the name of the value, rather than in the data of the value (which is "WIN98").