Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.47 MB
Время: 0.017 c
8-1164717121
Ангела
2006-11-28 15:32
2007.09.02
Как преобразовать файл bmp?


15-1186321802
bagos
2007-08-05 17:50
2007.09.02
Господа помогите найти


4-1173866657
fon-karlson
2007-03-14 13:04
2007.09.02
не ловится WM_COMMAND при нажатии на пункт меню


2-1186935022
Debug
2007-08-12 20:10
2007.09.02
Фокус ввода во вкладку TPageControl


2-1186662201
alex_tonk
2007-08-09 16:23
2007.09.02
Сохранить как DBF файл




   Наверх