Trouble compiling ReactOS after importing qcap.dll from Wine

All development related issues welcome

Moderator: Moderator Team

Post Reply
User avatar
Oleg Dubinskij
Posts: 42
Joined: Mon Aug 07, 2017 6:34 pm

Trouble compiling ReactOS after importing qcap.dll from Wine

Post by Oleg Dubinskij »

Hi everybody. ;)
I'm currently trying to fix CORE-16350.
The bug described there is the Windows Media Encoder 9 from Rapps fails to install due to missing qcap.dll.
I'm importing this dll from Wine (Staging) 4.14. There are no any Staging patches for qcap, as I see, so it's completely identical in both Wine versions.
I had a lot of compilation errors after importing it. For now, I was able to fix most of them, but I still have one error during compilation:

Code: Select all

In file included from ../dll/directx/wine/qcap/precomp.h:26:0:
../dll/directx/wine/qcap/capture.h:26:27: error: unknown type name 'BaseOutputPin'
I extracted the dlls/qcap directory from Wine's sources (excluding tests) in dll/directx/wine of ReactOS sources.
Of course, I enabled imported qcap in dll/directx/wine/CMakeLists.txt and wrote dll/directx/wine/qcap/CMakeLists.txt for this. Also I added precomp.h with needed headers included. Here is a code of it:

Code: Select all

#ifndef _QCAP_PRECOMP_H_
#define _QCAP_PRECOMP_H_

#include <wine/config.h>

#include <assert.h>

#define WIN32_LEAN_AND_MEAN
#define WIN32_NO_STATUS
#define _INC_WINDOWS

#define COBJMACROS

#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "wingdi.h"
#include "winuser.h"
#include "dshow.h"

#include <wine/unicode.h>
#include <wine/debug.h>

#include "capture.h"
#include "qcap_main.h"

#endif /* !_QCAP_PRECOMP_H_ */
Also qcap's CMakeLists.txt code attached:

Code: Select all

add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
spec2def(qcap.dll qcap.spec)

list(APPEND SOURCE
    audiorecord.c
    avico.c
    avimux.c
    capturegraph.c
    enummedia.c
    qcap_main.c
    smartteefilter.c
    v4l.c
    vfwcapture.c
    precomp.h)

add_library(qcap MODULE
    ${SOURCE}
    version.rc
    ${CMAKE_CURRENT_BINARY_DIR}/qcap.def)

set_module_type(qcap win32dll)
target_link_libraries(qcap strmbase strmiids uuid wine)
add_importlibs(qcap ole32 oleaut32 gdi32 advapi32 msvcrt kernel32 ntdll)
add_delay_importlibs(qcap msvfw32)
add_pch(qcap precomp.h SOURCE)
add_cd_file(TARGET qcap DESTINATION reactos/system32 FOR all)
I wrote it with the same values as in Wine's Makefile.in.
Qcap sources itself you can see here: https://source.winehq.org/git/wine.git/ ... /dlls/qcap
I didn't modify them, added as-is.
As I found out, BaseOutputPin is already defined in sdk/include/reactos/wine/strmbase.h:
https://git.reactos.org/?p=reactos.git; ... b=HEAD#l63
which is included in qcap_main.c. The last one I included in my precomp.h, both with capture.h, same as it done in other DirectX dlls (include all headers except private header).
If to include strmbase.h in capture.h, it brokes compilation more again. But without doing it, I have an error described above.
Question is, why it still fails? Probably some needed headers are still missing in my precomp.h? If so, which ones? Or maybe it needs some ReactOS-specific hacks/workarounds? Thanks.
User avatar
binarymaster
Posts: 481
Joined: Sun Nov 16, 2014 7:05 pm
Location: Russia, Moscow
Contact:

Re: Trouble compiling ReactOS after importing qcap.dll from Wine

Post by binarymaster »

Oleg Dubinskij wrote: Sat Aug 31, 2019 9:48 pm Question is, why it still fails? Probably some needed headers are still missing in my precomp.h?
Grepping strmbase.h header in our repo... https://git.reactos.org/?p=reactos.git& ... strmbase.h - the results are showing this header is included in different ways depending on source file type.

In C files it's included with double quotes:

Code: Select all

#include "wine/strmbase.h"
But in precompiled headers it's included with triangle brackets:

Code: Select all

#include <wine/strmbase.h>
This might be the answer to your question, if you confused them somewhere.
User avatar
Oleg Dubinskij
Posts: 42
Joined: Mon Aug 07, 2017 6:34 pm

Re: Trouble compiling ReactOS after importing qcap.dll from Wine

Post by Oleg Dubinskij »

sdk/include/reactos/wine/strmbase.h, which is included in qcap_main.c.
Oops, I meant "qcap_main.h" there. Sorry for the typo.
this header is included in different ways depending on source file type.
I tried to include strmbase.h in my precomp.h, and then in capture.h, with <> in the 1st case and "" in the 2nd, accordingly to other includes from the grep, but after this, nothing has changed. It brokes compilation more anyway. Terminal output is the same as without including strmbase.h at all (even in qcap_main.h, which has it by default). So looks like it isn't a source of problem. I probably need to include/write/change something in capture.h since code in this file causes a failure. Hmm, maybe it's possible to disable include of strmbase.h in qcap_main.h and then enable it otherwhere... Then compilation may succeed... Or I can't change Wine sources in any case?
User avatar
Oleg Dubinskij
Posts: 42
Joined: Mon Aug 07, 2017 6:34 pm

Re: Trouble compiling ReactOS after importing qcap.dll from Wine

Post by Oleg Dubinskij »

disable include of strmbase.h in qcap_main.h and then enable it otherwhere...
Sadly, but it doesn't help too. :( Compilation still fails in the same way as before. So it makes no sense.
I found out that qcap needs dshow.h and vfw.h headers also, since it uses that libs. Including them improved the situation for me, but didn't fix the problem. Also I tried to include ole32/oleaut32 headers, but they caused more conflicts than earlier. Which more headers I can include to fix the compilation?
I thought that the problem may be caused by too new qcap version and too old other components which it needs. For example, our msvfw32 is currently synced to Wine Staging 4.0, and strmbase to older Wine Staging 3.3. May it cause a build conflict with qcap?...
ThFabba
Developer
Posts: 293
Joined: Sun Jul 11, 2010 11:39 am

Re: Trouble compiling ReactOS after importing qcap.dll from Wine

Post by ThFabba »

I might give some more specific advice if and when I find a minute to read through these files and errors in detail, but one thing that should help: get rid of precomp.h and all related diffs. The files as provided by Wine should work. If they don't, then you can start looking at problems relating to different library versions etc.
User avatar
Oleg Dubinskij
Posts: 42
Joined: Mon Aug 07, 2017 6:34 pm

Re: Trouble compiling ReactOS after importing qcap.dll from Wine

Post by Oleg Dubinskij »

Removing precomp.h and all includes of this in CMakeLists.txt doesn't help too. :cry: Wine code as-is fails to compile. So problem indeed may be caused by different and incompatible versions of needed libs. Maybe syncing strmbase with more recent Wine version can help then.
Although I tried qcap from different Wine versions (e. g. 3.7, 3.11, 4.9), but they all fail to compile with the different output.
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests