Writing a DLL For Use With rundll32.exe

2019-09-11 11:13发布

I have the following codes:

mydll.h:

#include <Windows.h>

__declspec(dllexport) void CALLBACK Entry(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);

mydll.c:

#include "mydll.h"

void CALLBACK Entry(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) {
    FILE *f;
    f = fopen("C:\\Users\\user\\Desktop\\test.txt", "rw");
    fprintf(f, "test");
    fclose(f);
}

It compiles to mydll.dll.

Then, when I try to do

rundll32.exe mydll.dll,Entry

It gives me the error message

Error in mydll.dll
Missing entry: Entry

What am I missing here?

0条回答
登录 后发表回答