The odd thing is that if I change HKLM to HKCU, the code works perfectly, the registry entry appears correctly (in CU), and the program works (for that one user). Perhaps I am missing something obvious, but what is wrong here?
!define APPCOMPATMODE "WIN98"
# Registry entry in order to enable compatibility mode settings for the application.
# Put a space between each mode selected.
# The following modes are available:
# {WIN95 WIN98 NT4SP5 WIN2000 WINXPSP2}
# 256COLOR
# 640X480
# DISABLETHEMES
# DISABLEDWM
# HIGHDPIAWARE
# RUNASADMIN
#snip loads of code...
Section "Base Components" BASECOMPONENTS
#snip loads of code...
!ifdef APPCOMPATMODE
WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PROGEXE}" "${APPCOMPATMODE}"
!endif
#snip loads of code...
SectionEnd
Problem with WriteRegStr and AppCompatFlags
Program requires compatibility mode (Win98/ME) to run properly in Vista. To streamline this, I have added some generic code to a series of installer scripts in order to "Plug and Run". Unfortunately, the script is not writing the required registry entry. I am likely missing something quite obvious, but was wondering if anyone else has an idea. Here is the important code: