论坛可能避免为病毒感染,自动添加修改了首字节,运行下面的lisp程序可以自动删除首字节,
压缩包即可正常解开。这个程序就不打包上传了,不然无法解开压缩包。
- ;; 明经通道论坛 2021-12-19 yxp
- ;; 删除一个文件多余的head字节,0D0A
- (vl-load-com)
- (defun c:deletebyte (/ a LSP isUnnec)
- (setq a (getfiled "选择需要删除首字节的文件"
- (if filesPathDefault filesPathDefault "")
- "*"
- 0
- )
- )
- (if a
- (progn
- (setq filesPathDefault a
- LSP (read_Bin a)
- isUnnec (and (= (car LSP) 13) (= (cadr LSP) 10))
- exten (vl-filename-extension a)
- fnanme (vl-string-trim exten a)
- newFilesName (strcat fnanme "_mod" exten)
- )
- (if isUnnec
- (progn
- (write_Bin (cddr LSP) newFilesName)
- (princ "\n文件首字节已删除,保存在 ")
- (princ newFilesName)
- )
- (princ "文件首字节不符合删除要求")
- )
- )
- )
- (princ)
- )
- (defun write_Bin (Blist file / ADO vbin)
- (setq vbin (vlax-make-safearray 17 (cons 0 (1- (length Blist)))))
- (vlax-safearray-fill vbin Blist)
- (vlax-make-variant vbin)
- (setq ADO (vlax-create-object "ADODB.Stream"))
- (vlax-put-property ADO 'type 1)
- (vlax-invoke-method ADO 'open 'nil 'nil 'nil 'nil 'nil)
- (vlax-invoke-method ADO 'Write vbin)
- (vlax-invoke-method ADO 'saveToFile file 2)
- (vlax-invoke-method ADO 'close)
- (vlax-release-object ADO)
- )
- (defun read_Bin (file / vbin ADO)
- (setq ADO (vlax-create-object "ADODB.Stream"))
- (vlax-put-property ADO 'type 1)
- (vlax-invoke-method ADO 'open 'nil 'nil 'nil 'nil 'nil)
- (vlax-invoke-method ADO 'LoadFromFile file)
- (setq vbin (vlax-invoke-method ADO 'read 'nil))
- (vlax-invoke-method ADO 'close)
- (vlax-release-object ADO)
- (vlax-safearray->list (vlax-variant-value vbin))
- )
- (princ "载入成功,命令:deletebyte")
- (princ)
|