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

// 声明DLL中的函数原型
typedef const char* (__stdcall *MYFUNCTION)(void);

int main() {
    // 加载DLL
    HINSTANCE hDLL = LoadLibrary("UsbDkHelper.dll");
    if (hDLL == NULL) {
        // 加载DLL失败
        return 1;
    }

    // 获取DLL中的函数指针
    MYFUNCTION myFunction = (MYFUNCTION)GetProcAddress(hDLL, "UsbDk_EnumDevices");
    if (myFunction == NULL) {
        // 获取函数指针失败
        return 1;
    }

    // 调用DLL中的函数
    const char* result = myFunction();

    //  --->093a:2510|0c45:7603|
    printf("--->%s \n", result);

    // 释放DLL
    FreeLibrary(hDLL);

    return 0;
}

更多推荐