Rev 589 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 589 | Rev 631 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | .subfiles dd ? ; head of L2-list of files [for folders] |
17 | .subfiles dd ? ; head of L2-list of files [for folders] |
18 | .subfiles.end dd ? |
18 | .subfiles.end dd ? |
19 | .NumSubItems dd ? |
19 | .NumSubItems dd ? |
20 | .next dd ? ; next item of list of subfolders or files |
20 | .next dd ? ; next item of list of subfolders or files |
21 | .prev dd ? ; previous item of list of subfolders or files |
21 | .prev dd ? ; previous item of list of subfolders or files |
- | 22 | .stamp dd ? |
|
22 | .attr dd ? |
23 | .attr dd ? |
23 | .FileCRC dd ? |
24 | .FileCRC dd ? |
24 | .startPos dq ? |
25 | .startPos dq ? |
25 | .CreationTime dq ? |
26 | .CreationTime dq ? |
26 | .LastAccessTime dq ? |
27 | .LastAccessTime dq ? |
Line 35... | Line 36... | ||
35 | .bCreationTimeDefined db ? |
36 | .bCreationTimeDefined db ? |
36 | .bLastAccessTimeDefined db ? |
37 | .bLastAccessTimeDefined db ? |
37 | .bLastWriteTimeDefined db ? |
38 | .bLastWriteTimeDefined db ? |
38 | .bHasStream db ? |
39 | .bHasStream db ? |
39 | .bAnti db ? |
40 | .bAnti db ? |
40 | .stamp dd ? |
- | |
41 | .size = $ |
41 | .size = $ |
42 | end virtual |
42 | end virtual |
Line 43... | Line 43... | ||
43 | 43 | ||
44 | virtual at 0 |
44 | virtual at 0 |
Line 828... | Line 828... | ||
828 | mov eax, [hOut] |
828 | mov eax, [hOut] |
829 | and [eax+handle_7z.curdir], 0 ; set root directory |
829 | and [eax+handle_7z.curdir], 0 ; set root directory |
830 | mov esi, [inStream] |
830 | mov esi, [inStream] |
831 | mov [eax+handle_7z.host], esi |
831 | mov [eax+handle_7z.host], esi |
832 | lea edi, [eax+handle_7z.host_datetime] |
832 | lea edi, [eax+handle_7z.host_datetime] |
833 | mov esi, [esp+16] |
833 | mov esi, [esp+12] |
834 | add esi, 8 |
834 | add esi, 8 |
835 | mov ecx, 6 |
835 | mov ecx, 6 |
836 | rep movsd |
836 | rep movsd |
837 | ret |
837 | ret |
Line 2200... | Line 2200... | ||
2200 | push dword [eax+streamInfo.size+4] |
2200 | push dword [eax+streamInfo.size+4] |
2201 | push dword [eax+streamInfo.size] |
2201 | push dword [eax+streamInfo.size] |
2202 | push 0 |
2202 | push 0 |
2203 | push [inStream] |
2203 | push [inStream] |
2204 | call [seek] |
2204 | call [seek] |
2205 | pop eax |
- | |
2206 | push eax |
- | |
2207 | push ecx |
2205 | push ecx |
2208 | push edi |
2206 | push edi |
2209 | push [inStream] |
2207 | push [inStream] |
2210 | call [read] |
2208 | call [read] |
2211 | cmp eax, ecx |
2209 | cmp eax, ecx |
Line 2272... | Line 2270... | ||
2272 | cmp dword [eax+5], 0x0107F106 |
2270 | cmp dword [eax+5], 0x0107F106 |
2273 | jnz @f |
2271 | jnz @f |
2274 | cmp dword [eax+9], 1 |
2272 | cmp dword [eax+9], 1 |
2275 | jz .ret |
2273 | jz .ret |
2276 | @@: |
2274 | @@: |
- | 2275 | inc edx |
|
- | 2276 | ; Deflate decoder: method ID = [size=03] 04 01 08, NumInStreams = NumOutStreams = 1 |
|
- | 2277 | cmp dword [eax+4], 0x08010403 |
|
- | 2278 | jnz @f |
|
- | 2279 | cmp dword [eax+8], 1 |
|
- | 2280 | jz .ret |
|
- | 2281 | @@: |
|
- | 2282 | inc edx |
|
- | 2283 | ; Deflate64 decoder: method ID = [size=03] 04 01 09, NumInStreams = NumOutStreams = 1 |
|
- | 2284 | cmp dword [eax+4], 0x09010403 |
|
- | 2285 | jnz @f |
|
- | 2286 | cmp dword [eax+8], 1 |
|
- | 2287 | jz .ret |
|
- | 2288 | @@: |
|
2277 | stc |
2289 | stc |
2278 | .ret: |
2290 | .ret: |
2279 | ret |
2291 | ret |
Line 2280... | Line 2292... | ||
2280 | 2292 | ||
Line 2285... | Line 2297... | ||
2285 | dd lzma_get_buf_size |
2297 | dd lzma_get_buf_size |
2286 | dd ppmd_get_buf_size |
2298 | dd ppmd_get_buf_size |
2287 | dd bcj_get_buf_size |
2299 | dd bcj_get_buf_size |
2288 | dd bcj2_get_buf_size |
2300 | dd bcj2_get_buf_size |
2289 | dd aes7z_get_buf_size |
2301 | dd aes7z_get_buf_size |
- | 2302 | dd deflate_get_buf_size |
|
- | 2303 | dd deflate_get_buf_size |
|
2290 | label _7z.InitTable dword |
2304 | label _7z.InitTable dword |
2291 | dd copy_init_decoder |
2305 | dd copy_init_decoder |
2292 | dd lzma_init_decoder |
2306 | dd lzma_init_decoder |
2293 | dd ppmd_init_decoder |
2307 | dd ppmd_init_decoder |
2294 | dd bcj_init_decoder |
2308 | dd bcj_init_decoder |
2295 | dd bcj2_init_decoder |
2309 | dd bcj2_init_decoder |
2296 | dd aes7z_init_decoder |
2310 | dd aes7z_init_decoder |
- | 2311 | dd deflate_init_decoder |
|
- | 2312 | dd deflate64_init_decoder |
|
2297 | endg |
2313 | endg |
Line 2298... | Line 2314... | ||
2298 | 2314 | ||
2299 | copy_get_buf_size: |
2315 | copy_get_buf_size: |
2300 | mov eax, streamInfo.size+8 |
2316 | mov eax, streamInfo.size+8 |
Line 2341... | Line 2357... | ||
2341 | pop eax |
2357 | pop eax |
2342 | mov [eax+streamInfo.size+4], esi |
2358 | mov [eax+streamInfo.size+4], esi |
2343 | popad |
2359 | popad |
2344 | ret |
2360 | ret |
Line 2345... | Line -... | ||
2345 | - | ||
2346 | ; int __stdcall ReadFolder([esp+4] = HANDLE hPlugin, |
- | |
2347 | ; [esp+8] = unsigned dirinfo_start, [esp+12] = unsigned dirinfo_size, |
- | |
2348 | ; [esp+16] = void* dirdata); |
- | |
2349 | ReadFolder_7z: |
- | |
2350 | ; init header |
- | |
2351 | mov edi, [esp+16] |
- | |
2352 | mov ecx, 32/4 |
- | |
2353 | xor eax, eax |
- | |
2354 | rep stosd |
- | |
2355 | mov byte [edi-32], 1 ; version |
- | |
2356 | mov ebp, [esp+4] |
- | |
2357 | ; get current directory |
- | |
2358 | lea ebx, [ebp+handle_7z.root.subfolders] |
- | |
2359 | cmp [ebp+handle_7z.curdir], 0 |
- | |
2360 | jz @f |
- | |
2361 | mov ebx, [ebp+handle_7z.curdir] |
- | |
2362 | add ebx, file_in_7z.subfolders |
- | |
2363 | @@: |
- | |
2364 | mov ecx, [ebx+16] |
- | |
2365 | mov [edi-24], ecx ; number of files |
- | |
2366 | ; edi points to BDFE |
- | |
2367 | push 6 ; assume EOF |
- | |
2368 | pop eax |
- | |
2369 | sub ecx, [esp+8] |
- | |
2370 | ja @f |
- | |
2371 | and dword [edi-28], 0 ; number of files read |
- | |
2372 | ret 10h |
- | |
2373 | @@: |
- | |
2374 | cmp ecx, [esp+12] |
- | |
2375 | jb @f |
- | |
2376 | mov ecx, [esp+12] |
- | |
2377 | xor eax, eax ; OK |
- | |
2378 | @@: |
- | |
2379 | mov [edi-28], ecx |
- | |
2380 | push eax |
- | |
2381 | ; copy files data |
- | |
2382 | test ecx, ecx |
- | |
2383 | jz .done |
- | |
2384 | ; seek to required item |
- | |
2385 | mov eax, [esp+8+4] |
- | |
2386 | mov esi, [ebx] |
- | |
2387 | .0: |
- | |
2388 | test esi, esi |
- | |
2389 | jnz .1 |
- | |
2390 | mov esi, [ebx+8] |
- | |
2391 | .1: |
- | |
2392 | add esi, ebp |
- | |
2393 | dec eax |
- | |
2394 | js .2 |
- | |
2395 | mov esi, [esi+file_in_7z.next] |
- | |
2396 | jmp .0 |
- | |
2397 | .2: |
- | |
2398 | .copy: |
- | |
2399 | cmp [esi+file_in_7z.bPseudoFolder], 0 |
- | |
2400 | jnz .pseudo |
- | |
2401 | xor eax, eax |
- | |
2402 | cmp [esi+file_in_7z.bAttrDefined], 0 |
- | |
2403 | jz @f |
- | |
2404 | mov eax, [esi+file_in_7z.attr] |
- | |
2405 | @@: |
- | |
2406 | stosd |
- | |
2407 | xor eax, eax |
- | |
2408 | stosd |
- | |
2409 | push esi ecx |
- | |
2410 | add esi, file_in_7z.CreationTime |
- | |
2411 | mov ecx, 8 |
- | |
2412 | rep movsd |
- | |
2413 | pop ecx esi |
- | |
2414 | mov edx, [esi+file_in_7z.name] |
- | |
2415 | push edi |
- | |
2416 | @@: |
- | |
2417 | mov al, [edx] |
- | |
2418 | inc edx |
- | |
2419 | stosb |
- | |
2420 | test al, al |
- | |
2421 | jnz @b |
- | |
2422 | pop edi |
- | |
2423 | .cont: |
- | |
2424 | add edi, 264 |
- | |
2425 | mov esi, [esi+file_in_7z.next] |
- | |
2426 | test esi, esi |
- | |
2427 | jnz @f |
- | |
2428 | mov esi, [ebx+8] |
- | |
2429 | @@: |
- | |
2430 | add esi, ebp |
- | |
2431 | loop .copy |
- | |
2432 | jmp .done |
- | |
2433 | .pseudo: |
- | |
2434 | push 0x10 ; attributes: folder |
- | |
2435 | pop eax |
- | |
2436 | stosd |
- | |
2437 | xor eax, eax |
- | |
2438 | stosd |
- | |
2439 | push ecx esi |
- | |
2440 | lea esi, [ebp+handle_7z.host_datetime] |
- | |
2441 | mov ecx, 6 |
- | |
2442 | rep movsd |
- | |
2443 | pop esi |
- | |
2444 | stosd |
- | |
2445 | stosd |
- | |
2446 | push edi esi |
- | |
2447 | mov ecx, [esi+file_in_7z.namelen] |
- | |
2448 | mov esi, [esi+file_in_7z.name] |
- | |
2449 | rep movsb |
- | |
2450 | mov byte [edi], 0 |
- | |
2451 | pop esi edi ecx |
- | |
2452 | jmp .cont |
- | |
2453 | .done: |
- | |
2454 | pop eax |
- | |
2455 | ret 10h |
- | |
2456 | - | ||
2457 | ; bool __stdcall SetFolder([esp+4] = HANDLE hPlugin, |
- | |
2458 | ; [esp+8] = const char* relative_path, [esp+12] = const char* absolute_path); |
- | |
2459 | SetFolder_7z: |
- | |
2460 | mov ebp, [esp+4] |
- | |
2461 | mov edx, [ebp+handle_7z.curdir] |
- | |
2462 | mov esi, [esp+8] |
- | |
2463 | cmp dword [esi], '..' |
- | |
2464 | jz .toparent |
- | |
2465 | xor ecx, ecx |
- | |
2466 | @@: |
- | |
2467 | inc ecx |
- | |
2468 | cmp byte [esi+ecx], 0 |
- | |
2469 | jnz @b |
- | |
2470 | mov ebx, [ebp+handle_7z.root.subfolders] |
- | |
2471 | test edx, edx |
- | |
2472 | jz .scan |
- | |
2473 | mov ebx, [edx+file_in_7z.subfolders] |
- | |
2474 | .scan: |
- | |
2475 | test ebx, ebx |
- | |
2476 | jz .err |
- | |
2477 | add ebx, ebp |
- | |
2478 | cmp [ebx+file_in_7z.namelen], ecx |
- | |
2479 | jnz .cont |
- | |
2480 | push ecx esi |
- | |
2481 | mov edi, [ebx+file_in_7z.name] |
- | |
2482 | repz cmpsb |
- | |
2483 | pop esi ecx |
- | |
2484 | jz .set |
- | |
2485 | .cont: |
- | |
2486 | mov ebx, [ebx+file_in_7z.next] |
- | |
2487 | jmp .scan |
- | |
2488 | .toparent: |
- | |
2489 | test edx, edx |
- | |
2490 | jz .err |
- | |
2491 | mov ebx, [edx+file_in_7z.parent] |
- | |
2492 | test ebx, ebx |
- | |
2493 | jz @f |
- | |
2494 | add ebx, ebp |
- | |
2495 | @@: |
- | |
2496 | .set: |
- | |
2497 | mov [ebp+handle_7z.curdir], ebx |
- | |
2498 | mov al, 1 |
- | |
2499 | ret 12 |
- | |
2500 | .err: |
- | |
2501 | xor eax, eax |
- | |
2502 | ret 12 |
- | |
2503 | 2361 | ||
2504 | ; ebp=hPlugin, eax->item, edi->info |
2362 | ; ebp=hPlugin, eax->item, edi->info |
2505 | getattr_7z: |
2363 | getattr_7z: |
2506 | cmp [eax+file_in_7z.bPseudoFolder], 0 |
2364 | cmp [eax+file_in_7z.bPseudoFolder], 0 |
2507 | jnz .pseudo |
2365 | jnz .pseudo |
Line 2512... | Line 2370... | ||
2512 | add esi, -(file_in_7z.attr+4) + file_in_7z.CreationTime |
2370 | add esi, -(file_in_7z.attr+4) + file_in_7z.CreationTime |
2513 | mov ecx, 8 |
2371 | mov ecx, 8 |
2514 | rep movsd |
2372 | rep movsd |
2515 | ret |
2373 | ret |
2516 | .pseudo: |
2374 | .pseudo: |
2517 | mov esi, [eax+file_in_7z.name] |
- | |
2518 | mov ecx, [eax+file_in_7z.namelen] |
- | |
2519 | push 0x10 ; attributes: folder |
2375 | push 0x10 ; attributes: folder |
2520 | pop eax |
2376 | pop eax |
2521 | stosd |
2377 | stosd |
2522 | xor eax, eax |
2378 | xor eax, eax |
2523 | stosd |
2379 | stosd |
2524 | push ecx esi |
- | |
2525 | lea esi, [ebp+handle_7z.host_datetime] |
2380 | lea esi, [ebp+handle_7z.host_datetime] |
2526 | push 6 |
2381 | push 6 |
2527 | pop ecx |
2382 | pop ecx |
2528 | rep movsd |
2383 | rep movsd |
2529 | pop esi ecx |
- | |
2530 | stosd |
2384 | stosd |
2531 | stosd |
2385 | stosd |
2532 | rep movsb |
- | |
2533 | mov byte [edi], 0 |
- | |
2534 | ret |
2386 | ret |
Line 2535... | Line 2387... | ||
2535 | 2387 | ||
2536 | virtual at 0 |
2388 | virtual at 0 |
2537 | file_handle_7z: |
2389 | file_handle_7z: |
Line 2984... | Line 2836... | ||
2984 | @@: |
2836 | @@: |
2985 | mov esi, ebx |
2837 | mov esi, ebx |
2986 | call free_handle |
2838 | call free_handle |
2987 | .ret: |
2839 | .ret: |
2988 | ret 4 |
2840 | ret 4 |
2989 | - | ||
2990 | iglobal |
- | |
2991 | cur_stamp dd 0 |
- | |
2992 | endg |
- | |
2993 | - | ||
2994 | uglobal |
- | |
2995 | tmp_bdfe rb 304 |
- | |
2996 | endg |
- | |
2997 | - | ||
2998 | GetFiles_7z: |
- | |
2999 | mov ecx, [ebp+handle_7z.NumFiles] |
- | |
3000 | test ecx, ecx |
- | |
3001 | jz .ret |
- | |
3002 | lea ebx, [ebp+handle_7z.basesize] |
- | |
3003 | inc [cur_stamp] |
- | |
3004 | .loop: |
- | |
3005 | push ecx |
- | |
3006 | mov esi, [ebx+file_in_7z.fullname] |
- | |
3007 | mov edx, [ebp+handle_7z.curdir] |
- | |
3008 | test edx, edx |
- | |
3009 | jz .incur |
- | |
3010 | mov eax, [cur_stamp] |
- | |
3011 | mov [edx+file_in_7z.stamp], eax |
- | |
3012 | mov edi, [edx+file_in_7z.fullname] |
- | |
3013 | mov ecx, [edx+file_in_7z.namelen] |
- | |
3014 | add ecx, [edx+file_in_7z.name] |
- | |
3015 | sub ecx, edi |
- | |
3016 | repz cmpsb |
- | |
3017 | jnz .cont |
- | |
3018 | .incur: |
- | |
3019 | cmp byte [esi], '/' |
- | |
3020 | jnz @f |
- | |
3021 | inc esi |
- | |
3022 | @@: |
- | |
3023 | mov ecx, [esp+12] ; NumItems |
- | |
3024 | mov edx, [esp+16] ; items |
- | |
3025 | cmp ecx, -1 |
- | |
3026 | jz .ok |
- | |
3027 | .check: |
- | |
3028 | sub ecx, 1 |
- | |
3029 | js .cont |
- | |
3030 | push esi |
- | |
3031 | mov edi, [edx] |
- | |
3032 | add edi, 40 |
- | |
3033 | @@: |
- | |
3034 | lodsb |
- | |
3035 | scasb |
- | |
3036 | jnz @f |
- | |
3037 | test al, al |
- | |
3038 | jz .ok2 |
- | |
3039 | jmp @b |
- | |
3040 | @@: |
- | |
3041 | pop esi |
- | |
3042 | cmp al, '/' |
- | |
3043 | jnz @f |
- | |
3044 | cmp byte [edi-1], 0 |
- | |
3045 | jz .ok |
- | |
3046 | @@: |
- | |
3047 | add edx, 4 |
- | |
3048 | jmp .check |
- | |
3049 | .ok2: |
- | |
3050 | pop esi |
- | |
3051 | .ok: |
- | |
3052 | ; add all parents directories if needed |
- | |
3053 | .parloope: |
- | |
3054 | mov ecx, [ebx+file_in_7z.parent] |
- | |
3055 | jecxz .pardone |
- | |
3056 | add ecx, ebp |
- | |
3057 | mov eax, [cur_stamp] |
- | |
3058 | cmp [ecx+file_in_7z.stamp], eax |
- | |
3059 | jz .pardone |
- | |
3060 | .parloopi: |
- | |
3061 | mov edx, ecx |
- | |
3062 | mov ecx, [ecx+file_in_7z.parent] |
- | |
3063 | jecxz @f |
- | |
3064 | add ecx, ebp |
- | |
3065 | cmp [ecx+file_in_7z.stamp], eax |
- | |
3066 | jnz .parloopi |
- | |
3067 | @@: |
- | |
3068 | mov [edx+file_in_7z.stamp], eax |
- | |
3069 | push esi |
- | |
3070 | mov eax, edx |
- | |
3071 | mov edi, tmp_bdfe |
- | |
3072 | push edi |
- | |
3073 | sub esi, [ebx+file_in_7z.fullname] |
- | |
3074 | add esi, [edx+file_in_7z.fullname] |
- | |
3075 | push esi |
- | |
3076 | call getattr_7z |
- | |
3077 | mov eax, [esp+16+20] |
- | |
3078 | call eax |
- | |
3079 | pop esi |
- | |
3080 | test al, al |
- | |
3081 | jz .forced_exit |
- | |
3082 | jmp .parloope |
- | |
3083 | .pardone: |
- | |
3084 | cmp [ebx+file_in_7z.bIsDirectory], 0 |
- | |
3085 | jz .addfile |
- | |
3086 | mov eax, [cur_stamp] |
- | |
3087 | cmp [ebx+file_in_7z.stamp], eax |
- | |
3088 | jz .cont |
- | |
3089 | mov [ebx+file_in_7z.stamp], eax |
- | |
3090 | push esi |
- | |
3091 | mov eax, ebx |
- | |
3092 | mov edi, tmp_bdfe |
- | |
3093 | push edi |
- | |
3094 | push esi |
- | |
3095 | call getattr_7z |
- | |
3096 | mov eax, [esp+16+20] |
- | |
3097 | call eax |
- | |
3098 | pop esi |
- | |
3099 | test al, al |
- | |
3100 | jz .forced_exit |
- | |
3101 | jmp .cont |
- | |
3102 | .addfile: |
- | |
3103 | push ebx esi |
- | |
3104 | push 11h |
- | |
3105 | pop edi |
- | |
3106 | mov eax, ebx |
- | |
3107 | call open_file_7z |
- | |
3108 | pop esi ebx |
- | |
3109 | test eax, eax |
- | |
3110 | jz .cont |
- | |
3111 | push eax |
- | |
3112 | push eax |
- | |
3113 | mov edi, tmp_bdfe |
- | |
3114 | push edi |
- | |
3115 | push esi |
- | |
3116 | mov eax, ebx |
- | |
3117 | call getattr_7z |
- | |
3118 | mov eax, [esp+20+16] |
- | |
3119 | call eax |
- | |
3120 | pop ecx |
- | |
3121 | push eax |
- | |
3122 | push ebx |
- | |
3123 | push ecx |
- | |
3124 | call myclose |
- | |
3125 | pop ebx |
- | |
3126 | pop eax |
- | |
3127 | test al, al |
- | |
3128 | jz .forced_exit |
- | |
3129 | .cont: |
- | |
3130 | add ebx, file_in_7z.size |
- | |
3131 | pop ecx |
- | |
3132 | dec ecx |
- | |
3133 | jnz .loop |
- | |
3134 | .ret: |
- | |
3135 | ret 20 |
- | |
3136 | .forced_exit: |
- | |
3137 | pop ecx |
- | |
3138 | jmp .ret |
- |