| 36 |
#include "fwdui.h" |
#include "fwdui.h" |
| 37 |
#include "util.h" |
#include "util.h" |
| 38 |
#include "ssh.h" |
#include "ssh.h" |
| 39 |
|
#include "ttcommon.h" |
| 40 |
|
|
| 41 |
#include <stdlib.h> |
#include <stdlib.h> |
| 42 |
#include <stdio.h> |
#include <stdio.h> |
| 892 |
} |
} |
| 893 |
} |
} |
| 894 |
|
|
|
int DetectComPorts(char *ComPortTable, int ComPortMax) |
|
|
{ |
|
|
HMODULE h; |
|
|
TCHAR devicesBuff[65535]; |
|
|
TCHAR *p; |
|
|
int comports = 0; |
|
|
int i, j, min; |
|
|
char s; |
|
|
|
|
|
if (((h = GetModuleHandle("kernel32.dll")) != NULL) && |
|
|
(GetProcAddress(h, "QueryDosDeviceA") != NULL) && |
|
|
(QueryDosDevice(NULL, devicesBuff, 65535) != 0)) { |
|
|
p = devicesBuff; |
|
|
while (*p != '\0') { |
|
|
if (strncmp(p, "COM", 3) == 0 && p[3] != '\0') |
|
|
ComPortTable[comports++] = atoi(p+3); |
|
|
if (comports >= ComPortMax) |
|
|
break; |
|
|
p += (strlen(p)+1); |
|
|
} |
|
|
|
|
|
for (i=0; i<comports-1; i++) { |
|
|
min = i; |
|
|
for (j=i+1; j<comports; j++) |
|
|
if (ComPortTable[min] > ComPortTable[j]) |
|
|
min = j; |
|
|
if (min != i) { |
|
|
s = ComPortTable[i]; |
|
|
ComPortTable[i] = ComPortTable[min]; |
|
|
ComPortTable[min] = s; |
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
#if 1 |
|
|
for (i=1; i<=ComPortMax; i++) { |
|
|
FILE *fp; |
|
|
char buf[10]; |
|
|
sprintf_s(buf, sizeof(buf), "\\\\.\\COM%d", i); |
|
|
if ((fp = fopen(buf, "r")) != NULL) { |
|
|
fclose(fp); |
|
|
ComPortTable[comports++] = i; |
|
|
} |
|
|
} |
|
|
#else |
|
|
comports = -1; |
|
|
#endif |
|
|
} |
|
|
|
|
|
return comports; |
|
|
} |
|
|
|
|
| 895 |
static BOOL CALLBACK TTXHostDlg(HWND dlg, UINT msg, WPARAM wParam, |
static BOOL CALLBACK TTXHostDlg(HWND dlg, UINT msg, WPARAM wParam, |
| 896 |
LPARAM lParam) |
LPARAM lParam) |
| 897 |
{ |
{ |
| 3857 |
|
|
| 3858 |
/* |
/* |
| 3859 |
* $Log: not supported by cvs2svn $ |
* $Log: not supported by cvs2svn $ |
| 3860 |
|
* Revision 1.57 2007/03/04 18:02:36 doda |
| 3861 |
|
* New connection$B$*$h$S(BSerial port setup$B%@%$%"%m%0$G!"MxMQ2DG=$J%7%j%"%k%]!<%H$N$_(B> |
| 3862 |
|
* $B$rI=<($9$k$h$&$K$7$?!#(B |
| 3863 |
|
* |
| 3864 |
* Revision 1.56 2007/01/31 13:15:08 maya |
* Revision 1.56 2007/01/31 13:15:08 maya |
| 3865 |
* 言語ファイルがないときに \0 が正しく認識されないバグを修正した。 |
* 言語ファイルがないときに \0 が正しく認識されないバグを修正した。 |
| 3866 |
* |
* |