On Saturday 23 June 2007 09:06, Victor wrote:
> After upgrading wine (from 0.9.37 to 0.9.38 or from 0.9.38 to 0.9.39 - I'm
> not sure) many graphical applications started crashing if WINEDEBUG+=all or
> WINEDEBUG+=relay not set.
I was able to find where crash occurs, but didn't yet find why this happens.
I've used one of my own ddraw test applications (written for windows) that 
produces same result - crashes if WINEDEBUG+=relay is not set, and works if 
it is set. Source code is at the end of message. (If someone need it, I can 
send a windows executable since it is 3584 bytes big.)
For Wine - 0.9.39:
When initializing DirectDraw by using DirectDrawCreateEx, DDRAW_Create calls 
LoadLibraryA with argument "wined3d". Crash occurs during LoadLibraryA call, 
not in wined3d, but in ntdll/loader.c, in get_modref() function, at 
the "return cached_modref = CONTAINING_RECORD(mod, WINE_MODREF, ldr);" line.
It looks like (somewhere between LoadLibraryA and get_modref()) there is  a 
problem with a "if (TRACE_ON())", but I'm not sure if this so, and where 
should I look for this problem. And I still don't know why it worked before 
and suddenly stopped working.  Any suggestions about location of this bug?

With best regards, Victor Eremin.

--Test application source code (C++)--
#include <windows.h>
#include <ddraw.h>
#include <GFSrel.h>
//#include <_smallapp.h>

#define WNDCLASSNAME TEXT("DDrawDraft")
#define WNDCAPTION TEXT("DDraw draft application")
#define HRC(hr, msg) if (FAILED(hr)){MessageBox(0, TEXT("Error!"), 
TEXT("Error!")/*TEXT(msg)*/, MB_ICONERROR|MB_OK); 
OutputDebugString(TEXT(msg)); return;}

static bool g_bRunning = true;
LPDIRECTDRAW7 g_lpDDraw = 0;
LPDIRECTDRAWSURFACE7 g_lpPrimary = 0;


LRESULT WINAPI WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam){
        switch(Msg){
                case (WM_DESTROY):{
                        g_bRunning = false;
                        PostQuitMessage(0);
                        return 0;
                }
        default:
            return DefWindowProc(hWnd, Msg, wParam, lParam);
        }
}

//int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int){
//void WinMainCRTStartup(void){
void entry_point(void){
        HINSTANCE hInst = GetModuleHandle(0);
    WNDCLASS wc = {
        CS_VREDRAW|CS_HREDRAW,
        WndProc, 0, 0,
        hInst,
        LoadIcon(0, IDI_APPLICATION),
        LoadCursor(0, IDC_ARROW),
        0,//(HBRUSH)GetStockObject(LTGRAY_BRUSH),
        0,
        WNDCLASSNAME
    };

    RegisterClass(&wc);

    HWND hWnd = 
    CreateWindow(
                                WNDCLASSNAME,
                                WNDCAPTION, 
                                WS_POPUP,//OVERLAPPEDWINDOW,
                                CW_USEDEFAULT,
                                CW_USEDEFAULT,
                                CW_USEDEFAULT,
                                CW_USEDEFAULT,
                                0, 0, hInst, 0
                                );
    UpdateWindow(hWnd);
    ShowWindow(hWnd, SW_SHOW);

        HRESULT hr = DirectDrawCreateEx(0, (LPVOID*)&g_lpDDraw, 
IID_IDirectDraw7, 0);
        HRC(hr, "DirectDrawCreateEx");
        hr = g_lpDDraw->SetCooperativeLevel(hWnd, 
DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN);
        HRC(hr, "SetCooperativeLevel");

        hr = g_lpDDraw->SetDisplayMode(640, 480, 8, 0, 0);
        HRC(hr, "SetDisplayMode");

        DDSURFACEDESC2 surf_desc;
        //ZeroMemory((LPVOID*)&surf_desc, sizeof(surf_desc));
        fill_char((void*)&surf_desc, 0, sizeof(surf_desc));
        surf_desc.dwSize = sizeof(surf_desc);
        surf_desc.dwFlags = DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
        surf_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|
DDSCAPS_COMPLEX;
        surf_desc.dwBackBufferCount = 1;
        hr = g_lpDDraw->CreateSurface(&surf_desc, &g_lpPrimary, 0);
        HRC(hr, "CreatePrimary");

        MSG msg;
    while (g_bRunning){
        if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE)){
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else{
            //idle                                                
                }
    }

        if (g_lpDDraw){
                g_lpDDraw->RestoreDisplayMode();
        }
        SREL(g_lpPrimary);
        SREL(g_lpDDraw);
        UnregisterClass(WNDCLASSNAME, hInst);

    //return 0;
}


Reply via email to