alternate ways of setting the string encoding for absolute paths

git-svn-id: svn://kolibrios.org@6758 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2016-11-25 15:11:25 +00:00
parent ae17e1bd38
commit 8eb00f284b
4 changed files with 63 additions and 50 deletions

View File

@ -828,10 +828,16 @@ common_app_entry:
[ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size]
mov esi, [ebp+APP_HDR.path_string]
mov edi, [ebp+APP_HDR.path]
mov ecx, [ebp+APP_HDR.filename_size]
cmp ecx, 1023
jc @f
mov ecx, 1022
@@:
push esi
test edi, edi
jz @f
mov ecx, [ebp+APP_HDR.filename_size]
mov al, '/'
stosb
rep movsb
mov byte [edi], 0
@@:

View File

@ -3900,12 +3900,16 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* +20 = +0x14: byte: 0
* +21 = +0x15: dword: указатель на строку
Чувствительность к регистру букв зависит от файловой системы.
Можно указать кодировку, поместив в начале строки байт со значениями:
Если путь начинается не с '/', то он считается относительным.
Получить или установить текущую папку можно с помощью сисфункции 30.
'../' в начале пути означает подъём на одну папку относительно текущей.
Можно указать кодировку строки, поместив в её начале байт со значениями:
* 1 = cp866
* 2 = UTF-16LE
* 3 = UTF-8
иначе будет использоваться кодировка cp866.
Формат строки:
иначе будет использоваться кодировка cp866. В абсолютном пути можно
поместить этот байт после '/' или добавить дополнительный '/' перед ним.
Формат абсолютного пути:
/base/number/dir1/dir2/.../dirn/file,
где base/number идентифицирует устройство, на котором ищется файл:
* RD/1 = рамдиск
@ -3924,9 +3928,6 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* '/HD0/1/folder/file.txt',0
* '/hd2/2/pics/tanzania.bmp',0
* 2,'/',0,'sys','/',0,'F',0,'I',0,'L',0,'E',0,0,0
Также функция поддерживает относительные имена. Если путь начинается
не с '/', то он считается относительно текущей папки. Получить или
установить текущую папку можно с помощью сисфункции 30.
Доступные подфункции:
* подфункция 0 - чтение файла
@ -4134,7 +4135,6 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* +0: dword: 4 = номер подфункции
* +4: dword: младший dword нового размера файла
* +8: dword: старший dword нового размера файла
(должен быть 0 для FAT)
* +12 = +0xC: dword: 0 (зарезервировано)
* +16 = +0x10: dword: 0 (зарезервировано)
* +20 = +0x14: путь, правила формирования имён указаны в общем описании
@ -4142,10 +4142,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* eax = 0 - успешно, иначе код ошибки файловой системы
* ebx разрушается
Замечания:
* Если новый размер файла меньше старого, файл усекается. Если
новый размер больше старого, файл расширяется нулевыми символами.
Если новый размер равен старому, единственным результатом вызова
является установка даты/времени модификации и доступа в текущие.
* Если новый размер файла меньше старого, файл усекается.
Если новый размер больше старого, файл расширяется, и если
разница в размере не больше 16 МБ, новое место очищается нулями.
* Если свободного места на диске недостаточно для расширения файла,
то функция расширит насколько возможно, после чего вернёт
код ошибки 8.
@ -4599,7 +4598,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* esi = длина структуры sockaddr
Формат структуры SockAddr:
* +0: Word: Family
* +2: 14*Byte: Data
* +2: 14*Byte: Data
Возвращаемое значение:
* eax = -1 для ошибки
* ebx = код ошибки
@ -4618,7 +4617,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* esi = длина структуры sockaddr
Формат структуры SockAddr:
* +0: Word: Family
* +2: 14*Byte: Data
* +2: 14*Byte: Data
Возвращаемое значение:
* eax = номер сокета из принятого сокета, -1 для ошибки
* ebx = код ошибки

View File

@ -3670,6 +3670,7 @@ Parameters:
* ebx = 2 - subfunction number
* ecx = thread identifier
* edx = size of context structure, must be 0x28=40 bytes
* esi -> context structure
Returned value:
* function does not return value
Format of context structure is shown in the description of
@ -3855,12 +3856,16 @@ General format of the information structure:
* +20 = +0x14: byte: 0
* +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 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
* 3 = UTF-8
otherwise will be used cp866.
Format of filename:
otherwise will be used cp866. In an absolute path
you may put this byte after the '/' or put an additional '/' before it.
Format of an absolute path:
/base/number/dir1/dir2/.../dirn/file,
where base/number identifies device, on which file is located:
* RD/1 = ramdisk
@ -3879,9 +3884,6 @@ Examples:
* '/HD0/1/folder/file.txt',0
* '/hd2/2/pics/tanzania.bmp',0
* 2,'/',0,'sys','/',0,'F',0,'I',0,'L',0,'E',0,0,0
Also function supports relative names. If the path begins not
with '/', it is considered relative to a current folder. To get or
set a current folder, use the function 30.
Available subfunctions:
* subfunction 0 - read file
@ -4094,11 +4096,9 @@ Returned value:
* eax = 0 - success, otherwise file system error code
* ebx destroyed
Remarks:
* If the new file size is less than old one, file is truncated.
If the new size is greater than old one, file is expanded with
characters with code 0. If the new size is equal to old one,
the only result of call is set date/time of modification and
access to the current date/time.
* If new file size is less than old one, file will be truncated.
If new size is greater than old one, file will be expanded, and if
size difference is up to 16 MB, new space will be cleared with 0.
* If there is not enough free space on disk for expansion, the
function will expand to maximum possible size and then return
error code 8.
@ -4549,7 +4549,7 @@ Parameters:
* esi = length of sockaddr structure
Format of SockAddr structure:
* +0: Word: Family
* +2: 14*Byte: Data
* +2: 14*Byte: Data
Returned value:
* eax = -1 on error
* ebx = errorcode
@ -4568,7 +4568,7 @@ Parameters:
* esi = length of sockaddr structure
Format of SockAddr structure:
* +0: Word: Family
* +2: 14*Byte: Data
* +2: 14*Byte: Data
Returned value:
* eax = socket number of accepted socket, -1 on error
* ebx = errorcode
@ -4687,7 +4687,7 @@ Parameters:
Returned value:
* eax = -1 on error, otherwise lower bits of MAC
* bx = upper bits of MAC
======================================================================
= Function 76, Protocol 1 - IPv4, Subfunction 0, Read # Packets sent =
======================================================================
@ -4698,7 +4698,7 @@ Parameters:
* bl = 0 (Read # packets sent)
Returned value:
* eax = number of packets sent (-1 on error)
======================================================================
= Function 76, Protocol 1 - IPv4, Subfunction 1, Read # Packets rcvd =
======================================================================
@ -4709,7 +4709,7 @@ Parameters:
* bl = 1 (Read # packets received)
Returned value:
* eax = number of packets received (-1 on error)
======================================================================
=== Function 76, Protocol 1 - IPv4, Subfunction 2, Read IP address ===
======================================================================
@ -4720,7 +4720,7 @@ Parameters:
* bl = 2 (Read IP address)
Returned value:
* eax = IP address (-1 on error)
======================================================================
=== Function 76, Protocol 1 - IPv4, Subfunction 3, Set IP address ====
======================================================================
@ -4743,7 +4743,7 @@ Parameters:
* bl = 4 (Read DNS server IP address)
Returned value:
* eax = DNS server IP address (-1 on error)
======================================================================
=== Function 76, Protocol 1 - IPv4, Subfunction 5, Set DNS address ===
======================================================================
@ -4766,7 +4766,7 @@ Parameters:
* bl = 6 (Read subnet mask)
Returned value:
* eax = subnet mask (-1 on error)
======================================================================
=== Function 76, Protocol 1 - IPv4, Subfunction 7, Set subnet mask ===
======================================================================
@ -4778,7 +4778,7 @@ Parameters:
* ecx = subnet mask
Returned value:
* eax = -1 on error
======================================================================
===== Function 76, Protocol 1 - IPv4, Subfunction 8, Read gateway ====
======================================================================
@ -4789,7 +4789,7 @@ Parameters:
* bl = 8 (Read gateway IP address)
Returned value:
* eax = gateway IP address (-1 on error)
======================================================================
===== Function 76, Protocol 1 - IPv4, Subfunction 9, Set gateway =====
======================================================================
@ -4801,7 +4801,7 @@ Parameters:
* ecx = gateway IP address
Returned value:
* eax = -1 on error
======================================================================
= Function 76, Protocol 2 - ICMP, Subfunction 0, Read # Packets sent =
======================================================================
@ -4812,7 +4812,7 @@ Parameters:
* bl = 0 (Read # packets sent)
Returned value:
* eax = number of packets sent (-1 on error)
======================================================================
= Function 76, Protocol 2 - ICMP, Subfunction 1, Read # Packets rcvd =
======================================================================
@ -4823,7 +4823,7 @@ Parameters:
* bl = 1 (Read # packets received)
Returned value:
* eax = number of packets received (-1 on error)
======================================================================
= Function 76, Protocol 3 - UDP, Subfunction 0, Read # Packets sent ==
======================================================================
@ -4834,7 +4834,7 @@ Parameters:
* bl = 0 (Read # packets sent)
Returned value:
* eax = number of packets sent (-1 on error)
======================================================================
= Function 76, Protocol 3 - UDP, Subfunction 1, Read # Packets rcvd ==
======================================================================
@ -4845,7 +4845,7 @@ Parameters:
* bl = 1 (Read # packets received)
Returned value:
* eax = number of packets received (-1 on error)
======================================================================
= Function 76, Protocol 4 - TCP, Subfunction 0, Read # Packets sent ==
======================================================================
@ -4856,7 +4856,7 @@ Parameters:
* bl = 0 (Read # packets sent)
Returned value:
* eax = number of packets sent (-1 on error)
======================================================================
= Function 76, Protocol 4 - TCP, Subfunction 1, Read # Packets rcvd ==
======================================================================
@ -4867,7 +4867,7 @@ Parameters:
* bl = 1 (Read # packets received)
Returned value:
* eax = number of packets received (-1 on error)
======================================================================
= Function 76, Protocol 5 - ARP, Subfunction 0, Read # Packets sent ==
======================================================================
@ -4878,7 +4878,7 @@ Parameters:
* bl = 0 (Read # packets sent)
Returned value:
* eax = number of packets sent (-1 on error)
======================================================================
= Function 76, Protocol 5 - ARP, Subfunction 1, Read # Packets rcvd ==
======================================================================
@ -4889,7 +4889,7 @@ Parameters:
* bl = 1 (Read # packets received)
Returned value:
* eax = number of packets received (-1 on error)
======================================================================
== Function 76, Protocol 5 - ARP, Subfunction 2, Read # ARP entries ==
======================================================================
@ -4913,14 +4913,14 @@ Parameters:
* edi = ptr to buffer where ARP entry will be written
Returned value:
* eax = -1 on error
Remarks:
Remarks:
ARP_entry struct is defined in ARP.inc in kernel and currently looks like this:
struct ARP_entry
IP dd ?
MAC dp ?
Status dw ?
TTL dw ?
ends
ends
======================================================================
==== Function 76, Protocol 5 - ARP, Subfunction 4, Add ARP entry ====
@ -4933,9 +4933,9 @@ Parameters:
* esi = ptr to buffer holding ARP entry
Returned value:
* eax = -1 on error
Remarks:
Remarks:
See previous function for details on ARP entry.
======================================================================
=== Function 76, Protocol 5 - ARP, Subfunction 5, Remove ARP entry ====
======================================================================
@ -4958,7 +4958,7 @@ Parameters:
* bl = 6 (Send ARP announce)
Returned value:
* eax = -1 on error
======================================================================
=== Function 76, Protocol 5 - ARP, Subfunction 7, Read # conflicts ===
======================================================================

View File

@ -510,10 +510,18 @@ get_full_file_name:
cmp byte [esi], '/'
jnz .set_relative
inc esi
cmp byte [ebx], 2
jnz @f
cmp byte [esi], 4
jnc @f
mov ebx, esi
inc esi
cmp byte [esi], '/'
jnz .start
inc esi
@@:
cmp byte [ebx], 2
jnz .start
inc esi
.start:
call process_replace_file_name
mov edi, [esp+12]
mov ecx, [esp+16]