Hello.
i need to move a file form one location to another....
what apis woudl i need to do this?
and if u can make it low levelish....so if ther is 1 api that does the work of 5...i woudl rally rather know the 5 then the 1.
:P
thx
i need to move a file form one location to another....
what apis woudl i need to do this?
and if u can make it low levelish....so if ther is 1 api that does the work of 5...i woudl rally rather know the 5 then the 1.
:P
thx
#1: MoveFile{Ex}
#2: 2xCreateFile, loop:{ReadFile, WriteFile}, 2xCloseHandle, DeleteFile
#2: 2xCreateFile, loop:{ReadFile, WriteFile}, 2xCloseHandle, DeleteFile
sorry fro teh dumb questoin but i am nto sure what doesn;t work...hereis the code:
the progrma deosn't mov the main.exe to c:\.....the main,exe is in the same folder as the mover program.....
am i missing someting?
i also tried to ahve the to as c:\main.exe....
didn't work either....
any ideas?
.386
.model flat, stdcall
option casemap :none
include windows.inc
include kernel32.inc
include user32.inc
include Comctl32.inc
include shell32.inc
includelib kernel32.lib
includelib user32.lib
includelib Comctl32.lib
includelib shell32.lib
.data
from db "main.exe",0
to db "C:\",0
.code
start:
invoke MoveFile,addr from,addr to
invoke ExitProcess,NULL
end start
the progrma deosn't mov the main.exe to c:\.....the main,exe is in the same folder as the mover program.....
am i missing someting?
i also tried to ahve the to as c:\main.exe....
didn't work either....
any ideas?
Perhaps a dumb question, but is main.exe located on drive C:?
no it is not, main.exe and mover.exe are on the desktop
i want mover to move the main.exe to c:\ ,
but for some reasont he above code dones't do that.
so they are in the c drive, but not in the rot directory of the c
any ideas?
i want mover to move the main.exe to c:\ ,
but for some reasont he above code dones't do that.
so they are in the c drive, but not in the rot directory of the c
any ideas?
Well, "on drive C" means "anywhere on drive C", not "the root of drive C" - I asked the question since one of the requirements of MoveFile is that source and destination are on the same drive.
Try running in OllyDbg and check LastError after the MoveFile?
Try running in OllyDbg and check LastError after the MoveFile?
weee..i am not too sure how to use olly dbg..can someone give me a couple of tuts on that?
cuz i know nothing more then how to search for strings.....
:?
cuz i know nothing more then how to search for strings.....
:?
main.exe has to be in the same directory as your program
change
into
change
to db "C:\",0
into
to db "C:\main.exe",0
He already tried the "c:\main.exe", and MoveFile specifies that you can specify a directory as target, so it ought to work...
ok, i think i got it to work...i didn't recompile it...stupid me
but how woudl i go about moving a file form 1 drive to another?
but how woudl i go about moving a file form 1 drive to another?
MoveFileEx can handle that, but is only supported on NT - so you'll have to use the algorithm I outlined earlier.
... I asked the question since one of the requirements of MoveFile is that source and destination are on the same drive.
MoveFile() will fail only when you move a directory across volumes, not files.
Sorry for that one, I read through PSDK too quickly :)