Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
lakor64 committed Aug 20, 2024
1 parent c142100 commit a0b4887
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 10 deletions.
4 changes: 2 additions & 2 deletions base/applications/dxdiag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ list(APPEND SOURCE
add_rc_deps(dxdiag.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/dxdiag.ico)
add_executable(dxdiag ${SOURCE} dxdiag.rc)
set_module_type(dxdiag win32gui UNICODE)
target_link_libraries(dxdiag dxguid psdk dxsdk msxml6 comctl32)
target_link_libraries(dxdiag dxguid psdk msxml6 comctl32)
add_importlibs(dxdiag fakewine)
add_dependencies(dxdiag dxsdk)
add_pch(dxdiag precomp.h SOURCE)
add_cd_file(TARGET dxdiag DESTINATION reactos/system32 FOR all)
41 changes: 41 additions & 0 deletions base/applications/dxdiag/information.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@
#include "dxdiag_private.h"
#endif

#define TEST_DXDIAGN_NOT_FROM_COM 1

// Microsoft broken define in latest crt
#ifdef IDxDiagProvider_Initialize
#undef IDxDiagProvider_Initialize
#define IDxDiagProvider_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#endif

#if TEST_DXDIAGN_NOT_FROM_COM
typedef HRESULT(WINAPI* DllGetClassObjectCb)(_In_ REFCLSID rclsid, _In_ REFIID riid, _Out_ LPVOID* ppv);
#endif

#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*(A)))
#define wcsdup _wcsdup
Expand Down Expand Up @@ -259,9 +264,41 @@ struct dxdiag_information *collect_dxdiag_information(BOOL whql_check)
HRESULT hr;
size_t i;

#if TEST_DXDIAGN_NOT_FROM_COM
HMODULE w = NULL;
DllGetClassObjectCb cb = NULL;
IClassFactory* cfact = NULL;
#endif

#if !TEST_DXDIAGN_NOT_FROM_COM
/* Initialize the DxDiag COM instances. */
hr = CoCreateInstance(&CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER,
&IID_IDxDiagProvider, (void **)&pddp);
#else
w = LoadLibraryW(L"dxdiagn_proxy.dll");
if (!w)
{
WINE_ERR("Cannot load dxdiagn.dll\n");
goto error;
}

cb = (DllGetClassObjectCb)GetProcAddress(w, "DllGetClassObject");
if (!cb)
{
WINE_ERR("Cannot load DllGetClassObject from dxdiagn.dll\n");
goto error;
}

hr = cb(&CLSID_DxDiagProvider, &IID_IClassFactory, (void**)&cfact);
if (FAILED(hr))
{
WINE_ERR("IClassFactory instance creation failed with 0x%08lx\n", hr);
goto error;
}

hr = cfact->lpVtbl->CreateInstance(cfact, NULL, &IID_IDxDiagProvider, (void**)&pddp);
#endif

if (FAILED(hr))
{
WINE_ERR("IDxDiagProvider instance creation failed with 0x%08lx\n", hr);
Expand Down Expand Up @@ -304,5 +341,9 @@ struct dxdiag_information *collect_dxdiag_information(BOOL whql_check)
free_dxdiag_information(ret);
if (root) IDxDiagContainer_Release(root);
if (pddp) IDxDiagProvider_Release(pddp);
#if TEST_DXDIAGN_NOT_FROM_COM
if (w) FreeLibrary(w);
#endif

return NULL;
}
3 changes: 2 additions & 1 deletion tests/dxdiag/dxdiag_actioner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_definitions(-D_UNICODE)
add_executable(dxdiag_actioner actioner.cpp)
target_link_libraries(dxdiag_actioner psdk dxsdk dxguid cppstl)
add_dependencies(dxdiag_actioner dxsdk)
target_link_libraries(dxdiag_actioner psdk dxguid cppstl)
set_module_type(dxdiag_actioner win32cui)
set_target_properties(dxdiag_actioner PROPERTIES
WITH_CXX_EXCEPTIONS 1
Expand Down
3 changes: 2 additions & 1 deletion tests/dxdiag/dxdiag_walker/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_definitions(-D_UNICODE)
add_executable(dxdiag_walker walker.cpp)
target_link_libraries(dxdiag_walker psdk dxsdk dxguid cppstl)
add_dependencies(dxdiag_walker dxsdk)
target_link_libraries(dxdiag_walker psdk dxguid cppstl)
set_module_type(dxdiag_walker win32cui)
set_target_properties(dxdiag_walker PROPERTIES
WITH_CXX_EXCEPTIONS 1
Expand Down
4 changes: 2 additions & 2 deletions tests/dxdiag/dxdiagn_proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ add_idl_headers(dxdiagn_proxy_idl proxy.idl)
add_iid_library(dxdiagn_proxy_iid proxy.idl)

set_module_type(dxdiagn_proxy win32dll UNICODE)
add_dependencies(dxdiagn_proxy dxdiagn_proxy_idl)
target_link_libraries(dxdiagn_proxy dxdiagn_proxy_iid cppstl atl_classes dxguid dxsdk psdk)
add_dependencies(dxdiagn_proxy dxdiagn_proxy_idl dxsdk)
target_link_libraries(dxdiagn_proxy dxdiagn_proxy_iid cppstl atl_classes dxguid psdk)
set_target_properties(dxdiagn_proxy PROPERTIES WITH_CXX_EXCEPTIONS TRUE)
8 changes: 4 additions & 4 deletions tests/dxdiag/dxdiagn_proxy/dxdiagn.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@ stdcall DllRegisterServer ()
@ stdcall DllUnregisterServer ()
@ stdcall DllCanUnloadNow ()
@ stdcall DllGetClassObject (ptr ptr ptr)
@ stdcall -private DllRegisterServer ()
@ stdcall -private DllUnregisterServer ()
@ stdcall -private DllCanUnloadNow ()
@ stdcall -private DllGetClassObject (ptr ptr ptr)

0 comments on commit a0b4887

Please sign in to comment.