... or so I'd consider it!
However AutoHotkey retrieves the Windows directory path to set A_WinDir (based on the result, I'm guessing it's via the GetWindowsDirectory API function) gives what is probably not the intended answer in Terminal Services (aka Remote Desktop Services) sessions running in the normal "Execute Mode", as opposed to the administrative "Install Mode": it returns the so-called "private" Windows directory path, which generally corresponds to %HomeDrive%%HomePath%\Windows (or to %HomeDrive%\Windows when the home directory is mapped to a drive letter). This private Windows directory is a legacy concept designed to capture INI files written/read via the WritePrivateProfileString/GetPrivateProfileString functions without a fully-qualified INI path. It contains no Windows executables, so any references to EXEs, DLLs, etc. using A_WinDir would fail in remote sessions.
The correct (in my view) function to retrieve the true Windows directory under all circumstances is GetSystemWindowsDirectory, as described in its documentation.
The current workarounds to this issue are, without #NoEnv, to use %WinDir% or %SystemRoot%, and with #NoEnv, to read the PathName entry at "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" or to explictly use the above-mentioned GetSystemWindowsDirectory.
See my long post in the old forums for more details about Terminal Services' Install vs. Execute modes and how they affect system behavior, including that of API functions like GetWindowsDirectory: https://autohotkey.com/board/topic/14700-terminal-server-awareness-flag-bad-idea/
JB
A_WinDir bug ... Topic is solved
Re: A_WinDir bug ...
I think it qualifies as a bug, and will be changing it.
If %WinDir% works without #NoEnv, wouldn't EnvGet be a much simpler workaround than reading from the registry?
If %WinDir% works without #NoEnv, wouldn't EnvGet be a much simpler workaround than reading from the registry?
Re: A_WinDir bug ... Topic is solved
Yes, much simpler. I'm not yet fully converted to #NoEnv (lots of old code to worry about), so I sometimes forget about EnvGet.
I see this issue is fixed in v1.1.33.x, as is the FileGetShortcut/FileCreateShortcut icon resource ID issue. Thanks.
JB
I see this issue is fixed in v1.1.33.x, as is the FileGetShortcut/FileCreateShortcut icon resource ID issue. Thanks.
JB
Who is online
Users browsing this forum: Descolada and 25 guests