![]() |
【转帖】access violation
access violation
access violation in the exhostappservices.cpp there is a place that i get an access violation enumerating the registry. i get the error code error_no_more_items, but it is not catered for and the variables nvalnamesize and ndatasize are both 0. previous code is do { tchar* lpvalname = new tchar[nvalnamesize]; lpbyte lpdata = new byte[ndatasize]; nres = ::regenumvalue(hfonts, nindex, lpvalname, &nvalnamesize, null, null, lpdata, &ndatasize); if(nres == error_more_data) { nvalnamesize += 20; } else { svaluename = lpvalname; filename = (lpctstr)lpdata; } delete lpvalname; delete lpdata; } while(nres == error_more_data); i suggest we change to do { tchar* lpvalname = new tchar[nvalnamesize]; lpbyte lpdata = new byte[ndatasize]; nres = ::regenumvalue(hfonts, nindex, lpvalname, &nvalnamesize, null, null, lpdata, &ndatasize); if(nres == error_more_data) { nvalnamesize += 20; } else if( nres == error_success) { svaluename = lpvalname; filename = (lpctstr)lpdata; } delete lpvalname; delete lpdata; } while(nres == error_more_data); else the line filename = (lpctstr) lpdata access violates. (it access violates some where in odstring, and hence i dont have source for there so i have to leave you gurus to make the correct decision. also to help you : the call stack is as follows : activextest.ocx!odansistring::odansistring() + 0x19 activextest.ocx!odstring::odstring() + 0x54 activextest.ocx!odstring:perator=() + 0x28 > activextest.ocx!exhostappservices::ttffilenamebyde scriptor(const odttfdescriptor & descr={...}, odstring & filename={...}) line 293 c++ activextest.ocx!oddbfontservices::loadstylerec() + 0x61a activextest.ocx!odgitextstyle::loadstylerec() + 0xb4 activextest.ocx!odmtextiterator::changefont() + 0x449 activextest.ocx!odmtextiterator:rocess() + 0x896 ntdll.dll!7c9106eb() ntdll.dll!7c911596() ntdll.dll!7c911596() ntdll.dll!7c9106eb() ntdll.dll!7c911538() ntdll.dll!7c911596() ntdll.dll!7c9106eb() ntdll.dll!7c911596() ntdll.dll!7c911596() ntdll.dll!7c9106eb() ntdll.dll!7c910732() ntdll.dll!7c9106ab() ntdll.dll!7c910d5c() ntdll.dll!7c910f46() ntdll.dll!7c960af8() ntdll.dll!7c960bcc() ntdll.dll!7c960af8() ntdll.dll!7c960bf0() ntdll.dll!7c960bcc() ntdll.dll!7c91056d() msvcrtd.dll!_free_base(void * pblock=0x00000009) line 96 c msvcrtd.dll!_free_dbg(void * puserdata=0x01a70110, int nblockuse=1) line 1006 + 0x7 c msvcrtd.dll!free(void * puserdata=0x7c9180ff) line 956 + 0xb c ntdll.dll!7c90d4ea() ntdll.dll!7c9180ff() ntdll.dll!7c90d4ea() ntdll.dll!7c9180ff() ntdll.dll!7c911596() ntdll.dll!7c9106eb() ntdll.dll!7c911596() ntdll.dll!7c9106eb() ntdll.dll!7c911596() ntdll.dll!7c911596() ntdll.dll!7c9106eb() ntdll.dll!7c912270() ntdll.dll!7c911596() ntdll.dll!7c9106eb() also as a side note: this fixed a memory corruption i was having on 2- 3 machines in the test office. as in the previous threads i posted previously : we fixed it so: code: do { tchar* lpvalname = new tchar[nvalnamesize]; lpbyte lpdata = new byte[ndatasize]; nres = ::regenumvalue(hfonts, nindex, lpvalname, &nvalnamesize, null, null, lpdata, &ndatasize); if (nres == error_more_data) { nvalnamesize += 20; } else if (nres == error_success) { svaluename = lpvalname; filename = (lpctstr)lpdata; } else { svaluename.empty(); filename.empty(); } delete lpvalname; delete lpdata; } while (nres == error_more_data); sergey slezkin |
所有的时间均为北京时间。 现在的时间是 02:20 PM. |