0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

アセンブラAdvent Calendar 2019

Day 13

paizaでkernel開発 その2

Posted at

#概要

paizaでkernel開発やってみる。
paizaから、バイナリーを落とす方法を考える。

#閃きのイメージ

1、paizaで、base64エンコードする。
2、コピーして、TXTファイルにする。
3、vbsで、base64デコードしてバイナリーに戻す。

#実験

base64のgifコードをバイナリーにする。

R0lGODlhAQABAGAAACH5BAEKAP8ALAAAAAABAAEAAAgEAP8FBAA7

#サンプルコード

Const adTypeBinary = 1
Const adTypeText = 2
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
Dim st
Dim data
Dim xmldom
Dim node
Dim inFile
Dim outFile
Dim cd
Dim sh
Dim str
Set sh = CreateObject("WScript.Shell")
cd = sh.CurrentDirectory
inFile = cd & "\gif.txt"
outFile = cd & "\a.gif"
Set xmldom = CreateObject("Microsoft.XMLDOM")
Set node = xmldom.CreateElement("work")
node.DataType = "bin.base64"
Set st = CreateObject("ADODB.Stream")
st.Charset = "ascii"
st.Open
st.LoadFromFile(inFile)
str = st.ReadText
msgbox str
node.Text = str
st.Close
bin = node.NodeTypedValue
st.Open
st.Type = adTypeBinary
st.Write bin
st.saveToFile outFile, adSaveCreateOverWrite
st.Close
Set st = Nothing
Set node = Nothing
Set xmldom = Nothing
msgbox "ok"


以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?