diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index 2d8558d6c6..49f573ee2f 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -24,9 +24,6 @@ ?define MENU1_SUBMENU2 "Закрыть" ?define MENU1_SUBMENU3 "Свойства" ?define MENU1_SUBMENU4 "Выход" - ?define ERROR_LOAD_BOX_LIB "Ошибка при загрузке библиотеки - box_lib.obj" - ?define ERROR_LOAD_LIBIO "Ошибка при загрузке библиотеки - libio.obj" - ?define ERROR_LOAD_PROC_LIB "Ошибка при загрузке библиотеки - proc_lib.obj" #else ?define T_FILE "File" ?define T_TYPE "Type" @@ -36,9 +33,6 @@ ?define MENU1_SUBMENU2 "Close" ?define MENU1_SUBMENU3 "Properties" ?define MENU1_SUBMENU4 "Exit" - ?define ERROR_LOAD_BOX_LIB "Error while loading library - box_lib.obj" - ?define ERROR_LOAD_LIBIO "Error while loading library - libio.obj" - ?define ERROR_LOAD_PROC_LIB "Error while loading library - proc_lib.obj" #endif #ifdef LANG_RUS @@ -135,9 +129,9 @@ void main() menu_text_area1.end = 0; mem_Init(); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_LOAD_BOX_LIB); - if (load_dll2(libio, #libio_init,1)!=0) notify(ERROR_LOAD_LIBIO); - if (load_dll2(Proc_lib, #OpenDialog_init,0)!=0) notify(ERROR_LOAD_PROC_LIB); + load_dll(boxlib, #box_lib_init,0); + load_dll(libio, #libio_init,1); + load_dll(Proc_lib, #OpenDialog_init,0); OpenDialog_init stdcall (#o_dialog); SetEventMask(0x27); loop() diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 73f7824656..795b6ed445 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -167,7 +167,7 @@ void main() mem_Init(); SetEventMask(0x27); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); list[SKINS].current = list[WALLPAPERS].current = -1; list[SKINS].first = list[WALLPAPERS].first = 0; TabClick(WALLPAPERS); diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 85f6da5da0..e58bf8222e 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -124,10 +124,10 @@ void main() mem_Init(); CursorPointer.Load(#CursorFile); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); - if (load_dll2(libio, #libio_init,1)!=0) notify(LIB_IO_LOAD_ERR); - if (load_dll2(libimg, #libimg_init,1)!=0) notify(LIB_IMG_LOAD_ERR); - if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify(LIB_HTTP_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); + load_dll(libio, #libio_init,1); + load_dll(libimg, #libimg_init,1); + load_dll(libHTTP, #http_lib_init,1); Libimg_LoadImage(#skin, abspath("wv_skin.png")); SetSkinColors(); diff --git a/programs/cmm/dicty/dicty.c b/programs/cmm/dicty/dicty.c index b8c5e517aa..170fd2462b 100644 --- a/programs/cmm/dicty/dicty.c +++ b/programs/cmm/dicty/dicty.c @@ -35,7 +35,7 @@ void main() { int id, key; mem_Init(); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); dict_folder = abspath(DICT_DIRECROTY); OpenDictionary(0); diff --git a/programs/cmm/downloader/Downloader.c b/programs/cmm/downloader/Downloader.c index 4bdaa83f90..cd722cda90 100644 --- a/programs/cmm/downloader/Downloader.c +++ b/programs/cmm/downloader/Downloader.c @@ -49,9 +49,9 @@ void main() char notify_message[4296]; mem_Init(); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); - if (load_dll2(libio, #libio_init,1)!=0) notify(LIB_IO_LOAD_ERR); - if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http"); + load_dll(boxlib, #box_lib_init,0); + load_dll(libio, #libio_init,1); + load_dll(libHTTP, #http_lib_init,1); if (!URL) strcpy(#URL, "http://builds.kolibrios.org/eng/latest-iso.7z"); address_box.size = address_box.pos = strlen(#URL); diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 36b7285548..b14ba6fcce 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -185,8 +185,8 @@ void main() rand_n = random(40); gestures.get(); mem_Init(); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); - if (load_dll2(libini, #lib_init,1)!=0) notify(LIB_INI_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); + load_dll(libini, #lib_init,1); eolite_ini_path = abspath("Eolite.ini"); LoadIniSettings(); GetSystemDiscs(); diff --git a/programs/cmm/lib/dll.h b/programs/cmm/lib/dll.h index 964200ebcd..f84c399d2c 100644 --- a/programs/cmm/lib/dll.h +++ b/programs/cmm/lib/dll.h @@ -1,11 +1,15 @@ #ifndef INCLUDE_DLL_H #define INCLUDE_DLL_H +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/file_system.h" +#endif + + char a_libdir[43] = "/sys/lib/\0"; :inline void error_init(dword text) { - dword l,ll; dword TEXT_ERROR = malloc(1024); #ifdef LANG_RUS strcpy(TEXT_ERROR,"'Ошибка при загрузке библиотеки `"); @@ -14,13 +18,10 @@ char a_libdir[43] = "/sys/lib/\0"; #else strcpy(TEXT_ERROR,"'Error while loading library `"); #endif - ll = strlen(TEXT_ERROR); - strcpy(TEXT_ERROR+ll,text); - l = strlen(text); - strncpy(TEXT_ERROR+ll+l,"`' -E",4); + strcat(TEXT_ERROR,text); + strcat(TEXT_ERROR,"`' -E"); notify(TEXT_ERROR); free(TEXT_ERROR); - ExitProcess(); } // stdcall with 1 parameter @@ -236,7 +237,11 @@ int load_dll2(dword dllname, import_table, byte need_init) return 0; @exit01: return -1; - //error_init(dllname); +} + +void load_dll(dword dllname, import_table, byte need_init) +{ + if (load_dll2(dllname, import_table, need_init)!=0) error_init(dllname); } diff --git a/programs/cmm/lib/obj/box_lib.h b/programs/cmm/lib/obj/box_lib.h index dbb58410ac..779254777d 100644 --- a/programs/cmm/lib/obj/box_lib.h +++ b/programs/cmm/lib/obj/box_lib.h @@ -13,13 +13,6 @@ dword boxlib = #aEdit_box_lib; char aEdit_box_lib[]="/sys/lib/box_lib.obj"; -#ifdef LANG_RUS - ?define BOX_LIB_LOAD_ERR "Error while loading library /rd/1/lib/box_lib.obj" -#else - ?define BOX_LIB_LOAD_ERR "Ошибка при загрузке библиотеки /rd/1/lib/box_lib.obj" -#endif - - dword box_lib_init = #aboxlib_init; dword edit_box_draw = #aEdit_box_draw; diff --git a/programs/cmm/lib/obj/http.h b/programs/cmm/lib/obj/http.h index 19d8baf05b..40e6df259c 100644 --- a/programs/cmm/lib/obj/http.h +++ b/programs/cmm/lib/obj/http.h @@ -12,7 +12,6 @@ dword libHTTP = #alibHTTP; char alibHTTP[23] = "/sys/lib/http.obj\0"; -?define LIB_HTTP_LOAD_ERR "Error while loading library /rd/1/lib/http.obj" dword http_lib_init = #aLib_init; dword http_get = #aHTTPget; diff --git a/programs/cmm/lib/obj/libimg_lib.h b/programs/cmm/lib/obj/libimg_lib.h index a86f16b6d8..f9277ee96c 100644 --- a/programs/cmm/lib/obj/libimg_lib.h +++ b/programs/cmm/lib/obj/libimg_lib.h @@ -23,8 +23,7 @@ //library dword libimg = #alibimg; char alibimg[21] = "/sys/lib/libimg.obj\0"; -?define LIB_IMG_LOAD_ERR "Error while loading library /rd/1/lib/libimg.obj" - + dword libimg_init = #alibimg_init; dword img_is_img = #aimg_is_img; dword img_to_rgb2 = #aimg_to_rgb2; diff --git a/programs/cmm/lib/obj/libini.h b/programs/cmm/lib/obj/libini.h index 4eb3dbec32..56d574f3d2 100644 --- a/programs/cmm/lib/obj/libini.h +++ b/programs/cmm/lib/obj/libini.h @@ -11,7 +11,6 @@ dword libini = #alibini; char alibini[] = "/sys/lib/libini.obj"; -?define LIB_INI_LOAD_ERR "Error while loading library /rd/1/lib/libini.obj" dword lib_init = #alib_init; dword ini_enum_sections = #aini_enum_sections; diff --git a/programs/cmm/lib/obj/libio_lib.h b/programs/cmm/lib/obj/libio_lib.h index 25f3c4e7fc..4f6e1c99a6 100644 --- a/programs/cmm/lib/obj/libio_lib.h +++ b/programs/cmm/lib/obj/libio_lib.h @@ -13,7 +13,6 @@ //library dword libio = #alibio; char alibio[21] = "/sys/lib/libio.obj\0"; //"libio.obj\0"; -?define LIB_IO_LOAD_ERR "Error while loading library /rd/1/lib/libio.obj" dword libio_init = #alibio_init; dword file_size = #afile_size; diff --git a/programs/cmm/liza/liza.c b/programs/cmm/liza/liza.c index fb5d4d62d7..f1e053c7bc 100644 --- a/programs/cmm/liza/liza.c +++ b/programs/cmm/liza/liza.c @@ -102,12 +102,12 @@ char version[]=" WebView 0.1"; void main() { mem_Init(); CursorPointer.Load(#CursorFile); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); - if (load_dll2(network_lib, #network_lib_init,0)!=0) notify("Error while loading library - network.obj"); - if (load_dll2(netcode_lib, #base64_encode,0)!=0) notify("Error while loading library - netcode.obj"); - if (load_dll2(iconv_lib, #iconv_open,0)!=0) { notify("Error while loading library - iconv.obj"); use_iconv=2; } - if (load_dll2(libio, #libio_init,1)!=0) notify(LIB_IO_LOAD_ERR); - if (load_dll2(libimg, #libimg_init,1)!=0) notify(LIB_IMG_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); + load_dll(network_lib, #network_lib_init,0); + load_dll(netcode_lib, #base64_encode,0); + load_dll(libio, #libio_init,1); + load_dll(libimg, #libimg_init,1); + if (load_dll2(iconv_lib, #iconv_open,0)!=0) { notify("Error while loading library - iconv.obj"); use_iconv=2; } OpenMailDat(); SetEventMask(0x27); LoginBoxLoop(); diff --git a/programs/cmm/mouse_cfg/mouse_cfg.c b/programs/cmm/mouse_cfg/mouse_cfg.c index de0ec7a972..e454349514 100644 --- a/programs/cmm/mouse_cfg/mouse_cfg.c +++ b/programs/cmm/mouse_cfg/mouse_cfg.c @@ -42,7 +42,7 @@ void main() { dword id; mem_Init(); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); LoadCfg(); diff --git a/programs/cmm/panels_cfg/panels_cfg.c b/programs/cmm/panels_cfg/panels_cfg.c index 70b0dc217a..99cf8950ca 100644 --- a/programs/cmm/panels_cfg/panels_cfg.c +++ b/programs/cmm/panels_cfg/panels_cfg.c @@ -34,8 +34,6 @@ ?define FSIZE "Режим панели" ?define ASHOW "Не скрывать" ?define CHANGE_POS "Нажмите на изображение для смены позиции" - ?define BOX_LIB_LOAD_ERR "Ошибка при загрузке библиотеки /rd/1/lib/box_lib.obj" - ?define LIBINI_LOAD_ERR "Ошибка при загрузке библиотеки /rd/1/lib/libini.obj" #else ?define WINDOW_TITLE "Taskbar and Docky configuration" ?define TASK_FRAME_T " Taskbar " @@ -54,8 +52,6 @@ ?define FSIZE "Full width" ?define ASHOW "Always show" ?define CHANGE_POS "Click on image to change position" - ?define BOX_LIB_LOAD_ERR "Error while loading library /rd/1/lib/box_lib.obj" - ?define LIBINI_LOAD_ERR "Error while loading library /rd/1/lib/libini.obj" #endif @@ -97,8 +93,8 @@ void main() dword id, key; mem_Init(); - if (load_dll2(libini, #lib_init,1)!=0) notify(LIBINI_LOAD_ERR); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); + load_dll(boxlib, #box_lib_init,0); LoadCfg(); diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index 9fa086867e..f00304f44c 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -78,10 +78,10 @@ void main() mem_Init(); SetEventMask(0x27); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("'Error: library doesn't exists - box_lib' -E"); - if (load_dll2(libio, #libio_init,1)!=0) notify("'Error: library doesn't exists - libio' -E"); - if (load_dll2(libimg, #libimg_init,1)!=0) notify("'Error: library doesn't exists - libimg' -E"); - if (load_dll2(libini, #lib_init,1)!=0) notify("'Error: library doesn't exists - libini' -E"); + load_dll(boxlib, #box_lib_init,0); + load_dll(libio, #libio_init,1)!=0); + load_dll(libimg, #libimg_init,1); + load_dll(libini, #lib_init,1); id = abspath("pixie.ini"); strcpy(#pixie_ini_path, id); diff --git a/programs/cmm/software_widget/software_widget.c b/programs/cmm/software_widget/software_widget.c index fad150f879..a8723f5a41 100644 --- a/programs/cmm/software_widget/software_widget.c +++ b/programs/cmm/software_widget/software_widget.c @@ -65,9 +65,9 @@ void main() { dword id, key; mem_Init(); - if (load_dll2(libio, #libio_init,1)!=0) notify(LIB_IO_LOAD_ERR); - if (load_dll2(libimg, #libimg_init,1)!=0) notify(LIB_IMG_LOAD_ERR); - if (load_dll2(libini, #lib_init,1)!=0) notify(LIB_INI_LOAD_ERR); + load_dll(libio, #libio_init,1); + load_dll(libimg, #libimg_init,1); + load_dll(libini, #lib_init,1); Libimg_LoadImage(#skin, "/sys/icons32.png"); Libimg_FillTransparent(skin.image, skin.w, skin.h, LIST_BACKGROUND_COLOR); diff --git a/programs/cmm/tmpdisk/t_gui.c b/programs/cmm/tmpdisk/t_gui.c index 2435c33203..7b89c86619 100644 --- a/programs/cmm/tmpdisk/t_gui.c +++ b/programs/cmm/tmpdisk/t_gui.c @@ -58,11 +58,11 @@ edit_box edit_disk_size= {50,0,5,0xffffff,0x94AECE,0x000000,0xffffff,0,4,#new_di void Main_Window() { - word id, key, err; + word id, key; int i, x; mem_Init(); - if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(BOX_LIB_LOAD_ERR); + load_dll(boxlib, #box_lib_init,0); GetSizeDisk(); edit_disk_size.left = strlen(INTRO_TEXT_4)*6 + 10; SetEventMask(0x27); diff --git a/programs/cmm/ttf_viewer/ttf_viewer.c b/programs/cmm/ttf_viewer/ttf_viewer.c index 8731649c72..4db8e909b3 100644 --- a/programs/cmm/ttf_viewer/ttf_viewer.c +++ b/programs/cmm/ttf_viewer/ttf_viewer.c @@ -39,8 +39,8 @@ void main() int id, key; mem_Init(); - if (load_dll2(libtruetype, #truetype, 1) != 0) notify("Error: library doesn't exists - truetype"); - if (load_dll2(Proc_lib, #OpenDialog_init,0)!=0) notify(LIB_IO_LOAD_ERR); + load_dll(libtruetype, #truetype, 1); + load_dll(Proc_lib, #OpenDialog_init,0); OpenDialog_init stdcall (#o_dialog); if (param[0]) OpenFont(#param);