Build and override a simple Winelib DLL

Questions about Wine on Linux
Locked
Hiryuu
Newbie
Newbie
Posts: 4
Joined: Thu Apr 04, 2013 7:52 am

Build and override a simple Winelib DLL

Post by Hiryuu »

Hi,

I have a Windows executable that load a really simple DLL (it is a test) 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:

Code: Select all

winegcc -m32 -shared -o mydll.dll mydll.c mydll.spec
Now I have mydll.dll.so and I want to override mydll.dll.so
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

Code: Select all

HINSTANCE DllHandle;
char str[255];
typedef int(*tfp)(char * const);
DllHandle = LoadLibrary("mylib.dll");
tfp fp = (tfp)GetProcAddress(DllHandle, "myfunc");
fp(str);
FreeLibrary(DllHandle);
mydll.spec

Code: Select all

@ stdcall myfunc(str)
mydll.c (do nothing, just for test)

Code: Select all

#include <windef.h>

int WINAPI myfunc(char * str)
{
  strcpy(str, "myfunc from the Winelib DLL");
  return 0;
}
Hiryuu
Newbie
Newbie
Posts: 4
Joined: Thu Apr 04, 2013 7:52 am

Re: Build and override a simple Winelib DLL

Post by Hiryuu »

I'm always stuck with this. I tried to create a def file but I don't understand if it is necessery or not.
So now I build like this:

Code: Select all

winegcc -mwindows -lntdll -lkernel32 -o com_fake.dll.so com_fake.c -I${WINE_ROOT}/include -shared com_fake.spec
winebuild -w --def -o libcom_fake.def --export com_fake.spec
cp -f libcom_fake.def /usr/lib/
cp -f com_fake.dll.so /usr/lib/
The library dependencies and def file seem correct...
it always crash though, any idea ?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: Build and override a simple Winelib DLL

Post by dimesio »

You might want to ask this on the developer's mailing list. This is the user's forum, and developers rarely read it.
Locked