Board.KolibriOS.org

Official KolibriOS board
It is currently Sat Aug 17, 2019 8:33 pm

All times are UTC+03:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Nov 08, 2016 12:47 am 
Offline

Joined: Sun Oct 30, 2011 6:43 pm
Posts: 1499
А оно поддерживает AccessTime? Почему-то всегда 0. Пробовал узнать атрибуты файла '/sys/boardlog.txt'
Spoiler: Show
Attachment:
1.PNG
1.PNG [ 5.05 KiB | Viewed 1307 times ]
Исходник
Spoiler: Show
Code:
Unit Unit1;
(* -------------------------------------------------------- *)
Interface
(* -------------------------------------------------------- *)
Type

  Dword = Cardinal;

  TFileDate = Packed Record
    Day:   Byte;
    Month: Byte;
    Year:  Word;
  End;

  TFileTime = Packed Record
    Seconds: Byte;
    Minutes: Byte;
    Hours:   Byte;
    Zero:    Byte;
  End;

  TFileAttributes = Packed Record
    Attributes:   Dword;
    Flags:        Byte;
    reserved:     Array[0..2] Of Byte;
    CreationTime: TFileTime;
    CreationDate: TFileDate;
    AccessTime:   TFileTime;
    AccessDate:   TFileDate;
    ModifyTime:   TFileTime;
    ModifyDate:   TFileDate;
    SizeLo:       Dword;
    SizeHi:       Dword;
  End;

Var
  hConsole: Pointer;
  ConsoleInit:       Procedure(WndWidth, WndHeight, ScrWidth, ScrHeight: Dword; Caption: PChar); StdCall;
  ConsoleExit:       Procedure(bCloseWindow: Cardinal); StdCall;
  printf:            Function(Const Format: PChar): Integer; CDecl VarArgs;
(* -------------------------------------------------------- *)
  Procedure Main; Forward;
  Procedure ThreadTerminate; Forward;
  Function  LoadLibrary(Path: PChar): Pointer; StdCall; Forward;
  Function  GetProcAddress(hLib: Pointer; ProcName: PChar): Pointer; StdCall; Forward;
  Function  GetFileAttributes(Path: PChar; Var Buffer: TFileAttributes): Integer; StdCall; Forward;
(* -------------------------------------------------------- *)
Implementation
(* -------------------------------------------------------- *)
Procedure Main();
Var
   FileAttributes: TFileAttributes;
Begin

   hConsole          := LoadLibrary('/sys/lib/console.obj');
   ConsoleInit       := GetProcAddress(hConsole, 'con_init');
   ConsoleExit       := GetProcAddress(hConsole, 'con_exit');
   printf            := GetProcAddress(hConsole, 'con_printf');

   ConsoleInit($FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, 'Test');

   GetFileAttributes('/sys/boardlog.txt', FileAttributes);
   With FileAttributes Do Begin
     printf('Size         = %d'#10, SizeLo);
     With ModifyDate   Do printf('ModifyDate   = %02d.%02d.%02d'#10, Day, Month, Year);
     With ModifyTime   Do printf('ModifyTime   = %02d:%02d:%02d'#10, Hours, Minutes, Seconds);
     With AccessDate   Do printf('AccessDate   = %02d.%02d.%02d'#10, Day, Month, Year);
     With AccessTime   Do printf('AccessTime   = %02d:%02d:%02d'#10, Hours, Minutes, Seconds);
     With CreationDate Do printf('CreationDate = %02d.%02d.%02d'#10, Day, Month, Year);
     With CreationTime Do printf('CreationTime = %02d:%02d:%02d'#10, Hours, Minutes, Seconds);
   End;

   ConsoleExit(0);
   ThreadTerminate;
End;
(* -------------------------------------------------------- *)
Function  GetFileAttributes(Path: PChar; Var Buffer: TFileAttributes): Integer; StdCall;
Asm
        push   ebx
        push   Path
        dec    esp
        mov    byte[esp], 0
        push   Buffer
        push   0
        push   0
        push   0
        push   5
        mov    ebx, esp
        mov    eax, 70
        int    64
        add    esp, 25
        pop    ebx
End;
(* -------------------------------------------------------- *)
Procedure ThreadTerminate();
Asm
        mov    eax, $FFFFFFFF
        int    64
End;
(* -------------------------------------------------------- *)
Function GetProcAddress(hLib: Pointer; ProcName: PChar): Pointer;
Asm
        push   esi
        push   edi
        push   ebx
        mov    edx, hLib
        xor    eax, eax
        test   edx, edx
        jz     @end
        mov    edi, ProcName
        mov    ecx, $FFFFFFFF
        repne scasb
        mov    ebx, ecx
        not    ebx
@next:
        mov    esi, [edx]
        test   esi, esi
        jz     @end
        mov    ecx, ebx
        mov    edi, ProcName
        add    edx, 8
        repe cmpsb
        jne    @next
        mov    eax, [edx - 4]
@end:
        pop    ebx
        pop    edi
        pop    esi
End;
(* -------------------------------------------------------- *)
Function LoadLibrary(Path: PChar): Pointer;
Asm
        push   ebx
        mov    eax, 68
        mov    ebx, 19
        mov    ecx, Path
        int    64
        pop    ebx
End;
(* -------------------------------------------------------- *)
End.


Top
   
PostPosted: Tue Nov 08, 2016 3:00 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Thu Mar 26, 2015 5:16 pm
Posts: 1264
FAT не хранит AccessTime, только AccessDate.


Top
   
PostPosted: Tue Nov 08, 2016 3:03 pm 
Offline

Joined: Sun Oct 30, 2011 6:43 pm
Posts: 1499
Pathoswithin, а, то есть, в ext\ntfs оно должно работать нормально?


Top
   
PostPosted: Tue Nov 08, 2016 3:06 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Thu Mar 26, 2015 5:16 pm
Posts: 1264
Да.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+03:00


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited