Archive: Problem with SetShellVarContext (1.98)


Problem with SetShellVarContext (1.98)
Hello,

SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Der Clou! Win32"
creates for me C:\Windows\Temp\Der Clou! Win32 on Windows 98 (it works fine on XP), isn't SetShellVarContext supposed to fall back to the local directory if the global one doesn't exist?

Thanks!
Lactobacillus

I've just had a look at the latest 2.0a7 code (I'll check 1.98 in a minute and post back here) and if SetShellVarContext is set to current it will ignore the first seven characters of the folder name it is looking for when matching in the registry. This has the effect of taking a name like "Common Start Menu" and matching instead "Start Menu" (I say this so that you can check if this mechanism wouldn't work based on your registry content, it looks under HKEY_LOCAL_MACHINE at Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders).

If SetShellVarContext is set to all it and it cannot find the desired folder under that key in the registry it will try current mode. If that also fails it will fall back to your $TEMP directory.

[edit]In 1.98 the intent of the code seems to be the same, there is a slight optimisation in 2.0a7 over 1.98 but the logic is identical.

Therefore I have to conclude that either your registry strings under that key in the registry are not what the developers expected, or else the code is working perfectly and is falling back to the last option, the $TEMP dir (or there is a bug in the code relating to the value of $SMPROGRAMS.. I don't have time to investigate that far but I'm sure KiCHiK will amaze us when he answers :D - no pressure KiCHiK :P)[/edit]


This a bug with 1.98. It has been fixed in one of the 2.0aX version. Download the latest 2.0a7 and it should work.

Or, if you wish to still use 1.98 you can change Source\exehead\util.c. Function queryShellFolders, where it says myRegGetStr(f?HKEY_LOCAL_MACH... just change g_all_user_var_flag to f and recompile. I don't know the exact line number because I don't have the source code of 1.98 infront of me, but if this is an option for you (you have a compiler), I can look it up for you.


Doh! That wasn't an amazing reply KiCHiK :)


Thank you, thank you. I am here all night :D I really am... :)


Ahha I see KiCHiK - I missed that blasted first ?: test against g_all_user_var_flag. I'll build a new 1.98 for Lactobacillus and post the url to it here.


Yes, those g_all_user_var_flag are slippery aren't they? :D
I am sure he will find your compiled version very useful :up:


Download a 1.98 build of makensis.exe that contains the fix mentioned by KiCHiK - this is built by me, it is *not* official in anyway.
http://www.clantpa.co.uk/nsis/hosted...ithssvcfix.exe

or a zipped version (of just the exe) is here


You guys are posing so fast, when I finished compiling NSIS I saw that Sunjammer provided a download of the fixed version ;)

However: Thanks a lot! I am looking forward to switch to the latest 2.0x code once it's out of alpha/beta state.

Lactobacillus