Subversion Repositories Kolibri OS

Rev

Rev 359 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 359 Rev 548
Line 48... Line 48...
48
 
48
 
49
#ifndef INVALID_SET_FILE_POINTER
49
#ifndef INVALID_SET_FILE_POINTER
50
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
50
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
Line -... Line 51...
-
 
51
#endif
-
 
52
 
-
 
53
typedef struct 
-
 
54
{
-
 
55
  char     *name;
-
 
56
  unsigned int offset;
-
 
57
}__file_handle;
-
 
58
 
-
 
59
typedef struct
-
 
60
{   DWORD    attr;
-
 
61
    DWORD    flags;
-
 
62
    DWORD    cr_time;
-
 
63
    DWORD    cr_date;
-
 
64
    DWORD    acc_time;
-
 
65
    DWORD    acc_date;
-
 
66
    DWORD    mod_time;
-
 
67
    DWORD    mod_date;
-
 
68
    DWORD    size;
-
 
69
    DWORD    size_high; 
-
 
70
} FILEINFO;
-
 
71
 
51
#endif
72
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
52
 
73
 
53
_WCRTLINK long __lseek( int hid, long offset, int origin )
74
_WCRTLINK long __lseek( int hid, long offset, int origin )
-
 
75
{
Line 54... Line 76...
54
{
76
    __file_handle *fh;
-
 
77
    long rc;
-
 
78
    
-
 
79
    __handle_check( hid, -1 );
-
 
80
    fh = (__file_handle*) __getOSHandle( hid );
-
 
81
 
55
    DWORD               rc;
82
    switch(origin)
-
 
83
    {
-
 
84
      case SEEK_SET:
-
 
85
        rc = offset;
-
 
86
        break;
-
 
87
      case SEEK_CUR:  
-
 
88
        rc = fh->offset + offset;
-
 
89
        break;
-
 
90
      case SEEK_END:
-
 
91
      {
-
 
92
        FILEINFO info;
-
 
93
        get_fileinfo(fh->name,&info);
-
 
94
        rc = offset + info.size;
-
 
95
        break;
-
 
96
      }    
-
 
97
      default:
-
 
98
        return -1;
Line 56... Line -...
56
 
-
 
57
    __handle_check( hid, -1 );
-
 
58
    rc = offset;
-
 
59
 
-
 
60
//    rc = SetFilePointer( __getOSHandle( hid ), offset, 0, origin );
99
    };
61
//    if( rc == INVALID_SET_FILE_POINTER ) {
100