<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
   <channel>
      <title>UsefullCode.net</title>
      <link>http://www.usefullcode.net/</link>
      <description>Visual Studio 2005での開発者向けに便利なソースコードを提供
This site provide you with useful source codes under &apos;USEFULLCODE license&apos;.</description>
      <language>ja</language>
      <copyright>Copyright 2007</copyright>
      <lastBuildDate>Thu, 05 Apr 2007 00:05:51 +0900</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>Vistaのバグ（その6） Windows Updateがきちんと動いていない！</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/04/04/vista6_1.gif" rel="lightbox"><img alt="vista6_1.gif" src="http://www.usefullcode.net/2007/04/04/vista6_1-thumb.gif" width="400" height="422" align="left" /></a>
左の図は私のPCでのWindows Updateの更新履歴を示したものだ。この図を見て何か気がつくことはないだろうか？<br>
よく見ると「MSXML 4.0 SP2 セキュリティ更新プログラム（KB927978）」と「MSXML 4.0 SP2 セキュリティ更新プログラム（925672）」という項目が何度もインストールされている。本来であれば1度だけインストールすればいいものを何度もインストールしているのだ。
<br clear=left>

<a href="http://www.usefullcode.net/2007/04/05/vista6_2.gif" rel="lightbox"><img alt="vista6_2.gif" src="http://www.usefullcode.net/2007/04/05/vista6_2-thumb.gif" width="400" height="277" align="left" /></a>
また、インストールするたびにCドライブのルートに新しいフォルダを作成して「msxml4-KB927978-enu.log」というファイルなどを作成する。この図の場合は一度インストールした後の状態なのでフォルダが2つ作られているだけだが、10回インストールした後であれば20個ものフォルダとファイルが作られることになる。
<br clear=left>

<a href="http://www.usefullcode.net/2007/04/05/vista6_3.gif" rel="lightbox"><img alt="vista6_3.gif" src="http://www.usefullcode.net/2007/04/05/vista6_3-thumb.gif" width="400" height="275" align="left" /></a>
これらの更新プログラムが何度もインストールされないようにするには、Windows Updateの画面から「利用可能な更新プログラムを表示します」をクリックする。
<br clear=left>

<a href="http://www.usefullcode.net/2007/04/05/vista6_4.gif" rel="lightbox"><img alt="vista6_4.gif" src="http://www.usefullcode.net/2007/04/05/vista6_4-thumb.gif" width="400" height="275" align="left" /></a>
そしてチェックが入っている「MSXML 4.0 SP2 セキュリティ更新プログラム（KB927978）」という項目の上で右クリックをして現れたメニューから「更新プログラムの非表示」を選択する。
<br clear=left>

<a href="http://www.usefullcode.net/2007/04/05/vista6_5.gif" rel="lightbox"><img alt="vista6_5.gif" src="http://www.usefullcode.net/2007/04/05/vista6_5-thumb.gif" width="400" height="275" align="left" /></a>
同様に「MSXML 4.0 SP2 セキュリティ更新プログラム（925672）」に対しても同じ操作を行う。
<br clear=left>

<a href="http://www.usefullcode.net/2007/04/05/vista6_6.gif" rel="lightbox"><img alt="vista6_6.gif" src="http://www.usefullcode.net/2007/04/05/vista6_6-thumb.gif" width="400" height="275" align="left" /></a>
これで次回からWindows Updateを実行しても同じ更新プログラムがインストールされなくなる<br>
<br>
．．．とは言うものの、この対処方法では、また同じように何度もインストールされる更新プログラムが現れたときには同じように非表示に設定する必要がある。手間のかかる話しだ。
<br clear=left>
]]></description>
         <link>http://www.usefullcode.net/2007/04/vista6_windows_update.html</link>
         <guid>http://www.usefullcode.net/2007/04/vista6_windows_update.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">コラム</category>
        
        
         <pubDate>Thu, 05 Apr 2007 00:05:51 +0900</pubDate>
      </item>
            <item>
         <title>Vistaのバグ（その5） 削除したはずのファイルが消えていない！</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/04/04/vista5_1.gif" rel="lightbox"><img alt="vista5_1.gif" src="http://www.usefullcode.net/2007/04/04/vista5_1-thumb.gif" width="400" height="209" align="left" /></a>
このバグは非常にたちが悪いものの1つだ。
このバグはファイルをドライブからドライブへ移動するときなどに起きることがある。通常に移動が終わったように見えてもエクスプローラーで表示を更新すると移動したはずのファイルがまだ残っているというものだ。<br>
このバグは1GB以上あるような大き目のファイルを扱ったときに起きる。消えているべきファイルは削除しようとしてもこの図のように「対象のフォルダへのアクセスは拒否されました。この操作を実行するアクセス許可が必要です。」と言われ、削除できない。ファイルとして扱われるべきものがフォルダとして扱われているのだろうか？
<br clear=left>

<a href="http://www.usefullcode.net/2007/04/04/vista5_2.gif" rel="lightbox"><img alt="vista5_2.gif" src="http://www.usefullcode.net/2007/04/04/vista5_2-thumb.gif" width="400" height="295" align="left" /></a>
図に示した例はmpegの映像ファイルでの例だ。このバグが生じたファイルは再生しようとしても「ファイルにアクセスできません。」と言われて再生できない。<br>

このバグの困った点は、"大きいファイルで起こる"ことと"削除できない"という点だ。OS上はファイル自体は存在しているので、HDDの容量は取られたままになる。最近はHDDの容量が大きいため、問題ないと考えがちだ。しかし最近はハイビジョンなどデータ量の多い映像も多いため馬鹿にならない。ちなみにこの文章を書いている今、私のPCにはこのバグにより削除できていないファイルが15個残っている。<br>

このように削除できないファイルを削除したい場合は、一度Windows Vistaをログオフしてログオンしなおすか、再起動するしかない。サーバー用途など長時間起動したままにするシステムでは致命的だ。
<br clear=left>
]]></description>
         <link>http://www.usefullcode.net/2007/04/vista5.html</link>
         <guid>http://www.usefullcode.net/2007/04/vista5.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">コラム</category>
        
        
         <pubDate>Wed, 04 Apr 2007 23:49:41 +0900</pubDate>
      </item>
            <item>
         <title>Office 2007はライセンス認証しないと閲覧モードに移ってしまう</title>
         <description><![CDATA[
<a href="http://www.usefullcode.net/2007/03/30/office2007_01.gif" rel="lightbox"><img alt="office2007_01.gif" src="http://www.usefullcode.net/2007/03/30/office2007_01-thumb.gif" width="400" height="321" align="left" /></a>
Microsoft Office 2007はインストールにプロダクトキーが必要ない。ただしWordやExcelの起動時に「25文字のプロダクトキーを入力してください。」という旨の画面が表示される。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_02.gif" rel="lightbox"><img alt="office2007_02.gif" src="http://www.usefullcode.net/2007/03/30/office2007_02-thumb.gif" width="400" height="325" align="left" /></a>
「×」ボタンを押してウインドウを閉じようとすると「セットアップをキャンセルしてもよろしいですか？」と聞かれるので「はい」ボタンを押す。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_03.gif" rel="lightbox"><img alt="office2007_03.gif" src="http://www.usefullcode.net/2007/03/30/office2007_03-thumb.gif" width="400" height="326" align="left" /></a>
すると「Microsoft Office Professional 2007の構成が中止されました。」という画面が表示され．．．
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_04.gif" rel="lightbox"><img alt="office2007_04.gif" src="http://www.usefullcode.net/2007/03/30/office2007_04-thumb.gif" width="400" height="328" align="left" /></a>
問題なくWordやExcelなどの全機能を利用できていた（既に過去形）。このようにしてプロダクトキーを指定しない状態でOfficeを使っていても、起動時に入力用の画面が表示される以外はまったく問題なく利用できていた。バージョン情報の画面を見ても「残り39回利用できます」のようなメッセージが表示されているわけでもなかった。
しかし、今日起動してみると図のようにメニュー項目が灰色になってしまい。まったくと言っていいほど利用できなくなった。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_05.gif" rel="lightbox"><img alt="office2007_05.gif" src="http://www.usefullcode.net/2007/03/30/office2007_05-thumb.gif" width="400" height="366" align="left" /></a>
Excelだけでなく、Wordでも同様だ。ファイルを開いて閲覧することはできるが、入力や編集が一切できない。Excelは検索機能が動いたが、Wordでは検索機能も動かない。
<br>
何も表示されていなかったのだが、おそらくプロダクトキーを入力しないで利用している場合は50回の利用制限があったのだろう。つまり51回目の起動からこのように機能が利用できなくなるのだろう。
<br clear=left>

<br>
<br>

<a href="http://www.usefullcode.net/2007/03/30/office2007_06.gif" rel="lightbox"><img alt="office2007_06.gif" src="http://www.usefullcode.net/2007/03/30/office2007_06-thumb.gif" width="400" height="337" align="left" /></a>
当然ことながらこのままでは使い物にならないのでプロダクトキーを入力した。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_07.gif" rel="lightbox"><img alt="office2007_07.gif" src="http://www.usefullcode.net/2007/03/30/office2007_07-thumb.gif" width="400" height="337" align="left" /></a>
すると「インストールの種類を選択してください」と言われた。しかし種類を選択するも何も、「今すぐインストール」と「ユーザー設定」しかない。ここではとりあえず「ユーザー設定を」を選択した。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_08.gif" rel="lightbox"><img alt="office2007_08.gif" src="http://www.usefullcode.net/2007/03/30/office2007_08-thumb.gif" width="400" height="337" align="left" /></a>
すると氏名などの編集画面が表示された。ユーザー設定項目はこれだけのようだ。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_09.gif" rel="lightbox"><img alt="office2007_09.gif" src="http://www.usefullcode.net/2007/03/30/office2007_09-thumb.gif" width="400" height="337" align="left" /></a>
「今すぐインストール」ボタンを押すと「Microsoft Office Professional 2007を構成しています...」と10秒程度待たされた。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_10.gif" rel="lightbox"><img alt="office2007_10.gif" src="http://www.usefullcode.net/2007/03/30/office2007_10-thumb.gif" width="400" height="337" align="left" /></a>
そして「Microsoft Office Professional 2007の構成が正常に完了しました。」という表示。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_11.gif" rel="lightbox"><img alt="office2007_11.gif" src="http://www.usefullcode.net/2007/03/30/office2007_11-thumb.gif" width="400" height="324" align="left" /></a>
しかし、ここまで進んでもまだOfficeの機能は灰色になっていて利用できなかった。
<br clear=left>

<br>
<br>

<a href="http://www.usefullcode.net/2007/03/30/office2007_12.gif" rel="lightbox"><img alt="office2007_12.gif" src="http://www.usefullcode.net/2007/03/30/office2007_12-thumb.gif" width="400" height="349" align="left" /></a>
一度Excelを終了して、再度起動すると今度は「Microsoft Office ライセンス認証ウィザード」が開いた。インターネット経由でのライセンス認証（アクティベーション）は気分的に嫌なのでここでは電話経由を選択した。<br>
ちなみにWindows Vistaの場合はインターネットに接続していると強制的にネット経由でアクティベーションを行ってしまうということがあったので、事前にネットワーク接続を切った状態でプロダクトキーの入力などをしていた。その可能性は低いだろうがもしかすると接続時は強制的にオンライン認証されるのかもしれない。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_13.gif" rel="lightbox"><img alt="office2007_13.gif" src="http://www.usefullcode.net/2007/03/30/office2007_13-thumb.gif" width="400" height="349" align="left" /></a>
そして表示されているフリーダイヤルに電話をして確認コードを入力。電話のアナウンスでは「ステップ4のA～Gの欄に．．．」のように言っていたが、確認コードの入力はステップ３のようだ。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_14.gif" rel="lightbox"><img alt="office2007_14.gif" src="http://www.usefullcode.net/2007/03/30/office2007_14-thumb.gif" width="400" height="349" align="left" /></a>
これで無事にライセンス認証が終了した。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/30/office2007_15.gif" rel="lightbox"><img alt="office2007_15.gif" src="http://www.usefullcode.net/2007/03/30/office2007_15-thumb.gif" width="400" height="324" align="left" /></a>
これで機能が灰色化することもなく正常に利用できるようになった。
<br clear=left>

]]></description>
         <link>http://www.usefullcode.net/2007/03/office_2007.html</link>
         <guid>http://www.usefullcode.net/2007/03/office_2007.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">コラム</category>
        
        
         <pubDate>Fri, 30 Mar 2007 18:32:12 +0900</pubDate>
      </item>
            <item>
         <title>DLLなどからエクスポートされている関数を一覧する</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/03/30/test129.gif" rel="lightbox"><img alt="test129.gif" src="http://www.usefullcode.net/2007/03/30/test129-thumb.gif" width="400" height="334" align="left" /></a>
DLLからエクスポートされている関数を調べるにはDLLをPEファイルの構造を元にバイナリレベルで解析して調べる方法とAPIを利用して情報を取得する方法とがある。
ここではデバッグ用に用意されているAPIのImageDirectoryEntryToDataを利用して取得した。
<br clear=left>

依存環境：ATL
<pre class=SourceCode>
#include &quot;atlstr.h&quot;

#include &quot;Dbghelp.h&quot;
#pragma	comment(lib,&quot;Dbghelp.lib&quot;)


bool	ShowExportedFunction(LPCTSTR pszDLLPath)
{
	HMODULE	hModule;
	ULONG	nSize;
	DWORD	i;
	DWORD	j;
	char**	ppszFunctionName;
	WORD*	pwFunctionOrdinal;
	IMAGE_EXPORT_DIRECTORY*	pImageExportDir;

	CAtlString	strMessage;

	hModule = ::LoadLibrary(pszDLLPath);
	if(hModule == NULL)
		return	false;

	pImageExportDir = (IMAGE_EXPORT_DIRECTORY*)::ImageDirectoryEntryToData((PVOID)hModule,TRUE,IMAGE_DIRECTORY_ENTRY_EXPORT,&amp;nSize);
	if(pImageExportDir == NULL)
	{
		::FreeLibrary(hModule);
		return	false;
	}

	strMessage.AppendFormat(_T(&quot;%sがエクスポートしている関数一覧\n\n&quot;),pszDLLPath);


	//pImageExportDir内のアドレスはhModuleからの相対的なアドレス
	ppszFunctionName	= (char**)(pImageExportDir-&gt;AddressOfNames + (ULONGLONG)hModule);
	pwFunctionOrdinal	= (WORD*)(pImageExportDir-&gt;AddressOfNameOrdinals + (ULONGLONG)hModule);

	for(i = 0; i &lt; pImageExportDir-&gt;NumberOfFunctions; i++)
	{
		strMessage.AppendFormat(_T(&quot;序数：%4d（0x%04x）&quot;),pImageExportDir-&gt;Base + i,pImageExportDir-&gt;Base + i);

		for(j = 0; j &lt; pImageExportDir-&gt;NumberOfNames; j++)
		{
			if(pwFunctionOrdinal[j] != i)		//pwFunctionOrdinal[j]は序数ではなくインデックス
				continue;

			//hModuleからの相対アドレスで関数名が格納されている
			strMessage.AppendFormat(_T(&quot;　関数名：%s&quot;),(char*)(ppszFunctionName[j] + (ULONGLONG)hModule));
			break;
		}

		strMessage += _T(&quot;\n&quot;);
	}

	::FreeLibrary(hModule);

	::MessageBox(NULL,strMessage,_T(&quot;&quot;),MB_OK);

	return	true;
}


bool	Test()
{
	return	ShowExportedFunction(_T(&quot;hotplug.dll&quot;));
}</pre>

<a href="http://www.usefullcode.net/2007/03/30/Test129.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/03/dll.html</link>
         <guid>http://www.usefullcode.net/2007/03/dll.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">ファイル・フォルダ</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">FreeLibrary</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">ImageDirectoryEntryToData</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">LoadLibrary</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">MessageBox</category>
        
         <pubDate>Fri, 30 Mar 2007 12:23:36 +0900</pubDate>
      </item>
            <item>
         <title>簡単に処理時間を計測する</title>
         <description><![CDATA[<img alt="test128.gif" src="http://www.usefullcode.net/2007/03/29/test128.gif" width="272" height="167" align="left" />
ベンチマークソフトを作りたい！と本格的に思わなくとも処理時間を計測したい場面は多々ある。簡易的に測定したのならGetTickCountを利用すると簡単に計測できる。

GetTickCountはPCを起動してからの経過時間をミリ秒単位で返すための関数だ。この関数を計測したい処理の前後に実行して、取得した値の差を取れば処理に要した時間となる。

ただしGetTickCountを利用する上で注意しておきたい点がある。

まず、この関数で返される値は「まれにゼロに戻る」という点だ。具体的には49.7日周期でゼロに戻る。そのため49.7日を超える処理時間は確実に計測できないし、処理時間が仮に数秒の場合でもちょうどゼロに戻るタイミングに当たった場合は処理時間が負の値となりきちんと計測できない。

また、WindowsはマルチタスクOSなため、バックグラウンド処理が重たいと計測時間が長くなるという点だ。これはGetTickCountの欠点ではないが場合によっては問題となり得る。


何はともあれ、「GetTickCountの値がゼロに戻ることがある」という点だけは絶対に頭に入れておかないとダメだ。
<br clear=left>


<pre class=SourceCode>#include &quot;atlstr.h&quot;

bool	Test()
{
	DWORD		dwStart;
	ULONGLONG	dwEnd;

	dwStart = ::GetTickCount();

	//処理時間を計測したい処理
	{
		int		i;
		int		j;

		for(i = 0; i &lt; 1000; i++)
		{
			for(j = 0; j &lt; 1000; j++)
			{
				char	pszBuff[256];

				::sprintf_s(pszBuff,256,&quot;%d %d&quot;,i,j);
			}
		}
	}

	dwEnd = ::GetTickCount();

	//GetTickCountは49.7日に1回ゼロに戻る。
	//計測中にゼロに戻っても正常な値になるようにゼロに戻った場合は桁上がりさせる
	//※注意：この桁上がり処理をした場合も49.7日を超える時間は計測できない
	if(dwStart &gt; dwEnd)
		dwEnd += 0x100000000;		//桁上がり

	CAtlString	strMessage;

	strMessage.Format(_T(&quot;処理にかかった時間は %d ミリ秒です&quot;),dwEnd - dwStart);
	::MessageBox(NULL,strMessage,_T(&quot;&quot;),MB_OK);

	return	true;
}</pre>
<a href="http://www.usefullcode.net/2007/03/29/Test128.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/03/post_56.html</link>
         <guid>http://www.usefullcode.net/2007/03/post_56.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">その他</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">GetTickCount</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">MessageBox</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">sprintf_s</category>
        
         <pubDate>Thu, 29 Mar 2007 19:58:36 +0900</pubDate>
      </item>
            <item>
         <title>たくさんある文字列比較用関数から必要なものを見つける</title>
         <description><![CDATA[C言語をやっていた頃はstrcmp（とstrncmp）だけ知っていれば文字列比較には十分だった。

しかしWindowsプログラミングになるとユニコードやらTCHAR型が登場したおかげで非常に複雑になっている。さらに同じ挙動を示す関数が名前違いで複数用意されているものだから混沌としている。



しかし関数の名前の法則（？）を押さえておけば何となく使うべき関数をチョイスできる。

・「w」がついている場合はユニコード文字列の比較
・「t」が付いている場合はTCHAR型文字列の比較
・「str」が付いている場合は通常の文字列（SHIFT-JISやANSI文字列）の比較

・「n」が付いている場合は文字数を指定しての比較
・「i」が付いている場合は大文字と小文字を区別しない比較

という命名慣習だ。



例えば「strcmp」は「str」が含まれるから通常文字列用で、「i」や「n」が含まれないから大文字と小文字を区別して文字数の指定ができない比較用となるし、「stricmp」は大文字小文字を同一視する比較用、「strncmp」は文字数を指定しての比較用となる。


実際のプログラミングでは...

通常の文字列に対応したstrcmp、strncmp（文字数指定）、stricmp（大文字小文字同一視）、_strnicmp（文字数指定かつ大文字小文字同一視）。

TCHAR型文字列に対応した_tcscmp、_tcsncmp（文字数指定）、_tcsicmp（大文字小文字同一視）、_tcsnicmp（文字数指定かつ大文字小文字同一視）。

の合計8個程度を覚えておけば問題ないだろう。




MSDNライブラリから適当にピックアップしただけで以下のものが見つかった。きちんと探せばまだまだある。いったいいくつあるのだろう？

<table border=0 cellpadding=0 cellspacing=0 style='border-collapse:
 collapse;table-layout:fixed;'>
 <col width=160 style='mso-width-source:userset;mso-width-alt:5120;width:120pt'>
 <col class=xl65 span=6 style='width:54pt'>
 <col width=35 style='mso-width-source:userset;mso-width-alt:1120;width:26pt'>
 <col width=142 style='mso-width-source:userset;mso-width-alt:4544;width:107pt'>
 <col width=232 style='mso-width-source:userset;mso-width-alt:7424;width:174pt'>
 <col span=2 style='width:54pt'>
 <tr>
  <td width=160 style='width:120pt'></td>
  <td class=xl65 style='width:54pt'>char</td>
  <td class=xl65 style='width:54pt'>wchar_t</td>
  <td class=xl65 style='width:54pt'>TCHAR</td>
  <td class=xl65 style='width:54pt'>比較長</td>
  <td class=xl65 style='width:54pt'>大小同一</td>
  <td class=xl65 style='width:54pt'>ロケール</td>
  <td width=35 style='width:26pt'></td>
  <td width=142 style='width:107pt'>対応OS</td>
  <td width=232 >補足</td>
 </tr>
 <tr>
  <td>_tcscmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tccmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>strcmp</td>
  <td class=xl65>○</td>
  <td colspan=5 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>wcscmp</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=4 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbscmp</td>
  <td class=xl65>MBCS</td>
  <td colspan=5 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsnccmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>strncmp</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>wcsncmp</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbcmp<span
  style='mso-spacerun:yes'>&nbsp;</span></td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsncmp</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncmp_l</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbcml</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsncmp_l</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsicmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_stricmp</td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsicmp</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsicmp</td>
  <td class=xl65>MBCS</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncicmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicmp</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicmp</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnicmp</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsnicmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicmp</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicmp</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbicmp</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncicmp_l</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicmp_l</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicmp_l</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnicmp_l</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpA</td>
  <td class=xl65>○</td>
  <td colspan=5 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=4 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpN</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNA</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpI</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpIA</td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpIW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNI</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNIA</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNIW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrNCmp</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrNCmpI</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpC</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpCA</td>
  <td class=xl65>○</td>
  <td colspan=5 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpCW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=4 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNC</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNCA</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNCW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpIC</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpICA</td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpICW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNIC</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNICA</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpNICW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>StrCmpLogicalW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=4 class=xl65 style='mso-ignore:colspan'></td>
  <td></td>
  <td>Windows XP<ruby>以降<span style='display:none'><rt>イコウ</rt></span></ruby></td>
  <td>含まれる数値を比較に考慮</td>
  <td colspan=2 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>strcmpi</td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td></td>
  <td>（現在は利用しない）</td>
  <td colspan=3 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>CompareString</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>可能</td>
  <td class=xl65>可能</td>
  <td class=xl65></td>
  <td colspan=2 style='mso-ignore:colspan'></td>
  <td colspan=3 style='mso-ignore:colspan'>戻り値に注意！等しいときはCSTR_EQUAL（＝2）を返す</td>
 </tr>
 <tr>
  <td>CompareStringA</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>可能</td>
  <td class=xl65>可能</td>
  <td class=xl65></td>
  <td colspan=2 style='mso-ignore:colspan'></td>
  <td colspan=3 style='mso-ignore:colspan'>戻り値に注意！等しいときはCSTR_EQUAL（＝2）を返す</td>
 </tr>
 <tr>
  <td>CompareStringW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>可能</td>
  <td class=xl65>可能</td>
  <td class=xl65></td>
  <td colspan=2 style='mso-ignore:colspan'></td>
  <td colspan=3 style='mso-ignore:colspan'>戻り値に注意！等しいときはCSTR_EQUAL（＝2）を返す</td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>CompareStringEx</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>可能</td>
  <td class=xl65>可能</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows Vista以降</td>
  <td colspan=3 style='mso-ignore:colspan'>戻り値に注意！等しいときはCSTR_EQUAL（＝2）を返す</td>
 </tr>
 <tr>
  <td>CompareStringOrdinal</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>可能</td>
  <td class=xl65>可能</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows Vista以降</td>
  <td colspan=3 style='mso-ignore:colspan'>戻り値に注意！等しいときはCSTR_EQUAL（＝2）を返す</td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>CompareStringWrapW</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>可能</td>
  <td class=xl65>可能</td>
  <td class=xl65></td>
  <td></td>
  <td>Windows 2000以降</td>
  <td colspan=3 style='mso-ignore:colspan'>戻り値に注意！等しいときはCSTR_EQUAL（＝2）を返す</td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>strcoll</td>
  <td class=xl65>○</td>
  <td colspan=4 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>wcscoll</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=3 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbscoll</td>
  <td class=xl65>MBCS</td>
  <td colspan=4 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncoll</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strncoll</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsncoll</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbcoll</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td><span
  style='mso-spacerun:yes'>&nbsp;</span></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncoll_l</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strncoll</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsncoll</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsncoll</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strncoll_l</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsncoll_l</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsncoll_l<span
  style='mso-spacerun:yes'>&nbsp;</span></td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbcoll_l<span
  style='mso-spacerun:yes'>&nbsp;</span></td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsnicoll</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicoll</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicoll</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbicoll</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsnicoll_l</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicoll_l</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicoll_l</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbicoll_l</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td><span
  style='mso-spacerun:yes'>&nbsp;</span></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsncicoll</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicoll</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicoll</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbicoll</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsnicoll</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicoll</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicoll</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbicoll</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td></td>
  <td colspan=6 class=xl65 style='mso-ignore:colspan'></td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_tcsnicoll_l</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_strnicoll_l</td>
  <td class=xl65>○</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_wcsnicoll_l</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
 <tr>
  <td>_mbsnbicoll_l</td>
  <td class=xl65>MBCS</td>
  <td colspan=2 class=xl65 style='mso-ignore:colspan'></td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td class=xl65>○</td>
  <td colspan=5 style='mso-ignore:colspan'></td>
 </tr>
</table>

]]></description>
         <link>http://www.usefullcode.net/2007/03/post_55.html</link>
         <guid>http://www.usefullcode.net/2007/03/post_55.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">文字列操作</category>
        
        
         <pubDate>Thu, 29 Mar 2007 19:17:28 +0900</pubDate>
      </item>
            <item>
         <title>HRESULT型とは？</title>
         <description><![CDATA[HRESULTとはlong型の数値だ。この型はCOMインターフェース関連の関数の戻り値として利用されることが多い。

関数の戻り値として使われることの多いBOOL型が成功を意味するのは「1」（＝TRUE）で失敗が「0」（＝FALSE）なのと似ている。

大きな違いはBOOL型がTRUEとFALSEの2値しか取らないのに対して、HRESULT型では0x00000000～0xFFFFFFFFまでの多くの値が利用される。そのためBOOL型では失敗の原因を取得するためにGetLastError()を利用する必要があったが、HRESULT型では値を見るだけで失敗の原因まで分かる。

HRESULT型として使われる値は下のような規則に則って決定されている。これは「winerror.h」のコメント内に記述されているものだ。


<pre class=SourceCode>//  HRESULTs are 32 bit values layed out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +-+-+-+-+-+---------------------+-------------------------------+
//  |S|R|C|N|r|    Facility         |               Code            |
//  +-+-+-+-+-+---------------------+-------------------------------+
//
//  where
//
//      S - Severity - indicates success/fail
//
//          0 - Success
//          1 - Fail (COERROR)
//
//      R - reserved portion of the facility code, corresponds to NT's
//              second severity bit.
//
//      C - reserved portion of the facility code, corresponds to NT's
//              C field.
//
//      N - reserved portion of the facility code. Used to indicate a
//              mapped NT status value.
//
//      r - reserved portion of the facility code. Reserved for internal
//              use. Used to indicate HRESULT values that are not status
//              values, but are instead message ids for display strings.
//
//      Facility - is the facility code
//
//      Code - is the facility's status code</pre>


要約すると

・上位1bitが「1」なら"失敗"、「0」なら"成功"
・16～26bitまでの11ビットの値はカテゴリ
・0～15bitまでの下位WORDの値は詳細情報

のように値が決定されている。つまり、あるHRESULT型の値が"成功"を示しているか、それとも"失敗"を示しているのかは

<pre class=SourceCode>	HRESULT	hr;

	hr = function_example();

	if(hr &amp; 0x80000000)
	{
		//上位1bitが「1」なので成功
	}
	else
	{
		//失敗
	}</pre>


というように判定できる。

この判別を簡単にするために「winerror.h」内では以下の2つのマクロが定義されている。

<pre class=SourceCode>#define SUCCEEDED(hr) (((HRESULT)(hr)) &gt;= 0)
#define FAILED(hr) (((HRESULT)(hr)) &lt; 0)</pre>


これを利用すると成功と失敗の判別は以下のようにできる。

<pre class=SourceCode>	HRESULT	hr;

	hr = function_example();

	if(SUCCEEDED(hr))
	{
		//成功
	}
	else
	{
		//失敗
	}

	if(SUCCEEDED(hr))
	{
		//成功
	}

	if(FAILED(hr))
	{
		//失敗
	}</pre>


また、前に述べたようにHRESULT型では値を参照することで失敗の原因を知ることができる。例えば．．．

<pre class=SourceCode>	HRESULT	hr;

	hr = function_example();

	switch(hr)
	{
	case	S_OK:
		//成功
		break;

	case	E_FAIL:
		//一般的な失敗
		break;

	case	E_OUTOFMEMORY:
		//メモリー不足による失敗
		break;

	case	E_INVALIDARG:
		//引数不正による失敗
		break;

	case	E_UNEXPECTED:
		//予期せぬ失敗
		break;

	case	E_OUTOFMEMORY:
		//による失敗
		break;

	case	E_POINTER:
		//不正なポインターによる失敗
		break;

	（...省略...）

	default:
		//その他（の失敗時もしくは成功時）
		break;
	}</pre>


のようにできる。ここで、例えば「E_OUTOFMEMORY」が示す数値はWin32の場合は「0x8007000E」だがMacの場合は「0x80000002」のようにプラットフォームによって値が変わることがある。そのため具体的な数値をソースコードに記述してはいけない。

定義されている値から推測できるように「S_」から始まるものは"成功"を示し、「E_」から始まるものは"失敗"を示す。また、多くの場合成功時は「S_OK」が返る。しかし、成功時は必ずS_OKというわけではない。そのため先に述べた「SUCCEEDED()」マクロによって判定すること。
]]></description>
         <link>http://www.usefullcode.net/2007/03/hresult.html</link>
         <guid>http://www.usefullcode.net/2007/03/hresult.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">コラム</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">HRESULT</category>
        
         <pubDate>Sun, 18 Mar 2007 17:50:30 +0900</pubDate>
      </item>
            <item>
         <title>Vistaのバグ（その4） デスクトップにコピーや移動したファイルが表示されない！</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/03/17/vista4_1.gif" rel="lightbox"><img alt="vista4_1.gif" src="http://www.usefullcode.net/2007/03/17/vista4_1-thumb.gif" width="400" height="300" align="left" /></a>
これもよく生じるちょっと不便なバグ。<br>
任意のフォルダーからファイルをデスクトップにコピーや移動したとき、もしくは使っているアプリケーションがデスクトップ上にファイルを作成したときに起きる。このバグも必ず起きるというわけではないが頻発する。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/17/vista4_2.gif" rel="lightbox"><img alt="vista4_2.gif" src="http://www.usefullcode.net/2007/03/17/vista4_2-thumb.gif" width="400" height="300" align="left" /></a>
ここでは画像ファイルをデスクトップへ移動したにも関わらずデスクトップ上にアイコンが表示されていない。もちろん移動したので元のフォルダからはファイルのアイコンは消えている。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/17/vista4_3.gif" rel="lightbox"><img alt="vista4_3.gif" src="http://www.usefullcode.net/2007/03/17/vista4_3-thumb.gif" width="400" height="300" align="left" /></a>
バグでファイルが失われたというわけではない。<br>
デスクトップ上で右クリックをして現れるメニューから「最新の情報に更新」を選択して画面表示を更新する。
<br clear=left>

<a href="http://www.usefullcode.net/2007/03/17/vista4_4.gif" rel="lightbox"><img alt="vista4_4.gif" src="http://www.usefullcode.net/2007/03/17/vista4_4-thumb.gif" width="400" height="300" align="left" /></a>
するとファイルのアイコンが現れる。<br>
「Excelなどで編集をして、デスクトップに保存。そしてExcelを閉じてからデスクトップを見たら保存したはずのファイルがない！」というように焦ることもあるだろう（少なくとも私はこのようなことがあった）。<br>
また、このバグではデスクトップのアイコンが自動的に整列されるようにしていても、新しく移動したファイルなどは「コンピュータ」と「ごみ箱」のアイコンの間に現れる。つまりアイコンの位置が勝手に変わってしまう。そのためアイコンを表示してからアイコンを手動で動かさなければならず二度手間なのが不便だ。
<br clear=left>

]]></description>
         <link>http://www.usefullcode.net/2007/03/vista4.html</link>
         <guid>http://www.usefullcode.net/2007/03/vista4.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">コラム</category>
        
        
         <pubDate>Sat, 17 Mar 2007 20:30:48 +0900</pubDate>
      </item>
            <item>
         <title>Vistaのバグ（その3） ファイルサイズがマイナスの値になる！</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/03/17/vista3.gif" rel="lightbox"><img alt="vista3.gif" src="http://www.usefullcode.net/2007/03/17/vista3-thumb.gif" width="400" height="333" align="left" /></a>
Windows VistaのエクスプローラーはWindows XPの頃と比べて非常に多くのバグがある。さすがに致命的なものは"少ない"（無いわけでない）のであまり問題はないのだが不便なことが多い。<br>
そんな致命的ではないバグの1つがこれ。エクスプローラーのステータスバー部分に表示されているファイルサイズがマイナスになっている。残念ながら「最新の情報に更新」をしても正常な値は表示されない。正常なファイルサイズを知りたい場合は右クリックして「プロパティ」を表示する。<br>
このバグは必ず起きるというわけではない。発生条件はよく分からないものの頻繁に発生する。
<br clear=left>
]]></description>
         <link>http://www.usefullcode.net/2007/03/vista3.html</link>
         <guid>http://www.usefullcode.net/2007/03/vista3.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">コラム</category>
        
        
         <pubDate>Sat, 17 Mar 2007 20:23:16 +0900</pubDate>
      </item>
            <item>
         <title>TOSHIBA RDシリーズからネットdeダビング経由で映像を取得する</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/03/17/test127.JPG" rel="lightbox"><img alt="test127.JPG" src="http://www.usefullcode.net/2007/03/17/test127-thumb.JPG" width="400" height="267" align="left" /></a>
TOSHIBA RD-H1などのHDDレコーダーには「ネットdeダビング」という機能により機器間で録画した映像をやりとりできる。ここではこのネットdeダビングを利用してTOSHIBA RDシリーズからPCへ映像をダビング（コピー）する。<br>
今回のソースコードにはFTPサーバー部しか実装されていない。そのため実際にTOSHIBA RDシリーズから映像データをダビングするには「<a href="http://www.usefullcode.net/2007/03/netbios.html" target="_blank">NetBIOSの名前問い合わせに返答する </a>」を起動しておく。
<br clear=left>

■「ネットdeダビング」での処理の流れ

１．（RD上で操作）赤外線リモコンの「ネットdeダビング」ボタンを押す
２．（RD上で操作）ダビング先として「ネットワーク」を選択する
３．（RD→PC）NetBIOS（UDP/137）を利用した名前の問い合わせが送信される
４．（PC→RD）NetBIOS（UDP/137）による名前を応答する
５．（RD上で表示）「ネットワーク機器名」としてNetBIOSで応答のあった機器が列挙される
６．（RD上で操作）PCを示すダビング先を選択する
７．（RD⇔PC）PCがFTPサーバー、RDがFTPクライアントとして動作して映像がPCにアップロードされる

前回の「<a href="http://www.usefullcode.net/2007/03/netbios.html" target="_blank">NetBIOSの名前問い合わせに返答する </a>」により1～6の処理が可能になる。今回は7の処理を実装した。
ただし実装はシングルスレッドで、かつ、ネットワーク遅延やパケット分割、各種エラー発生時の処理は省略している。そのため実際に流用する場合はそれらを考慮したものに変更する必要がある。


■「ネットdeダビング」でのFTPの流れ

1．（PC）（TCP/21で受信待機する）
2．（RD→PC）（FTPサーバー（PC）へTCP/21で接続する）
3．（RD←PC）220 
4．（RD→PC）USER b2b404fc9e0344e64c40d549d0c21219
5．（RD←PC）331 
6．（RD→PC）PASS b2b404fc9e0344e64c40d549d0c21219
7．（RD←PC）230 
8．（RD→PC）TYPE I
9．（RD←PC）200 

10．（RD→PC）PASV
11．（PC）（データ転送用に任意のポートを開ける）
12．（RD←PC）227 Entering Passive Mode (x,x,x,x,y,y).　（xは自分のIPアドレス、yはデータ転送用のポート番号）
13．（PC）（データ転送用のポートで受信待機する）
14．（RD→PC）（データ転送用のポートにアクセスする）
15．（RD→PC）STOR $netdubbing$dubbinginfo.xml
16．（RD←PC）150 
17．（RD→PC）（データ転送用のポートにXMLが送られる。内容は以下のようなもの）

<pre class=SourceCode>&lt;?xml version=&quot;1.0&quot; encoding=&quot;shift_jis&quot;?&gt;
&lt;dubbinginfo&gt;
&lt;titlesize&gt;2246&lt;/titlesize&gt;
&lt;device&gt;0&lt;/device&gt;
&lt;/dubbinginfo&gt;</pre>

18．（RD←PC）226 

19．（RD→PC）PASV
20．（PC）（データ転送用に任意のポートを開ける）
21．（RD←PC）227 Entering Passive Mode (x,x,x,x,y,y).　（xは自分のIPアドレス、yはデータ転送用のポート番号）
22．（PC）（データ転送用のポートで受信待機する）
23．（RD→PC）（データ転送用のポートにアクセスする）
24．（RD→PC）RETR $xml$status.xml
25．（RD←PC）150 
26．（RD←PC）（データ転送用のポートにXMLを送る。内容は以下のようなもの）

<pre class=SourceCode>&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;shift_jis\&quot;?&gt;
&lt;status&gt;
&lt;dubbing&gt;ready&lt;/dubbing&gt;
&lt;accept_dubbing&gt;ready&lt;/accept_dubbing&gt;
&lt;device0_remain&gt;167772160&lt;/device0_remain&gt;
&lt;device0_recorded&gt;0&lt;/device0_recorded&gt;
&lt;device0_title_remain&gt;350&lt;/device0_title_remain&gt;
&lt;device1_remain&gt;167772160&lt;/device1_remain&gt;
&lt;device1_recorded&gt;0&lt;/device1_recorded&gt;
&lt;device1_title_remain&gt;350&lt;/device1_title_remain&gt;
&lt;/status&gt;</pre>

27．（RD←PC）226 

28．（RD→PC）PASV
29．（PC）（データ転送用に任意のポートを開ける）
30．（RD←PC）227 Entering Passive Mode (x,x,x,x,y,y).　（xは自分のIPアドレス、yはデータ転送用のポート番号）
31．（PC）（データ転送用のポートで受信待機する）
32．（RD→PC）（データ転送用のポートにアクセスする）
33．（RD→PC）STOR $netdubbing$dev0.dat
34．（RD←PC）150 
35．（RD→PC）（データ転送用のポートにmpegファイルの内容が送られる。内容は以下のようなもの）
36．（RD←PC）226 

37．（RD→PC）PASV
38．（PC）（データ転送用に任意のポートを開ける）
39．（RD←PC）227 Entering Passive Mode (x,x,x,x,y,y).　（xは自分のIPアドレス、yはデータ転送用のポート番号）
40．（PC）（データ転送用のポートで受信待機する）
41．（RD→PC）（データ転送用のポートにアクセスする）
42．（RD→PC）STOR $netdubbing$dubbinginfo.xml
43．（RD←PC）150 
44．（RD→PC）（データ転送用のポートにXMLが送られる。内容は以下のようなもの）

<pre class=SourceCode>&lt;?xml version=&quot;1.0&quot; encoding=&quot;shift_jis&quot;?&gt;
&lt;dubbinginfo&gt;
&lt;titlesize&gt;0&lt;/titlesize&gt;
&lt;device&gt;0&lt;/device&gt;
&lt;/dubbinginfo&gt;</pre>

45．（RD←PC）226 

46．（RD→PC）PASV
47．（PC）（データ転送用に任意のポートを開ける）
48．（RD←PC）227 Entering Passive Mode (x,x,x,x,y,y).　（xは自分のIPアドレス、yはデータ転送用のポート番号）
49．（PC）（データ転送用のポートで受信待機する）
50．（RD→PC）（データ転送用のポートにアクセスする）
51．（RD→PC）RETR $xml$status.xml
52．（RD←PC）150 
53．（RD←PC）（データ転送用のポートにXMLを送る。内容は以下のようなもの）

<pre class=SourceCode>&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;shift_jis\&quot;?&gt;
&lt;status&gt;
&lt;dubbing&gt;ready&lt;/dubbing&gt;
&lt;accept_dubbing&gt;ready&lt;/accept_dubbing&gt;
&lt;device0_remain&gt;167772160&lt;/device0_remain&gt;
&lt;device0_recorded&gt;0&lt;/device0_recorded&gt;
&lt;device0_title_remain&gt;350&lt;/device0_title_remain&gt;
&lt;device1_remain&gt;167772160&lt;/device1_remain&gt;
&lt;device1_recorded&gt;0&lt;/device1_recorded&gt;
&lt;device1_title_remain&gt;350&lt;/device1_title_remain&gt;
&lt;/status&gt;</pre>

54．（RD←PC）226 

55．（RD→PC）RETR QUIT

※PCからRDへの送信例は適当に作成しています。本来はきちんとHDD容量や転送デバイスを考慮した値を入れる必要があります。



依存環境：ATL
<pre class=SourceCode>
#include &lt;winsock2.h&gt;
#pragma	comment(lib,&quot;Ws2_32.lib&quot;)

bool	Send(SOCKET sock,const char* pszMessage)
{
	int		nRet;

	nRet = ::send(sock,pszMessage,(int)::strlen(pszMessage),0);

	return (nRet == SOCKET_ERROR) ? false : true;
}


bool	SendResponseCode(SOCKET sock,int nCode,const char* pszMessage=NULL)
{
	char	pszData[128];

	if(pszMessage == NULL)
		::sprintf_s(pszData,128,&quot;%d \r\n&quot;,nCode);		//TOSHIBA RDシリーズでは%d直後のスペースが必須！
	else
		::sprintf_s(pszData,128,&quot;%d %s\r\n&quot;,nCode,pszMessage);

	return	Send(sock,pszData);
}




bool	FTPServer()
{
	int		nRet;
	SOCKET	sock;
	SOCKET	sockDataConnection;
	sockaddr_in	addr;

	sock = ::socket(PF_INET,SOCK_STREAM,0);
	if(sock == SOCKET_ERROR)
		return	false;

	sockDataConnection = SOCKET_ERROR;


	addr.sin_family		= PF_INET;
	addr.sin_port		= ::htons(21);		//FTPポート
	addr.sin_addr.s_addr= INADDR_ANY;

	nRet = ::bind(sock,(sockaddr*)&amp;addr,sizeof(sockaddr_in));
	if(nRet == SOCKET_ERROR)
	{
		::closesocket(sock);
		return	false;
	}

	nRet = ::listen(sock,SOMAXCONN);
	if(nRet == SOCKET_ERROR)
	{
		::closesocket(sock);
		return	false;
	}

	while(1)
	{
		int			nAddrLen;
		SOCKET		sockAccept;
		sockaddr_in	addrAccept;

		ATLTRACE(&quot;FTP Server Start...\n&quot;);
		nAddrLen = sizeof(sockaddr_in);
		sockAccept = ::accept(sock,(sockaddr*)&amp;addrAccept,&amp;nAddrLen);
		if(sockAccept == SOCKET_ERROR)
			break;

		//FTPサーバーへのコネクト開始メッセージ
		SendResponseCode(sockAccept,220);
		ATLTRACE(&quot;FTP Connected\n&quot;);

		while(1)
		{
			char	pBuffer[2048];

			nRet = ::recv(sockAccept,pBuffer,sizeof(pBuffer),0);
			if(nRet == SOCKET_ERROR)
				break;
			if(nRet == 0)
				continue;

			pBuffer[nRet] = NULL;
			ATLTRACE(&quot;%s\n&quot;,pBuffer);

			if(nRet &lt; 4)
				break;

			if(::StrCmpNIA(pBuffer,&quot;USER&quot;,4) == 0)
			{
				SendResponseCode(sockAccept,331);
				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;PASS&quot;,4) == 0)
			{
				SendResponseCode(sockAccept,230);
				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;TYPE&quot;,4) == 0)
			{
				SendResponseCode(sockAccept,200);
				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;PASV&quot;,4) == 0)
			{
				//データ転送用ソケットを作って、そのポートをRDに知らせる

				int		i;
				int		nPort;
				char	pszMessage[1024];

				SOCKET		sockData;
				sockaddr_in	sDataAddr;

				sockData = ::socket(PF_INET,SOCK_STREAM,0);
				if(sockData == SOCKET_ERROR)
					break;

				nPort = 22222;
				for(i = 0; i &lt; 100; i++)
				{
					::ZeroMemory(&amp;sDataAddr,sizeof(sockaddr_in));
					sDataAddr.sin_family		= AF_INET;
					sDataAddr.sin_addr.s_addr	= INADDR_ANY;
					sDataAddr.sin_port			= ::htons(nPort);

					nRet = ::bind(sockData,(sockaddr*)&amp;sDataAddr,sizeof(sockaddr_in));
					if(nRet != SOCKET_ERROR)
						break;

					//ポート番号を変えて再試行
					nPort++;
				}
				if(nRet == SOCKET_ERROR)
					break;
				::listen(sockData,1);

				int			nAddrLen;
				sockaddr	addr;

				nAddrLen = sizeof(sockaddr);
				::getsockname(sockAccept,&amp;addr,&amp;nAddrLen);

				::sprintf_s(pszMessage,1024,&quot;Entering Passive Mode (%u,%u,%u,%u,%u,%u).\r\n&quot;
					,addr.sa_data[2] &amp; 0xFF
					,addr.sa_data[3] &amp; 0xFF
					,addr.sa_data[4] &amp; 0xFF
					,addr.sa_data[5] &amp; 0xFF
					,(nPort &gt;&gt; 8) &amp; 0x00FF
					,(nPort &gt;&gt; 0) &amp; 0x00FF);

				//待機アドレス、ポートを知らせる
				SendResponseCode(sockAccept,227,pszMessage);

				//RDからの接続を待つ
				nAddrLen = sizeof(sockaddr_in);
				sockDataConnection = ::accept(sockData,(sockaddr*)&amp;sDataAddr,&amp;nAddrLen);
				::closesocket(sockData);
				if(sockDataConnection == SOCKET_ERROR)
					break;

				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;STOR $netdubbing$dev0.dat&quot;,(int)::strlen(&quot;STOR $netdubbing$dev0.dat&quot;)) == 0)
			{
				//MPEGデータの受信

				char	pBuffer[2048];
				HANDLE	hFile;

				//ファイル決め打ちで保存
				hFile = ::CreateFile(_T(&quot;c:\\_Down\\test2.mpg&quot;),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
				if(hFile == INVALID_HANDLE_VALUE)
					break;

				ATLTRACE(&quot;Receiving mpeg file...\n&quot;);

				//転送開始
				SendResponseCode(sockAccept,150);

				while(1)
				{
					::Sleep(0);

					nRet = ::recv(sockDataConnection,pBuffer,sizeof(pBuffer),0);
					if(nRet == SOCKET_ERROR)
						break;
					if(nRet == 0)
						break;

					BOOL	ret;
					DWORD	dwWrittenSize;

					ret = ::WriteFile(hFile,pBuffer,nRet,&amp;dwWrittenSize,NULL);
					if(ret == FALSE)
					{
						SendResponseCode(sockAccept,450);
						break;
					}
				}

				//転送終了
				SendResponseCode(sockAccept,226);

				::CloseHandle(hFile);
				ATLTRACE(&quot;Received\n&quot;);

				::closesocket(sockDataConnection);
				sockDataConnection = SOCKET_ERROR;

				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;STOR&quot;,4) == 0)
			{
				//mpegファイル以外のデータ受信
				//dubbinginfoやコマンドなどを処理

				char	pBuffer[2048];

				//転送開始
				SendResponseCode(sockAccept,150);

				while(1)
				{
					::Sleep(0);

					nRet = ::recv(sockDataConnection,pBuffer,sizeof(pBuffer),0);
					if(nRet == SOCKET_ERROR)
						break;
					if(nRet == 0)
						break;
					pBuffer[nRet] = NULL;

					ATLTRACE(&quot;%s\n&quot;,pBuffer);
				}

				//転送終了
				SendResponseCode(sockAccept,226);

				::closesocket(sockDataConnection);
				sockDataConnection = SOCKET_ERROR;

				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;RETR&quot;,4) == 0)
			{
				//ステータス情報の送信
				//本来ならdubbinginfoを見て返答すべきだが決め打ち

				char	pBuffer[4096];

				strcpy_s(pBuffer,4096,
					&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;shift_jis\&quot;?&gt;\r\n&quot;
					&quot;&lt;status&gt;\r\n&quot;
					&quot;&lt;dubbing&gt;ready&lt;/dubbing&gt;\r\n&quot;
					&quot;&lt;accept_dubbing&gt;ready&lt;/accept_dubbing&gt;\r\n&quot;
					&quot;&lt;device0_remain&gt;167772160&lt;/device0_remain&gt;\r\n&quot;
					&quot;&lt;device0_recorded&gt;0&lt;/device0_recorded&gt;\r\n&quot;
					&quot;&lt;device0_title_remain&gt;350&lt;/device0_title_remain&gt;\r\n&quot;
					&quot;&lt;device1_remain&gt;167772160&lt;/device1_remain&gt;\r\n&quot;
					&quot;&lt;device1_recorded&gt;0&lt;/device1_recorded&gt;\r\n&quot;
					&quot;&lt;device1_title_remain&gt;350&lt;/device1_title_remain&gt;\r\n&quot;
					&quot;&lt;/status&gt;\r\n&quot;);

				//転送開始
				SendResponseCode(sockAccept,150);

				Send(sockDataConnection,pBuffer);

				//転送終了
				SendResponseCode(sockAccept,226);

				::closesocket(sockDataConnection);
				sockDataConnection = SOCKET_ERROR;

				continue;
			}
			if(::StrCmpNIA(pBuffer,&quot;QUIT&quot;,4) == 0)
				break;


			ATLTRACE(&quot;unknown cmd\n&quot;);
		}

		::shutdown(sockAccept,SD_BOTH);
		::closesocket(sockAccept);
	}


	if(sockDataConnection != SOCKET_ERROR)
	{
		::shutdown(sockDataConnection,SD_BOTH);
		::closesocket(sockDataConnection);
	}

	::shutdown(sock,SD_BOTH);
	::closesocket(sock);

	return	true;
}




bool	Test()
{
	WSAData wsaData;

	//Winsock2.2
	::WSAStartup(MAKEWORD(2,2),&amp;wsaData);

	FTPServer();

	::WSACleanup();

	return	true;
}</pre>

<a href="http://www.usefullcode.net/2007/03/17/Test127.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/03/toshiba_rdde.html</link>
         <guid>http://www.usefullcode.net/2007/03/toshiba_rdde.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">ネットワーク</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">accept</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">bind</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">CloseHandle</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">closesocket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">CreateFile</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">getsockname</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">listen</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">recv</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">send</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">shutdown</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">socket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">sprintf_s</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">StrCmpNIA</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">strcpy_s</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WriteFile</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSACleanup</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSAStartup</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">ZeroMemory</category>
        
         <pubDate>Sat, 17 Mar 2007 11:42:59 +0900</pubDate>
      </item>
            <item>
         <title>NetBIOSの名前問い合わせに返答する</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/03/16/test126.JPG" rel="lightbox"><img alt="test126.JPG" src="http://www.usefullcode.net/2007/03/16/test126-thumb.JPG" width="400" height="267" align="left" /></a>
TOSHIBAのHDDレコーダー「RD-H1」などは「ネットdeダビング」という機能によりLAN経由による映像データのコピー（ダビング）に対応している。<br>
この「ネットdeダビング」ではダビング先を探す際にNetBIOSの名前解決を利用している。ここではUDPのポート137を使ったNetBIOSの名前問い合わせに対してRDシリーズ向けの返答を返している。ここで返す応答はNetBIOSに則っているようで反したものになっている。そのため実際のNetBIOS機器に流用する際は注意が必要だ。
<br clear=left>


<pre class=SourceCode>#include &lt;mstcpip.h&gt;
#include &lt;winsock2.h&gt;
#pragma	comment(lib,&quot;Ws2_32.lib&quot;)



//////////////////////////////////////////////////////
//以下の構造体はWindows SDKのサンプルに含まれる「iphdr.h」内からコピー
//

#pragma	pack(push,1)

//
// IPv4 Header (without any IP options)
//
typedef struct ip_hdr
{
    unsigned char  ip_verlen;        // 4-bit IPv4 version
                                     // 4-bit header length (in 32-bit words)
    unsigned char  ip_tos;           // IP type of service
    unsigned short ip_totallength;   // Total length
    unsigned short ip_id;            // Unique identifier 
    unsigned short ip_offset;        // Fragment offset field
    unsigned char  ip_ttl;           // Time to live
    unsigned char  ip_protocol;      // Protocol(TCP,UDP etc)
    unsigned short ip_checksum;      // IP checksum
    unsigned int   ip_srcaddr;       // Source address
    unsigned int   ip_destaddr;      // Source address
} IPV4_HDR, *PIPV4_HDR, FAR * LPIPV4_HDR;

//
// Define the UDP header 
//
typedef struct udp_hdr
{
    unsigned short src_portno;       // Source port no.
    unsigned short dest_portno;      // Dest. port no.
    unsigned short udp_length;       // Udp packet length
    unsigned short udp_checksum;     // Udp checksum
} UDP_HDR, *PUDP_HDR;

#pragma	pack(pop)


//////////////////////////////////////////////////////

#pragma	pack(push,1)

typedef	struct ip_hdr_udp
{
	IPV4_HDR	sHdrIp;
	UDP_HDR		sHdrUdp;
	BYTE		pData[1];

} UDP_IP_HDR;



typedef	struct netbios_name_reply
{
	USHORT	nTransactionID;
	USHORT	nFlags1;
	USHORT	nQuestion;
	USHORT	nAnswer;
	USHORT	nAuthority;
	USHORT	nAdditional;
	char	cbX;
	char	pszName[32];
	char	cbY;
	USHORT	nType;
	USHORT	nClass;
	USHORT	nTTL1;
	USHORT	nTTL2;
	USHORT	nLen;
	USHORT	nFlags2;
	UINT	nSrcAddr;
} NETBIOS_NAME_REPLY;


#pragma	pack(pop)


enum	RD_DEVICE_ID
{
	DEVICE_HDD			= 1,
	DEVICE_DVD			= 2,
	DEVICE_HDD_DVD		= 3,
	DEVICE_HDD2			= 4,
	DEVICE_HDD_HDD2		= 5,
	DEVICE_DVD_HDD2		= 6,
	DEVICE_HDD_DVD_HDD2	= 7,
	DEVICE_4			= 8,
	DEVICE_HDD_4		= 9,
	DEVICE_DVD_4		= 10,
	DEVICE_HDD_DVD_4	= 11,
	DEVICE_HDD2_4		= 12,
	DEVICE_HDD_HDD2_4	= 13,
	DEVICE_DVD_HDD2_4	= 14,
	//DEVICE_HDD_DVD_HDD2	= 15,
	DEVICE_5			= 16,
	DEVICE_HDD_5		= 17,
};




//
//	TOSHIBA RDシリーズ向けの名前問い合わせ返答処理
//
//【目的】
//TOSHIBA RDシリーズではネットDEダビングなどのためにダビング先機器を検索する際に
//UDP/137（NetBIOSの名前問い合わせ）を送信する。
//ここではその問い合わせに対して返答を返す。
//
//【処理の流れ】
//WinSock2のRAWソケットで全パケットをキャプチャする。
//キャプチャデータのうちUDP/137（NetBIOS名前問い合わせ）以外は無視
//NetBIOS名前問い合わせに対する返答をTOSHIBAのRDシリーズ用に送信
//
bool	ReplyNetBiosNS()
{
	int		nRet;
	SOCKET	sock;
	DWORD	dwReturned;

	//RAW SOCKETを作る
	sock = ::WSASocket(AF_INET,SOCK_RAW,IPPROTO_IP,NULL,0,WSA_FLAG_OVERLAPPED);
	if(sock == INVALID_SOCKET)
		return false;

	{
		SOCKADDR_IN	sSockAddrIn;

		//パケットを監視するインターフェースを選ぶ
		//ここでは簡易のため最初に見つかったインターフェースを利用している
		//PCに複数のインターフェース（無線LANと有線LANなど）がある場合は適宜変更すること
		//無線LANが何番目に見つかるかなど、物理的なNICとの関連付けをしたい場合は、GetIfTableを利用する
		{
			int		nNo;
			BYTE	pBuff[1024];
			SOCKET_ADDRESS_LIST* pSockAddrList;

			//何番目に見つかったインターフェースを利用するか
			//2番目のインターフェースを利用したい場合は「1」に変更
			nNo = 0;

			// アダプタの列挙
			nRet = ::WSAIoctl(sock,SIO_ADDRESS_LIST_QUERY,NULL,0,pBuff,1024,&amp;dwReturned,NULL,NULL);
			if(nRet == SOCKET_ERROR || dwReturned == 0)
			{
				::closesocket(sock);
				return false;
			}

			pSockAddrList = (SOCKET_ADDRESS_LIST*)pBuff;

			if(nNo &gt;= pSockAddrList-&gt;iAddressCount)
			{
				::closesocket(sock);
				return false;
			}
			sSockAddrIn.sin_addr.s_addr= ((SOCKADDR_IN*)pSockAddrList-&gt;Address[nNo].lpSockaddr)-&gt;sin_addr.s_addr;
		}


		//バインドとキャプチャ-の有効化
		//WSAIoctlに渡すコマンドによってキャプチャ-種などを変更できる
		{
			BOOL	bOption;

			//sSockAddrIn.sin_addr.s_addr	= INADDR_ANY; &lt;-これはNG.必ずSIO_ADDRESS_LIST_QUERYで求めた値を利用する
			sSockAddrIn.sin_family	= AF_INET;
			sSockAddrIn.sin_port	= htons(0);

			nRet = ::bind(sock,(sockaddr*)&amp;sSockAddrIn,sizeof(SOCKADDR_IN));
			if(nRet == SOCKET_ERROR) 
			{
				::closesocket(sock);
				return false;
			}

			//パケットキャプチャの有効化(Windows 2000以降対応)
			bOption = TRUE;
			nRet = ::WSAIoctl(sock,SIO_RCVALL,&amp;bOption,sizeof(BOOL),NULL,0,&amp;dwReturned,NULL,NULL);
			if(nRet == SOCKET_ERROR)
			{
				::closesocket(sock);
				return false;
			}
		}
	}





	//キャプチャの実行とNetBIOS名前問い合わせへの返答
	{
		char	pBuff[204800];
		WSABUF	sWsaBuf;
		DWORD	dwFlags;
		DWORD	dwTick;

		dwTick = ::GetTickCount();

		while(1)
		{
			::Sleep(0);

			//処理時間を10秒間に制限
			if(::GetTickCount() - dwTick &gt; 10*1000)
				break;


			dwFlags = 0;
			::ZeroMemory(pBuff,sizeof(pBuff));
			sWsaBuf.buf = pBuff;
			sWsaBuf.len = sizeof(pBuff);

			//パケット受信
			nRet = ::WSARecv(sock,&amp;sWsaBuf,1,&amp;dwReturned,&amp;dwFlags,NULL,NULL);
			if(nRet == SOCKET_ERROR)
				continue;


			//受信データの解析
			{
				UDP_IP_HDR*	pHdr;

				//UDP分のデータ長がなければ処理しない
				if(dwReturned &lt; sizeof(UDP_IP_HDR))
					continue;

				pHdr = (UDP_IP_HDR*)pBuff;

				//IPv4、かつ、IPヘッダーサイズが5×32bit以外のときは処理しない
				if(pHdr-&gt;sHdrIp.ip_verlen != 0x45)
					continue;

				//UDP/139以外は処理しない
				if(pHdr-&gt;sHdrIp.ip_protocol != IPPROTO_UDP || pHdr-&gt;sHdrUdp.dest_portno != ::htons(137))
					continue;


				//NetBIOSの名前問い合わせに返答する。。。ただしTOSHIBAのHDDレコーダーRDシリーズ形式で返す
				{
					UINT	i;
					BYTE	cbDeviceID;
					BYTE	cbTransactionID;
					NETBIOS_NAME_REPLY	sReply;
					char	pszName[] = &quot;usefullcode.net&quot;;	//機器名、最大15文字

					//TOSHIBA RDシリーズではトランザクションIDの1バイト目がデバイス種別になっている
					cbDeviceID		= DEVICE_HDD;			//enum RD_DEVICE_ID内の各値を使用可能
					cbTransactionID = pHdr-&gt;pData[1];

					::ZeroMemory(&amp;sReply,sizeof(NETBIOS_NAME_REPLY));
					sReply.nTransactionID = ::htons((cbDeviceID &lt;&lt; 8) + cbTransactionID);
					sReply.nFlags1		= ::htons(0x8500);
					sReply.nQuestion	= 0;
					sReply.nAnswer		= ::htons(0x0001);
					sReply.cbX			= 0x32;

					//NetBIOS形式で名前をエンコード
					for(i = 0;i &lt; 15; i++)
					{
						if(i &lt; ::strlen(pszName))
						{
							sReply.pszName[i*2+0] = ((pszName[i] &amp; 0xF0) &gt;&gt; 4) + 'A';
							sReply.pszName[i*2+1] = ((pszName[i] &amp; 0x0F) &gt;&gt; 0) + 'A';
						}
						else
						{
							sReply.pszName[i*2+0] = ((' ' &amp; 0xF0) &gt;&gt; 4) + 'A';
							sReply.pszName[i*2+1] = ((' ' &amp; 0x0F) &gt;&gt; 0) + 'A';
						}
					}

					sReply.nType		= ::htons(0x0020);
					sReply.nClass		= ::htons(0x0001);
					sReply.nLen			= 0;
					sReply.nSrcAddr		= pHdr-&gt;sHdrIp.ip_srcaddr;


					SOCKET		sock;
					sockaddr_in	addr;

					sock = ::socket(AF_INET,SOCK_DGRAM,0);

					addr.sin_family		= AF_INET;
					addr.sin_port		= ::htons(137);
					addr.sin_addr.s_addr= pHdr-&gt;sHdrIp.ip_srcaddr;

					//返答の送信
					::sendto(sock,(char*)&amp;sReply,sizeof(NETBIOS_NAME_REPLY),0,(sockaddr*)&amp;addr,sizeof(sockaddr));

					::closesocket(sock);
				}
			}
		}
	} 

	::closesocket(sock);

	return	true;
}


bool	Test()
{
	WSAData wsaData;

	//Winsock2.2
	::WSAStartup(MAKEWORD(2,2),&amp;wsaData);

	ReplyNetBiosNS();

	::WSACleanup();

	return	true;
}</pre>

<a href="http://www.usefullcode.net/2007/03/16/Test126.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/03/netbios.html</link>
         <guid>http://www.usefullcode.net/2007/03/netbios.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">ネットワーク</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">bind</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">closesocket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">GetTickCount</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">sendto</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">Sleep</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">socket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSACleanup</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSAIoctl</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSARecv</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSASocket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSAStartup</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">Zeromemory</category>
        
         <pubDate>Fri, 16 Mar 2007 20:22:03 +0900</pubDate>
      </item>
            <item>
         <title>ネットワークに流れるパケットをキャプチャする</title>
         <description><![CDATA[<a href="http://www.usefullcode.net/2007/03/16/test125.gif" rel="lightbox"><img alt="test125.gif" src="http://www.usefullcode.net/2007/03/16/test125-thumb.gif" width="400" height="305" align="left" /></a>
Windows 2000以降ではかなり簡単にネットワークのパケットモニターを作れる。<br>
ここではWinSock2.2のRAWソケットを利用してパケットデータを取得している。取得結果はVisual Studioの「出力」ウインドウに表示している。
<br clear=left>


依存環境：ATL
<pre class=SourceCode>#include &lt;mstcpip.h&gt;
#include &lt;winsock2.h&gt;
#pragma	comment(lib,&quot;Ws2_32.lib&quot;)



//////////////////////////////////////////////////////
//以下の構造体はWindows SDKのサンプルに含まれる「iphdr.h」内からコピー
//

#pragma	pack(push,1)

//
// IPv4 Header (without any IP options)
//
typedef struct ip_hdr
{
    unsigned char  ip_verlen;        // 4-bit IPv4 version
                                     // 4-bit header length (in 32-bit words)
    unsigned char  ip_tos;           // IP type of service
    unsigned short ip_totallength;   // Total length
    unsigned short ip_id;            // Unique identifier 
    unsigned short ip_offset;        // Fragment offset field
    unsigned char  ip_ttl;           // Time to live
    unsigned char  ip_protocol;      // Protocol(TCP,UDP etc)
    unsigned short ip_checksum;      // IP checksum
    unsigned int   ip_srcaddr;       // Source address
    unsigned int   ip_destaddr;      // Source address
} IPV4_HDR, *PIPV4_HDR, FAR * LPIPV4_HDR;

//
// Define the UDP header 
//
typedef struct udp_hdr
{
    unsigned short src_portno;       // Source port no.
    unsigned short dest_portno;      // Dest. port no.
    unsigned short udp_length;       // Udp packet length
    unsigned short udp_checksum;     // Udp checksum
} UDP_HDR, *PUDP_HDR;

//
// Define the TCP header
//
typedef struct tpc_hdr				// &lt;- スペルミス？動作に問題なし
{
    unsigned short src_portno;       // Source port no.
    unsigned short dest_portno;      // Dest. port no.
    unsigned long  seq_num;          // Sequence number
    unsigned long  ack_num;          // Acknowledgement number;
    unsigned short lenflags;         // Header length and flags
    unsigned short window_size;      // Window size
    unsigned short tcp_checksum;     // Checksum
    unsigned short tcp_urgentptr;    // Urgent data?
} TCP_HDR, *PTCP_HDR;

#pragma	pack(pop)


//////////////////////////////////////////////////////

#pragma	pack(push,1)

typedef	struct ip_hdr_tcp
{
	IPV4_HDR	sHdrIp;
	TCP_HDR		sHdrTcp;
	BYTE		pData[1];

} TCP_IP_HDR;

typedef	struct ip_hdr_udp
{
	IPV4_HDR	sHdrIp;
	UDP_HDR		sHdrUdp;
	BYTE		pData[1];

} UDP_IP_HDR;


#pragma	pack(pop)


#define	SWAP_BYTE_ALIGNMENT(data)	\
{									\
	int		i;						\
	int		nSize;					\
	int		nLoop;					\
	BYTE*	pData;					\
	BYTE	cbTmp;					\
									\
	pData = (BYTE*)&amp;data;			\
	nSize = sizeof(data);			\
	nLoop = nSize / 2;				\
	for(i = 0; i &lt; nLoop; i++)		\
	{								\
		cbTmp = *(pData + i);		\
		*(pData + i) = *(pData + nSize - i - 1);	\
		*(pData + nSize - i - 1) = cbTmp;			\
	}								\
}


bool	PacketCapture()
{
	int		nRet;
	SOCKET	sock;
	DWORD	dwReturned;

	//RAW SOCKETを作る
	sock = ::WSASocket(AF_INET,SOCK_RAW,IPPROTO_IP,NULL,0,WSA_FLAG_OVERLAPPED);
	if(sock == INVALID_SOCKET)
		return false;

	{
		SOCKADDR_IN	sSockAddrIn;

		//パケットを監視するインターフェースを選ぶ
		//ここでは簡易のため最初に見つかったインターフェースを利用している
		//PCに複数のインターフェース（無線LANと有線LANなど）がある場合は適宜変更すること
		//無線LANが何番目に見つかるかなど、物理的なNICとの関連付けをしたい場合は、GetIfTableを利用する
		{
			int		nNo;
			BYTE	pBuff[1024];
			SOCKET_ADDRESS_LIST* pSockAddrList;

			//何番目に見つかったインターフェースを利用するか
			//2番目のインターフェースを利用したい場合は「1」に変更
			nNo = 0;

			// アダプタの列挙
			nRet = ::WSAIoctl(sock,SIO_ADDRESS_LIST_QUERY,NULL,0,pBuff,1024,&amp;dwReturned,NULL,NULL);
			if(nRet == SOCKET_ERROR || dwReturned == 0)
			{
				::closesocket(sock);
				return false;
			}

			pSockAddrList = (SOCKET_ADDRESS_LIST*)pBuff;

			if(nNo &gt;= pSockAddrList-&gt;iAddressCount)
			{
				::closesocket(sock);
				return false;
			}
			sSockAddrIn.sin_addr.s_addr= ((SOCKADDR_IN*)pSockAddrList-&gt;Address[nNo].lpSockaddr)-&gt;sin_addr.s_addr;
		}


		//バインドとキャプチャ-の有効化
		//WSAIoctlに渡すコマンドによってキャプチャ-種などを変更できる
		{
			BOOL	bOption;

			//sSockAddrIn.sin_addr.s_addr	= INADDR_ANY; &lt;-これはNG.必ずSIO_ADDRESS_LIST_QUERYで求めた値を利用する
			sSockAddrIn.sin_family	= AF_INET;
			sSockAddrIn.sin_port	= htons(0);

			nRet = ::bind(sock,(sockaddr*)&amp;sSockAddrIn,sizeof(SOCKADDR_IN));
			if(nRet == SOCKET_ERROR) 
			{
				::closesocket(sock);
				return false;
			}

			//パケットキャプチャの有効化(Windows 2000以降対応)
			bOption = TRUE;
			nRet = ::WSAIoctl(sock,SIO_RCVALL,&amp;bOption,sizeof(BOOL),NULL,0,&amp;dwReturned,NULL,NULL);
			if(nRet == SOCKET_ERROR)
			{
				::closesocket(sock);
				return false;
			}
		}
	}





	//キャプチャの実行とキャプチャデータの表示
	{
		char	pBuff[204800];
		WSABUF	sWsaBuf;
		DWORD	dwFlags;
		DWORD	dwTick;

		dwTick = ::GetTickCount();

		while(1)
		{
			::Sleep(0);

			//キャプチャ時間を10秒間に制限
			if(::GetTickCount() - dwTick &gt; 10*1000)
				break;


			dwFlags = 0;
			::ZeroMemory(pBuff,sizeof(pBuff));
			sWsaBuf.buf = pBuff;
			sWsaBuf.len = sizeof(pBuff);

			//パケット受信
			nRet = ::WSARecv(sock,&amp;sWsaBuf,1,&amp;dwReturned,&amp;dwFlags,NULL,NULL);
			if(nRet == SOCKET_ERROR)
				continue;

			//受信パケット情報の表示
			//ここではIPv4に限って送信元と送信先、TCPかUDPの場合はポート番号の表示のみを処理している
			{
				IPV4_HDR*	pHdr;

				if(dwReturned &lt; sizeof(IPV4_HDR))
					continue;

				pHdr = (IPV4_HDR*)pBuff;

				//IPv4、かつ、IPヘッダーサイズが5×32bit以外のときは処理しない
				if(pHdr-&gt;ip_verlen != 0x45)
					continue;

				ATLTRACE(&quot;送信元：%d.%d.%d.%d\n&quot;,(pHdr-&gt;ip_srcaddr &gt;&gt; 0) &amp; 0xFF,(pHdr-&gt;ip_srcaddr &gt;&gt; 8) &amp; 0xFF,(pHdr-&gt;ip_srcaddr &gt;&gt; 16) &amp; 0xFF,(pHdr-&gt;ip_srcaddr &gt;&gt; 24) &amp; 0xFF);
				ATLTRACE(&quot;送信先：%d.%d.%d.%d\n&quot;,(pHdr-&gt;ip_destaddr &gt;&gt; 0) &amp; 0xFF,(pHdr-&gt;ip_destaddr &gt;&gt; 8) &amp; 0xFF,(pHdr-&gt;ip_destaddr &gt;&gt; 16) &amp; 0xFF,(pHdr-&gt;ip_destaddr &gt;&gt; 24) &amp; 0xFF);

				//プロトコルに応じた処理（プロトコルの一覧は「ws2def.h」内で定義されている）
				switch(pHdr-&gt;ip_protocol)
				{
				case	IPPROTO_TCP:
					if(dwReturned &gt;= sizeof(TCP_IP_HDR) - 1)
					{
						USHORT		nSrcPort;
						USHORT		nDstPort;
						TCP_IP_HDR*	pTcp;

						pTcp = (TCP_IP_HDR*)pHdr;

						//ポート番号などはエンディアンが異なるので注意
						nSrcPort = pTcp-&gt;sHdrTcp.src_portno;
						nDstPort = pTcp-&gt;sHdrTcp.dest_portno;
						SWAP_BYTE_ALIGNMENT(nSrcPort);
						SWAP_BYTE_ALIGNMENT(nDstPort);
						ATLTRACE(&quot;送信元ポート番号：%d\n&quot;,nSrcPort);
						ATLTRACE(&quot;送信先ポート番号：%d\n&quot;,nDstPort);
					}
					break;

				case	IPPROTO_UDP:
					if(dwReturned &gt;= sizeof(UDP_IP_HDR) - 1)
					{
						USHORT		nSrcPort;
						USHORT		nDstPort;
						UDP_IP_HDR*	pUdp;

						pUdp = (UDP_IP_HDR*)pHdr;

						//ポート番号などはエンディアンが異なるので注意
						nSrcPort = pUdp-&gt;sHdrUdp.src_portno;
						nDstPort = pUdp-&gt;sHdrUdp.dest_portno;
						SWAP_BYTE_ALIGNMENT(nSrcPort);
						SWAP_BYTE_ALIGNMENT(nDstPort);
						ATLTRACE(&quot;送信元ポート番号：%d\n&quot;,nSrcPort);
						ATLTRACE(&quot;送信先ポート番号：%d\n&quot;,nDstPort);
					}
					break;

				//今回はTCP/UDP以外は処理しない
				default:
					break;
				}

				ATLTRACE(&quot;\n&quot;);
			}
		}
	} 

	::closesocket(sock);

	return	true;
}


bool	Test()
{
	WSAData wsaData;

	//Winsock2.2
	::WSAStartup(MAKEWORD(2,2),&amp;wsaData);

	PacketCapture();

	::WSACleanup();

	return	true;
}</pre>


<a href="http://www.usefullcode.net/2007/03/16/Test125.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/03/packet_capture.html</link>
         <guid>http://www.usefullcode.net/2007/03/packet_capture.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">ネットワーク</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">bind</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">closesocket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">GetTickCount</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSACleanup</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSAIoctl</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSARecv</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSASocket</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">WSAStartup</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">ZeroMemory</category>
        
         <pubDate>Fri, 16 Mar 2007 17:32:03 +0900</pubDate>
      </item>
            <item>
         <title>2進数表記の文字列をlong型の数値に変換する</title>
         <description><![CDATA[「01001001」のように0と1だけの2進数で書かれた文字列を数値に変換するにはstrtol系の関数が利用できる。従来通りに1文字ずつ判別しながら数値に変換してもいいが、この関数を利用すればかなり楽ができる。覚えておいて損はないだろう。

<pre class=SourceCode>bool	Test()
{
	////////////////////////////////
	//	2進数表記の文字列をlong型の数値に変換
	//
	{
		//char型文字列から変換
		long	nValue;
		char	pszText[] = &quot;01001001&quot;;
		char*	pszEnd;

		nValue = ::strtol(pszText,&amp;pszEnd,2);
	}
	{
		//wchar_t型文字列から変換
		long		nValue;
		wchar_t		pszText[] = L&quot;01001001&quot;;
		wchar_t*	pszEnd;

		nValue = ::wcstol(pszText,&amp;pszEnd,2);
	}
	{
		//TCHAR型文字列から変換
		long	nValue;
		TCHAR	pszText[] = _T(&quot;01001001&quot;);
		TCHAR*	pszEnd;

		nValue = ::_tcstol(pszText,&amp;pszEnd,2);
	}
	{
		//CString型文字列から変換
		long	nValue;
		CString	strText = _T(&quot;01001001&quot;);
		TCHAR*	pszEnd;

		nValue = ::_tcstol(strText,&amp;pszEnd,2);
	}

	return	true;
}</pre>

<a href="http://www.usefullcode.net/2007/02/26/Test124.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/02/2long.html</link>
         <guid>http://www.usefullcode.net/2007/02/2long.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">文字列操作</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">strtol</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">wcstol</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">_tcstol</category>
        
         <pubDate>Mon, 26 Feb 2007 20:48:08 +0900</pubDate>
      </item>
            <item>
         <title>16進数表記の文字列をlong型の数値に変換する</title>
         <description><![CDATA[「0x0123」や「0FFF」のように16進数で書かれた文字列を数値に変換するにはstrtol系の関数が利用できる。従来通りに1文字ずつ判別しながら数値に変換してもいいが、この関数を利用すればかなり楽ができる。覚えておいて損はないだろう。


<pre class=SourceCode>bool	Test()
{
	////////////////////////////////
	//	16進数表記の文字列をlong型の数値に変換
	//
	{
		//char型文字列から変換
		long	nValue;
		char	pszText[] = &quot;0ab3&quot;;
		char*	pszEnd;

		nValue = ::strtol(pszText,&amp;pszEnd,16);
	}
	{
		//wchar_t型文字列から変換
		long		nValue;
		wchar_t		pszText[] = L&quot;0ab3&quot;;
		wchar_t*	pszEnd;

		nValue = ::wcstol(pszText,&amp;pszEnd,16);
	}
	{
		//TCHAR型文字列から変換
		long	nValue;
		TCHAR	pszText[] = _T(&quot;0ab3&quot;);
		TCHAR*	pszEnd;

		nValue = ::_tcstol(pszText,&amp;pszEnd,16);
	}
	{
		//CString型文字列から変換
		long	nValue;
		CString	strText = _T(&quot;0ab3&quot;);
		TCHAR*	pszEnd;

		nValue = ::_tcstol(strText,&amp;pszEnd,16);
	}

	return	true;
}</pre>

<a href="http://www.usefullcode.net/2007/02/26/Test123.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/02/16long.html</link>
         <guid>http://www.usefullcode.net/2007/02/16long.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">文字列操作</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">strtol</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">wcstol</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">_tcstol</category>
        
         <pubDate>Mon, 26 Feb 2007 20:13:31 +0900</pubDate>
      </item>
            <item>
         <title>10進数表記の文字列をint型の数値に変換する</title>
         <description><![CDATA[文字列をint型の数値に変換するには従来通りatoi系の関数が利用できる。変換元の文字列の型に応じてatoi、_wtoi、_ttoiを使い分けるといい。


<pre class=SourceCode>bool	Test()
{
	////////////////////////////////
	//	10進数表記の文字列をint型数値に変換
	//
	{
		//char型文字列から変換
		int		nValue;
		char	pszText[] = &quot;123&quot;;

		nValue = ::atoi(pszText);
	}
	{
		//wchar_t型文字列から変換
		int		nValue;
		wchar_t	pszText[] = L&quot;123&quot;;

		nValue = ::_wtoi(pszText);
	}
	{
		//TCHAR型文字列から変換
		int		nValue;
		TCHAR	pszText[] = _T(&quot;123&quot;);

		nValue = ::_ttoi(pszText);
	}
	{
		//CString型文字列から変換
		int		nValue;
		CString	strText = _T(&quot;123&quot;);

		nValue = ::_ttoi(strText);
	}

	return	true;
}</pre>

<a href="http://www.usefullcode.net/2007/02/26/Test122.zip">プロジェクトファイルをダウンロード</a>
]]></description>
         <link>http://www.usefullcode.net/2007/02/string2int.html</link>
         <guid>http://www.usefullcode.net/2007/02/string2int.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">文字列操作</category>
        
                  <category domain="http://www.sixapart.com/ns/types#tag">atoi</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">_ttoi</category>
                  <category domain="http://www.sixapart.com/ns/types#tag">_wtoi</category>
        
         <pubDate>Mon, 26 Feb 2007 19:58:32 +0900</pubDate>
      </item>
      
   </channel>
</rss>
