void CTestForOpenEmtyFileDlg::OnOK()
{
int i = 1;
try
{
Test();
}
catch(CFileException * e)
{
CString strMsg;
e->GetErrorMessage(strMsg.GetBuffer(255),255);
strMsg.ReleaseBuffer();
AfxMessageBox(strMsg);
}
}
void CTestForOpenEmtyFileDlg::Test()
{
CFile file;
//打开不存在的文件
file.Open("1.txt",CFile::modeWrite);
file.Write("ttt",3);
int nLength = file.GetLength();
}
004014d0 55 push ebp
004014d1 8bec mov ebp,esp
004014d3 6aff push 0FFFFFFFFh
004014d5 68a81b4000 push offset TestForOpenEmtyFile!AfxWinMain+0x9a (00401ba8)
004014da 64a100000000 mov eax,dword ptr fs:[00000000h]
004014e0 50 push eax
004014e1 64892500000000 mov dword ptr fs:[0],esp
004014e8 83ec0c sub esp,0Ch
004014eb 53 push ebx
004014ec 56 push esi
004014ed 57 push edi
004014ee c745fc00000000 mov dword ptr [ebp-4],0
004014f5 8965f0 mov dword ptr [ebp-10h],esp
004014f8 e873000000 call TestForOpenEmtyFile!CTestForOpenEmtyFileDlg::Test (00401570)
004014fd 8b4df4 mov ecx,dword ptr [ebp-0Ch]
00401500 5f pop edi
00401501 5e pop esi
00401502 64890d00000000 mov dword ptr fs:[0],ecx
00401509 5b pop ebx
0040150a 8be5 mov esp,ebp
0040150c 5d pop ebp
0040150d c3 ret
0040150e 8d4dec lea ecx,[ebp-14h]
00401511 e8d4020000 call TestForOpenEmtyFile!CString::CString (004017ea)
00401516 8b75e8 mov esi,dword ptr [ebp-18h]
00401519 6a00 push 0
0040151b 68ff000000 push 0FFh
00401520 68ff000000 push 0FFh
00401525 8b3e mov edi,dword ptr [esi]
00401527 8d4dec lea ecx,[ebp-14h]
0040152a c645fc02 mov byte ptr [ebp-4],2
0040152e e8e1020000 call TestForOpenEmtyFile!CString::GetBuffer (00401814)
00401533 50 push eax
00401534 8bce mov ecx,esi
00401536 ff5714 call dword ptr [edi+14h]
00401539 6aff push 0FFFFFFFFh
0040153b 8d4dec lea ecx,[ebp-14h]
0040153e e8cb020000 call TestForOpenEmtyFile!CString::ReleaseBuffer (0040180e)
00401543 8b45ec mov eax,dword ptr [ebp-14h]
00401546 6a00 push 0
00401548 6a00 push 0
0040154a 50 push eax
0040154b e8b8020000 call TestForOpenEmtyFile!AfxMessageBox (00401808)
00401550 8d4dec lea ecx,[ebp-14h]
00401553 c645fc01 mov byte ptr [ebp-4],1
00401557 e882020000 call TestForOpenEmtyFile!CString::~CString (004017de)
0040155c b8fd144000 mov eax,offset TestForOpenEmtyFile!CTestForOpenEmtyFileDlg::OnOK+0x2d (004014fd)
00401561 c3 ret