2024年5月
 1234
567891011
12131415161718
19202122232425
262728293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,682 アクセス



AfxGetInstanceHandle

コンソール AP を変更していて「MFC を使用」にすると AfxGetInstanceHandle で ASSERT .
AfxGetInstanceHandle ASSERT

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: c:\Temp\TOutline\tolmba\Debug.060\tolmba.exe
File: afxwin1.inl
Line: 19

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
中止(A)   再試行(R)   無視(I)   
---------------------------

この単体テスト用プロジェクトは,最初 MFC を使用しないでコードを書いていた.
が,幾つかの機能を付けていくと MFC を使用した既存のコードが必要になった.
その中で AfxGetInstanceHandle() を呼出している所があり,そこで ASSERT .


次の様に MFC の初期化 ::AfxWinInit を追加して対応.

int	_tmain	(int argc,TCHAR* argv[])
{
	#ifdef	_MFC_VER
	if (!::AfxWinInit(::GetModuleHandle(NULL),NULL,::GetCommandLine(),0)) {
		return	1 ;
		}
	#endif
	_tsetlocale(LC_ALL,_T("")) ;
//	...
	return	0 ;
	}
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

::EnumFontFamilies…

フォントを列挙する方法を「ChatGPT」と「Bingチャット」で問合わせてみた.


ChatGPT

#include <windows.h>
#include <iostream>

int main() {
    HDC hdc = GetDC(NULL);
    LOGFONT lf;
    memset(&lf, 0, sizeof(LOGFONT));
    lf.lfCharSet = DEFAULT_CHARSET;
    std::cout << "Available Fonts:" << std::endl;
    EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontFamiliesCallback, 0, 0);
    ReleaseDC(NULL, hdc);
    return 0;
}

int CALLBACK EnumFontFamiliesCallback(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, DWORD FontType, LPARAM lParam) {
    std::cout << lpelfe->elfFullName << std::endl;
    return 1;
}

Bingチャット

#include <windows.h>
#include <iostream>
#include <string>

int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* lpelfe, NEWTEXTMETRICEXW* lpntme, DWORD FontType, LPARAM lParam)
{
    std::wcout << lpelfe->elfFullName << std::endl;
    return 1;
}

int main()
{
    HDC hdc = GetDC(NULL);
    LOGFONTW lf = { 0 };
    lf.lfCharSet = DEFAULT_CHARSET;
    EnumFontFamiliesExW(hdc, &lf, (FONTENUMPROCW)EnumFontFamExProc, 0, 0);
    ReleaseDC(NULL, hdc);
    return 0;
}

以前よりも精度が上がった様に感じる.
EnumFontFamilies...

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

VC 14.x での MFC のソース?

VC 2019 など最新でない VC を使用していると,MFC ソースにステップイン できなくなることがある.
VC 2019 MFC cstring.h
大抵は,インストールされている最新の MFC の場所を指定すれば良さそう.

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\atlmfc\include
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\atlmfc\src\mfc

VC 2019 atlmfc src mfc


VC のアップデートがあり更新したためか,一部で「ビルド時のものと異なる」と表示されるようになった.

---------------------------
Microsoft Visual Studio
---------------------------
ソース ファイル:C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\atlmfc\include\cstringt.h
モジュール:C:\Windows\SysWOW64\mfc140ud.dll
プロセス:[28036] GLSmth.exe
ソース ファイルがモジュールがビルドされたときのものと異なります。デバッガーでこのファイルを使用しますか?
---------------------------
はい(Y)   いいえ(N)   
---------------------------

VC 2022 MFC cstring.h
VC 2022 で試しても同様になるので,アップデートの問題か?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

角の二等分線

https://en.wikipedia.org/wiki/Bisection
wiki にあるアニメーションをコードにしたもの.

Ld2	V2_get_bisector	(const Vd2& vp,const Vd2& vc,const Vd2& vn)
{
	//	    * vp    
	//	    |       
	//	    |       
	//	    |       * vcx
	//	    |     / 
	//	    | o /   
	//	    | / o   
	//	vc  * - - - - - - * vn
	Vd2	vcp = (vp-vc).Normalized() ;
	Vd2	vcn = (vn-vc).Normalized() ;
	Vd2	vcb = (vcp+vcn)/2. ;
	Vd2	vcx = vcb + vc ;
	{
		vcx = ::get_cross_line(vp,vn,vc,vcx) ;
		}
	Ld2	lbs(vc,vcx) ;
	return	lbs ;
	}

青い円弧が,最初の 2 行の Normalized .
次の中点を求めているのは,赤い円弧の交点を結ぶ線にあたる.
二等分線を対辺?まで延長.
二等分線
角の二等分線

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

MariaDB「データベースをリセット」

先日 Synology NAS を DSM 7.2 に更新して,困った現象があった.
実際は DSM の問題ではなく,Joomla! のバージョンが 3.10 から 4.2.9 になったとこによるもの.
記事などの一覧を表示しようとすると,エラーになってしまう.
Joomla! 4 の記事一覧などでエラー


検索などもしてみたが,いい情報に引っ掛からない.
それでいろいろと弄っていて,間違って DS116 の DB を削除してしまった
MariaDB 10  「データベースを
リセット」
Joomla! や WordPress の記事がきれいになくなってしまった.


こうなると何でもできるので,WordPress と Joomla! のパッケージを削除,再インストール.
WordPress は,完全ではないが DS220 からインポート.
Joomla! の方はこれからだが,記事の一覧などを表示できそうなところまでは確認済み.
Joomla! 4  カテゴリ一覧


データをインポートするために J2XML を使おうとするが,4.0 での対応が不明.
エクステンションのインストール画面で検索しても出てこない(All Version とすると表示はされる).
検索すると J2XML 3.9 だと対応しているみたい.
pkg_j2xml-3.9.231.zip をダウンロードして,インストール.
1 つの記事だけ 何故かダメだったが,何とかインポートまではできた.
xml の中身を見ると環境依存文字?が含まれていた.
J2XML でインポートできなかったデータ
それを削除すると何とか通った.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

WebGL での 3D データ表示

さらに,以前作成した Web サーバ を利用して WebGL での表示に

bool	test	(void)
{
	Vd2A	pts ;
	{
		pts.push_back(Vd2(  0,  0)) ;
		pts.push_back(Vd2( 70,  0)) ;
		pts.push_back(Vd2( 90, 50)) ;
		pts.push_back(Vd2(100,100)) ;
		pts.push_back(Vd2( 50,100)) ;
		pts.push_back(Vd2( 30, 70)) ;
		pts.push_back(Vd2( 40, 30)) ;
		pts.push_back(Vd2(  0,  0)) ;
		}
	vv_PLF	vvplf ;
	{
		Vd3A	v3a = ::ToVd3A(pts) ;
		Vd4A	v4a = ::ToVd4A(v3a) ;
		PLF	plf_l(PLF::line,v4a) ;
		PLF	plf_f(PLF::face,v4a) ;
		v_PLF	v_plf ;
			v_plf.push_back(plf_l) ;
			v_plf.push_back(plf_f) ;
			vvplf.push_back(v_plf) ;
		}
	{
		tstring	tmp_path = ::Get_i_Tools_tmp_date() ;
		tstring	out_name = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T("__.htm") ;
		tstring	outtname = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T("_t.htm") ;
		tstring	outnname = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T("_n.htm") ;
		{
			GonsA	gnsa = ::PLF_ToGonsA(vvplf) ;
			::GonsA_ToWGL(gnsa,out_name.c_str()) ;
				gnsa = ::GonsA_Triangulation(gnsa) ;
			::GonsA_ToWGL(gnsa,outtname.c_str()) ;
				gnsa = ::GonsA_CalcNormal   (gnsa) ;
			::GonsA_ToWGL(gnsa,outnname.c_str()) ;
			}
		{
			::start_web_server(tmp_path) ;
			}
		}
	tstring	g3_d_exe = ::get_g3_d_exe() ;
	if (!g3_d_exe.empty()) {
		tstring	tmp_path = ::Get_i_Tools_tmp_date() ;
		tstring	ipl_name = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T(".ipl") ;
		::To_ipl  (vvplf,ipl_name.c_str()) ;
		::start_g3_d(ipl_name.c_str()) ;
		}
	return	true ;
	}

簡易 Web サーバで WebGL

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux での GLUT 3D データ表示

昨日のコードをもう少し汎用的に修正.そしてそれを他から呼出せるように変更.
次の様なコードで 3D データを生成して,GLUT で表示できる様にした.

bool	test	(void)
{
	Vd2A	pts ;
	{
		pts.push_back(Vd2(  0,  0)) ;
		pts.push_back(Vd2( 70,  0)) ;
		pts.push_back(Vd2( 90, 50)) ;
		pts.push_back(Vd2(100,100)) ;
		pts.push_back(Vd2( 50,100)) ;
		pts.push_back(Vd2( 30, 70)) ;
		pts.push_back(Vd2( 40, 30)) ;
		pts.push_back(Vd2(  0,  0)) ;
		}
	vv_PLF	vvplf ;
	{
		Vd3A	v3a = ::ToVd3A(pts) ;
		Vd4A	v4a = ::ToVd4A(v3a) ;
		PLF	plf_l__ (PLF::line,v4a) ;
		PLF	plf_f__ (PLF::face,v4a) ;
		v_PLF	v_plf ;
			v_plf.push_back(plf_l__) ;
			v_plf.push_back(plf_f__) ;
			vvplf.push_back(v_plf) ;
		}
	tstring	txt_name = ::g3_d_get_txt_name() ;
	{
		tstring	tmp_path = ::Get_i_Tools_tmp_date() ;
		tstring	ipl_name = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T(".ipl") ;
		::To_ipl  (vvplf,ipl_name.c_str()) ;
		::SaveText(txt_name.c_str(),ipl_name) ;
		}
	{
		::exec_g3_d(txt_name.c_str()) ;
		}
	return	true ;
	}

g3_d_gl

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

GLUT を使用した 3D データの表示

個人的なメモです.
4 年位前に作成したコードで,凹多角形がうまく処理できていないものがあったのでその変更.

#include	"glut_cg.hxx"
#include	"gonsa_to.hxx"

#define		TIMING_DN	1000

//	int	_tmain	(int argc, _TCHAR* argv[])
int		main	(int argc,   char* argv[])
{
	{
		GonsA	gnsa ;
		{
			tstring	buf ;	buf.resize(1000) ;
			while (std::terr << _T("file ? =") , std::tin.getline(&buf[0],buf.size()))
			{
				tstring	str = buf.c_str() ;
				if 	(str == _T("q"))    {	break ;		}
				else if (str == _T("Q"))    {	break ;		}
				str = ::QuotM_Del_All(str) ;
				if (str.empty())            {	continue ;	}
				if (::File_IsNothing(str))  {	continue ;	}
				tstring	in_file = str ;
				gnsa = ::To_GonsA(in_file.c_str()) ;
				gnsa = ::GonsA_Triangulation(gnsa) ;		//	2023/06/27
				gnsa = ::GonsA_CalcNormal   (gnsa) ;		//	2023/06/27
				if (gnsa.size() > 0)        {	break ;		}
				}
			if (gnsa.size() == 0)           {	return	0 ;		}
			}
		::set_GonsA(gnsa) ;
		::set_Extent(::GonsA_GetExtent(gnsa)) ;
		}
	::glutInitWindowPosition(200,200) ;
	::glutInitWindowSize    (600,400) ;
	::glutInitDisplayMode   (GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) ;
	::glutInit              (&argc,argv) ;
	::glutCreateWindow      (argv[0]) ;
	::glutReshapeFunc       (cv_resize) ;
	::glutDisplayFunc       (cg_display) ;
	::glutKeyboardFunc      (cv_keyboard) ;
	::glutMouseFunc         (cv_mouse) ;
	::glutMotionFunc        (cv_motion) ;
	::glutTimerFunc         (TIMING_DN,cv_timer,TIMING_DN) ;
	::cv_init               () ;
	{
		::glEnable(GL_LIGHTING) ;
		::glEnable(GL_LIGHT0) ;
		}
	::glutMainLoop          () ;
	return	0 ;
	}

#include	"messbar.cxx"

t_gl_b_3.cpp
t_gl_b_3.exe

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

warning C4305:

先日次の様なコードを書いていた.塗りつぶして表示する時の色の補正.

	ColorRGB	colRGB = ::ColorRefToRGB(pgs1.GetColor()) ;
	{
		float	rgbcol = colRGB.R + colRGB.G + colRGB.B ;
		if (rgbcol < 0.20*3) {
			if (colRGB.R < 0.20)	{	colRGB.R = 0.20f ;	}
			if (colRGB.G < 0.20)	{	colRGB.G = 0.20f ;	}
			if (colRGB.B < 0.20)	{	colRGB.B = 0.20f ;	}
			}
		if (0.80*3 < rgbcol) {
			if (0.80 < colRGB.R)	{	colRGB.R = 0.80f ;	}
			if (0.80 < colRGB.G)	{	colRGB.G = 0.80f ;	}
			if (0.80 < colRGB.B)	{	colRGB.B = 0.80f ;	}
			}
		}

ColorRGB.R などは float で,RGB のそれぞれを 0.0 ~ 1.0 で表現したもの.
最初 if (colRGB.R < 0.25) { colRGB.R = 0.25 ; }  の様にしていたが,0.2 に変更した.
すると C4305 の warning .0.2f の様にすれば良いのはわかっているが,他の値で調べてみた.


0.0 , 1.0 , 7.0 などは大丈夫だが,0.2 や 7.1 は C4305 になってしまう.
warning C4305: '=' : truncation from 'const double' to 'float'
コンパイラやオプションの指定にもよると思うが,float で表現できない場合のみ warning となるのか?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Synology NAS DSM 7.2

Synology NAS DS220+ で DSM 7.2 に更新ができる様になっていた.
本当は DS116 で試してからにしたかったが…  DS220+ を更新した.
DSM の更新は 30 分程度.その後 Joomla! や WordPress などで 30 分.


今回の更新で,Joomla! は 3.10 から 4.2.9 に,WordPress は 5.8.3 から 6.1.1 に.
まだ全ての確認はできていないが,以前の更新と比べて影響は少なそう.
DSM 7.1DSM 7
DSM 7.2  Web Station  Web サービス

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

SetForegroundWindow

他 AP から,HWND を指定して前面に移動する方法.

bool	Window_Foreground	(HWND hWnd)
{
	if (hWnd == NULL)	{	return	false ;		}
	if (!::IsWindow(hWnd))	{	return	false ;		}
	{
		if (::IsIconic(hWnd)) {
			WINDOWPLACEMENT	wndpl = { 0 } ;
			::GetWindowPlacement(hWnd,&wndpl) ;
			wndpl.showCmd = SW_RESTORE ;
			::SetWindowPlacement(hWnd,&wndpl) ;
			}
		SetForegroundWindow(hWnd) ;
		}
	return	true ;
	}

SetForegroundWindow


CWnd::SetWindowPos(&wndTopMost,…)

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

FBX SDK 2020.3.4

Windows Update があり,それに合わせて VS も更新.
その VS のリリース情報をみると,FBX に関するものが幾つかあった.
それで FBX SDK のページを見ると 2020.3.4 があった.
今回から VS 2015 は外れ,VS 2022 までになったみたい.他にも 32 ビット版が外れている.
FBX SDK 2020.3.4

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ゼロからの OS 自作入門 第 3 章

main.cpp のコンパイル,リンク.
$ cd ~/workspace/mikanos
$ git checkout osbook_day03a
$ cd kernel
$ clang++ -O2 -Wall -g –target=x86_64-elf -ffreestanding -mno-red-zone -fno-exceptions -fno-rtti -std=c++17 -c main.cpp
$ ld.lld –entry KernelMain -z norelro –image-base 0x100000 –static -o kernel.elf main.o
第 3 章 min.cpp コンパイル,リンク
ブートローダのビルドと実行.
$ cd ~/edk2
$ source edksetup.sh
$ build
$ ~/osbook/devenv/run_qemu.sh Build/MikanLoaderX64/DEBUG_CLANG38/X64/Loader.efi ~/workspace/mikanos/kernel/kernel.elf
第 3 章 ブートローダのビルドと実行
うまくいっているのか,ちょっとわからず.


2023/06/15
$ cd ~/workspace/mikanos
$ git checkout osbook_day03b
$ cd ~/edk2
$ source edksetup.sh
$ build
$ ~/osbook/devenv/run_qemu.sh Build/MikanLoaderX64/DEBUG_CLANG38/X64/Loader.efi ~/workspace/mikanos/kernel/kernel.elf
第 3 章 白で塗りつぶす


$ cd ~/workspace/mikanos
$ git checkout osbook_day03c
$ source ~/osbook/devenv/buildenv.sh
$ cd ~/workspace/mikanos/kernel/
$ clang++ $CPPFLAGS -O2 –target=x86_64-elf -fno-exceptions -ffreestanding -c main.cpp
$ ld.lld $LDFLAGS –entry KernelMain -z norelro –image-base 0x100000 –static -o kernel.elf main.o
$ cd ~/edk2
$ source edksetup.sh
$ build
$ ~/osbook/devenv/run_qemu.sh Build/MikanLoaderX64/DEBUG_CLANG38/X64/Loader.efi ~/workspace/mikanos/kernel/kernel.elf
第 3 章 適当な模様?
これもうまく動作しない.どうも kernel の呼出しがうまく行っていない?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ゼロからの OS 自作入門 第 2 章

本にある通り
$ cd ~/workspace/mikanos
$ git checkout osbook_day02a

$ cd ~/edk2
$ ln -s ~/workspace/mikanos/MikanLoaderPkg ./

$ source edksetup.sh
$ build
第 2 章 Conf/target.txt を設定していないため Failed
Conf/target.txt を「表 2.1」に変更しなければならない?


すると今度は…

build.py...
/home/iwao/edk2/MikanLoaderPkg/MikanLoaderPkg.dsc(...): error 4000: Instance of library class [RegisterFilterLib] is not found
	in [/home/iwao/edk2/MdePkg/Library/BaseLib/BaseLib.inf] [X64]
	consumed by module [/home/iwao/edk2/MikanLoaderPkg/Loader.inf]

第 2 章  error 4000 Instance of library class [RegisterFilterLib] is not foud
error 4000: Instance of library class [RegisterFilterLib] is not found」で検索すると
FAQ(よくある質問とその回答)
次の方法で対応.
$ git checkout 38c8be123aced4cc8ad5c7e0da9121a181b94251
うまくビルドできた.
第 2 章 Hello Mikan World


$ cd ~/workspace/mikanos/
$ git checkout osbook_day02b
$ cd ~/edk2/
$ source edksetup.sh
$ build
$ cd Build/MikanLoaderX64/DEBUG_CLANG38/X64/
$ ~/osbook/devenv/run_qemu.sh ./Loader.efi
第 2 章  day2b hello


2023/06/09 メモリマップの確認
第 2 章 メモリマップ

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

QNAP NAS 証明書の更新

QNAP NAS の Let’s Encrypt での証明書の更新が安定しない.
以前は,自動で更新できていた頃もあったと思う
手動で「証明書更新」としても,うまく更新できない.
今回は,代替名の ts.mish.work を外して,証明書を取得することができた.
QNAP NAS 証明書の更新

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ゼロからの OS 自作入門 第 1 章

昨日 VirtualBox 内の Ubuntu の QEMU が動作することは確認できたので,バイナリコードの入力から.
BOOT_X86.EFI の作成と実行
hello.c をコピー.EfiMain() の while(1) ; のループをコメントにして,コンパイル,リンクしたものを実行.
EfiMain の while(1) をコメントに
EfiMain() を起動した後,BIOS の画面に入った?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

VC 2022 17.6.?

先日 VS 2022 の更新版 があったのでアップデート.
個人的なツールの 3D ビューア をビルドすると,

ALYac           	Gen:Variant.Tedy.373496
Arcabit         	Trojan.Tedy.D5B2F8
BitDefender     	Gen:Variant.Tedy.373496
Cylance         	Unsafe
DeepInstinct    	MALICIOUS
Emsisoft        	Gen:Variant.Tedy.373496 (B)
eScan           	Gen:Variant.Tedy.373496
GData           	Gen:Variant.Tedy.373496
MAX              	Malware (ai Score=81)
McAfee          	Artemis!AE3A9CE560AE
McAfee-GW-Edition	Artemis
Trellix (FireEye)	Gen:Variant.Tedy.373496
TrendMicro-HouseCall	TROJ_GEN.R002H09EQ23
VIPRE           	Gen:Variant.Tedy.373496

VirusTotal  VC 2022 17.6
VC 2019 などでビルドしたものは問題ない.また VC 2022 更新前のものも問題なかった.


今まで VS の更新版が出てすぐにそれでビルドすることは少なかった.
テストが不十分なこともあり,リリース用は主に VC 2017 を使用している.
更新版によっては,この様なことがあるのかもしれない.
落ち着くまでしばらく時間がかかるのか?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ゼロからの OS 自作入門

久しぶりにいい本(自分に合っている本)を購入.

まだ第1章までしか読めていないが,知らないことがいっぱい.
https://zero.osdev.jp/
https://zero.osdev.jp/book-sample.pdf
1 日に 1 章をクリアしていけば,ほぼ 1ヶ月で消化できるみたいだが,そこまでは時間が取れないか?


2023/05/30
少し時間がかかったが,VirtuaBox 内の Ubuntu 22.04.2 LTS に環境を作成した.
確認用 PC 環境は,その Ubuntu 内の QEMU .
手順は,次の所に書かれている通りで,付録 A の状態に.
https://github.com/uchan-nos/mikanos-build
$ cd $HOME
$ git clone https://github.com/uchan-nos/mikanos-build.git osbook

$ sudo apt install ansible
$ cd $HOME/osbook/devenv
$ ansible-playbook -K -i ansible_inventory ansible_provision.yml


これで,QEMU も入るみたいで /usr/bin/ 以下に qemu-* が存在する.
35 ページに書かれている方法でやってみたがうまくいかず,そのページの下の方の run_qemu.sh を使用した.
Ubuntu の QEMU で Hello

Is this 投稿 useful? Useful Useless 1 of 1 people say this 投稿 is useful.

error during ReadSymbolTable

5 年位前に作成したプロジェクトをビルドしていると,

--------------------Configuration: phpup_mb - Win32 Debug--------------------
Compiling...
ComPrj01.cpp
phpup_mb.cpp
...
Linking...
c:\Temp\HTM\phpup\phpup_mb\Debug.060\ComPrj01.obj : error : Internal error during ReadSymbolTable
  ExceptionCode            = C0000005
  ExceptionFlags           = 00000000
  ExceptionAddress         = 004623F2
  NumberParameters         = 00000002
  ExceptionInformation[ 0] = 00000000
  ExceptionInformation[ 1] = 0090B470
CONTEXT:
  Eax    = 3FFF1E64  Esp    = 0019F050
  Ebx    = FFFF8000  Ebp    = 01B834C7
  Ecx    = 3FFF1E64  Esi    = 401F1EC0
  Edx    = 0094B478  Edi    = 401F1EC0
  Eip    = 004623F2  EFlags = 00010246
  SegCs  = 00000023  SegDs  = 0000002B
  SegSs  = 0000002B  SegEs  = 0000002B
  SegFs  = 00000053  SegGs  = 0000002B
  Dr0    = 0019F050  Dr3    = FFFF8000
  Dr1    = 01B834C7  Dr6    = 3FFF1E64
  Dr2    = 00000000  Dr7    = 00000000
Error executing link.exe.
Tool execution canceled by user.

Internal error during ReadSymbolTable
exe は存在するが正しくできていないので,exe のみ削除して再度ビルド.

--------------------Configuration: phpup_mb - Win32 Debug--------------------
Linking...
LINK : LNK6004: c:\Temp\HTM\phpup\phpup_mb\Debug.060/phpup_mb.exe not found or not built by the last incremental link; performing full link
ComPrj01.obj : fatal error LNK1143: invalid or corrupt file: no symbol for comdat section 0xffff8000
Error executing link.exe.

phpup_mb.exe - 1 error(s), 0 warning(s)

LNK6004  LNK1143
obj のサイズを見ると,20 MB 位になっている.
それで思い出したのが,前にも同じ様な現象が…
LNK1143 : ファイルが無効であるか…
ソースを分割して対応.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

MFC ウィンドウ位置の保存

以前から,実装しようとしていつも見返してしまうので…


単純にウィンドウ位置を保存するタイミングは OnDestroy が良さそう.
ウィンドウ位置を保存するために ClassWizard で OnDestroy を追加
他には,ダイアログで「OK」を押された場合( OnOK )などもある.


ウィンドウ位置を保存するコードは次の様な感じ.

	if (!wnd->IsIconic())	{
		CRect	wRect ;
		wnd->GetWindowRect(&wRect) ;
	//	SaveRect(SecDialog,entry,wRect) ;
		}

起動時は

	CRect	rect ;	rect.SetRectEmpty() ;
	//	rect = GetRect(SecDialog,entry,rect) ;
	if (!rect.IsRectNull()) {
	//	::SystemParametersInfo(SPI_GETWORKAREA,0,&workArea,0) ;
	//	範囲の補正
		wnd->MoveWindow(rect) ;
		}

CMainFrame を持つ AP では CMainFrame::OnCreate で,ダイアログの場合は OnInitDialog で MoveWindow する.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.