Page 4 of 6

Re: FTP client

Posted: Thu Feb 01, 2018 12:21 pm
by 0CodErr
nisargshah95, i think it is possible to do like in info3ds app.
To copy the icons into distr it need to edit Tupfile.lua http://websvn.kolibrios.org/filedetails ... a#line-158

Re: FTP client

Posted: Thu Feb 08, 2018 9:05 pm
by nisargshah95
Thanks 0CodErr. Is there any way to test this on local machine? Do I need to follow build instructions from root/build.txt?

Re: FTP client

Posted: Mon Mar 12, 2018 8:07 pm
by nisargshah95
Writing to log file at /usbhd0/1/ftpc.log fails with "access denied" error. It writes successfully if i compile and run ftpc from /usbhd0/1/. Why does the ftpc from the image give this error? Will it work if I change log destination to /tmp0/1/?

Re: FTP client

Posted: Mon Mar 12, 2018 8:49 pm
by 0CodErr
nisargshah95, which filesystem do you use on /usbhd0/1 ?
nisargshah95 wrote:Will it work if I change log destination to /tmp0/1/?
I think yes, on the tmp the FAT filesystem is used. Just try it.

Re: FTP client

Posted: Mon Mar 19, 2018 7:59 pm
by nisargshah95
0CodErr wrote:nisargshah95, which filesystem do you use on /usbhd0/1 ?
I use FAT (32-bit) on /usbhd0/1. I will try submitting a fix with /tmp0/1 and see if it works.

Re: FTP client

Posted: Wed Mar 21, 2018 7:24 pm
by nisargshah95
0CodErr, it looks like there is still "Access denied" issue even after moving log location to /tmp0/1/ (Rev 7201).

Re: FTP client

Posted: Wed Mar 21, 2018 8:40 pm
by 0CodErr
nisargshah95, maybe you'll show some code?
How do you writing to log?

Re: FTP client

Posted: Wed Mar 21, 2018 8:58 pm
by nisargshah95
0CodErr wrote:How do you writing to log?
From programs/network/ftpc/ftpc.asm:637:

Code: Select all

;;================================================================================================;;
write_to_file: ;//////////////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Writes input buffer to log file                                                                ;;
;;------------------------------------------------------------------------------------------------;;
;> eax = pointer to buffer                                                                        ;;
;> ecx = size of buffer                                                                           ;;
;;------------------------------------------------------------------------------------------------;;
;< eax = status of SF 70.3                                                                        ;;
;;================================================================================================;;
        cmp     [logfile_offset], -1 ; if offset == -1 => logging disabled
        jne     @f
        mov     eax, 0
        ret
      @@:
        mov     [filestruct2.subfn], 3
        m2m     [filestruct2.offset], [logfile_offset]
        mov     [filestruct2.size], ecx
        mov     [filestruct2.ptr], eax
        mov     [filestruct2.name], log_file
        mcall   70, filestruct2
        test    eax, eax
        jz      @f
        mov     [logfile_offset], -1 ; disable logging
        call    error_fs
        icall   ebx, interface_addr, interface.print, str_no_logging
        ret
      @@:
        mov     eax, [logfile_offset]
        add     eax, ecx
        mov     [logfile_offset], eax
        ret
Just to clarify, it works if I compile the FTPC source from /usbhd0/1 and run the compiled binary. Doesn't work for the FTPC packaged in Kolibri image.

Re: FTP client

Posted: Wed Mar 21, 2018 9:09 pm
by 0CodErr
Hmm, according to you code above it seems that used SysFn70.3:WriteFile only.
Maybe it need to use SysFn70.2 instead of SysFn70.3?

Below the code that i tested and it works fine:

Code: Select all

; to compile: nasm -f bin test.asm -o test.kex
ORG 0
BITS 32
; ---------------------------------------------------------------------------- ;
STACK_SIZE        equ 256
; ---------------------------| Application Header |--------------------------- ;
MENUET01          db "MENUET01"
version           dd 1
program.start     dd START
program.end       dd END
program.memory    dd END + STACK_SIZE
program.stack     dd END + STACK_SIZE
program.params    dd 0
program.path      dd 0
; ---------------------------------------------------------------------------- ;
Buf:
db 'This is my data to save to log file.'
.end:
PathToMyLogFile db '/tmp0/1/MyLogFile.txt',0
Buffer dd Buf
Count dd (Buf.end - Buf)
Path dd PathToMyLogFile
; ---------------------------------------------------------------------------- ;
align 4
START:
; ---------------------------------------------------------------------------- ;
; Create\Rewrite file      ;   SysFn70.2
        push   dword [Path]
        dec    esp
        mov    byte[esp], 0
        push   dword [Buffer]
        push   dword [Count]
        push   dword 0
        push   dword 0
        push   dword 2
        mov    ebx, esp
        mov    eax, 70
        int    64
        add    esp, 25
; terminate                ;   SysFn-1
        or     eax, -1
        int    64
; ---------------------------------------------------------------------------- ;
align 4
END:

Re: FTP client

Posted: Wed Mar 21, 2018 9:16 pm
by nisargshah95
0CodErr, I think you are right. On reading sysfuncs.txt carefully, I see 70.3 is for writing to existing file. Using 70.2 should work. Thanks very much!

Re: FTP client

Posted: Mon Mar 26, 2018 6:48 pm
by nisargshah95
According to sysfuncs.txt for 70.3,
* The file must already exist, otherwise function returns eax=5.
But I get eax=10. How is this possible?

Re: FTP client

Posted: Mon Mar 26, 2018 7:14 pm
by 0CodErr
nisargshah95, is your app really can to find ini-file?

Re: FTP client

Posted: Mon Mar 26, 2018 7:51 pm
by nisargshah95
0CodErr wrote:nisargshah95, is your app really can to find ini-file?
It does. As I mentioned before, if I compile ftpc source on /usbhd0/1 and run it from there it can successfully create and write to file.

Re: FTP client

Posted: Mon Mar 26, 2018 9:40 pm
by 0CodErr
nisargshah95 wrote:Doesn't work for the FTPC packaged in Kolibri image.
Is ini-file also packaged in the image?

Re: FTP client

Posted: Tue Mar 27, 2018 6:47 pm
by nisargshah95
0CodErr wrote:
nisargshah95 wrote:Doesn't work for the FTPC packaged in Kolibri image.
Is ini-file also packaged in the image?
No. I always assumed it would be. But I don't see the file in /rd/1/network. Thanks a lot! I'll try adding it to data/Tupfile.lua.