A few fixes for mingw cross-compilation.

This commit is contained in:
Alexandre Julliard 2002-05-17 03:31:08 +00:00
parent 0aa28b5b8d
commit 6044307c3a
12 changed files with 76 additions and 82 deletions

View File

@ -16,7 +16,7 @@ MAINSPEC = $(MODULE:%.dll=%).spec
SPEC_DEF = $(MAINSPEC).def
ALL_OBJS = $(MAINSPEC).o $(SPEC_SRCS:.spec=.spec.o) $(OBJS) $(MODULE).dbg.o
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
TESTIMPORTS = $(MODULE) $(DELAYIMPORTS) $(IMPORTS)
TESTIMPORTS = $(MODULE:%.dll=%) $(DELAYIMPORTS) $(IMPORTS)
all: $(MODULE)$(DLLEXT)

View File

@ -1815,7 +1815,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
if(lpstrFilter)
{
DWORD len;
_strlwr(lpstrFilter); /* lowercase */
CharLowerA(lpstrFilter); /* lowercase */
len = MultiByteToWideChar( CP_ACP, 0, lpstrFilter, -1, NULL, 0 );
fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpstrFilter, -1,
@ -1856,7 +1856,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
if((int)lpstrFilter != CB_ERR)
{
DWORD len;
_strlwr(lpstrFilter); /* lowercase */
CharLowerA(lpstrFilter); /* lowercase */
len = MultiByteToWideChar( CP_ACP, 0, lpstrFilter, -1, NULL, 0 );
fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpstrFilter, -1,

View File

@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <limits.h>
#include "windef.h"
#include "wine/windef16.h"
#include "wine/debug.h"
@ -107,12 +106,7 @@ void WINAPI FreeAllUserMem(void)
INT16 WINAPI GetFreeFileHandles(void)
{
TRACE("GetFreeFileHandles\n");
#ifndef OPEN_MAX
return _POSIX_OPEN_MAX;
#else
return OPEN_MAX;
#endif
return 256; /* can't have more than 256 16-bit handles */
}
/***********************************************************************

View File

@ -21,7 +21,6 @@
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
#include "winbase.h"
@ -468,29 +467,8 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
*/
DWORD WINAPI WNetGetUserA( LPCSTR lpName, LPSTR lpUserID, LPDWORD lpBufferSize )
{
struct passwd *pwd = getpwuid(getuid());
FIXME( "(%s, %p, %p): mostly stub\n",
debugstr_a(lpName), lpUserID, lpBufferSize );
if (pwd)
{
if ( strlen(pwd->pw_name) + 1 > *lpBufferSize )
{
*lpBufferSize = strlen(pwd->pw_name) + 1;
SetLastError(ERROR_MORE_DATA);
return ERROR_MORE_DATA;
}
strcpy( lpUserID, pwd->pw_name );
*lpBufferSize = strlen(pwd->pw_name) + 1;
return WN_SUCCESS;
}
/* FIXME: wrong return value */
SetLastError(ERROR_NO_NETWORK);
return ERROR_NO_NETWORK;
if (GetUserNameA( lpUserID, lpBufferSize )) return WN_SUCCESS;
return GetLastError();
}
/*****************************************************************

View File

@ -21,7 +21,6 @@
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
#include "winbase.h"

View File

@ -138,7 +138,7 @@ static int error_handler( Display *display, XErrorEvent *error_evt )
*/
static void lock_tsx11(void)
{
RtlEnterCriticalSection( &X11DRV_CritSection );
EnterCriticalSection( &X11DRV_CritSection );
}
/***********************************************************************
@ -146,7 +146,7 @@ static void lock_tsx11(void)
*/
static void unlock_tsx11(void)
{
RtlLeaveCriticalSection( &X11DRV_CritSection );
LeaveCriticalSection( &X11DRV_CritSection );
}
/***********************************************************************
@ -431,7 +431,7 @@ static void process_detach(void)
/* restore TSX11 locking */
wine_tsx11_lock = old_tsx11_lock;
wine_tsx11_unlock = old_tsx11_unlock;
RtlDeleteCriticalSection( &X11DRV_CritSection );
DeleteCriticalSection( &X11DRV_CritSection );
}

View File

@ -1016,45 +1016,24 @@ BOOL WINAPI GetVersionExW(OSVERSIONINFOW*);
/*int WinMain(HINSTANCE, HINSTANCE prev, char *cmd, int show);*/
/* FIXME: need to use defines because we don't have proper imports everywhere yet */
#ifndef have_proper_imports
LONG WINAPI RtlEnterCriticalSection( CRITICAL_SECTION *crit );
LONG WINAPI RtlLeaveCriticalSection( CRITICAL_SECTION *crit );
LONG WINAPI RtlDeleteCriticalSection( CRITICAL_SECTION *crit );
BOOL WINAPI RtlTryEnterCriticalSection( CRITICAL_SECTION *crit );
PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,ULONG);
BOOLEAN WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
PVOID WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,ULONG);
ULONG WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
#define HeapAlloc(heap,flags,size) RtlAllocateHeap(heap,flags,size)
#define HeapFree(heap,flags,ptr) RtlFreeHeap(heap,flags,ptr)
#define HeapReAlloc(heap,flags,ptr,size) RtlReAllocateHeap(heap,flags,ptr,size)
#define HeapSize(heap,flags,ptr) RtlSizeHeap(heap,flags,ptr)
#define EnterCriticalSection(crit) RtlEnterCriticalSection(crit)
#define LeaveCriticalSection(crit) RtlLeaveCriticalSection(crit)
#define DeleteCriticalSection(crit) RtlDeleteCriticalSection(crit)
#define TryEnterCriticalSection(crit) RtlTryEnterCriticalSection(crit)
#else
LPVOID WINAPI HeapAlloc(HANDLE,DWORD,DWORD);
BOOL WINAPI HeapFree(HANDLE,DWORD,LPVOID);
LPVOID WINAPI HeapReAlloc(HANDLE,DWORD,LPVOID,DWORD);
DWORD WINAPI HeapSize(HANDLE,DWORD,LPVOID);
void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
BOOL WINAPI InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION *,DWORD);
void WINAPI DeleteCriticalSection(CRITICAL_SECTION *lpCrit);
void WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit);
BOOL WINAPI TryEnterCriticalSection(CRITICAL_SECTION *lpCrit);
void WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
#endif
void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
BOOL WINAPI InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION *,DWORD);
void WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit);
BOOL WINAPI GetProcessWorkingSetSize(HANDLE,LPDWORD,LPDWORD);
DWORD WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR);
void WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD);
BOOL WINAPI SetProcessWorkingSetSize(HANDLE,DWORD,DWORD);
BOOL WINAPI TerminateProcess(HANDLE,DWORD);
BOOL WINAPI TerminateThread(HANDLE,DWORD);
BOOL WINAPI GetExitCodeThread(HANDLE,LPDWORD);
void WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit);
BOOL WINAPI GetProcessWorkingSetSize(HANDLE,LPDWORD,LPDWORD);
DWORD WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR);
void WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD);
BOOL WINAPI SetProcessWorkingSetSize(HANDLE,DWORD,DWORD);
BOOL WINAPI TerminateProcess(HANDLE,DWORD);
BOOL WINAPI TerminateThread(HANDLE,DWORD);
BOOL WINAPI GetExitCodeThread(HANDLE,LPDWORD);
/* GetBinaryType return values.
*/

View File

@ -135,6 +135,8 @@ size_t getpagesize(void)
{
# ifdef __svr4__
return sysconf(_SC_PAGESIZE);
# elif defined(__i386__)
return 4096;
# else
# error Cannot get the page size on this platform
# endif

View File

@ -37,7 +37,7 @@
/* Win32 process environment database */
typedef struct _ENVDB
{
LPSTR environ; /* 00 Process environment strings */
LPSTR env; /* 00 Process environment strings */
DWORD unknown1; /* 04 Unknown */
LPSTR cmd_line; /* 08 Command line */
LPSTR cur_dir; /* 0c Current directory */
@ -165,7 +165,7 @@ static BOOL build_environment(void)
/* Now allocate the environment */
if (!(p = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
current_envdb.environ = p;
current_envdb.env = p;
env_sel = SELECTOR_AllocBlock( p, 0x10000, WINE_LDT_FLAGS_DATA );
/* And fill it with the Unix environment */
@ -487,7 +487,7 @@ LPWSTR WINAPI GetCommandLineW(void)
*/
LPSTR WINAPI GetEnvironmentStringsA(void)
{
return current_envdb.environ;
return current_envdb.env;
}
@ -500,10 +500,10 @@ LPWSTR WINAPI GetEnvironmentStringsW(void)
LPWSTR ret;
RtlAcquirePebLock();
size = HeapSize( GetProcessHeap(), 0, current_envdb.environ );
size = HeapSize( GetProcessHeap(), 0, current_envdb.env );
if ((ret = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) )) != NULL)
{
LPSTR pA = current_envdb.environ;
LPSTR pA = current_envdb.env;
LPWSTR pW = ret;
while (size--) *pW++ = (WCHAR)(BYTE)*pA++;
}
@ -517,7 +517,7 @@ LPWSTR WINAPI GetEnvironmentStringsW(void)
*/
BOOL WINAPI FreeEnvironmentStringsA( LPSTR ptr )
{
if (ptr != current_envdb.environ)
if (ptr != current_envdb.env)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
@ -549,7 +549,7 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size )
return 0;
}
RtlAcquirePebLock();
if ((p = ENV_FindVariable( current_envdb.environ, name, strlen(name) )))
if ((p = ENV_FindVariable( current_envdb.env, name, strlen(name) )))
{
ret = strlen(p);
if (size <= ret)
@ -597,7 +597,7 @@ BOOL WINAPI SetEnvironmentVariableA( LPCSTR name, LPCSTR value )
BOOL ret = FALSE;
RtlAcquirePebLock();
env = p = current_envdb.environ;
env = p = current_envdb.env;
/* Find a place to insert the string */
@ -634,7 +634,7 @@ BOOL WINAPI SetEnvironmentVariableA( LPCSTR name, LPCSTR value )
strcat( p, "=" );
strcat( p, value );
}
current_envdb.environ = new_env;
current_envdb.env = new_env;
ret = TRUE;
done:
@ -684,8 +684,7 @@ DWORD WINAPI ExpandEnvironmentStringsA( LPCSTR src, LPSTR dst, DWORD count )
if ((p = strchr( src + 1, '%' )))
{
len = p - src - 1; /* Length of the variable name */
if ((var = ENV_FindVariable( current_envdb.environ,
src + 1, len )))
if ((var = ENV_FindVariable( current_envdb.env, src + 1, len )))
{
src += len + 2; /* Skip the variable name */
len = strlen(var);

View File

@ -779,3 +779,45 @@ BOOL16 WINAPI Local32Next16( LOCAL32ENTRY *pLocal32Entry )
return FALSE;
}
/* FIXME: these functions are needed for dlls that aren't properly separated yet */
LPVOID WINAPI HeapAlloc( HANDLE heap, DWORD flags, DWORD size )
{
return RtlAllocateHeap( heap, flags, size );
}
BOOL WINAPI HeapFree( HANDLE heap, DWORD flags, LPVOID ptr )
{
return RtlFreeHeap( heap, flags, ptr );
}
LPVOID WINAPI HeapReAlloc( HANDLE heap, DWORD flags, LPVOID ptr, DWORD size )
{
return RtlReAllocateHeap( heap, flags, ptr, size );
}
DWORD WINAPI HeapSize( HANDLE heap, DWORD flags, LPVOID ptr )
{
return RtlSizeHeap( heap, flags, ptr );
}
void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
{
RtlEnterCriticalSection( crit );
}
BOOL WINAPI TryEnterCriticalSection( CRITICAL_SECTION *crit )
{
return RtlTryEnterCriticalSection( crit );
}
void WINAPI DeleteCriticalSection( CRITICAL_SECTION *crit )
{
RtlDeleteCriticalSection( crit );
}
void WINAPI LeaveCriticalSection( CRITICAL_SECTION *crit )
{
RtlLeaveCriticalSection( crit );
}

View File

@ -25,7 +25,6 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#ifdef HAVE_SYS_SYSCALL_H
# include <sys/syscall.h>
#endif

View File

@ -44,7 +44,9 @@
#include "wine/debug.h"
/* int 13 stuff */
#include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#include <fcntl.h>
#ifdef linux
# include <linux/fd.h>