如果你在打开对话框时弹出 "The ActiveX control "Grid Control" could not be instantiated because it requires a design-time license"这个对话框时,在VC安装盘中找到vb6controls.reg,双击导入注册表就OK了,没有这个文件的可以COPY下面的代码另存为*.reg,导入注册表就行了

REGEDIT
HKEY_CLASSES_ROOT\Licenses = Licensing: Copying the keys may be a violation of established copyrights.

// Masked Edit Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\BC96F860-9928-11cf-8AFA-00AA00C00905 = mmimfflflmqmlfffrlnmofhfkgrlmmfmqkqj

// Chart Control 6.0 (OLEDB) license key
HKEY_CLASSES_ROOT\Licenses\12B142A4-BD51-11d1-8C08-0000F8754DA1 = aadhgafabafajhchnbchehfambfbbachmfmb

// Common Dialog Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\4D553650-6ABE-11cf-8ADB-00AA00C00905 = gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj

// ADO Data Control 6.0 (OLEDB) license key
HKEY_CLASSES_ROOT\Licenses\C4145310-469C-11d1-B182-00A0C922E820 = konhqhioohihphkouimonhqhvnwiqhhhnjti

// Common Controls-3 6.0 license key
HKEY_CLASSES_ROOT\Licenses\38911DA0-E448-11D0-84A3-00DD01104159 = mcpckchcdchjcjcclidcgcgchdqdcjhcojpd

// Windows Common Controls-2 5.0 (SP2) license key
HKEY_CLASSES_ROOT\Licenses\9E799BF1-8817-11cf-958F-0020AFC28C3B = uqpqnqkjujkjjjjqwktjrjkjtkupsjnjtoun

// Windows Common Controls license key
HKEY_CLASSES_ROOT\Licenses\57CBF9E0-6AA7-11cf-8ADB-00AA00C00905 = aahakhchghkhfhaamghhbhbhkbpgfhahlfle

// Data Bound Grid Control 5.0(SP3) license key
HKEY_CLASSES_ROOT\Licenses\556C75F1-EFBC-11CF-B9F3-00A0247033C4 = xybiedobrqsprbijaegcbislrsiucfjdhisl

// Data Bound List Controls 6.0 license key
HKEY_CLASSES_ROOT\Licenses\096EFC40-6ABF-11cf-850C-08002B30345D = knsgigmnmngnmnigthmgpninrmumhgkgrlrk

// Internet Transfer Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\78E1BDD1-9941-11cf-9756-00AA00C00908 = yjrjvqkjlqqjnqkjvprqsjnjvkuknjpjtoun

// Multimedia Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\B1EFCCF0-6AC1-11cf-8ADB-00AA00C00905 = qqkjvqpqmqjjpqjjvpqqkqmqvkypoqjquoun

// Chart Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\7C35CA30-D112-11cf-8E72-00A0C90F26F8 = whmhmhohmhiorhkouimhihihwiwinhlosmsl

// Windows Common Controls-2 6.0 license key
HKEY_CLASSES_ROOT\Licenses\4F86BADF-9F77-11d1-B1B7-0000F8753F5D = iplpwpnippopupiivjrioppisjsjlpiiokuj

// Windows Common Controls 6.0 license key
HKEY_CLASSES_ROOT\Licenses\ED4B87C4-9F76-11d1-8BF7-0000F8754DA1 = knlggnmntgggrninthpgmnngrhqhnnjnslsh

// Comm Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\4250E830-6AC2-11cf-8ADB-00AA00C00905 = kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun

// DataGrid Control 6.0 (OLEDB) license key
HKEY_CLASSES_ROOT\Licenses\CDE57A55-8B86-11D0-b3C6-00A0C90AEA82 = ekpkhddkjkekpdjkqemkfkldoeoefkfdjfqe

// DataList Control 6.0 (OLEDB) license key
HKEY_CLASSES_ROOT\Licenses\A133F000-CCB0-11d0-A316-00AA00688B10 = cibbcimbpihbbbbbnhdbeidiocmcbbdbgdoc

// DBWin license key
HKEY_CLASSES_ROOT\Licenses\D015B071-D2ED-11d0-A31A-00AA00688B10 = gjdcfjpcmjicjcdcoihcechjlioiccechepd

// MSDBRPT license key
HKEY_CLASSES_ROOT\Licenses\9DF1A470-BA8E-11D0-849C-00A0C90DC8A9 = cchcqjejhcgcqcfjpdfcdjkckiqikchcojpd

// FlexGrid Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\72E67120-5959-11cf-91F6-C2863C385E30 = ibcbbbebqbdbciebmcobmbhifcmciibblgmf

// MAPI Controls 6.0 license key
HKEY_CLASSES_ROOT\Licenses\899B3E80-6AC6-11cf-8ADB-00AA00C00905 = wjsjjjlqmjpjrjjjvpqqkqmqukypoqjquoun

// MSRDO 2.0 license key
HKEY_CLASSES_ROOT\Licenses\B1692F60-23B0-11D0-8E95-00A0C90F26F8 = mjjjccncgjijrcfjpdfjfcejpdkdkcgjojpd

// RemoteData Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\43478d75-78e0-11cf-8e78-00a0d100038e = imshohohphlmnhimuinmphmmuiminhlmsmsl

// Windowless Controls 6.0 license key
HKEY_CLASSES_ROOT\Licenses\80E80EF0-DBBE-11D0-BCE2-00A0C90DCA10 = qijimitpmpnpxplpvjnikpkpqoxjmpkpoivj

// PictureClip Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\6FB38640-6AC7-11cf-8ADB-00AA00C00905 = gdjkokgdldikhdddpjkkekgknesjikdkoioh

// Rich TextBox Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\DC4D7920-6AC8-11cf-8ADB-00AA00C00905 = iokouhloohrojhhhtnooiokomiwnmohosmsl

// Sheridan Tab Control license key
HKEY_CLASSES_ROOT\Licenses\190B7910-992A-11cf-8AFA-00AA00C00905 = gclclcejjcmjdcccoikjlcecoioijjcjnhng

// SysInfo Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\E32E2733-1BC5-11d0-B8C3-00A0C90DCA10 = kmhfimlflmmfpffmsgfmhmimngtghmoflhsg

// Winsock Control 6.0 license key
HKEY_CLASSES_ROOT\Licenses\2c49f800-c2dd-11cf-9ad6-0080c7e7b78d = mlrljgrlhltlngjlthrligklpkrhllglqlrk

 

posted @ 2008-07-19 12:28 三毛 阅读(1787) 评论(0) 编辑
TinyXML是开源的XML操作库,很好用,以前都是在VC6中使用,使用也很正常,没出现任何问题.
最近把以前的代码升级到VS2008下,运行常出现堆栈溢出,莫名其秒的堆释放崩溃.
搞得人都快疯了,后来发现是在代码中使用了对齐的原因,为了进一步确定问题,新建一个工程,只引用tinyxml.h并定义一个结构采用#pragma pack(push,1)对齐,一运行就会出现崩溃......
而采用
#pragma pack(1)
#pragma pack()
则一切正常
posted @ 2008-04-25 23:39 三毛 阅读(9945) 评论(5) 编辑
我从CWinThread类上派生了一个类CGameSocket,从CGameSocket类上派生了CSocketThread类
我new CSocketThread类,然后在退出时delete this;

VC2005 Debug模式运行时报HEAP Corruption DETECTED。。。。。错误,就在delete this那里,从新运行程序并在new的地方和delete this那里下断点,发现在DEBUG模式下在堆中new对象时C++编译器会在new到的指针前后各放4字节的0xFD,在delete时检查前后的值是否为0xFD,如果不为0xFD则出现内存溢出。有问题就跟踪到C++的源码中去,你会发现很多平常调试时学不到的东西.

虽然发现这个“密秘”了,但是我的问题还是没有解决,再跟踪,我发现在new对象时,new完(也就是构造函数执行完了),我看了一下new返回的指针前后的内存数据,尾部的前面3个0xFD被清0了,OK,再重新运行,跟入到构造函数中去,发现在对一个成员变量进行清0时,会碰到那3个值,很奇怪,在内部对成员变量进行赋值操作会改到内存以外的值。。。郁闷中。。。百思不得其解,后来sizeof了类的大小,发现不是默认的4字节对齐,在类中,有几个成员变量,都是DWORD的,要不就是指针,只有一个BYTE成员,就出在这个BYTE成员上,找了老长时间的问题终于找到了,总算安心了。睡了,有写的了再写。。。
posted @ 2008-01-21 01:47 三毛 阅读(2324) 评论(0) 编辑

环境:Visual Studio Team Suite 2005
类型:Debug

以下是简化代码,出现让人摸不着头脑的Run-Time Check Failure,具体原因还在研究中,有结果会公布上来,N久没写博客了,太忙了。。。

代码1

#include 'stdafx.h' void malice() { printf('Hey,you're been attacked.\n'); } void foo() { int *ret; ret=(int*)&ret+2; (*ret)=(int)malice; } int _tmain(int argc, _TCHAR* argv[]) { foo(); return 0; }

运行后出现:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.


代码2

#include 'stdafx.h' void foo() { int var[2]; var[2] = 0; } int _tmain(int argc, _TCHAR* argv[]) { foo(); return 0; }

运行后出现:
Run-Time Check Failure #2 - Stack around the variable 'var' was corrupted.

#include 'stdafx.h' #include <iostream> using namespace std; int a,b; int _tmain(int argc, _TCHAR* argv[]) { int c; cout<<a<<'\n'; cout<<b<<'\n'; cout<<c<<'\n'; return 0; }

运行后出现:
Run-Time Check Failure #3 - The variable 'c' is being used without being defined.

posted @ 2008-01-20 22:27 三毛 阅读(2071) 评论(1) 编辑

The following is an example of rich edit2.0 based on the default SD rich edit project.
Please email me for source code.
1.revise PreCreateWindows
BOOL CRich20DocViewView::PreCreateWindow(CREATESTRUCT& cs)
{
 // TODO: Modify the Window class or styles here by modifying
 //  the CREATESTRUCT cs
// return CRichEditView::PreCreateWindow(cs);
 m_strClass="RichEdit20A";
 BOOL nR=CRichEditView::PreCreateWindow(cs);
 LoadLibraryA("RICHED20.DLL");
 return nR;
}
2. revise OnDestory
void CRich20DocViewView::OnDestroy()
{
 // Deactivate the item on destruction; this is important
 // when a splitter view is being used.
//   CRichEditView::OnDestroy();
   COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
   if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
   {
      pActiveItem->Deactivate();
      ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
   }
   CRichEditView::OnDestroy();
}
3. Enable auto URL detect in OnInitialUpdate()
 long lENM=GetRichEditCtrl().GetEventMask();
 lENM|=ENM_LINK;
 GetRichEditCtrl().SetEventMask(lENM);
 BOOL bEnable=1;
 ::SendMessage(m_hWnd,EM_AUTOURLDETECT,bEnable,0);
4. URL left-button_dwon open with notify message
 ON_NOTIFY_REFLECT_EX(EN_LINK, OnLink ) 
 afx_msg void OnLink( NMHDR* in_pNotifyHeader, LRESULT* out_pResult );
 void CRich20DocViewView::OnLink( NMHDR* in_pNotifyHeader, LRESULT* out_pResult )
{
  ENLINK * pLink=(ENLINK*) in_pNotifyHeader;
  if(pLink->msg==WM_LBUTTONDOWN)
  {
  GetRichEditCtrl().SetSel(pLink->chrg);
  CString str=GetRichEditCtrl().GetSelText();
  ShellExecute( this->GetSafeHwnd(), _T( "open" ), str, NULL, NULL, SW_SHOWNORMAL ) ;
  }
}

5. To print correctly, revise OnPrint. Without the following, there might be a non-stop print with blank pages)
void CRich20DocViewView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
 // TODO: Add your specialized code here and/or call the base class
 ASSERT_VALID(this);
 ASSERT_VALID(pDC);
 ASSERT(pInfo != NULL);
 ASSERT(pInfo->m_bContinuePrinting);

 UINT nPage = pInfo->m_nCurPage;
 ASSERT(nPage <= (UINT)m_aPageStart.GetSize());
 long nIndex = (long) m_aPageStart[nPage-1];

 // print as much as possible in the current page.
 nIndex = PrintPage(pDC, nIndex, 0xFFFFFFFF);
//nIndex got above hasn't take "return" into account
//The following codes add nIndex when there are any new lines
 int nLength=GetTextLength();
 CString strRich;
 GetRichEditCtrl().GetWindowText(strRich);
 int nS=0;
 while(nS!=-1)
 {
  nS=strRich.Find("\r\n",nS);
  if(nS!=-1)
  {
   nLength--;
   nS++;
  }

 }
 //END adding nIndex
 
 //other error that might cause non-stop print
 if(m_nIndex==nIndex)
  nLength-=10000;
 m_nIndex=nIndex;
 //end other erro

 if (nIndex >= nLength)//GetTextLength()
 {
  TRACE0("End of Document\n");
  pInfo->SetMaxPage(nPage);
 }

 // update pagination information for page just printed
 if (nPage == (UINT)m_aPageStart.GetSize())
 {
  if (nIndex < nLength)//GetTextLength()
   m_aPageStart.Add(nIndex);
 }
 else
 {
  ASSERT(nPage+1 <= (UINT)m_aPageStart.GetSize());
  ASSERT(nIndex == (long)m_aPageStart[nPage+1-1]);
 } 
// CRichEditView::OnPrint(pDC, pInfo);
}

posted @ 2007-05-14 18:07 三毛 阅读(356) 评论(0) 编辑
摘要: 今天要分析一个数据文件,数据太多了,手工分析易错且麻烦就自已写了一个工具,来进行自动转换,为了方便,使用了CStdioFile,因为它有ReadString函数,后来感觉处理方式不行,就换成结构一次读取64个字节,结果打开处理结果的文件一看,只有512个字节,好怪,文件根本没有读完,有点摸不着头脑了,试着把CStdioFile换成CFile,重新编译,运行,OK,好奇怪的问题,莫非是BUG?阅读全文
posted @ 2007-05-11 15:24 三毛 阅读(303) 评论(0) 编辑
摘要: 创建时间:2000-06-03文章属性:转载文章来源:红色力量文章提交:xundi (xundi_at_xfocus.org)从红色力量中转载--见我们的连接利用处理程序错误攻击(下)3 Land攻击工具Land也是一个很厉害的攻击工具,有人专门用Land对某种路由器进行了测试,结果发现,当对23端口进行攻击,路由器再也不能连到本地网上或域网外部。前面面板上的灯也停止了闪烁,用ping没有响应,t...阅读全文
posted @ 2007-05-09 10:28 三毛 阅读(81) 评论(0) 编辑
摘要: 由于TCP/IP协议是Internet的基础协议,所以对TCP/IP协议的完善和改进是非常必要的。TCP/IP协议从开始设计时候并没有考虑到现在网络上如此多的威胁,由此导致了许多形形色色的攻击方法,一般针对协议原理的攻击(尤其是DDOS)我们无能为力。现将TCP/IP攻击的常用原理介绍如下:(1) 源地址欺骗(Source Address Spoofing)、IP欺骗(IP Spoofing)和D...阅读全文
posted @ 2007-05-08 23:02 三毛 阅读(330) 评论(0) 编辑
摘要: 文章属性:转载文章提交:xundi (xundi_at_xfocus.org)在本章,将要介绍一些利用TCP/IP协议的处理程序中错误进行攻击的原理、方法以及一些防范对策。这些攻击包括当前流行的Teardrop和Land攻击。利用协议实现的攻击方法,都是故意错误地设定数据包头的一些重要字段,例如,IP包头部的Total Length、Fragment offset、IHL和Source addre...阅读全文
posted @ 2007-05-08 22:49 三毛 阅读(131) 评论(0) 编辑
摘要: 1.动态获得端口号:ACE_Asynch_Acceptor<Receiver> acceptor; ACE_INET_Addr addr= ACE_INET_Addr("HAStatus"); if (acceptor.open (addr, initial_read_size, 1) == -1) return -1;2.获得动态分配的端口号: ACE_SOCK_SEQPACK_As...阅读全文
posted @ 2007-05-08 10:24 三毛 阅读(1416) 评论(0) 编辑