関数 41b020

; recv する
; ecx コネクションズクラス
; esp + 0x4 コネクションのインデックス
; esp + 0x8 フラグ
0041b020 53 push ebx
0041b021 8b5c2408 mov ebx,[esp+0x8] ; ebx <- 第一引数( コネクションのインデックス )
0041b025 85db test ebx,ebx
0041b027 55 push ebp
0041b028 56 push esi
0041b029 57 push edi
0041b02a 8be9 mov ebp,ecx
0041b02c 0f8c69010000 jl image00400000+0x1b19b (0041b19b) ; ebx が - の場合
0041b032 81fbf4010000 cmp ebx,0x1f4
0041b038 0f8d5d010000 jnl image00400000+0x1b19b (0041b19b) ; ebx が 500 以上の場合
0041b03e 8bc3 mov eax,ebx
0041b040 69c028040000 imul eax,eax,0x428 ; eax は ebx の 1064 倍( コネクションクラスのサイズ )
0041b046 8db428ecbb0000 lea esi,[eax+ebp+0xbbec] ; ebp + 0xbbec はコネクションクラスの配列
0041b04d 8a868e000000 mov al,[esi+0x8e]
0041b053 84c0 test al,al
0041b055 0f8440010000 je image00400000+0x1b19b (0041b19b) ; 何かのフラグ( esi + 8e )が 0 -> 何もせずリターン
0041b05b 66837c241820 cmp word ptr [esp+0x18],0x20
0041b061 0f84a5000000 je image00400000+0x1b10c (0041b10c) ; 第二引数 == 32 -> 読み終えた事にする
0041b067 8b869c000000 mov eax,[esi+0x9c] ; eax <- ソケット( esi + 9c )
0041b06d 85c0 test eax,eax
0041b06f 0f8497000000 je image00400000+0x1b10c (0041b10c) ; ########## バグっぽい( INVALID_SOCKET と判定すべき )
0041b075 6a00 push 0x0
0041b077 68fcff0100 push 0x1fffc
0041b07c 683885fe00 push 0xfe8538
0041b081 50 push eax
0041b082 ff15f0954600 call dword ptr [image00400000+0x695f0 (004695f0)] ; recv
0041b088 8bf8 mov edi,eax
0041b08a 85ff test edi,edi
0041b08c 747e jz image00400000+0x1b10c (0041b10c) ; 読み終えた
0041b08e 83ffff cmp edi,0xffffffff
0041b091 c7462c00000000 mov dword ptr [esi+0x2c],0x0
0041b098 0f858d000000 jne image00400000+0x1b12b (0041b12b) ; SOCKET_ERROR ではない
0041b09e ff1510964600 call dword ptr [image00400000+0x69610 (00469610)] ; WSAGetLastError
0041b0a4 8bf8 mov edi,eax
0041b0a6 81ff33270000 cmp edi,0x2733 ; WSAEWOULDBLOCK
0041b0ac 746e jz image00400000+0x1b11c (0041b11c)
0041b0ae 81ff45270000 cmp edi,0x2745 ; WSAECONNABORTED
0041b0b4 7456 jz image00400000+0x1b10c (0041b10c)
0041b0b6 81ff46270000 cmp edi,0x2746 ; WSAECONNRESET
0041b0bc 744e jz image00400000+0x1b10c (0041b10c)
0041b0be 81ff49270000 cmp edi,0x2749 ; WSAENOTCONN
0041b0c4 7446 jz image00400000+0x1b10c (0041b10c)
; >>> 想定外のエラーコードが返って来た場合の処理
0041b0c6 51 push ecx
0041b0c7 8bcc mov ecx,esp
0041b0c9 89642418 mov [esp+0x18],esp
0041b0cd 6824cd4600 push 0x46cd24
0041b0d2 e8b96efeff call image00400000+0x1f90 (00401f90)
0041b0d7 e854960100 call image00400000+0x34730 (00434730)
0041b0dc 83c404 add esp,0x4
0041b0df 57 push edi
0041b0e0 8bcd mov ecx,ebp
0041b0e2 e8e9cbffff call image00400000+0x17cd0 (00417cd0)
0041b0e7 c6850d04090001 mov byte ptr [ebp+0x9040d],0x1
0041b0ee 8a8689000000 mov al,[esi+0x89]
0041b0f4 84c0 test al,al
0041b0f6 7514 jnz image00400000+0x1b10c (0041b10c)
0041b0f8 6a01 push 0x1
0041b0fa 8d4c2418 lea ecx,[esp+0x18]
0041b0fe 51 push ecx
0041b0ff 53 push ebx
0041b100 8bcd mov ecx,ebp
0041b102 c64424201f mov byte ptr [esp+0x20],0x1f
0041b107 e874d7feff call image00400000+0x8880 (00408880)
; <<< 想定外のエラーコードが返って来た場合の処理
; 想定内のエラーコードが返って来た or 読み終えた
0041b10c 6a01 push 0x1
0041b10e 8bce mov ecx,esi
0041b110 e84b8bfeff call image00400000+0x3c60 (00403c60)
0041b115 5f pop edi
0041b116 5e pop esi
0041b117 5d pop ebp
0041b118 5b pop ebx
0041b119 c20800 ret 0x8
; WSAEWOULDBLOCK
0041b11c 6a0a push 0xa
0041b11e ff15d4924600 call dword ptr [image00400000+0x692d4 (004692d4)]
0041b124 5f pop edi
0041b125 5e pop esi
0041b126 5d pop ebp
0041b127 5b pop ebx
0041b128 c20800 ret 0x8
; SOCKET_ERROR ではない
0041b12b 8a8689000000 mov al,[esi+0x89]
0041b131 84c0 test al,al
0041b133 7414 jz image00400000+0x1b149 (0041b149) ; 何かのフラグ( esi + 0x89 )が 0( 復号鍵取得済みフラグの可能性 )
0041b135 57 push edi ; recv し終えた長さ
0041b136 683885fe00 push 0xfe8538 ; バッファ
0041b13b 8bce mov ecx,esi ; class
0041b13d e88e8cfeff call image00400000+0x3dd0 (00403dd0)
0041b142 5f pop edi
0041b143 5e pop esi
0041b144 5d pop ebp
0041b145 5b pop ebx
0041b146 c20800 ret 0x8
; 何かのフラグ( esi + 0x89 )が 0( 復号鍵取得済みフラグの可能性 )
0041b149 8a8693000000 mov al,[esi+0x93]
0041b14f 84c0 test al,al
0041b151 7535 jnz image00400000+0x1b188 (0041b188) ; 何かのフラグ( esi + 0x93 )が 0( 復号鍵取得済みフラグの可能性 )
0041b153 83ff06 cmp edi,0x6
0041b156 8bce mov ecx,esi
0041b158 7c20 jl image00400000+0x1b17a (0041b17a) ; 読み終えた長さが 6 未満
0041b15a 8b153a85fe00 mov edx,[image00400000+0xbe853a (00fe853a)] ; edx <- バッファ[2] ... バッファ[5] ########## 良くない処理( アラインメントが合ってない )
0041b160 8d4678 lea eax,[esi+0x78]
0041b163 50 push eax
0041b164 8910 mov [eax],edx ; 復号鍵を入れている可能性
0041b166 c6400400 mov byte ptr [eax+0x4],0x0
0041b16a e8d17efeff call image00400000+0x3040 (00403040)
0041b16f 8d47fa lea eax,[edi-0x6]
0041b172 50 push eax ; recv し終えた長さから鍵長( 4 )とゴミ( 2 )を引いた値
0041b173 683e85fe00 push 0xfe853e ; バッファ + 4 + 2
0041b178 eb14 jmp image00400000+0x1b18e (0041b18e)
; 読み終えた長さが 6 未満
0041b17a 6a01 push 0x1
0041b17c e8df8afeff call image00400000+0x3c60 (00403c60)
0041b181 5f pop edi
0041b182 5e pop esi
0041b183 5d pop ebp
0041b184 5b pop ebx
0041b185 c20800 ret 0x8
; 何かのフラグ( esi + 0x93 )が 0( 復号鍵取得済みフラグの可能性 )
0041b188 57 push edi ; recv し終えた長さ
0041b189 683885fe00 push 0xfe8538 ; バッファ
0041b18e 8bce mov ecx,esi ; class
0041b190 e83b8cfeff call image00400000+0x3dd0 (00403dd0)
0041b195 01bdf8330000 add [ebp+0x33f8],edi
; 何もせずリターン
0041b19b 5f pop edi
0041b19c 5e pop esi
0041b19d 5d pop ebp
0041b19e 5b pop ebx
0041b19f c20800 ret 0x8