fix some MSVC compile problems

svn path=/trunk/; revision=19245
This commit is contained in:
Christoph von Wittich 2005-11-15 14:26:06 +00:00
parent a6227b1c67
commit 4aa521a7f6
4 changed files with 20 additions and 14 deletions

View file

@ -30,8 +30,9 @@
unsigned long DbgPrint(char *Format,...);
#ifdef __GNUC__
#define TRACE(...)
#endif
#ifdef DBG
#ifdef __GNUC__
@ -50,7 +51,9 @@ unsigned long DbgPrint(char *Format,...);
#endif
#if !defined(NDEBUG) && defined(DBG)
#ifdef __GNUC__
#define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#endif
#define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
#else
#ifdef __GNUC__

View file

@ -1,3 +1,7 @@
#define CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#if !defined(_MSC_VER)
#include <stdint.h>
#endif

View file

@ -22,15 +22,15 @@ int _cwait(int* pnStatus, int hProc, int nAction)
DWORD ExitCode;
nAction = 0;
if (WaitForSingleObject((void*)hProc, INFINITE) != WAIT_OBJECT_0) {
if (WaitForSingleObject((void*)ULongToPtr(hProc), INFINITE) != WAIT_OBJECT_0) {
__set_errno(ECHILD);
return -1;
}
if (!GetExitCodeProcess((void*)hProc, &ExitCode))
if (!GetExitCodeProcess((void*)ULongToPtr(hProc), &ExitCode))
return -1;
if (pnStatus != NULL)
*pnStatus = (int)ExitCode;
CloseHandle((HANDLE)hProc);
CloseHandle((HANDLE)ULongToPtr(hProc));
return hProc;
}

View file

@ -11,31 +11,30 @@
#include "precomp.h"
#include <process.h>
/*
* @implemented
*/
void* _loaddll(char* name)
intptr_t _loaddll(char* name)
{
return LoadLibraryA(name);
return (intptr_t) LoadLibraryA(name);
}
/*
* @implemented
*/
int _unloaddll(void* handle)
int _unloaddll(intptr_t handle)
{
return FreeLibrary(handle);
return FreeLibrary((HMODULE) handle);
}
/*
* @implemented
*/
FARPROC _getdllprocaddr(void* hModule, char* lpProcName, int iOrdinal)
FARPROC _getdllprocaddr(intptr_t hModule, char* lpProcName, intptr_t iOrdinal)
{
if (lpProcName != NULL)
return GetProcAddress(hModule, lpProcName);
return GetProcAddress((HMODULE) hModule, lpProcName);
else
return GetProcAddress(hModule, (LPSTR)iOrdinal);
return GetProcAddress((HMODULE) hModule, (LPSTR)iOrdinal);
return (NULL);
}