sysfunction 70.5: get device size

git-svn-id: svn://kolibrios.org@6875 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2017-03-06 13:45:37 +00:00
parent 820687bfc3
commit b27bd68162
4 changed files with 41 additions and 22 deletions

View File

@ -1379,18 +1379,12 @@ dyndisk_handler:
cmp byte [esi], 0 cmp byte [esi], 0
jnz .haspartition jnz .haspartition
; 11. The fs operation wants to enumerate partitions. ; 11. The fs operation wants to enumerate partitions.
; 11a. Only "list directory" operation is applicable to /<diskname> path. Check ; Check whether the media is inserted.
; the operation code. If wrong, go to 13.
cmp dword [ebx], 1
jnz .access_denied
; 11b. If the media is inserted, use 'fs_dyndisk_next' as an enumeration
; procedure. Otherwise, use 'fs_dyndisk_next_nomedia'.
mov esi, fs_dyndisk_next_nomedia mov esi, fs_dyndisk_next_nomedia
test edx, edx test edx, edx
jz @f jz @f
mov esi, fs_dyndisk_next mov esi, fs_dyndisk_next
@@: @@: ; Let the procedure from fs_lfn.inc do the job.
; 11c. Let the procedure from fs_lfn.inc do the job.
jmp file_system_lfn.maindir_noesi jmp file_system_lfn.maindir_noesi
.root: .root:

View File

@ -4231,7 +4231,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
но без имени файла, за исключением корневого каталога. но без имени файла, за исключением корневого каталога.
Замечания: Замечания:
* Для корневого каталога возвращается размер и имя раздела. * Для корневого каталога возвращается размер и имя раздела.
* Функция не поддерживает виртуальные папки типа / и /rd. * Для устройства возвращается только размер.
---------------------- Константы для регистров: ---------------------- ---------------------- Константы для регистров: ----------------------
eax - SF_FILE (70) eax - SF_FILE (70)

View File

@ -4186,8 +4186,8 @@ Information on file is returned in the BDFE format (block of data
for folder entry), explained in the description of subfunction 1, for folder entry), explained in the description of subfunction 1,
but without filename, except the root folder. but without filename, except the root folder.
Remarks: Remarks:
* For the root folder returns size and name of partition. * For the root folder returns the size and the volume label.
* The function does not support virtual folders such as / and /rd. * For the device returns only the size.
---------------------- Constants for registers: ---------------------- ---------------------- Constants for registers: ----------------------
eax - SF_FILE (70) eax - SF_FILE (70)

View File

@ -148,28 +148,32 @@ file_system_lfn:
.nextCD: .nextCD:
test eax, eax ; partition number test eax, eax ; partition number
stc jnz @f
jnz @f ; no more partitions inc eax ; /cdX/1
mov al, 1 ; /cdX/1 ret
clc
@@: @@:
stc
ret ret
.maindir: ; list partitions .maindir: ; list partitions
mov esi, .nextCD mov esi, .nextCD
xor ecx, ecx
.maindir_noesi: ; backjump from dyndisk_handler .maindir_noesi: ; backjump from dyndisk_handler
push ebp push ebp
mov ebp, ecx mov ebp, ecx
call kernel_free call kernel_free
cmp dword[ebx], 1 mov edi, [ebx+16] ; buffer
jnz .access_denied ; read folder? cmp byte [ebx], 5
jz .deviceInfo
cmp byte [ebx], 1 ; read folder?
jnz .access_denied
push ebp push ebp
pushd [ebx+4] ; first block pushd [ebx+4] ; first block
mov ebp, [ebx+12] ; the number of blocks to read mov ebp, [ebx+12] ; the number of blocks to read
mov edx, [ebx+16] ; buffer
mov ebx, [ebx+8] ; flags mov ebx, [ebx+8] ; flags
mov ecx, 32/4 mov ecx, 32/4
mov edi, edx mov edx, edi
xor eax, eax xor eax, eax
rep stosd rep stosd
mov byte [edx], 1 ; version mov byte [edx], 1 ; version
@ -200,7 +204,7 @@ file_system_lfn:
push edx push edx
test eax, eax test eax, eax
jnz @b jnz @b
cmp ebx, 1 cmp ebx, 2
jz .uni jz .uni
@@: @@:
pop eax pop eax
@ -209,6 +213,8 @@ file_system_lfn:
test eax, eax test eax, eax
jnz @b jnz @b
pop edi edx eax pop edi edx eax
cmp ebx, 3
jz @f
add edi, 264 add edi, 264
jmp .maindir_loop jmp .maindir_loop
@ -219,6 +225,7 @@ file_system_lfn:
test eax, eax test eax, eax
jnz .uni jnz .uni
pop edi edx eax pop edi edx eax
@@:
add edi, 520 add edi, 520
jmp .maindir_loop jmp .maindir_loop
@ -238,8 +245,23 @@ file_system_lfn:
mov dword[image_of_eax], ERROR_ACCESS_DENIED mov dword[image_of_eax], ERROR_ACCESS_DENIED
ret ret
.deviceInfo:
test ebp, ebp
jz @f
mov eax, dword[ebp+DISK.MediaInfo.Capacity]
mov edx, dword[ebp+DISK.MediaInfo.Capacity+4]
shld edx, eax, 9
shl eax, 9
mov [edi+36], edx
mov [edi+32], eax
@@:
and dword[image_of_eax], 0
ret
.rootdir: ; / - virtual root folder .rootdir: ; / - virtual root folder
cmp dword[ebx], 1 ; read folder? cmp byte [ebx], 5
jz @b
cmp byte [ebx], 1 ; read folder?
jnz .access_denied jnz .access_denied
mov ebp, [ebx+12] ; number of blocks mov ebp, [ebx+12] ; number of blocks
mov edx, [ebx+16] ; return area mov edx, [ebx+16] ; return area
@ -273,7 +295,7 @@ file_system_lfn:
rep stosd rep stosd
push edi push edi
lea esi, [esp+8] lea esi, [esp+8]
cmp ebx, 1 cmp ebx, 2
jz .uni2 jz .uni2
@@: @@:
lodsb lodsb
@ -281,6 +303,8 @@ file_system_lfn:
test eax, eax test eax, eax
jnz @b jnz @b
pop edi eax pop edi eax
cmp ebx, 3
jz @f
add edi, 264 add edi, 264
jmp .rootdir_loop jmp .rootdir_loop
@ -290,6 +314,7 @@ file_system_lfn:
test eax, eax test eax, eax
jnz .uni2 jnz .uni2
pop edi eax pop edi eax
@@:
add edi, 520 add edi, 520
jmp .rootdir_loop jmp .rootdir_loop