flat assembler
Message board for the users of flat assembler.

Index > Windows > copyfile to, not more!

Author
Thread Post new topic Reply to topic
XY2k



Joined: 18 Feb 2006
Posts: 6
XY2k
Hi,
i want only the source-code for a function like this "copyfile" to "target".
The copied file should become at the same time a new name

Example:
Copy File C:\programmes\bla\xy.exe to C:\programmes\renamedfile.exe

Not more guys Smile
When i have the code i compile it and put this code to an executable with a hexeditor. I change then the OEP etc. ...but that can I make.

regards,
XY2k
Post 19 Feb 2006, 00:00
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
Win32 Reference wrote:
BOOL CopyFile(

LPCTSTR lpExistingFileName, // pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);
Post 19 Feb 2006, 01:16
View user's profile Send private message Visit poster's website Reply with quote
XY2k



Joined: 18 Feb 2006
Posts: 6
XY2k
Thx Reverend, but the code is not complete. You must know, i´m a newbie and can only compile the source-code. Can u please make it finish with this names...look here --> Example:
Copy File C:\programmes\bla\xy.exe to C:\programmes\renamedfile.exe

regards,
XY2k
Post 19 Feb 2006, 03:15
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Quote:
Example:
Copy File C:\programmes\bla\xy.exe to C:\programmes\renamedfile.exe


Code:
push 0
Call label1
 db "C:\programmes\renamedfile.exe ",0
label1:
Call label2
 db "C:\programmes\bla\xy.exe",0
label2:
Call [CopyFile]    


it must work good, i think.
Post 19 Feb 2006, 09:18
View user's profile Send private message Reply with quote
XY2k



Joined: 18 Feb 2006
Posts: 6
XY2k
Sorry it doesn´t work

Code:
BOOL CopyFile( 

LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName, 
BOOL bFailIfExists 
);

push 0 
Call label1 
 db "C:\programmes\renamedfile.exe ",0 
label1: 
Call label2 
 db "C:\programmes\bla\xy.exe",0 
label2: 
Call [CopyFile]
    


by compiling with cmd it say :
copy.asm[1]
BOOL CopyFile(
error invalid expression


And when i want only compile the second code:
Code:
push 0
Call label1 
 db "C:\programmes\renamedfile.exe ",0 
label1: 
Call label2 
 db "C:\programmes\bla\xy.exe",0 
label2: 
Call [CopyFile]
    

It say: --> Call [CopyFile] "is undefined symbol"

Crying or Very sad

regards,
XY2k
Post 19 Feb 2006, 12:50
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM
you need to do put it in a PE executable.
Code:
include 'win32ax.inc' 
format PE console 4.0
.data
label2 db 'C:\blah\blah.blah',0
label1 db 'C:\from.exe',0
.code
start:
invoke CopyFile, label1, label2, 0
invoke ExitProcess,0
.end start
    

Edit: attached code that will process the command line
it goes like this: cp FromFile ToFile


Description: copy code
Download
Filename: cp.asm
Filesize: 1.93 KB
Downloaded: 92 Time(s)


_________________
This calls for... Ultra CRUNCHY Man!
Ta da!! *crunch*
Post 19 Feb 2006, 15:33
View user's profile Send private message Reply with quote
XY2k



Joined: 18 Feb 2006
Posts: 6
XY2k
THX UCM...its work Smile
Post 21 Feb 2006, 09:02
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 GitHub, YouTube, Twitter.

Website powered by rwasa.