Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.09.02;
Скачать: CL | DM;

Вниз

Замена системных модулей в D5   Найти похожие ветки 

 
AlexY ©   (2007-01-15 10:24) [0]

Как избавиться от повторного вызова KERNEL32.DLL после замены системных модулей в D5, KOL 2.35.
Дамп из TC:
IMPORTS TABLE:
  KERNEL32.DLL
Import Lookup Table RVA:   00000000h     (Unbound IAT)
TimeDateStamp:  00000000h
ForwarderChain:  00000000h
DLL Name RVA:  00006144h
Import Address Table RVA:  00006094h
First thunk RVA:  00006094h
Ordn   Name
----- -----
   0  FreeLibrary

  KERNEL32.DLL
Import Lookup Table RVA:   00000000h     (Unbound IAT)
TimeDateStamp:  00000000h
ForwarderChain:  00000000h
DLL Name RVA:  00006151h
Import Address Table RVA:  00006064h
First thunk RVA:  00006064h
Ordn   Name
----- -----
   0  GetCurrentThreadId
   0  LocalSize
   0  LocalReAlloc
   0  ExitProcess
   0  RaiseException
   0  TlsSetValue
   0  TlsGetValue
   0  LocalFree
   0  LocalAlloc
   0  GetModuleHandleA
   0  FreeLibrary.

В примере с пустой формой (Empty.exe) от Thaddy даже после распаковки Empty.exe KERNEL32.DLL вызывается 1 раз.


 
dimaxx ©   (2007-01-15 20:13) [1]

А чем он тебе мешает? Ошибка вываливается или еще что? Я постоянно пользуюсь заменой и никаких отрицательных действий не заметил.


 
AlexY ©   (2007-01-15 20:36) [2]

У меня пустая форма занимает 13824, а в примере от Thaddy 12800.


 
ANTPro ©   (2007-01-15 21:09) [3]

> [2] AlexY ©   (15.01.07 20:36)
> 12800.

А если название формы = nil ?


 
Dimaxx ©   (2007-01-16 15:48) [4]

Тебя так убивает лишний килобайт???


 
Vladimir Kladov   (2007-01-16 21:16) [5]

Тогда 2.35 -> 2.50 и вперед.


 
AndreyRus   (2007-01-16 22:55) [6]


> Тебя так убивает лишний килобайт???

И не только его!


 
thaddy   (2007-01-17 01:47) [7]


//load kernel32, but only if necessary
function LoadKernel32:HMODULE; //or THandle if you prefer :)
begin
 Result := GetModuleHandle("kernel32");
 if result = 0 then
   Result := LoadLibrary("kernel32");
end;


Problem is caused by excessive calls to loadlibrary instead of getmodulehandle.
Kernel32 is always loaded in the  main thread!
Loadlibrary is only necessary for other threads.
You can replace all occurrences of LoadLibrary("kernel32") with this replacement and you will see it is only loaded once.


 
thaddy   (2007-01-17 01:50) [8]

Note: use it always, the problem is mostly related to unit boundaries. If you see it, replace it.


 
thaddy   (2007-01-17 01:54) [9]

Also note getmodulehandle is in..... kernel32.dll, so it may not even be necessary to call loadlibrary ever, for kernel32 functions, I mean.


 
Dimaxx ©   (2007-01-17 10:45) [10]


> И не только его!

Просто надо указывать что именно мешает. А так попробуй догадайся о твоих проблемах из-за размеров exe с пустой формой...


 
Vladimir Kladov   (2007-01-17 15:36) [11]

Interesting, where is such procedure LoadKernel32 ? I can not find it...


 
thaddy   (2007-01-17 19:24) [12]

loadlibrary("kernel32"); for example in TThread in kol.pas. Probably some more places. Since loadlibrary is IN kernel32, those calls should be replaced by GetModuleHandle, I think. kernel32 is always loaded for every process/thread, at least under XP/Vista.


 
Vladimir Kladov   (2007-01-17 19:34) [13]

I don"t understand, what"s the relation this does have to the theme subject. This code is not linked for the empty project with a single empty form.



Страницы: 1 вся ветка

Текущий архив: 2007.09.02;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.025 c
15-1185883532
AntifreezeeR
2007-07-31 16:05
2007.09.02
Ищу помощи, как новичок.


2-1186447650
rosl
2007-08-07 04:47
2007.09.02
null на 0


2-1186935438
loeg
2007-08-12 20:17
2007.09.02
Вопрос по TWebBrowser


2-1186480407
Ванечка
2007-08-07 13:53
2007.09.02
Программно запустить файл *.html на просмотр ?


15-1185892916
cosinus
2007-07-31 18:41
2007.09.02
Эм... Глупейший вопрос по SoftIce.