qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Qemu-devel] Win32 MinGW build with current CVS


From: ZIGLIO, Frediano, VF-IT
Subject: RE: [Qemu-devel] Win32 MinGW build with current CVS
Date: Thu, 3 Aug 2006 10:58:11 +0200

> 
> Sent: Thursday, August 03, 2006 12:14 PM Kazu wrote:
> 
> >
> > Asynchronous I/O is implemented by overlapped I/O for Win32 
> but it is not
> > enabled.
> >
> > I tried to make the program. A patch attached fixs compile errors.
> >
> > I found some problems about it.
> > GetFileSizeEx needs to define WINVER 0x0500. It means that 
> Windows 98/Me
> > host is not supported.
> > If we try to support Win 98/Me host, it is necessary to 
> change configure
> to
> > use --enable-win9x and make another binary, etc.
> >
> > The first attempt to open a hard disk image with a drive 
> letter always
> > failed. After the second time is OK.
> >
> 
> An attached patch fixes the bug which is first time read error.
> 
> Regards,
> Kazu
> 

Well, consider this code, it define a pGetFileSizeEx you can use instead
of GetFileSizeEx

---------- header ----------
extern BOOL (WINAPI *pGetFileSizeEx)(HANDLE hFile, PLARGE_INTEGER
lpFileSize);
---------- header ----------

---------- code ----------
#define STRICT
#include <windows.h>

static BOOL WINAPI
autoGetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize);

typedef BOOL (WINAPI *tGetFileSizeEx)(HANDLE hFile, PLARGE_INTEGER
lpFileSize);

tGetFileSizeEx pGetFileSizeEx = autoGetFileSizeEx;

// replacement that automatically load proper api
static BOOL WINAPI
oldGetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize)
{
        DWORD dwHigh;
        DWORD res = GetFileSize(hFile, &dwHigh);
        if (res != 0xFFFFFFFF || GetLastError() == NO_ERROR) {
                lpFileSize->LowPart = res;
                lpFileSize->HighPart = dwHigh;
                return TRUE;
        }
        return FALSE;
}

// replacement that automatically load proper api
static BOOL WINAPI
autoGetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize)
{
        tGetFileSizeEx proc = (tGetFileSizeEx)
GetProcAddress(GetModuleHandle("kernel32"), "GetFileSizeEx");
        pGetFileSizeEx = proc ? proc : oldGetFileSizeEx;
        return pGetFileSizeEx(hFile, lpFileSize);
}
---------- code ----------

Frediano





reply via email to

[Prev in Thread] Current Thread [Next in Thread]