WinCE only. Updating existing windows ce tools to match the trunk

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@188472 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%meer.net
2006-01-30 18:46:01 +00:00
parent 9bf6c1266a
commit fe7cf054af
21 changed files with 928 additions and 1254 deletions

View File

@@ -40,7 +40,7 @@
#include "mozce_internal.h"
int a2w_buffer(LPCSTR inACPString, int inACPChars, LPWSTR outWideString, int inWideChars)
int a2w_buffer(const char* inACPString, int inACPChars, unsigned short* outWideString, int inWideChars)
{
int retval = 0;
@@ -74,7 +74,7 @@ int a2w_buffer(LPCSTR inACPString, int inACPChars, LPWSTR outWideString, int inW
}
LPWSTR a2w_malloc(LPCSTR inACPString, int inACPChars, int* outWideChars)
unsigned short* a2w_malloc(const char* inACPString, int inACPChars, int* outWideChars)
{
LPWSTR retval = NULL;

View File

@@ -3,17 +3,6 @@
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: shunt - Win32 (WCE ARMV4) SmartPhone--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
shunt.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: shunt - Win32 (WCE ARMV4) Debug--------------------
</h3>
<h3>Command Lines</h3>
@@ -22,17 +11,6 @@ shunt.dll - 0 error(s), 0 warning(s)
<h3>Results</h3>
shunt.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: shunt - Win32 (WCE emulator) Release--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
shunt.dll - 0 error(s), 0 warning(s)
<h3>
@@ -44,17 +22,6 @@ shunt.dll - 0 error(s), 0 warning(s)
<h3>Results</h3>
shunt.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: shunt - Win32 (WCE emulator) Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
shunt.dll - 0 error(s), 0 warning(s)
</pre>

File diff suppressed because it is too large Load Diff

View File

@@ -34,8 +34,18 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZCE_DEFS
#define MOZCE_DEFS
#ifndef _MOZCE_DEFS
#define _MOZCE_DEFS
#ifndef MOZCE_STATIC_BUILD
#ifdef MOZCE_SHUNT_EXPORTS
#define MOZCE_SHUNT_API __declspec(dllexport)
#else
#define MOZCE_SHUNT_API __declspec(dllimport)
#endif
#else
#define MOZCE_SHUNT_API
#endif
//#define USE_NC_LOGGING 1
@@ -59,53 +69,249 @@
#undef max
#endif
#ifdef MOZCE_SHUNT_EXPORTS
#define MOZCE_SHUNT_API __declspec(dllexport)
#else
#define MOZCE_SHUNT_API __declspec(dllimport)
#endif
//////////////////////////////////////////////////////////
// Various Definations
//////////////////////////////////////////////////////////
// for errors.h
#define EINVAL __LINE__
#define EAGAIN __LINE__
#define EINTR __LINE__
#define ENOMEM __LINE__
#define EBADF __LINE__
#define EFAULT __LINE__
#define EACCES __LINE__
#define EIO __LINE__
#define ENOTDIR __LINE__
#define EDEADLOCK __LINE__
#define EFBIG __LINE__
#define ENOSPC __LINE__
#define EPIPE __LINE__
#define ESPIPE __LINE__
#define EISDIR __LINE__
#define ENOENT __LINE__
#define EROFS __LINE__
#define EBUSY __LINE__
#define EXDEV __LINE__
#define EEXIST __LINE__
#define ENFILE __LINE__
#define EDEADLK __LINE__
#define ERANGE __LINE__
#define EPERM __LINE__
#define ENOSYS __LINE__
#ifdef EPERM
#undef EPERM
#endif
#define EPERM 1 /* Operation not permitted */
#ifdef ENOENT
#undef ENOENT
#endif
#define ENOENT 2 /* No such file or directory */
#ifdef ESRCH
#undef ESRCH
#endif
#define ESRCH 3 /* No such process */
#ifdef EINTR
#undef EINTR
#endif
#define EINTR 4 /* Interrupted system call */
#ifdef EIO
#undef EIO
#endif
#define EIO 5 /* Input/output error */
#ifdef ENXIO
#undef ENXIO
#endif
#define ENXIO 6 /* Device not configured */
#ifdef E2BIG
#undef E2BIG
#endif
#define E2BIG 7 /* Argument list too long */
#ifdef ENOEXEC
#undef ENOEXEC
#endif
#define ENOEXEC 8 /* Exec format error */
#ifdef EBADF
#undef EBADF
#endif
#define EBADF 9 /* Bad file descriptor */
#ifdef ECHILD
#undef ECHILD
#endif
#define ECHILD 10 /* No child processes */
#ifdef EDEADLK
#undef EDEADLK
#endif
#define EDEADLK 11 /* Resource deadlock avoided */
#ifdef was
#undef was
#endif
/* 11 was EAGAIN */
#ifdef ENOMEM
#undef ENOMEM
#endif
#define ENOMEM 12 /* Cannot allocate memory */
#ifdef EACCES
#undef EACCES
#endif
#define EACCES 13 /* Permission denied */
#ifdef EFAULT
#undef EFAULT
#endif
#define EFAULT 14 /* Bad address */
#ifdef ENOTBLK
#undef ENOTBLK
#endif
#define ENOTBLK 15 /* Block device required */
#ifdef EBUSY
#undef EBUSY
#endif
#define EBUSY 16 /* Device busy */
#ifdef EEXIST
#undef EEXIST
#endif
#define EEXIST 17 /* File exists */
#ifdef EXDEV
#undef EXDEV
#endif
#define EXDEV 18 /* Cross-device link */
#ifdef ENODEV
#undef ENODEV
#endif
#define ENODEV 19 /* Operation not supported by device */
#ifdef ENOTDIR
#undef ENOTDIR
#endif
#define ENOTDIR 20 /* Not a directory */
#ifdef EISDIR
#undef EISDIR
#endif
#define EISDIR 21 /* Is a directory */
#ifdef EINVAL
#undef EINVAL
#endif
#define EINVAL 22 /* Invalid argument */
#ifdef ENFILE
#undef ENFILE
#endif
#define ENFILE 23 /* Too many open files in system */
#ifdef EMFILE
#undef EMFILE
#endif
#define EMFILE 24 /* Too many open files */
#ifdef ENOTTY
#undef ENOTTY
#endif
#define ENOTTY 25 /* Inappropriate ioctl for device */
#ifdef ETXTBSY
#undef ETXTBSY
#endif
#define ETXTBSY 26 /* Text file busy */
#ifdef EFBIG
#undef EFBIG
#endif
#define EFBIG 27 /* File too large */
#ifdef ENOSPC
#undef ENOSPC
#endif
#define ENOSPC 28 /* No space left on device */
#ifdef ESPIPE
#undef ESPIPE
#endif
#define ESPIPE 29 /* Illegal seek */
#ifdef EROFS
#undef EROFS
#endif
#define EROFS 30 /* Read-only file system */
#ifdef EMLINK
#undef EMLINK
#endif
#define EMLINK 31 /* Too many links */
#ifdef EPIPE
#undef EPIPE
#endif
#define EPIPE 32 /* Broken pipe */
#ifdef EDOM
#undef EDOM
#endif
#define EDOM 33 /* Numerical argument out of domain */
#ifdef ERANGE
#undef ERANGE
#endif
#define ERANGE 34 /* Result too large */
#ifdef EAGAIN
#undef EAGAIN
#endif
#define EAGAIN 35 /* Resource temporarily unavailable */
// in winsock.h
#ifdef EBADRPC
#undef EBADRPC
#endif
#define EBADRPC 72 /* RPC struct is bad */
#ifdef ERPCMISMATCH
#undef ERPCMISMATCH
#endif
#define ERPCMISMATCH 73 /* RPC version wrong */
#ifdef EPROGUNAVAIL
#undef EPROGUNAVAIL
#endif
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
#ifdef EPROGMISMATCH
#undef EPROGMISMATCH
#endif
#define EPROGMISMATCH 75 /* Program version wrong */
#ifdef EPROCUNAVAIL
#undef EPROCUNAVAIL
#endif
#define EPROCUNAVAIL 76 /* Bad procedure for program */
#ifdef ENOLCK
#undef ENOLCK
#endif
#define ENOLCK 77 /* No locks available */
#ifdef ENOSYS
#undef ENOSYS
#endif
#define ENOSYS 78 /* Function not implemented */
#ifdef EOVERFLOW
#undef EOVERFLOW
#endif
#define EOVERFLOW 79 /* Value too large to be stored in data type */
// From cderr.h
#ifdef FNERR_INVALIDFILENAME
#undef FNERR_INVALIDFILENAME
#endif
#define FNERR_INVALIDFILENAME 0x3002
// From signal.h
#define SIGABRT 0
#define SIGSEGV 1
#define _SIGCOUNT 2 /* LAST ONE, SIZES BUFFER */
typedef void (*_sigsig)(int inSignal);
// From stdio.h
#define _MAX_FNAME 256
#define BUFSIZ 512
#define O_RDONLY 0x0000 // open for reading only
#define O_WRONLY 0x0001 // open for writing only
@@ -126,16 +332,12 @@ typedef void (*_sigsig)(int inSignal);
#define _O_WRONLY O_WRONLY
// From stdlib.h
#define _MAX_DRIVE MAX_PATH
#define _MAX_DIR MAX_PATH
#define _MAX_EXT MAX_PATH
#define _MAX_FNAME MAX_PATH
#define _MAX_PATH MAX_PATH
// From sys/types.h
typedef int ptrdiff_t;
typedef long _off_t;
typedef long off_t;
// From sys/stat.h
#if !defined(_STAT_DEFINED)
@@ -144,7 +346,7 @@ typedef long _off_t;
#define _S_IFREG 0100000 /* stat, is a normal file */
#define _S_IREAD 0000400 /* stat, can read */
#define _S_IWRITE 0000200 /* stat, can write */
#define _S_IEXEC 0000100
#define _S_IEXEC 0000100
struct mozce_stat
{
@@ -162,11 +364,8 @@ struct mozce_stat
// From time.h
#ifdef MOZCE_SHUNT_EXPORTS
#define _TM_DEFINED
struct tm {
#else
struct mozce_tm {
#endif
int tm_sec;
int tm_min;
int tm_hour;
@@ -179,13 +378,6 @@ struct mozce_tm {
};
struct mozce_lconv {
const char* thousandsSeparator;
const char* decimalSeparator;
const char* numGrouping;
};
typedef struct mozce_GLYPHMETRICS
{
UINT gmBlackBoxX;
@@ -193,21 +385,7 @@ typedef struct mozce_GLYPHMETRICS
POINT gmptGlyphOrigin;
short gmCellIncX;
short gmCellIncY;
} mozce_GLYPHMETRICS;
typedef struct mozce_FIXED {
WORD fract;
short value;
} mozce_FIXED;
typedef struct mozce_MAT2 {
mozce_FIXED eM11;
mozce_FIXED eM12;
mozce_FIXED eM21;
mozce_FIXED eM22;
} mozce_MAT2;
} mozce_GLYPHMETRICS;
typedef struct mozce_PANOSE {
BYTE bFamilyType;
@@ -257,7 +435,9 @@ typedef struct mozce_OUTLINETEXTMETRIC
PSTR otmpStyleName;
PSTR otmpFullName;
} mozce_OUTLINETEXTMETRIC;
#define SW_SHOWMINIMIZED 2
#define GGO_METRICS 0
#define GGO_GLYPH_INDEX 1
@@ -272,25 +452,12 @@ typedef struct mozce_OUTLINETEXTMETRIC
#define DISPID_WINDOWRESIZE (__LINE__ + 3000) /* 110 */
#define DISPID_WINDOWACTIVATE (__LINE__ + 3000) /* 111 */
#define CBM_INIT 4
#ifndef MM_TEXT
#define MM_TEXT 1
#endif
typedef struct _BLENDFUNCTION
{
BYTE BlendOp;
BYTE BlendFlags;
BYTE SourceConstantAlpha;
BYTE AlphaFormat;
} BLENDFUNCTION, *PBLENDFUNCTION, *LPBLENDFUNCTION;
#define AC_SRC_OVER 0
#ifndef SM_CYVTHUMB
#define SM_CYVTHUMB 9
#endif
@@ -312,4 +479,87 @@ typedef struct _BLENDFUNCTION
#define LR_LOADFROMFILE 0
#endif
#ifndef MA_NOACTIVATE
#define MA_NOACTIVATE 1
#endif
#ifndef MA_ACTIVATE
#define MA_ACTIVATE 1
#endif
#ifndef WM_MOUSEACTIVATE
#define WM_MOUSEACTIVATE WM_ACTIVATE
#endif
typedef struct WINDOWPLACEMENT
{
UINT length;
UINT flags;
UINT showCmd;
POINT ptMinPosition;
POINT ptMaxPosition;
RECT rcNormalPosition;
} WINDOWPLACEMENT, *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT;
typedef void (*_sigsig)(int inSignal);
typedef struct mozce_FIXED {
WORD fract;
short value;
} mozce_FIXED;
typedef struct mozce_MAT2 {
mozce_FIXED eM11;
mozce_FIXED eM12;
mozce_FIXED eM21;
mozce_FIXED eM22;
} mozce_MAT2;
//#if 0
#ifdef _BLENDFUNCTION
#undef _BLENDFUNCTION
#endif
#ifdef BLENDFUNCTION
#undef BLENDFUNCTION
#endif
#ifdef PBLENDFUNCTION
#undef PBLENDFUNCTION
#endif
typedef struct _BLENDFUNCTION
{
BYTE BlendOp;
BYTE BlendFlags;
BYTE SourceConstantAlpha;
BYTE AlphaFormat;
}BLENDFUNCTION,*PBLENDFUNCTION;
//#endif
//
// currentlly defined blend function
//
#define AC_SRC_OVER 0x00
//
// alpha format flags
//
#define AC_SRC_ALPHA 0x01
struct color{
unsigned char Red;
unsigned char Green;
unsigned char Blue;
double Alpha;
};
#endif

View File

@@ -50,6 +50,8 @@
// Function Mapping
//////////////////////////////////////////////////////////
#ifndef MOZCE_SHUNT_EXPORTS
// From asswert.cpp
#ifdef _assert
#undef _assert
@@ -113,27 +115,6 @@
#endif
#define _fileno mozce_fileno
// math.cpp
/*
#define fd_acos acos
#define fd_asin asin
#define fd_atan atan
#define fd_cos cos
#define fd_sin sin
#define fd_tan tan
#define fd_exp exp
#define fd_log log
#define fd_sqrt sqrt
#define fd_ceil ceil
#define fd_fabs fabs
#define fd_floor floor
#define fd_fmod fmod
#define fd_atan2 atan2
#define fd_copysign _copysign
#define fd_pow pow
*/
// From mbstring.cpp
#ifdef _mbsinc
#undef _mbsinc
@@ -187,6 +168,10 @@
#endif
#define getpid mozce_getpid
#ifdef _getpid
#undef _getpid
#endif
#define _getpid mozce_getpid
// From signal.cpp
#ifdef raise
@@ -386,17 +371,11 @@
#endif
#define ctime mozce_ctime
#ifdef localeconv
#undef localeconv
#endif
#define localeconv mozce_localeconv
//#ifdef lconv
//#undef lconv
//#endif
//#define lconv mozce_lconv
// From win32.cpp
#ifdef Arc
@@ -414,6 +393,11 @@
#endif
#define CreateDIBitmap mozce_CreateDIBitmap
#ifdef CommDlgExtendedError
#undef CommDlgExtendedError
#endif
#define CommDlgExtendedError mozce_CommDlgExtendedError
#ifdef EnumChildWindows
#undef EnumChildWindows
#endif
@@ -437,7 +421,18 @@
#ifdef ExpandEnvironmentStrings
#undef ExpandEnvironmentStrings
#endif
#define ExpandEnvironmentStrings mozce_ExpandEnvironmentStrings
#ifdef ExpandEnvironmentStringsA
#undef ExpandEnvironmentStringsA
#endif
#ifdef ExpandEnvironmentStringsW
#undef ExpandEnvironmentStringsW
#endif
#define ExpandEnvironmentStrings mozce_ExpandEnvironmentStrings
#define ExpandEnvironmentStringsA mozce_ExpandEnvironmentStrings
#define ExpandEnvironmentStringsW mozce_ExpandEnvironmentStringsW
#ifdef FIXED
#undef FIXED
@@ -464,22 +459,6 @@
#endif
#define GLYPHMETRICS mozce_GLYPHMETRICS
#ifdef GetCurrentProcess
#undef GetCurrentProcess
#endif
#define GetCurrentProcess mozce_GetCurrentProcess
#ifdef GetCurrentProcessId
#undef GetCurrentProcessId
#endif
#define GetCurrentProcessId mozce_GetCurrentProcessId
#ifdef GetCurrentThreadId
#undef GetCurrentThreadId
#endif
#define GetCurrentThreadId mozce_GetCurrentThreadId
#ifdef GetDIBits
#undef GetDIBits
#endif
@@ -510,6 +489,11 @@
#endif
#define GetMapMode mozce_GetMapMode
#ifdef GetMessageA
#undef GetMessageA
#endif
#define GetMessageA GetMessageW
#ifdef GetMessageTime
#undef GetMessageTime
#endif
@@ -555,6 +539,12 @@
#endif
#define GetUserName mozce_GetUserName
#ifdef GetWindowPlacement
#undef GetWindowPlacement
#endif
#define GetWindowPlacement mozce_GetWindowPlacement
#ifdef InvertRgn
#undef InvertRgn
#endif
@@ -565,11 +555,6 @@
#endif
#define IsIconic mozce_IsIconic
#ifdef LINEDDAPROC
#undef LINEDDAPROC
#endif
#define LINEDDAPROC mozce_LINEDDAPROC
#ifdef LPtoDP
#undef LPtoDP
#endif
@@ -590,11 +575,6 @@
#endif
#define MAT2 mozce_MAT2
#ifdef MsgWaitForMultipleObjects
#undef MsgWaitForMultipleObjects
#endif
#define MsgWaitForMultipleObjects mozce_MsgWaitForMultipleObjects
#ifdef MulDiv
#undef MulDiv
#endif
@@ -615,6 +595,12 @@
#endif
#define Pie mozce_Pie
#ifdef PeekMessageA
#undef PeekMessageA
#endif
#define PeekMessageA PeekMessageW
#ifdef RegCreateKey
#undef RegCreateKey
#endif
@@ -655,15 +641,10 @@
#endif
#define SetWindowTextA mozce_SetWindowTextA
#ifdef TlsAlloc
#undef TlsAlloc
#ifdef ShellExecute
#undef ShellExecute
#endif
#define TlsAlloc mozce_TlsAlloc
#ifdef TlsFree
#undef TlsFree
#endif
#define TlsFree mozce_TlsFree
#define ShellExecute mozce_ShellExecute
#ifdef UnhookWindowsHookEx
#undef UnhookWindowsHookEx
@@ -685,6 +666,21 @@
#endif
#define IsClipboardFormatAvailable mozce_IsClipboardFormatAvailable
#ifdef CoInitialize
#undef CoInitialize
#endif
#define CoInitialize mozce_CoInitialize
#ifdef OleInitialize
#undef OleInitialize
#endif
#define OleInitialize mozce_OleInitialize
#ifdef OleUninitialize
#undef OleUninitialize
#endif
#define OleUninitialize mozce_OleUninitialize
#ifdef OleFlushClipboard
#undef OleFlushClipboard
#endif
@@ -705,6 +701,10 @@
#endif
#define OleSetClipboard mozce_OleSetClipboard
#ifdef AlphaBlend
#undef AlphaBlend
#endif
#define AlphaBlend mozce_AlphaBlend
// From win32a.cpp
@@ -956,6 +956,11 @@
#endif
#define GlobalAddAtomA mozce_GlobalAddAtomA
#ifdef LoadBitmapA
#undef LoadBitmapA
#endif
#define LoadBitmapA mozce_LoadBitmapA
#ifdef LoadCursorA
#undef LoadCursorA
#endif
@@ -1006,11 +1011,6 @@
#endif
#define OutputDebugStringA mozce_OutputDebugStringA
#ifdef PeekMessageA
#undef PeekMessageA
#endif
#define PeekMessageA mozce_PeekMessageA
#ifdef PostMessageA
#undef PostMessageA
#endif
@@ -1132,11 +1132,6 @@
#endif
#define SystemParametersInfoA SystemParametersInfoW
#ifdef GetMessageA
#undef GetMessageA
#endif
#define GetMessageA GetMessageW
#ifdef DispatchMessageA
#undef DispatchMessageA
#endif
@@ -1172,6 +1167,7 @@
#define FindNextFile FindNextFileW
#if 1
#ifdef GetProp
#undef GetProp
@@ -1188,6 +1184,7 @@
#endif
#define RemoveProp mozce_RemovePropA
#endif
// From win32w.cpp
@@ -1226,6 +1223,7 @@
#endif
#define SetCurrentDirectoryW mozce_SetCurrentDirectoryW
#endif // MOZCE_SHUNT_EXPORTS
//////////////////////////////////////////////////////////
// Function Declarations
@@ -1268,7 +1266,7 @@ extern "C" {
MOZCE_SHUNT_API _sigsig mozce_signal(int inSignal, _sigsig inFunc);
// From stat.cpp
MOZCE_SHUNT_API int mozce_stat(const char *, struct _stat *);
MOZCE_SHUNT_API int mozce_stat(const char *inPath, struct mozce_stat * outStat);
// From stdio.cpp
MOZCE_SHUNT_API int mozce_access(const char *path, int mode);
@@ -1307,22 +1305,37 @@ extern "C" {
MOZCE_SHUNT_API struct tm* mozce_gmtime(const time_t* inTimeT);
MOZCE_SHUNT_API time_t mozce_mktime(struct tm* inTM);
MOZCE_SHUNT_API size_t mozce_strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr);
MOZCE_SHUNT_API struct lconv * mozce_localeconv(void);
// from win32.cpp
MOZCE_SHUNT_API BOOL mozce_AlphaBlend( HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
BLENDFUNCTION blendFunction);
MOZCE_SHUNT_API struct lconv * mozce_localeconv(void);
VOID CALLBACK mozce_LineDDAProc(int X, int Y, LPARAM lpData);
typedef void (*mozce_LINEDDAPROC) (int X, int Y, LPARAM lpData);
MOZCE_SHUNT_API int mozce_MulDiv(int inNumber, int inNumerator, int inDenominator);
MOZCE_SHUNT_API int mozce_GetDIBits(HDC inDC, HBITMAP inBMP, UINT inStartScan, UINT inScanLines, LPVOID inBits, LPBITMAPINFO inInfo, UINT inUsage);
MOZCE_SHUNT_API int mozce_SetDIBits(HDC inDC, HBITMAP inBMP, UINT inStartScan, UINT inScanLines, CONST LPVOID inBits, CONST LPBITMAPINFO inInfo, UINT inUsage);
MOZCE_SHUNT_API DWORD mozce_CommDlgExtendedError(void);
MOZCE_SHUNT_API HBITMAP mozce_CreateDIBitmap(HDC inDC, CONST BITMAPINFOHEADER *inBMIH, DWORD inInit, CONST VOID *inBInit, CONST BITMAPINFO *inBMI, UINT inUsage);
MOZCE_SHUNT_API int mozce_SetPolyFillMode(HDC inDC, int inPolyFillMode);
MOZCE_SHUNT_API int mozce_SetStretchBltMode(HDC inDC, int inStretchMode);
MOZCE_SHUNT_API int mozce_ExtSelectClipRgn(HDC inDC, HRGN inRGN, int inMode);
MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStrings(LPCTSTR lpSrc, LPTSTR lpDst, DWORD nSize);
MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStringsW(const unsigned short * lpSrc, const unsigned short * lpDst, DWORD nSize);
MOZCE_SHUNT_API BOOL mozce_LineDDA(int inXStart, int inYStart, int inXEnd, int inYEnd, mozce_LINEDDAPROC inLineFunc, LPARAM inData);
MOZCE_SHUNT_API int mozce_FrameRect(HDC inDC, CONST RECT *inRect, HBRUSH inBrush);
@@ -1334,7 +1347,7 @@ extern "C" {
MOZCE_SHUNT_API UINT mozce_GetTextCharset(HDC inDC);
MOZCE_SHUNT_API UINT mozce_GetTextCharsetInfo(HDC inDC, LPFONTSIGNATURE outSig, DWORD inFlags);
MOZCE_SHUNT_API UINT mozce_GetOutlineTextMetrics(HDC inDC, UINT inData, void* outOTM);
MOZCE_SHUNT_API int mozce_EnumFontFamiliesEx(HDC inDC, LPLOGFONT inLogfont, FONTENUMPROC inFunc, LPARAM inParam, DWORD inFlags);
MOZCE_SHUNT_API int mozce_EnumFontFamiliesEx(HDC inDC, const LOGFONTA* inLogfont, FONTENUMPROC inFunc, LPARAM inParam, DWORD inFlags);
MOZCE_SHUNT_API int mozce_GetMapMode(HDC inDC);
MOZCE_SHUNT_API BOOL mozce_GetIconInfo(HICON inIcon, PICONINFO outIconinfo);
MOZCE_SHUNT_API BOOL mozce_LPtoDP(HDC inDC, LPPOINT inoutPoints, int inCount);
@@ -1346,12 +1359,18 @@ extern "C" {
MOZCE_SHUNT_API BOOL mozce_IsIconic(HWND inWnd);
MOZCE_SHUNT_API BOOL mozce_OpenIcon(HWND inWnd);
MOZCE_SHUNT_API HHOOK mozce_SetWindowsHookEx(int inType, void* inFunc, HINSTANCE inMod, DWORD inThreadId);
MOZCE_SHUNT_API HINSTANCE mozce_ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd);
MOZCE_SHUNT_API BOOL mozce_UnhookWindowsHookEx(HHOOK inHook);
MOZCE_SHUNT_API LRESULT mozce_CallNextHookEx(HHOOK inHook, int inCode, WPARAM wParam, LPARAM lParam);
MOZCE_SHUNT_API BOOL mozce_GetWindowPlacement(HWND window, WINDOWPLACEMENT *lpwndpl);
MOZCE_SHUNT_API BOOL mozce_InvertRgn(HDC inDC, HRGN inRGN);
MOZCE_SHUNT_API int mozce_GetScrollPos(HWND inWnd, int inBar);
MOZCE_SHUNT_API BOOL mozce_GetScrollRange(HWND inWnd, int inBar, LPINT outMinPos, LPINT outMaxPos);
MOZCE_SHUNT_API HRESULT mozce_CoLockObjectExternal(IUnknown* inUnk, BOOL inLock, BOOL inLastUnlockReleases);
MOZCE_SHUNT_API HRESULT mozce_CoInitialize(LPVOID pvReserved);
MOZCE_SHUNT_API LRESULT mozce_OleInitialize(LPVOID pvReserved);
MOZCE_SHUNT_API void mozce_OleUninitialize();;
MOZCE_SHUNT_API HRESULT mozce_OleSetClipboard(IDataObject* inDataObj);
MOZCE_SHUNT_API HRESULT mozce_OleGetClipboard(IDataObject** outDataObj);
MOZCE_SHUNT_API HRESULT mozce_OleFlushClipboard(void);
@@ -1366,22 +1385,18 @@ extern "C" {
MOZCE_SHUNT_API HMENU mozce_LoadMenuA(HINSTANCE hInstance, LPCSTR lpMenuName);
MOZCE_SHUNT_API void mozce_GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
MOZCE_SHUNT_API DWORD mozce_GetFullPathName(LPCTSTR lpFileName, DWORD nBufferLength, LPTSTR lpBuffer, LPTSTR* lpFilePart);
MOZCE_SHUNT_API DWORD mozce_GetFullPathName(const char* lpFileName, DWORD nBufferLength, const char* lpBuffer, const char** lpFilePart);
MOZCE_SHUNT_API UINT mozce_GetACP(void);
MOZCE_SHUNT_API HANDLE mozce_GetCurrentProcess(void);
MOZCE_SHUNT_API HANDLE mozce_GetCurrentProcessId(void);
MOZCE_SHUNT_API DWORD mozce_TlsAlloc(void);
MOZCE_SHUNT_API BOOL mozce_TlsFree(DWORD dwTlsIndex);
MOZCE_SHUNT_API DWORD GetCurrentThreadId(void);
MOZCE_SHUNT_API DWORD mozce_MsgWaitForMultipleObjects(DWORD nCount, const HANDLE* pHandles, BOOL bWaitAll, DWORD dwMilliseconds, DWORD dwWakeMask);
MOZCE_SHUNT_API BOOL mozce_PeekMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg);
MOZCE_SHUNT_API BOOL mozce_GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
MOZCE_SHUNT_API LONG mozce_GetMessageTime(void);
// from win32a.cpp
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineA(HDC inDC, CHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST mozce_MAT2* inMAT2);
MOZCE_SHUNT_API ATOM mozce_GlobalAddAtomA(LPCSTR lpString);
MOZCE_SHUNT_API ATOM mozce_RegisterClassA(CONST WNDCLASSA *lpwc);
MOZCE_SHUNT_API BOOL mozce_CopyFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists);
@@ -1389,17 +1404,17 @@ extern "C" {
MOZCE_SHUNT_API BOOL mozce_RemoveDirectoryA(LPCSTR lpPathName);
MOZCE_SHUNT_API HANDLE mozce_CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName);
MOZCE_SHUNT_API BOOL mozce_CreateProcessA(LPCSTR pszImageName, LPCSTR pszCmdLine, LPSECURITY_ATTRIBUTES psaProcess, LPSECURITY_ATTRIBUTES psaThread, BOOL fInheritHandles, DWORD fdwCreate, LPVOID pvEnvironment, LPSTR pszCurDir, LPSTARTUPINFO psiStartInfo, LPPROCESS_INFORMATION pProcInfo);
MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOptions, LPCRECT inRect, LPCSTR inString, UINT inCount, const LPINT inDx);
MOZCE_SHUNT_API BOOL mozce_TextOutA(HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString);
MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOptions, LPCRECT inRect, const char* inString, UINT inCount, const LPINT inDx);
MOZCE_SHUNT_API BOOL mozce_TextOutA(HDC hdc, int nXStart, int nYStart, const char* lpString, int cbString);
MOZCE_SHUNT_API BOOL mozce_GetClassInfoA(HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASS lpWndClass);
MOZCE_SHUNT_API int mozce_GetClassNameA(HWND hWnd, LPTSTR lpClassName, int nMaxCount);
MOZCE_SHUNT_API BOOL mozce_GetFileVersionInfoA(LPSTR inFilename, DWORD inHandle, DWORD inLen, LPVOID outData);
MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, LPCSTR inStr, int inLen, int inMaxExtent, LPINT outFit, LPINT outDx, LPSIZE inSize);
MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, const char* inStr, int inLen, int inMaxExtent, LPINT outFit, LPINT outDx, LPSIZE inSize);
MOZCE_SHUNT_API BOOL mozce_GetVersionExA(LPOSVERSIONINFOA lpv);
MOZCE_SHUNT_API BOOL mozce_DeleteFileA(LPCSTR lpFileName);
MOZCE_SHUNT_API BOOL mozce_MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
MOZCE_SHUNT_API BOOL mozce_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg);
MOZCE_SHUNT_API BOOL mozce_SetCurrentDirectoryA(LPCSTR inPathName);
MOZCE_SHUNT_API BOOL mozce_VerQueryValueA(const LPVOID inBlock, LPSTR inSubBlock, LPVOID *outBuffer, PUINT outLen);
MOZCE_SHUNT_API BOOL mozce_UnregisterClassA(LPCSTR lpClassName, HINSTANCE hInstance);
@@ -1423,7 +1438,7 @@ extern "C" {
MOZCE_SHUNT_API LONG mozce_RegSetValueExA(HKEY hKey, const char *valname, DWORD dwReserved, DWORD dwType, const BYTE* lpData, DWORD dwSize);
MOZCE_SHUNT_API LONG mozce_RegCreateKeyExA(HKEY hKey, const char *subkey, DWORD dwRes, LPSTR lpszClass, DWORD ulOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES sec_att, PHKEY phkResult, DWORD *lpdwDisp);
MOZCE_SHUNT_API LONG mozce_RegDeleteValueA(HKEY hKey, LPCTSTR lpValueName);
MOZCE_SHUNT_API LONG mozce_RegDeleteValueA(HKEY hKey, const char* lpValueName);
MOZCE_SHUNT_API LRESULT mozce_DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
MOZCE_SHUNT_API LRESULT mozce_PostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
@@ -1441,6 +1456,7 @@ extern "C" {
MOZCE_SHUNT_API HINSTANCE mozce_LoadLibraryA(LPCSTR lpLibFileName);
MOZCE_SHUNT_API int mozce_GetObjectA(HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);
MOZCE_SHUNT_API FARPROC mozce_GetProcAddressA(HMODULE hMod, const char *name);
MOZCE_SHUNT_API HBITMAP mozce_LoadBitmapA(HINSTANCE hInstance, LPCSTR lpCursorName);
MOZCE_SHUNT_API HCURSOR mozce_LoadCursorA(HINSTANCE hInstance, LPCSTR lpCursorName);
MOZCE_SHUNT_API int mozce_StartDocA(HDC hdc, CONST DOCINFO* lpdi);
@@ -1459,22 +1475,22 @@ extern "C" {
MOZCE_SHUNT_API BOOL mozce_SetDlgItemTextA(HWND hwndDlg, int idControl, LPCSTR lpsz);
MOZCE_SHUNT_API HANDLE mozce_CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, const char *lpName);
MOZCE_SHUNT_API HANDLE mozce_GetPropA(HWND hWnd, LPCSTR lpString);
MOZCE_SHUNT_API BOOL mozce_SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData);
MOZCE_SHUNT_API HANDLE mozce_RemovePropA(HWND hWnd, LPCSTR lpString);
MOZCE_SHUNT_API HANDLE mozce_GetPropA(HWND hWnd, const char* lpString);
MOZCE_SHUNT_API BOOL mozce_SetPropA(HWND hWnd, const char* lpString, HANDLE hData);
MOZCE_SHUNT_API HANDLE mozce_RemovePropA(HWND hWnd, const char* lpString);
MOZCE_SHUNT_API HANDLE mozce_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData);
MOZCE_SHUNT_API BOOL mozce_FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData);
MOZCE_SHUNT_API HANDLE mozce_FindFirstFileA(const char* lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
MOZCE_SHUNT_API BOOL mozce_FindNextFileA(HANDLE hFindFile, WIN32_FIND_DATAA* lpFindFileData);
MOZCE_SHUNT_API HANDLE mozce_CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName);
MOZCE_SHUNT_API DWORD mozce_FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list* Arguments);
MOZCE_SHUNT_API HANDLE mozce_CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName);
MOZCE_SHUNT_API HFONT mozce_CreateFontIndirectA(CONST LOGFONT* lplf);
MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, LPCTSTR lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam);
MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, LPTSTR lpFaceName);
MOZCE_SHUNT_API BOOL mozce_GetTextMetricsA(HDC hdc, LPTEXTMETRIC lptm);
MOZCE_SHUNT_API HFONT mozce_CreateFontIndirectA(CONST LOGFONTA* lplf);
MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, const char* lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam);
MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, const char* lpFaceName);
MOZCE_SHUNT_API BOOL mozce_GetTextMetricsA(HDC hdc, TEXTMETRICA* lptm);
MOZCE_SHUNT_API BOOL mozce_SetWindowTextA(HWND hWnd, LPCSTR lpString);
@@ -1482,7 +1498,7 @@ extern "C" {
// From win32w.cpp
MOZCE_SHUNT_API BOOL mozce_SetCurrentDirectoryW(LPCTSTR inPathName);
MOZCE_SHUNT_API DWORD mozce_GetCurrentDirectoryW(DWORD inBufferLength, LPTSTR outBuffer);
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineW(HDC inDC, WCHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST void* inMAT2);
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineW(HDC inDC, WCHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST VOID* inMAT2);
MOZCE_SHUNT_API HANDLE mozce_OpenSemaphoreW(DWORD inDesiredAccess, BOOL inInheritHandle, LPCWSTR inName);
MOZCE_SHUNT_API UINT mozce_GetSystemDirectoryW(LPWSTR inBuffer, UINT inSize);
MOZCE_SHUNT_API UINT mozce_GetWindowsDirectoryW(LPWSTR inBuffer, UINT inSize);

View File

@@ -51,7 +51,7 @@ extern "C" {
** Right now, bail with a default implementation.
*/
// #define LOG_CALLS
#define LOG_CALLS
MOZCE_SHUNT_API unsigned char* mozce_mbsinc(const unsigned char* inCurrent)
{

View File

@@ -68,7 +68,7 @@
** included a terminating character for the conversion).
*/
int a2w_buffer(LPCSTR inACPString, int inACPChars, LPWSTR outWideString, int inWideChars);
int a2w_buffer(const char* inACPString, int inACPChars, unsigned short* outWideString, int inWideChars);
/*
** Perform the requested conversion using heap memory.
@@ -94,7 +94,7 @@ int a2w_buffer(LPCSTR inACPString, int inACPChars, LPWSTR outWideString, int inW
** NULL on failure.
*/
LPWSTR a2w_malloc(LPCSTR inACPString, int inACPChars, int* outWideChars);
unsigned short* a2w_malloc(const char* inACPString, int inACPChars, int* outWideChars);
/*
** Perform the requested conversion using the buffer provided.
@@ -116,7 +116,7 @@ LPWSTR a2w_malloc(LPCSTR inACPString, int inACPChars, int* outWideChars);
** should the string be terminated (i.e. if inWideChars
** included a terminating character for the conversion).
*/
int w2a_buffer(LPCWSTR inWideString, int inWideChars, LPSTR outACPString, int inACPChars);
int w2a_buffer(const unsigned short* inWideString, int inWideChars, char* outACPString, int inACPChars);
/*
** Perform the requested conversion using heap memory.
@@ -141,7 +141,7 @@ int w2a_buffer(LPCWSTR inWideString, int inWideChars, LPSTR outACPString, int in
** NULL on failure.
*/
LPSTR w2a_malloc(LPCWSTR inWideString, int inWideChars, int* outACPChars);
char* w2a_malloc(unsigned short* inWideString, int inWideChars, int* outACPChars);
void dumpMemoryInfo();
@@ -154,13 +154,13 @@ void dumpMemoryInfo();
extern "C" {
#endif
MOZCE_SHUNT_API int mozce_printf(const char *, ...);
MOZCE_SHUNT_API int mozce_printf(const char *, ...);
#ifdef __cplusplus
};
#endif
void nclog (const char *fmt, ...);
int nclog (const char *fmt, ...);
void nclograw(const char* data, long length);
//#define MOZCE_PRECHECK \

View File

@@ -44,6 +44,8 @@
#include "mozce_internal.h"
#define USE_NC_LOGGING
#ifdef USE_NC_LOGGING
@@ -77,17 +79,33 @@ static bool wsa_init()
WSADATA wd;
BOOL bc=true;
if (0 != WSAStartup(0x101, &wd)) goto error;
if (0 != WSAStartup(0x101, &wd))
{
MessageBox(0, L"WSAStartup failed", L"ERROR", 0);
goto error;
}
wsa_socket=socket(PF_INET, SOCK_DGRAM, 0);
if (wsa_socket == INVALID_SOCKET) goto error;
if (wsa_socket == INVALID_SOCKET)
{
MessageBox(0, L"socket failed", L"ERROR", 0);
goto error;
}
r=setsockopt(wsa_socket, SOL_SOCKET, SO_BROADCAST, (char*)&bc,
sizeof(bc));
if (r!=0) goto error;
if (r!=0)
{
MessageBox(0, L"setsockopt failed", L"ERROR", 0);
goto error;
}
if (wsa_bind(9998)) return true; // bind to default port.
error:
MessageBox(0, L"Can Not Bind To Port", L"ERROR", 0);
error:
if (wsa_socket != INVALID_SOCKET) closesocket(wsa_socket);
return false;
}
// can be called externally to select a different port for operations
@@ -104,7 +122,7 @@ static void wsa_send(const char *x)
}
// format input, convert to 8-bit and send.
void nclog (const char *fmt, ...)
int nclog (const char *fmt, ...)
{
va_list vl;
va_start(vl,fmt);
@@ -112,7 +130,7 @@ void nclog (const char *fmt, ...)
sprintf(buf,fmt,vl);
wsa_init();
wsa_send(buf);
return 0;
}
void nclograw(const char* data, long length)

View File

@@ -1,5 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEG LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -58,7 +59,7 @@ MOZCE_SHUNT_API void mozce_abort(void)
#if defined(DEBUG)
DebugBreak();
#endif
TerminateProcess(GetCurrentProcess(), 3);
TerminateProcess((HANDLE) GetCurrentProcessId(), 3);
}
@@ -71,9 +72,8 @@ MOZCE_SHUNT_API char* mozce_getenv(const char* inName)
#endif
char* retval = NULL;
#ifdef DEBUG_NSPR_ALL
if (!strcmp(inName, "NSPR_LOG_MODULES"))
return "all:5";
@@ -87,7 +87,10 @@ MOZCE_SHUNT_API char* mozce_getenv(const char* inName)
if (!strcmp(inName, "NS_TIMELINE_ENABLE"))
return "1";
#endif
#endif
if (!_stricmp(inName, "tmp"))
return "/Temp";
return retval;
}

View File

@@ -48,7 +48,7 @@ extern "C" {
#endif
MOZCE_SHUNT_API int mozce_stat(const char* inPath, struct stat* outStats)
MOZCE_SHUNT_API int mozce_stat(const char* inPath, struct mozce_stat* outStats)
{
MOZCE_PRECHECK

View File

@@ -128,7 +128,7 @@ MOZCE_SHUNT_API FILE* mozce_fdopen(int fd, const char* inMode)
if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
return 0;
return 0;
return _fdtab[fd].file;
}
@@ -180,10 +180,10 @@ MOZCE_SHUNT_API char* mozce_getcwd(char* buff, size_t size)
#ifdef DEBUG
mozce_printf("mozce_getcwd called.\n");
#endif
int i;
unsigned short dir[MAX_PATH];
GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
for (int i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
dir[i + 1] = TCHAR('\0');
w2a_buffer(dir, -1, buff, size);
@@ -193,6 +193,24 @@ MOZCE_SHUNT_API char* mozce_getcwd(char* buff, size_t size)
MOZCE_SHUNT_API int mozce_printf(const char * format, ...)
{
//#ifdef DEBUG
#define MAX_CHARS_IN_VARIABLE_STRING 1024
char buf[MAX_CHARS_IN_VARIABLE_STRING];
TCHAR tBuf[MAX_CHARS_IN_VARIABLE_STRING];
va_list ptr;
va_start(ptr,format);
vsprintf(buf,format,ptr);
mbstowcs(tBuf, buf, MAX_CHARS_IN_VARIABLE_STRING);
OutputDebugString(tBuf);
return 1;
//#endif
return 0;
}
@@ -274,7 +292,7 @@ MOZCE_SHUNT_API int mozce_close(int fd)
if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
return -1;
return -1;
fclose(_fdtab[fd].file);
@@ -292,7 +310,7 @@ MOZCE_SHUNT_API size_t mozce_read(int fd, void* buffer, size_t count)
#endif
if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
return -1;
return -1;
size_t num = fread(buffer, 1, count, _fdtab[fd].file);
@@ -312,7 +330,7 @@ MOZCE_SHUNT_API size_t mozce_write(int fd, const void* buffer, size_t count)
#endif
if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
return -1;
return -1;
size_t num = fwrite(buffer, 1, count, _fdtab[fd].file);
if (ferror(_fdtab[fd].file))
@@ -343,7 +361,7 @@ MOZCE_SHUNT_API int mozce_lseek(int fd, int offset, int whence)
if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
return -1;
return -1;
int newpos = -1;
int error = fseek(_fdtab[fd].file, offset, whence);
@@ -369,9 +387,9 @@ MOZCE_SHUNT_API int mozce_fileno(FILE* f)
for(fd = 0; fd < MAXFDS; fd++)
{
if(_fdtab[fd].file == f)
{
{
return _fdtab[fd].fd;
}
}
}
return (int) fileno(f);

View File

@@ -41,6 +41,10 @@
#include <stdio.h>
#include "mozce_internal.h"
#define _MAX_FNAME 256
#define _MAX_DIR _MAX_FNAME
#define _MAX_EXT _MAX_FNAME
extern "C" {
#if 0
@@ -61,9 +65,10 @@ MOZCE_SHUNT_API char *mozce_fullpath(char *absPath, const char *relPath, size_t
if (relPath[0] != '\\')
{
unsigned short dir[MAX_PATH];
int i;
unsigned short dir[MAX_PATH];
GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
for (int i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
dir[i + 1] = TCHAR('\0');
@@ -102,11 +107,11 @@ MOZCE_SHUNT_API void mozce_splitpath(const char* inPath, char* outDrive, char* o
if(NULL != inPath && '\0' != *inPath)
{
char* dup = (char*) malloc(strlen(inPath));
if(NULL != dup)
char* dup = (char*) malloc(strlen(inPath));
if(NULL != dup)
{
strcpy(dup, inPath);
/*
/*
** Change all forward slashes to back.
*/
char* convert = dup;

View File

@@ -40,7 +40,7 @@
#include "mozce_internal.h"
int w2a_buffer(LPCWSTR inWideString, int inWideChars, LPSTR outACPString, int inACPChars)
int w2a_buffer(const unsigned short* inWideString, int inWideChars, char* outACPString, int inACPChars)
{
int retval = 0;
@@ -76,7 +76,7 @@ int w2a_buffer(LPCWSTR inWideString, int inWideChars, LPSTR outACPString, int in
}
LPSTR w2a_malloc(LPCWSTR inWideString, int inWideChars, int* outACPChars)
char* w2a_malloc(const unsigned short* inWideString, int inWideChars, int* outACPChars)
{
LPSTR retval = NULL;

View File

@@ -52,6 +52,19 @@ extern "C" {
#define wcharcount(array) (sizeof(array) / sizeof(TCHAR))
MOZCE_SHUNT_API DWORD mozce_CommDlgExtendedError()
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_CommDlgExtendedError called\n");
#endif
return -1 /*CDERR_DIALOGFAILURE*/;
}
MOZCE_SHUNT_API int mozce_MulDiv(int inNumber, int inNumerator, int inDenominator)
{
MOZCE_PRECHECK
@@ -160,6 +173,12 @@ MOZCE_SHUNT_API int mozce_ExtSelectClipRgn(HDC inDC, HRGN inRGN, int inMode)
// RGN_DIFF = 4
// RGN_COPY = 5
if (inMode == RGN_COPY)
{
return SelectClipRgn(inDC, inRGN);
}
HRGN cRGN = NULL;
int result = GetClipRgn(inDC, cRGN);
@@ -407,7 +426,7 @@ static int CALLBACK collectProc(CONST LOGFONT* inLF, CONST TEXTMETRIC* inTM, DWO
return retval;
}
MOZCE_SHUNT_API int mozce_EnumFontFamiliesEx(HDC inDC, LPLOGFONT inLogfont, FONTENUMPROC inFunc, LPARAM inParam, DWORD inFlags)
MOZCE_SHUNT_API int mozce_EnumFontFamiliesEx(HDC inDC, const LOGFONTA* inLogfont, FONTENUMPROC inFunc, LPARAM inParam, DWORD inFlags)
{
MOZCE_PRECHECK
@@ -759,6 +778,40 @@ MOZCE_SHUNT_API HRESULT mozce_CoLockObjectExternal(IUnknown* inUnk, BOOL inLock,
return retval;
}
MOZCE_SHUNT_API HRESULT mozce_CoInitialize(LPVOID pvReserved)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("-- mozce_Conitialize called\n");
#endif
CoInitializeEx(NULL, COINIT_MULTITHREADED);
return S_OK;
}
MOZCE_SHUNT_API LRESULT mozce_OleInitialize(LPVOID pvReserved)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("-- mozce_OleInitialize called\n");
#endif
return S_OK;
}
MOZCE_SHUNT_API void mozce_OleUninitialize()
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("-- mozce_OleUninitialize called\n");
#endif
}
MOZCE_SHUNT_API HRESULT mozce_OleQueryLinkFromData(IDataObject* inSrcDataObject)
{
MOZCE_PRECHECK
@@ -817,19 +870,17 @@ MOZCE_SHUNT_API BOOL mozce_GetUserName(LPTSTR inBuffer, LPDWORD inoutSize)
}
MOZCE_SHUNT_API DWORD mozce_GetShortPathName(LPCTSTR inLongPath, LPTSTR outShortPath, DWORD inBufferSize)
MOZCE_SHUNT_API DWORD mozce_GetShortPathName(LPCSTR inLongPath, LPSTR outShortPath, DWORD inBufferSize)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("-- mozce_GetShortPathName called\n");
mozce_printf("mozce_GetShortPathName called\n");
#endif
DWORD retval = 0;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return retval;
DWORD retval = strlen(inLongPath);
strncpy(outShortPath, inLongPath, inBufferSize);
return ((retval > inBufferSize) ? inBufferSize : retval);
}
MOZCE_SHUNT_API DWORD mozce_GetEnvironmentVariable(LPCSTR lpName, LPCSTR lpBuffer, DWORD nSize)
@@ -860,97 +911,19 @@ MOZCE_SHUNT_API void mozce_GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFile
SystemTimeToFileTime(&st,lpSystemTimeAsFileTime);
}
struct lconv s_locale_conv =
{
".", /* decimal_point */
",", /* thousands_sep */
"333", /* grouping */
"$", /* int_curr_symbol */
"$", /* currency_symbol */
"", /* mon_decimal_point */
"", /* mon_thousands_sep */
"", /* mon_grouping */
"+", /* positive_sign */
"-", /* negative_sign */
'2', /* int_frac_digits */
'2', /* frac_digits */
1, /* p_cs_precedes */
1, /* p_sep_by_space */
1, /* n_cs_precedes */
1, /* n_sep_by_space */
1, /* p_sign_posn */
1, /* n_sign_posn */
};
MOZCE_SHUNT_API struct lconv * mozce_localeconv(void)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_localeconv called\n");
#endif
return &s_locale_conv;
}
MOZCE_SHUNT_API DWORD mozce_GetCurrentThreadId(void)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_GetCurrentThreadId called\n");
#endif
return GetCurrentThreadId();
}
MOZCE_SHUNT_API DWORD mozce_GetCurrentProcessId(void)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_GetCurrentProcessId called\n");
#endif
return GetCurrentProcessId();
}
MOZCE_SHUNT_API DWORD mozce_TlsAlloc(void)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_TlsAlloc called\n");
#endif
return TlsAlloc();
}
MOZCE_SHUNT_API BOOL mozce_TlsFree(DWORD dwTlsIndex)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_TlsFree called\n");
#endif
return TlsFree(dwTlsIndex);
}
MOZCE_SHUNT_API HANDLE mozce_GetCurrentProcess(void)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_GetCurrentProcess called\n");
#endif
return GetCurrentProcess();
}
#ifndef MIN
#define MIN(a,b) (((a)<(b)) ? (a) : (b))
#endif
MOZCE_SHUNT_API DWORD mozce_GetFullPathName(LPCSTR lpFileName,
#ifndef MAX
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
#endif
MOZCE_SHUNT_API DWORD mozce_GetFullPathName(const char* lpFileName,
DWORD nBufferLength,
LPCSTR lpBuffer,
LPCSTR* lpFilePart)
const char* lpBuffer,
const char** lpFilePart)
{
#ifdef DEBUG
mozce_printf("mozce_GetFullPathName called\n");
@@ -980,17 +953,44 @@ MOZCE_SHUNT_API DWORD mozce_GetFullPathName(LPCSTR lpFileName,
return len;
}
MOZCE_SHUNT_API DWORD mozce_MsgWaitForMultipleObjects(DWORD nCount, const HANDLE* pHandles, BOOL bWaitAll, DWORD dwMilliseconds, DWORD dwWakeMask)
static LONG gGetMessageTime = 0;
MOZCE_SHUNT_API BOOL mozce_GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_MsgWaitForMultipleObjects called\n");
mozce_printf("mozce_GetMessage called\n");
#endif
return MsgWaitForMultipleObjects(nCount, (HANDLE*) pHandles, bWaitAll, dwMilliseconds, dwWakeMask);
BOOL b = GetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMin);
if (b)
gGetMessageTime = lpMsg->time;
return b;
}
MOZCE_SHUNT_API BOOL mozce_PeekMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
{
MOZCE_PRECHECK
#ifdef LOUD_PEEKMESSAGE
#ifdef DEBUG
mozce_printf("mozce_PeekMessageA called\n");
#endif
#endif
BOOL b = PeekMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (b && wRemoveMsg == PM_REMOVE)
gGetMessageTime = lpMsg->time;
return b;
}
MOZCE_SHUNT_API LONG mozce_GetMessageTime(void)
{
MOZCE_PRECHECK
@@ -998,8 +998,8 @@ MOZCE_SHUNT_API LONG mozce_GetMessageTime(void)
#ifdef DEBUG
mozce_printf("mozce_GetMessageTime called\n");
#endif
// Close enough guess?
return GetTickCount();
return gGetMessageTime;
}
MOZCE_SHUNT_API UINT mozce_GetACP(void)
@@ -1026,6 +1026,17 @@ MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStrings(LPCTSTR lpSrc, LPTSTR lpDst
return 0;
}
MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStringsW(const unsigned short* lpSrc, const unsigned short* lpDst, DWORD nSize)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_ExpandEnvironmentStrings called\n");
#endif
return 0;
}
MOZCE_SHUNT_API BOOL mozce_GdiFlush(void)
{
MOZCE_PRECHECK
@@ -1033,6 +1044,163 @@ MOZCE_SHUNT_API BOOL mozce_GdiFlush(void)
return TRUE;
}
MOZCE_SHUNT_API BOOL mozce_GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT *lpwndpl)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_GetWindowPlacement called\n");
#endif
memset(lpwndpl, 0, sizeof(WINDOWPLACEMENT));
// This is wrong when the window is minimized.
lpwndpl->showCmd = SW_SHOWNORMAL;
GetWindowRect(hWnd, &lpwndpl->rcNormalPosition);
return TRUE;
}
MOZCE_SHUNT_API HINSTANCE mozce_ShellExecute(HWND hwnd,
LPCSTR lpOperation,
LPCSTR lpFile,
LPCSTR lpParameters,
LPCSTR lpDirectory,
INT nShowCmd)
{
LPTSTR op = a2w_malloc(lpOperation, -1, NULL);
LPTSTR file = a2w_malloc(lpFile, -1, NULL);
LPTSTR parm = a2w_malloc(lpParameters, -1, NULL);
LPTSTR dir = a2w_malloc(lpDirectory, -1, NULL);
SHELLEXECUTEINFO info;
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_NOCLOSEPROCESS;
info.hwnd = hwnd;
info.lpVerb = op;
info.lpFile = file;
info.lpParameters = parm;
info.lpDirectory = dir;
info.nShow = nShowCmd;
BOOL b = ShellExecuteEx(&info);
if (op)
free(op);
if (file)
free(file);
if (parm)
free(parm);
if (dir)
free(dir);
return (HINSTANCE) info.hProcess;
}
struct lconv s_locale_conv =
{
".", /* decimal_point */
",", /* thousands_sep */
"333", /* grouping */
"$", /* int_curr_symbol */
"$", /* currency_symbol */
"", /* mon_decimal_point */
"", /* mon_thousands_sep */
"", /* mon_grouping */
"+", /* positive_sign */
"-", /* negative_sign */
'2', /* int_frac_digits */
'2', /* frac_digits */
1, /* p_cs_precedes */
1, /* p_sep_by_space */
1, /* n_cs_precedes */
1, /* n_sep_by_space */
1, /* p_sign_posn */
1, /* n_sign_posn */
};
MOZCE_SHUNT_API struct lconv * mozce_localeconv(void)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_localeconv called\n");
#endif
return &s_locale_conv;
}
MOZCE_SHUNT_API BOOL mozce_AlphaBlend(
HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of upper-left corner
int nYOriginDest, // y-coord of upper-left corner
int nWidthDest, // destination width
int nHeightDest, // destination height
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of upper-left corner
int nYOriginSrc, // y-coord of upper-left corner
int nWidthSrc, // source width
int nHeightSrc, // source height
BLENDFUNCTION blendFunction // alpha-blending function
){
DWORD SCA = blendFunction.SourceConstantAlpha;
int w = MIN(nWidthSrc,nWidthDest);
int h = MIN(nHeightSrc, nHeightDest);
for ( int x = 0; x<= w; x++){
for( int y = 0; y<=h; y++){
COLORREF dc = GetPixel(hdcDest, nXOriginDest+x, nYOriginDest+y);
COLORREF sc = GetPixel(hdcSrc, nXOriginSrc+x, nYOriginSrc+y);
color Src,Dst;
Src.Red = GetRValue(sc);
Dst.Red = GetRValue(dc);
Src.Green = GetGValue(sc);
Dst.Green = GetGValue(dc);
Src.Blue = GetBValue(sc);
Dst.Blue = GetBValue(dc);
Src.Alpha = 1.0 - (double)((sc >> 24)/255.0);
Dst.Alpha = 1.0 - (double)((dc >> 24)/255.0);
//Src.Alpha = 1.0;//(double)((sc >> 24)/255.0);
//Dst.Alpha = 1.0;//(double)((dc >> 24)/255.0);
if(blendFunction.AlphaFormat & AC_SRC_ALPHA){
Dst.Red = (unsigned char)(Src.Red * (SCA/255.0) + Dst.Red * (1.0 - (SCA/255.0)));
Dst.Green = (unsigned char)(Src.Green * (SCA/255.0) + Dst.Green * (1.0 - (SCA/255.0)));
Dst.Blue = (unsigned char)(Src.Blue * (SCA/255.0) + Dst.Blue * (1.0 - (SCA/255.0)));
Dst.Alpha = MAX(0,MIN(1,Src.Alpha * (SCA/255.0) + Dst.Alpha * (1.0 - (SCA/255.0))));
}else if(SCA == 0xff){
Dst.Red = (unsigned char)(Src.Alpha*Src.Red + (1 - Src.Alpha) * Dst.Red);
Dst.Green = (unsigned char)(Src.Alpha*Src.Green + (1 - Src.Alpha) * Dst.Green);
Dst.Blue = (unsigned char)(Src.Alpha*Src.Blue + (1 - Src.Alpha) * Dst.Blue);
Dst.Alpha = MAX(0,MIN(1,Src.Alpha + (1 - Src.Alpha) * Dst.Alpha));
}else{
Src.Red = (unsigned char)(Src.Red * SCA / 255.0);
Src.Green = (unsigned char)(Src.Green * SCA / 255.0);
Src.Blue = (unsigned char)(Src.Blue * SCA / 255.0);
Src.Alpha = MAX(0,MIN(1,Src.Alpha * SCA / 255.0));
double t = (Src.Red + (1 - Src.Alpha) * Dst.Red);
Dst.Red = (unsigned char)(t>255?255:t);
t = (Src.Green + (1 - Src.Alpha) * Dst.Green);
Dst.Green = (unsigned char)(t>255?255:t);
t = (Src.Blue + (1 - Src.Alpha) * Dst.Blue);
Dst.Blue = (unsigned char)(t>255?255:t);
Dst.Alpha = MAX(0,MIN(1,Src.Alpha + (1 - Src.Alpha) * Dst.Alpha));
}
SetPixel(hdcDest,nXOriginDest+x, nYOriginDest+y, RGB(Dst.Red,Dst.Green,Dst.Blue));
//(((unsigned char)(Dst.Alpha*255) & 0xff) << 24)|
}
}
return true;
}
#if 0
{
#endif
@@ -1042,10 +1210,10 @@ void dumpMemoryInfo()
{
MEMORYSTATUS ms;
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&ms);
wprintf(L"-> %d %d %d %d %d %d %d\n",
ms.dwMemoryLoad,
ms.dwTotalPhys,

View File

@@ -237,24 +237,16 @@ MOZCE_SHUNT_API BOOL mozce_CreateProcessA(LPCSTR pszImageName, LPCSTR pszCmdLine
mozce_printf("mozce_CreateProcessA called\n");
#endif
BOOL retval = FALSE;
TCHAR pszImageNameW[MAX_PATH];
LPTSTR image = a2w_malloc(pszImageName, -1, NULL);
LPTSTR cmdline = a2w_malloc(pszCmdLine, -1, NULL);
if(a2w_buffer(pszImageName, -1, pszImageNameW, MAX_PATH))
{
LPTSTR pszCmdLineW = NULL;
BOOL retval = CreateProcessW(image, cmdline, NULL, NULL, FALSE, fdwCreate, NULL, NULL, NULL, pProcInfo);
pszCmdLineW = a2w_malloc(pszCmdLine, -1, NULL);
if(NULL != pszCmdLineW || NULL == pszCmdLine)
{
retval = CreateProcessW(pszImageNameW, pszCmdLineW, NULL, NULL, FALSE, fdwCreate, NULL, NULL, NULL, pProcInfo);
if(NULL != pszCmdLineW)
{
free(pszCmdLineW);
}
}
}
if (image)
free(image);
if (cmdline)
free(cmdline);
return retval;
}
@@ -423,7 +415,7 @@ MOZCE_SHUNT_API LONG mozce_RegQueryValueExA(HKEY inKey, LPCSTR inValueName, LPDW
MOZCE_SHUNT_API LONG mozce_RegSetValueExA(HKEY hKey, const char *valname, DWORD dwReserved, DWORD dwType, LPBYTE lpData, DWORD dwSize)
MOZCE_SHUNT_API LONG mozce_RegSetValueExA(HKEY hKey, const char *valname, DWORD dwReserved, DWORD dwType, const BYTE* lpData, DWORD dwSize)
{
MOZCE_PRECHECK
@@ -431,10 +423,10 @@ MOZCE_SHUNT_API LONG mozce_RegSetValueExA(HKEY hKey, const char *valname, DWORD
mozce_printf("mozce_RegSetValueExA called\n");
#endif
wchar_t valnamew[256];
unsigned short valnamew[256];
LONG res;
LPBYTE lpDataNew = lpData;
LPBYTE lpDataNew = (LPBYTE) lpData;
DWORD dwDataSize = dwSize;
MultiByteToWideChar(CP_ACP, 0, valname, -1, valnamew, charcount(valnamew));
@@ -444,7 +436,7 @@ MOZCE_SHUNT_API LONG mozce_RegSetValueExA(HKEY hKey, const char *valname, DWORD
dwDataSize = dwSize * 2;
lpDataNew = (LPBYTE) malloc(dwDataSize);
MultiByteToWideChar(CP_ACP, 0, (const char*) lpData, -1, (wchar_t *)lpDataNew, dwDataSize);
MultiByteToWideChar(CP_ACP, 0, (const char*) lpData, -1, (unsigned short *)lpDataNew, dwDataSize);
}
res = RegSetValueExW(hKey, valnamew, dwReserved, dwType, lpDataNew, dwDataSize);
@@ -472,7 +464,7 @@ MOZCE_SHUNT_API LONG mozce_RegCreateKeyExA(HKEY hKey, const char *subkey, DWORD
}
MOZCE_SHUNT_API LONG mozce_RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
MOZCE_SHUNT_API LONG mozce_RegDeleteValueA(HKEY hKey, const char* lpValueName)
{
MOZCE_PRECHECK
@@ -640,7 +632,7 @@ MOZCE_SHUNT_API HDC mozce_CreateDCA2(LPCSTR inDriver, LPCSTR inDevice, LPCSTR in
return retval;
}
MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, char* inStr, int inLen, int inMaxExtent, LPINT outFit, LPINT outDx, LPSIZE inSize)
MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, const char * inStr, int inLen, int inMaxExtent, LPINT outFit, LPINT outDx, LPSIZE inSize)
{
MOZCE_PRECHECK
@@ -650,13 +642,9 @@ MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, char* inStr, int inLe
BOOL retval = FALSE;
if (!inStr)
return retval;
inStr[inLen] = '\0';
LPTSTR wStr = a2w_malloc(inStr, inLen, NULL);
// BUG: if inString has any embedded nulls, this function will not produce the desired effect!
LPTSTR wStr = a2w_malloc(inStr, inLen, NULL);
if(NULL != wStr)
{
retval = GetTextExtentExPointW(inDC, wStr, inLen, inMaxExtent, outFit, outDx, inSize);
@@ -666,36 +654,43 @@ MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, char* inStr, int inLe
return retval;
}
MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOptions, const LPRECT inRect, LPCSTR inString, UINT inCount, const LPINT inDx)
MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOptions, LPCRECT inRect, const char* inString, UINT inCount, const LPINT inDx)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_ExtTextOutA called\n");
mozce_printf("mozce_ExtTextOutA (%s) called\n", inString);
#endif
BOOL retval = false;
if (inCount == -1)
inCount = strlen(inString);
inCount = strlen(inString);
int wLen = 0;
LPTSTR wStr = a2w_malloc(inString, inCount, &wLen);
if(NULL != wStr)
{
{
retval = ExtTextOutW(inDC, inX, inY, inOptions, inRect, wStr, wLen, inDx);
free(wStr);
wStr = NULL;
}
return retval;
}
MOZCE_SHUNT_API BOOL mozce_TextOutA(HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString)
MOZCE_SHUNT_API BOOL mozce_TextOutA(HDC hdc, int nXStart, int nYStart, const char* lpString, int cbString)
{
return mozce_ExtTextOutA(hdc, nXStart, nYStart, 0, NULL, lpString, cbString, NULL);
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_TextOutA (%s) called\n", lpString);
#endif
return mozce_ExtTextOutA(hdc, nXStart, nYStart, 0, NULL, lpString, cbString, NULL);
}
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineA(HDC inDC, CHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST mozce_MAT2* inMAT2)
@@ -974,23 +969,15 @@ MOZCE_SHUNT_API HWND mozce_FindWindowA(LPCSTR inClass, LPCSTR inWindow)
HWND retval = NULL;
LPTSTR wClass = a2w_malloc(inClass, -1, NULL);
if(NULL != wClass)
{
if(NULL == inWindow)
{
retval = FindWindow(wClass, NULL);
}
else
{
LPTSTR wWindow = a2w_malloc(inWindow, -1, NULL);
if(NULL != wWindow)
{
retval = FindWindow(wClass, wWindow);
free(wWindow);
}
}
LPTSTR wWindow = a2w_malloc(inWindow, -1, NULL);
retval = FindWindow(wClass, NULL);
if (wWindow)
free(wWindow);
if (wClass)
free(wClass);
}
return retval;
}
@@ -1056,7 +1043,7 @@ MOZCE_SHUNT_API LRESULT mozce_SendMessageA(HWND hWnd, UINT msg, WPARAM wParam, L
mozce_printf("mozce_SendMessageA called\n");
#endif
wchar_t *lpNewText = NULL;
unsigned short *lpNewText = NULL;
LRESULT res;
LPARAM lParamOrig = lParam;
@@ -1170,19 +1157,6 @@ MOZCE_SHUNT_API BOOL mozce_GetVersionExA(LPOSVERSIONINFOA lpv)
return TRUE;
}
MOZCE_SHUNT_API BOOL mozce_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
{
MOZCE_PRECHECK
#ifdef LOUD_PEEKMESSAGE
#ifdef DEBUG
mozce_printf("mozce_PeekMessageA called\n");
#endif
#endif
return PeekMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
}
MOZCE_SHUNT_API LRESULT mozce_DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
@@ -1388,15 +1362,45 @@ MOZCE_SHUNT_API FARPROC mozce_GetProcAddressA(HMODULE hMod, const char *name)
return p;
}
MOZCE_SHUNT_API HBITMAP mozce_LoadBitmapA(HINSTANCE hInstance, LPCSTR lpCursorName)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_LoadBitmapA called\n");
#endif
unsigned short *bitmapNameW;
HBITMAP hc;
if(lpCursorName > (LPCSTR) 0xFFFF)
{
int len = strlen(lpCursorName);
bitmapNameW = (unsigned short*)_alloca((len + 1) * 2);
MultiByteToWideChar(CP_ACP, 0, lpCursorName, -1, bitmapNameW, len + 1);
}
else
{
bitmapNameW = (LPWSTR) (LPSTR) lpCursorName;
}
hc = LoadBitmapW(hInstance, bitmapNameW);
return hc;
}
MOZCE_SHUNT_API HCURSOR mozce_LoadCursorA(HINSTANCE hInstance, LPCSTR lpCursorName)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_LoadCursorA called\n");
mozce_printf("-- mozce_LoadCursorA called\n");
#endif
return NULL;
wchar_t *lpCursorNameW;
unsigned short *lpCursorNameW;
HCURSOR hc;
if(lpCursorName > (LPCSTR) 0xFFFF)
@@ -1561,7 +1565,7 @@ MOZCE_SHUNT_API HANDLE mozce_CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttribute
#endif
HANDLE hEvent;
wchar_t *lpNameNew = NULL;
unsigned short *lpNameNew = NULL;
int len;
if(lpName)
@@ -1603,8 +1607,12 @@ MOZCE_SHUNT_API HMENU mozce_LoadMenuA(HINSTANCE hInstance, LPCSTR lpMenuName)
}
#ifdef GetProp
#undef GetProp
#endif
#define GetProp GetProp
MOZCE_SHUNT_API HANDLE mozce_GetPropA(HWND hWnd, LPCSTR lpString)
MOZCE_SHUNT_API HANDLE mozce_GetPropA(HWND hWnd, const char* lpString)
{
MOZCE_PRECHECK
@@ -1625,7 +1633,12 @@ MOZCE_SHUNT_API HANDLE mozce_GetPropA(HWND hWnd, LPCSTR lpString)
return h;
}
MOZCE_SHUNT_API BOOL mozce_SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
#ifdef SetProp
#undef SetProp
#endif
#define SetProp SetProp
MOZCE_SHUNT_API BOOL mozce_SetPropA(HWND hWnd, const char* lpString, HANDLE hData)
{
MOZCE_PRECHECK
@@ -1647,8 +1660,12 @@ MOZCE_SHUNT_API BOOL mozce_SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
}
return b;
}
#ifdef RemoveProp
#undef RemoveProp
#endif
#define RemoveProp RemoveProp
MOZCE_SHUNT_API HANDLE mozce_RemovePropA(HWND hWnd, LPCSTR lpString)
MOZCE_SHUNT_API HANDLE mozce_RemovePropA(HWND hWnd, const char* lpString)
{
MOZCE_PRECHECK
@@ -1661,7 +1678,7 @@ MOZCE_SHUNT_API HANDLE mozce_RemovePropA(HWND hWnd, LPCSTR lpString)
if (IS_INTRESOURCE(lpString))
return RemoveProp(hWnd, (const unsigned short *)lpString);
LPTSTR wString = a2w_malloc(lpString, -1, NULL);
unsigned short* wString = a2w_malloc(lpString, -1, NULL);
if (wString) {
h = RemoveProp(hWnd, wString);
free(wString);
@@ -1670,7 +1687,7 @@ MOZCE_SHUNT_API HANDLE mozce_RemovePropA(HWND hWnd, LPCSTR lpString)
}
MOZCE_SHUNT_API HANDLE mozce_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
MOZCE_SHUNT_API HANDLE mozce_FindFirstFileA(const char* lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
{
MOZCE_PRECHECK
@@ -1708,7 +1725,7 @@ MOZCE_SHUNT_API HANDLE mozce_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA
return h;
}
MOZCE_SHUNT_API BOOL mozce_FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
MOZCE_SHUNT_API BOOL mozce_FindNextFileA(HANDLE hFindFile, WIN32_FIND_DATAA* lpFindFileData)
{
MOZCE_PRECHECK
@@ -1875,7 +1892,7 @@ MyEnumFontFamProc(CONST LOGFONT *lf, CONST TEXTMETRIC *tm, DWORD fonttype, LPARA
return (*fn) (&lfw, tm, fonttype, parg->lParam);
}
MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam)
MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, const char* lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam)
{
MOZCE_PRECHECK
@@ -1884,7 +1901,7 @@ MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUM
#endif
MYENUMFONTFAMARG arg;
wchar_t *lpszFamilyW = NULL;
unsigned short *lpszFamilyW = NULL;
if(lpszFamily != NULL)
lpszFamilyW = a2w_malloc(lpszFamily, -1, NULL);
@@ -1901,7 +1918,7 @@ MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUM
}
MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, LPSTR lpFaceName)
MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, const char* lpFaceName)
{
MOZCE_PRECHECK
@@ -1920,7 +1937,7 @@ MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, LPSTR lpFaceName)
int res = GetTextFaceW(hdc, nCount, wBuffer);
if(res != GDI_ERROR && res != 0 && lpFaceName)
{
int result = w2a_buffer(wBuffer, -1, lpFaceName, nCount);
int result = w2a_buffer(wBuffer, -1, (char*)lpFaceName, nCount);
if (result == 0)
res = result;
@@ -1933,7 +1950,7 @@ MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, LPSTR lpFaceName)
return res;
}
MOZCE_SHUNT_API BOOL mozce_GetTextMetricsA(HDC hdc, LPTEXTMETRICA lptma)
MOZCE_SHUNT_API BOOL mozce_GetTextMetricsA(HDC hdc, TEXTMETRICA* lptma)
{
MOZCE_PRECHECK

View File

@@ -129,7 +129,7 @@ MOZCE_SHUNT_API HANDLE mozce_OpenSemaphoreW(DWORD inDesiredAccess, BOOL inInheri
}
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineW(HDC inDC, WCHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST mozce_MAT2* inMAT2)
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineW(HDC inDC, WCHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST VOID* inMAT2)
{
MOZCE_PRECHECK

View File

@@ -23,6 +23,8 @@ main(int argc, char **argv)
args[i++] = "/I\"" SHUNT_INC "\"";
args[i++] = "/FI\"mozce_shunt.h\"";
args[i++] = "/DMOZCE_STATIC_BUILD";
args[i++] = "/DARM";
args[i++] = "/DWINCE";
args[i++] = "/D_WIN32_WCE=420";
@@ -36,8 +38,10 @@ main(int argc, char **argv)
args[i++] = "/Gy"; // For link warning LNK1166
// args[i++] = "/Gf";
// args[i++] = "/GF";
// args[i++] = "/QRxscale";
args[i++] = "/Gf";
args[i++] = "/QRxscale";
// args[i++] = "/QRxscalesched";
// args[i++] = "/Ox";
@@ -82,6 +86,7 @@ main(int argc, char **argv)
args[i++] = "-ENTRY:mainACRTStartup";
args[i++] = "-SUBSYSTEM:WINDOWSCE,4.20";
args[i++] = "-ALIGN:\"4096\"";
args[i++] = "-MACHINE:ARM";
args[i++] = "-LIBPATH:\"" WCE_LIB "\"";
args[i++] = "-LIBPATH:\"" SHUNT_LIB "\"";

View File

@@ -29,9 +29,14 @@ main(int argc, char **argv)
args[i++] = "shunt.lib";
args[i++] = "ole32.lib";
args[i++] = "/NODEFAULTLIB:LIBC";
args[i++] = "/NODEFAULTLIB:OLDNAMES";
args[i++] = "/align:\"4096\"";
// args[i++] = "/STACK:0x5000000,0x100000";
// if -DLL is not passed, then change the entry to 'main'

View File

@@ -7,7 +7,7 @@
#define WCE_INC "c:/Program Files/Windows CE Tools/wce420/POCKET PC 2003/Include/Armv4/"
#define WCE_LIB "c:/Program Files/Windows CE Tools/wce420/POCKET PC 2003/Lib/Armv4/"
#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/ARMV4Rel/"
#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/static/ARMV4Dbg/"
#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
#define ASM_PATH WCE_BIN "armasm.exe"
@@ -18,23 +18,23 @@
#define MAX_NOLEAK_BUFFERS 100
char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
static int next_buffer = 0;
int argpath_conv(char **args_in, char **args_out)
{
int i = 0;
while (args_in[i])
{
args_out[i] = args_in[i];
if (args_in[i])
{
char *offset = strstr(args_out[i], "/cygdrive/c/");
char *offset = strstr(args_out[i], "/cygdrive/");
if (offset) {
strcpy(offset, offset+9);
offset[0] = 'c';
offset[0] = offset[1];
offset[1] = ':';
offset[2] = '/';
}