Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2007.09.02;
Скачать: [xml.tar.bz2];

Вниз

Замена системных модулей в 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 вся ветка

Форум: "KOL";
Текущий архив: 2007.09.02;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.045 c
6-1168754919
DRtM
2007-01-14 09:08
2007.09.02
Проблемма с закачкой


11-1168868161
mixail_shar
2007-01-15 16:36
2007.09.02
Как к Меню привязать картинки?


15-1186168050
Ламот
2007-08-03 23:07
2007.09.02
Чат для локалки


2-1186843938
Aleksandrrr
2007-08-11 18:52
2007.09.02
Как добавить в *.exe -файл-проект изображения и текстовые файлы?


15-1185889229
Alkid
2007-07-31 17:40
2007.09.02
Фриварный антивирус





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский