yxp 发表于 2021-12-19 19:36:08

论坛压缩包不能打开的修复程序

论坛可能避免为病毒感染,自动添加修改了首字节,运行下面的lisp程序可以自动删除首字节,
压缩包即可正常解开。这个程序就不打包上传了,不然无法解开压缩包。

;; 明经通道论坛 2021-12-19yxp
;; 删除一个文件多余的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)

baitang36 发表于 2021-12-19 19:50:54

很不错的lsp程序

紫苏炒黄瓜 发表于 2021-12-19 20:23:45

666不错的lsp

白色微風1991 发表于 2021-12-20 07:35:24

很不錯的lsp程序

lxl217114 发表于 2021-12-20 12:52:56

感谢y版的修复工具

趣意人生 发表于 2021-12-20 22:26:50


很不錯的lsp程序

429014673 发表于 2021-12-21 09:18:50

本帖最后由 429014673 于 2021-12-21 09:57 编辑

chrome浏览器用Internet Download Manager下载,不用搞修复这回事,一点问题都没有

k1nger 发表于 2021-12-21 10:21:02

这个也是一个大神写的,海大神的,也分享给大家!
(vl-Load-COM)
(defun try-file-ReadBinary (FileName / node size str stream xmldom)
      (setq xmldom (vlax-create-object "Microsoft.XMLDOM"))
      (setq node (vlax-invoke-method xmldom 'CreateElement "binary"))
      (vlax-put-Property node 'DataType "bin.hex")
      (setq stream (vlax-create-object "ADODB.Stream"))
      (vlax-put-Property stream 'type 1)
      (Vlax-Invoke stream 'open)
      (vlax-invoke-method
                stream
                'LoadFromFile
                FileName
      )
      (setq size(vlax-get-Property stream 'size))
      (vlax-put-Property node 'NodeTypedValue (Vlax-Invoke-Method stream 'Read size))
      (Vlax-Invoke-Method stream 'close)
      (setq str (vlax-get-Property node 'text))
      (vlax-release-object xmldom)
      str
)
(defun try-file-WriteBinary (file str / node stream xmldom)
      (setq xmldom (vlax-create-object "Microsoft.XMLDOM"))
      (setq node (vlax-invoke-method xmldom 'CreateElement "binary"))
      (vlax-put-Property node 'DataType "bin.hex")
      (vlax-put-Property node 'Text str)
      (setq stream (vlax-create-object "ADODB.Stream"))
      (vlax-put-Property stream 'type 1)
      (Vlax-Invoke stream 'open)
      (vlax-invoke-method stream 'write
                (vlax-get-Property node 'NodeTypedValue)
      )
      (vlax-invoke-method stream 'saveToFile file 2)
      (Vlax-Invoke-Method stream 'close)
      (vlax-release-object xmldom)
      (vlax-release-object stream)
)
(defun c:mjtd (/ file h16 h16-2 newfile)
      (setq file(getfiled "选择一个文件" "" "*" 0))
      (or file (exit))
      (setq
                h16(try-file-ReadBinary file)
                h16-2(substr h16 5)
      )
      (setq newfile (strcat(vl-filename-directory file)"\\"(vl-filename-base file)"_new"(vl-filename-extension file)))
      (try-file-WriteBinary newfile h16-2)
      (princ(strcat"\n处理完成,生成新文件"newfile))(princ)
)

cghdy 发表于 2021-12-21 10:28:57

大神的ssget总结让人受益匪浅

hhuhuwei 发表于 2021-12-21 14:12:24

不错不错,收藏使用了
页: [1]
查看完整版本: 论坛压缩包不能打开的修复程序