flat assembler
Message board for the users of flat assembler.

Index > Windows > Create path longer than MAX_PATH

Author
Thread Post new topic Reply to topic
marcinzabrze12



Joined: 07 Aug 2011
Posts: 60
marcinzabrze12
Why this does not work ?

Code:
format pe gui 4.0
entry start
include 'win32wx.inc'
overmaxpathname   fix 'xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_',\
                      'xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_',\
                      'xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_',\
                      'xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_',\
                      'xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_',\
                      'xxxxxxxxx_.txt'        ; 264 bytes name



section '.data' data readable writeable

   filename         TCHAR  '\\?\d:\',overmaxpathname,0


section '.code' code readable executable
start:
        invoke  CreateFile, filename, GENERIC_READ or GENERIC_WRITE,\
                FILE_SHARE_READ or  FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,\
                FILE_ATTRIBUTE_ARCHIVE, NULL

        .if eax = INVALID_HANDLE_VALUE
                invoke MessageBox, 0, 'NIEPOWODZENIE',0,0
                jmp    endstart
        .endif

        mov     ebx, eax
        invoke  MessageBox,0,'successik','utworzono plik',0
        invoke  CloseHandle, ebx
     endstart:
        invoke  ExitProcess,0






section '.idata' import data readable
library kernel32,'kernel32.dll',user32,'user32.dll'
include 'api\kernel32.inc'
include 'api\user32.inc'
    


ofcorse when i change 'overmaxpathname' to name less than MAX_PATH everythink is ok.
Forgive my english.
Post 27 Sep 2011, 16:59
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2914
Location: [RSP+8*5]
bitRAKE
Just a guess: I'm assuming the path can be longer than MAX_PATH, but the filename is still limited?
Post 27 Sep 2011, 17:35
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
i think you are mixing UNICODE and an ASCII API. try DB instead


ps: the way you are preserving EBX seems odd to me.
Post 27 Sep 2011, 18:47
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Q: What does GetLastError return?
Post 27 Sep 2011, 23:54
View user's profile Send private message Reply with quote
marcinzabrze12



Joined: 07 Aug 2011
Posts: 60
marcinzabrze12
bitRAKE You are write. Now its work correctly
Post 29 Sep 2011, 20:07
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.