吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 207|回复: 0
收起左侧

[求助] 16位C/C++代码调用DLL问题

[复制链接]
dawsonliu 发表于 2024-7-28 09:47

各位大神,

论坛里有一个帖子:【新提醒】数据库逆向工程(三) - 『脱壳破解区』 - 吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

英文原文:https://medium.com/@MorteNoir/database-reverse-engineering-part-3-code-reuse-conclusion-b2145420b09b

讲的是如何通过直接调用FNAUTIL2.dll来读取图片压缩数据MCImage.DAT文件的,我尝试了很久,试过在Windows XP下通过Open Watcom C来调用,但都失败了。
有了解这个的大神吗?能给一些指导,我将非常感激!

#include <windows.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>

typedef struct {
    long unk_1;
    long unk_2;
    int unk_3;
    int mcimage;
} ImageFileData;

typedef int (FAR PASCAL *GETCOMPRESSEDIMAGE)( LPINT, LPLONG, LPLONG, LONG, LONG, ImageFileData*);

BOOL decrypt_image(const char* mcimage_path,
              unsigned long enc_image_offset,
              unsigned long enc_image_size)
{
    HANDLE hDrv;
    GETCOMPRESSEDIMAGE GETCOMPRESSEDIMAGE_Addr;

    char message[100];
    HBITMAP bitmap;
    int mcimage;
    long screen_width = 0;
    long screen_height = 0;
    int ret_val = 0;
    ImageFileData data = {0,0,0,0};

    if ((hDrv = LoadLibrary("FAPUTIL.DLL")) < 32) {
        MessageBox(NULL, "ERROR: failed to load GETCOMPRESSEDIMAGE from FAPUTIL.DLL\n", "Error", MB_OK | MB_TASKMODAL);
        return FALSE;
    } else {
        sprintf(message, "%s -> %d", "Works LoadLibrary: ", hDrv);
        MessageBox(NULL, message, "Success", MB_OK | MB_TASKMODAL);
    }

    GETCOMPRESSEDIMAGE_Addr = GetProcAddress(hDrv, "GETCOMPRESSEDIMAGE");

    if (! GETCOMPRESSEDIMAGE_Addr) {
        MessageBox(NULL, "ERROR: failed to GetProcAddress GETCOMPRESSEDIMAGE from FAPUTIL.DLL\n", "Error", MB_OK | MB_TASKMODAL);
        return FALSE;
    } else {
        sprintf(message, "%s -> %d", "Works GETCOMPRESSEDIMAGE_Addr: ", GETCOMPRESSEDIMAGE_Addr);
        MessageBox(NULL, message, "Success", MB_OK | MB_TASKMODAL);
    }

    mcimage = open(mcimage_path, O_RDONLY | O_BINARY);

    sprintf(message, "%s %s %d", mcimage_path, " -> ", mcimage);
    MessageBox(NULL, message, "Success", MB_OK | MB_TASKMODAL);

    data.mcimage = mcimage;

    bitmap = (*(GETCOMPRESSEDIMAGE) GETCOMPRESSEDIMAGE_Addr)(&ret_val, &screen_height, &screen_width, enc_image_size, enc_image_offset, &data);

    sprintf(message, "%s %d", " bitmap -> ", bitmap);
    MessageBox(NULL, message, "Success", MB_OK | MB_TASKMODAL);

    close(mcimage);
    return TRUE;
}

int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
    char* mcimage_path = "C:\\FAP_data\\MCImage.DAT";

    if (!LoadDLL(mcimage_path, 377759538, 21337))
    {
        MessageBox(NULL, "Could not load dll!", "Error", MB_OK | MB_TASKMODAL);
    }

    return (0);
}

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 14:25

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表