From c8034527cec838fcecd26decda2f82fbe9d76304 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 6 Dec 2012 07:49:06 +0000 Subject: [PATCH] update cmm programs git-svn-id: svn://kolibrios.org@3081 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/HTMLv.c | 2 +- programs/cmm/browser/TWB.h | 2 +- programs/cmm/lib/file_system.h | 4 +- programs/cmm/lib/kolibri.h | 9 +++- programs/cmm/lib/network.h | 85 ++++++++++++++++++++++++++++++++ programs/cmm/lib/socket.h | 52 +++++++++++++++++++ programs/cmm/lib/strings.h | 14 +++++- programs/cmm/notify/@notify | Bin 832 -> 0 bytes programs/cmm/tmpdisk/t_window.c | 4 +- 9 files changed, 164 insertions(+), 8 deletions(-) create mode 100644 programs/cmm/lib/network.h create mode 100644 programs/cmm/lib/socket.h delete mode 100644 programs/cmm/notify/@notify diff --git a/programs/cmm/browser/HTMLv.c b/programs/cmm/browser/HTMLv.c index cbc539bbaa..d5e1b6e4ae 100644 --- a/programs/cmm/browser/HTMLv.c +++ b/programs/cmm/browser/HTMLv.c @@ -185,7 +185,7 @@ void main() case evKey: key = GetKey(); - if (edit1.flags == 66) || (edit1.flags == 98) SWITCH(key) //если активна строка адреса игнорируем некоторые кнопки + if (edit1.flags & 0b10) SWITCH(key) //если активна строка адреса игнорируем некоторые кнопки { CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; } WB1.Scan(key); diff --git a/programs/cmm/browser/TWB.h b/programs/cmm/browser/TWB.h index 1b8988d2e3..4031139223 100644 --- a/programs/cmm/browser/TWB.h +++ b/programs/cmm/browser/TWB.h @@ -142,7 +142,7 @@ void TWebBrowser::Scan(int id) if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); return; case 054: //F5 - IF(edit1.flags == 66) break; + IF(edit1.flags & 0b10) break; case REFRESH: if (GetProcessSlot(downloader_id)<>0) { diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index 0408ee3fcc..2671189616 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -165,7 +165,7 @@ BDVK getinfo_file_info; { mem_Init(); cBufer = mem_Alloc(CopyFile_atr.sizelo); - if (! ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, copy_from)) + if (! ReadFile(0, CopyFile_atr.sizelo, cBufer, copy_from)) if (! WriteFile(CopyFile_atr.sizelo, cBufer, copy_in)) return 1; } @@ -205,4 +205,4 @@ inline fastcall void GetCurDir( ECX, EDX) void notify(dword notify_param) { RunProgram("@notify", notify_param); -} \ No newline at end of file +} diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index a466175f6a..073baffb60 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -335,6 +335,13 @@ done: $pop ecx $pop ebx } + +inline fastcall void debugch( ECX) +{ + $mov eax,63 + $mov ebx,1 + $int 0x40 +} //------------------------------------------------------------------------------ void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI, ESI) @@ -460,4 +467,4 @@ inline fastcall void DeleteButton( EDX) EAX = 8; EDX += BT_DEL; $int 0x40; -} \ No newline at end of file +} diff --git a/programs/cmm/lib/network.h b/programs/cmm/lib/network.h new file mode 100644 index 0000000000..8659e63ebf --- /dev/null +++ b/programs/cmm/lib/network.h @@ -0,0 +1,85 @@ +//Network library + +dword network_lib = #a_network_lib; +char a_network_lib[21]="/sys/lib/network.obj\0"; + +dword network_lib_init = #aLib_init; +dword inet_addr = #aInet_addr; //"192.168.0.1" -> dword IP +dword inet_ntoa = #aInet_ntoa; +dword getaddrinfo = #aGetaddrinfo; +dword getaddrinfo_start = #aGetaddrinfo_start; +dword getaddrinfo_process = #aGetaddrinfo_process; +dword getaddrinfo_abort = #aGetaddrinfo_abort; +dword freeaddrinfo = #aFreeaddrinfo; + +dword am3__ = 0x0; +dword bm3__ = 0x0; + +char aLib_init[9] = "lib_init\0"; +char aInet_addr[10] = "inet_addr\0"; +char aInet_ntoa[10] = "inet_ntoa\0"; +char aGetaddrinfo[12] = "getaddrinfo\0"; +char aGetaddrinfo_start[18] = "getaddrinfo_start\0"; +char aGetaddrinfo_process[20] = "getaddrinfo_process\0"; +char aGetaddrinfo_abort[18] = "getaddrinfo_abort\0"; +char aFreeaddrinfo[13] = "freeaddrinfo\0"; + +/* +addr соответствует IP 10.101.102.103 +itoa((addr&0xFF000000)>>24) равно 103 +itoa((addr&0xFF0000)>>16) —это 102 +itoa((addr&0xFF00)>>8) — это 101 +itoa(addr&0xFF) — это 10 +*/ + +dword GetIPfromAdress(dword addr) +{ + dword lpointer; + getaddrinfo stdcall (addr, 0, 0, #lpointer); + if (EAX!=0) return 0; //если ошибка + return DSDWORD[DSDWORD[lpointer+24]+4]; +} + +/*dword GetIPfromAdressASM(dword addr) +{ + dword lpointer; + + ESP=#lpointer; + $push esp // lpointer + $push esp // fourth parameter + $push 0 // third parameter + $push 0 // second parameter + EAX = addr; + $push eax // first parameter + $call getaddrinfo + if (EAX!=0) return 0; //ошибка + $pop esi + $mov ebx, DSDWORD[lpointer+24] + $mov eax, DSDWORD[EBX+4] + + return EAX; +}*/ + + +/* +//Convert the string from standard IPv4 dotted notation to integer IP addr. +inet_addr stdcall ("192.168.0.1"); +server_IP = EAX; + + +char* __stdcall inet_ntoa(struct in_addr in); +Convert the Internet host address to standard IPv4 dotted notation. + +getaddrinfo(__in const char* hostname, __in const char* servname, + __in const struct addrinfo* hints, __out struct addrinfo **res); +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + struct sockaddr *ai_addr; + char *ai_canonname; + struct addrinfo *ai_next; +}; +*/ diff --git a/programs/cmm/lib/socket.h b/programs/cmm/lib/socket.h new file mode 100644 index 0000000000..0b1df403c1 --- /dev/null +++ b/programs/cmm/lib/socket.h @@ -0,0 +1,52 @@ +#define SOCKET_PASSIVE 0 +#define SOCKET_ACTIVE 1 +inline fastcall dword OpenSocket( ECX, EDX, ESI, EDI) +{ + $mov eax,53 + $mov ebx,5 + $int 0x40 +} + +inline fastcall int StatusSocket( ECX) +{ + $mov eax,53 + $mov ebx,6 + $int 0x40 +} + +inline fastcall dword ReadSocket( ECX) +{ + $mov eax,53 + $mov ebx,3 + $int 0x40 + return BL; +} + +inline fastcall dword PollSocket( ECX) +{ + $mov eax,53 + $mov ebx,2 + $int 0x40 +} + + +inline fastcall dword WriteSocket( ECX, EDX, ESI) +{ + $mov eax,53 + $mov ebx,7 + $int 0x40 +} + +inline fastcall int IsPortFree( ECX) +{ + $mov eax,53 + $mov ebx,9 + $int 0x40 +} + +unsigned int GetFreePort(int port_i) +{ + for (; port_i<65535; port_i++;) + if (IsPortFree(port_i)==1) return port_i; + return 0; +} diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index 8d71313fd6..f6035ee5e4 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -130,6 +130,18 @@ inline fastcall strcat( EDI, ESI) } } +/*void strcat(char *to, char *from) //тоже работает +{ + while(*to) to++; + while(*from) + { + *to = *from; + to++; + from++; + } + *to = '\0'; +}*/ + dword itoa( ESI) { unsigned char buffer[11]; @@ -333,4 +345,4 @@ L4: POP ECX #define stricmpn strcmpni #define strnicmp strcmpni #define strincmp strcmpni -#define strcmpin strcmpni \ No newline at end of file +#define strcmpin strcmpni diff --git a/programs/cmm/notify/@notify b/programs/cmm/notify/@notify deleted file mode 100644 index e13de8369fcc3c21cd9137317a66d93bb537786d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 832 zcmV-G1Hb%BP(w?w1poj+00001Mv*2LLXK;4&&M{b;sm-zN$dhzgM!4kHD{cF3}gxP zsLT)WERq2V;0)tA!5>l6?Llif6^)G&-c7}!O={YuU}v{9^vU*${*6@%t;N{9(jz$ zzvvEzRqw5~48JRdT8PZ6*fs>RkmN+_S)*xLoCd3ST)K>;(#$@r8ThQ3KF%oH$cqs3 ze{R+-oqih19!_}!w46DueU+^s1wYqHJX7O7ywiOK3?QMdEkC;N@4>fA@4VC%rgZ0N ze@g@o<7841RI&3-EU&FqE{1t095tlh7CQ8f6OeO+=6BDrq;ewzx5E6YPd(m)*H1*- zFtQR%^l2dZkwA?~R=u44RRjp}1Ml23x0NH>r5h##O$!`BhrklVL? z8BPn3E7K|DiWT{&P)2MD#$ZF=mSzfgq_RFDU|6YOTogaaUi%!Aq$BFmY1gT=lPO<~ z{DF!*4mSWN