Rev 90 | Rev 95 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 90 | Rev 94 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | uglobal |
|
1 | uglobal |
2 | cd_current_pointer_of_input dd 0 |
2 | cd_current_pointer_of_input dd 0 |
3 | cd_current_pointer_of_input_2 dd 0 |
3 | cd_current_pointer_of_input_2 dd 0 |
4 | cd_mem_location dd 0 |
4 | cd_mem_location dd 0 |
5 | cd_counter_block dd 0 |
5 | cd_counter_block dd 0 |
6 | endg |
Line 440... | Line 441... | ||
440 | pop ebp |
441 | pop ebp edi |
441 | pop ebp edi |
442 | xor eax, eax |
442 | xor eax, eax |
443 | ret |
443 | ret |
444 | |
Line -... | Line 445... | ||
- | 445 | ;---------------------------------------------------------------- |
|
- | 446 | ; |
|
- | 447 | ; fs_CdExecute - LFN variant for executing from CD |
|
- | 448 | ; |
|
- | 449 | ; esi points to hd filename (e.g. 'dir1/name') |
|
- | 450 | ; ebp points to full filename (e.g. '/hd0/1/dir1/name') |
|
- | 451 | ; dword [ebx] = flags |
|
- | 452 | ; dword [ebx+4] = cmdline |
|
- | 453 | ; |
|
- | 454 | ; ret ebx,edx destroyed |
|
- | 455 | ; eax > 0 - PID, < 0 - error |
|
- | 456 | ; |
|
- | 457 | ;-------------------------------------------------------------- |
|
- | 458 | fs_CdExecute: |
|
- | 459 | mov edx, [ebx] |
|
- | 460 | mov ebx, [ebx+4] |
|
- | 461 | test ebx, ebx |
|
- | 462 | jz @f |
|
- | 463 | add ebx, std_application_base_address |
|
- | 464 | @@: |
|
- | 465 | ||
- | 466 | ;---------------------------------------------------------------- |
|
- | 467 | ; |
|
- | 468 | ; fs_CdExecute.flags - second entry |
|
- | 469 | ; |
|
- | 470 | ; esi points to floppy filename (kernel address) |
|
- | 471 | ; ebp points to full filename |
|
- | 472 | ; edx flags |
|
- | 473 | ; ebx cmdline (kernel address) |
|
- | 474 | ; |
|
- | 475 | ; ret eax > 0 - PID, < 0 - error |
|
- | 476 | ; |
|
- | 477 | ;-------------------------------------------------------------- |
|
- | 478 | ||
- | 479 | .flags: |
|
- | 480 | cmp byte [esi], 0 |
|
- | 481 | jnz @f |
|
- | 482 | ; cannot execute root! |
|
- | 483 | mov eax, -ERROR_ACCESS_DENIED |
|
- | 484 | ret |
|
- | 485 | @@: |
|
- | 486 | push edi |
|
- | 487 | call cd_find_lfn |
|
- | 488 | jnc .found |
|
- | 489 | pop edi |
|
- | 490 | mov eax, -ERROR_FILE_NOT_FOUND |
|
- | 491 | cmp [DevErrorCode], 0 |
|
- | 492 | jz @f |
|
- | 493 | mov al, -11 |
|
- | 494 | @@: |
|
- | 495 | ret |
|
- | 496 | .found: |
|
- | 497 | mov edi,[cd_current_pointer_of_input] |
|
- | 498 | mov eax,[edi+2] |
|
- | 499 | push 0 |
|
- | 500 | push eax |
|
- | 501 | push dword [edi+10] ; size |
|
- | 502 | push .DoRead |
|
- | 503 | call fs_execute |
|
- | 504 | add esp, 16 |
|
- | 505 | pop edi |
|
- | 506 | ret |
|
- | 507 | ||
- | 508 | .DoRead: |
|
- | 509 | ; read next block |
|
- | 510 | ; in: eax->parameters, edi->buffer |
|
- | 511 | ; out: eax = error code |
|
- | 512 | pushad |
|
- | 513 | cmp dword [eax], 0 ; file size |
|
- | 514 | jz .eof |
|
- | 515 | cmp [eax+8],dword 0 |
|
- | 516 | jne @f |
|
- | 517 | mov ecx,[eax+4] |
|
- | 518 | inc dword [eax+4] |
|
- | 519 | mov [CDSectorAddress],ecx |
|
- | 520 | mov [CDDataBuf_pointer],CDDataBuf ;edi |
|
- | 521 | call ReadCDWRetr |
|
- | 522 | cmp [DevErrorCode], 0 |
|
- | 523 | jnz .err |
|
- | 524 | @@: |
|
- | 525 | push esi edi ecx |
|
- | 526 | mov esi,512 |
|
- | 527 | imul esi,[eax+8] |
|
- | 528 | add esi,CDDataBuf |
|
- | 529 | mov ecx,512/4 |
|
- | 530 | cld |
|
- | 531 | rep movsd |
|
- | 532 | pop ecx edi esi |
|
- | 533 | ||
- | 534 | mov eax, [esp+28] |
|
- | 535 | mov ecx, [eax] |
|
- | 536 | sub ecx, 512 |
|
- | 537 | jae @f |
|
- | 538 | lea edi, [edi+ecx+512] |
|
- | 539 | neg ecx |
|
- | 540 | push eax |
|
- | 541 | xor eax, eax |
|
- | 542 | rep stosb |
|
- | 543 | pop eax |
|
- | 544 | @@: |
|
- | 545 | mov [eax], ecx |
|
- | 546 | mov edx, [eax+8] |
|
- | 547 | inc edx |
|
- | 548 | cmp edx, 4 ; 2048/512=4 |
|
- | 549 | jb @f |
|
- | 550 | xor edx, edx |
|
- | 551 | @@: |
|
- | 552 | mov [eax+8], edx |
|
- | 553 | popad |
|
- | 554 | xor eax, eax |
|
- | 555 | ret |
|
- | 556 | .eof: |
|
- | 557 | popad |
|
- | 558 | mov eax, 6 |
|
- | 559 | ret |
|
- | 560 | .err: |
|
- | 561 | popad |
|
- | 562 | mov eax, 11 |
|
- | 563 | ret |
|
- | 564 | ||
444 | 565 | cd_find_lfn: |
|
445 | cd_find_lfn: |
566 | ; in: esi->name |
446 | ; in: esi->name |
567 | ; out: CF=1 - file not found |
447 | ; out: CF=1 - file not found |
568 | ; else CF=0 and [cd_current_pointer_of_input] direntry |
448 | ; else CF=0 and [cd_current_pointer_of_input] direntry |
569 | push eax esi |
Line 499... | Line 620... | ||
499 | stc |
620 | ret |
500 | ret |
621 | ; èñêîìûé ýëåìåíò öåïî÷êè íàéäåí |
501 | ; èñêîìûé ýëåìåíò öåïî÷êè íàéäåí |
622 | .found: |
502 | .found: |
623 | ; êîíåö ïóòè ôàéëà |
503 | ; êîíåö ïóòè ôàéëà |
624 | cmp byte [esi-1], 0 |
504 | cmp byte [esi], 0 |
625 | jz .done |
505 | jz .done |
626 | mov eax,[cd_current_pointer_of_input] |
506 | mov eax,[cd_current_pointer_of_input] |
627 | add eax,2 |
507 | add eax,2 |
628 | mov eax,[eax] |
508 | mov eax,[eax] |
629 | mov [CDSectorAddress],eax ; íà÷àëî äèðåêòîðèè |
509 | mov [CDSectorAddress],eax ; íà÷àëî äèðåêòîðèè |
630 | add eax,8 |