SweetLow
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Это настоящий код из дампера блоков памяти, т.е. с доп. проверкой что там лежит реальный путь, иногда встречается мусор. В твоём случае это даже лишнее. Код: if (PWord(Ptr(Owner,$2c)))^=MemSel1 then begin Write('Environment'); i:=0; while (PWord(Ptr(MemSel1,i)))^<>0 do Inc(i); i:=i+4; c:=Upcase(PChar(Ptr(MemSel1,i))^); if (c>='A')and(c<='Z')and ((PWord(Ptr(MemSel1,i+1)))^=$5c3a) or ((PWord(Ptr(MemSel1,i)))^=$5c5c) then Write(' ',PChar(Ptr(MemSel1,i))); end | Locating the Load Path Starting with DOS version 3.0, DOS stores an additional string after the end of the formal environment that can be used to locate the drive and directory from which a program was loaded. A smart application program can use this to help itself find program overlays and data files. This is most significant since DOS 3.0 began allowing an operator to invoke a program by prefixing a pathname before the program filename. Following the final ASCIIZ string of the environment is a byte of 0, indicating the end of the formal environment. The next two bytes are a 16-bit binary count of additional strings (this value is normally 0001H). Following this binary value, you can expect to find an ASCIIZ string of the filespec (including the .COM or .EXE extension) which was used by DOS Fn 4bH (EXEC) to load and execute the program. Even if the program file was not in the default directory and DOS needed to use the command search path (ie, the PATH= string) to locate the program file, the correct full filespec (d:\path\filename.ext,0) will be stored after the end of the environment. P.S. А это борландовский RTL Код: GetParStr: ARG StrP,DWORD,1 ARG Index,WORD,1 ENTRY FAR MOV DX,Index OR DX,DX JE @@1 CALL ParStrCnt JMP SHORT @@4 @@1: MOV AH,dosGetVersion INT DOS CMP AL,3 MOV AX,0 JB @@4 MOV ES,PrefixSeg MOV ES,ES:pspEnvSeg XOR DI,DI CLD @@2: CMP AL,ES:[DI] JE @@3 MOV CX,-1 REPNE SCASB JMP @@2 @@3: ADD DI,3 MOV SI,DI MOV CX,256 REPNE SCASB XCHG AX,CX NOT AL @@4: PUSH DS PUSH ES POP DS LES DI,StrP CLD STOSB XCHG AX,CX REP MOVSB POP DS EXIT 2 | 0 параметр - это с @@1: | Всего записей: 1013 | Зарегистр. 08-03-2005 | Отправлено: 11:37 08-02-2021 | Исправлено: SweetLow, 11:47 08-02-2021 |
|