Subversion Repositories Kolibri OS

Rev

Rev 3555 | Rev 4265 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3555 Rev 3908
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 3555 $
8
$Revision: 3908 $
Line 9... Line 9...
9
 
9
 
Line 61... Line 61...
61
; edx - flags
61
; edx - flags
62
; ebp - full filename
62
; ebp - full filename
63
; [esp+4] = procedure DoRead, [esp+8] = filesize & [esp+12]... - arguments for it
63
; [esp+4] = procedure DoRead, [esp+8] = filesize & [esp+12]... - arguments for it
Line 64... Line 64...
64
 
64
 
-
 
65
       locals
-
 
66
         cmdline_size  dd ? ; +0 ; cmdline -12
-
 
67
         cmdline_adr   dd ? ; +4 ; cmdline -8
65
       locals
68
         cmdline_flag  dd ? ; +8 ; cmdline -4
66
         cmdline       rd 64    ;256/4
69
         cmdline       rd 64    ;256/4
67
         filename      rd 256   ;1024/4
70
         filename      rd 256   ;1024/4
Line 68... Line 71...
68
         flags     dd ?
71
         flags         dd ?
Line 125... Line 128...
125
        mov     eax, -ERROR_FILE_NOT_FOUND
128
        mov     eax, -ERROR_FILE_NOT_FOUND
Line 126... Line 129...
126
 
129
 
Line 127... Line 130...
127
        jmp     .final
130
        jmp     .final
-
 
131
 
-
 
132
.namecopied:
-
 
133
        xor     eax, eax
-
 
134
        mov     [cmdline_flag], eax
Line 128... Line 135...
128
 
135
        mov     [cmdline_adr], eax
129
.namecopied:
136
        mov     [cmdline_size], eax
-
 
137
 
-
 
138
        mov     [cmdline], ebx
-
 
139
        test    ebx, ebx
-
 
140
        jz      .no_copy
-
 
141
;--------------------------------------
-
 
142
        pushad
-
 
143
        pushfd
-
 
144
        mov     esi, ebx
-
 
145
        mov     ecx, 65536 ; 64 Kb max for ext.cmdline
-
 
146
        cld
-
 
147
@@:
-
 
148
        dec     ecx
-
 
149
        jz      .end_string
-
 
150
 
-
 
151
        lodsb
-
 
152
        test    al, al
-
 
153
        jnz     @b
-
 
154
 
-
 
155
.end_string:
-
 
156
        mov     eax, 65536 ; 64 Kb max for ext.cmdline
130
 
157
        sub     eax, ecx
-
 
158
        mov     [cmdline_size], eax
-
 
159
        cmp     eax, 255
-
 
160
        ja      @f
-
 
161
 
-
 
162
        popfd
-
 
163
        popad
-
 
164
        jmp     .old_copy
-
 
165
 
-
 
166
@@:
-
 
167
        xor     eax, eax
-
 
168
        dec     eax
-
 
169
        mov     [cmdline_flag], eax
-
 
170
        popfd
-
 
171
        popad
-
 
172
; get memory for the extended command line
-
 
173
        stdcall kernel_alloc, [cmdline_size] ;eax
-
 
174
        test    eax, eax
-
 
175
        jz      .old_copy ; get memory failed
-
 
176
 
-
 
177
        mov     [cmdline_adr], eax
-
 
178
 
-
 
179
        pushad
-
 
180
        pushfd
-
 
181
        mov     esi, ebx
-
 
182
        mov     edi, eax
-
 
183
        mov     ecx, [cmdline_size]
-
 
184
        cld
-
 
185
        rep movsb
Line -... Line 186...
-
 
186
        popfd
-
 
187
        popad
-
 
188
        jmp     .no_copy
-
 
189
 
-
 
190
.old_copy:
131
        mov     [cmdline], ebx
191
; clear flag because old method with 256 bytes
132
        test    ebx, ebx
192
        xor     eax, eax
-
 
193
        mov     [cmdline_flag], eax
133
        jz      @F
194
;--------------------------------------
134
 
195
        lea     eax, [cmdline]
135
        lea     eax, [cmdline]
196
        mov     dword [eax+252], 0
136
        mov     dword [eax+252], 0
197
.copy:
Line 137... Line 198...
137
        stdcall strncpy, eax, ebx, 255
198
        stdcall strncpy, eax, ebx, 255
138
@@:
199
.no_copy:
Line 1053... Line 1114...
1053
        jc      @f
1114
        jc      @f
Line 1054... Line 1115...
1054
 
1115
 
1055
        cmp     eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
1116
        cmp     eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
Line 1056... Line -...
1056
        ja      @f
-
 
1057
 
1117
        ja      @f
-
 
1118
 
-
 
1119
        mov     eax, [cmd_line]
-
 
1120
 
-
 
1121
        cmp     [edx], dword 0xffffffff ; extended destination tag
-
 
1122
        jne     .no_ext_dest
-
 
1123
 
-
 
1124
        mov     edx, [edx+4] ; extended destination for cmdline
-
 
1125
        jmp     .continue
-
 
1126
 
-
 
1127
.no_ext_dest:
-
 
1128
        mov     [eax-12], dword 255
-
 
1129
.continue:
1058
        mov     byte [edx], 0  ;force empty string if no cmdline given
1130
        mov     byte [edx], 0  ;force empty string if no cmdline given
1059
        mov     eax, [cmd_line]
1131
 
-
 
1132
        test    eax, eax
-
 
1133
        jz      @f
-
 
1134
;--------------------------------------
-
 
1135
        cmp     [eax-4], dword 0xffffffff ; cmdline_flag
-
 
1136
        jne     .old_copy
-
 
1137
 
-
 
1138
        push    eax
-
 
1139
        stdcall strncpy, edx, [eax-8], [eax-12]
-
 
1140
        pop     eax
-
 
1141
 
-
 
1142
        stdcall kernel_free, [eax-8]
-
 
1143
        jmp     @f
-
 
1144
 
1060
        test    eax, eax
1145
.old_copy:
1061
        jz      @f
1146
;--------------------------------------
1062
        stdcall strncpy, edx, eax, 256
1147
        stdcall strncpy, edx, eax, 256
1063
@@:
1148
@@:
1064
        mov     edx, [params]
1149
        mov     edx, [params]