/kernel/trunk/core/memory.inc |
---|
1103,7 → 1103,7 |
jbe sys_sheduler |
cmp ebx, 11 |
jb undefined_syscall |
cmp ebx, 28 |
cmp ebx, 27 |
ja undefined_syscall |
xor eax, eax |
jmp dword [f68call+ebx*4-11*4] |
1138,8 → 1138,6 |
call srv_handlerEx ;ecx |
mov [esp+SYSCALL_STACK._eax], eax |
ret |
.18: |
mov eax, edx |
.19: |
cmp ecx, OS_BASE |
jae .fail |
1201,24 → 1199,6 |
mov [esp+SYSCALL_STACK._edx], edx |
mov [esp+SYSCALL_STACK._eax], eax |
ret |
.28: |
cmp ecx, OS_BASE |
jae .fail |
push ecx edx |
stdcall kernel_alloc, maxPathLength |
mov edi, eax |
pop eax esi |
push edi |
call getFullPath |
pop ebp |
test eax, eax |
jz @f |
stdcall load_file_umode, ebp |
mov [esp+SYSCALL_STACK._edx], edx |
@@: |
mov [esp+SYSCALL_STACK._eax], eax |
stdcall kernel_free, ebp |
ret |
.fail: |
mov [esp+SYSCALL_STACK._eax], eax |
1234,7 → 1214,7 |
dd f68.fail ; moved to f68.24 |
dd f68.16 ; get_service |
dd f68.17 ; call_service |
dd f68.18 ; loadLibUnicode |
dd f68.fail ; moved to f68.25 |
dd f68.19 ; load_dll |
dd f68.20 ; user_realloc |
dd f68.21 ; load_driver |
1244,8 → 1224,8 |
dd f68.25 ; unmask exception |
dd f68.26 ; user_unmap |
dd f68.27 ; load_file_umode |
dd f68.28 ; loadFileUnicode |
align 4 |
proc load_pe_driver stdcall, file:dword, cmdline:dword |
push esi |
/kernel/trunk/core/syscall.inc |
---|
176,9 → 176,6 |
dd sys_socket ; 75-reserved for new stack |
dd sys_protocols ; 76-reserved for new stack |
dd sys_synchronization ; 77 |
dd undefined_syscall ; 78-free |
dd undefined_syscall ; 79-free |
dd fileSystemUnicode ; 80-File system interface for different encodings |
times 255 - ( ($-servetable2) /4 ) dd undefined_syscall |
dd sys_end ; -1-end application |
/kernel/trunk/fs/fs_lfn.inc |
---|
38,30 → 38,31 |
mov [image_of_ebx], ebx |
ret |
fileSystemUnicode: |
; in: ebx -> f.80 parameter structure |
mov edi, [ebx+20] |
mov esi, [ebx+24] |
jmp @f |
file_system_lfn: |
; in: ebx -> f.70 parameter structure |
xor edi, edi |
lea esi, [ebx+20] |
cmp byte [esi], 0 |
; in: ebx -> parameter structure |
lea ebp, [ebx+20] |
cmp byte [ebp], 0 |
jnz @f |
mov esi, [ebx+21] |
mov ebp, [ebx+21] |
@@: |
cmp word [esi], '/' |
cmp word [ebp], '/' |
jz .rootdir |
cmp byte [ebp], 4 |
jnc @f |
cmp byte [ebp], 0 |
jz @f |
cmp word [ebp+1], '/' |
jnz @f |
cmp edi, 2 |
cmp byte [ebp], 2 |
jnz .rootdir |
cmp dword[esi], '/' |
cmp word [ebp+3], 0 |
jz .rootdir |
@@: |
stdcall kernel_alloc, maxPathLength |
push eax ebx |
xchg eax, edi |
mov esi, ebp |
xor eax, eax |
call getFullPath |
pop ebx ebp |
test eax, eax |
366,11 → 367,9 |
lodsb |
test al, al |
jz .cont |
or al, 20h |
scasb |
jz @b |
or al, 20h |
cmp [edi-1], al |
jz @b |
.cont: |
pop edi esi |
inc edi |
398,7 → 397,6 |
sys_current_directory: ; sysfunction 30 |
mov eax, [current_slot] |
mov edi, [eax+APPDATA.cur_dir] |
xor eax, eax |
dec ebx |
jz .set |
dec ebx |
405,12 → 403,8 |
jz .get |
dec ebx |
jz .mount_additional_directory |
mov eax, edx |
dec ebx |
jz .set |
mov eax, esi |
dec ebx |
jz .get |
jz .get16 |
@@: |
ret |
422,17 → 416,26 |
jnz @b |
mov esi, ecx |
mov edi, sysdir_name1 |
mov ecx, 64 |
mov ecx, 63 |
rep movsb ; copying fake directory name |
mov byte [edi-1], 0 |
inc esi |
xor eax, eax |
stosb ; terminator of name, in case if we get the inlet trash |
mov cl, 63 |
cmp word [esi], 2 |
jz .utf16 |
call cp866toUTF8_string |
@@: |
mov byte [edi], 0 |
mov [full_file_name_table.size], 2 |
ret |
.get: |
; in: ecx -> buffer, edx = length, eax = encoding |
.utf16: |
add esi, 2 |
call UTF16to8_string |
jmp @b |
.get: ; in: ecx -> buffer, edx = length |
mov esi, edi |
inc esi |
mov edi, ecx |
441,11 → 444,6 |
mov edx, maxPathLength |
@@: |
mov ecx, edx |
jecxz .ret |
cmp eax, 2 |
jz .get16 |
cmp eax, 3 |
jz .get8 |
@@: |
dec ecx |
js @f |
455,26 → 453,21 |
test al, al |
jnz @b |
sub edx, ecx |
mov ecx, edx |
@@: |
mov byte [edi-1], 0 |
.ret: |
mov [esp+32], edx |
mov [esp+32], ecx |
ret |
.get8: |
push edi |
mov edi, esi |
xor eax, eax |
repnz scasb |
sub edx, ecx |
mov ecx, edx |
pop edi |
rep movsb |
jmp @b |
.get16: |
shr ecx, 1 |
mov esi, edi |
inc esi |
mov edi, ecx |
cmp edx, maxPathLength |
jc @f |
mov edx, maxPathLength |
@@: |
shr edx, 1 |
mov ecx, edx |
@@: |
dec ecx |
js @f |
483,13 → 476,14 |
test ax, ax |
jnz @b |
sub edx, ecx |
mov ecx, edx |
@@: |
shl edx, 1 |
mov word [edi-2], 0 |
jmp .ret |
mov [esp+32], ecx |
ret |
.set: |
mov esi, ecx |
xor eax, eax |
getFullPath: |
; in: esi -> file path, eax = string encoding, edi -> destination |
; out: UTF-8 string (with marker), eax = length, 0 -> error |
/kernel/trunk/fs/ntfs.inc |
---|
1676,22 → 1676,23 |
mov al, '.' |
push edi ecx |
lea ecx, [esi+1] |
cmp dword[edi-36], 2 |
jz .utf16sp |
rep stosb |
mov byte [edi], 0 |
pop ecx edi |
cmp dword[edi-36], 3 |
test byte [edi-0x24], 1 |
jz @f |
add edi, 264 |
rep stosw |
pop ecx |
xor eax, eax |
stosw |
pop edi |
add edi, 520 |
ret |
.utf16sp: |
rep stosw |
mov word [edi], 0 |
pop ecx edi |
@@: |
add edi, 520 |
rep stosb |
pop ecx |
xor eax, eax |
stosb |
pop edi |
add edi, 264 |
.ret: |
ret |
1700,10 → 1701,9 |
cmp byte [esi+namespace], 2 |
jz .ret |
; do not return system files |
cmp dword[esi+fileRecordReference], 16 |
; ... note that there will be no bad effects if system files also were reported ... |
cmp dword [esi+fileRecordReference], 0x10 |
jb .ret |
cmp byte [esi+fileNameLength], 0 |
jz .ret |
mov eax, [edx] |
inc dword [eax+8] ; new file found |
dec ebx |
1716,42 → 1716,33 |
push ecx esi edi |
movzx ecx, byte [esi+fileNameLength] |
add esi, fileName |
cmp dword[edi-36], 2 |
jz .utf16 |
cmp dword[edi-36], 3 |
jz .utf8 |
test byte [edi-0x24], 1 |
jz .ansi |
shr ecx, 1 |
rep movsd |
adc ecx, ecx |
rep movsw |
and word [edi], 0 |
pop edi |
add edi, 520 |
pop esi ecx |
ret |
.ansi: |
jecxz .skip |
@@: |
lodsw |
call uni2ansi_char |
stosb |
loop @b |
mov byte [edi], 0 |
pop edi esi ecx |
.skip: |
xor al, al |
stosb |
pop edi |
add edi, 264 |
pop esi ecx |
ret |
.utf8: |
push ecx |
mov cx, 519 |
@@: |
lodsw |
call UTF16to8 |
js @f |
dec dword[esp] |
jnz @b |
@@: |
mov byte [edi], 0 |
pop edi |
@@: |
pop edi esi ecx |
add edi, 520 |
ret |
.utf16: |
rep movsw |
mov word [edi], 0 |
jmp @b |
ntfs_direntry_to_bdfe: |
mov [edi+4], eax ; ANSI/UNICODE name |
mov eax, [esi+fileFlags] |
/kernel/trunk/fs/ext.inc |
---|
1900,15 → 1900,13 |
mov esi, [esp+12] |
movzx ecx, [esi+DIRENTRY.nameLength] |
lea esi, [esi+DIRENTRY.name] |
add ecx, esi |
cmp byte [esi], '.' |
jnz @f |
or byte [edx], KOS_HIDDEN |
@@: |
lea edi, [edx+40] |
cmp byte [edx+4], 3 |
jz .utf8 |
add ecx, esi |
cmp byte [edx+4], 2 |
cmp byte [edx+4], 1 |
jz .utf16 |
@@: |
call utf8to16 |
1934,12 → 1932,6 |
push .wanted_start |
jmp .end_block |
.utf8: |
rep movsb |
mov byte [edi], 0 |
add edx, 40+520 |
jmp @b |
.utf16: |
call utf8to16 |
stosw |
/kernel/trunk/fs/fat.inc |
---|
1410,36 → 1410,26 |
push edi esi |
mov edi, esi |
mov esi, ebp |
cmp byte [ebp-4], 2 |
jz .utf16 |
cmp byte [ebp-4], 3 |
jz .utf8 |
@@: |
test byte [ebp-4], 1 |
jz .ansi |
.uni: |
lodsw |
call uni2ansi_char |
stosb |
test al, al |
jnz @b |
stosw |
test eax, eax |
jnz .uni |
pop esi edi |
add esi, 264 |
add esi, 520 |
.ret: |
ret |
.utf8: |
push ecx |
mov ecx, 519 |
call UTF16to8_string |
pop ecx |
jmp @f |
.utf16: |
.ansi: |
lodsw |
stosw |
test eax, eax |
jnz .utf16 |
@@: |
call uni2ansi_char |
stosb |
test al, al |
jnz .ansi |
pop esi edi |
add esi, 520 |
add esi, 264 |
ret |
bdfe_to_fat_entry: |
/kernel/trunk/fs/iso9660.inc |
---|
297,44 → 297,34 |
push edi |
call cd_find_lfn |
jnc .found |
pop edi |
cmp [DevErrorCode], 0 |
jne .noaccess_1 |
or ebx, -1 |
mov eax, ERROR_FILE_NOT_FOUND |
ret |
;-------------------------------------- |
.found: |
mov edi, [cd_current_pointer_of_input] |
test byte [edi+25], 10b ; do not allow read directories |
jnz .found_dir |
pop edi |
;-------------------------------------- |
.noaccess_1: |
or ebx, -1 |
mov eax, ERROR_ACCESS_DENIED |
ret |
.end_buffer: |
pop edx eax |
sub eax, 2048 ; directory is over? |
ja .read_to_buffer |
mov eax, [cd_counter_block] |
mov [edx+8], eax |
mov eax, [ebx] |
sub [edx+4], eax |
xor eax, eax |
dec ecx |
js @f |
mov al, ERROR_END_OF_FILE |
@@: |
pop ecx edi |
mov ebx, [edx+4] |
ret |
;-------------------------------------- |
.found_dir: |
mov eax, [edi+2] ; eax=cluster |
mov [CDSectorAddress], eax |
mov eax, [edi+10] ; directory size |
;-------------------------------------- |
.doit: |
; init header |
push eax ecx |
mov edi, edx |
mov ecx, 32/4 |
344,9 → 334,11 |
mov byte [edx], 1 ; version |
mov [cd_mem_location], edx |
add [cd_mem_location], 32 |
;.mainloop: |
mov [cd_counter_block], dword 0 |
dec dword [CDSectorAddress] |
push ecx |
;-------------------------------------- |
.read_to_buffer: |
inc dword [CDSectorAddress] |
mov [CDDataBuf_pointer], CDDataBuf |
353,106 → 345,142 |
call ReadCDWRetr ; read sector of directory |
cmp [DevErrorCode], 0 |
jne .noaccess_1 |
call .get_names_from_buffer |
sub eax, 2048 |
; directory is over? |
ja .read_to_buffer |
mov edi, [cd_counter_block] |
mov [edx+8], edi |
mov edi, [ebx] |
sub [edx+4], edi |
xor eax, eax |
dec ecx |
js @f |
mov al, ERROR_END_OF_FILE |
;-------------------------------------- |
@@: |
pop ecx edi |
mov ebx, [edx+4] |
ret |
;-------------------------------------- |
.get_names_from_buffer: |
mov [cd_current_pointer_of_input_2], CDDataBuf |
push eax edx |
.get_names_from_buffer: |
push eax esi edi edx |
;-------------------------------------- |
.get_names_from_buffer_1: |
call cd_get_name |
jc .end_buffer |
inc dword [cd_counter_block] |
mov eax, [cd_counter_block] |
cmp [ebx], eax |
jae .get_names_from_buffer |
jae .get_names_from_buffer_1 |
test ecx, ecx |
jz .get_names_from_buffer |
jz .get_names_from_buffer_1 |
mov edi, [cd_counter_block] |
mov [edx+4], edi |
dec ecx |
mov esi, ebp |
call cd_get_parameters_of_file |
mov edi, [cd_mem_location] |
add edi, 40 |
mov ax, '.' |
cmp dword[ebx+4], 2 |
jz .utf16 |
cmp dword[ebx+4], 3 |
jz .utf8 |
test dword [ebx+4], 1; 0=ANSI, 1=UNICODE |
jnz .unicode |
;-------------------------------------- |
.ansi: |
cmp [cd_counter_block], 2 |
jbe .parentDirectory |
@@: |
jbe .ansi_parent_directory |
cld |
lodsw |
xchg ah, al |
call uni2ansi_char |
cld |
stosb |
call .checkForEnd |
jc @b |
@@: |
; check end of file |
mov ax, [esi] |
cmp ax, word 3B00h ; separator end of file ';' |
je .cd_get_parameters_of_file_1 |
; check for files not ending with separator |
movzx eax, byte [ebp-33] |
add eax, ebp |
sub eax, 34 |
cmp esi, eax |
je .cd_get_parameters_of_file_1 |
; check the end of the directory |
movzx eax, byte [ebp-1] |
add eax, ebp |
cmp esi, eax |
jb .ansi |
;-------------------------------------- |
.cd_get_parameters_of_file_1: |
mov [edi], byte 0 |
call cd_get_parameters_of_file |
add [cd_mem_location], 304 |
jmp .get_names_from_buffer |
.parentDirectory: |
stosb |
jmp .get_names_from_buffer_1 |
;-------------------------------------- |
.ansi_parent_directory: |
cmp [cd_counter_block], 2 |
jnz @b |
stosb |
jmp @b |
je @f |
.utf8: |
add [cd_mem_location], 256 |
mov [edi], byte '.' |
inc edi |
jmp .cd_get_parameters_of_file_1 |
;-------------------------------------- |
@@: |
mov [edi], word '..' |
add edi, 2 |
jmp .cd_get_parameters_of_file_1 |
;-------------------------------------- |
.unicode: |
cmp [cd_counter_block], 2 |
jbe .parentDirectory |
push ecx |
mov ecx, 519 |
@@: |
lodsw |
xchg ah, al |
call UTF16to8 |
js @f |
call .checkForEnd |
jc @b |
@@: |
pop ecx |
mov [edi], byte 0 |
add [cd_mem_location], 304 |
jmp .get_names_from_buffer |
jbe .unicode_parent_directory |
.checkForEnd: |
cld |
movsw |
; check end of file |
mov ax, [esi] |
cmp ax, 3B00h ; ';' |
jz @f |
cmp ax, word 3B00h; separator end of file ';' |
je .cd_get_parameters_of_file_2 |
; check for files not ending with separator |
movzx eax, byte [ebp-33] |
add eax, ebp |
sub eax, 34 |
cmp esi, eax |
jz @f |
je .cd_get_parameters_of_file_2 |
; check the end of the directory |
movzx eax, byte [ebp-1] |
add eax, ebp |
cmp esi, eax |
@@: |
ret |
.utf16: |
cmp [cd_counter_block], 2 |
jbe .utf16ParentDirectory |
@@: |
lodsw |
xchg ah, al |
stosw |
call .checkForEnd |
jc @b |
@@: |
jb .unicode |
;-------------------------------------- |
.cd_get_parameters_of_file_2: |
mov [edi], word 0 |
call cd_get_parameters_of_file |
add [cd_mem_location], 560 |
jmp .get_names_from_buffer |
.utf16ParentDirectory: |
stosw |
jmp .get_names_from_buffer_1 |
;-------------------------------------- |
.unicode_parent_directory: |
cmp [cd_counter_block], 2 |
jnz @b |
stosw |
jmp @b |
je @f |
mov [edi], word 2E00h; '.' |
add edi, 2 |
jmp .cd_get_parameters_of_file_2 |
;-------------------------------------- |
@@: |
mov [edi], dword 2E002E00h; '..' |
add edi, 4 |
jmp .cd_get_parameters_of_file_2 |
;-------------------------------------- |
.end_buffer: |
pop edx edi esi eax |
ret |
;----------------------------------------------------------------------------- |
cd_get_parameters_of_file: |
mov edi, [cd_mem_location] |
cd_get_parameters_of_file_1: |
464,7 → 492,9 |
; is a directory? |
test [ebp-8], byte 2 |
jz .file |
inc eax |
;-------------------------------------- |
.file: |
; not as a volume label in the FAT, in this form not available |
; file is not a system |
472,14 → 502,14 |
; file is hidden? (attribute of existence) |
test [ebp-8], byte 1 |
jz .hidden |
inc eax |
;-------------------------------------- |
.hidden: |
shl eax, 1 |
; file is always read-only, as this CD |
inc eax |
mov [edi], eax |
mov eax, [ebx+4] |
mov [edi+4], eax |
; get the time to file |
; hour |
movzx eax, byte [ebp-12] |
511,6 → 541,19 |
mov [edi+20], eax |
; last write date |
mov [edi+28], eax |
; get the data type of name |
xor eax, eax |
test dword [ebx+4], 1; 0=ANSI, 1=UNICODE |
jnz .unicode_1 |
mov [edi+4], eax |
jmp @f |
;-------------------------------------- |
.unicode_1: |
inc eax |
mov [edi+4], eax |
;-------------------------------------- |
@@: |
; get the file size in bytes |
xor eax, eax |
mov [edi+32+4], eax |
/kernel/trunk/docs/sysfuncr.txt |
---|
1695,6 → 1695,7 |
====================================================================== |
================ Функция 30 - работа с текущей папкой. =============== |
====================================================================== |
-------- Подфункция 1 - установить текущую папку для потока. --------- |
Параметры: |
* eax = 30 - номер функции |
1703,7 → 1704,7 |
правила формирования строки указаны в описании функции 70. |
Возвращаемое значение: |
* функция не возвращает значения |
---------------------------------------------------------------------- |
--------- Подфункция 2 - получить текущую папку для потока. ---------- |
Параметры: |
* eax = 30 - номер функции |
1711,21 → 1712,27 |
* ecx = указатель на буфер |
* edx = размер буфера |
Возвращаемое значение: |
* eax = длина строки (включая завершающий 0) |
* eax = длина имени текущей папки (включая завершающий 0) |
Замечания: |
* Если размера буфера недостаточно для копирования всего пути, |
копируются только часть строки и в конце ставится завершающий 0. |
* Если размера буфера недостаточно для копирования всего имени, |
копируются только первые (edx-1) байт и в конце ставится |
завершающий 0. |
* По умолчанию, текущая папка для потока - "/rd/1". |
* При создании процесса/потока текущая папка наследуется от |
родителя. |
---------------------------------------------------------------------- |
---- Подфункция 3 - установить доп. системную директорию для ядра ---- |
Параметры: |
* eax = 30 - номер функции |
* ebx = 3 - номер подфункции |
* ecx = указатель на блок данных: |
для кодировки cp866: |
key rb 64 |
path rb 64 |
для кодировки UTF-16LE: |
key rb 64 |
dw 2 |
path rw 31 |
Пример: |
align 64 |
key db 'kolibrios',0 ; ключ должен быть в нижнем регистре |
1736,29 → 1743,20 |
* функция не возвращает значения |
Замечания: |
* Функция может быть вызвана только 1 раз за 1 сессию работы ОС. |
* При вводе пути символьный ключ не зависит от кодировки. |
---------------------------------------------------------------------- |
--- Подфункция 4 - установить текущую папку с указанием кодировки. --- |
* Кодировка не влияет на символьный ключ. |
----- Подфункция 4 - получить текущую папку в кодировке UTF-16LE ----- |
Параметры: |
* eax = 30 - номер функции |
* ebx = 4 - номер подфункции |
* ecx = указатель на строку с путём к новой текущей папке |
* edx = кодировка строки, подробности указаны в описании функции 80. |
Возвращаемое значение: |
* функция не возвращает значения |
---------------------------------------------------------------------- |
---- Подфункция 5 - получить текущую папку с указанием кодировки. ---- |
Параметры: |
* eax = 30 - номер функции |
* ebx = 5 - номер подфункции |
* ecx = указатель на буфер |
* edx = размер буфера |
* esi = кодировка строки |
Возвращаемое значение: |
* eax = длина строки в байтах (включая завершающий 0) |
* eax = количество символов в строке (включая завершающий 0) |
Замечания: |
* Если размера буфера недостаточно для копирования всего пути, |
копируются только часть строки и в конце ставится завершающий 0. |
* Если размера буфера недостаточно для копирования всего имени, |
копируются только первые (edx-2) байт и в конце ставится |
завершающий 0. |
* По умолчанию, текущая папка для потока - "/rd/1". |
* При создании процесса/потока текущая папка наследуется от |
родителя. |
3382,13 → 3380,13 |
eax - SF_SYS_MISC (68) |
ebx - SSF_CONTROL_DRIVER (17) |
====================================================================== |
== Функция 68, подфункция 18 - загрузить DLL с указанием кодировки. == |
============= Функция 68, подфункция 19 - загрузить DLL. ============= |
====================================================================== |
Параметры: |
* eax = 68 - номер функции |
* ebx = 18 - номер подфункции |
* ecx = указатель на строку с путём к DLL |
* edx = кодировка строки, подробности указаны в описании функции 80. |
* ebx = 19 - номер подфункции |
* ecx = указатель на строку с путём к DLL, |
правила формирования строки указаны в описании функции 70. |
Возвращаемое значение: |
* eax = 0 - неудача |
* иначе eax = указатель на таблицу экспорта DLL |
3397,18 → 3395,6 |
заканчивающийся нулём. Первый dword в структуре является |
указателем на имя функции, второй содержит адрес функции. |
====================================================================== |
============= Функция 68, подфункция 19 - загрузить DLL. ============= |
====================================================================== |
Параметры: |
* eax = 68 - номер функции |
* ebx = 19 - номер подфункции |
* ecx = указатель на строку с путём к DLL, |
правила формирования строки указаны в описании функции 70. |
Возвращаемое значение: |
* eax = 0 - неудача |
* иначе eax = указатель на таблицу экспорта DLL |
---------------------- Константы для регистров: ---------------------- |
eax - SF_SYS_MISC (68) |
ebx - SSF_LOAD_DLL (19) |
3571,7 → 3557,7 |
eax - SF_SYS_MISC (68) |
ebx - SSF_SET_EXCEPTION_STATE (25) |
====================================================================== |
======= Функция 68, подфункция 26 - освободить страницы памяти ======= |
= Функция 68, подфункция 26 - освободить страницы памяти ============ |
====================================================================== |
Параметры: |
* eax = 68 - номер функции |
3587,7 → 3573,7 |
eax - SF_SYS_MISC (68) |
ebx - SSF_MEM_FREE_EXT (26) |
====================================================================== |
============= Функция 68, подфункция 27 - загрузить файл ============= |
= Функция 68, подфункция 27 - загрузить файл =================== |
====================================================================== |
Параметры: |
* eax = 68 - номер функции |
3604,20 → 3590,6 |
eax - SF_SYS_MISC (68) |
ebx - SSF_LOAD_FILE (27) |
====================================================================== |
== Функция 68, подфункция 28 - загрузить файл с указанием кодировки == |
====================================================================== |
Параметры: |
* eax = 68 - номер функции |
* ebx = 28 - номер подфункции |
* ecx = указатель на строку с путём к файлу |
* edx = кодировка строки, подробности указаны в описании функции 80. |
Возвращаемое значение: |
* eax = указатель на загруженный файл или 0 |
* edx = размер загруженного файла или 0 |
Примечания: |
* функция загружает и, при необходимости, распаковывает файл (kunpack) |
====================================================================== |
======================== Функция 69 - отладка. ======================= |
====================================================================== |
Процесс может загрузить другой процесс как отлаживаемый установкой |
3919,9 → 3891,9 |
в других регистрах |
Общий формат информационной структуры: |
* +0: dword: номер подфункции |
* +4: dword: смещение в файле или папке |
* +8: dword: старшая часть смещения или поле флагов |
* +12 = +0xC: dword: размер данных |
* +4: dword: смещение в файле |
* +8: dword: старший dword смещения (должен быть 0) или поле флагов |
* +12 = +0xC: dword: размер |
* +16 = +0x10: dword: указатель на данные |
* +20 = +0x14: ?: текстовая строка - путь к файлу, заканчивается нулём |
или |
3930,7 → 3902,7 |
Чувствительность к регистру букв зависит от файловой системы. |
Если путь начинается не с '/', то он считается относительным. |
Получить или установить текущую папку можно с помощью сисфункции 30. |
'../' в пути означает подъём на одну папку относительно текущей. |
'../' в начале пути означает подъём на одну папку относительно текущей. |
Можно указать кодировку строки, поместив в её начале байт со значениями: |
* 1 = cp866 |
* 2 = UTF-16LE |
3937,7 → 3909,6 |
* 3 = UTF-8 |
иначе будет использоваться кодировка cp866. В абсолютном пути можно |
поместить этот байт после '/' или добавить дополнительный '/' перед ним. |
Также, можно использовать сисфункцию 80. |
Формат абсолютного пути: |
/base/number/dir1/dir2/.../dirn/file, |
где base/number идентифицирует устройство, на котором ищется файл: |
4021,12 → 3992,11 |
* +0: dword: 1 = номер подфункции |
* +4: dword: индекс начального блока (считая с 0) |
* +8: dword: в какой кодировке возвращать имена: |
0 = по умолчанию |
1 = cp866 |
2 = UTF-16LE |
3 = UTF-8 |
0 = cp866 -> байт на символ |
1 = UTF-16LE -> 2 байта на символ |
* +12 = +0xC: dword: сколько блоков читать |
* +16 = +0x10: dword: указатель на буфер, куда будут записаны данные. |
* +16 = +0x10: dword: указатель на буфер, куда будут записаны |
данные, размер буфера должен быть не меньше 32+n(40+256*enc+8) байт |
* +20 = +0x14: путь, правила формирования имён указаны в общем описании |
Возвращаемое значение: |
* eax = 0 - успешно, иначе код ошибки файловой системы |
4059,7 → 4029,9 |
это может быть полезно для автоматического создания |
backup-архивов, ибо при записи бит обычно устанавливается |
(не в Kolibri, правда) |
* +4: dword: кодировка имени, соответствует полю +8 информационной структуры |
* +4: dword: кодировка имени: |
* 0 = cp866 -> байт на символ |
* 1 = UTF-16LE -> 2 байта на символ |
* +8: 4*byte: время создания файла |
* +12 = +0xC: 4*byte: дата создания файла |
* +16 = +0x10: 4*byte: время последнего доступа (чтение или запись) |
4067,7 → 4039,7 |
* +24 = +0x18: 4*byte: время последней модификации |
* +28 = +0x1C: 4*byte: дата последней модификации |
* +32 = +0x20: qword: размер файла в байтах (до 16777216 Тб) |
* +40 = +0x28: имя, размер в cp866 составляет 264 байта, иначе - 520 байт. |
* +40 = +0x28: (256*enc+8)*byte: имя |
Формат времени: |
* +0: byte: секунды |
* +1: byte: минуты |
4080,8 → 4052,9 |
* +2: word: год |
* например, 25.11.1979 записывается как (в hex) 19 0B BB 07 |
Замечания: |
* Если БДВК содержит имя в cp866, то длина БДВК составляет |
304 байта, иначе - 560 байт. |
* Если в БДВК присутствует имя в cp866, то длина БДВК составляет |
304 байта, если в UTF-16LE - 560 байт. Значение длины выравнено |
на целое кратное 16 байт для ускорения обработки в кэш-памяти CPU. |
* Строка имени заканчивается нулём, дальнейшие данные содержат мусор. |
* Если файлы в папке кончились раньше, чем было прочитано |
запрошенное количество, то функция прочитает, сколько сможет, |
4862,31 → 4835,6 |
---------------------- Константы для регистров: ---------------------- |
eax - SF_TERMINATE_PROCESS (-1) |
====================================================================== |
=== Функция 80 - работа с файловой системой с указанием кодировки. === |
====================================================================== |
Параметры: |
* eax = 80 |
* ebx = указатель на информационную структуру |
Возвращаемое значение: |
* eax = 0 - успешно; иначе код ошибки файловой системы |
* в зависимости от подфункции может возвращаться значение и |
в других регистрах |
Общий формат информационной структуры: |
* +0: dword: номер подфункции |
* +4: dword: смещение в файле или папке |
* +8: dword: старшая часть смещения или поле флагов |
* +12 = +0xC: dword: размер данных |
* +16 = +0x10: dword: указатель на данные |
* +20 = +0x14: dword: кодировка строки: |
1 = cp866 |
2 = UTF-16LE |
3 = UTF-8 |
0 = по умолчанию (поддерживает байт кодировки в начале строки) |
* +24 = +0x18: dword: указатель на строку пути (заканчивается нулём) |
В остальном полностью соответствует функции 70. |
====================================================================== |
=========================== Список событий =========================== |
====================================================================== |
Очередное событие можно получить вызовом одной из функций 10 |
/kernel/trunk/docs/sysfuncs.txt |
---|
1677,6 → 1677,7 |
====================================================================== |
============= Function 30 - work with the current folder. ============ |
====================================================================== |
--------- Subfunction 1 - set current folder for the thread. --------- |
Parameters: |
* eax = 30 - function number |
1685,7 → 1686,7 |
rules of path forming can be found in function 70 description. |
Returned value: |
* function does not return value |
---------------------------------------------------------------------- |
--------- Subfunction 2 - get current folder for the thread. --------- |
Parameters: |
* eax = 30 - function number |
1693,21 → 1694,26 |
* ecx = pointer to buffer |
* edx = size of buffer |
Returned value: |
* eax = size of the string (including terminating 0) |
* eax = size of the current folder's name (including terminating 0) |
Remarks: |
* If the buffer is too small to hold all path, only part of the string |
will be copied and terminated with 0. |
* If the buffer is too small to hold all data, only first (edx-1) |
bytes are copied and than terminating 0 is inserted. |
* By default, current folder for the thread is "/rd/1". |
* At process/thread creation the current folder will be inherited |
from the parent. |
---------------------------------------------------------------------- |
--- Subfunction 3 - install the add.system directory for the kernel -- |
Parameters: |
* eax = 30 - function number |
* ebx = 3 - subfunction number |
* ecx = pointer to a block of data: |
for cp866 encoding: |
key rb 64 |
path rb 64 |
for UTF-16LE encoding: |
key rb 64 |
dw 2 |
path rw 31 |
Example: |
align 64 |
key db 'kolibrios',0 ; key must be in lower case |
1718,29 → 1724,19 |
* function does not return value |
Remarks: |
* The function can be called only 1 time for 1 session of the OS. |
* On input the symbolic key is not changing by encoding. |
---------------------------------------------------------------------- |
---- Subfunction 4 - set current folder, specifying the encoding. ---- |
* The key is not affected by encoding. |
------ Subfunction 4 - get current folder in UTF-16LE encoding. ------ |
Parameters: |
* eax = 30 - function number |
* ebx = 4 - subfunction number |
* ecx = pointer to string with the path to new current folder |
* edx = string encoding, details can be found in function 80 description. |
Returned value: |
* function does not return value |
---------------------------------------------------------------------- |
---- Subfunction 5 - get current folder, specifying the encoding. ---- |
Parameters: |
* eax = 30 - function number |
* ebx = 5 - subfunction number |
* ecx = pointer to buffer |
* edx = size of buffer |
* esi = string encoding |
Returned value: |
* eax = size of the string in bytes (including terminating 0) |
* eax = number of chars in the buffer (including terminating 0) |
Remarks: |
* If the buffer is too small to hold all path, only part of the string |
will be copied and terminated with 0. |
* If the buffer is too small to hold all data, only first (edx-2) |
bytes are copied and than terminating 0 is inserted. |
* By default, current folder for the thread is "/rd/1". |
* At process/thread creation the current folder will be inherited |
from the parent. |
3347,13 → 3343,13 |
eax - SF_SYS_MISC (68) |
ebx - SSF_CONTROL_DRIVER (17) |
====================================================================== |
== Function 68, subfunction 18 - load DLL, specifying the encoding. == |
=============== Function 68, subfunction 19 - load DLL. ============== |
====================================================================== |
Parameters: |
* eax = 68 - function number |
* ebx = 18 - subfunction number |
* ecx = pointer to the string with path to DLL |
* edx = string encoding, details can be found in function 80 description. |
* ebx = 19 - subfunction number |
* ecx = pointer to the string with path to DLL, |
rules of path forming can be found in function 70 description. |
Returned value: |
* eax = 0 - failed |
* otherwise eax = pointer to DLL export table |
3362,18 → 3358,6 |
by zero. The first dword in structure points to function name, |
the second dword contains address of function. |
====================================================================== |
=============== Function 68, subfunction 19 - load DLL. ============== |
====================================================================== |
Parameters: |
* eax = 68 - function number |
* ebx = 19 - subfunction number |
* ecx = pointer to the string with path to DLL, |
rules of path forming can be found in function 70 description. |
Returned value: |
* eax = 0 - failed |
* otherwise eax = pointer to DLL export table |
---------------------- Constants for registers: ---------------------- |
eax - SF_SYS_MISC (68) |
ebx - SSF_LOAD_DLL (19) |
3568,20 → 3552,6 |
eax - SF_SYS_MISC (68) |
ebx - SSF_LOAD_FILE (27) |
====================================================================== |
== Function 68, subfunction 28 - load file, specifying the encoding == |
====================================================================== |
Parameters: |
* eax = 68 - function number |
* ebx = 28 - subfunction number |
* ecx = pointer to the string with path to file |
* edx = string encoding, details can be found in function 80 description. |
Returned value: |
* eax = pointer to the loaded file, or zero |
* edx = size of the loaded file, or zero |
Remarks: |
* function loads file and unpacks, if necessary |
====================================================================== |
====================== Function 69 - debugging. ====================== |
====================================================================== |
A process can load other process as debugged by set of corresponding |
3877,9 → 3847,9 |
* some subfunctions return value in other registers too |
General format of the information structure: |
* +0: dword: subfunction number |
* +4: dword: offset in file or folder |
* +8: dword: higher part of offset or flags |
* +12 = +0xC: dword: size of data |
* +4: dword: file offset |
* +8: dword: high dword of offset (must be 0) or flags field |
* +12 = +0xC: dword: size |
* +16 = +0x10: dword: pointer to data |
* +20 = +0x14: ?: path - zero terminated string |
or |
3887,8 → 3857,8 |
* +21 = +0x15: dword: pointer to string |
Case sensitivity depends on filesystem. |
If a path not begins with '/', it is considered a relative. |
To get or set the current folder, use the sysfunction 30. |
'../' in the path means a lift by one folder relatively current folder. |
To get or set the current folder, use the function 30. |
'../' in the beginning means a lift by one folder relatively current folder. |
To set the encoding, put at the start of the string a byte with next values: |
* 1 = cp866 |
* 2 = UTF-16LE |
3895,7 → 3865,6 |
* 3 = UTF-8 |
otherwise will be used cp866. In an absolute path |
you may put this byte after the '/' or put an additional '/' before it. |
Also, you may use the sysfunction 80. |
Format of an absolute path: |
/base/number/dir1/dir2/.../dirn/file, |
where base/number identifies device, on which file is located: |
3976,13 → 3945,12 |
Format of the information structure: |
* +0: dword: 1 = subfunction number |
* +4: dword: index of starting block (beginning from 0) |
* +8: dword: names encoding: |
0 = default |
1 = cp866 |
2 = UTF-16LE |
3 = UTF-8 |
* +8: dword: encoding: |
* 0 = cp866 -> byte per char |
* 1 = UTF-16LE -> word per char |
* +12 = +0xC: dword: number of blocks to read |
* +16 = +0x10: dword: pointer to buffer for data |
* +16 = +0x10: dword: pointer to buffer for data, buffer size |
must be not less than 32+n(40+256*enc+8) bytes |
* +20 = +0x14: path, general rules of names forming |
Returned value: |
* eax = 0 - success, otherwise file system error code |
4014,7 → 3982,9 |
and after archiving this bit is cleared - it can be useful |
for automatically creating of backup-archives as at writing |
this bit is usually set |
* +4: dword: encoding, equals to field +8 in the information structure |
* +4: dword: encoding: |
* 0 = cp866 -> byte per char |
* 1 = UTF-16LE -> word per char |
* +8: 4*byte: time of file creation |
* +12 = +0xC: 4*byte: date of file creation |
* +16 = +0x10: 4*byte: time of last access (read or write) |
4022,7 → 3992,7 |
* +24 = +0x18: 4*byte: time of last modification |
* +28 = +0x1C: 4*byte: date of last modification |
* +32 = +0x20: qword: file size in bytes (up to 16777216 Tb) |
* +40 = +0x28: name, 264 bytes in cp866, otherwise - 520 bytes. |
* +40 = +0x28: (256*enc+8)*byte: name |
Time format: |
* +0: byte: seconds |
* +1: byte: minutes |
4036,7 → 4006,8 |
* for example, 25.11.1979 is written as (in hex) 19 0B BB 07 |
Remarks: |
* If BDFE contains cp866 name, the length of BDFE is 304 bytes, |
otherwise - 560 bytes. |
if UTF-16LE name - 560 bytes. Value of length is aligned |
on 16-byte bound to accelerate processing in CPU cache. |
* Name string is zero terminated, further data contain garbage. |
* If files in folder were ended before requested number was read, |
the function will read as many as it can, and after that return |
5076,30 → 5047,6 |
eax - SF_FUTEX (77) |
ebx - SSF_WAKE (3) |
====================================================================== |
=== Function 80 - file system interface with parameter of encoding === |
====================================================================== |
Parameters: |
* eax = 80 |
* ebx = pointer to the information structure |
Returned value: |
* eax = 0 - success; otherwise file system error code |
* some subfunctions return value in other registers too |
General format of the information structure: |
* +0: dword: subfunction number |
* +4: dword: offset in file or folder |
* +8: dword: higher part of offset or flags |
* +12 = +0xC: dword: size of data |
* +16 = +0x10: dword: pointer to data |
* +20 = +0x14: dword: string encoding: |
1 = cp866 |
2 = UTF-16LE |
3 = UTF-8 |
0 = default (supports encoding byte at the start of the string) |
* +24 = +0x18: dword: pointer to zero terminated string with path |
The rest is similar to sysfunction 70. |
====================================================================== |
=============== Function -1 - terminate thread/process =============== |
====================================================================== |
Parameters: |