|
|
| version 1.3, 2004/08/09 02:47:02 | version 1.4, 2004/08/12 17:57:36 |
|---|---|
| Line 81 UINT __stdcall file_write(FILEH handle, | Line 81 UINT __stdcall file_write(FILEH handle, |
| return(0); | return(0); |
| } | } |
| short __stdcall file_close(FILEH handle) { | BRESULT __stdcall file_close(FILEH handle) { |
| CloseHandle(handle); | CloseHandle(handle); |
| return(0); | return(0); |
| Line 92 UINT __stdcall file_getsize(FILEH handle | Line 92 UINT __stdcall file_getsize(FILEH handle |
| return(GetFileSize(handle, NULL)); | return(GetFileSize(handle, NULL)); |
| } | } |
| short __stdcall file_delete(const OEMCHAR *path) { | static BRESULT cnvdatetime(FILETIME *file, DOSDATE *dosdate, DOSTIME *dostime) { |
| return(DeleteFile(path)?0:-1); | FILETIME localtime; |
| SYSTEMTIME systime; | |
| if ((FileTimeToLocalFileTime(file, &localtime) == 0) || | |
| (FileTimeToSystemTime(&localtime, &systime) == 0)) { | |
| return(FAILURE); | |
| } | |
| if (dosdate) { | |
| dosdate->year = (UINT16)systime.wYear; | |
| dosdate->month = (UINT8)systime.wMonth; | |
| dosdate->day = (UINT8)systime.wDay; | |
| } | |
| if (dostime) { | |
| dostime->hour = (UINT8)systime.wHour; | |
| dostime->minute = (UINT8)systime.wMinute; | |
| dostime->second = (UINT8)systime.wSecond; | |
| } | |
| return(SUCCESS); | |
| } | |
| BRESULT __stdcall file_getdatetime(FILEH handle, DOSDATE *dosdate, DOSTIME *dostime) { | |
| FILETIME lastwrite; | |
| if ((GetFileTime(handle, NULL, NULL, &lastwrite) == 0) || | |
| (cnvdatetime(&lastwrite, dosdate, dostime) != SUCCESS)) { | |
| return(FAILURE); | |
| } | |
| return(SUCCESS); | |
| } | |
| BRESULT __stdcall file_delete(const OEMCHAR *path) { | |
| return(DeleteFile(path)?SUCCESS:FAILURE); | |
| } | } |
| short __stdcall file_attr(const OEMCHAR *path) { | SINT16 __stdcall file_attr(const OEMCHAR *path) { |
| return((short)GetFileAttributes(path)); | return((SINT16)GetFileAttributes(path)); |
| } | } |
| short __stdcall file_dircreate(const OEMCHAR *path) { | BRESULT __stdcall file_dircreate(const OEMCHAR *path) { |
| return(CreateDirectory(path, NULL)?0:-1); | return(CreateDirectory(path, NULL)?SUCCESS:FAILURE); |
| } | } |
| Line 144 FILEH __stdcall file_create_c(const OEMC | Line 177 FILEH __stdcall file_create_c(const OEMC |
| return(file_create(curpath)); | return(file_create(curpath)); |
| } | } |
| short __stdcall file_delete_c(const OEMCHAR *path) { | BRESULT __stdcall file_delete_c(const OEMCHAR *path) { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| file_catname(curpath, path, NELEMENTS(curpath)); | file_catname(curpath, path, NELEMENTS(curpath)); |
| return(file_delete(curpath)); | return(file_delete(curpath)); |
| } | } |
| short __stdcall file_attr_c(const OEMCHAR *path) { | SINT16 __stdcall file_attr_c(const OEMCHAR *path) { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| file_catname(curpath, path, NELEMENTS(curpath)); | file_catname(curpath, path, NELEMENTS(curpath)); |