@@ -182,6 +182,17 @@ static int find_clink_entry(const char* value, int* left, int* right)
182182 return 1 ;
183183}
184184
185+ //------------------------------------------------------------------------------
186+ static const char * get_cmd_start (const char * cmd )
187+ {
188+ while (isspace (* cmd ) || * cmd == '&' )
189+ {
190+ ++ cmd ;
191+ }
192+
193+ return cmd ;
194+ }
195+
185196//------------------------------------------------------------------------------
186197static int uninstall_autorun (const char * clink_path , int wow64 )
187198{
@@ -202,7 +213,7 @@ static int uninstall_autorun(const char* clink_path, int wow64)
202213 ret = 1 ;
203214 if (key_value && find_clink_entry (key_value , & left , & right ))
204215 {
205- char * read ;
216+ const char * read ;
206217 char * write ;
207218 int i , n ;
208219
@@ -218,15 +229,16 @@ static int uninstall_autorun(const char* clink_path, int wow64)
218229 ++ read ;
219230 }
220231
221- if (* key_value == '\0' )
232+ read = get_cmd_start (key_value );
233+ if (* read == '\0' )
222234 {
223235 // Empty key. We might as well delete it.
224236 if (!delete_value (cmd_proc_key , "AutoRun" ))
225237 {
226238 ret = 0 ;
227239 }
228240 }
229- else if (!set_value (cmd_proc_key , "AutoRun" , key_value ))
241+ else if (!set_value (cmd_proc_key , "AutoRun" , read ))
230242 {
231243 ret = 0 ;
232244 }
@@ -245,6 +257,7 @@ static int uninstall_autorun(const char* clink_path, int wow64)
245257static int install_autorun (const char * clink_path , int wow64 )
246258{
247259 HKEY cmd_proc_key ;
260+ const char * value ;
248261 char * new_value ;
249262 char * key_value ;
250263 int i ;
@@ -286,8 +299,9 @@ static int install_autorun(const char* clink_path, int wow64)
286299 }
287300
288301 // Set it
302+ value = get_cmd_start (new_value );
289303 i = 1 ;
290- if (!set_value (cmd_proc_key , "AutoRun" , new_value ))
304+ if (!set_value (cmd_proc_key , "AutoRun" , value ))
291305 {
292306 i = 0 ;
293307 }
0 commit comments