Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ttxssh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2964 by doda, Sun Mar 4 18:02:36 2007 UTC revision 2965 by maya, Mon Mar 5 08:39:57 2007 UTC
# Line 36  SOFTWARE, EVEN IF ADVISED OF THE POSSIBI Line 36  SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
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>
# Line 891  static void enable_dlg_items(HWND dlg, i Line 892  static void enable_dlg_items(HWND dlg, i
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  {  {
# Line 3908  int CALLBACK LibMain(HANDLE hInstance, W Line 3857  int CALLBACK LibMain(HANDLE hInstance, W
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   *   *

Legend:
Removed from v.2964  
changed lines
  Added in v.2965

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26