--- np2/generic/hostdrvs.c 2004/06/20 02:57:47 1.9 +++ np2/generic/hostdrvs.c 2005/02/07 14:46:10 1.12 @@ -13,7 +13,7 @@ static const HDRVDIR hddroot = {" ", 0, 0, 0, 0x10, {0}, {0}}; -static const BYTE dospathchr[] = { +static const UINT8 dospathchr[] = { 0xfa, 0x23, // '&%$#"! /.-,+*)( 0xff, 0x03, // 76543210 ?>=<;:98 0xff, 0xff, // GFEDCBA@ ONMLKJIH @@ -84,10 +84,10 @@ static BOOL realname2fcb(char *fcbname, char *ext; #if defined(OSLANG_EUC) - codecnv_euc2sjis(sjis, sizeof(sjis), fli->path, sizeof(fli->path)); + codecnv_euc2sjis(sjis, sizeof(sjis), fli->path, NELEMENTS(fli->path)); realname = sjis; #elif defined(OSLANG_UTF8) - oemtext_oem2sjis(sjis, sizeof(sjis), fli->path, sizeof(fli->path)); + oemtext_oem2sjis(sjis, sizeof(sjis), fli->path, NELEMENTS(fli->path)); realname = sjis; #else realname = fli->path; @@ -117,7 +117,7 @@ static BOOL hddseadir(void *vpItem, void return(FALSE); } -LISTARRAY hostdrvs_getpathlist(const char *realpath) { +LISTARRAY hostdrvs_getpathlist(const OEMCHAR *realpath) { FLISTH flh; FLINFO fli; @@ -148,7 +148,7 @@ LISTARRAY hostdrvs_getpathlist(const cha hdd->di.attr = fli.attr; hdd->di.date = fli.date; hdd->di.time = fli.time; - milstr_ncpy(hdd->realname, fli.path, sizeof(hdd->realname)); + file_cpyname(hdd->realname, fli.path, NELEMENTS(hdd->realname)); // TRACEOUT(("%s -> %11s", fli.path, fcbname)); } } while(file_listnext(flh, &fli) == SUCCESS); @@ -214,20 +214,20 @@ static char *dospath2fcb(char *fcbname, BOOL hostdrvs_getrealpath(HDRVPATH *hdp, char *dospath) { - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; LISTARRAY lst; const HDRVDIR *di; HDRVLST hdl; char fcbname[11]; - file_cpyname(path, np2cfg.hdrvroot, sizeof(path)); + file_cpyname(path, np2cfg.hdrvroot, NELEMENTS(path)); lst = NULL; di = &hddroot; while(dospath[0] != '\0') { if ((dospath[0] != '\\') || (!(di->attr & 0x10))) { goto hdsgrp_err; } - file_setseparator(path, sizeof(path)); + file_setseparator(path, NELEMENTS(path)); dospath++; if (dospath[0] == '\0') { di = &hddroot; @@ -240,12 +240,12 @@ const HDRVDIR *di; if (hdl == NULL) { goto hdsgrp_err; } - file_catname(path, hdl->realname, sizeof(path)); + file_catname(path, hdl->realname, NELEMENTS(path)); di = &hdl->di; } if (hdp) { CopyMemory(&hdp->di, di, sizeof(HDRVDIR)); - file_cpyname(hdp->path, path, sizeof(hdp->path)); + file_cpyname(hdp->path, path, NELEMENTS(hdp->path)); } listarray_destroy(lst); return(SUCCESS); @@ -255,7 +255,7 @@ hdsgrp_err: return(FAILURE); } -BOOL hostdrvs_getrealdir(char *path, int size, char *fcb, char *dospath) { +BOOL hostdrvs_getrealdir(OEMCHAR *path, int size, char *fcb, char *dospath) { LISTARRAY lst; HDRVLST hdl; @@ -296,25 +296,29 @@ hdsgrd_err: BOOL hostdrvs_newrealpath(HDRVPATH *hdp, char *dospath) { - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; char fcb[11]; LISTARRAY lst; HDRVLST hdl; char dosname[16]; UINT i; char *p; +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) + OEMCHAR oemname[64]; +#endif - if ((hostdrvs_getrealdir(path, sizeof(path), fcb, dospath) != SUCCESS) || + if ((hostdrvs_getrealdir(path, NELEMENTS(path), fcb, dospath) + != SUCCESS) || (fcb[0] == ' ')) { return(FAILURE); } lst = hostdrvs_getpathlist(path); hdl = (HDRVLST)listarray_enum(lst, hddsea, fcb); if (hdl != NULL) { - file_catname(path, hdl->realname, sizeof(path)); + file_catname(path, hdl->realname, NELEMENTS(path)); if (hdp) { CopyMemory(&hdp->di, &hdl->di, sizeof(HDRVDIR)); - file_cpyname(hdp->path, path, sizeof(hdp->path)); + file_cpyname(hdp->path, path, NELEMENTS(hdp->path)); } } else { @@ -329,11 +333,20 @@ BOOL hostdrvs_newrealpath(HDRVPATH *hdp, } } *p = '\0'; - file_catname(path, dosname, sizeof(path)); + // ここで SJIS->OEMコードに未変換! +#if defined(OSLANG_EUC) + codecnv_sjis2euc(oemname, NELEMENTS(oemname), dosname, (UINT)-1); + file_catname(path, oemname, NELEMENTS(path)); +#elif defined(OSLANG_UTF8) + oemtext_sjis2oem(oemname, NELEMENTS(oemname), dosname, (UINT)-1); + file_catname(path, oemname, NELEMENTS(path)); +#else + file_catname(path, dosname, NELEMENTS(path)); +#endif if (hdp) { ZeroMemory(&hdp->di, sizeof(hdp->di)); CopyMemory(hdp->di.fcbname, fcb, 11); - file_cpyname(hdp->path, path, sizeof(hdp->path)); + file_cpyname(hdp->path, path, NELEMENTS(hdp->path)); } } listarray_destroy(lst);