scusi-svn Mailing List for Scusi
Status: Pre-Alpha
Brought to you by:
syntheticpp
You can subscribe to this list here.
| 2007 |
Jan
(55) |
Feb
(12) |
Mar
(38) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: <syn...@us...> - 2007-06-03 18:04:42
|
Revision: 120
http://scusi.svn.sourceforge.net/scusi/?rev=120&view=rev
Author: syntheticpp
Date: 2007-06-03 11:04:41 -0700 (Sun, 03 Jun 2007)
Log Message:
-----------
add cmake info
Modified Paths:
--------------
trunk/Readme.txt
Modified: trunk/Readme.txt
===================================================================
--- trunk/Readme.txt 2007-06-03 17:50:17 UTC (rev 119)
+++ trunk/Readme.txt 2007-06-03 18:04:41 UTC (rev 120)
@@ -25,8 +25,13 @@
To generate project files for QtCore, QtGui, and wcelibcex
with cmake first build the tools with scusi_tools
and then call in a build folder
+
cmake ..\trunk
+Open the .sln file and switch to the Pocket PC 2003 configuration
+(this version ships with a command shell). You also coild try
+Mobile 5 Pocket PC, but to have a command shell you have to install
+the Power Toys.
Compilation finally breaks because of the
incomplete port.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <syn...@us...> - 2007-06-03 17:50:18
|
Revision: 119
http://scusi.svn.sourceforge.net/scusi/?rev=119&view=rev
Author: syntheticpp
Date: 2007-06-03 10:50:17 -0700 (Sun, 03 Jun 2007)
Log Message:
-----------
add cmake info
Modified Paths:
--------------
trunk/Readme.txt
Modified: trunk/Readme.txt
===================================================================
--- trunk/Readme.txt 2007-03-22 16:19:46 UTC (rev 118)
+++ trunk/Readme.txt 2007-06-03 17:50:17 UTC (rev 119)
@@ -18,15 +18,15 @@
Go into scusi/qt4 and call 'scusi_tools.bat'
this cript builds qmake, moc, rcc, and uic for win32.
-Then call 'scusi_arm.bat', this script changes the path
-to the wince-compiler/sdk and the Qt target setting.
+Only for this tools qmake is used, to build the Qt libs
+you need cmake:
+www.cmake.org
-It creates a makefile for nmake in src/corelib.
-Currently arm is hard coded in the settings.
+To generate project files for QtCore, QtGui, and wcelibcex
+with cmake first build the tools with scusi_tools
+and then call in a build folder
+cmake ..\trunk
-You could also create project files by calling
-'qamke -t vclib' in src/corelib. But they are a
-little bit buggy.
Compilation finally breaks because of the
incomplete port.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-22 16:19:52
|
Revision: 118
http://scusi.svn.sourceforge.net/scusi/?rev=118&view=rev
Author: ohochreu
Date: 2007-03-22 09:19:46 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Add necessary definition when compiling with _DEBUG defined
Modified Paths:
--------------
trunk/wcelibcex/src/wce_file.c
Modified: trunk/wcelibcex/src/wce_file.c
===================================================================
--- trunk/wcelibcex/src/wce_file.c 2007-03-19 08:16:34 UTC (rev 117)
+++ trunk/wcelibcex/src/wce_file.c 2007-03-22 16:19:46 UTC (rev 118)
@@ -36,6 +36,16 @@
#include "wce_timesys.h"
#include "wce_fcntl.h"
+#ifdef DEBUG
+DBGPARAM dpCurSettings = {
+ TEXT("WCELIBCEX"),
+ {
+ TEXT("General"),
+ TEXT("Undefined"),
+ TEXT("Miscellaneous"),
+ }, 0x00000001
+};
+#endif // DEBUG
int wceex__open(const char* filename, int flags/*, int mode*/)
{
@@ -125,7 +135,7 @@
if ((int) hFile <0)
{
// !!!!!! on Unix it is used sometimes considered as an error (error is -1)
- DEBUGCHK(0);
+ //DEBUGCHK(0);
}
return (int) hFile;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-19 08:29:21
|
Revision: 114
http://scusi.svn.sourceforge.net/scusi/?rev=114&view=rev
Author: ohochreu
Date: 2007-03-19 01:10:12 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
Add environment variable support
Added Paths:
-----------
trunk/wcelibcex/src/wce_env.c
trunk/wcelibcex/src/wce_registry.c
trunk/wcelibcex/src/wce_util.c
trunk/wcelibcex/src/wce_winreg.h
Added: trunk/wcelibcex/src/wce_env.c
===================================================================
--- trunk/wcelibcex/src/wce_env.c (rev 0)
+++ trunk/wcelibcex/src/wce_env.c 2007-03-19 08:10:12 UTC (rev 114)
@@ -0,0 +1,104 @@
+
+// based on celib's code from ke...@ne...
+
+#include "wce_winreg.h"
+#include "wce_stdlib.h"
+
+
+/*******************************************************************************
+* wceex_getenv - get value of an environment variable
+*
+* Description:
+*
+* Implements the concept of environment variable for Windows CE platform.
+* The environment list is based n Windows CE Registry and dedicated subkey,
+* global for all users of WCELIBCEX library.
+*
+* Return:
+*
+* Upon successful completion, getenv() shall return a pointer to a string
+* containing the value for the specified name.
+* If the specified name cannot be found in the environment,
+* a null pointer shall be returned.
+*
+* The return value from getenv() points to global data are released and reallocated
+* by subsequent calls to getenv().
+* IMPORTANT: Unline in POSIX, user is allowed and even encouraged to free
+* returned value manually, by calling free() function.
+*
+*******************************************************************************/
+
+char* wceex_getenv(const char* name)
+{
+ size_t name_size = 0;
+ size_t var_size = 0;
+ LPSTR value = NULL;
+
+ if (NULL != name);
+ {
+ value = (char*)malloc(_MAX_ENV * sizeof(char));
+ if (NULL == value)
+ return NULL;
+
+ if (FAILED(StringCchLengthA(name, _MAX_ENV, &name_size)))
+ return NULL;
+
+ /* Get environment from the Windows CE registry. */
+ var_size = wceex_GetEnvironmentVariableA(name, value, _MAX_ENV);
+ if (0 != var_size)
+ {
+ /* Assign new value fetched from the registry. */
+ value = (char*) realloc(value, (var_size+1)*sizeof(char));
+ }
+ else
+ {
+ free(value);
+ value = NULL;
+ }
+
+ }
+
+ return value;
+}
+
+int wceex_putenv(char* envstring)
+{
+ char * value = envstring;
+ size_t cnt = 0;
+
+ if (NULL == envstring)
+ return -1;
+
+ for (; cnt < _MAX_ENV && (*value) != '='; cnt++, value++)
+ continue;
+
+ if (_MAX_ENV == cnt)
+ return -1;
+
+ *value = '\0';
+ value++;
+ if (FAILED(StringCchLengthA(value, _MAX_ENV, &cnt)))
+ return -1;
+
+ if (wceex_SetEnvironmentVariableA(envstring, value))
+ return 0;
+ else
+ return -1;
+}
+
+DWORD wceex_GetEnvironmentVariableA(
+ LPCSTR lpName,
+ LPSTR lpBuffer,
+ DWORD nSize
+)
+{
+ return wceex_GetEnvironmentVariableFromRegA(lpName, lpBuffer, nSize);
+}
+
+BOOL wceex_SetEnvironmentVariableA(
+ LPCSTR lpName,
+ LPCSTR lpValue
+)
+{
+ return wceex_SetEnvironmentVariableInRegA(lpName, lpValue);
+}
Added: trunk/wcelibcex/src/wce_registry.c
===================================================================
--- trunk/wcelibcex/src/wce_registry.c (rev 0)
+++ trunk/wcelibcex/src/wce_registry.c 2007-03-19 08:10:12 UTC (rev 114)
@@ -0,0 +1,464 @@
+// registry.c
+//
+// Time-stamp: <15/02/02 20:50:46 ke...@ne...>
+
+#include <stdlib.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#define COUNTOF(X) (sizeof(X)/sizeof(X[0]))
+
+LONG
+wceex_RegCreateKeyExA(HKEY hKey,
+ const char *subkey,
+ DWORD dwRes,
+ LPSTR lpszClass,
+ DWORD ulOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES sec_att,
+ PHKEY phkResult,
+ DWORD *lpdwDisp
+ )
+{
+ long res;
+ wchar_t subkeyw[256];
+
+ MultiByteToWideChar(CP_ACP, 0, subkey, -1, subkeyw, COUNTOF(subkeyw));
+
+ res = RegCreateKeyExW(hKey, subkeyw, dwRes, NULL, ulOptions,
+ samDesired, NULL, phkResult, lpdwDisp);
+
+ return res;
+}
+
+LONG
+wceex_RegOpenKeyExA(HKEY hKey,
+ const char *subkey,
+ DWORD ulOptions,
+ REGSAM samDesired,
+ PHKEY phkResult
+ )
+{
+ long res;
+ wchar_t subkeyw[256];
+
+ MultiByteToWideChar(CP_ACP, 0, subkey, -1, subkeyw, COUNTOF(subkeyw));
+
+ res = RegOpenKeyExW(hKey, subkeyw, ulOptions, samDesired, phkResult);
+
+ return res;
+}
+
+LONG
+wceex_RegQueryValueExA(
+ HKEY hKey,
+ const char *valname,
+ LPDWORD lpReserved,
+ LPDWORD lpType,
+ LPBYTE lpData,
+ LPDWORD lpcbData
+ )
+{
+ wchar_t valnamew[256];
+ LONG res;
+ LPBYTE lpDataNew = NULL;
+ DWORD dwDataSize;
+ DWORD dword_spare = 0;
+ LPDWORD lpType_spare = &dword_spare;
+
+ if(lpData != NULL)
+ {
+ dwDataSize = *lpcbData * 2;
+ lpDataNew = malloc(dwDataSize);
+ }
+
+ // suggested by W. Garland
+ if (lpType == NULL)
+ lpType = lpType_spare;
+
+ MultiByteToWideChar(CP_ACP, 0, valname, -1, valnamew, COUNTOF(valnamew));
+
+ res = RegQueryValueExW(hKey, valnamew, lpReserved, lpType, lpDataNew,
+ &dwDataSize);
+
+ if(res != 0)
+ {
+ free(lpDataNew);
+ return res;
+ }
+
+ if(lpData)
+ {
+ if(*lpType == REG_SZ)
+ {
+ WideCharToMultiByte(CP_ACP, 0,
+ (wchar_t *)lpDataNew, *lpcbData,
+ (char *) lpData, *lpcbData,
+ NULL, NULL);
+ *lpcbData = dwDataSize/2;
+ }
+ else
+ {
+ *lpcbData = dwDataSize;
+ memcpy(lpData, lpDataNew, *lpcbData);
+ }
+ }
+ else // query only...
+ {
+ if(lpcbData)
+ *lpcbData = dwDataSize;
+ }
+
+ free(lpDataNew);
+
+ return 0;
+}
+
+LONG
+wceex_RegSetValueExA(
+ HKEY hKey,
+ const char *valname,
+ DWORD dwReserved,
+ DWORD dwType,
+ LPBYTE lpData,
+ DWORD dwSize
+ )
+{
+ wchar_t valnamew[256];
+ LONG res;
+ // suggested by W. Garland
+ LPBYTE lpDataNew = lpData;
+ DWORD dwDataSize = dwSize;
+
+ MultiByteToWideChar(CP_ACP, 0, valname, -1, valnamew, COUNTOF(valnamew));
+
+ if(dwType == REG_SZ || dwType == REG_EXPAND_SZ)
+ {
+ dwDataSize = dwSize * 2;
+ lpDataNew = malloc(dwDataSize);
+
+ MultiByteToWideChar(CP_ACP, 0, lpData, -1, (wchar_t *)lpDataNew,
+ dwDataSize);
+ }
+
+ res = RegSetValueExW(hKey, valnamew, dwReserved, dwType, (BYTE*)lpDataNew,
+ dwDataSize);
+
+ // doesn't this possibly free lpData?
+ free(lpDataNew);
+
+ return res;
+}
+
+LONG
+wceex_RegEnumValueA(
+ HKEY hKey,
+ DWORD dwIndex,
+ char *lpValueName,
+ LPDWORD lpcbValueName,
+ LPDWORD lpReserved,
+ LPDWORD lpType,
+ LPBYTE lpData,
+ LPDWORD lpcbData
+ )
+{
+ long res;
+ DWORD dwValueSize = 0;
+ DWORD dwDataSize = 0;
+ wchar_t *lpValueNameW = NULL;
+ LPBYTE lpDataNew = NULL;
+
+ if(lpcbValueName) // size in characters
+ dwValueSize = *lpcbValueName;
+ if(lpcbData)
+ dwDataSize = *lpcbData;
+
+ if(lpValueName != NULL)
+ lpValueNameW = malloc(dwValueSize*2);
+
+ if(lpData != NULL)
+ lpDataNew = malloc(dwDataSize*2);
+
+ res = RegEnumValueW(hKey, dwIndex, lpValueNameW, &dwValueSize,
+ lpReserved, lpType, lpDataNew, &dwDataSize);
+
+ if(res == 0)
+ {
+ if(lpValueName)
+ {
+ WideCharToMultiByte(CP_ACP, 0,
+ (wchar_t *)lpValueNameW, *lpcbValueName,
+ (char *) lpValueName, *lpcbValueName,
+ NULL, NULL);
+ }
+
+ if(lpcbValueName)
+ *lpcbValueName = dwValueSize;
+
+ if(lpData)
+ {
+ if(*lpType == REG_SZ)
+ {
+ WideCharToMultiByte(CP_ACP, 0,
+ (wchar_t *)lpDataNew, *lpcbData,
+ (char *) lpData, *lpcbData,
+ NULL, NULL);
+ }
+ else
+ {
+ *lpcbData = dwDataSize;
+ memcpy(lpData, lpDataNew, *lpcbData);
+ }
+ }
+
+ if(lpcbData)
+ *lpcbData = dwDataSize;
+ }
+
+ free(lpValueNameW);
+ free(lpDataNew);
+
+ return res;
+}
+
+LONG
+wceex_RegDeleteKeyA(
+ HKEY hKey,
+ LPCSTR lpszSubKey
+ )
+{
+ WCHAR *lpszSubKeyW;
+ int len;
+
+ len = strlen(lpszSubKey);
+ lpszSubKeyW = alloca(2*(len+1));
+
+ MultiByteToWideChar(CP_ACP, 0, lpszSubKey, -1, lpszSubKeyW, len+1);
+
+ return RegDeleteKeyW(hKey, lpszSubKeyW);
+}
+
+LONG
+wceex_RegEnumKeyExA(
+ HKEY hKey,
+ DWORD iSubkey,
+ LPSTR lpszName,
+ LPDWORD lpcchName,
+ LPDWORD lpdwReserved,
+ LPSTR lpszClass,
+ LPDWORD lpcchClass,
+ PFILETIME lpftLastWrite
+ )
+{
+ WCHAR lpszNameW[256];
+ WCHAR lpszClassW[256];
+ int res;
+ int old_name_size = 0;
+ int old_class_size = 0;
+
+ old_name_size = *lpcchName;
+
+ if(lpszClass)
+ old_class_size = *lpcchClass;
+
+ res = RegEnumKeyExW(hKey, iSubkey, lpszNameW, lpcchName, lpdwReserved,
+ lpszClassW, lpcchClass, lpftLastWrite);
+
+ if(res == 0)
+ {
+ WideCharToMultiByte(CP_ACP, 0, lpszNameW, -1,
+ lpszName, old_name_size, 0, 0);
+ if(lpszClass)
+ {
+ WideCharToMultiByte(CP_ACP, 0, lpszClassW, -1,
+ lpszClass, old_class_size, 0, 0);
+ }
+ }
+
+ return res;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+LONG
+wceex_RegCreateKeyA(
+ HKEY hKey,
+ LPCSTR lpszSubKey,
+ PHKEY phkResult
+ )
+{
+ DWORD dwDisp;
+
+ return wceex_RegCreateKeyExA(hKey, lpszSubKey, 0, NULL, 0, 0, 0, phkResult,
+ &dwDisp);
+}
+
+LONG
+wceex_RegOpenKeyA(
+ HKEY hKey,
+ LPCSTR lpszSubKey,
+ PHKEY phkResult
+ )
+{
+ DWORD dwDisp;
+
+ return wceex_RegOpenKeyExA(hKey, lpszSubKey, 0, 0, phkResult);
+}
+
+LONG
+wceex_RegCloseKey(HKEY hKey)
+{
+ // just for tracing...
+ return RegCloseKey(hKey);
+}
+
+
+LONG
+wceex_RegEnumKeyA(
+ HKEY hKey,
+ DWORD iSubKey,
+ LPSTR lpszName,
+ DWORD cchName
+ )
+{
+ int res;
+ char lpszClass[126];
+ DWORD cchClass = 126;
+ FILETIME ft;
+
+ res = wceex_RegEnumKeyExA(hKey, iSubKey, lpszName, &cchName, NULL, lpszClass,
+ &cchClass, &ft);
+
+ return res;
+}
+
+LONG
+wceex_RegDeleteValueA(
+ HKEY hKey,
+ LPSTR lpszValue
+ )
+{
+ LONG res;
+ int len;
+ WCHAR *lpszValueW;
+
+ len = strlen(lpszValue);
+ lpszValueW = alloca((len+1) * 2);
+ MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, lpszValueW, len+1);
+ res = RegDeleteValueW(hKey, lpszValueW);
+
+ return res;
+}
+
+
+
+int
+wceex_GetEnvironmentVariableFromRegA(const char *name, char *buf, int len)
+{
+ int res;
+ char data[1024];
+ HKEY hKey;
+ DWORD dwDataSize = sizeof(data);
+ DWORD dwType;
+
+ if(buf)
+ buf[0] = 0;
+
+ if((res = wceex_RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Environment", 0,
+ KEY_READ, (PHKEY)&hKey)) != 0)
+ {
+ return 0;
+ }
+
+ res = wceex_RegQueryValueExA(hKey, name, NULL, &dwType,
+ (LPBYTE)data, &dwDataSize);
+
+ wceex_RegCloseKey(hKey);
+
+ if(res != 0 || dwType != REG_SZ)
+ return 0;
+
+ if(buf == NULL)
+ return strlen(data);
+
+ strncpy(buf, data, len);
+
+ return strlen(buf);
+}
+
+BOOL
+wceex_SetEnvironmentVariableInRegA(const char *name, const char *value)
+{
+ int res;
+ HKEY hKey;
+
+ if((res = wceex_RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Environment", 0,
+ KEY_READ, &hKey)) != 0)
+ {
+ return FALSE;
+ }
+
+ res = wceex_RegSetValueExA(hKey, name, 0, REG_SZ,
+ (LPBYTE) value, strlen(value) + 1);
+
+ wceex_RegCloseKey(hKey);
+
+ return res == 0;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int
+wceex_GetRegStringA(HKEY hKey, const char *keyname, const char *valname,
+ char *buf, int len)
+{
+ int res;
+ char data[1024];
+ DWORD dwDataSize = sizeof(data);
+ DWORD dwType;
+
+ if(buf)
+ buf[0] = 0;
+
+ if((res = wceex_RegOpenKeyExA(hKey, keyname, 0,
+ KEY_READ, &hKey)) != 0)
+ {
+ return 0;
+ }
+
+ res = wceex_RegQueryValueExA(hKey, valname, NULL, &dwType,
+ (LPBYTE)data, &dwDataSize);
+
+ wceex_RegCloseKey(hKey);
+
+ if(res != 0 || dwType != REG_SZ)
+ return 0;
+
+ if(buf == NULL)
+ return strlen(data);
+
+ strncpy(buf, data, len);
+
+ return strlen(buf);
+}
+
+BOOL
+wceex_SetRegStringA(HKEY hKey, const char *keyname, const char *valname,
+ const char *value)
+{
+ int res;
+
+ if((res = wceex_RegOpenKeyExA(hKey, keyname, 0,
+ KEY_READ, &hKey)) != 0)
+ {
+ return FALSE;
+ }
+
+ res = wceex_RegSetValueExA(hKey, valname, 0, REG_SZ,
+ (LPBYTE) value, strlen(value) + 1);
+
+ wceex_RegCloseKey(hKey);
+
+ return res == 0;
+}
Added: trunk/wcelibcex/src/wce_util.c
===================================================================
Added: trunk/wcelibcex/src/wce_winreg.h
===================================================================
--- trunk/wcelibcex/src/wce_winreg.h (rev 0)
+++ trunk/wcelibcex/src/wce_winreg.h 2007-03-19 08:10:12 UTC (rev 114)
@@ -0,0 +1,184 @@
+/*
+ * $Id: wce_winreg.h,v 1.0 2007/03/16 15:29:36 ohochreu Exp $
+ *
+ * Created by Olivier Hochreutiner (olivier dot hochreutiner at gmail dot com)
+ *
+ * Copyright (c) 2007 Olivier Hochreutiner
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+ * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * MIT License:
+ * http://opensource.org/licenses/mit-license.php
+ *
+ */
+
+#include <windows.h>
+
+LONG
+wceex_RegCreateKeyExA(HKEY hKey,
+ LPCSTR subkey,
+ DWORD dwRes,
+ LPSTR lpszClass,
+ DWORD ulOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES sec_att,
+ PHKEY phkResult,
+ DWORD *lpdwDisp
+ );
+
+LONG
+wceex_RegOpenKeyExA(HKEY hKey,
+ const char *subkey,
+ DWORD ulOptions,
+ REGSAM samDesired,
+ PHKEY phkResult
+ );
+
+LONG
+wceex_RegQueryValueExA(
+ HKEY hKey,
+ const char *valname,
+ LPDWORD lpReserved,
+ LPDWORD lpType,
+ LPBYTE lpData,
+ LPDWORD lpcbData
+ );
+
+LONG
+wceex_RegSetValueExA(
+ HKEY hKey,
+ const char *valname,
+ DWORD dwReserved,
+ DWORD dwType,
+ LPBYTE lpData,
+ DWORD dwSize
+ );
+
+LONG
+wceex_RegEnumValueA(
+ HKEY hKey,
+ DWORD dwIndex,
+ char *lpValueName,
+ LPDWORD lpcbValueName,
+ LPDWORD lpReserved,
+ LPDWORD lpType,
+ LPBYTE lpData,
+ LPDWORD lpcbData
+ );
+
+LONG
+wceex_RegDeleteKeyA(
+ HKEY hKey,
+ LPCSTR lpszSubKey
+ );
+
+LONG
+wceex_RegEnumKeyExA(
+ HKEY hKey,
+ DWORD iSubkey,
+ LPSTR lpszName,
+ LPDWORD lpcchName,
+ LPDWORD lpdwReserved,
+ LPSTR lpszClass,
+ LPDWORD lpcchClass,
+ PFILETIME lpftLastWrite
+ );
+
+LONG
+wceex_RegCreateKeyA(
+ HKEY hKey,
+ LPCSTR lpszSubKey,
+ PHKEY phkResult
+ );
+
+LONG
+wceex_RegOpenKeyA(
+ HKEY hKey,
+ LPCSTR lpszSubKey,
+ PHKEY phkResult
+ );
+
+LONG
+wceex_RegCloseKey(HKEY hKey);
+
+
+LONG
+wceex_RegEnumKeyA(
+ HKEY hKey,
+ DWORD iSubKey,
+ LPSTR lpszName,
+ DWORD cchName
+ );
+
+LONG
+wceex_RegDeleteValueA(
+ HKEY hKey,
+ LPSTR lpszValue
+ );
+
+//////////////////////////////////////////////////////////////////////
+
+int
+wceex_GetEnvironmentVariableFromRegA(
+ const char *name,
+ char *buf,
+ int len
+);
+
+BOOL
+wceex_SetEnvironmentVariableInRegA(
+ const char *name,
+ const char *value
+);
+
+//////////////////////////////////////////////////////////////////////
+
+int
+wceex_GetRegStringA(
+ HKEY hKey,
+ const char *keyname,
+ const char *valname,
+ char *buf,
+ int len
+);
+
+BOOL
+wceex_SetRegStringA(
+ HKEY hKey,
+ const char *keyname,
+ const char *valname,
+ const char *value
+);
+
+#ifdef WCEEX_FREE_NAMES
+
+#define RegCreateKeyExA wceex_RegCreateKeyExA
+#define RegOpenKeyExA wceex_RegOpenKeyExA
+#define RegQueryValueExA wceex_RegQueryValueExA
+#define RegSetValueExA wceex_RegSetValueExA
+#define RegEnumValueA wceex_RegEnumValueA
+#define RegDeleteKeyA wceex_RegDeleteKeyA
+#define RegEnumKeyExA wceex_RegEnumKeyExA
+#define RegCreateKeyA wceex_RegCreateKeyA
+#define RegOpenKeyA wceex_RegOpenKeyA
+#define RegCloseKey wceex_RegCloseKey
+#define RegEnumKeyA wceex_RegEnumKeyA
+#define RegDeleteValueA wceex_RegDeleteValueA
+
+#endif // WCEEX_FREE_NAMES
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-19 08:29:21
|
Revision: 115
http://scusi.svn.sourceforge.net/scusi/?rev=115&view=rev
Author: ohochreu
Date: 2007-03-19 01:12:27 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
Add environment variable support
Modified Paths:
--------------
trunk/wcelibcex/src/wce_stdlib.h
Modified: trunk/wcelibcex/src/wce_stdlib.h
===================================================================
--- trunk/wcelibcex/src/wce_stdlib.h 2007-03-19 08:10:12 UTC (rev 114)
+++ trunk/wcelibcex/src/wce_stdlib.h 2007-03-19 08:12:27 UTC (rev 115)
@@ -49,7 +49,10 @@
typedef unsigned long DWORD;
typedef wchar_t *LPWSTR, *PWSTR;
typedef const wchar_t *LPCWSTR, *PCWSTR;
+typedef char *LPSTR, *PSTR;
+typedef const char *LPCSTR, *PCSTR;
+
#define _MAX_DIR 256
#define _MAX_FNAME 256
#define _MAX_EXT 256
@@ -72,7 +75,7 @@
/* Size for buffers used by the getenv/putenv functions.
* NOTE: On Windows NT, _MAX_ENV value is 32767, but on Windows CE
- * we decied to make it much lower on Windows CE, see value above.
+ * we decided to make it much lower on Windows CE, see value above.
*/
#ifndef _MAX_ENV
#define _MAX_ENV REG_VALUE_SIZE_MAX
@@ -150,13 +153,22 @@
char* wceex_getenv(const char* varname);
-/* Implements GetEnvironmentVariable function from Windows NT API. */
-BOOL wceex_SetEnvironmentVariable(LPCWSTR lpName, LPCWSTR lpValue);
+int wceex_putenv(char* string);
/* Implements SetEnvironmentVariable function from Windows NT API. */
-DWORD wceex_GetEnvironmentVariable(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);
+BOOL wceex_SetEnvironmentVariableA(
+ LPCSTR lpName,
+ LPCSTR lpValue
+);
+/* Implements GetEnvironmentVariableA function from Windows NT API. */
+DWORD wceex_GetEnvironmentVariableA(
+ LPCSTR lpName,
+ LPSTR lpBuffer,
+ DWORD nSize
+);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
@@ -178,6 +190,7 @@
#define fullpath wceex_fullpath
#define wfullpath wceex_wfullpath
#define getenv wceex_getenv
+#define putenv wceex_putenv
#define GetFullPathNameW wceex_GetFullPathNameW
#define SetEnvironmentVariable wceex_SetEnvironmentVariable
#define GetEnvironmentVariable wceex_GetEnvironmentVariable
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-19 08:29:21
|
Revision: 116
http://scusi.svn.sourceforge.net/scusi/?rev=116&view=rev
Author: ohochreu
Date: 2007-03-19 01:15:52 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
remove unused variable
Modified Paths:
--------------
trunk/wcelibcex/src/wce_registry.c
Modified: trunk/wcelibcex/src/wce_registry.c
===================================================================
--- trunk/wcelibcex/src/wce_registry.c 2007-03-19 08:12:27 UTC (rev 115)
+++ trunk/wcelibcex/src/wce_registry.c 2007-03-19 08:15:52 UTC (rev 116)
@@ -301,8 +301,6 @@
PHKEY phkResult
)
{
- DWORD dwDisp;
-
return wceex_RegOpenKeyExA(hKey, lpszSubKey, 0, 0, phkResult);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-19 08:29:21
|
Revision: 117
http://scusi.svn.sourceforge.net/scusi/?rev=117&view=rev
Author: ohochreu
Date: 2007-03-19 01:16:34 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
Add several files to project (mainly env variable support)
Modified Paths:
--------------
trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj
Modified: trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj
===================================================================
--- trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj 2007-03-19 08:15:52 UTC (rev 116)
+++ trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj 2007-03-19 08:16:34 UTC (rev 117)
@@ -669,6 +669,10 @@
>
</File>
<File
+ RelativePath="..\src\wce_env.c"
+ >
+ </File>
+ <File
RelativePath="..\src\wce_errno.c"
>
</File>
@@ -681,10 +685,6 @@
>
</File>
<File
- RelativePath="..\src\wce_getenv.c"
- >
- </File>
- <File
RelativePath="..\src\wce_getopt.c"
>
</File>
@@ -721,6 +721,10 @@
>
</File>
<File
+ RelativePath="..\src\wce_registry.c"
+ >
+ </File>
+ <File
RelativePath="..\src\wce_rename.c"
>
</File>
@@ -757,6 +761,10 @@
>
</File>
<File
+ RelativePath="..\src\wce_util.c"
+ >
+ </File>
+ <File
RelativePath="..\src\wce_winbase.c"
>
</File>
@@ -834,6 +842,10 @@
RelativePath="..\src\wce_winbase.h"
>
</File>
+ <File
+ RelativePath="..\src\wce_winreg.h"
+ >
+ </File>
</Filter>
</Files>
<Globals>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-15 11:03:23
|
Revision: 113
http://scusi.svn.sourceforge.net/scusi/?rev=113&view=rev
Author: ohochreu
Date: 2007-03-15 04:03:14 -0700 (Thu, 15 Mar 2007)
Log Message:
-----------
Some more file permission defs
Modified Paths:
--------------
trunk/wcelibcex/src/wce_stat.h
Modified: trunk/wcelibcex/src/wce_stat.h
===================================================================
--- trunk/wcelibcex/src/wce_stat.h 2007-03-14 20:14:48 UTC (rev 112)
+++ trunk/wcelibcex/src/wce_stat.h 2007-03-15 11:03:14 UTC (rev 113)
@@ -105,14 +105,18 @@
#define _S_IFDIR S_IFDIR
#define S_IFCHR 0020000 /* Character device. */
#define S_IFREG 0100000 /* Regular file. */
+#define _S_IFREG S_IFREG
#define S_IFIFO 0010000 /* FIFO. */
/* Permission bits */
#define S_ISUID 04000 /* Set user ID on execution. */
#define S_ISGID 02000 /* Set group ID on execution. */
#define S_IREAD 0000400 /* Read permission, owner */
+#define _S_IREAD S_IREAD
#define S_IWRITE 0000200 /* Write permission, owner */
+#define _S_IWRITE S_IWRITE
#define S_IEXEC 0000100 /* Execute/search permission, owner */
+#define _S_IEXEC S_IEXEC
#define S_IXUSR 0000100 /* execute/search permission, */
#define S_IXGRP 0000010 /* execute/search permission, */
#define S_IXOTH 0000001 /* execute/search permission, */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <syn...@us...> - 2007-03-14 20:15:10
|
Revision: 112
http://scusi.svn.sourceforge.net/scusi/?rev=112&view=rev
Author: syntheticpp
Date: 2007-03-14 13:14:48 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
compile on win32: on win32 _fstat uses struct _stat64i32 as second parameter
Modified Paths:
--------------
trunk/wcelibcex/src/wce_io.h
Modified: trunk/wcelibcex/src/wce_io.h
===================================================================
--- trunk/wcelibcex/src/wce_io.h 2007-03-14 14:22:38 UTC (rev 111)
+++ trunk/wcelibcex/src/wce_io.h 2007-03-14 20:14:48 UTC (rev 112)
@@ -149,7 +149,7 @@
#define _lseek wceex__lseek
#define lstat wceex_lstat
#define fstat wceex_fstat
-#define _fstat fstat
+//#define _fstat fstat // on win32 _fstat uses struct _stat64i32 as second parameter
#define truncate wceex_truncate
#define ftruncate wceex_ftruncate
#define _chsize wceex__chsize
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 14:22:39
|
Revision: 111
http://scusi.svn.sourceforge.net/scusi/?rev=111&view=rev
Author: ohochreu
Date: 2007-03-14 07:22:38 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add _chsize()
Modified Paths:
--------------
trunk/wcelibcex/src/wce_io.h
Modified: trunk/wcelibcex/src/wce_io.h
===================================================================
--- trunk/wcelibcex/src/wce_io.h 2007-03-14 10:38:14 UTC (rev 110)
+++ trunk/wcelibcex/src/wce_io.h 2007-03-14 14:22:38 UTC (rev 111)
@@ -116,6 +116,7 @@
int wceex_fstat(int desc, struct stat* st);
int wceex_truncate(const char *path, long length);
int wceex_ftruncate(int fd, long length);
+#define wceex__chsize(a,b) wceex_ftruncate(a,b)
/*******************************************************************************
File-access permission functions
@@ -151,6 +152,7 @@
#define _fstat fstat
#define truncate wceex_truncate
#define ftruncate wceex_ftruncate
+#define _chsize wceex__chsize
#define waccess wceex_waccess
#define access wceex_access
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:38:15
|
Revision: 110
http://scusi.svn.sourceforge.net/scusi/?rev=110&view=rev
Author: ohochreu
Date: 2007-03-14 03:38:14 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/wcelibcex/include/wcelibcex/windows.h
Modified: trunk/wcelibcex/include/wcelibcex/windows.h
===================================================================
--- trunk/wcelibcex/include/wcelibcex/windows.h 2007-03-14 10:35:49 UTC (rev 109)
+++ trunk/wcelibcex/include/wcelibcex/windows.h 2007-03-14 10:38:14 UTC (rev 110)
@@ -68,6 +68,7 @@
#endif
//from stst.h
+#if 0 // Moved to wce_stat.h
#define _S_IFMT 0xF000 /* file type mask */
#define _S_IFDIR 0x4000 /* directory */
#define _S_IFCHR 0x2000 /* character special */
@@ -76,6 +77,7 @@
#define _S_IREAD 0x0100 /* read permission, owner */
#define _S_IWRITE 0x0080 /* write permission, owner */
#define _S_IEXEC 0x0040 /* execute/search permission, owner */
+#endif
// move to wce_stat.h
#define S_IFMT _S_IFMT
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:35:50
|
Revision: 109
http://scusi.svn.sourceforge.net/scusi/?rev=109&view=rev
Author: ohochreu
Date: 2007-03-14 03:35:49 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add file access constants
Modified Paths:
--------------
trunk/wcelibcex/src/wce_stat.h
Modified: trunk/wcelibcex/src/wce_stat.h
===================================================================
--- trunk/wcelibcex/src/wce_stat.h 2007-03-14 10:35:10 UTC (rev 108)
+++ trunk/wcelibcex/src/wce_stat.h 2007-03-14 10:35:49 UTC (rev 109)
@@ -102,6 +102,7 @@
/* File types. */
#define S_IFDIR 0040000 /* Directory. */
+#define _S_IFDIR S_IFDIR
#define S_IFCHR 0020000 /* Character device. */
#define S_IFREG 0100000 /* Regular file. */
#define S_IFIFO 0010000 /* FIFO. */
@@ -112,6 +113,19 @@
#define S_IREAD 0000400 /* Read permission, owner */
#define S_IWRITE 0000200 /* Write permission, owner */
#define S_IEXEC 0000100 /* Execute/search permission, owner */
+#define S_IXUSR 0000100 /* execute/search permission, */
+#define S_IXGRP 0000010 /* execute/search permission, */
+#define S_IXOTH 0000001 /* execute/search permission, */
+#define _S_IWUSR 0000200 /* write permission, */
+#define S_IWUSR _S_IWUSR /* write permission, owner */
+#define S_IWGRP 0000020 /* write permission, group */
+#define S_IWOTH 0000002 /* write permission, other */
+#define S_IRUSR 0000400 /* read permission, owner */
+#define S_IRGRP 0000040 /* read permission, group */
+#define S_IROTH 0000004 /* read permission, other */
+#define S_IRWXU 0000700 /* read, write, execute */
+#define S_IRWXG 0000070 /* read, write, execute */
+#define S_IRWXO 0000007 /* read, write, execute */
/* Macros to test file types masks.*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:35:14
|
Revision: 108
http://scusi.svn.sourceforge.net/scusi/?rev=108&view=rev
Author: ohochreu
Date: 2007-03-14 03:35:10 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add a Windows/UNIX time conversion fct
Modified Paths:
--------------
trunk/wcelibcex/src/wce_timesys.c
trunk/wcelibcex/src/wce_timesys.h
Modified: trunk/wcelibcex/src/wce_timesys.c
===================================================================
--- trunk/wcelibcex/src/wce_timesys.c 2007-03-14 10:34:05 UTC (rev 107)
+++ trunk/wcelibcex/src/wce_timesys.c 2007-03-14 10:35:10 UTC (rev 108)
@@ -37,8 +37,11 @@
#include <wce_time.h>
#include <wce_timesys.h>
+#include <wce_errno.h>
#include <windows.h>
+extern int errno;
+
/*******************************************************************************
* wceex_filetime_to_time - Convert FILETIME to time as time_t value
*
@@ -136,3 +139,55 @@
return wceex_mktime(&tmbuff);
}
+static BOOL g_bInit = FALSE;
+static FILETIME ftDateZero;
+static UINT64 ft64DateZero;
+
+void initFileModule()
+{
+ static const SYSTEMTIME s ={
+ 1970,
+ 1,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+ // On UNIX system, the zero date is january 1st 1970
+ SystemTimeToFileTime(&s,&ftDateZero);
+ ft64DateZero = ((UINT64)ftDateZero.dwHighDateTime << 32) | ftDateZero.dwLowDateTime;
+ g_bInit = TRUE;
+}
+
+time_t ConvertWindowsToUnixTime(FILETIME* ft)
+{
+ UINT64 ft64 = ((UINT64)ft->dwHighDateTime << 32) | ft->dwLowDateTime;
+
+ if (!g_bInit)
+ {
+ initFileModule();
+ }
+ //ft64 = number of 100-nanosecond intervals since January 1, 1601.
+
+ // sanity check
+ if (ft64 < ft64DateZero)
+ {
+ errno = EINVAL ;
+ return -1;
+ }
+
+ ft64 -= ft64DateZero; // ft64 = number of 100-nanosecond since 1 january 1970
+ // divide ft by 10,000,000 to convert from 100-nanosecond units to seconds
+ ft64 /= 10000000;
+
+ // bound check result
+ if (ft64 > 0xFFFFFFFF)
+ {
+ errno = EINVAL;
+ return -1; // value is too big to return in time_t
+ }
+
+ return (time_t)ft64;
+}
Modified: trunk/wcelibcex/src/wce_timesys.h
===================================================================
--- trunk/wcelibcex/src/wce_timesys.h 2007-03-14 10:34:05 UTC (rev 107)
+++ trunk/wcelibcex/src/wce_timesys.h 2007-03-14 10:35:10 UTC (rev 108)
@@ -51,6 +51,7 @@
time_t wceex_filetime_to_time(const FILETIME * filetime);
time_t wceex_local_to_time(const SYSTEMTIME *systemtime);
time_t wceex_local_to_time_r(int year, int mon, int day, int hour, int min, int sec);
+time_t ConvertWindowsToUnixTime(FILETIME* ft);
#ifdef __cplusplus
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:34:07
|
Revision: 107
http://scusi.svn.sourceforge.net/scusi/?rev=107&view=rev
Author: ohochreu
Date: 2007-03-14 03:34:05 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add several function declarations (coming from CESSH)
Modified Paths:
--------------
trunk/wcelibcex/src/wce_io.h
Modified: trunk/wcelibcex/src/wce_io.h
===================================================================
--- trunk/wcelibcex/src/wce_io.h 2007-03-14 10:33:05 UTC (rev 106)
+++ trunk/wcelibcex/src/wce_io.h 2007-03-14 10:34:05 UTC (rev 107)
@@ -106,6 +106,17 @@
int wceex_findnext(intptr_t handle, struct _finddata_t *fileinfo);
int wceex_findclose(intptr_t hFile);
+int wceex__open(const char* filename, int flags);
+FILE* wceex__fdopen(int fildes, const char *mode);
+int wceex__close(int fd);
+int wceex__read(int fd, void *buffer, unsigned int count);
+int wceex__write(int fd, const void *buffer, unsigned int count);
+long wceex__lseek(int fd, long offset, int whence);
+int wceex_lstat(const char* filename, struct stat* st);
+int wceex_fstat(int desc, struct stat* st);
+int wceex_truncate(const char *path, long length);
+int wceex_ftruncate(int fd, long length);
+
/*******************************************************************************
File-access permission functions
*******************************************************************************/
@@ -127,6 +138,20 @@
#define _findnext wceex_findnext
#define _findclose wceex_findclose
+#define _open wceex__open
+#define _fdopen wceex_fdopen
+#define _close wceex__close
+#define _read wceex__read
+#define read _read
+#define _write wceex__write
+#define write _write
+#define _lseek wceex__lseek
+#define lstat wceex_lstat
+#define fstat wceex_fstat
+#define _fstat fstat
+#define truncate wceex_truncate
+#define ftruncate wceex_ftruncate
+
#define waccess wceex_waccess
#define access wceex_access
#define _get_osfhandle wceex_get_osfhandle
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:33:06
|
Revision: 106
http://scusi.svn.sourceforge.net/scusi/?rev=106&view=rev
Author: ohochreu
Date: 2007-03-14 03:33:05 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add some file access definitions
Modified Paths:
--------------
trunk/wcelibcex/src/wce_fcntl.h
Modified: trunk/wcelibcex/src/wce_fcntl.h
===================================================================
--- trunk/wcelibcex/src/wce_fcntl.h 2007-03-14 10:32:26 UTC (rev 105)
+++ trunk/wcelibcex/src/wce_fcntl.h 2007-03-14 10:33:05 UTC (rev 106)
@@ -55,7 +55,12 @@
#define O_EXCL 0x0200 /* Exclusive file use. */
#define O_NOCTTY 0x0400 /* Do not assign controlling terminal. */
#define O_TRUNC 0x1000 /* Open and truncate file. */
+#ifdef _O_BINARY
+#define O_BINARY _O_BINARY
+#else
#define O_BINARY 0x8000 /* file mode is binary (untranslated) */
+#define _O_BINARY O_BINARY
+#endif
/* File access and status flags */
@@ -64,6 +69,13 @@
#define O_RDWR 0x0002 /* Open for reading and writing. */
#define O_APPEND 0x2000 /* Set append mode. */
+#define _O_RDONLY O_RDONLY
+#define _O_WRONLY O_WRONLY
+#define _O_RDWR O_RDWR
+#define _O_APPEND O_APPEND
+#define _O_CREAT O_CREAT
+#define _O_TRUNC O_TRUNC
+#define _O_EXCL O_EXCL
#ifdef __cplusplus
extern "C" {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:32:27
|
Revision: 105
http://scusi.svn.sourceforge.net/scusi/?rev=105&view=rev
Author: ohochreu
Date: 2007-03-14 03:32:26 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Initial version
Added Paths:
-----------
trunk/wcelibcex/src/wce_file.c
Added: trunk/wcelibcex/src/wce_file.c
===================================================================
--- trunk/wcelibcex/src/wce_file.c (rev 0)
+++ trunk/wcelibcex/src/wce_file.c 2007-03-14 10:32:26 UTC (rev 105)
@@ -0,0 +1,401 @@
+//-------------------------------------------------------------------------
+// <copyright file="file.c" company="Adeneo">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// The use and distribution terms for this software are covered by the
+// Limited Permissive License (Ms-LPL)
+// which can be found in the file LPL.txt at the root of this distribution.
+// By using this software in any fashion, you are agreeing to be bound by
+// the terms of this license.
+//
+// The software is licensed "as-is."
+//
+// You must not remove this notice, or any other, from this software.
+// </copyright>
+//-------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//! \addtogroup SSHCOmpat
+//! @{
+//!
+//! All rights reserved ADENEO SAS 2005
+//!
+//! \file file.c
+//!
+//! \brief file related functions
+//!
+//!
+//-----------------------------------------------------------------------------
+
+// System include
+#include <windows.h>
+#include "../include/wcelibcex/io.h"
+#include "../include/wcelibcex/errno.h"
+//#include "strings.h"
+#include "../include/wcelibcex/time.h"
+#include "wce_stat.h"
+#include "wce_timesys.h"
+#include "wce_fcntl.h"
+
+
+int wceex__open(const char* filename, int flags/*, int mode*/)
+{
+ DWORD dwDesiredAccess = 0;
+ DWORD dwCreateDispo = 0;
+ WCHAR wFileName[MAX_PATH];
+ HANDLE hFile;
+
+
+ if ((flags & _O_RDONLY) && (flags & _O_WRONLY))
+ {
+ SET_ERRNO(EINVAL);
+ return -1;
+ }
+
+ if (flags & _O_RDONLY)
+ {
+ dwDesiredAccess |= GENERIC_READ;
+ }
+ if (flags & _O_WRONLY)
+ {
+ dwDesiredAccess |= GENERIC_WRITE;
+ }
+ if (flags & _O_RDWR)
+ {
+ dwDesiredAccess |= GENERIC_WRITE | GENERIC_READ;
+ }
+
+
+ if (flags & _O_CREAT)
+ {
+ if (flags & O_EXCL)
+ {
+ dwCreateDispo |= CREATE_NEW;
+ }
+ else
+ {
+ if (flags & O_TRUNC)
+ {
+ dwCreateDispo |= CREATE_ALWAYS;
+ }
+ else
+ {
+ dwCreateDispo |= OPEN_ALWAYS;
+ }
+ }
+ }
+ else
+ {
+ dwCreateDispo |= OPEN_EXISTING;
+ if (flags & O_TRUNC)
+ {
+ dwCreateDispo |= TRUNCATE_EXISTING;
+ }
+ }
+
+ if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename, -1, wFileName, MAX_PATH))
+ {
+ SET_ERRNO(ENOENT);
+ return -1;
+ }
+
+ if (dwCreateDispo == 0)
+ {
+ dwCreateDispo = OPEN_EXISTING;
+ }
+ if (dwDesiredAccess == 0)
+ {
+ dwDesiredAccess = GENERIC_READ;
+ }
+
+ hFile = CreateFile(wFileName,dwDesiredAccess,FILE_SHARE_WRITE | FILE_SHARE_READ,NULL,dwCreateDispo,FILE_ATTRIBUTE_NORMAL,NULL);
+
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ SET_ERRNO(-1);
+ return -1;
+ }
+
+
+ if (flags & _O_APPEND)
+ {
+ SetFilePointer(hFile,0,NULL,FILE_END);
+ }
+
+
+ if ((int) hFile <0)
+ {
+ // !!!!!! on Unix it is used sometimes considered as an error (error is -1)
+ DEBUGCHK(0);
+ }
+
+ return (int) hFile;
+
+}
+
+FILE* wceex__fdopen(int fildes, const char *mode)
+{
+ WCHAR wMode[5];
+ if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mode, -1, wMode, 5))
+ {
+ SET_ERRNO(EINVAL);
+ return NULL;
+ }
+ return _wfdopen((HANDLE)fildes, wMode);
+}
+
+
+int wceex__close(int fd)
+{
+ if (CloseHandle((HANDLE) fd))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+int wceex__read(int fd, void *buffer, unsigned int count)
+{
+ DWORD dwRead = 0;
+ if (ReadFile((HANDLE)fd,buffer,count,&dwRead,NULL))
+ {
+ return dwRead;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+int wceex__write(int fd, const void *buffer, unsigned int count)
+{
+ DWORD dwWritten = 0;
+ if (WriteFile((HANDLE)fd,buffer,count,&dwWritten,NULL))
+ {
+ return dwWritten;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+long wceex__lseek(int fd, long offset, int whence)
+{
+ DWORD dwMethod,dwDistance;
+ switch (whence)
+ {
+ case SEEK_SET:
+ dwMethod = FILE_BEGIN;
+ break;
+ case SEEK_CUR:
+ dwMethod = FILE_CURRENT;
+ break;
+ case SEEK_END:
+ dwMethod = FILE_END;
+ break;
+ default:
+ return -1;
+ }
+
+ dwDistance = SetFilePointer((HANDLE)fd,offset,NULL,dwMethod);
+ if (dwDistance == (DWORD)-1)
+ {
+ return -1;
+ }
+ else
+ {
+ return (long) dwDistance;
+ }
+}
+
+#if 0
+int wceex_unlink(const char* pathname)
+{
+ BOOL bSuccess;
+ WCHAR wPathName[MAX_PATH];
+ if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pathname, -1, wPathName, MAX_PATH))
+ {
+ SET_ERRNO(EINVAL);
+ return -1;
+ }
+
+ bSuccess = DeleteFile(wPathName);
+
+ return bSuccess ? 0 : -1 ;
+}
+
+void __cdecl wceex_rewind(FILE *stream)
+{
+ fseek(stream, 0L, SEEK_SET);
+}
+
+int wceex_stat(const char* filename, struct stat* st)
+{
+ WCHAR wFileName[MAX_PATH];
+ WIN32_FILE_ATTRIBUTE_DATA s;
+
+ if (filename == NULL || st == NULL)
+ {
+ SET_ERRNO( EINVAL );
+ return -1;
+ }
+
+ if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename, -1, wFileName, MAX_PATH))
+ {
+ SET_ERRNO(EINVAL);
+ return -1;
+ }
+
+ if (!GetFileAttributesEx(wFileName, GetFileExInfoStandard, (LPVOID)&s))
+ {
+ SET_ERRNO( ENOENT );
+ return -1;
+ }
+
+ st->st_mode = 0;
+ if (s.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ st->st_mode |= _S_IFDIR;
+ st->st_mode |= S_IEXEC | S_IXGRP | S_IXOTH;
+ }
+ else
+ {
+ st->st_mode |= S_IFREG;
+ }
+ if (!(s.dwFileAttributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_INROM)))
+ {
+ st->st_mode |= S_IWRITE | S_IWGRP | S_IWOTH;
+ }
+ if (!(s.dwFileAttributes & (FILE_ATTRIBUTE_ROMMODULE)))
+ {
+ st->st_mode |= S_IREAD | S_IROTH | S_IRGRP; // TODO: assuming readable, but this may not be the case
+ }
+ else
+ {
+ st->st_mode &= ~(S_IREAD | S_IROTH | S_IRGRP | S_IWRITE | S_IWGRP | S_IWOTH); // ROM module is executable but nor readable nor writeable
+ st->st_mode |= S_IEXEC | S_IXGRP | S_IXOTH; // ROM module is executable
+ }
+
+
+ st->st_size = s.nFileSizeLow;
+ st->st_atime = ConvertWindowsToUnixTime(&s.ftLastAccessTime);
+ st->st_mtime = ConvertWindowsToUnixTime(&s.ftLastWriteTime);
+ st->st_ctime = ConvertWindowsToUnixTime(&s.ftCreationTime);
+ st->st_dev = 0;
+ st->st_ino = 0;
+ st->st_uid = 0;
+ st->st_gid = 0;
+ st->st_rdev = 0;
+ st->st_nlink = 1;
+
+ return 0;
+}
+#endif
+
+int wceex_lstat(const char* filename, struct stat* st)
+{
+ return wceex_stat(filename, st);
+}
+
+int wceex_fstat(int desc, struct stat* st)
+{
+ HANDLE h;
+ BY_HANDLE_FILE_INFORMATION info;
+
+ h = (HANDLE) desc;
+ if (h == INVALID_HANDLE_VALUE || st == NULL)
+ {
+ SET_ERRNO( EINVAL );
+ return -1;
+ }
+
+
+ if (!GetFileInformationByHandle(h, &info))
+ {
+ SET_ERRNO( ENOENT );
+ return -1;
+ }
+
+ st->st_mode = 0;
+
+ if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ st->st_mode |= _S_IFDIR;
+ st->st_mode |= S_IEXEC | S_IXGRP | S_IXOTH;
+ }
+ else
+ {
+ st->st_mode |= S_IFREG;
+ }
+
+ if (!(info.dwFileAttributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_INROM)))
+ {
+ st->st_mode |= S_IWRITE | S_IWGRP | S_IWOTH;
+ }
+
+ if (!(info.dwFileAttributes & (FILE_ATTRIBUTE_ROMMODULE)))
+ {
+ st->st_mode |= S_IREAD | S_IROTH | S_IRGRP;
+ }
+ else
+ {
+ st->st_mode &= ~(S_IREAD | S_IROTH | S_IRGRP | S_IWRITE | S_IWGRP | S_IWOTH); // ROM module is executable but nor readable nor writeable
+ st->st_mode |= S_IEXEC | S_IXGRP | S_IXOTH; // ROM module is executable
+ }
+
+ st->st_size = info.nFileSizeLow;
+ st->st_atime = ConvertWindowsToUnixTime(&info.ftLastAccessTime);
+ st->st_mtime = ConvertWindowsToUnixTime(&info.ftLastWriteTime);
+ st->st_ctime = ConvertWindowsToUnixTime(&info.ftCreationTime);
+ st->st_dev = 0;
+ st->st_ino = 0;
+ st->st_uid = 0;
+ st->st_gid = 0;
+ st->st_rdev = 0;
+ st->st_nlink = 1;
+
+ return 0;
+}
+
+
+int wceex_truncate(const char *path, long length)
+{
+ int iRet = -1;
+ HANDLE h;
+ WCHAR wFileName[MAX_PATH];
+
+ if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, path, -1, wFileName, MAX_PATH))
+ {
+ SET_ERRNO(EINVAL);
+ return -1;
+ }
+
+ h = CreateFile(wFileName,GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+ if (h != INVALID_HANDLE_VALUE)
+ {
+ iRet = wceex_ftruncate((int)h,length);
+ CloseHandle(h);
+ }
+
+ return iRet;
+}
+
+int wceex_ftruncate(int fd, long length)
+{
+ int iRet = -1;
+
+ if (SetFilePointer((HANDLE)fd,length,NULL,FILE_BEGIN))
+ {
+ if (SetEndOfFile((HANDLE)fd))
+ {
+ iRet = 0;
+ }
+ }
+ return iRet;
+}
+
+// End of Doxygen group SSHCompat
+//! @}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:31:47
|
Revision: 104
http://scusi.svn.sourceforge.net/scusi/?rev=104&view=rev
Author: ohochreu
Date: 2007-03-14 03:31:46 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
add SET_ERRNO macro
Modified Paths:
--------------
trunk/wcelibcex/src/wce_errno.h
Modified: trunk/wcelibcex/src/wce_errno.h
===================================================================
--- trunk/wcelibcex/src/wce_errno.h 2007-03-14 10:30:48 UTC (rev 103)
+++ trunk/wcelibcex/src/wce_errno.h 2007-03-14 10:31:46 UTC (rev 104)
@@ -40,6 +40,7 @@
# error "Only Winddows CE target is supported!"
#endif
+#define SET_ERRNO(x) (errno = x)
#ifdef __cplusplus
extern "C" {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-14 10:30:54
|
Revision: 103
http://scusi.svn.sourceforge.net/scusi/?rev=103&view=rev
Author: ohochreu
Date: 2007-03-14 03:30:48 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add wce_file.c to project
Modified Paths:
--------------
trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj
Modified: trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj
===================================================================
--- trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj 2007-03-12 14:26:52 UTC (rev 102)
+++ trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj 2007-03-14 10:30:48 UTC (rev 103)
@@ -673,6 +673,10 @@
>
</File>
<File
+ RelativePath="..\src\wce_file.c"
+ >
+ </File>
+ <File
RelativePath="..\src\wce_findfile.c"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:26:54
|
Revision: 102
http://scusi.svn.sourceforge.net/scusi/?rev=102&view=rev
Author: ohochreu
Date: 2007-03-12 07:26:52 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj
Modified: trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj
===================================================================
--- trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj 2007-03-12 14:12:08 UTC (rev 101)
+++ trunk/wcelibcex/msvc80/wcelibcex_lib.vcproj 2007-03-12 14:26:52 UTC (rev 102)
@@ -637,6 +637,10 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
+ RelativePath="..\src\helperfcts.c"
+ >
+ </File>
+ <File
RelativePath="..\src\wce_abort.c"
>
</File>
@@ -759,6 +763,10 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath="..\src\helperfcts.h"
+ >
+ </File>
+ <File
RelativePath="..\src\errno.h"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:12:12
|
Revision: 101
http://scusi.svn.sourceforge.net/scusi/?rev=101&view=rev
Author: ohochreu
Date: 2007-03-12 07:12:08 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/wcelibcex/src/helperfcts.c
trunk/wcelibcex/src/helperfcts.h
Added: trunk/wcelibcex/src/helperfcts.c
===================================================================
--- trunk/wcelibcex/src/helperfcts.c (rev 0)
+++ trunk/wcelibcex/src/helperfcts.c 2007-03-12 14:12:08 UTC (rev 101)
@@ -0,0 +1,165 @@
+/*
+ * $Id: helperfcts.c,v 1.0 2007/03/01 12:32:28 ohochreu Exp $
+ *
+ * Various internal helper functions
+ *
+ * Created by Olivier Hochreutiner (olivier dot hochreutiner at gmail dot com)
+ *
+ * Copyright (c) 2007 Olivier Hochreutiner
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+ * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * MIT License:
+ * http://opensource.org/licenses/mit-license.php
+ *
+ */
+
+#include "helperfcts.h"
+#include <errno.h>
+
+BOOL MultiByteToWideCharSecure(LPCSTR in, LPWSTR * pout, unsigned int maxlength)
+{
+ unsigned int length = 0;
+ if (S_OK != StringCchLengthA(in, maxlength, &length))
+ {
+ *pout = NULL;
+ return FALSE;
+ }
+ *pout = (LPWSTR)malloc((length+1)*sizeof(WCHAR));
+ if (NULL == *pout)
+ {
+ return FALSE;
+ }
+
+ if (0 == MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, in, -1, *pout, length+1))
+ {
+ free(*pout);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int
+_winerr2errno(DWORD werror)
+{
+ switch(werror) {
+ case 0:
+ return 0;
+ case ERROR_FILE_NOT_FOUND:
+ case ERROR_PATH_NOT_FOUND:
+ return ENOENT;
+ case ERROR_ACCESS_DENIED:
+ return EACCES;
+ case ERROR_DEV_NOT_EXIST:
+ return ENODEV;
+ case ERROR_ALREADY_EXISTS:
+ return EEXIST;
+ case ERROR_DIR_NOT_EMPTY:
+ return ENOTEMPTY;
+
+ /* Winsock Errors */
+/*
+ case WSAEWOULDBLOCK:
+ return EWOULDBLOCK;
+*/
+ case WSAEINPROGRESS:
+ return EINPROGRESS;
+ case WSAEALREADY:
+ return EALREADY;
+ case WSAENOTSOCK:
+ return ENOTSOCK;
+ case WSAEDESTADDRREQ:
+ return EDESTADDRREQ;
+ case WSAEMSGSIZE:
+ return EMSGSIZE;
+ case WSAEPROTOTYPE:
+ return EPROTOTYPE;
+ case WSAENOPROTOOPT:
+ return ENOPROTOOPT;
+/*
+ case WSAEPROTONOSUPPORT:
+ return EPROTONOSUPPORT;
+*/
+ case WSAESOCKTNOSUPPORT:
+ return ESOCKTNOSUPPORT;
+ case WSAEOPNOTSUPP:
+ return WSAEOPNOTSUPP;
+ case WSAEPFNOSUPPORT:
+ return EPFNOSUPPORT;
+/*
+ case WSAEAFNOSUPPORT:
+ return EAFNOSUPPORT;
+*/
+ case WSAEADDRINUSE:
+ return EADDRINUSE;
+ case WSAEADDRNOTAVAIL:
+ return EADDRNOTAVAIL;
+ case WSAENETDOWN:
+ return ENETDOWN;
+ case WSAENETUNREACH:
+ return ENETUNREACH;
+ case WSAENETRESET:
+ return ENETRESET;
+ case WSAECONNABORTED:
+ return ECONNABORTED;
+ case WSAECONNRESET:
+ return ECONNRESET;
+ case WSAENOBUFS:
+ return ENOBUFS;
+ case WSAEISCONN:
+ return EISCONN;
+ case WSAENOTCONN:
+ return ENOTCONN;
+ case WSAESHUTDOWN:
+ return ESHUTDOWN;
+ case WSAETOOMANYREFS:
+ return ETOOMANYREFS;
+ case WSAETIMEDOUT:
+ return ETIMEDOUT;
+ case WSAECONNREFUSED:
+ return ECONNREFUSED;
+ case WSAELOOP:
+ return ELOOP;
+ case WSAENAMETOOLONG:
+ return ENAMETOOLONG;
+ case WSAEHOSTDOWN:
+ return EHOSTDOWN;
+ case WSAEHOSTUNREACH:
+ return EHOSTUNREACH;
+ case WSAENOTEMPTY:
+ return ENOTEMPTY;
+ case WSAEPROCLIM:
+ return EPROCLIM;
+ case WSAEUSERS:
+ return EUSERS;
+ case WSAEDQUOT:
+ return EDQUOT;
+ case WSAESTALE:
+ return ESTALE;
+ case WSAEREMOTE:
+ return EREMOTE;
+
+ case WSAEDISCON:
+ return ENOTSUP;
+
+ default:
+ return ENOTSUP;
+ }
+ return ENOTSUP;
+}
Added: trunk/wcelibcex/src/helperfcts.h
===================================================================
--- trunk/wcelibcex/src/helperfcts.h (rev 0)
+++ trunk/wcelibcex/src/helperfcts.h 2007-03-12 14:12:08 UTC (rev 101)
@@ -0,0 +1,51 @@
+/*
+ * $Id: helperfcts.c,v 1.0 2007/03/01 12:32:28 ohochreu Exp $
+ *
+ * Various internal helper functions
+ *
+ * Created by Olivier Hochreutiner (olivier dot hochreutiner at gmail dot com)
+ *
+ * Copyright (c) 2007 Olivier Hochreutiner
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+ * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * MIT License:
+ * http://opensource.org/licenses/mit-license.php
+ *
+ */
+
+
+/*
+ * Multibyte to wide-char conversion.
+ *
+ * in : Pointer to null-terminated string to convert.
+ * pout : Pointer to where the address of the converted string should be stored.
+ * It is the caller's responsibility to free the memory allocated to store
+ * the converted string by calling free()
+ *
+ * maxlength : Maximum length of the input string. If longer, this function fails.
+ *
+ * Return value: TRUE if success, FALSE if input string too long.
+ */
+
+#include <windows.h>
+
+BOOL MultiByteToWideCharSecure(LPCSTR in, LPWSTR * pout, unsigned int maxlength);
+
+int _winerr2errno(DWORD werror);
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:11:02
|
Revision: 100
http://scusi.svn.sourceforge.net/scusi/?rev=100&view=rev
Author: ohochreu
Date: 2007-03-12 07:11:00 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/wcelibcex/src/wce_winbase.c
trunk/wcelibcex/src/wce_winbase.h
Modified: trunk/wcelibcex/src/wce_winbase.c
===================================================================
--- trunk/wcelibcex/src/wce_winbase.c 2007-03-12 14:09:26 UTC (rev 99)
+++ trunk/wcelibcex/src/wce_winbase.c 2007-03-12 14:11:00 UTC (rev 100)
@@ -36,3 +36,10 @@
{
return NULL;
}
+
+BOOL wceex_GetSystemTimeAsFileTime(LPFILETIME pft)
+{
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+ return SystemTimeToFileTime(&st, pft);
+}
Modified: trunk/wcelibcex/src/wce_winbase.h
===================================================================
--- trunk/wcelibcex/src/wce_winbase.h 2007-03-12 14:09:26 UTC (rev 99)
+++ trunk/wcelibcex/src/wce_winbase.h 2007-03-12 14:11:00 UTC (rev 100)
@@ -46,6 +46,14 @@
HANDLE GetStdHandle( DWORD nStdHandle );
+BOOL wceex_GetSystemTimeAsFileTime(LPFILETIME pft);
+
+#ifdef WCEEX_FREE_NAMES
+
+#define GetSystemTimeAsFileTime wceex_GetSystemTimeAsFileTime
+
+#endif
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:09:27
|
Revision: 99
http://scusi.svn.sourceforge.net/scusi/?rev=99&view=rev
Author: ohochreu
Date: 2007-03-12 07:09:26 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/wcelibcex/src/wce_process.c
Modified: trunk/wcelibcex/src/wce_process.c
===================================================================
--- trunk/wcelibcex/src/wce_process.c 2007-03-12 14:06:18 UTC (rev 98)
+++ trunk/wcelibcex/src/wce_process.c 2007-03-12 14:09:26 UTC (rev 99)
@@ -31,14 +31,13 @@
#include "wce_process.h"
#include "wce_errno.h"
+#include "helperfcts.h"
#include <winbase.h>
#include <winnls.h>
#define MAX_ARGV_NB 512
#define MAX_ARGV_SIZE 512
-BOOL MultiByteToWideCharSecure(LPCSTR, LPWSTR *, unsigned int);
-
intptr_t wceex_wspawnv(int mode, LPCWSTR cmdname, LPCWSTR const* argv)
{
size_t arglength;
@@ -210,24 +209,3 @@
return wceex_spawnv(mode, cmdname, argv);
}
-BOOL MultiByteToWideCharSecure(LPCSTR in, LPWSTR * pout, unsigned int maxlength)
-{
- unsigned int length = 0;
- if (S_OK != StringCchLengthA(in, maxlength, &length))
- {
- *pout = NULL;
- return FALSE;
- }
- *pout = (LPWSTR)malloc((length+1)*sizeof(WCHAR));
- if (NULL == *pout)
- {
- return FALSE;
- }
-
- if (0 == MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, in, -1, *pout, length+1))
- {
- free(*pout);
- return FALSE;
- }
- return TRUE;
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:06:20
|
Revision: 98
http://scusi.svn.sourceforge.net/scusi/?rev=98&view=rev
Author: ohochreu
Date: 2007-03-12 07:06:18 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/wcelibcex/src/wce_io.h
Modified: trunk/wcelibcex/src/wce_io.h
===================================================================
--- trunk/wcelibcex/src/wce_io.h 2007-03-12 14:03:27 UTC (rev 97)
+++ trunk/wcelibcex/src/wce_io.h 2007-03-12 14:06:18 UTC (rev 98)
@@ -62,6 +62,16 @@
# define _FSIZE_T_DEFINED
#endif
+typedef struct _fdent
+{
+ int fd;
+ int type;
+ HANDLE hFile;
+ int flags;
+} _fdent_t;
+
+#define MAXFDS 100
+
#define MAX_PATH 260
#ifndef _FINDDATA_T_DEFINED
@@ -96,8 +106,6 @@
int wceex_findnext(intptr_t handle, struct _finddata_t *fileinfo);
int wceex_findclose(intptr_t hFile);
-int wceex_open(const char *filename, int oflag, int pmode);
-
/*******************************************************************************
File-access permission functions
*******************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:03:29
|
Revision: 97
http://scusi.svn.sourceforge.net/scusi/?rev=97&view=rev
Author: ohochreu
Date: 2007-03-12 07:03:27 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Add more error codes
Modified Paths:
--------------
trunk/wcelibcex/src/wce_errno.h
Modified: trunk/wcelibcex/src/wce_errno.h
===================================================================
--- trunk/wcelibcex/src/wce_errno.h 2007-03-12 14:02:08 UTC (rev 96)
+++ trunk/wcelibcex/src/wce_errno.h 2007-03-12 14:03:27 UTC (rev 97)
@@ -57,45 +57,130 @@
/* Error Codes */
-#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 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 ENAMETOOLONG 38
-#define ENOLCK 39
-#define ENOSYS 40
-#define ENOTEMPTY 41
-#define EILSEQ 42
+#define EPERM 1 /* Not super-user */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No children */
+#define EAGAIN 11 /* No more processes */
+#define ENOMEM 12 /* Not enough core */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Mount device busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* Too many open files in system */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math arg out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define ENOMSG 35 /* No message of desired type */
+#define EIDRM 36 /* Identifier removed */
+#define ECHRNG 37 /* Channel number out of range */
+#define EL2NSYNC 38 /* Level 2 not synchronized */
+#define EL3HLT 39 /* Level 3 halted */
+#define EL3RST 40 /* Level 3 reset */
+#define ELNRNG 41 /* Link number out of range */
+#define EUNATCH 42 /* Protocol driver not attached */
+#define ENOCSI 43 /* No CSI structure available */
+#define EL2HLT 44 /* Level 2 halted */
+#define EDEADLK 45 /* Deadlock condition */
+#define ENOLCK 46 /* No record locks available */
+#define EBADE 50 /* Invalid exchange */
+#define EBADR 51 /* Invalid request descriptor */
+#define EXFULL 52 /* Exchange full */
+#define ENOANO 53 /* No anode */
+#define EBADRQC 54 /* Invalid request code */
+#define EBADSLT 55 /* Invalid slot */
+#define EDEADLOCK 56 /* File locking deadlock error */
+#define EBFONT 57 /* Bad font file fmt */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data (for no delay io) */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* The object is remote */
+#define ENOLINK 67 /* The link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 74 /* Multihop attempted */
+#define ELBIN 75 /* Inode is remote (not really error) */
+#define EDOTDOT 76 /* Cross mount point (not really error) */
+#define EBADMSG 77 /* Trying to read unreadable message */
+#define EFTYPE 79 /* Inappropriate file type or format */
+#define ENOTUNIQ 80 /* Given log. name not unique */
+#define EBADFD 81 /* f.d. invalid for this operation */
+#define EREMCHG 82 /* Remote address changed */
+#define ELIBACC 83 /* Can't access a needed shared lib */
+#define ELIBBAD 84 /* Accessing a corrupted shared lib */
+#define ELIBSCN 85 /* .lib section in a.out corrupted */
+#define ELIBMAX 86 /* Attempting to link in too many libs */
+#define ELIBEXEC 87 /* Attempting to exec a shared library */
+#define ENOSYS 88 /* Function not implemented */
+#define ENMFILE 89 /* No more files */
+#define ENOTEMPTY 90 /* Directory not empty */
+#define ENAMETOOLONG 91 /* File or path name too long */
+#define ELOOP 92 /* Too many symbolic links */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+//#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
+#define EPROTOTYPE 107 /* Protocol wrong type for socket */
+#define ENOTSOCK 108 /* Socket operation on non-socket */
+#define ENOPROTOOPT 109 /* Protocol not available */
+#define ESHUTDOWN 110 /* Can't send after socket shutdown */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EADDRINUSE 112 /* Address already in use */
+#define ECONNABORTED 113 /* Connection aborted */
+#define ENETUNREACH 114 /* Network is unreachable */
+#define ENETDOWN 115 /* Network interface is not configured */
+#define ETIMEDOUT 116 /* Connection timed out */
+#define EHOSTDOWN 117 /* Host is down */
+#define EHOSTUNREACH 118 /* Host is unreachable */
+#define EINPROGRESS 119 /* Connection already in progress */
+#define EALREADY 120 /* Socket already connected */
+#define EDESTADDRREQ 121 /* Destination address required */
+#define EMSGSIZE 122 /* Message too long */
+//#define EPROTONOSUPPORT 123 /* Unknown protocol */
+#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
+#define EADDRNOTAVAIL 125 /* Address not available */
+#define ENETRESET 126
+#define EISCONN 127 /* Socket is already connected */
+#define ENOTCONN 128 /* Socket is not connected */
+#define ETOOMANYREFS 129
+#define EPROCLIM 130
+#define EUSERS 131
+#define EDQUOT 132
+#define ESTALE 133
+#define ENOTSUP 134 /* Not supported */
+#define ENOMEDIUM 135 /* No medium (in tape drive) */
+#define ENOSHARE 136 /* No such host or network path */
+#define ECASECLASH 137 /* Filename exists with different case */
+#define EILSEQ 138
+#define EOVERFLOW 139 /* Value too large for defined data type */
+
#ifndef _ERRNO_T_DEFINED
typedef int errno_t;
# define _ERRNO_T_DEFINED
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <oho...@us...> - 2007-03-12 14:02:15
|
Revision: 96
http://scusi.svn.sourceforge.net/scusi/?rev=96&view=rev
Author: ohochreu
Date: 2007-03-12 07:02:08 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Add wce_winbase.h include
Modified Paths:
--------------
trunk/wcelibcex/include/wcelibcex/windows.h
Modified: trunk/wcelibcex/include/wcelibcex/windows.h
===================================================================
--- trunk/wcelibcex/include/wcelibcex/windows.h 2007-03-11 16:52:33 UTC (rev 95)
+++ trunk/wcelibcex/include/wcelibcex/windows.h 2007-03-12 14:02:08 UTC (rev 96)
@@ -9,6 +9,8 @@
# endif
#endif
+#include "..\..\src\wce_winbase.h"
+
#ifdef __cplusplus
extern "C" {
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|