W
W
Wasya UK2017-10-25 19:59:44
assembler
Wasya UK, 2017-10-25 19:59:44

How to write text to a file using copyFileA?

How to correctly write the name of all folders to a file? Thanks in advance
, here's what I got:

.386
.model flat,STDCALL

extrn	SHGetSpecialFolderLocation:Proc
extrn	MessageBoxA:Proc
extrn	ExitProcess:Proc
extrn	SHGetPathFromIDList:Proc
extrn	CopyFileA:Proc

.data
  INDEX	dd	0	
  DIRECTORY_ID	dd 0		
  DIRECTORY_NAME	db 512 dup(0)	

 T db ' Cпеціальний каталог:',0
 K db ' Індекс:', 0
 H db ' Хендл:', 0

 outText db 'out.txt', 0
.code
Start:	push offset DIRECTORY_ID	
  push INDEX			
  push 0				
  call SHGetSpecialFolderLocation

  inc INDEX
  cmp INDEX,65		
  jnc STOP		

  or eax,eax		
  jnz Start			

  push offset DIRECTORY_NAME	
  push DIRECTORY_ID		
  call SHGetPathFromIDList
  
  call    CopyFileA,offset DIRECTORY_NAME, offset outText,0
  
  ;call MessageBoxA,0,offset DIRECTORY_NAME, offset T,0
  ;call MessageBoxA,0,offset INDEX, offset K,0
  ;call MessageBoxA,0,offset DIRECTORY_ID, offset H,0
  jmp Start

STOP:	call ExitProcess,0
end Start

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-10-26
@dmc1989

How to write text to a file using copyFileA?

No way. The CopyFile function copies files in the file system. To write something to a file, you need to open it ( CreateFile ), write data ( WriteFile ) and close it ( CloseHandle ).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question