having a problem with putting cop command to a buffer then usng shellexecute to do the command i think t he problem is because if the folder name is longer thasn 8 chars then i have to make it ~1 etc.. here is the code below can someone give me some insight into how to make it work

.data
SubKey BYTE "Software\Microsoft\Windows\CurrentVersion\App Paths\aim.exe",0
foldername db "%sclone",0
PathString BYTE "Path",0
TheDataSize DWORD 255
szCopy BYTE " *.* ",0
slash BYTE "%s\*.*",0
copystring BYTE "COPY",0

.data?
TheData byte 255 dup (?)
TheReturn DWORD ?
szfolder db 256 dup(?)
szSource db 256 dup(?)
szDest db 256 dup(?)
szBuffer3 db 256 dup(?)

.code
start:
invoke RegOpenKeyEx, HKEY_LOCAL_MACHINE,addr SubKey,0,KEY_READ,addr TheReturn ;|get location of aim install
invoke RegQueryValueEx,TheReturn,addr PathString,0,0,addr TheData, addr TheDataSize ;| and set it to thedata buffer
invoke wsprintf,addr szfolder, addr foldername, addr TheData ;|set the folder as c:\Program files\aim95clone
invoke CreateDirectory, addr szfolder, 0 ;|and create it
invoke SetCurrentDirectory, addr TheData ;|put ourselves in the aim dir
invoke wsprintf,addr szDest,addr slash,addr szfolder ;|add \ to end of aimclonedir
invoke lstrcat,addr szCopy,addr szDest ;|add *.* to it
invoke ShellExecute, NULL,addr copystring,addr szCopy,NULL,NULL, SW_SHOWNORMAL
;^^^^^^should execute the copy command 'copy *.* c:\program files\aim95clone\*.*'
; but because the 8.3 format and long file names it wont work need to change it to
; 'copy *.* c:\progra~1\aim95c~1\*.*'

;| clean up shop and get out of town
invoke RegCloseKey, TheReturn
invoke ExitProcess,NULL
end start
Posted on 2002-04-16 12:43:01 by illwill
Well, this would help out im sure...

API from kernel32 - GetShortPathName
? lpszLongPath
? lpszShortPath
? cchBuffer

Points to a null-terminated path string. The function obtains the short form of this path.

Points to a buffer to receive the null-terminated short form of the path specified by lpszLongPath.

Specifies the size, in characters, of the buffer pointed to by lpszShortPath.

GL
Posted on 2002-04-16 13:37:13 by Graebel
Until now I didnt know that it is possible to execute DOS commands with ShellExecute ...

In your case the problem is probably not the long filename, but the space sign in "program files". Try <slash BYTE '"%s\*.*"',0> as mask for wsprintf.

Maybe you can also try the "ShFileOperation" API function to do the copy operation via Windows Shell API.
Posted on 2002-04-17 07:20:12 by beaster
I think beaster is right, long filenames should be no problem for
ShellExecute, but if there's a space in path or filename, you
probably need the quotes.

To add something new... I dunno if you can ShellExecute the "copy"
command, as it's built into command.com / cmd.exe. It might work
(don't think it will) - if it doesn't you'll have to launch command.com
(or cmd.exe on NT) with the right parameter to execute a command
and terminate. And in that case, you're better off doing things properly -
setting up a FindFile + Copy loop.
Posted on 2002-04-17 07:35:41 by f0dder
And in that case, you're better off doing things properly -
setting up a FindFile + Copy loop.


or using SHFileOperation that is especially well suited to do those things...
Posted on 2002-04-17 09:13:43 by JCP
could you guys maybe give me an example of each ive tried doing this with the little asm knowledge i have and im not sure on how to do the loop or the fileoper way

thanx
Posted on 2002-04-17 12:54:01 by illwill