diff --git a/programs/system/open/open.asm b/programs/system/open/open.asm index 0d5f5b813..ecf5e2cfd 100644 --- a/programs/system/open/open.asm +++ b/programs/system/open/open.asm @@ -204,13 +204,14 @@ end if ;; if dialog mov eax, [param_s] - mov [is_openas + 8], eax cmpne [eax], byte '~', @f inc [param_s] - mov eax, [param_s] + stdcall quote_param, [param_s], param_quoted mov [is_openas + 8], eax jmp start_dialog @@: + stdcall quote_param, [param_s], param_quoted + mov [is_openas + 8], eax ;; if without '.' - execute stdcall string.last_index_of, [param_s], '.', 1 @@ -257,7 +258,7 @@ end if invoke libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined cmpe [buffer], byte 0, ini_error @@: - mov eax, [param_s] + stdcall quote_param, [param_s], param_quoted mov [is_open + 8], eax mcall 70, is_open jmp exit @@ -886,6 +887,33 @@ end if ;---------------------- + proc quote_param uses esi edi, _src, _dst + mov esi, [_src] + mov edi, [_dst] + cmp byte [esi], '"' + je .already_quoted + mov byte [edi], '"' + inc edi + .q_loop: + mov al, [esi] + test al, al + jz .q_end + mov [edi], al + inc esi + inc edi + jmp .q_loop + .q_end: + mov word [edi], '"' + mov eax, [_dst] + jmp .ret + .already_quoted: + mov eax, [_src] + .ret: + ret + endp + + ;---------------------- + proc get_index stdcall get_index_cur, [last_x], [last_y] ret @@ -1061,6 +1089,7 @@ end if buffer7 rb 32 ;for sorting buffer8 rd 2048 paramorig rb 2048 + param_quoted rb 2048 _stack rb 2048 params rb 256 memory: