[ttssh2-commit] [10522] 通信テストプログラム追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2023年 1月 21日 (土) 01:17:27 JST


Revision: 10522
          https://osdn.net/projects/ttssh2/scm/svn/commits/10522
Author:   zmatsuo
Date:     2023-01-21 01:17:27 +0900 (Sat, 21 Jan 2023)
Log Message:
-----------
通信テストプログラム追加

Modified Paths:
--------------
    branches/ttcomtester/tools/CMakeLists.txt

Added Paths:
-----------
    branches/ttcomtester/tools/ttcomtester/
    branches/ttcomtester/tools/ttcomtester/CMakeLists.txt
    branches/ttcomtester/tools/ttcomtester/README.md
    branches/ttcomtester/tools/ttcomtester/device_com.cpp
    branches/ttcomtester/tools/ttcomtester/deviceope.h
    branches/ttcomtester/tools/ttcomtester/main.cpp
    branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.sln
    branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj
    branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj.filters
    branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.sln
    branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj
    branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj.filters

-------------- next part --------------
Modified: branches/ttcomtester/tools/CMakeLists.txt
===================================================================
--- branches/ttcomtester/tools/CMakeLists.txt	2023-01-20 16:03:38 UTC (rev 10521)
+++ branches/ttcomtester/tools/CMakeLists.txt	2023-01-20 16:17:27 UTC (rev 10522)
@@ -15,3 +15,9 @@
   ttreg
   PROPERTIES FOLDER tools
 )
+
+add_subdirectory(ttcomtester)
+set_target_properties(
+  ttcomtester
+  PROPERTIES FOLDER tools
+)

Added: branches/ttcomtester/tools/ttcomtester/CMakeLists.txt
===================================================================
--- branches/ttcomtester/tools/ttcomtester/CMakeLists.txt	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/CMakeLists.txt	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,51 @@
+set(PACKAGE_NAME "ttcomtester")
+
+project(${PACKAGE_NAME})
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
+
+add_executable(
+  ${PACKAGE_NAME}
+  ../libs/getopt_mb_uni_src/getopt.c
+  ../libs/getopt_mb_uni_src/getopt.h
+  main.cpp
+  device_com.cpp
+  deviceope.h
+  #
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../teraterm/common/asprintf.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../teraterm/common/codeconv.h
+  )
+
+target_include_directories(
+  ${PACKAGE_NAME}
+  PRIVATE
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../teraterm/common
+  ${CMAKE_CURRENT_SOURCE_DIR}/../libs/getopt_mb_uni_src
+  )
+
+target_compile_options(
+  ${PACKAGE_NAME}
+  PRIVATE
+  -W4
+  )
+
+target_compile_definitions(
+  ${PACKAGE_NAME}
+  PRIVATE
+  STATIC_GETOPT
+  )
+
+target_link_libraries(
+  ${PACKAGE_NAME}
+  PRIVATE
+  ttpcmn
+  common_static
+  )
+
+if(MINGW)
+  target_link_options(
+    ${PACKAGE_NAME}
+    PRIVATE
+    -municode
+    )
+endif()

Added: branches/ttcomtester/tools/ttcomtester/README.md
===================================================================
--- branches/ttcomtester/tools/ttcomtester/README.md	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/README.md	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,60 @@
+# ttcomtester
+
+- 通信のテストを行うツール
+- コマンドラインプログラム
+  - cmd などから実行する
+
+## 動作確認
+
+- シリアルをクロス接続する
+  - 同一PCでも別PCでもok
+  - HHD Virtual Serail Ports の Local Bridges を作ってテストできる
+    - https://www.hhdsoftware.com/
+    - インストールしてある程度経過すると、制限あり無料版として継続使用できる
+- 受信側(例com1)を起動
+  - `./ttcomtester --device com1 --rts on --verbose` 起動
+    - `Rts Flow control` が 1 になっていることを確認
+  - `o` を押す
+    - 'open com=...'と表示、read待ちになる
+  - `r` を押すごとに、RTSラインをon/offできる
+- 送信側(例com2)を起動
+  - `./ttcomtester --device com2 --rts hs --verbose` 起動
+    - `Rts Flow control` が 2 になっていることを確認
+  - `o` を押す
+    - 'open com=...'と表示、read待ちになる
+  - `:` を押す
+    - send mode に切り替わる(send/command 切り替え)
+  - `:` 以外のキーを押すと、受信側に送信される
+- 受信側でも send mode に切り替えて相互に送受信できることを確認する
+- 送信側で `s` 32x1024byteデータ送信
+  - うまく送信できるはず
+
+## RTS/CTSハードフローテスト
+
+- 受信側は
+  - RTS/CTSフローは使用していない状態で起動している
+    - `--rts on` は RTSライン=1 で初期化する
+  - command mode で、`r` 毎に RTS=0/1 切り替えられる
+- フロー制御が行われているか確認
+  - 受信側でRTS=0/1を切り替えて、送信側から送信
+    - 送信側で send mode にして、適当なキーを押して送信
+  - 送信側から 32x1024byteのデータを送信、受信中にRTS=0/1を切り替え、
+
+## Tera Term で RTS/CTSテスト
+
+- 送信側を Tera Term に切り替える
+- パラメータは "baud=9600 parity=N data=8 stop=1", フロー RTS/CTS
+- 受信側が RTSライン=0 としていても Tera Term は送信してくる
+
+# 参考
+
+## RTS/CTS
+
+- [RTSをめぐる混乱](https://lipoyang.hatenablog.com/entry/20130530/p1)
+
+## HyperTerminal
+
+- HyperTerminal Free Trial for Windows 11, 10, 8, 7, Vista, and XP
+  - https://www.hilgraeve.com/hyperterminal-trial/
+  - A free 30 day trial
+

Added: branches/ttcomtester/tools/ttcomtester/device_com.cpp
===================================================================
--- branches/ttcomtester/tools/ttcomtester/device_com.cpp	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/device_com.cpp	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,473 @@
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <windows.h>
+#include <winioctl.h>
+#include <assert.h>
+
+#include "ttlib.h"
+
+#include "deviceope.h"
+
+typedef struct comdata_st {
+	wchar_t *port_name;
+	HANDLE h;
+	OVERLAPPED rol;
+	OVERLAPPED wol;
+	COMMPROP device_prop;
+	bool dcb_setted;
+	DCB dcb;
+	bool commtimeouts_setted;
+	COMMTIMEOUTS commtimeouts;
+	bool read_requested;
+	enum {
+		STATE_CLOSE,
+		STATE_OPEN,
+		STATE_ERROR,
+	} state;
+} comdata_t;
+
+static void *init(void)
+{
+	comdata_t *p = (comdata_t *)calloc(sizeof(*p), 1);
+	if (p == NULL) {
+		// no memory
+		return NULL;
+	}
+	p->dcb_setted = false;
+	p->commtimeouts_setted = false;
+	p->state = comdata_t::STATE_CLOSE;
+	return p;
+}
+
+static DWORD destroy(device_t *device)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	if (p->port_name != NULL) {
+		free(p->port_name);
+	}
+	free(p);
+
+	free(device);
+	return ERROR_SUCCESS;
+}
+
+#define CommInQueSize 8192
+#define CommOutQueSize 2048
+
+/**
+ *	\x83N\x83\x8D\x81[\x83Y
+ */
+static DWORD close(device_t *device)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	if (p == NULL) {
+		return ERROR_HANDLES_CLOSED;
+	}
+
+	if (p->state != comdata_t::STATE_OPEN) {
+		return ERROR_SUCCESS;
+	}
+
+	CloseHandle(p->h);
+	p->h = NULL;
+	CloseHandle(p->rol.hEvent);
+	p->rol.hEvent = NULL;
+	CloseHandle(p->wol.hEvent);
+	p->wol.hEvent = NULL;
+
+	p->state = comdata_t::STATE_CLOSE;
+
+	return ERROR_SUCCESS;
+}
+
+static DWORD open(device_t *device)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	HANDLE h;
+	h = CreateFileW(p->port_name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+					OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+	if (h == INVALID_HANDLE_VALUE) {
+		DWORD e = GetLastError();
+		return e;
+	}
+
+	BOOL r;
+	r = GetCommProperties(h, &p->device_prop);
+	assert(r == TRUE);
+	// p->device_prop.dwMaxTxQueue == 0 \x82̂Ƃ\xAB\x82́A\x8Dő\xE5\x92l\x82Ȃ\xB5(\x83h\x83\x89\x83C\x83o\x82\xAA\x82\xA4\x82܂\xAD\x82\xE2\x82\xC1\x82Ă\xAD\x82\xEA\x82\xE9\x82炵\x82\xA2)
+
+	DWORD DErr;
+	ClearCommError(h, &DErr, NULL);
+	SetupComm(h, CommInQueSize, CommOutQueSize);
+	PurgeComm(h, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);
+
+	if (p->commtimeouts_setted) {
+		r = SetCommTimeouts(h, &p->commtimeouts);
+		assert(r == TRUE);
+	}
+	if (p->dcb_setted) {
+		if (p->dcb.XonChar == p->dcb.XoffChar) {
+			p->dcb.XonChar = 0x11;
+			p->dcb.XoffChar = 0x13;
+		}
+		r = SetCommState(h, &p->dcb);
+		if (r == FALSE) {
+			close(device);
+			DWORD e = GetLastError();
+			return e;
+		}
+	}
+
+	SetCommMask(h, 0);
+	SetCommMask(h, EV_RXCHAR);
+
+	memset(&p->rol, 0, sizeof(p->rol));
+	p->rol.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+	assert(p->rol.hEvent != NULL);
+	memset(&p->wol, 0, sizeof(p->wol));
+	p->wol.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+	assert(p->wol.hEvent != NULL);
+	p->h = h;
+
+	p->state = comdata_t::STATE_OPEN;
+
+	return ERROR_SUCCESS;
+}
+
+// https://donnk.com/Nmura/soft/help015.html
+// http://nonsoft.la.coocan.jp/SoftSample/VC/SampleRs232c.html
+
+/**
+ *	\x83y\x83\x93\x83f\x83B\x83\x93\x83O\x8F\xF3\x91Ԃ\xF0\x83`\x83F\x83b\x83N\x82\xB7\x82\xE9
+ *
+ *	@param	readed				\x93ǂݍ\x9E\x82񂾃o\x83C\x83g\x90\x94
+ *								0	\x93ǂݍ\x9E\x82܂\xEA\x82Ă\xA2\x82Ȃ\xA2
+ *	@return	ERROR_SUCCESS		\x93ǂݍ\x9E\x82\xF1\x82\xBE (\x83y\x83\x93\x83f\x83B\x83\x93\x83O\x8F\xF3\x91ԏI\x97\xB9)
+ *	@return	ERROR_IO_PENDING	\x93ǂݍ\x9E\x82ݑ҂\xBF(\x90\xB3\x8F\xED,
+ *	@return	etc					\x83G\x83\x89\x81[
+ */
+static DWORD wait_read(device_t *device, size_t *readed)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	HANDLE h = p->h;
+
+	if (p->state != comdata_t::STATE_OPEN) {
+		return ERROR_NOT_READY;
+	}
+	if (p->read_requested == false) {
+		// \x83\x8A\x83N\x83G\x83X\x83g\x82\xB5\x82Ă\xA2\x82Ȃ\xA2\x82̂ɑ҂\xBF\x8F\xF3\x91ԂɂȂ\xC1\x82\xBD
+		return ERROR_INVALID_OPERATION;
+	}
+
+	DWORD dwMilliseconds = 0;
+	DWORD wait = WaitForSingleObject(p->rol.hEvent, dwMilliseconds);
+	if (wait == WAIT_TIMEOUT) {
+		// \x82܂\xBE\x8E\xF3\x90M\x82\xB5\x82Ă\xA2\x82Ȃ\xA2
+		*readed = 0;
+		return ERROR_IO_PENDING;
+	}
+	else if (wait == WAIT_OBJECT_0) {
+		// \x83C\x83x\x83\x93\x83g\x94\xAD\x90\xB6(\x8E\xF3\x90M\x82\xB5\x82\xBD/\x83G\x83\x89\x81[\x81c)
+		DWORD readed_;
+		BOOL b = GetOverlappedResult(h, &p->rol, &readed_, TRUE);
+		if (b) {
+			// \x93ǂݍ\x9E\x82߂\xBD
+			*readed = readed_;
+			p->read_requested = false;
+			return ERROR_SUCCESS;
+		}
+		else {
+			DWORD e = GetLastError();
+			p->state = comdata_t::STATE_ERROR;
+			*readed = 0;
+			return e;
+		}
+	}
+	else if (wait == WAIT_ABANDONED) {
+		// \x82ǂ\xF1\x82ȂƂ\xAB\x94\xAD\x90\xB6\x82\xB7\x82\xE9? event\x88ُ\xED?
+		p->state = comdata_t::STATE_ERROR;
+		*readed = 0;
+		return ERROR_INVALID_OPERATION;
+	}
+	else {
+		// WAIT_FAILED
+		p->state = comdata_t::STATE_ERROR;
+		*readed = 0;
+		DWORD e = GetLastError();
+		return e;
+	}
+#if 0
+	BOOL r = WaitCommEvent(h,&Evt, p->rol);
+	if (r == FALSE) {
+		// error
+		DWORD DErr = GetLastError();
+		if (DErr == ERROR_OPERATION_ABORTED) {
+			// USB com port is removed
+			printf("unpluged\n");
+			return ERROR_OPERATION_ABORTED;
+		}
+		// \x83N\x83\x8A\x83A\x82\xB5\x82Ă\xA2\x82\xA2\x82\xCC?
+		ClearCommError(h,&DErr,NULL);
+	}
+#endif
+}
+
+/**
+ *	\x83f\x81[\x83^\x93ǂݍ\x9E\x82݁A\x83u\x83\x8D\x83b\x83N\x82\xB5\x82Ȃ\xA2
+ *
+ *	@param	buf					\x93ǂݍ\x9E\x82ރA\x83h\x83\x8C\x83X
+ *								\x8C\xE3\x82œǂ܂\xEA\x82邩\x82\xE0\x82\xB5\x82\xEA\x82Ȃ\xA2\x82̂Œ\x8D\x88\xD3
+ *	@param	readed				\x93ǂݍ\x9E\x82񂾃o\x83C\x83g\x90\x94
+ *	@return	ERROR_SUCCESS		\x93ǂݍ\x9E\x82\xF1\x82\xBE
+ *								(readed = 0 \x82̏ꍇ\x82\xE0\x8Dl\x97\xB6\x82\xB7\x82邱\x82\xC6)
+ *	@return	ERROR_IO_PENDING	\x93ǂݍ\x9E\x82ݑ҂\xBF
+ *								wait_read() \x82Ŋ\xAE\x97\xB9\x82\xF0\x91҂\xC2
+ */
+static DWORD read(device_t *device, uint8_t *buf, size_t buf_len, size_t *readed)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	HANDLE h = p->h;
+	DWORD err = ERROR_SUCCESS;
+
+	if (p->state != comdata_t::STATE_OPEN) {
+		return ERROR_NOT_READY;
+	}
+	if (p->read_requested) {
+		// \x83G\x83\x89\x81[\x81A\x83\x8A\x83N\x83G\x83X\x83g\x92\x86
+		return ERROR_IO_PENDING;
+	}
+
+	DWORD readed_;
+	BOOL r = ReadFile(h, buf, (DWORD)buf_len, &readed_, &p->rol);
+	if (!r) {
+		*readed = 0;
+		err = GetLastError();
+		if (err == ERROR_IO_PENDING) {
+			p->read_requested = true;
+			return ERROR_IO_PENDING;
+		}
+		else {
+			// \x89\xBD\x82\xA9\x83G\x83\x89\x81[
+			p->state = comdata_t::STATE_ERROR;
+			p->read_requested = false;
+			readed_ = 0;
+			return err;
+		}
+	}
+
+	*readed = readed_;
+	return ERROR_SUCCESS;
+}
+
+static DWORD wait_write(device_t *device, size_t *writed)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	HANDLE h = p->h;
+
+	if (p->state != comdata_t::STATE_OPEN) {
+		return ERROR_NOT_READY;
+	}
+#if 0
+	if (p->read_requested == false) {
+		// \x83\x8A\x83N\x83G\x83X\x83g\x82\xB5\x82Ă\xA2\x82Ȃ\xA2\x82̂ɑ҂\xBF\x8F\xF3\x91ԂɂȂ\xC1\x82\xBD
+		return ERROR_INVALID_OPERATION;
+	}
+#endif
+
+	// \x83C\x83x\x83\x93\x83g\x94\xAD\x90\xB6(\x8F\x91\x82\xAB\x8D\x9E\x82݊\xAE\x97\xB9/\x83G\x83\x89\x81[\x81c)
+	DWORD writed_;
+	DWORD r = GetOverlappedResult(h, &p->wol, &writed_, FALSE);
+	if (r) {
+		printf("GetOverlappedResult %d\n", r);
+		*writed = writed_;
+		return ERROR_IO_PENDING;
+		//return ERROR_SUCCESS;
+	}
+	else {
+		DWORD e = GetLastError();
+		p->state = comdata_t::STATE_ERROR;
+		*writed = 0;
+		return e;
+	}
+}
+
+/**
+ *	\x8F\x91\x82\xAB\x8D\x9E\x82\xDD
+ *		TODO
+ *			- overlap\x82ł\xBF\x82\xE1\x82\xF1\x82Ɠ\xAE\x82\xA2\x82Ă\xA2\x82\xE9?\x83`\x83F\x83b\x83N
+ *			- \x8F\x91\x82\xAB\x8D\x9E\x82݊\xAE\x97\xB9\x83`\x83F\x83b\x83N\x82\xF0\x8D\xEC\x82\xE9
+ *	@return	ERROR_SUCCESS		\x8F\x91\x82\xAB\x8D\x9E\x82݊\xAE\x97\xB9
+ *	@return	ERROR_IO_PENDING	\x8F\x91\x82\xAB\x8D\x9E\x82ݒ\x86 (\x83V\x83\x8A\x83A\x83\x8B\x82̎\x9E\x82͔\xAD\x90\xB6\x82\xB5\x82Ȃ\xA2)
+ *								wait_write() \x82Ŋ\xAE\x97\xB9\x82\xF0\x91҂\xC2 (\x96\xA2\x83e\x83X\x83g)
+ */
+// http://www.ys-labo.com/BCB/2007/070512%20RS232C%20zenpan.html
+// https://learn.microsoft.com/en-us/previous-versions/ms810467(v=msdn.10)?redirectedfrom=MSDN
+static DWORD write(device_t *device, const void *buf, size_t buf_len, size_t *writed)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	HANDLE h = p->h;
+	DWORD err = ERROR_SUCCESS;
+
+	if (p->state != comdata_t::STATE_OPEN) {
+		return ERROR_NOT_READY;
+	}
+
+	if (buf_len == 0) {
+		return ERROR_SUCCESS;
+	}
+
+#if 0
+	DWORD Errors;
+	COMSTAT Comstat;
+	ClearCommError(h, &Errors, &Comstat);
+	if (Comstat.fCtsHold != 0) {
+		return ERROR_SUCCESS;
+	}
+#endif
+
+	DWORD modem_state;
+	GetCommModemStatus(h, &modem_state);
+	if ((modem_state & MS_CTS_ON) == 0) {
+		*writed = 0;
+		return ERROR_SUCCESS;
+	}
+
+#if 0
+	// \x91\x97\x90M\x83T\x83C\x83Y\x82𒲐\xAE
+	if (buf_len > Comstat.cbOutQue) {
+		buf_len = Comstat.cbOutQue;
+	}
+#endif
+
+	DWORD writed_;
+	BOOL r = WriteFile(h, buf, (DWORD)buf_len, &writed_, &p->wol);
+	if (!r) {
+		err = GetLastError();
+		if (err == ERROR_IO_PENDING) {
+#if 1
+			const DWORD timeout_ms = INFINITE;
+			DWORD wait = WaitForSingleObject(p->wol.hEvent, timeout_ms);
+			if (wait == WAIT_TIMEOUT) {
+				// \x83u\x83\x8D\x83b\x83N\x82\xB7\x82\xE9\x82̂Ŕ\xAD\x90\xB6\x82\xB5\x82Ȃ\xA2
+				;
+			}
+			else if (wait == WAIT_OBJECT_0) {
+				// \x83C\x83x\x83\x93\x83g\x94\xAD\x90\xB6(\x8F\x91\x82\xAB\x8D\x9E\x82݊\xAE\x97\xB9/\x83G\x83\x89\x81[\x81c)
+				r = GetOverlappedResult(h, &p->wol, &writed_, FALSE);
+				if (r) {
+					// \x8F\x91\x82\xAB\x8D\x9E\x82݊\xAE\x97\xB9
+					*writed = writed_;
+					return ERROR_SUCCESS;
+				}
+				else {
+					err = GetLastError();
+					p->state = comdata_t::STATE_ERROR;
+					*writed = 0;
+					return err;
+				}
+			}
+			else if (wait == WAIT_ABANDONED) {
+				// \x82ǂ\xF1\x82ȂƂ\xAB\x94\xAD\x90\xB6\x82\xB7\x82\xE9? event\x88ُ\xED?
+				p->state = comdata_t::STATE_ERROR;
+				*writed = 0;
+				return ERROR_INVALID_OPERATION;
+			}
+			else {
+				// WAIT_FAILED
+				p->state = comdata_t::STATE_ERROR;
+				*writed = 0;
+				DWORD e = GetLastError();
+				return e;
+			}
+#else
+			*writed = buf_len;
+			return ERROR_SUCCESS;
+#endif
+		}
+		else {
+			p->state = comdata_t::STATE_ERROR;
+			*writed = 0;
+			DWORD e = GetLastError();
+			return e;
+		}
+	}
+	if (writed != NULL) {
+		*writed = writed_;
+	}
+	return err;
+}
+
+static DWORD ctrl(device_t *device, device_ctrl_request request, ...)
+{
+	comdata_t *p = (comdata_t *)device->private_data;
+	va_list ap;
+	va_start(ap, request);
+	DWORD retval = ERROR_CALL_NOT_IMPLEMENTED;
+
+	switch (request) {
+	case SET_PORT_NAME: {
+		const wchar_t *s = (wchar_t *)va_arg(ap, wchar_t *);
+		if (p->port_name != NULL) {
+			free(p->port_name);
+		}
+		p->port_name = _wcsdup(s);
+		retval = ERROR_SUCCESS;
+		break;
+	}
+	case GET_RAW_HANDLE: {
+		HANDLE *handle = va_arg(ap, HANDLE *);
+		*handle = p->h;
+		retval = ERROR_SUCCESS;
+		break;
+	}
+	case SET_COM_DCB: {
+		DCB *dcb = va_arg(ap, DCB *);
+		p->dcb = *dcb;
+		p->dcb_setted = true;
+		retval = ERROR_SUCCESS;
+		break;
+	}
+	case SET_COM_TIMEOUTS: {
+		COMMTIMEOUTS *commtimeouts = va_arg(ap, COMMTIMEOUTS *);
+		p->commtimeouts = *commtimeouts;
+		p->commtimeouts_setted = true;
+		retval = ERROR_SUCCESS;
+		break;
+	}
+	}
+
+	va_end(ap);
+	return retval;
+}
+
+static const device_ope ope = {
+	destroy,
+	open,
+	close,
+	read,
+	wait_read,
+	write,
+	wait_write,
+	ctrl,
+};
+
+/**
+ *	com\x83|\x81[\x83g\x83f\x83o\x83C\x83X\x8D쐬
+ */
+DWORD com_init(device_t **device)
+{
+	device_t *dev = (device_t *)calloc(sizeof(*dev), 1);
+	if (dev == NULL) {
+		return ERROR_NOT_ENOUGH_MEMORY;
+	}
+	void *data = init();
+	if (data == NULL) {
+		free(dev);
+		return ERROR_NOT_ENOUGH_MEMORY;
+	}
+	dev->ope = &ope;
+	dev->private_data = data;
+	*device = dev;
+	return ERROR_SUCCESS;
+}

Added: branches/ttcomtester/tools/ttcomtester/deviceope.h
===================================================================
--- branches/ttcomtester/tools/ttcomtester/deviceope.h	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/deviceope.h	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,90 @@
+/*
+ * (C) 2023- TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <windows.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+	SET_PORT_NAME,
+	GET_RAW_HANDLE,
+	SET_COM_DCB,
+	SET_COM_TIMEOUTS,
+} device_ctrl_request;
+
+typedef struct device {
+	struct device_ope_st const *ope;
+	void *private_data;
+} device_t;
+
+typedef struct device_ope_st {
+	/**
+	 *	\x8Eg\x97p\x82\xB5\x82Ȃ\xAD\x82Ȃ\xC1\x82\xBD\x82\xE7\x83R\x81[\x83\x8B\x82\xB7\x82\xE9
+	 */
+	DWORD (*destroy)(device_t *device);
+	/**
+	 *	\x83I\x81[\x83v\x83\x93
+	 *	\x95K\x82\xB8 close() \x82\xB7\x82邱\x82\xC6
+	 */
+	DWORD (*open)(device_t *device);
+	/**
+	 *	close()\x82\xB7\x82\xE9\x82ƍēxopen()\x82ł\xAB\x82\xE9
+	 */
+	DWORD (*close)(device_t *device);
+	/**
+	 *	read() \x82œǂݍ\x9E\x82݃\x8A\x83N\x83G\x83X\x83g\x82\xF0\x8Ds\x82\xA4\x81A
+	 *		\x82\xB7\x82\xAE\x93ǂ߂邩\x82\xE0\x82\xB5\x82\xEA\x82Ȃ\xA2\x82\xB5
+	 *		\x83y\x83\x93\x83f\x83B\x83\x93\x83O\x82\xB3\x82\xEA\x82Č\xE3\x82œǂݍ\x9E\x82߂邩\x82\xE0\x82\xB5\x82\xEA\x82Ȃ\xA2
+	 */
+	DWORD (*read)(device_t *device, uint8_t *buf, size_t buf_len, size_t *readed);
+
+	/**
+	 *	read() \x82̃\x8A\x83N\x83G\x83X\x83g\x82\xAA\x8A\xAE\x97\xB9\x82\xB5\x82\xBD\x82\xA9\x83`\x83F\x83b\x83N\x82\xB7\x82\xE9
+	 *		\x93ǂ߂\xEA\x82\xCEreaded\x82Ƀo\x83C\x83g\x90\x94\x82\xAA\x93\xFC\x82\xC1\x82Ă\xA2\x82\xE9
+	 *		\x83f\x81[\x83^\x82\xCDread()\x8E\x9E\x82̃A\x83h\x83\x8C\x83X\x82ɓ\xFC\x82\xC1\x82Ă\xA2\x82\xE9
+	 */
+	DWORD (*wait_read)(device_t *device, size_t *readed);
+
+	DWORD (*write)(device_t *device, const void *buf, size_t buf_len, size_t *writed);
+	DWORD (*wait_write)(device_t *device, size_t *writed);
+
+	/**
+	 *	\x83f\x83o\x83C\x83X\x82\xB2\x82Ƃ̐\xA7\x8C\xE4
+	 */
+	DWORD (*ctrl)(device_t *device, device_ctrl_request request, ...);
+} device_ope;
+
+
+DWORD com_init(device_t **device);
+
+#ifdef __cplusplus
+}
+#endif

Added: branches/ttcomtester/tools/ttcomtester/main.cpp
===================================================================
--- branches/ttcomtester/tools/ttcomtester/main.cpp	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/main.cpp	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,436 @@
+
+#include <stdio.h>
+#include <locale.h>
+#include <windows.h>
+#include <stdint.h>
+#include <conio.h>
+#include <crtdbg.h>
+
+#include "getopt.h"
+
+#include "asprintf.h"
+#include "codeconv.h"
+#include "win32helper.h"
+
+#include "deviceope.h"
+
+static void usage()
+{
+	printf(
+		"ttcomtester [option]\n"
+		"  -h\n"
+		"  -v\n"
+		"  -i ttcomtester.ini\n"
+		);
+}
+
+static void key_usage(void)
+{
+	printf(
+		"key:\n"
+		"   command mode\n"
+		"':'	go send mode\n"
+		"'o'	open\n"
+		"'c'	close\n"
+		"'q'	quit\n"
+		"'r'	RTS 0/1\n"
+		"'d'	DTR 0/1\n"
+		"'x'	XON/XOFF\n"
+		"'e'	echo on/off\n"
+		"'s'    send big data\n"
+		"   send mode\n"
+		"':'	go command mode\n"
+		);
+}
+
+void DispErrorStr(wchar_t *str, DWORD err)
+{
+	wchar_t *buf;
+	DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM |
+		FORMAT_MESSAGE_ALLOCATE_BUFFER |
+		FORMAT_MESSAGE_IGNORE_INSERTS;
+	FormatMessageW(flags, 0, err, 0, (LPWSTR) & buf, 0, NULL);
+	wprintf(L"%s %d=%s", str, err, buf);
+	LocalFree(buf);
+}
+
+void dump(const uint8_t *buf, size_t len)
+{
+	if (len == 0) {
+		return;
+	}
+	printf("%ld :", (long)len);
+	for (size_t i = 0; i < len; i++) {
+		printf("%02x ", *buf++);
+	}
+	printf("\n");
+}
+
+void dumpDCB(const DCB *p)
+{
+	printf("sizeof(DCB)                     %d\n", p->DCBlength);
+	printf("Baudrate at which running       %d\n", p->BaudRate);
+	printf("Binary Mode (skip EOF check)    %d\n", p->fBinary);
+	printf("Enable parity checking          %d\n", p->fParity);
+	printf("CTS handshaking on output       %d\n", p->fOutxCtsFlow);
+	printf("DSR handshaking on output       %d\n", p->fOutxDsrFlow);
+	printf("DTR Flow control                %d\n", p->fDtrControl);
+	printf("DSR Sensitivity                 %d\n", p->fDsrSensitivity);
+	printf("Continue TX when Xoff sent      %d\n", p->fTXContinueOnXoff);
+	printf("Enable output X-ON/X-OFF        %d\n", p->fOutX);
+	printf("Enable input X-ON/X-OFF         %d\n", p->fInX);
+	printf("Enable Err Replacement          %d\n", p->fErrorChar);
+	printf("Enable Null stripping           %d\n", p->fNull);
+	printf("Rts Flow control                %d\n", p->fRtsControl);
+	printf("Abort all reads and writes on Error %d\n", p->fAbortOnError);
+	printf("Reserved                        %d\n", p->fDummy2);
+	printf("Not currently used              %d\n", p->wReserved);
+	printf("Transmit X-ON threshold         %d\n", p->XonLim);
+	printf("Transmit X-OFF threshold        %d\n", p->XoffLim);
+	printf("Number of bits/byte, 4-8        %d\n", p->ByteSize);
+	printf("0-4=None,Odd,Even,Mark,Space    %d\n", p->Parity);
+	printf("0,1,2 = 1, 1.5, 2               %d\n", p->StopBits);
+	printf("Tx and Rx X-ON character        %d\n", p->XonChar);
+	printf("Tx and Rx X-OFF character       %d\n", p->XoffChar);
+	printf("Error replacement char          %d\n", p->ErrorChar);
+	printf("End of Input character          %d\n", p->EofChar);
+	printf("Received Event character        %d\n", p->EvtChar);
+	printf("Fill for now.                   %d\n", p->wReserved1);
+}
+
+
+int wmain(int argc, wchar_t *argv[])
+{
+	setlocale(LC_ALL, "");
+#ifdef _DEBUG
+	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+	//_CrtSetBreakAlloc(269);
+#endif
+
+	bool verbose = false;
+	wchar_t *ini_base = L"ttcomtester.ini";
+	int arg_rts = RTS_CONTROL_DISABLE;
+	wchar_t *prog = argv[0];
+	wchar_t *arg_device_name = NULL;
+
+	static const struct option_w long_options[] = {
+		{L"help", no_argument, NULL, L'h'},
+		{L"verbose", no_argument, NULL, L'v'},
+		{L"inifile", required_argument, NULL, L'i'},
+		{L"rts", required_argument, NULL, L'r'},
+		{L"device", required_argument, NULL, L'd'},
+		{}
+	};
+
+
+	opterr = 0;
+    while(1) {
+		int c = getopt_long_w(argc, argv, L"vhi:r:", long_options, NULL);
+        if(c == -1) break;
+
+        switch (c)
+        {
+		case L'h':
+		case L'?':
+			usage();
+			return 0;
+			break;
+		case L'v':
+			verbose = true;
+			break;
+		case L'i':
+			ini_base = optarg_w;
+			break;
+		case L'r': {
+			if (wcscmp(optarg_w, L"off") == 0) {
+				arg_rts = RTS_CONTROL_DISABLE;
+			} else if (wcscmp(optarg_w, L"on") == 0) {
+				arg_rts = RTS_CONTROL_ENABLE;
+			} else if (wcscmp(optarg_w, L"hs") == 0) {
+				arg_rts = RTS_CONTROL_HANDSHAKE;
+			} else if (wcscmp(optarg_w, L"on") == 0) {
+				arg_rts = RTS_CONTROL_TOGGLE;
+			} else {
+				printf("check rts option");
+				exit(1);
+			}
+			break;
+		}
+		case L'd': {
+			arg_device_name = _wcsdup(optarg_w);
+			break;
+		}
+		default:
+			usage();
+			return 0;
+			break;
+		}
+    }
+
+	wchar_t *ini_path = _wcsdup(prog);
+	wchar_t *p = wcsrchr(ini_path, '\\');
+	*p = 0;
+	wchar_t *ini;
+	aswprintf(&ini, L"%s\\%s", ini_path, ini_base);
+	wprintf(L"ini='%s'\n", ini);
+
+	wchar_t *ini_device_name;
+	hGetPrivateProfileStringW(L"ttcomtester", L"device", L"com1", ini, &ini_device_name);
+	wchar_t *com_param;
+	wchar_t *com_param_default = L"baud=9600 parity=N data=8 stop=1";
+	//wchar_t *com_param_default = L"baud=9600 parity=N data=8 stop=1 rts=hs";		// error?
+	hGetPrivateProfileStringW(L"ttcomtester", L"com_param", com_param_default, ini, &com_param);
+	free(ini);
+	ini = nullptr;
+	free(ini_path);
+	ini_path = nullptr;
+
+	const wchar_t *device_name = arg_device_name;
+	if (arg_device_name == NULL) {
+		device_name = ini_device_name;
+	}
+	device_t *dev;
+	com_init(&dev);
+
+	device_ope const *ope = dev->ope;
+	ope->ctrl(dev, SET_PORT_NAME, device_name);
+
+	DCB dcb;
+	memset(&dcb, 0, sizeof(dcb));	// 100% build\x82\xB5\x82Ă\xAD\x82\xEA\x82Ȃ\xA2\x82悤\x82\xBE
+	dcb.DCBlength = sizeof(dcb);
+	BOOL r = BuildCommDCBW(com_param, &dcb);
+	dcb.fRtsControl = arg_rts;
+	if (r == FALSE) {
+		DWORD e = GetLastError();
+		wchar_t b[128];
+		swprintf_s(b, _countof(b), L"BuildCommDCBW('%s')", com_param);
+		DispErrorStr(b, e);
+		goto finish;
+	}
+	if (verbose) {
+		printf("param='%ls'\n", com_param);
+		dumpDCB(&dcb);
+	}
+	ope->ctrl(dev, SET_COM_DCB, &dcb);
+
+	printf("':'		switch mode\n");
+	bool quit_flag = false;
+	bool receive_pending = false;
+	bool command_mode = true;
+	bool rts = true;
+	bool xon = true;
+	bool dtr = true;
+	bool echo_mode = false;
+	enum {
+		STATE_CLOSE,
+		STATE_OPEN,
+		STATE_ERROR,
+	} state = STATE_CLOSE;
+	while (!quit_flag) {
+		if (_kbhit() == 0) {
+			// \x83L\x81[\x82\xAA\x89\x9F\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2
+			Sleep(1);
+		}
+		else {
+			int c = _getch();
+			if (command_mode) {
+				switch (c) {
+				case 'o': {
+					printf("open com='%ls'\n", device_name);
+					DWORD e = ope->open(dev);
+					if (e == ERROR_SUCCESS) {
+						state = STATE_OPEN;
+					}
+					else {
+						DispErrorStr(L"open()", e);
+					}
+					break;
+				}
+				case 'c': {
+					printf("close\n");
+					ope->close(dev);
+					state = STATE_CLOSE;
+					break;
+				}
+				case 's': {
+					size_t send_len = 32*1024;
+					printf("send big data %zu bytes\n", send_len);
+					unsigned char *send_data = (unsigned char* )malloc(send_len);
+					for(size_t i = 0; i < send_len; i++) {
+						send_data[i] = (unsigned char)i;
+					}
+					size_t sended_len;
+					r = ope->write(dev, send_data, send_len, &sended_len);
+					if (r == ERROR_SUCCESS) {
+						printf("sened\n");
+					}
+					else {
+						size_t sended_len_total = sended_len;
+						while(1) {
+							r = ope->wait_write(dev, &sended_len);
+#if 0
+							if (r == ERROR_SUCCESS) {
+								printf("sened\n");
+							}
+#endif
+							sended_len_total += sended_len;
+							printf("send size %zu(%zu)/%zu\n", sended_len_total, sended_len, send_len);
+							Sleep(100);
+						}
+					}
+					free(send_data);
+					break;
+				}
+				case 'q': {
+					printf("quit\n");
+					quit_flag = true;
+					break;
+				}
+				case 'r': {
+					HANDLE h;
+					ope->ctrl(dev, GET_RAW_HANDLE, &h);
+					BOOL b;
+					if (rts) {
+						rts = false;
+						b = EscapeCommFunction(h, CLRRTS);
+						printf("RTS=0, %d\n", b);
+					}
+					else {
+						rts = true;
+						b = EscapeCommFunction(h, SETRTS);
+						printf("RTS=1, %d\n", b);
+					}
+					break;
+				}
+				case 'd': {
+					HANDLE h;
+					ope->ctrl(dev, GET_RAW_HANDLE, &h);
+					BOOL b;
+					if (dtr) {
+						dtr = false;
+						b = EscapeCommFunction(h, CLRDTR);
+						printf("DTR=0, %d\n", b);
+					}
+					else {
+						dtr = true;
+						b = EscapeCommFunction(h, SETDTR);
+						printf("DTR=1, %d\n", b);
+					}
+					break;
+				}
+				case 'x': {
+					HANDLE h;
+					ope->ctrl(dev, GET_RAW_HANDLE, &h);
+					BOOL b;
+					if (xon) {
+						xon = false;
+						b = EscapeCommFunction(h, SETXOFF);
+						printf("XON=0, %d\n", b);
+					}
+					else {
+						xon = true;
+						b = EscapeCommFunction(h, SETXON);
+						printf("XON=1, %d\n", b);
+					}
+					break;
+				}
+				case 'e': {
+					if (echo_mode) {
+						printf("echo off\n");
+						echo_mode = false;
+					}
+					else {
+						printf("echo on\n");
+						echo_mode = true;
+					}
+					break;
+				}
+				case ':': {
+					printf("\nsend mode\n");
+					command_mode = false;
+					break;
+				}
+				default:
+					printf("unknown command '%c'\n", c);
+					key_usage();
+					break;
+				}
+			}
+			else {
+				if (c == ':') {
+					printf("\ncommand mode\n");
+					command_mode = true;
+				}
+				else {
+					if (state == STATE_OPEN) {
+						char send_text[2];
+						size_t sended_len;
+						send_text[0] = (char)c;
+						DWORD e = ope->write(dev, send_text, 1, &sended_len);
+						if (e == ERROR_SUCCESS) {
+							printf("send %02x, %zu byte\n", c, sended_len);
+						}
+						else {
+							DispErrorStr(L"write() error", e);
+							state = STATE_ERROR;
+						}
+					}
+				}
+			}
+		}
+
+		uint8_t buf[1024];
+		size_t len = 0;
+		DWORD e;
+		if (state != STATE_OPEN) {
+			Sleep(1);
+		}
+		else if (receive_pending == false) {
+			e = ope->read(dev, buf, sizeof(buf), &len);
+			if (e == ERROR_SUCCESS) {
+				if(len > 0) {
+					printf("read:\n");
+					dump(buf, len);
+				}
+			}
+			else if (e == ERROR_IO_PENDING) {
+				printf("read pending\n");
+				receive_pending = true;
+			}
+			else {
+				DispErrorStr(L"read() error", e);
+				state = STATE_ERROR;
+			}
+		}
+		else {
+			e = ope->wait_read(dev, &len);
+			if (e == ERROR_IO_PENDING) {
+				// \x82܂\xBE\x91҂\xBF\x8F\xF3\x91\xD4
+				;
+			}
+			else if (e == ERROR_SUCCESS) {
+				printf("wait_read:\n");
+				dump(buf, len);
+				receive_pending = false;
+			}
+			else {
+				DispErrorStr(L"wait_read", e);
+				state = STATE_ERROR;
+				receive_pending = false;
+			}
+		}
+
+		if (echo_mode) {
+			if (len > 0){
+				printf("echo\n");
+				ope->write(dev, buf, len, NULL);
+			}
+		}
+	}
+
+finish:
+	free(ini_device_name);
+	free(arg_device_name);
+	free(com_param);
+	return 0;
+}

Added: branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.sln
===================================================================
--- branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.sln	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.sln	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.33214.272
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ttcomtester.v16", "ttcomtester.v16.vcxproj", "{73AB0B34-8188-4AE6-BEE4-EE85732B806C}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Debug|x86.ActiveCfg = Debug|Win32
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Debug|x86.Build.0 = Debug|Win32
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Release|x86.ActiveCfg = Release|Win32
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {5E68F57F-01E7-4C19-BB90-DC1AFEE479CA}
+	EndGlobalSection
+EndGlobal

Added: branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj
===================================================================
--- branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+    <ProjectGuid>{73AB0B34-8188-4AE6-BEE4-EE85732B806C}</ProjectGuid>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v142</PlatformToolset>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v142</PlatformToolset>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir>$(Configuration)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir>$(Configuration)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
+      <HeaderFileName />
+    </Midl>
+    <ClCompile>
+      <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\libs\getopt_mb_uni_src;$(SolutionDir)..\..\teraterm\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>STATIC_GETOPT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <ResourceCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <AdditionalLibraryDirectories>$(SolutionDir)..\..\teraterm\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>common_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
+      <HeaderFileName />
+    </Midl>
+    <ClCompile>
+      <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\libs\getopt_mb_uni_src;$(SolutionDir)..\..\teraterm\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>STATIC_GETOPT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <ResourceCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <AdditionalLibraryDirectories>$(SolutionDir)..\..\teraterm\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>common_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\libs\getopt_mb_uni_src\getopt.c" />
+    <ClCompile Include="device_com.cpp" />
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\libs\getopt_mb_uni_src\getopt.h" />
+    <ClInclude Include="deviceope.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

Added: branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj.filters
===================================================================
--- branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj.filters	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/ttcomtester.v16.vcxproj.filters	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="getopt">
+      <UniqueIdentifier>{0aa971de-f4a9-4de9-af59-ab72371cae0d}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\libs\getopt_mb_uni_src\getopt.h">
+      <Filter>getopt</Filter>
+    </ClInclude>
+    <ClInclude Include="deviceope.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="device_com.cpp" />
+    <ClCompile Include="main.cpp" />
+    <ClCompile Include="..\libs\getopt_mb_uni_src\getopt.c" />
+  </ItemGroup>
+</Project>
\ No newline at end of file

Added: branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.sln
===================================================================
--- branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.sln	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.sln	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,23 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ttcomtester.v17", "ttcomtester.v17.vcxproj", "{73AB0B34-8188-4AE6-BEE4-EE85732B806C}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Debug|x86.ActiveCfg = Debug|Win32
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Debug|x86.Build.0 = Debug|Win32
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Release|x86.ActiveCfg = Release|Win32
+		{73AB0B34-8188-4AE6-BEE4-EE85732B806C}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {5E68F57F-01E7-4C19-BB90-DC1AFEE479CA}
+	EndGlobalSection
+EndGlobal

Added: branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj
===================================================================
--- branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+    <ProjectGuid>{73AB0B34-8188-4AE6-BEE4-EE85732B806C}</ProjectGuid>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v143</PlatformToolset>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v143</PlatformToolset>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir>$(Configuration)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir>$(Configuration)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
+      <HeaderFileName />
+    </Midl>
+    <ClCompile>
+      <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\libs\getopt_mb_uni_src;$(SolutionDir)..\..\teraterm\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>STATIC_GETOPT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <ResourceCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <AdditionalLibraryDirectories>$(SolutionDir)..\..\teraterm\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>common_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
+      <HeaderFileName />
+    </Midl>
+    <ClCompile>
+      <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\libs\getopt_mb_uni_src;$(SolutionDir)..\..\teraterm\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>STATIC_GETOPT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <ResourceCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <AdditionalLibraryDirectories>$(SolutionDir)..\..\teraterm\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>common_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\libs\getopt_mb_uni_src\getopt.c" />
+    <ClCompile Include="device_com.cpp" />
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\libs\getopt_mb_uni_src\getopt.h" />
+    <ClInclude Include="deviceope.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file

Added: branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj.filters
===================================================================
--- branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj.filters	                        (rev 0)
+++ branches/ttcomtester/tools/ttcomtester/ttcomtester.v17.vcxproj.filters	2023-01-20 16:17:27 UTC (rev 10522)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="getopt">
+      <UniqueIdentifier>{0aa971de-f4a9-4de9-af59-ab72371cae0d}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\libs\getopt_mb_uni_src\getopt.h">
+      <Filter>getopt</Filter>
+    </ClInclude>
+    <ClInclude Include="deviceope.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="device_com.cpp" />
+    <ClCompile Include="main.cpp" />
+    <ClCompile Include="..\libs\getopt_mb_uni_src\getopt.c" />
+  </ItemGroup>
+</Project>
\ No newline at end of file


ttssh2-commit メーリングリストの案内
Back to archive index