flat assembler
Message board for the users of flat assembler.

Index > Windows > Add double slashes into path

Author
Thread Post new topic Reply to topic
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 03 Apr 2021, 09:43
Please help me, I need to convert data from GetCurrentDirectory or SHGetFolderPath
to wsprintf use as \\...\\... example.
Any examples, please! And thank you!

_________________
Windows 9, FL Studio 19
Post 03 Apr 2021, 09:43
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3551
Location: vpcmipstrm
bitRAKE 03 Apr 2021, 11:26
This works except when it doesn't. Wink


Description: Console program to double slashes on current path.
Download
Filename: doubleslash.zip
Filesize: 1.58 KB
Downloaded: 264 Time(s)


_________________
¯\(°_o)/¯ unlicense.org
Post 03 Apr 2021, 11:26
View user's profile Send private message Visit poster's website Reply with quote
FlierMate



Joined: 21 Jan 2021
Posts: 219
FlierMate 03 Apr 2021, 14:44
bitRAKE wrote:
This works except when it doesn't. Wink


I think your code is great, but why does Windows Defender report EXE built by FASM as malware again. Shocked


Description: Windows Defender reports doubleslash.exe as unwanted app / malware
Filesize: 28.94 KB
Viewed: 3173 Time(s)

slash.JPG


Post 03 Apr 2021, 14:44
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19105
Location: In your JS exploiting you and your system
revolution 03 Apr 2021, 15:02
Disable Windows Defender. It isn't protecting you anyway, and only serves to make you feel better.
Post 03 Apr 2021, 15:02
View user's profile Send private message Visit poster's website Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 03 Apr 2021, 15:32
I've radical method to remove Defender from win8.1.iso, no app no problem Smile
Post 03 Apr 2021, 15:32
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3551
Location: vpcmipstrm
bitRAKE 03 Apr 2021, 18:37
Maybe it's because I openly criticize retarded programming practices and the stupid people that implement them? Nah, it's because their software is really that bad.

Maybe, it's because I have the ability to code programs that match arbitrary hash IDs. Nah, it's because their software is really that bad.

Maybe it's because they target unknown software as a monopolistic business practice? Yeah, that's probably true.

_________________
¯\(°_o)/¯ unlicense.org
Post 03 Apr 2021, 18:37
View user's profile Send private message Visit poster's website Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 11 Dec 2022, 02:55
«I'll be back»

Maybe return again. It's need more.
The code bitRAKE just low level asm without msdn calls. I give up! Smile
In addition this includes are modified. My fasm stop with errors.
Maybe has a easier? Very Happy

Code:
.FRAME    

error
Post 11 Dec 2022, 02:55
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3551
Location: vpcmipstrm
bitRAKE 11 Dec 2022, 11:21
The general sentiment is to start from the end of the string, pushing string fragments - whenever a '\' is found push double-slash string. Finally, concatenate all the strings. The code is for fasmg. In my current environment it would look slightly different.

I like assembly. Just looking at a bunch of CALL, CALL, CALL, ... doesn't not appeal to me, and should be left to high-level languages, imho.

_________________
¯\(°_o)/¯ unlicense.org
Post 11 Dec 2022, 11:21
View user's profile Send private message Visit poster's website Reply with quote
Mustafa01



Joined: 11 Dec 2022
Posts: 1
Mustafa01 11 Dec 2022, 16:52
semiono wrote:
«I'll be back»
Maybe has a easier? Very Happy


(not tested, just wrote it)

Code:

lea esi, [src]
lea edi, [dst]
_repeat:
cld
lodsb
stosb
cmp al, '\'
jne _skip1
stosb              ; double the slash
_skip1:
test al, al
jz _end
jmp _repeat

_end:

int 3h

    
Post 11 Dec 2022, 16:52
View user's profile Send private message Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 11 Dec 2022, 16:58
Thanks to all!

Code:
include '%fasm%/win64ax.inc'
section '.code' executable
start:
        sub rsp,8

        invoke GetCurrentDirectory,MAX_PATH,a

        invoke lstrlen,a
        xchg   ecx,eax
        mov    esi,a
        mov    edi,b
@@:     lodsb
        cmp    al,'\'
        jne    @next
        mov    word[edi],'\\'
        inc    edi
@next:  stosb
        loop   @r

        invoke MessageBoxTimeout,HWND_DESKTOP,b,'',MB_TOPMOST,LANG_NEUTRAL,2000
exit:
        invoke ExitProcess,NULL

section '.data' readable writeable

        a rb MAX_PATH
        b rb MAX_PATH
    


tested Very Happy
Post 11 Dec 2022, 16:58
View user's profile Send private message Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 11 Dec 2022, 17:00
Quote:

stosb ; double the slash

cool!
Post 11 Dec 2022, 17:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.