📄 gzio.cod
字号:
00087 c7 46 38 ff ff
ff ff mov DWORD PTR [esi+56], -1
$LN12@gzwrite:
; 588 : }
; 589 : s->crc = crc32(s->crc, (const Bytef *)buf, len);
0008e 8b 46 4c mov eax, DWORD PTR [esi+76]
00091 57 push edi
00092 55 push ebp
00093 50 push eax
00094 e8 00 00 00 00 call _crc32@12
00099 89 46 4c mov DWORD PTR [esi+76], eax
; 590 :
; 591 : return (int)(len - s->stream.avail_in);
0009c 8b c7 mov eax, edi
0009e 2b 46 04 sub eax, DWORD PTR [esi+4]
000a1 5f pop edi
000a2 5d pop ebp
000a3 5e pop esi
; 592 : }
000a4 c2 0c 00 ret 12 ; 0000000cH
$LN6@gzwrite:
; 564 : gz_stream *s = (gz_stream*)file;
; 565 :
; 566 : if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
000a7 b8 fe ff ff ff mov eax, -2 ; fffffffeH
000ac 5e pop esi
; 592 : }
000ad c2 0c 00 ret 12 ; 0000000cH
_gzwrite@12 ENDP
_TEXT ENDS
PUBLIC _gzread@12
; Function compile flags: /Ogtpy
; COMDAT _gzread@12
_TEXT SEGMENT
_file$ = 8 ; size = 4
_buf$ = 12 ; size = 4
_len$ = 16 ; size = 4
_gzread@12 PROC ; COMDAT
; 399 : gz_stream *s = (gz_stream*)file;
; 400 : Bytef *start = (Bytef*)buf; /* starting point for crc computation */
00000 8b 44 24 08 mov eax, DWORD PTR _buf$[esp-4]
00004 53 push ebx
00005 56 push esi
; 401 : Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
; 402 :
; 403 : if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
00006 8b 74 24 0c mov esi, DWORD PTR _file$[esp+4]
0000a 85 f6 test esi, esi
0000c 8b d8 mov ebx, eax
0000e 0f 84 31 02 00
00 je $LN24@gzread
00014 80 7e 5c 72 cmp BYTE PTR [esi+92], 114 ; 00000072H
00018 0f 85 27 02 00
00 jne $LN24@gzread
; 404 :
; 405 : if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
0001e 8b 4e 38 mov ecx, DWORD PTR [esi+56]
00021 83 f9 fd cmp ecx, -3 ; fffffffdH
00024 57 push edi
00025 0f 84 11 02 00
00 je $LN36@gzread
0002b 83 cf ff or edi, -1
0002e 3b cf cmp ecx, edi
00030 0f 84 06 02 00
00 je $LN36@gzread
; 406 : if (s->z_err == Z_STREAM_END) return 0; /* EOF */
00036 ba 01 00 00 00 mov edx, 1
0003b 3b ca cmp ecx, edx
0003d 75 08 jne SHORT $LN21@gzread
0003f 5f pop edi
00040 5e pop esi
00041 33 c0 xor eax, eax
00043 5b pop ebx
; 496 : }
00044 c2 0c 00 ret 12 ; 0000000cH
$LN21@gzread:
; 407 :
; 408 : next_out = (Byte*)buf;
; 409 : s->stream.next_out = (Bytef*)buf;
; 410 : s->stream.avail_out = len;
00047 8b 4c 24 18 mov ecx, DWORD PTR _len$[esp+8]
; 411 :
; 412 : if (s->stream.avail_out && s->back != EOF) {
0004b 85 c9 test ecx, ecx
0004d 55 push ebp
0004e 8b e8 mov ebp, eax
00050 89 46 0c mov DWORD PTR [esi+12], eax
00053 89 4e 10 mov DWORD PTR [esi+16], ecx
00056 74 2d je SHORT $LN38@gzread
00058 39 7e 6c cmp DWORD PTR [esi+108], edi
0005b 74 28 je SHORT $LN38@gzread
; 413 : *next_out++ = s->back;
0005d 8a 4e 6c mov cl, BYTE PTR [esi+108]
00060 88 08 mov BYTE PTR [eax], cl
; 414 : s->stream.next_out++;
00062 01 56 0c add DWORD PTR [esi+12], edx
; 415 : s->stream.avail_out--;
00065 01 7e 10 add DWORD PTR [esi+16], edi
; 416 : s->back = EOF;
; 417 : s->out++;
00068 01 56 68 add DWORD PTR [esi+104], edx
; 418 : start++;
; 419 : if (s->last) {
0006b 83 7e 70 00 cmp DWORD PTR [esi+112], 0
0006f 8d 68 01 lea ebp, DWORD PTR [eax+1]
00072 89 7e 6c mov DWORD PTR [esi+108], edi
00075 8b dd mov ebx, ebp
00077 74 0c je SHORT $LN38@gzread
; 420 : s->z_err = Z_STREAM_END;
00079 89 56 38 mov DWORD PTR [esi+56], edx
; 421 : return 1;
0007c 8b c2 mov eax, edx
$LN40@gzread:
0007e 5d pop ebp
0007f 5f pop edi
00080 5e pop esi
00081 5b pop ebx
; 496 : }
00082 c2 0c 00 ret 12 ; 0000000cH
$LN38@gzread:
; 422 : }
; 423 : }
; 424 :
; 425 : while (s->stream.avail_out != 0) {
00085 83 7e 10 00 cmp DWORD PTR [esi+16], 0
00089 0f 84 6f 01 00
00 je $LN35@gzread
0008f 90 npad 1
$LL18@gzread:
; 426 :
; 427 : if (s->transparent) {
00090 83 7e 58 00 cmp DWORD PTR [esi+88], 0
00094 0f 85 f7 00 00
00 jne $LN29@gzread
; 447 : return (int)len;
; 448 : }
; 449 : if (s->stream.avail_in == 0 && !s->z_eof) {
0009a 83 7e 04 00 cmp DWORD PTR [esi+4], 0
0009e 75 4f jne SHORT $LN11@gzread
000a0 83 7e 3c 00 cmp DWORD PTR [esi+60], 0
000a4 75 49 jne SHORT $LN11@gzread
; 450 :
; 451 : errno = 0;
000a6 e8 00 00 00 00 call __errno
000ab c7 00 00 00 00
00 mov DWORD PTR [eax], 0
; 452 : s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
000b1 8b 56 40 mov edx, DWORD PTR [esi+64]
000b4 8b 46 44 mov eax, DWORD PTR [esi+68]
000b7 52 push edx
000b8 68 00 40 00 00 push 16384 ; 00004000H
000bd 6a 01 push 1
000bf 50 push eax
000c0 e8 00 00 00 00 call _fread
000c5 83 c4 10 add esp, 16 ; 00000010H
; 453 : if (s->stream.avail_in == 0) {
000c8 85 c0 test eax, eax
000ca 89 46 04 mov DWORD PTR [esi+4], eax
000cd 75 1b jne SHORT $LN9@gzread
; 454 : s->z_eof = 1;
; 455 : if (ferror(s->file)) {
000cf 8b 4e 40 mov ecx, DWORD PTR [esi+64]
000d2 51 push ecx
000d3 c7 46 3c 01 00
00 00 mov DWORD PTR [esi+60], 1
000da e8 00 00 00 00 call _ferror
000df 83 c4 04 add esp, 4
000e2 85 c0 test eax, eax
000e4 0f 85 11 01 00
00 jne $LN30@gzread
$LN9@gzread:
; 457 : break;
; 458 : }
; 459 : }
; 460 : s->stream.next_in = s->inbuf;
000ea 8b 56 44 mov edx, DWORD PTR [esi+68]
000ed 89 16 mov DWORD PTR [esi], edx
$LN11@gzread:
; 461 : }
; 462 : s->in += s->stream.avail_in;
000ef 8b 46 04 mov eax, DWORD PTR [esi+4]
; 463 : s->out += s->stream.avail_out;
000f2 8b 4e 10 mov ecx, DWORD PTR [esi+16]
000f5 01 46 64 add DWORD PTR [esi+100], eax
000f8 01 4e 68 add DWORD PTR [esi+104], ecx
; 464 : s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
000fb 6a 00 push 0
000fd 56 push esi
000fe e8 00 00 00 00 call _inflate@8
; 465 : s->in -= s->stream.avail_in;
00103 8b 56 04 mov edx, DWORD PTR [esi+4]
; 466 : s->out -= s->stream.avail_out;
00106 8b 4e 10 mov ecx, DWORD PTR [esi+16]
00109 29 56 64 sub DWORD PTR [esi+100], edx
0010c 29 4e 68 sub DWORD PTR [esi+104], ecx
; 467 :
; 468 : if (s->z_err == Z_STREAM_END) {
0010f 83 f8 01 cmp eax, 1
00112 89 46 38 mov DWORD PTR [esi+56], eax
00115 75 4f jne SHORT $LN34@gzread
; 469 : /* Check CRC and original size */
; 470 : s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
00117 8b 7e 0c mov edi, DWORD PTR [esi+12]
0011a 8b 46 4c mov eax, DWORD PTR [esi+76]
0011d 8b d7 mov edx, edi
0011f 2b d3 sub edx, ebx
00121 52 push edx
00122 53 push ebx
00123 50 push eax
00124 e8 00 00 00 00 call _crc32@12
00129 89 46 4c mov DWORD PTR [esi+76], eax
; 471 : start = s->stream.next_out;
; 472 :
; 473 : if (getLong(s) != s->crc) {
0012c 8b c6 mov eax, esi
0012e 8b df mov ebx, edi
00130 e8 00 00 00 00 call _getLong
00135 3b 46 4c cmp eax, DWORD PTR [esi+76]
00138 75 4e jne SHORT $LN32@gzread
; 476 : (void)getLong(s);
0013a 8b c6 mov eax, esi
0013c e8 00 00 00 00 call _getLong
; 477 : /* The uncompressed length returned by above getlong() may be
; 478 : * different from s->out in case of concatenated .gz files.
; 479 : * Check for such files:
; 480 : */
; 481 : check_header(s);
00141 8b c6 mov eax, esi
00143 e8 00 00 00 00 call _check_header
; 482 : if (s->z_err == Z_OK) {
00148 83 7e 38 00 cmp DWORD PTR [esi+56], 0
0014c 0f 85 ac 00 00
00 jne $LN35@gzread
; 483 : inflateReset(&(s->stream));
00152 56 push esi
00153 e8 00 00 00 00 call _inflateReset@4
; 484 : s->crc = crc32(0L, Z_NULL, 0);
00158 6a 00 push 0
0015a 6a 00 push 0
0015c 6a 00 push 0
0015e e8 00 00 00 00 call _crc32@12
00163 89 46 4c mov DWORD PTR [esi+76], eax
$LN34@gzread:
; 485 : }
; 486 : }
; 487 : }
; 488 : if (s->z_err != Z_OK || s->z_eof) break;
00166 83 7e 38 00 cmp DWORD PTR [esi+56], 0
0016a 0f 85 8e 00 00
00 jne $LN35@gzread
00170 83 7e 3c 00 cmp DWORD PTR [esi+60], 0
00174 0f 85 84 00 00
00 jne $LN35@gzread
; 422 : }
; 423 : }
; 424 :
; 425 : while (s->stream.avail_out != 0) {
0017a 83 7e 10 00 cmp DWORD PTR [esi+16], 0
0017e 74 7e je SHORT $LN35@gzread
00180 83 cf ff or edi, -1
00183 e9 08 ff ff ff jmp $LL18@gzread
$LN32@gzread:
; 474 : s->z_err = Z_DATA_ERROR;
00188 c7 46 38 fd ff
ff ff mov DWORD PTR [esi+56], -3 ; fffffffdH
; 475 : } else {
0018f eb 6d jmp SHORT $LN35@gzread
$LN29@gzread:
; 428 : /* Copy first the lookahead bytes: */
; 429 : uInt n = s->stream.avail_in;
00191 8b 7e 04 mov edi, DWORD PTR [esi+4]
; 430 : if (n > s->stream.avail_out) n = s->stream.avail_out;
00194 8b 46 10 mov eax, DWORD PTR [esi+16]
00197 3b f8 cmp edi, eax
00199 76 02 jbe SHORT $LN15@gzread
0019b 8b f8 mov edi, eax
$LN15@gzread:
; 431 : if (n > 0) {
0019d 85 ff test edi, edi
0019f 76 1d jbe SHORT $LN14@gzread
; 432 : zmemcpy(s->stream.next_out, s->stream.next_in, n);
001a1 8b 0e mov ecx, DWORD PTR [esi]
001a3 8b 56 0c mov edx, DWORD PTR [esi+12]
001a6 57 push edi
001a7 51 push ecx
001a8 52 push edx
001a9 e8 00 00 00 00 call _memcpy
; 433 : next_out += n;
; 434 : s->stream.next_out = next_out;
; 435 : s->stream.next_in += n;
001ae 01 3e add DWORD PTR [esi], edi
; 436 : s->stream.avail_out -= n;
001b0 29 7e 10 sub DWORD PTR [esi+16], edi
001b3 03 ef add ebp, edi
001b5 83 c4 0c add esp, 12 ; 0000000cH
; 437 : s->stream.avail_in -= n;
001b8 29 7e 04 sub DWORD PTR [esi+4], edi
001bb 89 6e 0c mov DWORD PTR [esi+12], ebp
$LN14@gzread:
; 438 : }
; 439 : if (s->stream.avail_out > 0) {
001be 8b 46 10 mov eax, DWORD PTR [esi+16]
001c1 85 c0 test eax, eax
001c3 76 13 jbe SHORT $LN13@gzread
; 440 : s->stream.avail_out -=
; 441 : (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
001c5 8b 4e 40 mov ecx, DWORD PTR [esi+64]
001c8 51 push ecx
001c9 50 push eax
001ca 6a 01 push 1
001cc 55 push ebp
001cd e8 00 00 00 00 call _fread
001d2 83 c4 10 add esp, 16 ; 00000010H
001d5 29 46 10 sub DWORD PTR [esi+16], eax
$LN13@gzread:
; 442 : }
; 443 : len -= s->stream.avail_out;
001d8 8b 44 24 1c mov eax, DWORD PTR _len$[esp+12]
001dc 2b 46 10 sub eax, DWORD PTR [esi+16]
; 444 : s->in += len;
001df 01 46 64 add DWORD PTR [esi+100], eax
; 445 : s->out += len;
001e2 01 46 68 add DWORD PTR [esi+104], eax
; 446 : if (len == 0) s->z_eof = 1;
001e5 85 c0 test eax, eax
001e7 0f 85 91 fe ff
ff jne $LN40@gzread
001ed 5d pop ebp
001ee 5f pop edi
001ef c7 46 3c 01 00
00 00 mov DWORD PTR [esi+60], 1
001f6 5e pop esi
001f7 5b pop ebx
; 496 : }
001f8 c2 0c 00 ret 12 ; 0000000cH
$LN30@gzread:
; 456 : s->z_err = Z_ERRNO;
001fb 89 7e 38 mov DWORD PTR [esi+56], edi
$LN35@gzread:
; 489 : }
; 490 : s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
001fe 8b 56 0c mov edx, DWORD PTR [esi+12]
00201 8b 46 4c mov eax, DWORD PTR [esi+76]
00204 2b d3 sub edx, ebx
00206 52 push edx
00207 53 push ebx
00208 50 push eax
00209 e8 00 00 00 00 call _crc32@12
; 491 :
; 492 : if (len == s->stream.avail_out &&
; 493 : (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
0020e 8b 4e 10 mov ecx, DWORD PTR [esi+16]
00211 89 46 4c mov DWORD PTR [esi+76], eax
00214 8b 44 24 1c mov eax, DWORD PTR _len$[esp+12]
00218 3b c1 cmp eax, ecx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -