News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

CodeEdit, the Christmas Edition

Started by hutch--, December 25, 2022, 09:23:21 AM

Previous topic - Next topic

HSE

Quote from: hutch-- on December 27, 2022, 09:24:25 AM
Seems like its OS difference with older OS versions.

:thumbsup: This OS is 2 years old, but perhaps could be related to OS language.

Later: Explorer have 2 years. Win say OS is from October 18, 2022  :biggrin:
Equations in Assembly: SmplMath

zedd151

Now to test hutch's other 64 bit editors...  :badgrin:
If they used the same command line handling code, it is worth a look. I'll look into it later on sometime.

jj2007

Quote from: hutch-- on December 27, 2022, 09:24:25 AM
Seems like its OS difference with older OS versions.

I couldn't see any differences between XP, 7 and 10, see reply #29. Tomorrow, if I find the time, I will test it on my Win98 machine.

zedd151

Quote from: zedd151 on December 27, 2022, 09:53:01 AM
Now to test hutch's other 64 bit editors...  :badgrin:
If they used the same command line handling code, it is worth a look. I'll look into it later on sometime.

tEditor.exe from Masm64 SDK and tEdit.exe from Masm64/Examples/Advanced/tEdit also cannot be opened via Windows Explorer right click context menu "Open With...". I have not checked any further ... as I am 99% sure that they use the same command line handling.

hutch--

You are probably right Z, they all work perfectly on my US language version of Win10 64 Pro. What Hector has said also makes sense, different language versions of Windows sometimes do things differently and you only find out via experience as things like that are never documented by Microsoft.

hutch--

I thought this one was worth the effort, its an algo that only removes the leading and trailing double quote. You could probably get it a bit faster but I doubt its worth the effort.

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

    include \masm64\include64\masm64rt.inc

    .data
      cln db 34,"  How   D, I  am quoted   text.   ",34,0
      pcl dq cln

    .code

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

entry_point proc

    USING r12

    SaveRegs

    conout pcl,lf           ; before

    rcall unquote,pcl       ; strip the leading and trailing quotes
    rcall szMono,pcl        ; monospace the string

    conout pcl,lf           ; after

    waitkey
    RestoreRegs
    .exit

entry_point endp

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

NOSTACKFRAME

unquote proc
  ; -------------------------------------------------------
  ; remove single leading and single trailing double quotes
  ; -------------------------------------------------------
    mov r10, rcx                    ; source and dest are same address
    mov r11, rcx

    sub r10, 1
  @@:
    add r10, 1
    cmp BYTE PTR [r10], 34          ; strip the leading quote
    je @B

  @@:
    add r10, 1
    movzx rax, BYTE PTR [r10]       ; read byte from 1st address
    test rax, rax                   ; safety margin for text with no quotes
    jz @F                           ; exit on ASCII zero
    mov BYTE PTR [r11], al          ; copy byte to 2nd address
    add r11, 1
    cmp rax, 34                     ; test if its a quote
    jne @B
    mov BYTE PTR [r11-1], 0         ; terminate and overwrite trailing quote

  @@:

    ret

unquote endp

STACKFRAME

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

    end

jj2007

#36
Quote from: hutch-- on December 27, 2022, 02:11:43 PMdifferent language versions of Windows sometimes do things differently

I can confirm that in the Italian versions of Win XP, 7 and 10 Explorer has that habit of putting "quotes around paths with spaces". Now we still need to verify that behaviour for Win 11 and UK, US, Russian, Chinese etc versions.

For those who have one of the Windows versions with this behaviour, there is a really simple solution taking advantage of a dedicated WinAPI function that gives you the un-quoted path for use with exist, ptr

See also https://learn.microsoft.com/en-us/troubleshoot/windows-server/deployment/filenames-with-spaces-require-quotation-mark
unfortunately, Micros*t doesn't give you a list of supported Windows versions :cool:

hutch--

Interesting stuff but I would prefer one that was coded in assembler that I knew worked. One for ASCII, another for UNICODE. The one I posted above will accept any string and if it has quotes at either end, it will remove them.