| 83 |
"protocols" range. */ |
"protocols" range. */ |
| 84 |
#define ORDER 2500 |
#define ORDER 2500 |
| 85 |
|
|
|
#ifdef TERATERM32 |
|
| 86 |
static HICON SecureLargeIcon = NULL; |
static HICON SecureLargeIcon = NULL; |
| 87 |
static HICON SecureSmallIcon = NULL; |
static HICON SecureSmallIcon = NULL; |
|
#endif |
|
| 88 |
|
|
| 89 |
static HFONT DlgHostFont; |
static HFONT DlgHostFont; |
| 90 |
static HFONT DlgAboutFont; |
static HFONT DlgAboutFont; |
| 93 |
|
|
| 94 |
static TInstVar FAR *pvar; |
static TInstVar FAR *pvar; |
| 95 |
|
|
|
#ifdef TERATERM32 |
|
| 96 |
/* WIN32 allows multiple instances of a DLL */ |
/* WIN32 allows multiple instances of a DLL */ |
| 97 |
static TInstVar InstVar; |
static TInstVar InstVar; |
| 98 |
#define GET_VAR() |
#define GET_VAR() |
|
#else |
|
|
/* WIN16 does not allow multiple instances of a DLL */ |
|
|
|
|
|
/* maximum number of Tera Term instances */ |
|
|
#define MAXNUMINST 32 |
|
|
/* list of task handles for Tera Term instances */ |
|
|
static HANDLE FAR TaskList[MAXNUMINST]; |
|
|
/* variable sets for instances */ |
|
|
static TInstVar FAR *FAR InstVar[MAXNUMINST]; |
|
|
|
|
|
/* Here's how the TS settings work. |
|
|
Whenever the TS settings are read or written to the INI file, then |
|
|
the shared memory containing those settings is updated. |
|
|
When Teraterm starts, the shared memory is read to initialize the TS |
|
|
settings. */ |
|
|
|
|
|
/* TS settings shared across instances */ |
|
|
static TS_SSH ts_SSH_settings; |
|
|
|
|
|
|
|
|
extern void SSH2_update_cipher_myproposal(PTInstVar pvar); |
|
|
|
|
|
|
|
|
static BOOL NewVar() |
|
|
{ |
|
|
int i = 0; |
|
|
HANDLE Task = GetCurrentTask(); |
|
|
|
|
|
if (TaskList[0] == NULL) |
|
|
|
|
|
if (Task == NULL) |
|
|
return FALSE; |
|
|
while ((i < MAXNUMINST) && (TaskList[i] != NULL)) |
|
|
i++; |
|
|
if (i >= MAXNUMINST) |
|
|
return FALSE; |
|
|
pvar = (TInstVar FAR *) malloc(sizeof(TInstVar)); |
|
|
InstVar[i] = pvar; |
|
|
TaskList[i] = Task; |
|
|
return TRUE; |
|
|
} |
|
|
|
|
|
void DelVar() |
|
|
{ |
|
|
int i = 0; |
|
|
HANDLE Task = GetCurrentTask(); |
|
|
|
|
|
if (Task == NULL) |
|
|
return; |
|
|
while ((i < MAXNUMINST) && (TaskList[i] != Task)) |
|
|
i++; |
|
|
if (i >= MAXNUMINST) |
|
|
return; |
|
|
free(TaskList[i]); |
|
|
TaskList[i] = NULL; |
|
|
} |
|
|
|
|
|
BOOL GetVar() |
|
|
{ |
|
|
int i = 0; |
|
|
HANDLE Task = GetCurrentTask(); |
|
|
|
|
|
if (Task == NULL) |
|
|
return FALSE; |
|
|
while ((i < MAXNUMINST) && (TaskList[i] != Task)) |
|
|
i++; |
|
|
if (i >= MAXNUMINST) |
|
|
return FALSE; |
|
|
pvar = InstVar[i]; |
|
|
return TRUE; |
|
|
} |
|
|
|
|
|
#define GET_VAR() if (!GetVar()) return |
|
|
#endif |
|
| 99 |
|
|
| 100 |
/* |
/* |
| 101 |
This code makes lots of assumptions about the order in which Teraterm |
This code makes lots of assumptions about the order in which Teraterm |
| 157 |
|
|
| 158 |
static void PASCAL FAR TTXInit(PTTSet ts, PComVar cv) |
static void PASCAL FAR TTXInit(PTTSet ts, PComVar cv) |
| 159 |
{ |
{ |
|
#ifndef TERATERM32 |
|
|
if (!NewVar()) |
|
|
return; /* should be called first */ |
|
|
pvar->ts_SSH = &ts_SSH_settings; |
|
|
#endif |
|
| 160 |
pvar->settings = *pvar->ts_SSH; |
pvar->settings = *pvar->ts_SSH; |
| 161 |
pvar->ts = ts; |
pvar->ts = ts; |
| 162 |
pvar->cv = cv; |
pvar->cv = cv; |
| 614 |
|
|
| 615 |
void notify_established_secure_connection(PTInstVar pvar) |
void notify_established_secure_connection(PTInstVar pvar) |
| 616 |
{ |
{ |
|
#ifdef TERATERM32 |
|
| 617 |
// LoadIcon ではなく LoadImage を使うようにし、 |
// LoadIcon ではなく LoadImage を使うようにし、 |
| 618 |
// 16x16 のアイコンを明示的に取得するようにした (2006.8.9 maya) |
// 16x16 のアイコンを明示的に取得するようにした (2006.8.9 maya) |
| 619 |
if (SecureLargeIcon == NULL) { |
if (SecureLargeIcon == NULL) { |
| 638 |
PostMessage(pvar->NotificationWindow, WM_SETICON, ICON_SMALL, |
PostMessage(pvar->NotificationWindow, WM_SETICON, ICON_SMALL, |
| 639 |
(LPARAM) SecureSmallIcon); |
(LPARAM) SecureSmallIcon); |
| 640 |
} |
} |
|
#endif |
|
| 641 |
|
|
| 642 |
notify_verbose_message(pvar, "Entering secure mode", |
notify_verbose_message(pvar, "Entering secure mode", |
| 643 |
LOG_LEVEL_VERBOSE); |
LOG_LEVEL_VERBOSE); |
| 2128 |
static int get_keys_file_name(HWND parent, char FAR * buf, int bufsize, |
static int get_keys_file_name(HWND parent, char FAR * buf, int bufsize, |
| 2129 |
int readonly) |
int readonly) |
| 2130 |
{ |
{ |
|
#ifdef TERATERM32 |
|
| 2131 |
OPENFILENAME params; |
OPENFILENAME params; |
| 2132 |
char fullname_buf[2048] = "ssh_known_hosts"; |
char fullname_buf[2048] = "ssh_known_hosts"; |
| 2133 |
|
|
| 2171 |
|
|
| 2172 |
return 0; |
return 0; |
| 2173 |
} |
} |
|
#else |
|
|
return 0; |
|
|
#endif |
|
| 2174 |
} |
} |
| 2175 |
|
|
| 2176 |
static void choose_read_write_file(HWND dlg) |
static void choose_read_write_file(HWND dlg) |
| 3395 |
free(pvar->err_msg); |
free(pvar->err_msg); |
| 3396 |
pvar->err_msg = NULL; |
pvar->err_msg = NULL; |
| 3397 |
} |
} |
|
#ifndef TERATERM32 |
|
|
DelVar(); |
|
|
#endif |
|
| 3398 |
} |
} |
| 3399 |
|
|
| 3400 |
/* This record contains all the information that the extension forwards to the |
/* This record contains all the information that the extension forwards to the |
| 3422 |
TTXSetCommandLine |
TTXSetCommandLine |
| 3423 |
}; |
}; |
| 3424 |
|
|
|
#ifdef TERATERM32 |
|
| 3425 |
BOOL __declspec(dllexport) |
BOOL __declspec(dllexport) |
| 3426 |
PASCAL FAR TTXBind(WORD Version, TTXExports FAR * exports) |
PASCAL FAR TTXBind(WORD Version, TTXExports FAR * exports) |
| 3427 |
{ |
{ |
|
#else |
|
|
BOOL __export PASCAL FAR TTXBind(WORD Version, TTXExports FAR * exports) |
|
|
{ |
|
|
#endif |
|
| 3428 |
int size = sizeof(Exports) - sizeof(exports->size); |
int size = sizeof(Exports) - sizeof(exports->size); |
| 3429 |
/* do version checking if necessary */ |
/* do version checking if necessary */ |
| 3430 |
/* if (Version!=TTVERSION) return FALSE; */ |
/* if (Version!=TTVERSION) return FALSE; */ |
| 3437 |
return TRUE; |
return TRUE; |
| 3438 |
} |
} |
| 3439 |
|
|
|
#ifdef TERATERM32 |
|
| 3440 |
static HANDLE __mem_mapping = NULL; |
static HANDLE __mem_mapping = NULL; |
| 3441 |
|
|
| 3442 |
BOOL WINAPI DllMain(HANDLE hInstance, |
BOOL WINAPI DllMain(HANDLE hInstance, |
| 3485 |
} |
} |
| 3486 |
return TRUE; |
return TRUE; |
| 3487 |
} |
} |
|
#else |
|
|
#ifdef WATCOM |
|
|
#pragma off (unreferenced); |
|
|
#endif |
|
|
int CALLBACK LibMain(HANDLE hInstance, WORD wDataSegment, |
|
|
WORD wHeapSize, LPSTR lpszCmdLine) |
|
|
#ifdef WATCOM |
|
|
#pragma on (unreferenced); |
|
|
#endif |
|
|
{ |
|
|
int i; |
|
|
for (i = 0; i < MAXNUMINST; i++) |
|
|
TaskList[i] = NULL; |
|
|
hInst = hInstance; |
|
|
return (1); |
|
|
} |
|
|
#endif |
|