reversing.kr ImagePrc
今回の問題は以下のようなBitmapの推論問題である。

早速IDA Proによりデバッグしてもると、以下のような流れを確認できる。
まず、CreateCompatibleBitmap関数により、200x150のピクセルを持ったbitmapを生成する。

次に、GetDIBits関数からポインターされているBitmapのBitを検索して、bufferにコピーする。

上記のコードからわかるのは、このプログラムが受けるデータは0x18、つまり、24BitのBitmapとなっていることである。
そして、文字列を検索すると、入力されたデータが間違えてることを示す
演算が存在することを確認できる。

そして、この文字列はLoc_4013CD関数から呼び出されていて、さらにその関数はLoc_4013A3から呼び出されていることが確認できる。

この時、4013A3から、描かれたBitmapデータを比較する。もっと詳しく見るために以下のコードに着目する。

ecx レジスタには描かれたBitmapデータのポインタ(&esi)が入って、LoadResource関数により比較の元となるデータ(eax+ecx)が1byteごとに呼び出され、それを90000byteの大きさまで比較して、間違ってる場合には、Wrongを出力する。

実際に実行して見ると、FFFFFFFのようなBitmapデータが確認できる。
以上の結果からeax+ecxからその90000byteまでデータを出力して、Bitmapを作ると、以下のような答えを得る。
