[xiph-commits] r15626 - in trunk/oggdsf/src/lib/helper: . wince wince/sys

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Sun Jan 18 11:52:32 PST 2009


Author: cristianadam
Date: 2009-01-18 11:52:31 -0800 (Sun, 18 Jan 2009)
New Revision: 15626

Added:
   trunk/oggdsf/src/lib/helper/wince/
   trunk/oggdsf/src/lib/helper/wince/direct.c
   trunk/oggdsf/src/lib/helper/wince/direct.h
   trunk/oggdsf/src/lib/helper/wince/errno.c
   trunk/oggdsf/src/lib/helper/wince/errno.h
   trunk/oggdsf/src/lib/helper/wince/fcntl.h
   trunk/oggdsf/src/lib/helper/wince/io.h
   trunk/oggdsf/src/lib/helper/wince/io_wce.c
   trunk/oggdsf/src/lib/helper/wince/string_wce.c
   trunk/oggdsf/src/lib/helper/wince/sys/
   trunk/oggdsf/src/lib/helper/wince/sys/stat.c
   trunk/oggdsf/src/lib/helper/wince/sys/stat.h
   trunk/oggdsf/src/lib/helper/wince/sys/types.h
   trunk/oggdsf/src/lib/helper/wince/sys/utime.c
   trunk/oggdsf/src/lib/helper/wince/sys/utime.h
   trunk/oggdsf/src/lib/helper/wince/time.h
   trunk/oggdsf/src/lib/helper/wince/time_wce.c
   trunk/oggdsf/src/lib/helper/wince/wince-2005.sln
   trunk/oggdsf/src/lib/helper/wince/wince-2005.vcproj
   trunk/oggdsf/src/lib/helper/wince/wince.c
   trunk/oggdsf/src/lib/helper/wince/wince.h
Log:
Added wince project containing some missing POSIX functionality from Windows CE. Code was taken from Ruby project. Code has the following license "You can freely use, copy, modify, and redistribute the whole contents.". Needed to compile FLAC on Windows CE.

Added: trunk/oggdsf/src/lib/helper/wince/direct.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/direct.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/direct.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,54 @@
+/***************************************************************
+  direct.c
+***************************************************************/
+
+#include <windows.h>
+#include <tchar.h>
+#include <direct.h>
+#include "wince.h" /* for wce_mbtowc */
+
+/* global for chdir, getcwd */
+char _currentdir[MAX_PATH+1];
+
+
+char *getcwd(char* buffer, int maxlen)
+{
+	strcpy( buffer, _currentdir );
+	return buffer;
+}
+
+int _chdir(const char * dirname)
+{
+	if( MAX_PATH < strlen(dirname) )
+		return -1;
+
+	strcpy( _currentdir, dirname );
+	return 0;
+}
+
+int _rmdir(const char * dir)
+{
+	wchar_t *wdir;
+	BOOL rc;
+
+	/* replace with RemoveDirectory. */
+	wdir = wce_mbtowc(dir);
+	rc = RemoveDirectoryW(wdir);
+	free(wdir);
+
+	return rc==TRUE ? 0 : -1;
+}
+
+int _mkdir(const char * dir)
+{
+	wchar_t* wdir;
+	BOOL rc;
+
+	/* replace with CreateDirectory. */
+	wdir = wce_mbtowc(dir);
+	rc = CreateDirectoryW(wdir, NULL);
+	free(wdir);
+
+	return rc==TRUE ? 0 : -1;
+}
+

Added: trunk/oggdsf/src/lib/helper/wince/direct.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/direct.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/direct.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,22 @@
+#ifndef DIRECT_H
+#define DIRECT_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *getcwd(char* buffer, int maxlen);
+int _chdir(const char * dirname);
+int _rmdir(const char * dir);
+int _mkdir(const char * dir);
+
+#ifdef __cplusplus
+};
+#endif
+
+#define chdir      _chdir
+#define rmdir      _rmdir
+#define mkdir      _mkdir
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/errno.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/errno.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/errno.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,11 @@
+/***************************************************************
+  errno.c
+***************************************************************/
+
+#include <errno.h>
+
+
+int errno;
+int _doserrno;
+int _sys_nerr;
+

Added: trunk/oggdsf/src/lib/helper/wince/errno.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/errno.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/errno.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,55 @@
+#ifndef ERRNO_H
+#define ERRNO_H 1
+
+
+#define EPERM           1
+#define ENOENT          2
+#define ESRCH           3
+#define EINTR           4
+#define EIO             5
+#define ENXIO           6
+#define E2BIG           7
+#define ENOEXEC         8
+#define EBADF           9
+#define ECHILD          10
+#define EAGAIN          11
+#define ENOMEM          12
+#define EACCES          13
+#define EFAULT          14
+#define EOSERR          15 // rk
+#define EBUSY           16
+#define EEXIST          17
+#define EXDEV           18
+#define ENODEV          19
+#define ENOTDIR         20
+#define EISDIR          21
+#define EINVAL          22
+#define ENFILE          23
+#define EMFILE          24
+#define ENOTTY          25
+#define EFBIG           27
+#define ENOSPC          28
+#define ESPIPE          29
+#define EROFS           30
+#define EMLINK          31
+#define EPIPE           32
+#define EDOM            33
+#define ERANGE          34
+#define EDEADLK         36
+#define ENOSYS          37
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int errno;
+extern int _doserrno;
+extern int _sys_nerr;
+
+#define sys_nerr _sys_nerr
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/fcntl.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/fcntl.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/fcntl.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,42 @@
+
+#ifndef FCNTL_H
+#define FCNTL_H 1
+
+
+#define F_SETFL         1
+#define F_SETFD         2
+#define F_GETFL         3
+
+#define _O_RDONLY       0x0000  /* open for reading only */
+#define _O_WRONLY       0x0001  /* open for writing only */
+#define _O_RDWR         0x0002  /* open for reading and writing */
+
+#define _O_NONBLOCK     0x0004
+
+#define _O_APPEND       0x0008  /* writes done at eof */
+#define _O_CREAT        0x0100  /* create and open file */
+#define _O_TRUNC        0x0200  /* open and truncate */
+#define _O_EXCL         0x0400  /* open only if file doesn't already exist */
+#define _O_TEXT         0x4000  /* file mode is text (translated) */
+#define _O_BINARY       0x8000  /* file mode is binary (untranslated) */
+#define _O_ACCMODE      0x10000
+
+#define _O_NOINHERIT    0
+#define O_NOINHERIT     _O_NOINHERIT
+
+#define O_RDONLY        _O_RDONLY
+#define O_WRONLY        _O_WRONLY
+#define O_RDWR          _O_RDWR
+
+#define O_NONBLOCK      _O_NONBLOCK
+
+#define O_APPEND        _O_APPEND
+#define O_CREAT         _O_CREAT
+#define O_TRUNC         _O_TRUNC
+#define O_EXCL          _O_EXCL
+#define O_TEXT          _O_TEXT
+#define O_BINARY        _O_BINARY
+#define O_ACCMODE       _O_ACCMODE
+
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/io.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/io.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/io.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,76 @@
+
+#ifndef _IO_WINCE_H_
+#define _IO_WINCE_H_
+
+#ifndef _TIME_T_DEFINED
+typedef unsigned long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
+#define _FSIZE_T_DEFINED
+#endif
+
+#ifndef _FINDDATA_T_DEFINED
+struct _finddata_t {
+        unsigned    attrib;
+        time_t      time_create;    /* -1 for FAT file systems */
+        time_t      time_access;    /* -1 for FAT file systems */
+        time_t      time_write;
+        _fsize_t    size;
+        char        name[260];
+};
+#define _FINDDATA_T_DEFINED
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int _chsize(int handle, long size);
+int _rename (const char *oldname, const char *newname);
+int _unlink(const char *file);
+int _umask(int cmask);
+int _chmod(const char *path, int mode);
+int dup( int handle );
+//int dup2( int handle1, int handle2 );
+int _isatty(int fd);
+int _pipe(int *phandles, unsigned int psize, int textmode);
+int _access(const char *filename, int flags);
+int _open_osfhandle ( long osfhandle, int flags);
+long _get_osfhandle( int filehandle );
+int _open(const char *file, int mode,...);
+int close(int fd);
+int _read(int fd, void *buffer, int length);
+int _write(int fd, const void *buffer, unsigned count);
+long _lseek(int handle, long offset, int origin);
+long _findfirst( char *filespec, struct _finddata_t *fileinfo );
+int _findnext( long handle, struct _finddata_t *fileinfo );
+int _findclose( long handle );
+
+#ifdef __cplusplus
+};
+#endif
+
+#define chmod      _chmod
+#define chsize     _chsize
+#define rename     _rename
+#define unlink	   _unlink
+#define open	   _open
+//#define close	   _close
+#define read	   _read
+#define write	   _write
+#define umask	   _umask
+//#define dup        _dup
+#define isatty	   _isatty
+#define access	   _access
+#define pipe       _pipe
+#define setmode    _setmode
+#define lseek      _lseek
+
+#define _close	   close
+
+#endif
+

Added: trunk/oggdsf/src/lib/helper/wince/io_wce.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/io_wce.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/io_wce.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,230 @@
+/***************************************************************
+  io.c
+
+  author : uema2
+  date   : Nov 30, 2002
+
+  You can freely use, copy, modify, and redistribute
+  the whole contents.
+***************************************************************/
+
+#include <windows.h>
+#include <stdlib.h>
+#include <io.h>
+#include <fcntl.h>
+#include <time.h>
+#include <errno.h>
+#include "wince.h" /* for wce_mbtowc */
+
+extern int _errno;
+
+
+int _rename(const char *oldname, const char *newname)
+{
+	wchar_t *wold, *wnew;
+	BOOL rc;
+
+	wold = wce_mbtowc(oldname);
+	wnew = wce_mbtowc(newname);
+
+	/* replace with MoveFile. */
+	rc = MoveFileW(wold, wnew);
+
+	free(wold);
+	free(wnew);
+
+	return rc==TRUE ? 0 : -1;
+}
+
+int _unlink(const char *file)
+{
+	wchar_t *wfile;
+	BOOL rc;
+
+	/* replace with DeleteFile. */
+	wfile = wce_mbtowc(file);
+	rc = DeleteFileW(wfile);
+	free(wfile);
+
+	return rc==TRUE ? 0 : -1;
+}
+
+/* replace "open" with "CreateFile", etc. */
+int _open(const char *file, int mode, va_list arg)
+{
+	wchar_t *wfile;
+	DWORD access=0, share=0, create=0;
+	HANDLE h;
+
+	if( (mode&_O_RDWR) != 0 )
+		access = GENERIC_READ|GENERIC_WRITE;
+	else if( (mode&_O_RDONLY) != 0 )
+		access = GENERIC_READ;
+	else if( (mode&_O_WRONLY) != 0 )
+		access = GENERIC_WRITE;
+
+	if( (mode&_O_CREAT) != 0 )
+		create = CREATE_ALWAYS;
+	else
+		create = OPEN_ALWAYS;
+
+	wfile = wce_mbtowc(file);
+
+	h = CreateFileW(wfile, access, share, NULL,
+			create, 0, NULL );
+
+	free(wfile);
+	return (int)h;
+}
+
+int close(int fd)
+{
+	CloseHandle( (HANDLE)fd );
+	return 0;
+}
+
+int _read(int fd, void *buffer, int length)
+{
+	DWORD dw;
+	ReadFile( (HANDLE)fd, buffer, length, &dw, NULL );
+	return (int)dw;
+}
+
+int _write(int fd, const void *buffer, unsigned count)
+{
+	DWORD dw;
+	WriteFile( (HANDLE)fd, buffer, count, &dw, NULL );
+	return (int)dw;
+}
+
+long _lseek(int handle, long offset, int origin)
+{
+	DWORD flag, ret;
+
+	switch(origin)
+	{
+	case SEEK_SET: flag = FILE_BEGIN;   break;
+	case SEEK_CUR: flag = FILE_CURRENT; break;
+	case SEEK_END: flag = FILE_END;     break;
+	default:       flag = FILE_CURRENT; break;
+	}
+
+	ret = SetFilePointer( (HANDLE)handle, offset, NULL, flag );
+	return ret==0xFFFFFFFF ? -1 : 0;
+}
+
+/* _findfirst, _findnext, _findclose. */
+/* replace them with FindFirstFile, etc. */
+long _findfirst( char *file, struct _finddata_t *fi )
+{
+	HANDLE h;
+	WIN32_FIND_DATAA fda;
+
+	h = FindFirstFileA( file, &fda );
+	if( h==NULL )
+	{
+		errno = EINVAL; return -1;
+	}
+
+	fi->attrib      = fda.dwFileAttributes;
+	fi->time_create = wce_FILETIME2time_t( &fda.ftCreationTime );
+	fi->time_access = wce_FILETIME2time_t( &fda.ftLastAccessTime );
+	fi->time_write  = wce_FILETIME2time_t( &fda.ftLastWriteTime );
+	fi->size        = fda.nFileSizeLow + (fda.nFileSizeHigh<<32);
+	strcpy( fi->name, fda.cFileName );
+
+	return (long)h;
+}
+
+int _findnext( long handle, struct _finddata_t *fi )
+{
+	WIN32_FIND_DATAA fda;
+	BOOL b;
+
+	b = FindNextFileA( (HANDLE)handle, &fda );
+
+	if( b==FALSE )
+	{
+		errno = ENOENT; return -1;
+	}
+
+	fi->attrib      = fda.dwFileAttributes;
+	fi->time_create = wce_FILETIME2time_t( &fda.ftCreationTime );
+	fi->time_access = wce_FILETIME2time_t( &fda.ftLastAccessTime );
+	fi->time_write  = wce_FILETIME2time_t( &fda.ftLastWriteTime );
+	fi->size        = fda.nFileSizeLow + (fda.nFileSizeHigh<<32);
+	strcpy( fi->name, fda.cFileName );
+
+	return 0;
+}
+
+int _findclose( long handle )
+{
+	BOOL b;
+	b = FindClose( (HANDLE)handle );
+	return b==FALSE ? -1 : 0;
+}
+
+/* below functions unsupported... */
+/* I have no idea how to replace... */
+int _chsize(int handle, long size)
+{
+	errno = EACCES;
+	return -1;
+}
+
+int _umask(int cmask)
+{
+	return 0;
+}
+
+int _chmod(const char *path, int mode)
+{
+	return 0;
+}
+
+/* WinCE doesn't have dup and dup2.  */
+/* so, we cannot use missing/dup2.c. */
+int dup( int handle )
+{
+	errno = EBADF;
+	return -1;
+}
+/*
+int dup2( int handle1, int handle2 )
+{
+	errno = EBADF;
+	return -1;
+}
+*/
+int _isatty(int fd)
+{
+	if( fd==(int)_fileno(stdin) || 
+		fd==(int)_fileno(stdout)||
+		fd==(int)_fileno(stderr) )
+		return 1;
+	else
+		return 0;
+}
+
+int _pipe(int *phandles, unsigned int psize, int textmode)
+{
+	return -1;
+}
+
+int _access(const char *filename, int flags)
+{
+	return 0;
+}
+
+int _open_osfhandle( long osfhandle, int flags)
+{
+/*	return 0; */
+	return (int)osfhandle;
+}
+
+long _get_osfhandle( int filehandle )
+{
+/*	return 0; */
+	return (long)filehandle;
+}

Added: trunk/oggdsf/src/lib/helper/wince/string_wce.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/string_wce.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/string_wce.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,89 @@
+/***************************************************************
+  string.c
+***************************************************************/
+
+#include <windows.h>
+#include "wince.h" /* for wce_mbtowc */
+
+/* _strdup already exists in stdlib.h? */
+char *strdup(const char * str)
+{
+	char *p;
+
+	p = malloc( strlen(str)+1 );
+	strcpy( p, str );
+	return p;
+}
+
+char* strerror(int errno)
+{
+	static char buf[32]="wince::strerror called.";
+	return buf;
+}
+
+/* strnicmp already exists in stdlib.h? */
+int strnicmp( const char *s1, const char *s2, size_t count )
+{
+	wchar_t *w1, *w2;
+	int n;
+
+	w1 = wce_mbtowc(s1);
+	w2 = wce_mbtowc(s2);
+
+	n = wcsnicmp(w1, w2, count);
+
+	free(w1);
+	free(w2);
+
+	return n;
+}
+
+#if _WIN32_WCE < 300
+#include "..\missing\strtoul.c"
+
+char *strrchr( const char *p, int c )
+{
+	char *pp;
+	for( pp=(char*)p+strlen(p); pp!=p; pp-- )
+	{
+		if( *pp==c ) break;
+	}
+	return pp==p ? NULL : pp;
+}
+
+int stricmp( const char *s1, const char *s2 )
+{
+	wchar_t *w1, *w2;
+	int n;
+
+	w1 = wce_mbtowc(s1);
+	w2 = wce_mbtowc(s2);
+
+	n = wcsicmp(w1, w2);
+
+	free(w1);
+	free(w2);
+
+	return n;
+}
+
+char *strpbrk(const char *str, const char *cs)
+{
+	wchar_t *wstr, *wcs, *w;
+	char *s = NULL;
+
+	wstr = wce_mbtowc(str);
+	wcs  = wce_mbtowc(cs);
+
+	w = wcspbrk(wstr, wcs);
+
+	if( w!=NULL )
+		s = str + (wcs-wstr)/sizeof(wchar_t);
+
+	free(wstr);
+	free(wcs);
+
+	return s;
+}
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/sys/stat.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/sys/stat.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/sys/stat.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,102 @@
+/***************************************************************
+  stat.c
+
+  author : uema2
+  date   : Nov 30, 2002
+
+  You can freely use, copy, modify, and redistribute
+  the whole contents.
+***************************************************************/
+
+#include <windows.h>
+#include <sys/stat.h>
+#include <time.h>
+#include "..\wince.h" /* for wce_mbtowc */
+
+
+int _stat(const char *filename, struct _stat *st)
+{
+	DWORD dwAttribute;
+	HANDLE h;
+	DWORD dwSizeLow=0, dwSizeHigh=0, dwError=0;
+	WIN32_FIND_DATAW fd;
+	wchar_t *wfilename;
+
+//	wfilename = wce_mbtowc(filename);
+	wfilename = wce_replaceRelativeDir(filename);
+
+	dwAttribute = GetFileAttributesW(wfilename);
+	if(dwAttribute==0xFFFFFFFF)
+	{
+		free(wfilename);
+		return -1;
+	}
+
+	st->st_mode = 0;
+	if((dwAttribute & FILE_ATTRIBUTE_DIRECTORY) != 0)
+		st->st_mode += S_IFDIR;
+	else
+		st->st_mode += S_IFREG;
+
+	/* initialize */
+	st->st_atime = 0;
+    st->st_mtime = 0;
+    st->st_ctime = 0;
+	st->st_size  = 0;
+	st->st_dev   = 0;
+
+	h = FindFirstFileW(wfilename, &fd);
+	if(h == INVALID_HANDLE_VALUE)
+	{
+		if(wfilename[wcslen(wfilename)-1]	== L'\\')
+		{
+			wfilename[wcslen(wfilename)-1] = L'\0';
+			h = FindFirstFileW(wfilename, &fd);
+			if(h == INVALID_HANDLE_VALUE)
+			{
+				free(wfilename);
+				return 0;
+			}
+		}
+		else
+		{
+			free(wfilename);
+			return 0;
+		}
+	}
+
+	/* FILETIME -> time_t */
+	st->st_atime = wce_FILETIME2time_t(&fd.ftLastAccessTime);
+    st->st_mtime = wce_FILETIME2time_t(&fd.ftLastWriteTime);
+    st->st_ctime = wce_FILETIME2time_t(&fd.ftCreationTime);
+	st->st_size  = fd.nFileSizeLow;
+
+	FindClose( h );
+	free(wfilename);
+	return 0;
+}
+
+int fstat(int file, struct stat *sbuf)
+{
+	/* GetFileSize & GetFileTime */
+	DWORD dwSize;
+	FILETIME ctime, atime, mtime;
+
+	dwSize = GetFileSize( (HANDLE)file, NULL );
+	if( dwSize == 0xFFFFFFFF )
+		return -1;
+
+	sbuf->st_size = dwSize;
+	sbuf->st_dev  = 0;
+	sbuf->st_rdev = 0;
+	sbuf->st_mode = _S_IFREG;
+	sbuf->st_nlink= 1;
+
+	GetFileTime( (HANDLE)file, &ctime, &atime, &mtime );
+	sbuf->st_ctime = wce_FILETIME2time_t(&ctime);
+	sbuf->st_atime = wce_FILETIME2time_t(&atime);
+	sbuf->st_mtime = wce_FILETIME2time_t(&mtime);
+
+	return 0;
+}
+

Added: trunk/oggdsf/src/lib/helper/wince/sys/stat.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/sys/stat.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/sys/stat.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,68 @@
+#ifndef SYS_STAT_H
+#define SYS_STAT_H 1
+
+#include <sys/types.h>
+
+#define _S_IFMT         0170000         /* file type mask */
+#define _S_IFDIR        0040000         /* directory */
+#define _S_IFCHR        0020000         /* character special */
+#define _S_IFIFO        0010000         /* pipe */
+#define _S_IFREG        0100000         /* regular */
+#define _S_IREAD        0000400         /* read permission, owner */
+#define _S_IWRITE       0000200         /* write permission, owner */
+#define _S_IEXEC        0000100         /* execute/search permission, owner */
+
+#define S_IFMT   _S_IFMT
+#define S_IFREG  _S_IFREG
+#define S_IFCHR  _S_IFCHR
+#define S_IFDIR  _S_IFDIR
+#define S_IREAD  _S_IREAD
+#define S_IWRITE _S_IWRITE
+#define S_IEXEC  _S_IEXEC
+
+#ifndef S_ISDIR
+#define S_ISDIR(X) (((X) & S_IFMT) == S_IFDIR)
+#endif
+#ifndef S_ISREG
+#define S_ISREG(X) (((X) & S_IFMT) == S_IFREG)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// in sys/types.h
+//typedef unsigned int _dev_t;
+//typedef long _off_t;
+//typedef unsigned short _ino_t;
+
+#ifndef _STAT_DEFINED
+struct stat 
+{
+  dev_t st_dev;
+  ino_t st_ino;
+  unsigned short st_mode;
+  short st_nlink;
+  short st_uid;
+  short st_gid;
+  dev_t st_rdev;
+  off_t st_size;
+  time_t st_atime;
+  time_t st_mtime;
+  time_t st_ctime;
+};
+#define _STAT_DEFINED
+#endif /* _STAT_DEFINED */
+
+#define _stat stat
+
+int _stat(const char *filename, struct _stat *stat);
+int fstat(int file, struct stat *sbuf);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/sys/types.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/sys/types.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/sys/types.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,60 @@
+#ifndef SYS_TYPES_H
+#define SYS_TYPES_H 1
+
+#define BIG_ENDIAN    1234
+#define LITTLE_ENDIAN 4321
+
+#ifdef MIPS
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
+//#if UNDER_CE > 201
+//  typedef unsigned long time_t;
+//  #define _TIME_T_DEFINED_
+//#endif
+typedef unsigned long dev_t;
+typedef unsigned long ino_t;
+#ifndef _MODE_T_DEFINED_
+  typedef unsigned long mode_t;
+  #define _MODE_T_DEFINED_
+#endif
+
+typedef long clock_t;
+
+#ifndef _PTRDIFF_T_DEFINED
+typedef long ptrdiff_t;
+#define _PTRDIFF_T_DEFINED
+#endif
+
+typedef long off_t;
+
+//typedef unsigned char u_char;
+//typedef unsigned short u_short;
+
+#ifndef _CADDR_T_DEFINED_
+typedef unsigned char * caddr_t;
+#define _CADDR_T_DEFINED_
+#endif
+
+#ifndef _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED_
+#endif
+
+//typedef unsigned char u_int8_t;
+
+//typedef short int16_t;
+//typedef unsigned short u_int16_t;
+
+//typedef int int32_t;
+//typedef unsigned int u_int32_t;
+
+//typedef unsigned long u_long;
+//typedef unsigned int u_int;
+
+//#ifndef _TIME_T_DEFINED_
+//typedef unsigned long time_t;
+//#define _TIME_T_DEFINED_
+//#endif
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/sys/utime.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/sys/utime.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/sys/utime.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,44 @@
+/***************************************************************
+  utime.c
+***************************************************************/
+
+#include <windows.h>
+#include <sys/utime.h>
+#include "..\wince.h" /* for wce_mbtowc */
+
+
+#ifdef _WIN32_WCE
+  #if _WIN32_WCE < 300
+    #define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
+/*    #define Int32x32To64(a, b) ((__int64)((LONG)(a)) * (__int64)((LONG)(b))) */
+  #endif
+#endif
+
+int utime(const char *f, struct utimbuf *t)
+{
+	HANDLE h;
+	FILETIME atime={0}, mtime={0};
+	__int64 time64;
+	BOOL rc;
+	wchar_t *w;
+
+	w = wce_mbtowc(f);
+	h = CreateFileW(w, GENERIC_WRITE, 
+			FILE_SHARE_READ|FILE_SHARE_WRITE,
+			NULL, OPEN_EXISTING, 0, 0);
+	free(w);
+
+	if( h==INVALID_HANDLE_VALUE )
+		return -1;
+
+	time64 = Int32x32To64(t->actime, 10000000) + 116444736000000000;
+	atime.dwLowDateTime  = (DWORD)time64;
+	atime.dwHighDateTime = (DWORD)(time64 >> 32);
+	time64 = Int32x32To64(t->modtime, 10000000) + 116444736000000000;
+	mtime.dwLowDateTime  = (DWORD)time64;
+	mtime.dwHighDateTime = (DWORD)(time64 >> 32);
+
+	rc = SetFileTime(h, NULL, &atime, &mtime);
+	return rc==TRUE ? 0 : -1;
+}
+

Added: trunk/oggdsf/src/lib/helper/wince/sys/utime.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/sys/utime.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/sys/utime.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,27 @@
+#ifndef SYS_UTIME_H
+#define SYS_UTIME_H 1
+
+#include <time.h>
+
+struct utimbuf 
+{
+  time_t actime;
+  time_t modtime;
+};
+
+#define _utimbuf utimbuf
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int utime(const char *f, struct utimbuf *t);
+
+#ifdef __cplusplus
+};
+#endif
+
+//#define utime _utime
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/time.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/time.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/time.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,63 @@
+#ifndef _TIME_WINCE_H
+#define _TIME_WINCE_H 1
+
+#include <winbase.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int daylight;
+extern int _timezone, timezone;
+extern char *tzname[2];
+
+#if 0
+#define _DAY_SEC           (24L * 60L * 60L)    /* secs in a day */
+#define _YEAR_SEC          (365L * _DAY_SEC)    /* secs in a year */
+#define _FOUR_YEAR_SEC     (1461L * _DAY_SEC)   /* secs in a 4 year interval */
+#define _DEC_SEC           315532800L           /* secs in 1970-1979 */
+#define _BASE_YEAR         70L                  /* 1970 is the base year */
+#define _BASE_DOW          4                    /* 01-01-70 was a Thursday */
+#define _LEAP_YEAR_ADJUST  17L                  /* Leap years 1900 - 1970 */
+#define _MAX_YEAR          138L                 /* 2038 is the max year */
+#endif
+
+#ifndef _TM_DEFINED
+struct tm {
+  int tm_sec;     /* seconds after the minute - [0,59] */
+  int tm_min;     /* minutes after the hour - [0,59] */
+  int tm_hour;    /* hours since midnight - [0,23] */
+  int tm_mday;    /* day of the month - [1,31] */
+  int tm_mon;     /* months since January - [0,11] */
+  int tm_year;    /* years since 1900 */
+  int tm_wday;    /* days since Sunday - [0,6] */
+  int tm_yday;    /* days since January 1 - [0,365] */
+  int tm_isdst;   /* daylight savings time flag */
+};
+#define _TM_DEFINED
+#endif
+
+
+typedef struct {
+		int  yr;        // year of interest
+		int  yd;        // day of year 
+		long ms;        // milli-seconds in the day 
+} transitionTime;
+
+time_t mktime(struct tm* pt);
+time_t time( time_t *timer );
+struct tm *localtime(const time_t *ptime);
+struct tm *gmtime(const time_t *tod);
+char* ctime( const time_t *t );
+char* asctime(const struct tm *tptr);
+void tzset();
+int clock(void);
+time_t wce_FILETIME2time_t(const FILETIME* pf);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif

Added: trunk/oggdsf/src/lib/helper/wince/time_wce.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/time_wce.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/time_wce.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,301 @@
+/***************************************************************
+  time.c
+
+  author : uema2
+  date   : Nov 30, 2002
+
+  You can freely use, copy, modify, and redistribute
+  the whole contents.
+***************************************************************/
+
+/*#define __SCRATCH_TIMEC_DEBUG__ */
+
+#include <windows.h>
+#include <tchar.h>
+#include <time.h>
+
+/* globals */
+const __int64 _onesec_in100ns = (__int64)10000000;
+int   timezone, _timezone, altzone;
+int   daylight;
+char *tzname[2];
+
+
+/* __int64 <--> FILETIME */
+static __int64 wce_FILETIME2int64(FILETIME f)
+{
+	__int64 t;
+
+	t = f.dwHighDateTime;
+	t <<= 32;
+	t |= f.dwLowDateTime;
+	return t;
+}
+
+static FILETIME wce_int642FILETIME(__int64 t)
+{
+	FILETIME f;
+
+	f.dwHighDateTime = (DWORD)((t >> 32) & 0x00000000FFFFFFFF);
+	f.dwLowDateTime  = (DWORD)( t        & 0x00000000FFFFFFFF);
+	return f;
+}
+
+/* FILETIME utility */
+static FILETIME wce_getFILETIMEFromYear(WORD year)
+{
+	SYSTEMTIME s={0};
+	FILETIME f;
+
+	s.wYear      = year;
+	s.wMonth     = 1;
+	s.wDayOfWeek = 1;
+	s.wDay       = 1;
+
+	SystemTimeToFileTime( &s, &f );
+	return f;
+}
+
+static time_t wce_getYdayFromSYSTEMTIME(const SYSTEMTIME* s)
+{
+	__int64 t;
+	FILETIME f1, f2;
+
+	f1 = wce_getFILETIMEFromYear( s->wYear );
+	SystemTimeToFileTime( s, &f2 );
+
+	t = wce_FILETIME2int64(f2)-wce_FILETIME2int64(f1);
+
+	return (time_t)((t/_onesec_in100ns)/(60*60*24));
+}
+
+/* tm <--> SYSTEMTIME */
+static SYSTEMTIME wce_tm2SYSTEMTIME(struct tm *t)
+{
+	SYSTEMTIME s;
+
+	s.wYear      = t->tm_year + 1900;
+	s.wMonth     = t->tm_mon  + 1;
+	s.wDayOfWeek = t->tm_wday;
+	s.wDay       = t->tm_mday;
+	s.wHour      = t->tm_hour;
+	s.wMinute    = t->tm_min;
+	s.wSecond    = t->tm_sec;
+	s.wMilliseconds = 0;
+
+	return s;
+}
+
+static struct tm wce_SYSTEMTIME2tm(SYSTEMTIME *s)
+{
+	struct tm t;
+
+	t.tm_year  = s->wYear - 1900;
+	t.tm_mon   = s->wMonth- 1;
+	t.tm_wday  = s->wDayOfWeek;
+	t.tm_mday  = s->wDay;
+	t.tm_yday  = wce_getYdayFromSYSTEMTIME(s);
+	t.tm_hour  = s->wHour;
+	t.tm_min   = s->wMinute;
+	t.tm_sec   = s->wSecond;
+	t.tm_isdst = 0;
+
+	return t;
+}
+
+/* FILETIME <--> time_t */
+time_t wce_FILETIME2time_t(const FILETIME* f)
+{
+	FILETIME f1601, f1970;
+	__int64 t, offset;
+
+	f1601 = wce_getFILETIMEFromYear(1601);
+	f1970 = wce_getFILETIMEFromYear(1970);
+
+	offset = wce_FILETIME2int64(f1970) - wce_FILETIME2int64(f1601);
+
+	t = wce_FILETIME2int64(*f);
+
+	t -= offset;
+	return (time_t)(t / _onesec_in100ns);
+}
+
+FILETIME wce_time_t2FILETIME(const time_t t)
+{
+	FILETIME f, f1970;
+	__int64 time;
+
+	f1970 = wce_getFILETIMEFromYear(1970);
+
+	time = t;
+	time *= _onesec_in100ns;
+	time += wce_FILETIME2int64(f1970);
+
+	f = wce_int642FILETIME(time);
+
+	return f;
+}
+
+/* time.h difinition */
+time_t time( time_t *timer )
+{
+	SYSTEMTIME s;
+	FILETIME   f;
+
+	if( timer==NULL ) return 0;
+
+	GetSystemTime( &s );
+
+	SystemTimeToFileTime( &s, &f );
+
+	*timer = wce_FILETIME2time_t(&f);
+	return *timer;
+}
+
+struct tm *localtime( const time_t *timer )
+{
+	SYSTEMTIME ss, ls, s;
+	FILETIME   sf, lf, f;
+	__int64 t, diff;
+	static struct tm tms;
+
+	GetSystemTime(&ss);
+	GetLocalTime(&ls);
+
+	SystemTimeToFileTime( &ss, &sf );
+	SystemTimeToFileTime( &ls, &lf );
+
+	diff = wce_FILETIME2int64(sf) - wce_FILETIME2int64(lf);
+
+	f = wce_time_t2FILETIME(*timer);
+	t = wce_FILETIME2int64(f) - diff;
+	f = wce_int642FILETIME(t);
+
+	FileTimeToSystemTime( &f, &s );
+
+	tms = wce_SYSTEMTIME2tm(&s);
+
+	return &tms;
+}
+
+time_t mktime(struct tm* pt)
+{
+	SYSTEMTIME ss, ls, s;
+	FILETIME   sf, lf, f;
+	__int64 diff;
+
+	GetSystemTime(&ss);
+	GetLocalTime(&ls);
+	SystemTimeToFileTime( &ss, &sf );
+	SystemTimeToFileTime( &ls, &lf );
+
+	diff = (wce_FILETIME2int64(lf)-wce_FILETIME2int64(sf))/_onesec_in100ns;
+
+	s = wce_tm2SYSTEMTIME(pt);
+	SystemTimeToFileTime( &s, &f );
+	return wce_FILETIME2time_t(&f) - (time_t)diff;
+}
+
+struct tm *gmtime(const time_t *t)
+{
+	FILETIME f;
+	SYSTEMTIME s;
+	static struct tm tms;
+	
+	f = wce_time_t2FILETIME(*t);
+	FileTimeToSystemTime(&f, &s);
+	tms = wce_SYSTEMTIME2tm(&s);
+	return &tms;
+}
+
+char* ctime( const time_t *t )
+{
+	// Wed Jan 02 02:03:55 1980\n\0
+	static char buf[30]={0};
+	char week[] = "Sun Mon Tue Wed Thr Fri Sat ";
+	char month[]= "Jan Feb Mar Apl May Jun Jul Aug Sep Oct Nov Dec ";
+	struct tm tms;
+
+	tms = *localtime(t);
+
+	strncpy( buf,    week+tms.tm_wday*4, 4 );
+	strncpy( buf+4,  month+tms.tm_mon*4, 4 );
+	sprintf( buf+8,  "%02d ", tms.tm_mday );
+	sprintf( buf+11, "%02d:%02d:%02d %d\n", 
+		tms.tm_hour, tms.tm_min, tms.tm_sec, tms.tm_year+1900 );
+	return buf;
+}
+
+char *asctime(const struct tm *pt)
+{
+	static char buf[30]={0};
+	char week[] = "Sun Mon Tue Wed Thr Fri Sat ";
+	char month[]= "Jan Feb Mar Apl May Jun Jul Aug Sep Oct Nov Dec ";
+
+	strncpy( buf,    week+pt->tm_wday*4, 4 );
+	strncpy( buf+4,  month+pt->tm_mon*4, 4 );
+	sprintf( buf+8,  "%02d ", pt->tm_mday );
+	sprintf( buf+11, "%02d:%02d:%02d %d\n", 
+		pt->tm_hour, pt->tm_min, pt->tm_sec, pt->tm_year+1900 );
+	return buf;
+}
+
+void tzset()
+{
+	daylight = 1;
+	_timezone = 28800;
+	timezone = 28800;
+}
+
+int clock(void)
+{
+	return 1;
+}
+
+//---------------------------------------------------------------
+#ifdef __SCRATCH_TIMEC_DEBUG__
+
+int main()
+{
+	time_t t1, t2;
+	struct tm tm1, tm2;
+
+	time( &t1 );
+	tm1 = *localtime(&t1);
+	t1 = mktime(&tm1);
+	tm1 = *gmtime(&t1);
+
+	_time( &t2 );
+	tm2 = *_localtime(&t2);
+	t2 = _mktime(&tm2);
+	tm2 = *_gmtime(&t2);
+
+	// time, mktime
+	if( t1==t2 )
+		OutputDebugString( "ok\n" );
+	else
+	{
+		static char buf[128];
+		wsprintf( buf, "ng : %d, %d\n", t1, t2 );
+		OutputDebugString( buf );
+	}
+
+	// localtime, gmtime
+	if( 0==memcmp( &tm1, &tm2, sizeof(struct tm) ) )
+		OutputDebugString( "ok\n" );
+	else
+		OutputDebugString( "ng\n" );
+
+	// ctime
+	OutputDebugString( ctime(&t1) );
+	OutputDebugString( _ctime(&t2) );
+
+	// asctime
+	OutputDebugString( asctime(&tm1) );
+	OutputDebugString( _asctime(&tm2) );
+
+	return 0;
+}
+
+#endif
+

Added: trunk/oggdsf/src/lib/helper/wince/wince-2005.sln
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/wince-2005.sln	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/wince-2005.sln	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,62 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wince", "wince-2005.vcproj", "{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I) = Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I) = Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I) = Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I) = Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I)
+		Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I) = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I) = Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I) = Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I)
+		Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I) = Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).ActiveCfg = Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Build.0 = Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Deploy.0 = Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).ActiveCfg = Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Build.0 = Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Deploy.0 = Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).ActiveCfg = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Build.0 = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Deploy.0 = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).ActiveCfg = Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Build.0 = Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Deploy.0 = Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+		{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: trunk/oggdsf/src/lib/helper/wince/wince-2005.vcproj
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/wince-2005.vcproj	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/wince-2005.vcproj	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,953 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="wince"
+	ProjectGUID="{4AB55B4D-8F56-40CF-9AFA-7C161EE1B99D}"
+	RootNamespace="wince2005"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)"
+		/>
+		<Platform
+			Name="Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)"
+		/>
+		<Platform
+			Name="Windows Mobile 6 Professional SDK (ARMV4I)"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Windows Mobile 5.0 Pocket PC SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Windows Mobile 5.0 Smartphone SDK 2 (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				AdditionalIncludeDirectories=".\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\direct.c"
+				>
+			</File>
+			<File
+				RelativePath=".\errno.c"
+				>
+			</File>
+			<File
+				RelativePath=".\io_wce.c"
+				>
+			</File>
+			<File
+				RelativePath=".\sys\stat.c"
+				>
+			</File>
+			<File
+				RelativePath=".\string_wce.c"
+				>
+			</File>
+			<File
+				RelativePath=".\time_wce.c"
+				>
+			</File>
+			<File
+				RelativePath=".\sys\utime.c"
+				>
+			</File>
+			<File
+				RelativePath=".\wince.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\direct.h"
+				>
+			</File>
+			<File
+				RelativePath=".\errno.h"
+				>
+			</File>
+			<File
+				RelativePath=".\fcntl.h"
+				>
+			</File>
+			<File
+				RelativePath=".\io.h"
+				>
+			</File>
+			<File
+				RelativePath=".\sys\stat.h"
+				>
+			</File>
+			<File
+				RelativePath=".\sys\types.h"
+				>
+			</File>
+			<File
+				RelativePath=".\sys\utime.h"
+				>
+			</File>
+			<File
+				RelativePath=".\wince.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: trunk/oggdsf/src/lib/helper/wince/wince.c
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/wince.c	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/wince.c	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,583 @@
+/***************************************************************
+  wince.c
+
+  author : uema2
+  date   : Nov 30, 2002
+
+  You can freely use, copy, modify, and redistribute
+  the whole contents.
+***************************************************************/
+
+#include <windows.h>
+#include <tchar.h>
+#include "wince.h"
+
+/* global for GetCommandLineA */
+char *_commandLine;
+
+extern char _currentdir[];
+
+/* make up Win32API except wce_* functions.  */
+
+DWORD GetModuleFileNameA( 
+	HMODULE hModule, LPSTR lpFileName,
+	DWORD size )
+{
+	LPWSTR lpFileNameW;
+	LPSTR  mb;
+	size_t ret;
+
+	if( size==0 ) return 0;
+
+	lpFileNameW = (LPWSTR)malloc( size*sizeof(wchar_t) );
+	ret = GetModuleFileNameW( hModule, lpFileNameW, size );
+	mb = wce_wctomb(lpFileNameW);
+	strcpy(lpFileName, mb);
+	free(mb);
+	free(lpFileNameW);
+
+	return ret;
+}
+
+#if _WIN32_WCE < 300
+FARPROC GetProcAddressA(HMODULE hModule, LPCSTR lpProcName)
+{
+	FARPROC p;
+	LPWSTR  lpwProcName;
+
+	lpwProcName = wce_mbtowc( lpProcName );
+	p = GetProcAddressW( hModule, lpwProcName );
+	free( lpwProcName );
+	return p;
+}
+#endif 
+
+char * GetCommandLineA(void)
+{
+	return _commandLine;
+}
+
+/* this is not Win32API. GetCommandLineA helper. */
+void wce_SetCommandLine(LPCWSTR wcmd)
+{
+	char* acmd;
+
+	acmd = wce_wctomb( wcmd );
+	_commandLine = (char*)malloc( strlen(acmd)+5 );
+	sprintf( _commandLine, "ruby %s", acmd );
+	free(acmd);
+}
+
+/* this is not Win32API. GetCommandLineA helper. */
+void wce_FreeCommandLine(void)
+{
+	free(_commandLine);
+	_commandLine = NULL;
+}
+
+/* I have no idea how to replace this. */
+BOOL GetProcessTimes(HANDLE hprocess,
+	LPFILETIME lpCreationTime, LPFILETIME lpExitTime,
+	LPFILETIME lpKernelTime, LPFILETIME lpUserTime) 
+{
+	return 0;
+}
+
+/* --------------  file attributes functions. ------------------- */
+DWORD GetFileAttributesA(LPCSTR lpFileName)
+{
+	LPWSTR lpwFileName;
+	DWORD dw;
+
+	lpwFileName = wce_mbtowc(lpFileName);
+	dw = GetFileAttributesW(lpwFileName);
+	free(lpwFileName);
+	return dw;
+}
+
+BOOL SetFileAttributesA(
+	LPCSTR lpFileName, DWORD attributes) 
+{
+	LPWSTR lpwFileName;
+	BOOL b;
+
+	lpwFileName = wce_mbtowc(lpFileName);
+	b = SetFileAttributesW(lpwFileName, attributes);
+	free(lpwFileName);
+	return b;
+}
+
+/* ---------------  move and remove functions. ------------------- */
+BOOL MoveFileA(LPCSTR fn1, LPCSTR fn2)
+{
+	LPWSTR wfn1, wfn2;
+	BOOL b;
+
+	wfn1 = wce_mbtowc(fn1);
+	wfn2 = wce_mbtowc(fn2);
+	b = MoveFileW(wfn1, wfn2);
+	free(wfn1);
+	free(wfn2);
+	return 0;
+}
+
+BOOL MoveFileEx(LPCSTR oldname, LPCSTR newname, DWORD dwFlags)
+{
+	LPWSTR woldname, wnewname;
+	BOOL b;
+
+	woldname = wce_mbtowc(oldname);
+	wnewname = wce_mbtowc(newname);
+
+	if( (dwFlags&MOVEFILE_REPLACE_EXISTING)!=0 )
+		DeleteFileW( wnewname );
+
+	b = MoveFileW( woldname, wnewname );
+
+	free(woldname);
+	free(wnewname);
+
+	return b;
+}
+
+BOOL DeleteFileA(LPCSTR path)
+{ 
+	LPWSTR wpath;
+	BOOL b;
+
+	wpath = wce_mbtowc(path);
+	b = DeleteFileW(wpath);
+	free(wpath);
+	return 0;
+}
+
+/* --------------- EnvironmentVariable functions. ----------------- */
+DWORD GetEnvironmentVariable(
+	LPCSTR name, LPSTR value, DWORD size)
+{
+	/* use registry instead of "environment valuable". */
+	HKEY	hk;
+	LONG	lret;
+	LPBYTE	lpData;
+	DWORD	dwType=REG_SZ, cbData;
+	TCHAR   buf[MAX_PATH]={0};
+	LPWSTR  wname;
+	LPSTR   avalue;
+
+	lret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+				_T("Software\\ruby_mswince"),
+				0, KEY_QUERY_VALUE, &hk );
+
+	if ( lret != ERROR_SUCCESS )
+	{
+		strcpy( value, "" );
+		return 0;
+	}
+
+	lpData = (LPBYTE)buf;
+	cbData = MAX_PATH*sizeof(*buf);
+	wname  = wce_mbtowc( name );
+
+	lret = RegQueryValueEx( hk, wname,
+		NULL, &dwType, lpData, &cbData );
+	RegCloseKey( hk );
+
+	if ( lret != ERROR_SUCCESS )
+	{
+		strcpy( value, "" );
+		free( wname );
+		return 0;
+	}
+
+	avalue = wce_wctomb( (LPCTSTR)lpData );
+	strcpy( value, avalue );
+	free( avalue );
+	free( wname );
+
+	return strlen(value);
+}
+
+BOOL SetEnvironmentVariable(LPCSTR name, LPCSTR value)
+{
+	/* use registry instead of "environment valuable". */
+	HKEY	hk;
+	LONG	lret;
+	LPBYTE	lpData;
+	DWORD	ret, dwType=REG_SZ, cbData;
+	LPWSTR  wname, wvalue;
+
+	lret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+			_T("Software\\ruby_mswince"),
+			0, _T(""), 0,
+			0, NULL, &hk, &ret );
+	if( lret != ERROR_SUCCESS )
+		return FALSE;
+
+	wname  = wce_mbtowc(name);
+	wvalue = wce_mbtowc(value);
+
+	lpData = (LPBYTE)wvalue;
+	cbData = (wcslen(wvalue) + 1) * sizeof(*wvalue);
+	lret = RegSetValueEx( hk, wname,
+		0, dwType, lpData, cbData );
+	RegCloseKey( hk );
+	free(wname);
+	free(wvalue);
+	return lret == ERROR_SUCCESS;
+}
+
+LPVOID GetEnvironmentStrings(VOID)
+{
+	return NULL;
+}
+
+BOOL FreeEnvironmentStrings(LPSTR lpszEnvironmentBlock)
+{
+	return FALSE;
+}
+
+/* DuplicateHandle, LockFile, etc... */
+/* I have no idea...  */
+BOOL GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
+		DWORD dwProcessGroupID)
+{
+	return 0;
+}
+
+BOOL DuplicateHandle(
+	HANDLE source_process, HANDLE source,
+	HANDLE dest_process, HANDLE *dest,
+	DWORD access, BOOL inherit, DWORD options)
+{
+	return 0;
+}
+
+BOOL LockFile(HANDLE hFile,
+	DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+	DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh)
+{
+	return FALSE;
+}
+
+BOOL LockFileEx(HANDLE hFile,
+	DWORD dwFlags, DWORD dwReserved,
+	DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
+	LPOVERLAPPED lpOverlapped)
+{
+	return FALSE;
+}
+
+BOOL UnlockFile( HFILE hFile,
+	DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+	DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh)
+{
+	return FALSE;
+}
+
+BOOL UnlockFileEx(HANDLE hFile,
+	DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
+	DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped)
+{
+	return FALSE;
+}
+
+/* --------------------- etc, etc, etc... ----------------------- */
+BOOL GetVersionExA(OSVERSIONINFOA *v)
+{
+	OSVERSIONINFOW wv;
+	BOOL b;
+	LPSTR mb;
+
+	b = GetVersionExW(&wv);
+	mb = wce_wctomb(wv.szCSDVersion);
+
+	strcpy( v->szCSDVersion, mb );
+	free(mb);
+	return b;
+}
+
+DWORD WaitForMultipleObjectsEx(DWORD count,
+	const HANDLE *handles, BOOL wait_all,
+	DWORD timeout, BOOL alertable)
+{
+	return WaitForMultipleObjects(
+		count, handles, wait_all,
+		timeout );
+}
+
+BOOL CreateProcessA(LPCSTR appname, LPCSTR commandline,
+	LPSECURITY_ATTRIBUTES att, LPSECURITY_ATTRIBUTES threadatt,
+	BOOL bOpt, DWORD dwFlag, LPVOID lpEnv, LPSTR dir,
+	LPSTARTUPINFO lpsi, LPPROCESS_INFORMATION lppi)
+{
+	LPWSTR wappname, wcommandline, wdir;
+	BOOL b;
+
+	wappname     = wce_mbtowc(appname);
+	wcommandline = wce_mbtowc(commandline);
+	wdir         = wce_mbtowc(dir);
+
+	b = CreateProcessW(wappname, wcommandline,
+			att, threadatt, bOpt, dwFlag, lpEnv,
+			wdir, lpsi, lppi);
+
+	free(wappname);
+	free(wcommandline);
+	free(wdir);
+
+	return b;
+}
+
+HANDLE CreateEventA(SECURITY_ATTRIBUTES *sa, 
+	BOOL manual_reset, BOOL initial_state, LPCSTR name)
+{
+	HANDLE h;
+	LPWSTR wname;
+
+	wname = wce_mbtowc(name);
+	h = CreateEventW(sa, manual_reset,
+		initial_state, wname);
+	free(wname);
+
+	return h;
+}
+
+DWORD FormatMessageA(DWORD dwFlags, LPCVOID lpSource, 
+	DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, 
+	DWORD nSize, va_list* args)
+{
+	DWORD dw;
+	LPWSTR lpWBuffer;
+
+	lpWBuffer = wce_mbtowc(lpBuffer);
+	dw = FormatMessageW( dwFlags, lpSource,
+			dwMessageId, dwLanguageId,
+			lpWBuffer, nSize, (va_list*)args );
+	free(lpWBuffer);
+	return dw;
+}
+
+/*---------------- FindFirstFile, FindNextFile ------------------ */
+HANDLE FindFirstFileA(LPCSTR path,
+			WIN32_FIND_DATAA *data)
+{
+	LPWSTR wpath;
+	LPSTR  mb;
+	HANDLE h;
+	WIN32_FIND_DATAW wdata;
+
+	wpath = wce_mbtowc(path);
+	h = FindFirstFileW( wpath, &wdata );
+	free(wpath);
+	
+	mb = wce_wctomb( wdata.cFileName );
+	strcpy( data->cFileName, mb );
+	free(mb);
+
+	return h;
+}
+
+BOOL FindNextFileA(HANDLE handle,
+	WIN32_FIND_DATAA *data)
+{
+	BOOL b;
+	WIN32_FIND_DATAW wdata;
+	LPSTR mb1;
+
+	b = FindNextFileW(handle, &wdata);
+
+	mb1 = wce_wctomb( wdata.cFileName );
+	strcpy( data->cFileName, mb1 );
+	free(mb1);
+
+	return b;
+}
+
+/* CreateFile doesn't support SECURITY_ATTRIBUTES in WinCE. */
+/* it must be NULL. */
+HANDLE CreateFileA(LPCSTR filename, DWORD access,
+	DWORD sharing, LPSECURITY_ATTRIBUTES sa,
+	DWORD creation, DWORD attributes, HANDLE template)
+{
+	LPWSTR wfilename;
+	HANDLE h;
+
+	wfilename = wce_mbtowc(filename);
+	h = CreateFileW(wfilename, access, sharing,
+			NULL, creation, 0, NULL);
+	free(wfilename);
+
+	return 0;
+}
+
+/* ---------------- CharNext, CharPrev. ---------------------*/
+LPSTR CharNextA(LPCSTR a)
+{
+	char *p=(char *)a;
+	if( TRUE==IsDBCSLeadByteEx(CP_ACP, (BYTE)*a) )
+		p+=2;
+	else
+		p++;
+
+	return p;
+}
+
+LPSTR CharPrevA(LPCSTR start, LPCSTR ptr)
+{
+	if( start==ptr ) return (LPSTR)start;
+	else if( start+1==ptr ) return (LPSTR)start;
+	else if( TRUE==IsDBCSLeadByteEx(CP_ACP, (BYTE)*(ptr-2)) )
+		return (LPSTR)(ptr-2);
+	else
+		return (LPSTR)(ptr-1);
+}
+
+/* WinCE doesn't have "drives". */
+DWORD GetLogicalDrives(VOID)
+{
+	return 0;
+}
+
+/* WinCE doesn't have "user name". */
+BOOL GetUserName(LPSTR lpBuffer, LPDWORD nSize)
+{
+	return 0;
+}
+
+/*------------------- LoadLibrary -----------------------*/
+HINSTANCE LoadLibraryA(LPCSTR libname)
+{
+	HINSTANCE h;
+	LPWSTR wlibname;
+
+	// if starts ".\", replace current directory.
+//	wlibname = wce_replaceRelativeDir(libname);
+
+	wlibname = wce_mbtowc(libname);
+	h = LoadLibraryW(wlibname);
+	free(wlibname);
+	return h;
+}
+
+HINSTANCE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile,
+			DWORD dwFlags)
+{
+	HINSTANCE h;
+	LPWSTR wlibname;
+
+	wlibname = wce_mbtowc(lpLibFileName);
+//	wlibname = wce_replaceRelativeDir(lpLibFileName);
+
+#if _WIN32_WCE < 300
+	h = LoadLibraryW(wlibname);
+#else
+	h = LoadLibraryExW(wlibname, hFile, dwFlags);
+#endif
+	free(wlibname);
+	return h;
+}
+
+/* WinCE doesn't have "CreatePipe". */
+BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe,
+	LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
+{
+	return FALSE;
+}
+
+/* WinCE doesn't have "Standard Devices". */
+HANDLE GetStdHandle(DWORD nStdHandle)
+{
+	return NULL;
+}
+
+BOOL SetStdHandle(DWORD nStdHandle, HANDLE h)
+{
+	return FALSE;
+}
+
+#if _WIN32_WCE < 300
+VOID ZeroMemory(PVOID p, DWORD length)
+{
+	memset(p,0,length);
+}
+#endif
+
+
+/* need in ruby/io.c. */
+int ReadDataPending()
+{
+	return 0;
+}
+
+/*---------------- helper functions. ---------------------------- */
+FILE *wce_fopen( const char *fname, const char *mode )
+{
+	TCHAR* tfname = wce_replaceRelativeDir(fname);
+	TCHAR* tmode = wce_mbtowc(mode);
+	FILE* fp = _tfopen(tfname, tmode);
+	free(tfname); free(tmode);
+	return fp;
+}
+
+void wce_SetCurrentDir()
+{
+	WCHAR tbuf[MAX_PATH+1]={0};
+	WCHAR *tp;
+	char *buf;
+
+	GetModuleFileNameW( NULL, tbuf, MAX_PATH );
+	tp = _tcsrchr( tbuf, '\\' );
+	if( tp!=NULL ) *tp=_T('\0');
+	buf = wce_wctomb(tbuf);
+	strcpy( _currentdir, buf );
+	free(buf);
+}
+
+TCHAR *wce_replaceRelativeDir(const char* str)
+{
+	TCHAR *tbuf;
+
+	if( 2<=strlen(str) && str[0]=='.' &&
+		(str[1]=='/' || str[1]=='\\') )
+	{
+		char *buf;
+		int len = strlen(str) + strlen(_currentdir);
+		buf = malloc( len+1 );
+		sprintf(buf, "%s%s", _currentdir, &str[1]);
+		tbuf = wce_mbtowc(buf);
+		free(buf);
+	}
+	else
+		tbuf = wce_mbtowc(str);
+	return tbuf;
+}
+
+/* char -> wchar_t */
+wchar_t* wce_mbtowc(const char* a)
+{
+	int length;
+	wchar_t *wbuf;
+
+	length = MultiByteToWideChar(CP_ACP, 0, 
+		a, -1, NULL, 0);
+	wbuf = (wchar_t*)malloc( (length+1)*sizeof(wchar_t) );
+	MultiByteToWideChar(CP_ACP, 0,
+		a, -1, wbuf, length);
+
+	return wbuf;
+}
+
+/* wchar_t -> char */
+char* wce_wctomb(const wchar_t* w)
+{
+	DWORD charlength;
+	char* pChar;
+
+	charlength = WideCharToMultiByte(CP_ACP, 0, w,
+					-1, NULL, 0, NULL, NULL);
+	pChar = (char*)malloc(charlength+1);
+	WideCharToMultiByte(CP_ACP, 0, w,
+		-1, pChar, charlength, NULL, NULL);
+
+	return pChar;
+}

Added: trunk/oggdsf/src/lib/helper/wince/wince.h
===================================================================
--- trunk/oggdsf/src/lib/helper/wince/wince.h	                        (rev 0)
+++ trunk/oggdsf/src/lib/helper/wince/wince.h	2009-01-18 19:52:31 UTC (rev 15626)
@@ -0,0 +1,191 @@
+
+#ifndef _EXT_CE_
+#define _EXT_CE_
+
+/* unique difinition in wince platform. */
+
+//#ifndef _MIPS_
+//  #define CONTEXT_FLOATING_POINT  0x00000002L
+//#endif
+
+/* LockFile difinition. */
+#define LOCKFILE_FAIL_IMMEDIATELY   0x00000001
+#define LOCKFILE_EXCLUSIVE_LOCK     0x00000002
+
+/* Dual Mode difinition. */
+#define STARTF_USESHOWWINDOW    0x00000001
+#define STARTF_USESIZE          0x00000002
+#define STARTF_USEPOSITION      0x00000004
+#define STARTF_USECOUNTCHARS    0x00000008
+#define STARTF_USEFILLATTRIBUTE 0x00000010
+#define STARTF_RUNFULLSCREEN    0x00000020
+#define STARTF_FORCEONFEEDBACK  0x00000040
+#define STARTF_FORCEOFFFEEDBACK 0x00000080
+#define STARTF_USESTDHANDLES    0x00000100
+/* #define STARTF_USEHOTKEY        0x00000200 */
+
+#define STD_INPUT_HANDLE    (DWORD)-10
+#define STD_OUTPUT_HANDLE   (DWORD)-11
+#define STD_ERROR_HANDLE    (DWORD)-12
+
+#define NORMAL_PRIORITY_CLASS       0x00000020
+#define IDLE_PRIORITY_CLASS         0x00000040
+#define HIGH_PRIORITY_CLASS         0x00000080
+#define REALTIME_PRIORITY_CLASS     0x00000100
+
+
+/* WINSOCK.H? */
+#define SO_SYNCHRONOUS_NONALERT 0x20
+
+/* MoveFileEx definition. */
+#define MOVEFILE_REPLACE_EXISTING       0x00000001
+/*
+#define MOVEFILE_COPY_ALLOWED           0x00000002
+#define MOVEFILE_DELAY_UNTIL_REBOOT     0x00000004
+#define MOVEFILE_WRITE_THROUGH          0x00000008
+#define MOVEFILE_CREATE_HARDLINK        0x00000010
+#define MOVEFILE_FAIL_IF_NOT_TRACKABLE  0x00000020
+*/
+
+#define _fgetc fgetc
+#define _fputc fputc
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Win32 API redifinition. */
+
+#undef GetCommandLine
+#define GetCommandLine GetCommandLineA
+
+#undef SetFileAttributes
+#define SetFileAttributes SetFileAttributesA
+
+#undef GetFileAttributes
+#define GetFileAttributes GetFileAttributesA
+
+#undef FormatMessage
+#define FormatMessage FormatMessageA
+
+#undef GetModuleFileName
+#define GetModuleFileName GetModuleFileNameA
+
+#undef CreateFile
+#define CreateFile CreateFileA
+
+#undef MoveFile
+#define MoveFile MoveFileA
+
+#undef DeleteFile
+#define DeleteFile DeleteFileA
+
+#undef CreateProcess
+#define CreateProcess CreateProcessA
+
+#undef CharNext
+#define CharNext CharNextA
+
+#undef CharPrev
+#define CharPrev CharPrevA
+
+#undef WIN32_FIND_DATA
+#define WIN32_FIND_DATA WIN32_FIND_DATAA
+
+#undef FindFirstFile
+#define FindFirstFile FindFirstFileA
+
+#undef FindNextFile
+#define FindNextFile FindNextFileA
+
+/* stdio.c */
+FILE *freopen(const char *filename, const char *mode, FILE *file);
+FILE *fdopen( int handle, const char *mode );
+
+//#define fdopen _fdopen
+
+/* stdlib.c */
+char *getenv(const char *charstuff);
+char *_fullpath(char *absPath, const char *relPath, size_t maxLength);
+
+/* string.c */
+char *strdup(const char * str);
+/* char *strerror(int errno); */
+int strnicmp( const char *s1, const char *s2, size_t count );
+
+//#define strnicmp _strnicmp
+#define stricmp _stricmp
+
+/* for win32.c */
+FARPROC GetProcAddressX(HMODULE hModule, LPCSTR lpProcName);
+
+BOOL MoveFileEx(LPCSTR oldname, LPCSTR newname, DWORD dwFlags);
+BOOL DuplicateHandle(
+	HANDLE source_process, HANDLE source,
+	HANDLE dest_process, HANDLE *dest,
+	DWORD access, BOOL inherit, DWORD options);
+BOOL LockFile(HANDLE hFile,
+	DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+	DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh);
+BOOL LockFileEx(HANDLE hFile,
+	DWORD dwFlags, DWORD dwReserved,
+	DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
+	LPOVERLAPPED lpOverlapped);
+BOOL UnlockFile( HFILE hFile,
+	DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+	DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh);
+BOOL UnlockFileEx(HANDLE hFile,
+	DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
+	DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);
+BOOL GetUserName(LPSTR lpBuffer, LPDWORD nSize);
+BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe,
+	LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
+HANDLE GetStdHandle(DWORD nStdHandle);
+BOOL SetStdHandle(DWORD nStdHandle, HANDLE h);
+DWORD GetLogicalDrives(VOID);
+DWORD WaitForMultipleObjectsEx(DWORD count,
+	const HANDLE *handles, BOOL wait_all,
+	DWORD timeout, BOOL alertable);
+DWORD GetEnvironmentVariable(LPCSTR name, LPSTR value, DWORD size);
+LPVOID GetEnvironmentStrings(VOID);
+BOOL FreeEnvironmentStrings(LPSTR lpszEnvironmentBlock);
+BOOL GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
+		DWORD dwProcessGroupID);
+BOOL GetProcessTimes(HANDLE hprocess,
+	LPFILETIME lpCreationTime, LPFILETIME lpExitTime,
+	LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
+
+/* char -> wchar_t, wchar_t -> char */
+wchar_t* wce_mbtowc(const char* a);
+char*    wce_wctomb(const wchar_t* w);
+/* other helpers. */
+void wce_SetCommandLine(LPCWSTR wcmd);
+void wce_FreeCommandLine(void);
+TCHAR *wce_replaceRelativeDir(const char* str);
+void wce_SetCurrentDir();
+
+#if _WIN32_WCE < 300
+  /* for Handheld PC Pro. */
+  char *strrchr( const char *p, int c );
+  int stricmp( const char *p1, const char *p2 );
+  VOID ZeroMemory(PVOID p, DWORD length);
+
+  #define isascii(c) ( (c>=0x00&&c<=0x7f)?1:0 )
+  #define isspace(c) ( ((c>=0x09&&c<=0x0d)||c==0x20)?1:0 )
+  #define isdigit(c) ( (c>=0x00&&c<=0x09)?1:0 )
+  #define isupper(c) ( (c>='A'&&c<='Z')?1:0 )
+  #define isalpha(c) ( ((c>='A'&&c<='Z')||(c>='a'&&c<='z'))?1:0 )
+  #define isprint(c) ( (c>=0x20&&c<=0x7e)?1:0 )
+  #define isalnum(c) ( (isalpha(c)||isdigit(c))?1:0 )
+  #define iscntrl(c) ( ((c>=0x00&&c<=0x1f)||c==0x7f)?1:0 )
+  #define islower(c) ( (c>='a'&&c<='z')?1:0 )
+  #define ispunct(c) ( !(isalnum(c)||isspace(c))?1:0 )
+  #define isxdigit(c) ( ((c>=0&&c<=9)||(c>='A'&&c<='F')||(c>='a'&&c<='f'))?1:0 )
+#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif /* _EXT_CE_ */



More information about the commits mailing list