searchap: allow user to give the path to mount

git-svn-id: svn://kolibrios.org@8400 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-14 01:55:05 +00:00
parent eb01893ff6
commit 6ef7a12f1c
2 changed files with 23 additions and 28 deletions

View File

@ -70,11 +70,6 @@ need to reboot system to try again."
void main() void main()
{ {
if (param) {
SetAdditionalSystemDirectory("kolibrios", #param+1);
ExitProcess();
}
WaitAutosearch(); WaitAutosearch();
CheckKosMounted(); CheckKosMounted();
@ -90,7 +85,7 @@ void main()
EventButton(GetButtonID()); EventButton(GetButtonID());
break; break;
case evKey: case evKey:
GetKeyScancode(); @GetKeyScancode();
if (AL == SCAN_CODE_ENTER) { if (AL == SCAN_CODE_ENTER) {
EventButton(active_button_id); EventButton(active_button_id);
} else if (AL == SCAN_CODE_TAB) { } else if (AL == SCAN_CODE_TAB) {

View File

@ -29,12 +29,8 @@
org 0x0 org 0x0
db 'MENUET01' db 'MENUET01'
dd 0x01 dd 0x01, START, IM_END, I_END, stacktop
dd START params dd PARAMS
dd IM_END
dd I_END
dd stacktop
params dd PARAMS
dd 0x0 dd 0x0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
delay dd 500 delay dd 500
@ -74,8 +70,6 @@ basic_file_path:
db '/sys/settings/' db '/sys/settings/'
basic_file_name: basic_file_name:
db 'kolibrios/res/system/kolibri.lbl',0 db 'kolibrios/res/system/kolibri.lbl',0
additional_dir_name:
db 'kolibrios',0
real_additional_dir: real_additional_dir:
db '/kolibrios',0 db '/kolibrios',0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -88,6 +82,15 @@ include "../../debug-fdo.inc"
START: START:
; process cmdline params ; process cmdline params
mov esi, [params] mov esi, [params]
cmp [esi], byte '/'
jne @f
mov esi, [params] ;user gave us the path so lets mount it
inc esi
mov edi,f30_3_work_area+64
call proc_copy_path
mcall 30,3,f30_3_work_area
mcall -1
@@:
test [esi], byte 0xFF test [esi], byte 0xFF
jz .params_done jz .params_done
cmp word[esi], '-d' ; delay cmp word[esi], '-d' ; delay
@ -136,7 +139,7 @@ exit:
je @f je @f
mov [mount_attempt], 1 ;second mount attempt with delay mov [mount_attempt], 1 ;second mount attempt with delay
DEBUGF 2, "Searchap: second attempt after 5 seconds!\n" DEBUGF 2, "Searchap: second attempt after 5 seconds!\n"
mcall 5,[delay] mcall 5, [delay]
jmp START.params_done jmp START.params_done
@@: @@:
mcall -1 mcall -1
@ -185,7 +188,7 @@ device_detect_f70:
je .continue je .continue
mov [right_folder_block],ebx mov [right_folder_block],ebx
xor ebp,ebp xor ebp,ebp
.start_copy_device_patch: .start_copy_device_path:
imul edi,[retrieved_devices_table_counter],10 imul edi,[retrieved_devices_table_counter],10
add edi,retrieved_devices_table add edi,retrieved_devices_table
mov [edi],byte '/' mov [edi],byte '/'
@ -193,16 +196,16 @@ device_detect_f70:
imul esi,[temp_counter_1],304 imul esi,[temp_counter_1],304
add esi,[read_folder.return] add esi,[read_folder.return]
add esi,32+40 add esi,32+40
call proc_copy_patch call proc_copy_path
imul esi,ebp,304 imul esi,ebp,304
add esi,[read_folder_1.return] add esi,[read_folder_1.return]
add esi,32+40 add esi,32+40
mov [edi-1],byte '/' mov [edi-1],byte '/'
call proc_copy_patch call proc_copy_path
inc [retrieved_devices_table_counter] inc [retrieved_devices_table_counter]
inc ebp inc ebp
cmp ebp,[right_folder_block] cmp ebp,[right_folder_block]
jb .start_copy_device_patch jb .start_copy_device_path
.continue: .continue:
inc [temp_counter_1] inc [temp_counter_1]
mov eax,[temp_counter_1] mov eax,[temp_counter_1]
@ -363,14 +366,10 @@ compare_files_and_mount:
; prepare real directory path for mounting ; prepare real directory path for mounting
inc esi inc esi
mov edi,f30_3_work_area+64 mov edi,f30_3_work_area+64
call proc_copy_patch call proc_copy_path
dec edi dec edi
mov esi,real_additional_dir mov esi,real_additional_dir
call proc_copy_patch call proc_copy_path
; prepare fake directory name
mov esi,additional_dir_name
mov edi,f30_3_work_area
call proc_copy_patch
; here is call kernel function to mount the found partition ; here is call kernel function to mount the found partition
; as "/kolibrios" directory to root directory "/" ; as "/kolibrios" directory to root directory "/"
mcall 30,3,f30_3_work_area mcall 30,3,f30_3_work_area
@ -387,7 +386,7 @@ compare_files_and_mount:
copy_folder_name: copy_folder_name:
mov edi,read_folder_name+1 mov edi,read_folder_name+1
.1: .1:
proc_copy_patch: proc_copy_path:
cld cld
@@: @@:
lodsb lodsb
@ -398,7 +397,7 @@ proc_copy_patch:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
copy_folder_name_1: copy_folder_name_1:
mov edi,read_folder_1_name+1 mov edi,read_folder_1_name+1
jmp proc_copy_patch jmp proc_copy_path
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
print_retrieved_devices_table: print_retrieved_devices_table:
mov ecx,[retrieved_devices_table_counter] mov ecx,[retrieved_devices_table_counter]
@ -447,7 +446,8 @@ mount_dir rb 1
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
align 4 align 4
f30_3_work_area: f30_3_work_area:
rb 128 db 'kolibrios',0
rb 118
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
align 4 align 4
retrieved_devices_table: retrieved_devices_table: