hooking into wine (GL video capturing app)

Damjan Jovanovic damjan.jov at gmail.com
Thu Mar 10 07:19:27 CST 2011


On Thu, Mar 10, 2011 at 2:09 PM, Christian Parpart <trapni at gentoo.org> wrote:
> Hey all,
>
> a few years ago I once developed an application for recording the video of
> the 3D games I played via wine (and cedega).
>
> This all worked quite fine these days and I remember that cedega's wine
> engine used other libX11 functions to process events than wine itself did
> or still does.
>
> In my software, I am overriding the specific library functions I want to
> hook in, such as glXSwapBuffers, XNextEvent, XCheckIfEvent, ...
> and then do LD_PRELOAD_LIBRARY this when starting wine.
> Note, only wine used to use XCheckIfEvent but cedega used some other
> function to process events, IIRC.
>
> This all worked fine back in the days I developed it, now I want to
> resurrect this project and found myself in troubles.
> That is, I can successfully hook into OpenGL library functions, but I just
> cannot find a trace on why my XCheckIfEvent is not being used by wine.
>
> A few days back one guy at IRC told me that I have to look at the wine's
> x11drv source code, which I did, but all I can see, is, that wine indeed
> still seems to use XCheckIfEvent().
>
> Checking my running wine app (with my library preloaded) using lsof I can
> see that my library is indeed successfully hooked up into the process
> image at least, and so do my hooks to the OpenGL functions work.
> As a test, I also hooked up into XOpenDisplay from libX11, it worked, but
> still, XCheckIfEvent() does not, and my only clue is, that this piece of
> code of wine isn't actually the one processing the events.
>
> As a side note, I need to hook up into libX11 to capture keyboard input to
> actually start/stop video recording / screenshotting on keyboard events.
>
> Can anyone please help me out here why I cannot grap wine's keyboard events?
>
> In case of interest, the following is the link to the source code in
> question:
>
>    http://redmine.xzero.ws/projects/captury/repository/revisions/master/entry/src/libGLcaptury/libX11.cpp
>
>
> Best regards,
> Christian Parpart.
>
>
>
>

Hooking XCheckIfEvent works for me:

#include <stdio.h>
#include <stdlib.h>

void XCheckIfEvent(void)
{
	printf("XCheckIfEvent called\n");
	exit(0);
}

$ gcc -fPIC -c chk.c
$ gcc chk.o -shared -o libchk.so
$ LD_PRELOAD=./libchk.so wine notepad
ERROR: ld.so: object './libxchk.so' from LD_PRELOAD cannot be
preloaded: ignored.
ERROR: ld.so: object './libxchk.so' from LD_PRELOAD cannot be
preloaded: ignored.
ERROR: ld.so: object './libxchk.so' from LD_PRELOAD cannot be
preloaded: ignored.
ERROR: ld.so: object './libxchk.so' from LD_PRELOAD cannot be
preloaded: ignored.
ERROR: ld.so: object './libxchk.so' from LD_PRELOAD cannot be
preloaded: ignored.
XCheckIfEvent called
(exits)



More information about the wine-devel mailing list