Hello, everybody. five days ago, i asked the problem for the coder of named f0dder in Win32ASM Community messageboard . untill now he can't figure out it. the question is : 1. my tested code sometimes can worked, another times it collapsed. 2. when second clicked button "Get List", it must collapsed. regards.
Here you are. Lots of errors there... 1. You were using esi & edi registers in a thread function without saving them in the stack - FIXED 2. You were freeing dynamic memory in one thread and using it in another. Actually, it sometimes happened to free memory before it was parsed in list_IP subrutine. FIXED 3. dwIP_addr_first incremented in the while loop, so it was equal to dwIP_addr_end the second time you try to scan the IP range. FIXED Works almost fine now, but it crashes after 5-10 runs. That's because very high CPU and memory usage: about 40Mb in heap - not good at all. You should consider using virtual memory in a global buffer instead. _994730663__lv_8.zip
Another suggestion: why not appending the IP-MAC items directly to the list view without using an intermediate buffer?
Hello, Quantum. Thank you very much. Now, it crashed sometimes in my PC when our Local net Ip >61. if it ran, process is becoming big id. collapse MSG: "0x7c938fea" Instruction used "0x00000010" memory. it is disable "written" "terminate" or "debug" ;=================================== in list_IP proc actually. the bak_lpMacbuf looks as below: ;------------------------------------------------- name1$66.150.127.8=00:C0:9F:33:7F:99*Name2$66.150.127.4=00:06:5B:4BF :0A*name3$66.150.127.3=00:02:55:FC:6E:92* ;------------------------------------------------- so, i think "jz L1 ; FIX" is not to be need. I used buffer to get list name-ip-mac. it is foolish. because listview can't work in the Arp_IP2MAC proc CreateThread. Thanks again. my tested code has already improved a lot. regards
Hey, Quantum. I modified some code for simpleness. but it crashed everytime. How debuged a CreateThread proc is difficult to me. I don't know where the tested code is error. regards. 952368842__lv_9.zip
dcskm4200_1 Код (Text): ... dwThread dd 0 szMacFmt1 db "%s",0 ;; ++ add by q_q szMacFmt2 db "%02X%02X%02X%02X%02X%02X",0 ;; -- add by q_q unknown db "unknow",0 ... mov al,pulMac[0] ; eax= MAC address ;; ++ add by q_q push eax ;; -- add by q_q invoke wsprintf,lpNamebuf,addr szMacFmt1,lpNamebuf ; HostName invoke wsprintf,lpIpbuf,addr szMacFmt1,lpIpbuf ; IP addresss invoke wsprintf,lpMacbuf,addr szMacFmt2 ; MAC address ; ~~~~~~~~~ ; change by q_q add esp,6*DWORD ; <-- FIX STACK!!! ; ~ ; change by q_q invoke AddItemInt, ListIndex, 0d, sum_num ...
Hey, q_q Thanks you for help. the listview started working. but its work isn't pretty well. for example: 1. a lot of same index. 2. some blank rows is there. 3. sometimes it collapsed. msg"0x7c938fea" Instruction used "0x00000010" memory. it is disable "written" "terminate" or "debug" ) I think how limit the thread number is next to do. thanks again. regards.
Hey, q_q Thanks you for help. the listview started working. but its work isn't pretty well. for example: 1. a lot of same index. 2. some blank rows is there. 3. sometimes it collapsed. msg"0x7c938fea" Instruction used "0x00000010" memory. it is disable "written" "terminate" or "debug" ) 4. if added " ;==================================== push eax add esp,6*DWORD ; <-- FIX STACK!!! ;==================================== your MAC address isn't right. I think how limit the thread number is next to do. thanks again. regards.
dcskm4200_1 Код (Text): ... Arp_IP2MAC proc dwIpaddr:DWORD LOCAL pulMac[8]:BYTE LOCAL ulLen:DWORD LOCAL lpNamebuf,lpIpbuf,lpMacbuf:DWORD ;; ++ q_q move to getMAC ;; mov ListIndex,0 ;; mov sum_num,1 ;; -- q_q mov ulLen,6 ; MAC ADDR 6 byte ... ;; ++ q_q !!! need inside critical section inc ListIndex ; start 0 inc sum_num invoke LeaveCriticalSection,ADDR stCS ;; -- q_q .ENDIF ret Arp_IP2MAC endp ... getMAC proc lhwnd:DWORD LOCAL lpObjarr:DWORD ;; ++ q_q move from Arp_IP2MAC mov ListIndex,0 mov sum_num,1 ;; -- q_q pushad ...
Hey, q_q Thanks you for help. I'v done according to you said, the below problems is still there. ;=========================== 1. a lot of same index. 2. some blank rows is there. ;=========================== regards
Hey, q_q Thanks you very much. it is becoming more and more nice. 1. once lv_10.exe ran, the processes id and his thread id of to be running in the OS, will be become very big num. 2. in my pc, when i click button "get list". sometimes it is ok, another times it is collapsed. every crash has the same MSG. msg: ("0x7c938fea" Instruction used "0x00000010" memory. it is disable "written" "terminate" or "debug" ) best regards.