@@ -117,6 +117,9 @@ FIXME: GFPZR: Function stat() may be undeclared.
117
117
#include <Userenv.h>
118
118
#include <shlobj.h>
119
119
120
+ #ifdef WIN32_PRAGMA_REMCON
121
+ #include <shlwapi.h>
122
+ #endif
120
123
extern char HomeDirLsaW [MAX_PATH ];
121
124
122
125
#endif
@@ -599,9 +602,17 @@ do_exec_no_pty(Session *s, const char *command)
599
602
#ifndef WIN32_PRAGMA_REMCON
600
603
exec_command = s -> pw -> pw_shell ;
601
604
#else
602
- snprintf (exec_command_str , sizeof (exec_command_str ),
603
- "\\program files\\pragma\\shared files\\cmdserver.exe SSHD %d %d" ,
604
- s -> row , s -> col );
605
+ if ( PathFileExists ("\\program files\\pragma\\shared files\\cmdserver.exe" ) )
606
+ snprintf (exec_command_str , sizeof (exec_command_str ),
607
+ "\\program files\\pragma\\shared files\\cmdserver.exe SSHD %d %d" , s -> row , s -> col );
608
+ else {
609
+ // find base path of our executable
610
+ char basepath [MAX_PATH ];
611
+ strcpy_s (basepath , MAX_PATH , __progname );
612
+ PathRemoveFileSpec (basepath ); // get the full dir part of the name
613
+ snprintf (exec_command_str , sizeof (exec_command_str ),
614
+ "%s\\cmdserver.exe SSHD %d %d" , basepath ,s -> row , s -> col );
615
+ }
605
616
exec_command = exec_command_str ;
606
617
#endif
607
618
}
0 commit comments