--- np2/win9x/sstpmsg.cpp 2005/03/19 18:54:58 1.8 +++ np2/win9x/sstpmsg.cpp 2007/12/28 20:36:40 1.11 @@ -1,6 +1,7 @@ #include "compiler.h" #include "strres.h" #include "np2.h" +#include "oemtext.h" #include "scrnmng.h" #include "sysmng.h" #include "sstp.h" @@ -186,10 +187,13 @@ static const UINT8 prs2[] = {0xaa,0xac,0 (a) = ((a) << 2) | ((a) >> 6); \ } -static char *sstpsolve(char *buf, const unsigned char *dat) { +static OEMCHAR *sstpsolve(OEMCHAR *buf, const UINT8 *dat) { UINT8 c; UINT8 last; +#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) + char sjis[4]; +#endif last = 0x80; while(1) { @@ -223,12 +227,12 @@ static char *sstpsolve(char *buf, const break; } while(ms > 10) { - CopyMemory(buf, "\\w9", 3); + CopyMemory(buf, OEMTEXT("\\w9"), 3 * sizeof(OEMCHAR)); buf += 3; ms -= 10; } if (ms) { - SPRINTF(buf, "\\w%1u", ms); + OEMSPRINTF(buf, OEMTEXT("\\w%1u"), ms); buf += 3; } } @@ -236,7 +240,13 @@ static char *sstpsolve(char *buf, const UINT8 c2; GETSSTPDAT1(c2); if (c2) { +#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) + sjis[0] = c2; + sjis[1] = '\0'; + buf += oemtext_sjistooem(buf, 4, sjis, 1); +#else *buf++ = c2; +#endif } else { break; @@ -261,15 +271,31 @@ static char *sstpsolve(char *buf, const buf = sstpsolve(buf, p); } else if ((c >= 0xa0) && (c < 0xe0)) { - *buf++ = (UINT8)0x82; - *buf++ = prs2[c-0xa0]; +#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) + sjis[0] = (UINT8)0x82; + sjis[1] = prs2[c-0xa0]; + sjis[2] = '\0'; + buf += oemtext_sjistooem(buf, 4, sjis, 2); +#else + buf[0] = (UINT8)0x82; + buf[1] = prs2[c-0xa0]; + buf += 2; +#endif } else { UINT8 c2; GETSSTPDAT1(c2); if (c2) { - *buf++ = c; - *buf++ = c2; +#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) + sjis[0] = c; + sjis[1] = c2; + sjis[2] = '\0'; + buf += oemtext_sjistooem(buf, 4, sjis, 2); +#else + buf[0] = c; + buf[1] = c2; + buf += 2; +#endif } else { break; @@ -283,25 +309,24 @@ static char *sstpsolve(char *buf, const // ------------------------------- +static const UINT8 *prcs[4] = {k_keropi, k_winx68k, k_t98next, k_anex86}; + static int check_keropi(void) { - char buf[64]; + UINT i; - sstpsolve(buf, k_keropi); - if (FindWindow(buf, NULL)) { - return(1); - } - sstpsolve(buf, k_winx68k); - if (FindWindow(buf, NULL)) { - return(2); - } - sstpsolve(buf, k_t98next); - if (FindWindow(NULL, buf)) { - return(3); - } - sstpsolve(buf, k_anex86); - if (FindWindow(NULL, buf)) { - return(4); + for (i=0; i