|
|
| version 1.2, 2004/08/03 12:50:54 | 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)); |
| Line 225 void __stdcall file_cutseparator(OEMCHAR | Line 258 void __stdcall file_cutseparator(OEMCHAR |
| int pos; | int pos; |
| pos = STRLEN(path) - 1; | pos = OEMSTRLEN(path) - 1; |
| if ((pos > 0) && // 2文字以上でー | if ((pos > 0) && // 2文字以上でー |
| (path[pos] == '\\') && // ケツが \ でー | (path[pos] == '\\') && // ケツが \ でー |
| (!milstr_kanji2nd(path, pos)) && // 漢字の2バイト目ぢゃなくてー | (!milstr_kanji2nd(path, pos)) && // 漢字の2バイト目ぢゃなくてー |
| Line 239 void __stdcall file_setseparator(OEMCHAR | Line 272 void __stdcall file_setseparator(OEMCHAR |
| int pos; | int pos; |
| pos = STRLEN(path) - 1; | pos = OEMSTRLEN(path) - 1; |
| if ((pos < 0) || | if ((pos < 0) || |
| ((pos == 1) && (path[1] == ':')) || | ((pos == 1) && (path[1] == ':')) || |
| ((path[pos] == '\\') && (!milstr_kanji2nd(path, pos))) || | ((path[pos] == '\\') && (!milstr_kanji2nd(path, pos))) || |