I have a Windows executable that load a library and I want to create a Winelib DLL that will overide the Windows DLL. It's been 2 days that I search and try but it won't work ! Please help me !
Basically I create mydll.c and mydll.spec to build the Winelib DLL with the command:
winegcc -m32 -shared -o mydll.dll mydll.c mydll.spec
Now I have mydll.dll.so and I want to override mydll.dll (both are at the same place) What should I do ? I try to rename mydll.dll but I got a Page Fault when the function is called ! I also tried to configure the override with winecfg or set environment variables like WINEDLLPATH. I don't understand how to proceed.
How I load the library in my Windows executable
HINSTANCE DllHandle;
char str[255];
typedef int(__stdcall * tfp)(char * const);
DllHandle = LoadLibrary("mydll.dll");
tfp fp = (tfp)GetProcAddress(DllHandle, "myfunc");
fp(str);
FreeLibrary(DllHandle);
mydll.spec
@ stdcall myfunc(str)
mydll.c
#include <windef.h>
int WINAPI myfunc(char * str)
{
strcpy(str, "myfunc from the Winelib DLL");
return 0;
}