<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093754</guid>
        <pubDate>Sun, 11 Mar 2012 06:06:53 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093754</link>
        <description><![CDATA[0day: нужно немного изменить поведение программы, с закрытыми исходниками.]]></description>
        <author>0day</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093709</guid>
        <pubDate>Sun, 11 Mar 2012 04:32:37 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093709</link>
        <description><![CDATA[leo: Да<br><br>PS: Интересно, для чего ты FindTypeInfoObject юзаешь - для инжекта в сторонний процесс или exe? Малварь изобретаешь или свою навесную защиту и т.п.?]]></description>
        <author>leo</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093608</guid>
        <pubDate>Sat, 10 Mar 2012 17:21:15 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093608</link>
        <description><![CDATA[0day: А в каком случаи вызывается NewInstance ? При выделении под класс памяти ?]]></description>
        <author>0day</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093427</guid>
        <pubDate>Sat, 10 Mar 2012 08:55:04 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093427</link>
        <description><![CDATA[leo: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=352737&view=findpost&p=3093348'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>0day &#064; <time class="tag-quote__quoted-time" datetime="2012-03-09T20:54:06+00:00">09.03.12, 20:54</time></span><div class='quote '>В целом AfterConstruction вроде как можно и не вызывать даже, там все равно ret.</div></div><br>
У TObject - да, а у той же TCustomForm и ее наследниках - во-первых, не пустой, во-вторых, не вызывает inherited, поэтому твой код для TForm и не работает. А если бы был вызов inherited, то твой OnAfterConstruction мог бы &quot;наломать дров&quot; из-за повторногом вызова obj.AfterConstruction]]></description>
        <author>leo</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093348</guid>
        <pubDate>Fri, 09 Mar 2012 20:54:06 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093348</link>
        <description><![CDATA[0day: <strong class='tag-b'>ViktorXP</strong><br>
В целом AfterConstruction вроде как можно и не вызывать даже, там все равно ret.<br>
Тоесть AfterConstruction  у TObject все равно пустой метод.<br>
я не прав?<br>
<br>
А не подскажите почему TForm не вызывает AfterConstruction  ?]]></description>
        <author>0day</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093284</guid>
        <pubDate>Fri, 09 Mar 2012 17:33:46 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093284</link>
        <description><![CDATA[ViktorXP: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=352737&view=findpost&p=3092730'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>0day &#064; <time class="tag-quote__quoted-time" datetime="2012-03-08T12:18:53+00:00">08.03.12, 12:18</time></span><div class='quote '>var<br>
 Ref:integer = 0;<br>
 <br>
function OnAfterConstruction(obj:TObject): TObject;<br>
begin<br>
 <br>
  if ( Ref = 0 ) then<br>
  begin<br>
   Inc(Ref);<br>
    obj.AfterConstruction;<br>
    ShowMessage(obj.ClassName);<br>
   Dec(Ref);<br>
  end;<br>
 <br>
  result:=obj;<br>
end;</div></div><br>
после инкремента Ref, уловие не будет срабатывать и соответственно все объекты которые будут порождены в период от инкремента до декремента будут отрабатывать мимо этого куска кода. соответственно obj.AfterConstruction для их не вывозется]]></description>
        <author>ViktorXP</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093047</guid>
        <pubDate>Fri, 09 Mar 2012 08:53:26 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3093047</link>
        <description><![CDATA[0day: <strong class='tag-b'>ViktorXP</strong><div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=352737&view=findpost&p=3092956'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ViktorXP &#064; <time class="tag-quote__quoted-time" datetime="2012-03-08T21:03:04+00:00">08.03.12, 21:03</time></span><div class='quote '>это получается что если я создам объект в AfterConstruction то его же собственный AfterConstruction не вызовется. </div></div><br>
Почему? покажи пример.<br>
<br>
Там перехват у TObject.AfterConstruction  который сам по себе пустой метод.<br>
Так как твой объект будет наследоваться от TObject то AfterConstruction  твоего обьекта должна быть вызвана.]]></description>
        <author>0day</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092956</guid>
        <pubDate>Thu, 08 Mar 2012 21:03:04 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092956</link>
        <description><![CDATA[ViktorXP: это получается что если я создам объект в AfterConstruction то его же собственный AfterConstruction не вызовется.]]></description>
        <author>ViktorXP</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092730</guid>
        <pubDate>Thu, 08 Mar 2012 12:18:53 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092730</link>
        <description><![CDATA[0day: Да точно&#33;)<br>
<br>
Кому интересно накидал код, выводит имена создаваемых классов.<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">type</div><div class="code_line">&nbsp;&nbsp;PEXCEPTION_POINTERS = ^EXCEPTION_POINTERS;</div><div class="code_line">&nbsp;&nbsp;EXCEPTION_POINTERS = packed record</div><div class="code_line">&nbsp;&nbsp; &nbsp; ExceptionRecord :^EXCEPTION_RECORD;</div><div class="code_line">&nbsp;&nbsp; &nbsp; ContextRecord &nbsp; :PCONTEXT;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">function AddVectoredExceptionHandler(FirstHandler:ULONG; VectoredHandler:Pointer):pointer;stdcall; external &#39;kernel32.dll&#39;;</div><div class="code_line">var</div><div class="code_line">&nbsp;Ref:integer = 0;</div><div class="code_line">&nbsp;</div><div class="code_line">function OnAfterConstruction(obj:TObject): TObject;</div><div class="code_line">begin</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;if ( Ref = 0 ) then</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; Inc(Ref);</div><div class="code_line">&nbsp;&nbsp; &nbsp;obj.AfterConstruction;</div><div class="code_line">&nbsp;&nbsp; &nbsp;ShowMessage(obj.ClassName);</div><div class="code_line">&nbsp;&nbsp; Dec(Ref);</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;result:=obj;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">FUNCTION VectoredHandler( ExceptionInfo:PEXCEPTION_POINTERS):ULONG;stdcall;</div><div class="code_line">var</div><div class="code_line">&nbsp;p:Pointer;</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;Result:=0;</div><div class="code_line">&nbsp;&nbsp;if ( ExceptionInfo^.ExceptionRecord^.ExceptionCode = EXCEPTION_SINGLE_STEP ) then</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;p :=PWORD( ExceptionInfo^.ContextRecord^.Eip);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ( PBYTE(PChar(p)-1)^ = $F1) and ( PBYTE(PChar(p))^ = $C3) then</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; ExceptionInfo^.ContextRecord^.Eip := Cardinal(@OnAfterConstruction);</div><div class="code_line">&nbsp;&nbsp; &nbsp; result:=$ffffffff;</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">var</div><div class="code_line">&nbsp;&nbsp;ptr:pointer;</div><div class="code_line">&nbsp;&nbsp;Attr:Cardinal;</div><div class="code_line">&nbsp;&nbsp;ObjRef:TObjectRef;</div><div class="code_line">begin</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;FindTypeInfoObject( pointer(1000),ObjRef );</div><div class="code_line">&nbsp;&nbsp;ptr:= GetVMTItem(ObjRef.VMT,MetodAfterConstruction);</div><div class="code_line">&nbsp;&nbsp;AddVectoredExceptionHandler(1,@VectoredHandler);</div><div class="code_line">&nbsp;&nbsp;VirtualProtect(ptr,sizeof(ptr),PAGE_EXECUTE_READWRITE,@Attr);</div><div class="code_line">&nbsp;&nbsp; &nbsp;PWord(ptr)^ := $C3F1;</div><div class="code_line">&nbsp;&nbsp;VirtualProtect(ptr,sizeof(ptr),Attr,@Attr);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;Application.Initialize;</div><div class="code_line">&nbsp;&nbsp;Application.CreateForm(TForm1, Form1);</div><div class="code_line">&nbsp;&nbsp;Application.Run;</div><div class="code_line">end.</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<span class="b-attach" data-size="8229" data-hits="304" data-attach-id="16680" data-attach-post-id="3092730">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3092730&amp;attach_id=16680' title='Скачать файл' target='_blank'>Projects.rar</a> (, : 304)
		</span> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2012-03-08T12:20:36+00:00">08.03.12, 12:20</time></span></span><br>
Версия однопоточная, для нескольких потоков нужно юзать TLS для переменной Ref.<br>
Работает для 7 версии дельфи.<br>
При запущенном отладчике дельфи работать не будет.]]></description>
        <author>0day</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092723</guid>
        <pubDate>Thu, 08 Mar 2012 12:05:56 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092723</link>
        <description><![CDATA[ViktorXP: да.<br>пс. Если более правильно выразится то эта функция взывает метод AfterConstruction у объекта. компилятор просто &quot;расставляет&quot; ее в нужном месте. (точно также как и неявное выделение/освобождение памяти строк/динамических массивов)]]></description>
        <author>ViktorXP</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092718</guid>
        <pubDate>Thu, 08 Mar 2012 11:54:22 +0000</pubDate>
        <title>Вызов _AfterConstruction</title>
        <link>https://forum.sources.ru/index.php?showtopic=352737&amp;view=findpost&amp;p=3092718</link>
        <description><![CDATA[0day: А все ли объекты вызывают System._AfterConstruction ?]]></description>
        <author>0day</author>
        <category>Delphi: Разработка компонентов</category>
      </item>
	
      </channel>
      </rss>
	