mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
RFC: Remove Windows CE support (#4342)
* Remove _WIN32_WCE macro Poco now use C++17 and Windows CE does not support it and VS2017 does also not support it so we can just remove Windows CE code. First remove all macro usages from our own files. * Remove WinCE support from build files Poco now use C++17 and Windows CE does not support it and VS2017 does also not support it so we can just remove Windows CE code. Remove all references from build systems / scripts. * Remove Windows CE related source and header files Poco now use C++17 and Windows CE does not support it and VS2017 does also not support it so we can just remove Windows CE code. First remove all macro usages from our own files. * Remove wcelibcex folder Poco now use C++17 and Windows CE does not support it and VS2017 does also not support it so we can just remove Windows CE code. First remove all macro usages from our own files. * Remove rest Windows CE mentions There where some Windows CE mentions left. Remove those. * Update Windows CE documentation We should keep documentation some time so people can find reason for remove. --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
parent
46759cab03
commit
708a5d8307
@ -10,10 +10,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(ActiveRecord-testrunner ${TEST_SRCS})
|
add_executable(ActiveRecord-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
//
|
|
||||||
// WinCEDriver.cpp
|
|
||||||
//
|
|
||||||
// Console-based test driver for Windows CE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2020, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "CppUnit/TestRunner.h"
|
|
||||||
#include "ActiveRecordTestSuite.h"
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
|
|
||||||
int wmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
std::vector<std::string> args;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
|
||||||
args.push_back(std::string(buffer));
|
|
||||||
}
|
|
||||||
CppUnit::TestRunner runner;
|
|
||||||
runner.addTest("ActiveRecordTestSuite", ActiveRecordTestSuite::suite());
|
|
||||||
return runner.run(args) ? 0 : 1;
|
|
||||||
}
|
|
@ -104,15 +104,12 @@ void TextTestResult::ignoring(const std::string ignore)
|
|||||||
|
|
||||||
void TextTestResult::setup()
|
void TextTestResult::setup()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
const char* env = std::getenv("CPPUNIT_IGNORE");
|
const char* env = std::getenv("CPPUNIT_IGNORE");
|
||||||
if (env)
|
if (env)
|
||||||
{
|
{
|
||||||
std::string ignored = env;
|
std::string ignored = env;
|
||||||
ignoring(ignored);
|
ignoring(ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,10 +10,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(Crypto-testrunner ${TEST_SRCS})
|
add_executable(Crypto-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
//
|
|
||||||
// WinCEDriver.cpp
|
|
||||||
//
|
|
||||||
// Console-based test driver for Windows CE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "CppUnit/TestRunner.h"
|
|
||||||
#include "CryptoTestSuite.h"
|
|
||||||
#include "Poco/Crypto/Crypto.h"
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
|
|
||||||
class CryptoInitializer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CryptoInitializer()
|
|
||||||
{
|
|
||||||
Poco::Crypto::initializeCrypto();
|
|
||||||
}
|
|
||||||
|
|
||||||
~CryptoInitializer()
|
|
||||||
{
|
|
||||||
Poco::Crypto::uninitializeCrypto();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int _tmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
CryptoInitializer ci;
|
|
||||||
|
|
||||||
std::vector<std::string> args;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
|
||||||
args.push_back(std::string(buffer));
|
|
||||||
}
|
|
||||||
CppUnit::TestRunner runner;
|
|
||||||
runner.addTest("CryptoTestSuite", CryptoTestSuite::suite());
|
|
||||||
return runner.run(args) ? 0 : 1;
|
|
||||||
}
|
|
@ -72,7 +72,7 @@ else()
|
|||||||
message(STATUS "PostgreSQL Support Disabled")
|
message(STATUS "PostgreSQL Support Disabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ODBC_FOUND AND ENABLE_DATA_ODBC AND NOT WINCE)
|
if(ODBC_FOUND AND ENABLE_DATA_ODBC)
|
||||||
message(STATUS "ODBC Support Enabled")
|
message(STATUS "ODBC Support Enabled")
|
||||||
add_subdirectory(ODBC)
|
add_subdirectory(ODBC)
|
||||||
else()
|
else()
|
||||||
|
@ -49,9 +49,6 @@ if(POCO_UNBUNDLED)
|
|||||||
SQLITE_THREADSAFE=1
|
SQLITE_THREADSAFE=1
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
if(WINCE)
|
|
||||||
target_compile_definitions(DataSQLite PRIVATE SQLITE_MSVC_LOCALTIME_API)
|
|
||||||
endif(WINCE)
|
|
||||||
target_compile_definitions(DataSQLite PRIVATE
|
target_compile_definitions(DataSQLite PRIVATE
|
||||||
SQLITE_THREADSAFE=1
|
SQLITE_THREADSAFE=1
|
||||||
SQLITE_DISABLE_LFS
|
SQLITE_DISABLE_LFS
|
||||||
|
@ -11,10 +11,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(DataSQLite-testrunner ${TEST_SRCS})
|
add_executable(DataSQLite-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
//
|
|
||||||
// WinCEDriver.cpp
|
|
||||||
//
|
|
||||||
// Console-based test driver for Windows CE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "CppUnit/TestRunner.h"
|
|
||||||
#include "SQLiteTestSuite.h"
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
|
|
||||||
int wmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
std::vector<std::string> args;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
|
||||||
args.push_back(std::string(buffer));
|
|
||||||
}
|
|
||||||
CppUnit::TestRunner runner;
|
|
||||||
runner.addTest("SQLiteTestSuite", SQLiteTestSuite::suite());
|
|
||||||
return runner.run(args) ? 0 : 1;
|
|
||||||
}
|
|
@ -11,10 +11,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(Data-testrunner ${TEST_SRCS})
|
add_executable(Data-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
//
|
|
||||||
// WinCEDriver.cpp
|
|
||||||
//
|
|
||||||
// Console-based test driver for Windows CE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "CppUnit/TestRunner.h"
|
|
||||||
#include "DataTestSuite.h"
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
|
|
||||||
int wmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
std::vector<std::string> args;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
|
||||||
args.push_back(std::string(buffer));
|
|
||||||
}
|
|
||||||
CppUnit::TestRunner runner;
|
|
||||||
runner.addTest("DataTestSuite", DataTestSuite::suite());
|
|
||||||
return runner.run(args) ? 0 : 1;
|
|
||||||
}
|
|
@ -11,10 +11,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS WIN
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(Data-testrunner ${TEST_SRCS})
|
add_executable(Data-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
|
@ -10,10 +10,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(Encodings-testrunner ${TEST_SRCS})
|
add_executable(Encodings-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
//
|
|
||||||
// WinCEDriver.cpp
|
|
||||||
//
|
|
||||||
// Console-based test driver for Windows CE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "CppUnit/TestRunner.h"
|
|
||||||
#include "EncodingsTestSuite.h"
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
|
|
||||||
int wmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
std::vector<std::string> args;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
|
||||||
args.push_back(std::string(buffer));
|
|
||||||
}
|
|
||||||
CppUnit::TestRunner runner;
|
|
||||||
runner.addTest("EncodingsTestSuite", EncodingsTestSuite::suite());
|
|
||||||
return runner.run(args) ? 0 : 1;
|
|
||||||
}
|
|
@ -10,18 +10,10 @@ POCO_HEADERS_AUTO(SRCS ${HDRS_G})
|
|||||||
POCO_SOURCES_AUTO_PLAT(SRCS UNIX src/SyslogChannel.cpp)
|
POCO_SOURCES_AUTO_PLAT(SRCS UNIX src/SyslogChannel.cpp)
|
||||||
POCO_HEADERS_AUTO(SRCS include/Poco/SyslogChannel.h)
|
POCO_HEADERS_AUTO(SRCS include/Poco/SyslogChannel.h)
|
||||||
|
|
||||||
# For Windows CE we need to disable these
|
|
||||||
if(WINCE)
|
|
||||||
POCO_SOURCES_AUTO_PLAT(SRCS OFF
|
|
||||||
src/WindowsConsoleChannel.cpp
|
|
||||||
src/EventLogChannel.cpp
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
POCO_SOURCES_AUTO_PLAT(SRCS WIN32
|
POCO_SOURCES_AUTO_PLAT(SRCS WIN32
|
||||||
src/WindowsConsoleChannel.cpp
|
src/WindowsConsoleChannel.cpp
|
||||||
src/EventLogChannel.cpp
|
src/EventLogChannel.cpp
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Version Resource
|
# Version Resource
|
||||||
if(MSVC AND BUILD_SHARED_LIBS)
|
if(MSVC AND BUILD_SHARED_LIBS)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
wcelibcex-1.0
|
|
@ -42,7 +42,7 @@
|
|||||||
// #define POCO_NO_SHAREDMEMORY
|
// #define POCO_NO_SHAREDMEMORY
|
||||||
|
|
||||||
|
|
||||||
// Define if no <locale> header is available (such as on WinCE)
|
// Define if no <locale> header is available
|
||||||
// #define POCO_NO_LOCALE
|
// #define POCO_NO_LOCALE
|
||||||
|
|
||||||
|
|
||||||
@ -165,12 +165,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Windows CE has no locale support
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#define POCO_NO_LOCALE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Enable the poco_debug_* and poco_trace_* macros
|
// Enable the poco_debug_* and poco_trace_* macros
|
||||||
// even if the _DEBUG variable is not set.
|
// even if the _DEBUG variable is not set.
|
||||||
// This allows the use of these macros in a release version.
|
// This allows the use of these macros in a release version.
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
//
|
|
||||||
// Environment_WINCE.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Core
|
|
||||||
// Module: Environment
|
|
||||||
//
|
|
||||||
// Definition of the EnvironmentImpl class for WINCE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_Environment_WINCE_INCLUDED
|
|
||||||
#define Foundation_Environment_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API EnvironmentImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef UInt8 NodeId[6]; /// Ethernet address.
|
|
||||||
|
|
||||||
static std::string getImpl(const std::string& name);
|
|
||||||
static bool hasImpl(const std::string& name);
|
|
||||||
static void setImpl(const std::string& name, const std::string& value);
|
|
||||||
static std::string osNameImpl();
|
|
||||||
static std::string osDisplayNameImpl();
|
|
||||||
static std::string osVersionImpl();
|
|
||||||
static std::string osArchitectureImpl();
|
|
||||||
static std::string nodeNameImpl();
|
|
||||||
static void nodeIdImpl(NodeId& id);
|
|
||||||
static unsigned processorCountImpl();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static bool envVar(const std::string& name, std::string* value);
|
|
||||||
|
|
||||||
static const std::string TEMP;
|
|
||||||
static const std::string TMP;
|
|
||||||
static const std::string HOMEPATH;
|
|
||||||
static const std::string COMPUTERNAME;
|
|
||||||
static const std::string OS;
|
|
||||||
static const std::string NUMBER_OF_PROCESSORS;
|
|
||||||
static const std::string PROCESSOR_ARCHITECTURE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_Environment_WINCE_INCLUDED
|
|
@ -24,11 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "File_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/File_WIN32U.h"
|
#include "Poco/File_WIN32U.h"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Poco/File_VX.h"
|
#include "Poco/File_VX.h"
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
|
@ -1,95 +0,0 @@
|
|||||||
//
|
|
||||||
// File_WIN32U.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Filesystem
|
|
||||||
// Module: File
|
|
||||||
//
|
|
||||||
// Definition of the Unicode FileImpl class for WIN32.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_File_WINCE_INCLUDED
|
|
||||||
#define Foundation_File_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
#include "Poco/Timestamp.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API FileImpl
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
enum Options {
|
|
||||||
OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef UInt64 FileSizeImpl;
|
|
||||||
|
|
||||||
FileImpl();
|
|
||||||
FileImpl(const std::string& path);
|
|
||||||
virtual ~FileImpl();
|
|
||||||
void swapImpl(FileImpl& file);
|
|
||||||
void setPathImpl(const std::string& path);
|
|
||||||
const std::string& getPathImpl() const;
|
|
||||||
bool existsImpl() const;
|
|
||||||
bool canReadImpl() const;
|
|
||||||
bool canWriteImpl() const;
|
|
||||||
bool canExecuteImpl() const;
|
|
||||||
bool isFileImpl() const;
|
|
||||||
bool isDirectoryImpl() const;
|
|
||||||
bool isLinkImpl() const;
|
|
||||||
bool isDeviceImpl() const;
|
|
||||||
bool isHiddenImpl() const;
|
|
||||||
Timestamp createdImpl() const;
|
|
||||||
Timestamp getLastModifiedImpl() const;
|
|
||||||
void setLastModifiedImpl(const Timestamp& ts);
|
|
||||||
FileSizeImpl getSizeImpl() const;
|
|
||||||
void setSizeImpl(FileSizeImpl size);
|
|
||||||
void setWriteableImpl(bool flag = true);
|
|
||||||
void setExecutableImpl(bool flag = true);
|
|
||||||
void copyToImpl(const std::string& path, int options = 0) const;
|
|
||||||
void renameToImpl(const std::string& path, int options = 0);
|
|
||||||
void linkToImpl(const std::string& path, int type) const;
|
|
||||||
void removeImpl();
|
|
||||||
bool createFileImpl();
|
|
||||||
bool createDirectoryImpl();
|
|
||||||
FileSizeImpl totalSpaceImpl() const;
|
|
||||||
FileSizeImpl usableSpaceImpl() const;
|
|
||||||
FileSizeImpl freeSpaceImpl() const;
|
|
||||||
static void handleLastErrorImpl(const std::string& path);
|
|
||||||
static void convertPath(const std::string& utf8Path, std::wstring& utf16Path);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string _path;
|
|
||||||
std::wstring _upath;
|
|
||||||
|
|
||||||
friend class FileHandle;
|
|
||||||
friend class DirectoryIteratorImpl;
|
|
||||||
friend class FileStreamBuf;
|
|
||||||
friend class LogFileImpl;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// inlines
|
|
||||||
//
|
|
||||||
inline const std::string& FileImpl::getPathImpl() const
|
|
||||||
{
|
|
||||||
return _path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_File_WINCE_INCLUDED
|
|
@ -44,7 +44,7 @@
|
|||||||
// Foundation_API functions as being imported from a DLL, wheras this DLL sees symbols
|
// Foundation_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||||
// defined with this macro as being exported.
|
// defined with this macro as being exported.
|
||||||
//
|
//
|
||||||
#if (defined(_WIN32) || defined(_WIN32_WCE)) && defined(POCO_DLL)
|
#if defined(_WIN32) && defined(POCO_DLL)
|
||||||
#if defined(Foundation_EXPORTS)
|
#if defined(Foundation_EXPORTS)
|
||||||
#define Foundation_API __declspec(dllexport)
|
#define Foundation_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
|
@ -28,11 +28,7 @@
|
|||||||
#include "Poco/Mutex_STD.h"
|
#include "Poco/Mutex_STD.h"
|
||||||
#else
|
#else
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Poco/Mutex_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/Mutex_WIN32.h"
|
#include "Poco/Mutex_WIN32.h"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Poco/Mutex_VX.h"
|
#include "Poco/Mutex_VX.h"
|
||||||
#else
|
#else
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
//
|
|
||||||
// Mutex_WIN32.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Threading
|
|
||||||
// Module: Mutex
|
|
||||||
//
|
|
||||||
// Definition of the MutexImpl and FastMutexImpl classes for WIN32.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_Mutex_WINCE_INCLUDED
|
|
||||||
#define Foundation_Mutex_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API MutexImpl
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
MutexImpl();
|
|
||||||
~MutexImpl();
|
|
||||||
void lockImpl();
|
|
||||||
bool tryLockImpl();
|
|
||||||
bool tryLockImpl(long milliseconds);
|
|
||||||
void unlockImpl();
|
|
||||||
|
|
||||||
private:
|
|
||||||
HANDLE _mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef MutexImpl FastMutexImpl;
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_Mutex_WINCE_INCLUDED
|
|
@ -1,55 +0,0 @@
|
|||||||
//
|
|
||||||
// Path_WINCE.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Filesystem
|
|
||||||
// Module: Path
|
|
||||||
//
|
|
||||||
// Definition of the PathImpl class for WIN32.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_Path_WINCE_INCLUDED
|
|
||||||
#define Foundation_Path_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API PathImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::string selfImpl();
|
|
||||||
static std::string currentImpl();
|
|
||||||
static std::string homeImpl();
|
|
||||||
static std::string configHomeImpl();
|
|
||||||
static std::string dataHomeImpl();
|
|
||||||
static std::string cacheHomeImpl();
|
|
||||||
static std::string tempHomeImpl();
|
|
||||||
static std::string tempImpl();
|
|
||||||
static std::string configImpl();
|
|
||||||
static std::string nullImpl();
|
|
||||||
static std::string systemImpl();
|
|
||||||
static std::string expandImpl(const std::string& path);
|
|
||||||
static void listRootsImpl(std::vector<std::string>& roots);
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
MAX_PATH_LEN = 32767
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_Path_WINCE_INCLUDED
|
|
@ -22,11 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "PipeImpl_DUMMY.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/PipeImpl_WIN32.h"
|
#include "Poco/PipeImpl_WIN32.h"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
#include "Poco/PipeImpl_POSIX.h"
|
#include "Poco/PipeImpl_POSIX.h"
|
||||||
#else
|
#else
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
#define POCO_OS_ANDROID 0x000f
|
#define POCO_OS_ANDROID 0x000f
|
||||||
#define POCO_OS_UNKNOWN_UNIX 0x00ff
|
#define POCO_OS_UNKNOWN_UNIX 0x00ff
|
||||||
#define POCO_OS_WINDOWS_NT 0x1001
|
#define POCO_OS_WINDOWS_NT 0x1001
|
||||||
#define POCO_OS_WINDOWS_CE 0x1011
|
|
||||||
#define POCO_OS_VMS 0x2001
|
#define POCO_OS_VMS 0x2001
|
||||||
|
|
||||||
|
|
||||||
@ -101,9 +100,6 @@
|
|||||||
#elif defined(unix) || defined(__unix) || defined(__unix__)
|
#elif defined(unix) || defined(__unix) || defined(__unix__)
|
||||||
#define POCO_OS_FAMILY_UNIX 1
|
#define POCO_OS_FAMILY_UNIX 1
|
||||||
#define POCO_OS POCO_OS_UNKNOWN_UNIX
|
#define POCO_OS POCO_OS_UNKNOWN_UNIX
|
||||||
#elif defined(_WIN32_WCE)
|
|
||||||
#define POCO_OS_FAMILY_WINDOWS 1
|
|
||||||
#define POCO_OS POCO_OS_WINDOWS_CE
|
|
||||||
#elif defined(_WIN32) || defined(_WIN64)
|
#elif defined(_WIN32) || defined(_WIN64)
|
||||||
#define POCO_OS_FAMILY_WINDOWS 1
|
#define POCO_OS_FAMILY_WINDOWS 1
|
||||||
#define POCO_OS POCO_OS_WINDOWS_NT
|
#define POCO_OS POCO_OS_WINDOWS_NT
|
||||||
@ -212,7 +208,7 @@
|
|||||||
#define POCO_ARCH_BIG_ENDIAN 1
|
#define POCO_ARCH_BIG_ENDIAN 1
|
||||||
#elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_)
|
#elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_)
|
||||||
#define POCO_ARCH POCO_ARCH_SH
|
#define POCO_ARCH POCO_ARCH_SH
|
||||||
#if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE)
|
#if defined(__LITTLE_ENDIAN__)
|
||||||
#define POCO_ARCH_LITTLE_ENDIAN 1
|
#define POCO_ARCH_LITTLE_ENDIAN 1
|
||||||
#else
|
#else
|
||||||
#define POCO_ARCH_BIG_ENDIAN 1
|
#define POCO_ARCH_BIG_ENDIAN 1
|
||||||
|
@ -22,11 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Process_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/Process_WIN32U.h"
|
#include "Poco/Process_WIN32U.h"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Poco/Process_VX.h"
|
#include "Poco/Process_VX.h"
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
//
|
|
||||||
// Process_WINCE.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Processes
|
|
||||||
// Module: Process
|
|
||||||
//
|
|
||||||
// Definition of the ProcessImpl class for WIN32.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_Process_WINCE_INCLUDED
|
|
||||||
#define Foundation_Process_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
#include "Poco/RefCountedObject.h"
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Pipe;
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API ProcessHandleImpl: public RefCountedObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid);
|
|
||||||
~ProcessHandleImpl();
|
|
||||||
|
|
||||||
UInt32 id() const;
|
|
||||||
HANDLE process() const;
|
|
||||||
int wait() const;
|
|
||||||
int tryWait() const;
|
|
||||||
void closeHandle();
|
|
||||||
|
|
||||||
private:
|
|
||||||
HANDLE _hProcess;
|
|
||||||
UInt32 _pid;
|
|
||||||
|
|
||||||
ProcessHandleImpl(const ProcessHandleImpl&);
|
|
||||||
ProcessHandleImpl& operator = (const ProcessHandleImpl&);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API ProcessImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef UInt32 PIDImpl;
|
|
||||||
typedef std::vector<std::string> ArgsImpl;
|
|
||||||
typedef std::map<std::string, std::string> EnvImpl;
|
|
||||||
|
|
||||||
static PIDImpl idImpl();
|
|
||||||
static void timesImpl(long& userTime, long& kernelTime);
|
|
||||||
static ProcessHandleImpl* launchImpl(
|
|
||||||
const std::string& command,
|
|
||||||
const ArgsImpl& args,
|
|
||||||
const std::string& initialDirectory,
|
|
||||||
Pipe* inPipe,
|
|
||||||
Pipe* outPipe,
|
|
||||||
Pipe* errPipe,
|
|
||||||
const EnvImpl& env,
|
|
||||||
int options = 0);
|
|
||||||
static void killImpl(ProcessHandleImpl& handle);
|
|
||||||
static void killImpl(PIDImpl pid);
|
|
||||||
static bool isRunningImpl(const ProcessHandleImpl& handle);
|
|
||||||
static bool isRunningImpl(PIDImpl pid);
|
|
||||||
static void requestTerminationImpl(PIDImpl pid);
|
|
||||||
static std::string terminationEventName(PIDImpl pid);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_Process_WINCE_INCLUDED
|
|
@ -23,11 +23,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Poco/RWLock_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/RWLock_WIN32.h"
|
#include "Poco/RWLock_WIN32.h"
|
||||||
#endif
|
|
||||||
#elif POCO_OS == POCO_OS_ANDROID
|
#elif POCO_OS == POCO_OS_ANDROID
|
||||||
#include "Poco/RWLock_Android.h"
|
#include "Poco/RWLock_Android.h"
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
//
|
|
||||||
// RWLock_WINCE.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Threading
|
|
||||||
// Module: RWLock
|
|
||||||
//
|
|
||||||
// Definition of the RWLockImpl class for WINCE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_RWLock_WINCE_INCLUDED
|
|
||||||
#define Foundation_RWLock_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API RWLockImpl
|
|
||||||
/// This implementation is based on the one from Stone Steps Inc,
|
|
||||||
/// licensed under the BSD license.
|
|
||||||
/// http://forums.stonesteps.ca/thread.asp?t=105
|
|
||||||
///
|
|
||||||
/// Note that with this implementation, writers always take
|
|
||||||
/// precedence over readers.
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
RWLockImpl();
|
|
||||||
~RWLockImpl();
|
|
||||||
void readLockImpl();
|
|
||||||
bool tryReadLockImpl(DWORD timeout = 1);
|
|
||||||
void writeLockImpl();
|
|
||||||
bool tryWriteLockImpl(DWORD timeout = 1);
|
|
||||||
void unlockImpl();
|
|
||||||
|
|
||||||
private:
|
|
||||||
DWORD _readerCount;
|
|
||||||
DWORD _readerWaiting;
|
|
||||||
DWORD _writerCount;
|
|
||||||
DWORD _writerWaiting;
|
|
||||||
HANDLE _readerGreen;
|
|
||||||
HANDLE _writerGreen;
|
|
||||||
CRITICAL_SECTION _cs;
|
|
||||||
bool _writeLock;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_RWLock_WINCE_INCLUDED
|
|
@ -26,11 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Poco/Thread_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/Thread_WIN32.h"
|
#include "Poco/Thread_WIN32.h"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Poco/Thread_VX.h"
|
#include "Poco/Thread_VX.h"
|
||||||
#else
|
#else
|
||||||
|
@ -1,194 +0,0 @@
|
|||||||
//
|
|
||||||
// Thread_WINCE.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Threading
|
|
||||||
// Module: Thread
|
|
||||||
//
|
|
||||||
// Definition of the ThreadImpl class for WIN32.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Foundation_Thread_WINCE_INCLUDED
|
|
||||||
#define Foundation_Thread_WINCE_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Foundation.h"
|
|
||||||
#include "Poco/Runnable.h"
|
|
||||||
#include "Poco/SharedPtr.h"
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(TLS_OUT_OF_INDEXES) // Windows CE 5.x does not define this
|
|
||||||
#define TLS_OUT_OF_INDEXES 0xFFFFFFFF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API ThreadImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef DWORD TIDImpl;
|
|
||||||
typedef void (*Callable)(void*);
|
|
||||||
typedef DWORD (WINAPI *Entry)(LPVOID);
|
|
||||||
|
|
||||||
enum Priority
|
|
||||||
{
|
|
||||||
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
|
|
||||||
PRIO_LOW_IMPL = THREAD_PRIORITY_BELOW_NORMAL,
|
|
||||||
PRIO_NORMAL_IMPL = THREAD_PRIORITY_NORMAL,
|
|
||||||
PRIO_HIGH_IMPL = THREAD_PRIORITY_ABOVE_NORMAL,
|
|
||||||
PRIO_HIGHEST_IMPL = THREAD_PRIORITY_HIGHEST
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Policy
|
|
||||||
{
|
|
||||||
POLICY_DEFAULT_IMPL = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
ThreadImpl();
|
|
||||||
~ThreadImpl();
|
|
||||||
|
|
||||||
TIDImpl tidImpl() const;
|
|
||||||
void setNameImpl(const std::string& threadName);
|
|
||||||
std::string getNameImpl() const;
|
|
||||||
std::string getOSThreadNameImpl();
|
|
||||||
/// Returns the thread's name, expressed as an operating system
|
|
||||||
/// specific name value. Return empty string if thread is not running.
|
|
||||||
/// For test used only.
|
|
||||||
void setPriorityImpl(int prio);
|
|
||||||
int getPriorityImpl() const;
|
|
||||||
void setOSPriorityImpl(int prio, int policy = 0);
|
|
||||||
int getOSPriorityImpl() const;
|
|
||||||
static int getMinOSPriorityImpl(int policy);
|
|
||||||
static int getMaxOSPriorityImpl(int policy);
|
|
||||||
void setStackSizeImpl(int size);
|
|
||||||
int getStackSizeImpl() const;
|
|
||||||
void startImpl(SharedPtr<Runnable> pTarget);
|
|
||||||
void joinImpl();
|
|
||||||
bool joinImpl(long milliseconds);
|
|
||||||
bool isRunningImpl() const;
|
|
||||||
static void yieldImpl();
|
|
||||||
static ThreadImpl* currentImpl();
|
|
||||||
static TIDImpl currentTidImpl();
|
|
||||||
static long currentOsTidImpl();
|
|
||||||
bool setAffinityImpl(int);
|
|
||||||
int getAffinityImpl() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static DWORD WINAPI runnableEntry(LPVOID pThread);
|
|
||||||
|
|
||||||
void createImpl(Entry ent, void* pData);
|
|
||||||
void threadCleanup();
|
|
||||||
|
|
||||||
private:
|
|
||||||
class CurrentThreadHolder
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CurrentThreadHolder(): _slot(TlsAlloc())
|
|
||||||
{
|
|
||||||
if (_slot == TLS_OUT_OF_INDEXES)
|
|
||||||
throw SystemException("cannot allocate thread context key");
|
|
||||||
}
|
|
||||||
~CurrentThreadHolder()
|
|
||||||
{
|
|
||||||
TlsFree(_slot);
|
|
||||||
}
|
|
||||||
ThreadImpl* get() const
|
|
||||||
{
|
|
||||||
return reinterpret_cast<ThreadImpl*>(TlsGetValue(_slot));
|
|
||||||
}
|
|
||||||
void set(ThreadImpl* pThread)
|
|
||||||
{
|
|
||||||
TlsSetValue(_slot, pThread);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DWORD _slot;
|
|
||||||
};
|
|
||||||
|
|
||||||
SharedPtr<Runnable> _pRunnableTarget;
|
|
||||||
HANDLE _thread;
|
|
||||||
DWORD _threadId;
|
|
||||||
int _prio;
|
|
||||||
int _stackSize;
|
|
||||||
std::string _name;
|
|
||||||
|
|
||||||
static CurrentThreadHolder _currentThreadHolder;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// inlines
|
|
||||||
//
|
|
||||||
inline int ThreadImpl::getPriorityImpl() const
|
|
||||||
{
|
|
||||||
return _prio;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline int ThreadImpl::getOSPriorityImpl() const
|
|
||||||
{
|
|
||||||
return _prio;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline int ThreadImpl::getMinOSPriorityImpl(int /* policy */)
|
|
||||||
{
|
|
||||||
return PRIO_LOWEST_IMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline int ThreadImpl::getMaxOSPriorityImpl(int /* policy */)
|
|
||||||
{
|
|
||||||
return PRIO_HIGHEST_IMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void ThreadImpl::yieldImpl()
|
|
||||||
{
|
|
||||||
Sleep(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void ThreadImpl::setStackSizeImpl(int size)
|
|
||||||
{
|
|
||||||
_stackSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline int ThreadImpl::getStackSizeImpl() const
|
|
||||||
{
|
|
||||||
return _stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline ThreadImpl::TIDImpl ThreadImpl::tidImpl() const
|
|
||||||
{
|
|
||||||
return _threadId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool ThreadImpl::setAffinityImpl(int)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline int ThreadImpl::getAffinityImpl() const
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Foundation_Thread_WINCE_INCLUDED
|
|
@ -37,20 +37,7 @@ bool Debugger::isAvailable()
|
|||||||
{
|
{
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
return IsDebuggerPresent() ? true : false;
|
||||||
#if (_WIN32_WCE >= 0x600)
|
|
||||||
BOOL isDebuggerPresent;
|
|
||||||
if (CheckRemoteDebuggerPresent(GetCurrentProcess(), &isDebuggerPresent))
|
|
||||||
{
|
|
||||||
return isDebuggerPresent ? true : false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
return IsDebuggerPresent() ? true : false;
|
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
return false;
|
return false;
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
|
@ -13,11 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/DirectoryIterator_WIN32U.h"
|
#include "Poco/DirectoryIterator_WIN32U.h"
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Poco/File_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/File_WIN32U.h"
|
#include "Poco/File_WIN32U.h"
|
||||||
#endif
|
|
||||||
#include "Poco/Path.h"
|
#include "Poco/Path.h"
|
||||||
#include "Poco/UnicodeConverter.h"
|
#include "Poco/UnicodeConverter.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@ -28,12 +28,8 @@
|
|||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
#include "Environment_UNIX.cpp"
|
#include "Environment_UNIX.cpp"
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Environment_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "Environment_WIN32U.cpp"
|
#include "Environment_WIN32U.cpp"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
@ -1,244 +0,0 @@
|
|||||||
//
|
|
||||||
// Environment_WINCE.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Core
|
|
||||||
// Module: Environment
|
|
||||||
//
|
|
||||||
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Environment_WINCE.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/UnicodeConverter.h"
|
|
||||||
#include "Poco/String.h"
|
|
||||||
#include "Poco/Path.h"
|
|
||||||
#include "Poco/NumberFormatter.h"
|
|
||||||
#include <sstream>
|
|
||||||
#include <cstring>
|
|
||||||
#include <windows.h>
|
|
||||||
#include <iphlpapi.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
const std::string EnvironmentImpl::TEMP("TEMP");
|
|
||||||
const std::string EnvironmentImpl::TMP("TMP");
|
|
||||||
const std::string EnvironmentImpl::HOMEPATH("HOMEPATH");
|
|
||||||
const std::string EnvironmentImpl::COMPUTERNAME("COMPUTERNAME");
|
|
||||||
const std::string EnvironmentImpl::OS("OS");
|
|
||||||
const std::string EnvironmentImpl::NUMBER_OF_PROCESSORS("NUMBER_OF_PROCESSORS");
|
|
||||||
const std::string EnvironmentImpl::PROCESSOR_ARCHITECTURE("PROCESSOR_ARCHITECTURE");
|
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::getImpl(const std::string& name)
|
|
||||||
{
|
|
||||||
std::string value;
|
|
||||||
if (!envVar(name, &value)) throw NotFoundException(name);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EnvironmentImpl::hasImpl(const std::string& name)
|
|
||||||
{
|
|
||||||
return envVar(name, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EnvironmentImpl::setImpl(const std::string& name, const std::string& value)
|
|
||||||
{
|
|
||||||
throw NotImplementedException("Cannot set environment variables on Windows CE");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::osNameImpl()
|
|
||||||
{
|
|
||||||
return "Windows CE";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::osDisplayNameImpl()
|
|
||||||
{
|
|
||||||
return osNameImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::osVersionImpl()
|
|
||||||
{
|
|
||||||
OSVERSIONINFOW vi;
|
|
||||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
|
||||||
if (GetVersionExW(&vi) == 0) throw SystemException("Cannot get OS version information");
|
|
||||||
std::ostringstream str;
|
|
||||||
str << vi.dwMajorVersion << "." << vi.dwMinorVersion << " (Build " << (vi.dwBuildNumber & 0xFFFF);
|
|
||||||
std::string version;
|
|
||||||
UnicodeConverter::toUTF8(vi.szCSDVersion, version);
|
|
||||||
if (!version.empty()) str << ": " << version;
|
|
||||||
str << ")";
|
|
||||||
return str.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::osArchitectureImpl()
|
|
||||||
{
|
|
||||||
SYSTEM_INFO si;
|
|
||||||
GetSystemInfo(&si);
|
|
||||||
switch (si.wProcessorArchitecture)
|
|
||||||
{
|
|
||||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
|
||||||
return "IA32";
|
|
||||||
case PROCESSOR_ARCHITECTURE_MIPS:
|
|
||||||
return "MIPS";
|
|
||||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
|
||||||
return "ALPHA";
|
|
||||||
case PROCESSOR_ARCHITECTURE_PPC:
|
|
||||||
return "PPC";
|
|
||||||
case PROCESSOR_ARCHITECTURE_IA64:
|
|
||||||
return "IA64";
|
|
||||||
#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
|
|
||||||
case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
|
|
||||||
return "IA64/32";
|
|
||||||
#endif
|
|
||||||
#ifdef PROCESSOR_ARCHITECTURE_AMD64
|
|
||||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
|
||||||
return "AMD64";
|
|
||||||
#endif
|
|
||||||
case PROCESSOR_ARCHITECTURE_SHX:
|
|
||||||
return "SHX";
|
|
||||||
case PROCESSOR_ARCHITECTURE_ARM:
|
|
||||||
return "ARM";
|
|
||||||
default:
|
|
||||||
return "Unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::nodeNameImpl()
|
|
||||||
{
|
|
||||||
HKEY hKey;
|
|
||||||
DWORD dwDisposition;
|
|
||||||
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"\\Ident", 0, 0, 0, 0, 0, &hKey, &dwDisposition) != ERROR_SUCCESS)
|
|
||||||
throw SystemException("Cannot get node name", "registry key not found");
|
|
||||||
|
|
||||||
std::string value;
|
|
||||||
DWORD dwType;
|
|
||||||
BYTE bData[1026];
|
|
||||||
DWORD dwData = sizeof(bData);
|
|
||||||
if (RegQueryValueExW(hKey, L"Name", 0, &dwType, bData, &dwData) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
switch (dwType)
|
|
||||||
{
|
|
||||||
case REG_SZ:
|
|
||||||
UnicodeConverter::toUTF8(reinterpret_cast<wchar_t*>(bData), value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
throw SystemException("Cannot get node name", "registry value has wrong type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
throw SystemException("Cannot get node name", "registry value not found");
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
|
||||||
{
|
|
||||||
PIP_ADAPTER_INFO pAdapterInfo;
|
|
||||||
PIP_ADAPTER_INFO pAdapter = 0;
|
|
||||||
ULONG len = sizeof(IP_ADAPTER_INFO);
|
|
||||||
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
|
||||||
// Make an initial call to GetAdaptersInfo to get
|
|
||||||
// the necessary size into len
|
|
||||||
DWORD rc = GetAdaptersInfo(pAdapterInfo, &len);
|
|
||||||
if (rc == ERROR_BUFFER_OVERFLOW)
|
|
||||||
{
|
|
||||||
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
|
||||||
}
|
|
||||||
else if (rc != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
delete[] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
throw SystemException("cannot get network adapter list");
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR)
|
|
||||||
{
|
|
||||||
pAdapter = pAdapterInfo;
|
|
||||||
while (pAdapter && !found)
|
|
||||||
{
|
|
||||||
if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id))
|
|
||||||
{
|
|
||||||
std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
pAdapter = pAdapter->Next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else throw SystemException("cannot get network adapter list");
|
|
||||||
if (!found) throw SystemException("no Ethernet adapter found");
|
|
||||||
}
|
|
||||||
catch (Exception&)
|
|
||||||
{
|
|
||||||
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned EnvironmentImpl::processorCountImpl()
|
|
||||||
{
|
|
||||||
SYSTEM_INFO si;
|
|
||||||
GetSystemInfo(&si);
|
|
||||||
return si.dwNumberOfProcessors;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EnvironmentImpl::envVar(const std::string& name, std::string* value)
|
|
||||||
{
|
|
||||||
if (icompare(name, TEMP) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = Path::temp();
|
|
||||||
}
|
|
||||||
else if (icompare(name, TMP) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = Path::temp();
|
|
||||||
}
|
|
||||||
else if (icompare(name, HOMEPATH) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = Path::home();
|
|
||||||
}
|
|
||||||
else if (icompare(name, COMPUTERNAME) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = nodeNameImpl();
|
|
||||||
}
|
|
||||||
else if (icompare(name, OS) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = osNameImpl();
|
|
||||||
}
|
|
||||||
else if (icompare(name, NUMBER_OF_PROCESSORS) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = NumberFormatter::format(processorCountImpl());
|
|
||||||
}
|
|
||||||
else if (icompare(name, PROCESSOR_ARCHITECTURE) == 0)
|
|
||||||
{
|
|
||||||
if (value) *value = osArchitectureImpl();
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -18,11 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "File_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "File_WIN32U.cpp"
|
#include "File_WIN32U.cpp"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "File_VX.cpp"
|
#include "File_VX.cpp"
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
|
@ -1,447 +0,0 @@
|
|||||||
//
|
|
||||||
// File_WIN32U.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Filesystem
|
|
||||||
// Module: File
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/File_WINCE.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/String.h"
|
|
||||||
#include "Poco/UnicodeConverter.h"
|
|
||||||
#include "Poco/Path.h"
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
class FileHandle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FileHandle(const std::string& path, const std::wstring& upath, DWORD access, DWORD share, DWORD disp)
|
|
||||||
{
|
|
||||||
_h = CreateFileW(upath.c_str(), access, share, 0, disp, 0, 0);
|
|
||||||
if (_h == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
FileImpl::handleLastErrorImpl(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~FileHandle()
|
|
||||||
{
|
|
||||||
if (_h != INVALID_HANDLE_VALUE) CloseHandle(_h);
|
|
||||||
}
|
|
||||||
|
|
||||||
HANDLE get() const
|
|
||||||
{
|
|
||||||
return _h;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
HANDLE _h;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::FileImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::FileImpl(const std::string& path): _path(path)
|
|
||||||
{
|
|
||||||
std::string::size_type n = _path.size();
|
|
||||||
if (n > 1 && (_path[n - 1] == '\\' || _path[n - 1] == '/') && !((n == 3 && _path[1]==':')))
|
|
||||||
{
|
|
||||||
_path.resize(n - 1);
|
|
||||||
}
|
|
||||||
convertPath(_path, _upath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::~FileImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::swapImpl(FileImpl& file)
|
|
||||||
{
|
|
||||||
std::swap(_path, file._path);
|
|
||||||
std::swap(_upath, file._upath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::setPathImpl(const std::string& path)
|
|
||||||
{
|
|
||||||
_path = path;
|
|
||||||
std::string::size_type n = _path.size();
|
|
||||||
if (n > 1 && (_path[n - 1] == '\\' || _path[n - 1] == '/') && !((n == 3 && _path[1]==':')))
|
|
||||||
{
|
|
||||||
_path.resize(n - 1);
|
|
||||||
}
|
|
||||||
convertPath(_path, _upath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::existsImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
DWORD attr = GetFileAttributesW(_upath.c_str());
|
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
switch (GetLastError())
|
|
||||||
{
|
|
||||||
case ERROR_FILE_NOT_FOUND:
|
|
||||||
case ERROR_PATH_NOT_FOUND:
|
|
||||||
case ERROR_NOT_READY:
|
|
||||||
case ERROR_INVALID_DRIVE:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::canReadImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
DWORD attr = GetFileAttributesW(_upath.c_str());
|
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
switch (GetLastError())
|
|
||||||
{
|
|
||||||
case ERROR_ACCESS_DENIED:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::canWriteImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
DWORD attr = GetFileAttributesW(_upath.c_str());
|
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return (attr & FILE_ATTRIBUTE_READONLY) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::canExecuteImpl() const
|
|
||||||
{
|
|
||||||
Path p(_path);
|
|
||||||
return icompare(p.getExtension(), "exe") == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::isFileImpl() const
|
|
||||||
{
|
|
||||||
return !isDirectoryImpl() && !isDeviceImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::isDirectoryImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
DWORD attr = GetFileAttributesW(_upath.c_str());
|
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::isLinkImpl() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::isDeviceImpl() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::isHiddenImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
DWORD attr = GetFileAttributesW(_upath.c_str());
|
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return (attr & FILE_ATTRIBUTE_HIDDEN) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Timestamp FileImpl::createdImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA fad;
|
|
||||||
if (GetFileAttributesExW(_upath.c_str(), GetFileExInfoStandard, &fad) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return Timestamp::fromFileTimeNP(fad.ftCreationTime.dwLowDateTime, fad.ftCreationTime.dwHighDateTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Timestamp FileImpl::getLastModifiedImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA fad;
|
|
||||||
if (GetFileAttributesExW(_upath.c_str(), GetFileExInfoStandard, &fad) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return Timestamp::fromFileTimeNP(fad.ftLastWriteTime.dwLowDateTime, fad.ftLastWriteTime.dwHighDateTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::setLastModifiedImpl(const Timestamp& ts)
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
UInt32 low;
|
|
||||||
UInt32 high;
|
|
||||||
ts.toFileTimeNP(low, high);
|
|
||||||
FILETIME ft;
|
|
||||||
ft.dwLowDateTime = low;
|
|
||||||
ft.dwHighDateTime = high;
|
|
||||||
FileHandle fh(_path, _upath, GENERIC_WRITE, FILE_SHARE_WRITE, OPEN_EXISTING);
|
|
||||||
if (SetFileTime(fh.get(), 0, &ft, &ft) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::FileSizeImpl FileImpl::getSizeImpl() const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA fad;
|
|
||||||
if (GetFileAttributesExW(_upath.c_str(), GetFileExInfoStandard, &fad) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
LARGE_INTEGER li;
|
|
||||||
li.LowPart = fad.nFileSizeLow;
|
|
||||||
li.HighPart = fad.nFileSizeHigh;
|
|
||||||
return li.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::setSizeImpl(FileSizeImpl size)
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
FileHandle fh(_path, _upath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
|
|
||||||
LARGE_INTEGER li;
|
|
||||||
li.QuadPart = size;
|
|
||||||
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
if (SetEndOfFile(fh.get()) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::setWriteableImpl(bool flag)
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
DWORD attr = GetFileAttributesW(_upath.c_str());
|
|
||||||
if (attr == -1)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
if (flag)
|
|
||||||
attr &= ~FILE_ATTRIBUTE_READONLY;
|
|
||||||
else
|
|
||||||
attr |= FILE_ATTRIBUTE_READONLY;
|
|
||||||
if (SetFileAttributesW(_upath.c_str(), attr) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::setExecutableImpl(bool flag)
|
|
||||||
{
|
|
||||||
// not supported
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::copyToImpl(const std::string& path, int options) const
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
std::wstring upath;
|
|
||||||
convertPath(path, upath);
|
|
||||||
if (CopyFileW(_upath.c_str(), upath.c_str(), (options & OPT_FAIL_ON_OVERWRITE_IMPL) != 0) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::renameToImpl(const std::string& path, int options)
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
std::wstring upath;
|
|
||||||
convertPath(path, upath);
|
|
||||||
if (options & OPT_FAIL_ON_OVERWRITE_IMPL) {
|
|
||||||
if (MoveFileW(_upath.c_str(), upath.c_str()) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
} else {
|
|
||||||
if (MoveFileW(_upath.c_str(), upath.c_str(), MOVEFILE_REPLACE_EXISTING) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::linkToImpl(const std::string& path, int type) const
|
|
||||||
{
|
|
||||||
throw Poco::NotImplementedException("File::linkTo() is not available on this platform");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::removeImpl()
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
if (isDirectoryImpl())
|
|
||||||
{
|
|
||||||
if (RemoveDirectoryW(_upath.c_str()) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (DeleteFileW(_upath.c_str()) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::createFileImpl()
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
HANDLE hFile = CreateFileW(_upath.c_str(), GENERIC_WRITE, 0, 0, CREATE_NEW, 0, 0);
|
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
CloseHandle(hFile);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (GetLastError() == ERROR_FILE_EXISTS)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FileImpl::createDirectoryImpl()
|
|
||||||
{
|
|
||||||
poco_assert (!_path.empty());
|
|
||||||
|
|
||||||
if (existsImpl() && isDirectoryImpl())
|
|
||||||
return false;
|
|
||||||
if (CreateDirectoryW(_upath.c_str(), 0) == 0)
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::FileSizeImpl FileImpl::totalSpaceImpl() const
|
|
||||||
{
|
|
||||||
poco_assert(!_path.empty());
|
|
||||||
|
|
||||||
ULARGE_INTEGER space;
|
|
||||||
if (!GetDiskFreeSpaceExW(_upath.c_str(), NULL, &space, NULL))
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return space.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::FileSizeImpl FileImpl::usableSpaceImpl() const
|
|
||||||
{
|
|
||||||
poco_assert(!_path.empty());
|
|
||||||
|
|
||||||
ULARGE_INTEGER space;
|
|
||||||
if (!GetDiskFreeSpaceExW(_upath.c_str(), &space, NULL, NULL))
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return space.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileImpl::FileSizeImpl FileImpl::freeSpaceImpl() const
|
|
||||||
{
|
|
||||||
poco_assert(!_path.empty());
|
|
||||||
|
|
||||||
ULARGE_INTEGER space;
|
|
||||||
if (!GetDiskFreeSpaceExW(_upath.c_str(), NULL, NULL, &space))
|
|
||||||
handleLastErrorImpl(_path);
|
|
||||||
return space.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::handleLastErrorImpl(const std::string& path)
|
|
||||||
{
|
|
||||||
switch (GetLastError())
|
|
||||||
{
|
|
||||||
case ERROR_FILE_NOT_FOUND:
|
|
||||||
throw FileNotFoundException(path);
|
|
||||||
case ERROR_PATH_NOT_FOUND:
|
|
||||||
case ERROR_BAD_NETPATH:
|
|
||||||
case ERROR_CANT_RESOLVE_FILENAME:
|
|
||||||
case ERROR_INVALID_DRIVE:
|
|
||||||
throw PathNotFoundException(path);
|
|
||||||
case ERROR_ACCESS_DENIED:
|
|
||||||
throw FileAccessDeniedException(path);
|
|
||||||
case ERROR_ALREADY_EXISTS:
|
|
||||||
case ERROR_FILE_EXISTS:
|
|
||||||
throw FileExistsException(path);
|
|
||||||
case ERROR_INVALID_NAME:
|
|
||||||
case ERROR_DIRECTORY:
|
|
||||||
case ERROR_FILENAME_EXCED_RANGE:
|
|
||||||
case ERROR_BAD_PATHNAME:
|
|
||||||
throw PathSyntaxException(path);
|
|
||||||
case ERROR_FILE_READ_ONLY:
|
|
||||||
throw FileReadOnlyException(path);
|
|
||||||
case ERROR_CANNOT_MAKE:
|
|
||||||
throw CreateFileException(path);
|
|
||||||
case ERROR_DIR_NOT_EMPTY:
|
|
||||||
throw DirectoryNotEmptyException(path);
|
|
||||||
case ERROR_WRITE_FAULT:
|
|
||||||
throw WriteFileException(path);
|
|
||||||
case ERROR_READ_FAULT:
|
|
||||||
throw ReadFileException(path);
|
|
||||||
case ERROR_SHARING_VIOLATION:
|
|
||||||
throw FileException("sharing violation", path);
|
|
||||||
case ERROR_LOCK_VIOLATION:
|
|
||||||
throw FileException("lock violation", path);
|
|
||||||
case ERROR_HANDLE_EOF:
|
|
||||||
throw ReadFileException("EOF reached", path);
|
|
||||||
case ERROR_HANDLE_DISK_FULL:
|
|
||||||
case ERROR_DISK_FULL:
|
|
||||||
throw WriteFileException("disk is full", path);
|
|
||||||
case ERROR_NEGATIVE_SEEK:
|
|
||||||
throw FileException("negative seek", path);
|
|
||||||
default:
|
|
||||||
throw FileException(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileImpl::convertPath(const std::string& utf8Path, std::wstring& utf16Path)
|
|
||||||
{
|
|
||||||
UnicodeConverter::toUTF16(utf8Path, utf16Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -23,9 +23,7 @@
|
|||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
#if defined(_WIN32)
|
||||||
#include "wce_time.h"
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -268,14 +266,11 @@ void LocalDateTime::determineTzd(bool adjust)
|
|||||||
{
|
{
|
||||||
std::time_t epochTime = _dateTime.timestamp().epochTime();
|
std::time_t epochTime = _dateTime.timestamp().epochTime();
|
||||||
#if defined(_WIN32) || defined(POCO_NO_POSIX_TSF)
|
#if defined(_WIN32) || defined(POCO_NO_POSIX_TSF)
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
std::tm* broken = wceex_localtime(&epochTime);
|
|
||||||
#else
|
|
||||||
std::tm brokenBuf;
|
std::tm brokenBuf;
|
||||||
std::tm* broken = &brokenBuf;
|
std::tm* broken = &brokenBuf;
|
||||||
errno_t err = localtime_s(broken, &epochTime);
|
errno_t err = localtime_s(broken, &epochTime);
|
||||||
if (err) broken = nullptr;
|
if (err) broken = nullptr;
|
||||||
#endif
|
|
||||||
if (!broken) throw Poco::SystemException("cannot get local time");
|
if (!broken) throw Poco::SystemException("cannot get local time");
|
||||||
_tzd = Timezone::utcOffset() + Timezone::dst(_dateTime.timestamp());
|
_tzd = Timezone::utcOffset() + Timezone::dst(_dateTime.timestamp());
|
||||||
#else
|
#else
|
||||||
@ -312,11 +307,8 @@ std::time_t LocalDateTime::dstOffset(int& dstOffset) const
|
|||||||
broken.tm_min = _dateTime.minute();
|
broken.tm_min = _dateTime.minute();
|
||||||
broken.tm_sec = _dateTime.second();
|
broken.tm_sec = _dateTime.second();
|
||||||
broken.tm_isdst = -1;
|
broken.tm_isdst = -1;
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
local = wceex_mktime(&broken);
|
|
||||||
#else
|
|
||||||
local = std::mktime(&broken);
|
local = std::mktime(&broken);
|
||||||
#endif
|
|
||||||
|
|
||||||
dstOffset = (broken.tm_isdst == 1) ? Timezone::dst(_dateTime.timestamp()) : 0;
|
dstOffset = (broken.tm_isdst == 1) ? Timezone::dst(_dateTime.timestamp()) : 0;
|
||||||
return local;
|
return local;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_NO_SYSLOGCHANNEL)
|
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_NO_SYSLOGCHANNEL)
|
||||||
#include "Poco/SyslogChannel.h"
|
#include "Poco/SyslogChannel.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#include "Poco/EventLogChannel.h"
|
#include "Poco/EventLogChannel.h"
|
||||||
#include "Poco/WindowsConsoleChannel.h"
|
#include "Poco/WindowsConsoleChannel.h"
|
||||||
#endif
|
#endif
|
||||||
@ -85,7 +85,7 @@ LoggingFactory& LoggingFactory::defaultFactory()
|
|||||||
void LoggingFactory::registerBuiltins()
|
void LoggingFactory::registerBuiltins()
|
||||||
{
|
{
|
||||||
_channelFactory.registerClass("AsyncChannel", new Instantiator<AsyncChannel, Channel>);
|
_channelFactory.registerClass("AsyncChannel", new Instantiator<AsyncChannel, Channel>);
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
_channelFactory.registerClass("ConsoleChannel", new Instantiator<WindowsConsoleChannel, Channel>);
|
_channelFactory.registerClass("ConsoleChannel", new Instantiator<WindowsConsoleChannel, Channel>);
|
||||||
_channelFactory.registerClass("ColorConsoleChannel", new Instantiator<WindowsColorConsoleChannel, Channel>);
|
_channelFactory.registerClass("ColorConsoleChannel", new Instantiator<WindowsColorConsoleChannel, Channel>);
|
||||||
#else
|
#else
|
||||||
@ -110,7 +110,7 @@ void LoggingFactory::registerBuiltins()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
_channelFactory.registerClass("EventLogChannel", new Instantiator<EventLogChannel, Channel>);
|
_channelFactory.registerClass("EventLogChannel", new Instantiator<EventLogChannel, Channel>);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -17,11 +17,7 @@
|
|||||||
#if defined(POCO_ENABLE_STD_MUTEX)
|
#if defined(POCO_ENABLE_STD_MUTEX)
|
||||||
#include "Mutex_STD.cpp"
|
#include "Mutex_STD.cpp"
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Mutex_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "Mutex_WIN32.cpp"
|
#include "Mutex_WIN32.cpp"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Mutex_VX.cpp"
|
#include "Mutex_VX.cpp"
|
||||||
#else
|
#else
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
//
|
|
||||||
// Mutex_WINCE.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Threading
|
|
||||||
// Module: Mutex
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Mutex_WINCE.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl()
|
|
||||||
{
|
|
||||||
_mutex = CreateMutexW(NULL, FALSE, NULL);
|
|
||||||
if (!_mutex) throw SystemException("cannot create mutex");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::~MutexImpl()
|
|
||||||
{
|
|
||||||
CloseHandle(_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MutexImpl::lockImpl()
|
|
||||||
{
|
|
||||||
switch (WaitForSingleObject(_mutex, INFINITE))
|
|
||||||
{
|
|
||||||
case WAIT_OBJECT_0:
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
throw SystemException("cannot lock mutex");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MutexImpl::tryLockImpl()
|
|
||||||
{
|
|
||||||
switch (WaitForSingleObject(_mutex, 0))
|
|
||||||
{
|
|
||||||
case WAIT_TIMEOUT:
|
|
||||||
return false;
|
|
||||||
case WAIT_OBJECT_0:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
throw SystemException("cannot lock mutex");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MutexImpl::tryLockImpl(long milliseconds)
|
|
||||||
{
|
|
||||||
switch (WaitForSingleObject(_mutex, milliseconds + 1))
|
|
||||||
{
|
|
||||||
case WAIT_TIMEOUT:
|
|
||||||
return false;
|
|
||||||
case WAIT_OBJECT_0:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
throw SystemException("cannot lock mutex");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MutexImpl::unlockImpl()
|
|
||||||
{
|
|
||||||
ReleaseMutex(_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -26,12 +26,8 @@
|
|||||||
#if defined(POCO_OS_FAMILY_UNIX)
|
#if defined(POCO_OS_FAMILY_UNIX)
|
||||||
#include "Path_UNIX.cpp"
|
#include "Path_UNIX.cpp"
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Path_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "Path_WIN32U.cpp"
|
#include "Path_WIN32U.cpp"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
@ -1,148 +0,0 @@
|
|||||||
//
|
|
||||||
// Path_WIN32U.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Filesystem
|
|
||||||
// Module: Path
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Path_WINCE.h"
|
|
||||||
#include "Poco/Environment_WINCE.h"
|
|
||||||
#include "Poco/UnicodeConverter.h"
|
|
||||||
#include "Poco/Buffer.h"
|
|
||||||
#include "Poco/Environment.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
std::string PathImpl::selfImpl()
|
|
||||||
{
|
|
||||||
return("");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathImpl::currentImpl()
|
|
||||||
{
|
|
||||||
return("\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathImpl::homeImpl()
|
|
||||||
{
|
|
||||||
return("\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathImpl::configHomeImpl()
|
|
||||||
{
|
|
||||||
return homeImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathImpl::dataHomeImpl()
|
|
||||||
{
|
|
||||||
return homeImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathImpl::cacheHomeImpl()
|
|
||||||
{
|
|
||||||
return homeImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string PathImpl::tempHomeImpl()
|
|
||||||
{
|
|
||||||
return tempImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string PathImpl::configImpl()
|
|
||||||
{
|
|
||||||
return("\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathImpl::systemImpl()
|
|
||||||
{
|
|
||||||
return("\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string PathImpl::nullImpl()
|
|
||||||
{
|
|
||||||
return "NUL:";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string PathImpl::tempImpl()
|
|
||||||
{
|
|
||||||
return "\\Temp\\";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string PathImpl::expandImpl(const std::string& path)
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
std::string::const_iterator it = path.begin();
|
|
||||||
std::string::const_iterator end = path.end();
|
|
||||||
while (it != end)
|
|
||||||
{
|
|
||||||
if (*it == '%')
|
|
||||||
{
|
|
||||||
++it;
|
|
||||||
if (it != end && *it == '%')
|
|
||||||
{
|
|
||||||
result += '%';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string var;
|
|
||||||
while (it != end && *it != '%') var += *it++;
|
|
||||||
if (it != end) ++it;
|
|
||||||
result += Environment::get(var, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else result += *it++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PathImpl::listRootsImpl(std::vector<std::string>& roots)
|
|
||||||
{
|
|
||||||
roots.clear();
|
|
||||||
roots.push_back("\\");
|
|
||||||
|
|
||||||
WIN32_FIND_DATAW fd;
|
|
||||||
HANDLE hFind = FindFirstFileW(L"\\*.*", &fd);
|
|
||||||
if (hFind != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
|
|
||||||
(fd.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY))
|
|
||||||
{
|
|
||||||
std::wstring name(fd.cFileName);
|
|
||||||
name += L"\\Vol:";
|
|
||||||
HANDLE h = CreateFileW(name.c_str(), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
if (h != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
// its a device volume
|
|
||||||
CloseHandle(h);
|
|
||||||
std::string name;
|
|
||||||
UnicodeConverter::toUTF8(fd.cFileName, name);
|
|
||||||
std::string root = "\\" + name;
|
|
||||||
roots.push_back(root);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (FindNextFileW(hFind, &fd));
|
|
||||||
FindClose(hFind);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -16,11 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "PipeImpl_DUMMY.cpp"
|
|
||||||
#else
|
|
||||||
#include "PipeImpl_WIN32.cpp"
|
#include "PipeImpl_WIN32.cpp"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
#include "PipeImpl_POSIX.cpp"
|
#include "PipeImpl_POSIX.cpp"
|
||||||
#else
|
#else
|
||||||
|
@ -48,11 +48,7 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Process_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "Process_WIN32U.cpp"
|
#include "Process_WIN32U.cpp"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Process_VX.cpp"
|
#include "Process_VX.cpp"
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
|
@ -1,244 +0,0 @@
|
|||||||
//
|
|
||||||
// Process_WINCE.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Processes
|
|
||||||
// Module: Process
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Process_WINCE.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/NumberFormatter.h"
|
|
||||||
#include "Poco/NamedEvent.h"
|
|
||||||
#include "Poco/UnicodeConverter.h"
|
|
||||||
#include "Poco/Pipe.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// ProcessHandleImpl
|
|
||||||
//
|
|
||||||
ProcessHandleImpl::ProcessHandleImpl(HANDLE hProcess, UInt32 pid):
|
|
||||||
_hProcess(hProcess),
|
|
||||||
_pid(pid)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ProcessHandleImpl::~ProcessHandleImpl()
|
|
||||||
{
|
|
||||||
closeHandle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessHandleImpl::closeHandle()
|
|
||||||
{
|
|
||||||
if (_hProcess)
|
|
||||||
{
|
|
||||||
CloseHandle(_hProcess);
|
|
||||||
_hProcess = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UInt32 ProcessHandleImpl::id() const
|
|
||||||
{
|
|
||||||
return _pid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HANDLE ProcessHandleImpl::process() const
|
|
||||||
{
|
|
||||||
return _hProcess;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ProcessHandleImpl::wait() const
|
|
||||||
{
|
|
||||||
DWORD rc = WaitForSingleObject(_hProcess, INFINITE);
|
|
||||||
if (rc != WAIT_OBJECT_0)
|
|
||||||
throw SystemException("Wait failed for process", NumberFormatter::format(_pid));
|
|
||||||
|
|
||||||
DWORD exitCode;
|
|
||||||
if (GetExitCodeProcess(_hProcess, &exitCode) == 0)
|
|
||||||
throw SystemException("Cannot get exit code for process", NumberFormatter::format(_pid));
|
|
||||||
|
|
||||||
return exitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ProcessHandleImpl::tryWait() const
|
|
||||||
{
|
|
||||||
DWORD exitCode;
|
|
||||||
if (GetExitCodeProcess(_hProcess, &exitCode) == 0)
|
|
||||||
throw SystemException("Cannot get exit code for process", NumberFormatter::format(_pid));
|
|
||||||
if (exitCode == STILL_ACTIVE)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return exitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// ProcessImpl
|
|
||||||
//
|
|
||||||
ProcessImpl::PIDImpl ProcessImpl::idImpl()
|
|
||||||
{
|
|
||||||
return GetCurrentProcessId();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessImpl::timesImpl(long& userTime, long& kernelTime)
|
|
||||||
{
|
|
||||||
FILETIME ftCreation;
|
|
||||||
FILETIME ftExit;
|
|
||||||
FILETIME ftKernel;
|
|
||||||
FILETIME ftUser;
|
|
||||||
|
|
||||||
if (GetThreadTimes(GetCurrentThread(), &ftCreation, &ftExit, &ftKernel, &ftUser) != 0)
|
|
||||||
{
|
|
||||||
ULARGE_INTEGER time;
|
|
||||||
time.LowPart = ftKernel.dwLowDateTime;
|
|
||||||
time.HighPart = ftKernel.dwHighDateTime;
|
|
||||||
kernelTime = long(time.QuadPart/10000000L);
|
|
||||||
time.LowPart = ftUser.dwLowDateTime;
|
|
||||||
time.HighPart = ftUser.dwHighDateTime;
|
|
||||||
userTime = long(time.QuadPart/10000000L);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
userTime = kernelTime = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, const std::string& initialDirectory, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe, const EnvImpl& env, int options)
|
|
||||||
{
|
|
||||||
std::wstring ucommand;
|
|
||||||
UnicodeConverter::toUTF16(command, ucommand);
|
|
||||||
|
|
||||||
std::string commandLine;
|
|
||||||
for (ArgsImpl::const_iterator it = args.begin(); it != args.end(); ++it)
|
|
||||||
{
|
|
||||||
if (it != args.begin()) commandLine.append(" ");
|
|
||||||
commandLine.append(*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring ucommandLine;
|
|
||||||
UnicodeConverter::toUTF16(commandLine, ucommandLine);
|
|
||||||
|
|
||||||
PROCESS_INFORMATION processInfo;
|
|
||||||
BOOL rc = CreateProcessW(
|
|
||||||
ucommand.c_str(),
|
|
||||||
const_cast<wchar_t*>(ucommandLine.c_str()),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL/*&startupInfo*/,
|
|
||||||
&processInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
if (rc)
|
|
||||||
{
|
|
||||||
CloseHandle(processInfo.hThread);
|
|
||||||
return new ProcessHandleImpl(processInfo.hProcess, processInfo.dwProcessId);
|
|
||||||
}
|
|
||||||
else throw SystemException("Cannot launch process", command);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
|
||||||
{
|
|
||||||
if (handle.process())
|
|
||||||
{
|
|
||||||
if (TerminateProcess(handle.process(), 0) == 0)
|
|
||||||
{
|
|
||||||
handle.closeHandle();
|
|
||||||
throw SystemException("cannot kill process");
|
|
||||||
}
|
|
||||||
handle.closeHandle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessImpl::killImpl(PIDImpl pid)
|
|
||||||
{
|
|
||||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
|
||||||
if (hProc)
|
|
||||||
{
|
|
||||||
if (TerminateProcess(hProc, 0) == 0)
|
|
||||||
{
|
|
||||||
CloseHandle(hProc);
|
|
||||||
throw SystemException("cannot kill process");
|
|
||||||
}
|
|
||||||
CloseHandle(hProc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (GetLastError())
|
|
||||||
{
|
|
||||||
case ERROR_ACCESS_DENIED:
|
|
||||||
throw NoPermissionException("cannot kill process");
|
|
||||||
case ERROR_NOT_FOUND:
|
|
||||||
throw NotFoundException("cannot kill process");
|
|
||||||
default:
|
|
||||||
throw SystemException("cannot kill process");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle)
|
|
||||||
{
|
|
||||||
bool result = true;
|
|
||||||
DWORD exitCode;
|
|
||||||
BOOL rc = GetExitCodeProcess(handle.process(), &exitCode);
|
|
||||||
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
|
||||||
{
|
|
||||||
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
|
|
||||||
bool result = true;
|
|
||||||
if (hProc)
|
|
||||||
{
|
|
||||||
DWORD exitCode;
|
|
||||||
BOOL rc = GetExitCodeProcess(hProc, &exitCode);
|
|
||||||
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
|
||||||
CloseHandle(hProc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessImpl::requestTerminationImpl(PIDImpl pid)
|
|
||||||
{
|
|
||||||
NamedEvent ev(terminationEventName(pid));
|
|
||||||
ev.set();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string ProcessImpl::terminationEventName(PIDImpl pid)
|
|
||||||
{
|
|
||||||
std::string evName("POCOTRM");
|
|
||||||
NumberFormatter::appendHex(evName, pid, 8);
|
|
||||||
return evName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -16,11 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "RWLock_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "RWLock_WIN32.cpp"
|
#include "RWLock_WIN32.cpp"
|
||||||
#endif
|
|
||||||
#elif POCO_OS == POCO_OS_ANDROID
|
#elif POCO_OS == POCO_OS_ANDROID
|
||||||
#include "RWLock_Android.cpp"
|
#include "RWLock_Android.cpp"
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
|
@ -1,174 +0,0 @@
|
|||||||
//
|
|
||||||
// RWLock_WINCE.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Threading
|
|
||||||
// Module: RWLock
|
|
||||||
//
|
|
||||||
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/RWLock_WINCE.h"
|
|
||||||
#include "Poco/Thread.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
RWLockImpl::RWLockImpl():
|
|
||||||
_readerCount(0),
|
|
||||||
_readerWaiting(0),
|
|
||||||
_writerCount(0),
|
|
||||||
_writerWaiting(0),
|
|
||||||
_writeLock(false)
|
|
||||||
|
|
||||||
{
|
|
||||||
InitializeCriticalSection(&_cs);
|
|
||||||
_readerGreen = CreateEventW(NULL, FALSE, TRUE, NULL);
|
|
||||||
if (!_readerGreen) throw SystemException("Cannot create RWLock");
|
|
||||||
_writerGreen = CreateEventW(NULL, FALSE, TRUE, NULL);
|
|
||||||
if (!_writerGreen)
|
|
||||||
{
|
|
||||||
CloseHandle(_readerGreen);
|
|
||||||
throw SystemException("Cannot create RWLock");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RWLockImpl::~RWLockImpl()
|
|
||||||
{
|
|
||||||
CloseHandle(_readerGreen);
|
|
||||||
CloseHandle(_writerGreen);
|
|
||||||
DeleteCriticalSection(&_cs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RWLockImpl::readLockImpl()
|
|
||||||
{
|
|
||||||
tryReadLockImpl(INFINITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool RWLockImpl::tryReadLockImpl(DWORD timeout)
|
|
||||||
{
|
|
||||||
bool wait = false;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&_cs);
|
|
||||||
if (!_writerCount && !_writerWaiting)
|
|
||||||
{
|
|
||||||
if (wait)
|
|
||||||
{
|
|
||||||
_readerWaiting--;
|
|
||||||
wait = false;
|
|
||||||
}
|
|
||||||
_readerCount++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!wait)
|
|
||||||
{
|
|
||||||
_readerWaiting++;
|
|
||||||
wait = true;
|
|
||||||
}
|
|
||||||
ResetEvent(_readerGreen);
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&_cs);
|
|
||||||
if (wait)
|
|
||||||
{
|
|
||||||
if (WaitForSingleObject(_readerGreen, timeout) != WAIT_OBJECT_0)
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&_cs);
|
|
||||||
_readerWaiting--;
|
|
||||||
SetEvent(_readerGreen);
|
|
||||||
SetEvent(_writerGreen);
|
|
||||||
LeaveCriticalSection(&_cs);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (wait);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RWLockImpl::writeLockImpl()
|
|
||||||
{
|
|
||||||
tryWriteLockImpl(INFINITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool RWLockImpl::tryWriteLockImpl(DWORD timeout)
|
|
||||||
{
|
|
||||||
bool wait = false;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&_cs);
|
|
||||||
if (!_readerCount && !_writerCount)
|
|
||||||
{
|
|
||||||
if (wait)
|
|
||||||
{
|
|
||||||
_writerWaiting--;
|
|
||||||
wait = false;
|
|
||||||
}
|
|
||||||
_writerCount++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!wait)
|
|
||||||
{
|
|
||||||
_writerWaiting++;
|
|
||||||
wait = true;
|
|
||||||
}
|
|
||||||
ResetEvent(_writerGreen);
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&_cs);
|
|
||||||
if (wait)
|
|
||||||
{
|
|
||||||
if (WaitForSingleObject(_writerGreen, timeout) != WAIT_OBJECT_0)
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&_cs);
|
|
||||||
_writerWaiting--;
|
|
||||||
SetEvent(_readerGreen);
|
|
||||||
SetEvent(_writerGreen);
|
|
||||||
LeaveCriticalSection(&_cs);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (wait);
|
|
||||||
|
|
||||||
_writeLock = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RWLockImpl::unlockImpl()
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&_cs);
|
|
||||||
|
|
||||||
if (_writeLock)
|
|
||||||
{
|
|
||||||
_writeLock = false;
|
|
||||||
_writerCount--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_readerCount--;
|
|
||||||
}
|
|
||||||
if (_writerWaiting)
|
|
||||||
SetEvent(_writerGreen);
|
|
||||||
else if (_readerWaiting)
|
|
||||||
SetEvent(_readerGreen);
|
|
||||||
|
|
||||||
LeaveCriticalSection(&_cs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -47,9 +47,6 @@
|
|||||||
#include "Poco/Random.h"
|
#include "Poco/Random.h"
|
||||||
#include "Poco/RandomStream.h"
|
#include "Poco/RandomStream.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
#include "wce_time.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -153,11 +150,8 @@ Random::Random(int stateSize)
|
|||||||
poco_assert (BREAK_0 <= stateSize && stateSize <= BREAK_4);
|
poco_assert (BREAK_0 <= stateSize && stateSize <= BREAK_4);
|
||||||
|
|
||||||
_pBuffer = new char[stateSize];
|
_pBuffer = new char[stateSize];
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
initState((UInt32) wceex_time(NULL), _pBuffer, stateSize);
|
|
||||||
#else
|
|
||||||
initState((UInt32) std::time(NULL), _pBuffer, stateSize);
|
initState((UInt32) std::time(NULL), _pBuffer, stateSize);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@ void SharedLibraryImpl::loadImpl(const std::string& path, int /*flags*/)
|
|||||||
|
|
||||||
if (_handle) throw LibraryAlreadyLoadedException(_path);
|
if (_handle) throw LibraryAlreadyLoadedException(_path);
|
||||||
DWORD flags(0);
|
DWORD flags(0);
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
Path p(path);
|
Path p(path);
|
||||||
if (p.isAbsolute()) flags |= LOAD_WITH_ALTERED_SEARCH_PATH;
|
if (p.isAbsolute()) flags |= LOAD_WITH_ALTERED_SEARCH_PATH;
|
||||||
#endif
|
|
||||||
std::wstring upath;
|
std::wstring upath;
|
||||||
UnicodeConverter::toUTF16(path, upath);
|
UnicodeConverter::toUTF16(path, upath);
|
||||||
_handle = LoadLibraryExW(upath.c_str(), 0, flags);
|
_handle = LoadLibraryExW(upath.c_str(), 0, flags);
|
||||||
@ -88,13 +88,7 @@ void* SharedLibraryImpl::findSymbolImpl(const std::string& name)
|
|||||||
|
|
||||||
if (_handle)
|
if (_handle)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
std::wstring uname;
|
|
||||||
UnicodeConverter::toUTF16(name, uname);
|
|
||||||
return (void*) GetProcAddressW((HMODULE) _handle, uname.c_str());
|
|
||||||
#else
|
|
||||||
return (void*) GetProcAddress((HMODULE) _handle, name.c_str());
|
return (void*) GetProcAddress((HMODULE) _handle, name.c_str());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,7 @@ SharedMemoryImpl::SharedMemoryImpl(const std::string& name, std::size_t size, Sh
|
|||||||
{
|
{
|
||||||
DWORD dwRetVal = GetLastError();
|
DWORD dwRetVal = GetLastError();
|
||||||
int retVal = static_cast<int>(dwRetVal);
|
int retVal = static_cast<int>(dwRetVal);
|
||||||
#if defined (_WIN32_WCE)
|
|
||||||
throw SystemException(Poco::format("Cannot create shared memory object %s [Error %d: %s]",
|
|
||||||
_name, retVal, Error::getMessage(dwRetVal)));
|
|
||||||
#else
|
|
||||||
if (_mode != PAGE_READONLY || dwRetVal != 5)
|
if (_mode != PAGE_READONLY || dwRetVal != 5)
|
||||||
{
|
{
|
||||||
throw SystemException(Poco::format("Cannot create shared memory object %s [Error %d: %s]",
|
throw SystemException(Poco::format("Cannot create shared memory object %s [Error %d: %s]",
|
||||||
@ -72,7 +69,6 @@ SharedMemoryImpl::SharedMemoryImpl(const std::string& name, std::size_t size, Sh
|
|||||||
throw SystemException(Poco::format("Cannot open shared memory object %s [Error %d: %s]",
|
throw SystemException(Poco::format("Cannot open shared memory object %s [Error %d: %s]",
|
||||||
_name, retVal, Error::getMessage(dwRetVal)), retVal);
|
_name, retVal, Error::getMessage(dwRetVal)), retVal);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
map();
|
map();
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Thread_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "Thread_WIN32.cpp"
|
#include "Thread_WIN32.cpp"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Thread_VX.cpp"
|
#include "Thread_VX.cpp"
|
||||||
#else
|
#else
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
#include "Poco/ErrorHandler.h"
|
#include "Poco/ErrorHandler.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
#include "wce_time.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -67,11 +64,7 @@ PooledThread::PooledThread(const std::string& name, int stackSize):
|
|||||||
{
|
{
|
||||||
poco_assert_dbg (stackSize >= 0);
|
poco_assert_dbg (stackSize >= 0);
|
||||||
_thread.setStackSize(stackSize);
|
_thread.setStackSize(stackSize);
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
_idleTime = wceex_time(NULL);
|
|
||||||
#else
|
|
||||||
_idleTime = std::time(NULL);
|
_idleTime = std::time(NULL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -135,11 +128,7 @@ int PooledThread::idleTime()
|
|||||||
{
|
{
|
||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
return (int) (wceex_time(NULL) - _idleTime);
|
|
||||||
#else
|
|
||||||
return (int) (time(NULL) - _idleTime);
|
return (int) (time(NULL) - _idleTime);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,11 +201,7 @@ void PooledThread::run()
|
|||||||
}
|
}
|
||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
_pTarget = 0;
|
_pTarget = 0;
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
_idleTime = wceex_time(NULL);
|
|
||||||
#else
|
|
||||||
_idleTime = time(NULL);
|
_idleTime = time(NULL);
|
||||||
#endif
|
|
||||||
_idle = true;
|
_idle = true;
|
||||||
_targetCompleted.set();
|
_targetCompleted.set();
|
||||||
ThreadLocalStorage::clear();
|
ThreadLocalStorage::clear();
|
||||||
|
@ -1,201 +0,0 @@
|
|||||||
//
|
|
||||||
// Thread_WINCE.h
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: Threading
|
|
||||||
// Module: Thread
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Thread_WINCE.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/ErrorHandler.h"
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
ThreadImpl::CurrentThreadHolder ThreadImpl::_currentThreadHolder;
|
|
||||||
|
|
||||||
|
|
||||||
ThreadImpl::ThreadImpl():
|
|
||||||
_pRunnableTarget(0),
|
|
||||||
_thread(0),
|
|
||||||
_threadId(0),
|
|
||||||
_prio(PRIO_NORMAL_IMPL),
|
|
||||||
_stackSize(POCO_THREAD_STACK_SIZE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ThreadImpl::~ThreadImpl()
|
|
||||||
{
|
|
||||||
if (_thread) CloseHandle(_thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadImpl::setNameImpl(const std::string& threadName)
|
|
||||||
{
|
|
||||||
std::string realName = threadName;
|
|
||||||
if (threadName.size() > POCO_MAX_THREAD_NAME_LEN)
|
|
||||||
{
|
|
||||||
int half = (POCO_MAX_THREAD_NAME_LEN - 1) / 2;
|
|
||||||
std::string truncName(threadName, 0, half);
|
|
||||||
truncName.append("~");
|
|
||||||
truncName.append(threadName, threadName.size() - half);
|
|
||||||
realName = truncName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (realName != _name)
|
|
||||||
{
|
|
||||||
_name = realName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string ThreadImpl::getNameImpl() const
|
|
||||||
{
|
|
||||||
return _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ThreadImpl::getOSThreadNameImpl()
|
|
||||||
{
|
|
||||||
// return fake thread name;
|
|
||||||
return isRunningImpl() ? _name : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadImpl::setPriorityImpl(int prio)
|
|
||||||
{
|
|
||||||
if (prio != _prio)
|
|
||||||
{
|
|
||||||
_prio = prio;
|
|
||||||
if (_thread)
|
|
||||||
{
|
|
||||||
if (SetThreadPriority(_thread, _prio) == 0)
|
|
||||||
throw SystemException("cannot set thread priority");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::setOSPriorityImpl(int prio, int /* policy */)
|
|
||||||
{
|
|
||||||
setPriorityImpl(prio);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::startImpl(SharedPtr<Runnable> pTarget)
|
|
||||||
{
|
|
||||||
if (isRunningImpl())
|
|
||||||
throw SystemException("thread already running");
|
|
||||||
|
|
||||||
_pRunnableTarget = pTarget;
|
|
||||||
|
|
||||||
createImpl(runnableEntry, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::createImpl(Entry ent, void* pData)
|
|
||||||
{
|
|
||||||
_thread = CreateThread(NULL, _stackSize, ent, pData, 0, &_threadId);
|
|
||||||
|
|
||||||
if (!_thread)
|
|
||||||
throw SystemException("cannot create thread");
|
|
||||||
if (_prio != PRIO_NORMAL_IMPL && !SetThreadPriority(_thread, _prio))
|
|
||||||
throw SystemException("cannot set thread priority");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::joinImpl()
|
|
||||||
{
|
|
||||||
if (!_thread) return;
|
|
||||||
|
|
||||||
switch (WaitForSingleObject(_thread, INFINITE))
|
|
||||||
{
|
|
||||||
case WAIT_OBJECT_0:
|
|
||||||
threadCleanup();
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
throw SystemException("cannot join thread");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ThreadImpl::joinImpl(long milliseconds)
|
|
||||||
{
|
|
||||||
if (!_thread) return true;
|
|
||||||
|
|
||||||
switch (WaitForSingleObject(_thread, milliseconds + 1))
|
|
||||||
{
|
|
||||||
case WAIT_TIMEOUT:
|
|
||||||
return false;
|
|
||||||
case WAIT_OBJECT_0:
|
|
||||||
threadCleanup();
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
throw SystemException("cannot join thread");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ThreadImpl::isRunningImpl() const
|
|
||||||
{
|
|
||||||
if (_thread)
|
|
||||||
{
|
|
||||||
DWORD ec = 0;
|
|
||||||
return GetExitCodeThread(_thread, &ec) && ec == STILL_ACTIVE;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::threadCleanup()
|
|
||||||
{
|
|
||||||
if (!_thread) return;
|
|
||||||
if (CloseHandle(_thread)) _thread = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ThreadImpl* ThreadImpl::currentImpl()
|
|
||||||
{
|
|
||||||
return _currentThreadHolder.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ThreadImpl::TIDImpl ThreadImpl::currentTidImpl()
|
|
||||||
{
|
|
||||||
return GetCurrentThreadId();
|
|
||||||
}
|
|
||||||
|
|
||||||
long ThreadImpl::currentOsTidImpl()
|
|
||||||
{
|
|
||||||
return GetCurrentThreadId();
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD WINAPI ThreadImpl::runnableEntry(LPVOID pThread)
|
|
||||||
{
|
|
||||||
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reinterpret_cast<ThreadImpl*>(pThread)->_pRunnableTarget->run();
|
|
||||||
}
|
|
||||||
catch (Exception& exc)
|
|
||||||
{
|
|
||||||
ErrorHandler::handle(exc);
|
|
||||||
}
|
|
||||||
catch (std::exception& exc)
|
|
||||||
{
|
|
||||||
ErrorHandler::handle(exc);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
ErrorHandler::handle();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -30,9 +30,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include <cmath>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -45,109 +42,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32_WCE) && defined(POCO_WINCE_TIMESTAMP_HACK)
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// See <http://community.opennetcf.com/articles/cf/archive/2007/11/20/getting-a-millisecond-resolution-datetime-under-windows-ce.aspx>
|
|
||||||
// for an explanation of the following code.
|
|
||||||
//
|
|
||||||
// In short: Windows CE system time in most cases only has a resolution of one second.
|
|
||||||
// But we want millisecond resolution.
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
|
|
||||||
class TickOffset
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TickOffset()
|
|
||||||
{
|
|
||||||
SYSTEMTIME st1, st2;
|
|
||||||
std::memset(&st1, 0, sizeof(SYSTEMTIME));
|
|
||||||
std::memset(&st2, 0, sizeof(SYSTEMTIME));
|
|
||||||
GetSystemTime(&st1);
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
GetSystemTime(&st2);
|
|
||||||
|
|
||||||
// wait for a rollover
|
|
||||||
if (st1.wSecond != st2.wSecond)
|
|
||||||
{
|
|
||||||
_offset = GetTickCount() % 1000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void calibrate(int seconds)
|
|
||||||
{
|
|
||||||
SYSTEMTIME st1, st2;
|
|
||||||
systemTime(&st1);
|
|
||||||
|
|
||||||
WORD s = st1.wSecond;
|
|
||||||
int sum = 0;
|
|
||||||
int remaining = seconds;
|
|
||||||
while (remaining > 0)
|
|
||||||
{
|
|
||||||
systemTime(&st2);
|
|
||||||
WORD s2 = st2.wSecond;
|
|
||||||
|
|
||||||
if (s != s2)
|
|
||||||
{
|
|
||||||
remaining--;
|
|
||||||
// store the offset from zero
|
|
||||||
sum += (st2.wMilliseconds > 500) ? (st2.wMilliseconds - 1000) : st2.wMilliseconds;
|
|
||||||
s = st2.wSecond;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// adjust the offset by the average deviation from zero (round to the integer farthest from zero)
|
|
||||||
if (sum < 0)
|
|
||||||
_offset += (int) std::floor(sum / (float)seconds);
|
|
||||||
else
|
|
||||||
_offset += (int) std::ceil(sum / (float)seconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
void systemTime(SYSTEMTIME* pST)
|
|
||||||
{
|
|
||||||
std::memset(pST, 0, sizeof(SYSTEMTIME));
|
|
||||||
|
|
||||||
WORD tick = GetTickCount() % 1000;
|
|
||||||
GetSystemTime(pST);
|
|
||||||
WORD ms = (tick >= _offset) ? (tick - _offset) : (1000 - (_offset - tick));
|
|
||||||
pST->wMilliseconds = ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
void systemTimeAsFileTime(FILETIME* pFT)
|
|
||||||
{
|
|
||||||
SYSTEMTIME st;
|
|
||||||
systemTime(&st);
|
|
||||||
SystemTimeToFileTime(&st, pFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
WORD _offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static TickOffset offset;
|
|
||||||
|
|
||||||
|
|
||||||
void GetSystemTimeAsFileTimeWithMillisecondResolution(FILETIME* pFT)
|
|
||||||
{
|
|
||||||
offset.systemTimeAsFileTime(pFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
|
|
||||||
#endif // defined(_WIN32_WCE) && defined(POCO_WINCE_TIMESTAMP_HACK)
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
@ -217,11 +111,7 @@ void Timestamp::update()
|
|||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
|
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
#if defined(_WIN32_WCE) && defined(POCO_WINCE_TIMESTAMP_HACK)
|
|
||||||
GetSystemTimeAsFileTimeWithMillisecondResolution(&ft);
|
|
||||||
#else
|
|
||||||
GetSystemTimeAsFileTime(&ft);
|
GetSystemTimeAsFileTime(&ft);
|
||||||
#endif
|
|
||||||
|
|
||||||
ULARGE_INTEGER epoch; // UNIX epoch (1970-01-01 00:00:00) expressed in Windows NT FILETIME
|
ULARGE_INTEGER epoch; // UNIX epoch (1970-01-01 00:00:00) expressed in Windows NT FILETIME
|
||||||
epoch.LowPart = 0xD53E8000;
|
epoch.LowPart = 0xD53E8000;
|
||||||
|
@ -22,11 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Timezone_WINCE.cpp"
|
|
||||||
#else
|
|
||||||
#include "Timezone_WIN32.cpp"
|
#include "Timezone_WIN32.cpp"
|
||||||
#endif
|
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include "Timezone_VX.cpp"
|
#include "Timezone_VX.cpp"
|
||||||
#else
|
#else
|
||||||
|
@ -1,104 +0,0 @@
|
|||||||
//
|
|
||||||
// Timezone_WINCE.cpp
|
|
||||||
//
|
|
||||||
// Library: Foundation
|
|
||||||
// Package: DateTime
|
|
||||||
// Module: Timezone
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Timezone.h"
|
|
||||||
#include "Poco/UnicodeConverter.h"
|
|
||||||
#include "Poco/Exception.h"
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
#include <ctime>
|
|
||||||
#if _WIN32_WCE >= 0x800
|
|
||||||
#include "time.h"
|
|
||||||
#else
|
|
||||||
#include "wce_time.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
int Timezone::utcOffset()
|
|
||||||
{
|
|
||||||
TIME_ZONE_INFORMATION tzInfo;
|
|
||||||
DWORD dstFlag = GetTimeZoneInformation(&tzInfo);
|
|
||||||
return -tzInfo.Bias*60;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Timezone::dst()
|
|
||||||
{
|
|
||||||
TIME_ZONE_INFORMATION tzInfo;
|
|
||||||
DWORD dstFlag = GetTimeZoneInformation(&tzInfo);
|
|
||||||
return dstFlag == TIME_ZONE_ID_DAYLIGHT ? -tzInfo.DaylightBias*60 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Timezone::dst(const Poco::Timestamp& timestamp)
|
|
||||||
{
|
|
||||||
if (isDst(timestamp))
|
|
||||||
{
|
|
||||||
TIME_ZONE_INFORMATION tzInfo;
|
|
||||||
GetTimeZoneInformation(&tzInfo);
|
|
||||||
return -tzInfo.DaylightBias*60;
|
|
||||||
}
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Timezone::isDst(const Timestamp& timestamp)
|
|
||||||
{
|
|
||||||
std::time_t time = timestamp.epochTime();
|
|
||||||
#if _WIN32_WCE >= 0x800
|
|
||||||
struct std::tm* tms = localtime(&time);
|
|
||||||
#else
|
|
||||||
struct std::tm* tms = wceex_localtime(&time);
|
|
||||||
#endif
|
|
||||||
if (!tms) throw SystemException("cannot get local time DST flag");
|
|
||||||
return tms->tm_isdst > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string Timezone::name()
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
TIME_ZONE_INFORMATION tzInfo;
|
|
||||||
DWORD dstFlag = GetTimeZoneInformation(&tzInfo);
|
|
||||||
WCHAR* ptr = dstFlag == TIME_ZONE_ID_DAYLIGHT ? tzInfo.DaylightName : tzInfo.StandardName;
|
|
||||||
UnicodeConverter::toUTF8(ptr, result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string Timezone::standardName()
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
TIME_ZONE_INFORMATION tzInfo;
|
|
||||||
DWORD dstFlag = GetTimeZoneInformation(&tzInfo);
|
|
||||||
WCHAR* ptr = tzInfo.StandardName;
|
|
||||||
UnicodeConverter::toUTF8(ptr, result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string Timezone::dstName()
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
TIME_ZONE_INFORMATION tzInfo;
|
|
||||||
DWORD dstFlag = GetTimeZoneInformation(&tzInfo);
|
|
||||||
WCHAR* ptr = tzInfo.DaylightName;
|
|
||||||
UnicodeConverter::toUTF8(ptr, result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
@ -4,7 +4,6 @@ set(TESTUNIT "Foundation-testrunner")
|
|||||||
file(GLOB SRCS_G "src/*.cpp")
|
file(GLOB SRCS_G "src/*.cpp")
|
||||||
file(GLOB SRCS_G_REMOVE
|
file(GLOB SRCS_G_REMOVE
|
||||||
src/TestApp.cpp
|
src/TestApp.cpp
|
||||||
src/TestApp_WINCE.cpp
|
|
||||||
src/TestLibrary.cpp
|
src/TestLibrary.cpp
|
||||||
src/TestPlugin.cpp
|
src/TestPlugin.cpp
|
||||||
)
|
)
|
||||||
@ -20,10 +19,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
||||||
src/WinCEDriver.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(Foundation-testrunner ${TEST_SRCS})
|
add_executable(Foundation-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
@ -53,12 +48,7 @@ if(UNIX AND NOT ANDROID)
|
|||||||
endif(UNIX AND NOT ANDROID)
|
endif(UNIX AND NOT ANDROID)
|
||||||
|
|
||||||
# TestApp
|
# TestApp
|
||||||
if(WINCE)
|
add_executable(TestApp src/TestApp.cpp)
|
||||||
add_executable(TestApp src/TestApp_WINCE.cpp)
|
|
||||||
set_target_properties(TestApp PROPERTIES LINK_FLAGS "/ENTRY:wmainCRTStartup")
|
|
||||||
else()
|
|
||||||
add_executable(TestApp src/TestApp.cpp)
|
|
||||||
endif()
|
|
||||||
# The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests
|
# The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests
|
||||||
set_target_properties(TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
set_target_properties(TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
target_link_libraries(TestApp PUBLIC Poco::Foundation)
|
target_link_libraries(TestApp PUBLIC Poco::Foundation)
|
||||||
|
@ -181,11 +181,11 @@ void CoreTest::testBugcheck()
|
|||||||
|
|
||||||
void CoreTest::testEnvironment()
|
void CoreTest::testEnvironment()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
Environment::set("FOO", "BAR");
|
Environment::set("FOO", "BAR");
|
||||||
assertTrue (Environment::has("FOO"));
|
assertTrue (Environment::has("FOO"));
|
||||||
assertTrue (Environment::get("FOO") == "BAR");
|
assertTrue (Environment::get("FOO") == "BAR");
|
||||||
#endif
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::string v = Environment::get("THISONEDOESNOTEXIST123");
|
std::string v = Environment::get("THISONEDOESNOTEXIST123");
|
||||||
|
@ -231,15 +231,13 @@ void FileTest::testFileAttributes3()
|
|||||||
#else
|
#else
|
||||||
File f("/dev/console");
|
File f("/dev/console");
|
||||||
#endif
|
#endif
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
File f("CON");
|
File f("CON");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
assertTrue (f.isDevice());
|
assertTrue (f.isDevice());
|
||||||
assertTrue (!f.isFile());
|
assertTrue (!f.isFile());
|
||||||
assertTrue (!f.isDirectory());
|
assertTrue (!f.isDirectory());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -271,12 +269,6 @@ void FileTest::testCompare()
|
|||||||
void FileTest::testRootDir()
|
void FileTest::testRootDir()
|
||||||
{
|
{
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
File f1("\\");
|
|
||||||
File f2("/");
|
|
||||||
assertTrue (f1.exists());
|
|
||||||
assertTrue (f2.exists());
|
|
||||||
#else
|
|
||||||
File f1("/");
|
File f1("/");
|
||||||
File f2("c:/");
|
File f2("c:/");
|
||||||
File f3("c:\\");
|
File f3("c:\\");
|
||||||
@ -285,7 +277,6 @@ void FileTest::testRootDir()
|
|||||||
assertTrue (f2.exists());
|
assertTrue (f2.exists());
|
||||||
assertTrue (f3.exists());
|
assertTrue (f3.exists());
|
||||||
assertTrue (f4.exists());
|
assertTrue (f4.exists());
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
File f1("/");
|
File f1("/");
|
||||||
assertTrue (f1.exists());
|
assertTrue (f1.exists());
|
||||||
@ -588,7 +579,7 @@ void FileTest::testRenameFailIfExists() {
|
|||||||
|
|
||||||
void FileTest::testLongPath()
|
void FileTest::testLongPath()
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
#if defined(_WIN32)
|
||||||
Poco::Path p("longpathtest");
|
Poco::Path p("longpathtest");
|
||||||
p.makeAbsolute();
|
p.makeAbsolute();
|
||||||
std::string longpath(p.toString());
|
std::string longpath(p.toString());
|
||||||
|
@ -456,13 +456,11 @@ void GlobTest::testGlob()
|
|||||||
assertTrue (files.find("globtest/testsuite/src/test.c") != files.end());
|
assertTrue (files.find("globtest/testsuite/src/test.c") != files.end());
|
||||||
assertTrue (files.find("globtest/testsuite/src/main.c") != files.end());
|
assertTrue (files.find("globtest/testsuite/src/main.c") != files.end());
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
// won't work if current directory is root dir
|
// won't work if current directory is root dir
|
||||||
files.clear();
|
files.clear();
|
||||||
Glob::glob("globtest/../*/testsuite/*/", files);
|
Glob::glob("globtest/../*/testsuite/*/", files);
|
||||||
translatePaths(files);
|
translatePaths(files);
|
||||||
assertTrue (files.size() == 1);
|
assertTrue (files.size() == 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
File dir("globtest");
|
File dir("globtest");
|
||||||
dir.remove(true);
|
dir.remove(true);
|
||||||
|
@ -25,9 +25,6 @@
|
|||||||
#include "Poco/DateTimeFormatter.h"
|
#include "Poco/DateTimeFormatter.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
|
||||||
#include "wce_time.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
using Poco::LocalDateTime;
|
using Poco::LocalDateTime;
|
||||||
@ -35,9 +32,7 @@ using Poco::DateTime;
|
|||||||
using Poco::Timestamp;
|
using Poco::Timestamp;
|
||||||
using Poco::Timespan;
|
using Poco::Timespan;
|
||||||
using Poco::Timezone;
|
using Poco::Timezone;
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
using std::strftime;
|
using std::strftime;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
LocalDateTimeTest::LocalDateTimeTest(const std::string& name): CppUnit::TestCase(name)
|
LocalDateTimeTest::LocalDateTimeTest(const std::string& name): CppUnit::TestCase(name)
|
||||||
@ -368,7 +363,6 @@ void LocalDateTimeTest::testSwap()
|
|||||||
|
|
||||||
void LocalDateTimeTest::testTimezone()
|
void LocalDateTimeTest::testTimezone()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
std::time_t tINCREMENT = (30 * 24 * 60 * 60); // 30 days
|
std::time_t tINCREMENT = (30 * 24 * 60 * 60); // 30 days
|
||||||
Timespan tsINCREMENT(30*Timespan::DAYS);
|
Timespan tsINCREMENT(30*Timespan::DAYS);
|
||||||
LocalDateTime now;
|
LocalDateTime now;
|
||||||
@ -450,7 +444,6 @@ void LocalDateTimeTest::testTimezone()
|
|||||||
<< " - failed to locate DST boundary, timezone test skipped."
|
<< " - failed to locate DST boundary, timezone test skipped."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void LoggingFactoryTest::testBuiltins()
|
|||||||
LoggingFactory& fact = LoggingFactory::defaultFactory();
|
LoggingFactory& fact = LoggingFactory::defaultFactory();
|
||||||
|
|
||||||
Channel::Ptr pConsoleChannel = fact.createChannel("ConsoleChannel");
|
Channel::Ptr pConsoleChannel = fact.createChannel("ConsoleChannel");
|
||||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
#if defined(_WIN32)
|
||||||
assertTrue (!pConsoleChannel.cast<Poco::WindowsConsoleChannel>().isNull());
|
assertTrue (!pConsoleChannel.cast<Poco::WindowsConsoleChannel>().isNull());
|
||||||
#else
|
#else
|
||||||
assertTrue (!pConsoleChannel.cast<ConsoleChannel>().isNull());
|
assertTrue (!pConsoleChannel.cast<ConsoleChannel>().isNull());
|
||||||
|
@ -19,12 +19,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
#include "Poco/Path_WINCE.h"
|
|
||||||
#else
|
|
||||||
#include "Poco/Path_WIN32U.h"
|
#include "Poco/Path_WIN32U.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
using Poco::Path;
|
using Poco::Path;
|
||||||
@ -1549,9 +1545,6 @@ void PathTest::testFind()
|
|||||||
bool found = Path::find(Environment::get("PATH"), "ls", p);
|
bool found = Path::find(Environment::get("PATH"), "ls", p);
|
||||||
bool notfound = Path::find(Environment::get("PATH"), "xxxyyy123", p);
|
bool notfound = Path::find(Environment::get("PATH"), "xxxyyy123", p);
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
bool found = Path::find(Environment::get("PATH"), "cmd.exe", p);
|
bool found = Path::find(Environment::get("PATH"), "cmd.exe", p);
|
||||||
bool notfound = Path::find(Environment::get("PATH"), "xxxyyy123.zzz", p);
|
bool notfound = Path::find(Environment::get("PATH"), "xxxyyy123.zzz", p);
|
||||||
#else
|
#else
|
||||||
|
@ -97,10 +97,6 @@ void ProcessRunnerTest::testProcessRunner()
|
|||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_UNIX)
|
#if defined(POCO_OS_FAMILY_UNIX)
|
||||||
cmd += name;
|
cmd += name;
|
||||||
#elif defined(_WIN32_WCE)
|
|
||||||
cmd = "\\";
|
|
||||||
cmd += name;
|
|
||||||
cmd += ".EXE";
|
|
||||||
#else
|
#else
|
||||||
cmd = name;
|
cmd = name;
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,10 +65,6 @@ void ProcessTest::testLaunch()
|
|||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_UNIX)
|
#if defined(POCO_OS_FAMILY_UNIX)
|
||||||
cmd += name;
|
cmd += name;
|
||||||
#elif defined(_WIN32_WCE)
|
|
||||||
cmd = "\\";
|
|
||||||
cmd += name;
|
|
||||||
cmd += ".EXE";
|
|
||||||
#else
|
#else
|
||||||
cmd = name;
|
cmd = name;
|
||||||
#endif
|
#endif
|
||||||
@ -85,7 +81,6 @@ void ProcessTest::testLaunch()
|
|||||||
|
|
||||||
void ProcessTest::testLaunchRedirectIn()
|
void ProcessTest::testLaunchRedirectIn()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
std::string name("TestApp");
|
std::string name("TestApp");
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
||||||
@ -107,13 +102,11 @@ void ProcessTest::testLaunchRedirectIn()
|
|||||||
ostr.close();
|
ostr.close();
|
||||||
int rc = ph.wait();
|
int rc = ph.wait();
|
||||||
assertTrue (rc == 100);
|
assertTrue (rc == 100);
|
||||||
#endif // !defined(_WIN32_WCE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProcessTest::testLaunchRedirectOut()
|
void ProcessTest::testLaunchRedirectOut()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
std::string name("TestApp");
|
std::string name("TestApp");
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
||||||
@ -137,13 +130,11 @@ void ProcessTest::testLaunchRedirectOut()
|
|||||||
assertTrue (s == "Hello, world!");
|
assertTrue (s == "Hello, world!");
|
||||||
int rc = ph.wait();
|
int rc = ph.wait();
|
||||||
assertTrue (rc == 1);
|
assertTrue (rc == 1);
|
||||||
#endif // !defined(_WIN32_WCE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProcessTest::testLaunchEnv()
|
void ProcessTest::testLaunchEnv()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
std::string name("TestApp");
|
std::string name("TestApp");
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
||||||
@ -169,13 +160,12 @@ void ProcessTest::testLaunchEnv()
|
|||||||
assertTrue (s == "test");
|
assertTrue (s == "test");
|
||||||
int rc = ph.wait();
|
int rc = ph.wait();
|
||||||
assertTrue (rc == 0);
|
assertTrue (rc == 0);
|
||||||
#endif // !defined(_WIN32_WCE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProcessTest::testLaunchArgs()
|
void ProcessTest::testLaunchArgs()
|
||||||
{
|
{
|
||||||
#if defined (_WIN32) && !defined(_WIN32_WCE)
|
#if defined (_WIN32)
|
||||||
std::string name("TestApp");
|
std::string name("TestApp");
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
name += 'd';
|
name += 'd';
|
||||||
@ -225,7 +215,7 @@ void ProcessTest::testLaunchArgs()
|
|||||||
assertTrue (argNumber == args.size());
|
assertTrue (argNumber == args.size());
|
||||||
int rc = ph.wait();
|
int rc = ph.wait();
|
||||||
assertTrue (rc == args.size());
|
assertTrue (rc == args.size());
|
||||||
#endif // !defined(_WIN32_WCE)
|
#endif // defined (_WIN32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -239,10 +229,6 @@ void ProcessTest::testLaunchInvalidCommand()
|
|||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_UNIX)
|
#if defined(POCO_OS_FAMILY_UNIX)
|
||||||
cmd += name;
|
cmd += name;
|
||||||
#elif defined(_WIN32_WCE)
|
|
||||||
cmd = "\\";
|
|
||||||
cmd += name;
|
|
||||||
cmd += ".EXE";
|
|
||||||
#else
|
#else
|
||||||
cmd = name;
|
cmd = name;
|
||||||
#endif
|
#endif
|
||||||
@ -269,7 +255,6 @@ void ProcessTest::testLaunchInvalidCommand()
|
|||||||
|
|
||||||
void ProcessTest::testIsRunning()
|
void ProcessTest::testIsRunning()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
std::string name("TestApp");
|
std::string name("TestApp");
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID)
|
||||||
@ -295,7 +280,6 @@ void ProcessTest::testIsRunning()
|
|||||||
int POCO_UNUSED rc = ph.wait();
|
int POCO_UNUSED rc = ph.wait();
|
||||||
assertTrue (!Process::isRunning(ph));
|
assertTrue (!Process::isRunning(ph));
|
||||||
assertTrue (!Process::isRunning(id));
|
assertTrue (!Process::isRunning(id));
|
||||||
#endif // !defined(_WIN32_WCE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
//
|
|
||||||
// TestApp_WINCE.cpp
|
|
||||||
//
|
|
||||||
// Copyright (c) 2005-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
int wmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
if (argc > 1)
|
|
||||||
{
|
|
||||||
std::wstring arg(argv[1]);
|
|
||||||
if (arg == L"-hello")
|
|
||||||
{
|
|
||||||
std::cout << "Hello, world!";
|
|
||||||
}
|
|
||||||
else if (arg == L"-count")
|
|
||||||
{
|
|
||||||
int n = 0;
|
|
||||||
int c = std::cin.get();
|
|
||||||
while (c != -1) { ++n; c = std::cin.get(); }
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return argc - 1;
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
//
|
|
||||||
// WinCEDriver.cpp
|
|
||||||
//
|
|
||||||
// Console-based test driver for Windows CE.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "CppUnit/TestRunner.h"
|
|
||||||
#include "FoundationTestSuite.h"
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
|
|
||||||
int wmain(int argc, wchar_t* argv[])
|
|
||||||
{
|
|
||||||
std::vector<std::string> args;
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
|
||||||
args.push_back(std::string(buffer));
|
|
||||||
}
|
|
||||||
CppUnit::TestRunner runner;
|
|
||||||
runner.addTest("FoundationTestSuite", FoundationTestSuite::suite());
|
|
||||||
return runner.run(args) ? 0 : 1;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
List of WCELIBCEX authors:
|
|
||||||
|
|
||||||
Active developers
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
* Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
|
|
||||||
* Stéphane Dunand (sdunand@sirap.fr)
|
|
||||||
|
|
||||||
Previously contributed
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
* Piotr Wisniewski (pwisniewski@taxussi.com.pl)
|
|
@ -1,41 +0,0 @@
|
|||||||
$Id: BUILD.txt 50 2007-01-08 12:16:50Z mloskot $
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
Building WCELIBCEX library
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
*** IMPORTANT ***
|
|
||||||
Remember to build WCELIBCEX as a static library, not DLL.
|
|
||||||
Provided project for Visual C++ 2005 is configured to
|
|
||||||
build WCELIBCEX as a static library
|
|
||||||
*****************
|
|
||||||
|
|
||||||
Supported and tested platforms:
|
|
||||||
|
|
||||||
- Windows CE 4.x
|
|
||||||
- Pocket PC 2003
|
|
||||||
- Smartphone 2003
|
|
||||||
- Windows CE 5.0
|
|
||||||
- Windows Mobile 5.0
|
|
||||||
- other custom operating systems based on Windows CE 5.0
|
|
||||||
|
|
||||||
If you've used WCELIBCEX on Windows CE OS not listed here,
|
|
||||||
please drop me a message on mateusz@loskot.net.
|
|
||||||
|
|
||||||
Supported compilers:
|
|
||||||
|
|
||||||
- Microsoft Visual C++ 2005 Standard or Professional
|
|
||||||
- Microsoft eMbedded Visual C++ 4.0
|
|
||||||
|
|
||||||
At the moment, there is no project file available for eVC++ 4.0.
|
|
||||||
The process of creating new project file for WCELIBCEX is pretty easy,
|
|
||||||
so there should be no problem with creating it for eVC++ 4.0.
|
|
||||||
In case of problems, write to wcelibcex-devel@lists.sourceforge.net.
|
|
||||||
|
|
||||||
Building the library
|
|
||||||
|
|
||||||
1. Go to 'msvc80' directory
|
|
||||||
2. Open 'wcelibcex_lib.sln' project in Visual C++ 2005 IDE
|
|
||||||
3. From the main toolbar, select prefered 'Solution Configuration'
|
|
||||||
and 'Solution Platform'
|
|
||||||
4. Run Build -> Build Solution
|
|
||||||
5. If no errors occured, the library is ready to use
|
|
@ -1,9 +0,0 @@
|
|||||||
Note about WCELIBCEX files copyright.
|
|
||||||
|
|
||||||
File copyright is held by a file author.
|
|
||||||
|
|
||||||
Files created for the first version of the WCELIBCEX project are
|
|
||||||
copyrighted by (c) 2006 Taxus SI Ltd., http://www.taxussi.com.pl
|
|
||||||
|
|
||||||
See comment in header of source files for more details.
|
|
||||||
See LICENSE.txt for license agreement.
|
|
@ -1,24 +0,0 @@
|
|||||||
WCELIBCEX - Windows CE C Library Extensions
|
|
||||||
|
|
||||||
The source code of the WCELIBCEX library is
|
|
||||||
licensed under MIT License:
|
|
||||||
|
|
||||||
http://opensource.org/licenses/mit-license.php
|
|
||||||
|
|
||||||
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.
|
|
@ -1,22 +0,0 @@
|
|||||||
$Id: README.txt 50 2007-01-08 12:16:50Z mloskot $
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
WCELIBCEX - Windows CE C Library Extensions
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
The WCELIBCEX is a package of C library extensions for Windows CE
|
|
||||||
operating system. It is a supplement to standard C library
|
|
||||||
available on Windows CE system.
|
|
||||||
|
|
||||||
Project developer: Mateusz Loskot <mateusz@loskot.net>
|
|
||||||
|
|
||||||
Homepage: http://sourceforge.net/projects/wcelibcex
|
|
||||||
Wiki: http://wcelibcex.sourceforge.net
|
|
||||||
|
|
||||||
For details, check following files:
|
|
||||||
AUTHORS.txt - list of developers and contributors
|
|
||||||
LICENSE.txt - license agreement
|
|
||||||
COPYING.txt - copyright and provenience notice
|
|
||||||
BUILD.txt - building instructions
|
|
||||||
|
|
||||||
Initial version of WCELIBCEX was founded and copyrighted by Taxus SI Ltd.,
|
|
||||||
http://www.taxussi.com.pl
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="windows-1250"?>
|
|
||||||
<VisualStudioPropertySheet
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8.00"
|
|
||||||
Name="wcelibcex"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
/>
|
|
||||||
<UserMacro
|
|
||||||
Name="WCELIBCEX_DIR"
|
|
||||||
Value="$(ProjectDir)..\src"
|
|
||||||
/>
|
|
||||||
</VisualStudioPropertySheet>
|
|
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
|
||||||
# Visual Studio 2005
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wcelibcex_lib", "wcelibcex_lib.vcproj", "{55190080-FEA8-4B07-83E1-A26E6937982A}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
|
|
||||||
Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4)
|
|
||||||
Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
|
|
||||||
Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4)
|
|
||||||
Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
{55190080-FEA8-4B07-83E1-A26E6937982A}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,817 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="windows-1250"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8.00"
|
|
||||||
Name="wcelibcex_lib"
|
|
||||||
ProjectGUID="{55190080-FEA8-4B07-83E1-A26E6937982A}"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Pocket PC 2003 (ARMV4)"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="Smartphone 2003 (ARMV4)"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Pocket PC 2003 (ARMV4)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
|
|
||||||
OutputFile="$(OutDir)/wcelibcexd.lib"
|
|
||||||
/>
|
|
||||||
<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|Smartphone 2003 (ARMV4)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
|
|
||||||
OutputFile="$(OutDir)/wcelibcexd.lib"
|
|
||||||
/>
|
|
||||||
<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 Pocket PC SDK (ARMV4I)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,5.01"
|
|
||||||
OutputFile="$(OutDir)/wcelibcexd.lib"
|
|
||||||
/>
|
|
||||||
<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 (ARMV4I)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,5.01"
|
|
||||||
OutputFile="$(OutDir)/wcelibcexd.lib"
|
|
||||||
/>
|
|
||||||
<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|Pocket PC 2003 (ARMV4)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
|
|
||||||
OutputFile="$(OutDir)/wcelibcex.lib"
|
|
||||||
/>
|
|
||||||
<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|Smartphone 2003 (ARMV4)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
|
|
||||||
OutputFile="$(OutDir)/wcelibcex.lib"
|
|
||||||
/>
|
|
||||||
<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 (ARMV4I)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,5.01"
|
|
||||||
OutputFile="$(OutDir)/wcelibcex.lib"
|
|
||||||
/>
|
|
||||||
<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 (ARMV4I)"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets=".\wcelibcex.vsprops"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ExecutionBucket="7"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories="$(WCELIBCEX_DIR)"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
|
|
||||||
Culture="1033"
|
|
||||||
AdditionalIncludeDirectories="$(IntDir)"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions=" /subsystem:windowsce,5.01"
|
|
||||||
OutputFile="$(OutDir)/wcelibcex.lib"
|
|
||||||
/>
|
|
||||||
<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="..\src\wce_abort.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_access.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_asctime.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_bsearch.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_clock.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_ctime.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_directorymanagement.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_errno.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_findfile.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_getenv.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_getopt.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_gettimeofday.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_lfind.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_localtime.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_mkdir.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_mktime.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_path.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_rename.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_rewind.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_rmdir.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_setlocale.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_stat.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_strerror.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_time.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_timesys.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_unlink.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_winbase.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\errno.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\fcntl.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_direct.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_errno.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_fcntl.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_io.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_stat.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_stdio.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_stdlib.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_string.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_time.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_timesys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_types.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_unistd.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\src\wce_winbase.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: errno.h 20 2006-11-18 17:00:30Z mloskot $
|
|
||||||
*
|
|
||||||
* errno.h - system error numbers
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef WCEEX_ERRNO_WRAPPER_H
|
|
||||||
#define WCEEX_ERRNO_WRAPPER_H 1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Windows CE SDK does not provide errno.h file.
|
|
||||||
* In order to simplify usage of wce_errno.h extension, this header is provided.
|
|
||||||
* It directly includes wce_errno.h file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
# error "Only Winddows CE target is supported!"
|
|
||||||
#else
|
|
||||||
# include "wce_errno.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* #ifndef WCEEX_ERRNO_WRAPPER_H */
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* fcntl.h - wrapper on wce_fcntl.h header
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef WCEEX_FCNTL_WRAPPER_H
|
|
||||||
#define WCEEX_FCNTL_WRAPPER_H 1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Windows CE SDK does not provide fcntl.h file.
|
|
||||||
* In order to simplify usage of wce_fcntl.h extension, this header is provided.
|
|
||||||
* It directly includes wce_fcntl.h file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
# error "Only Winddows CE target is supported!"
|
|
||||||
#else
|
|
||||||
# include "wce_fcntl.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* #ifndef WCEEX_FCNTL_WRAPPER_H */
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_abort.c,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines abort() function.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_abort - Generate abnormal process termination.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The abort() function shall cause abnormal process termination to occur.
|
|
||||||
* Internally, mkdir() function wraps TerminateProcess call from
|
|
||||||
* Windows CE API.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* The abort() function shall not return.*
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
void wceex_abort(void)
|
|
||||||
{
|
|
||||||
/* No return */
|
|
||||||
TerminateProcess(GetCurrentProcess(), 0);
|
|
||||||
}
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_access.c,v 1.0 2006/11/29 16:37:06 stephaned Exp $
|
|
||||||
*
|
|
||||||
* Defines _access(), _waccess() functions.
|
|
||||||
*
|
|
||||||
* Created by Stéphane Dunand (sdunand@sirap.fr)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Stéphane Dunand
|
|
||||||
*
|
|
||||||
* 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 <wce_io.h>
|
|
||||||
#include <wce_errno.h>
|
|
||||||
#include <shellapi.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_waccess - Determine file-access permission
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
* 0 if the file has the given mode
|
|
||||||
* –1 if the named file does not exist or is not accessible in the given mode
|
|
||||||
* and errno set as :
|
|
||||||
* EACCES file's permission setting does not allow specified access
|
|
||||||
* ENOENT filename or path not found
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_waccess( const wchar_t *path, int mode )
|
|
||||||
{
|
|
||||||
SHFILEINFO fi;
|
|
||||||
if( !SHGetFileInfo( path, 0, &fi, sizeof(fi), SHGFI_ATTRIBUTES ) )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// existence ?
|
|
||||||
if( mode == 0 )
|
|
||||||
return 0;
|
|
||||||
// write permission ?
|
|
||||||
if( mode & 2 )
|
|
||||||
{
|
|
||||||
if( fi.dwAttributes & SFGAO_READONLY )
|
|
||||||
{
|
|
||||||
errno = EACCES;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_access - Determine file-access permission
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
* 0 if the file has the given mode
|
|
||||||
* –1 if the named file does not exist or is not accessible in the given mode
|
|
||||||
* and errno set as :
|
|
||||||
* EACCES file's permission setting does not allow specified access
|
|
||||||
* ENOENT filename or path not found
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_access( const char *path, int mode )
|
|
||||||
{
|
|
||||||
wchar_t wpath[_MAX_PATH];
|
|
||||||
if( !MultiByteToWideChar( CP_ACP, 0, path, -1, wpath, _MAX_PATH ) )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return wceex_waccess( wpath, mode );
|
|
||||||
}
|
|
@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_asctime.c,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines asctime() function.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <wce_time.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Internal definitions
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/* Buffer to store string representation of tm struct. */
|
|
||||||
#define TIME_STRING_SIZE 26
|
|
||||||
|
|
||||||
/* Buffer to store string representation of tm struct. */
|
|
||||||
static char __wce_asc_result[TIME_STRING_SIZE];
|
|
||||||
|
|
||||||
/* Format of string returned. */
|
|
||||||
static const char __wce_asc_format[] = "%.3s %.3s %02d %.2d:%.2d:%.2d %d\n";
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_asctime - Convert date and time to a string
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The asctime function converts the broken-down time value that
|
|
||||||
* brokentime points to into a string in a standard format:
|
|
||||||
* "Mon Jan 30 13:46:22 2006\n"
|
|
||||||
*
|
|
||||||
* The abbreviations for the days of week are:
|
|
||||||
* Sun, Mon, Tue, Wed, Thu, Fri, and Sat.
|
|
||||||
*
|
|
||||||
* The abbreviations for the months are:
|
|
||||||
* Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec.
|
|
||||||
*
|
|
||||||
* The asctime() is not required to be thread-safe.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE Std 1003.1-2001
|
|
||||||
* The GNU C Library Manual
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
char * wceex_asctime(const struct tm *tmbuff)
|
|
||||||
{
|
|
||||||
return wceex_asctime_r(tmbuff, __wce_asc_result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_asctime_r - Convert date and time to a string
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* This function is similar to asctime but instead of placing the result
|
|
||||||
* in a static buffer it writes the string in the buffer pointed to by
|
|
||||||
* the parameter buffer. This buffer should have room for at least 26 bytes,
|
|
||||||
* including the terminating null.
|
|
||||||
*
|
|
||||||
* The asctime_r() is not required to be thread-safe.
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
*
|
|
||||||
* Upon success the function returns a pointer to the string the result was written into.
|
|
||||||
* Otherwise return NULL.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE Std 1003.1-2001
|
|
||||||
* The GNU C Library Manual
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
char * wceex_asctime_r(const struct tm *tmbuff, char *buff)
|
|
||||||
{
|
|
||||||
int res;
|
|
||||||
static char wday_short[7][3] = {
|
|
||||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
|
||||||
};
|
|
||||||
static char mon_short[12][3] = {
|
|
||||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
|
||||||
};
|
|
||||||
|
|
||||||
if (tmbuff == NULL)
|
|
||||||
{
|
|
||||||
// XXX - mloskot - set errno with EINVAL
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Format: "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n" */
|
|
||||||
res = sprintf(buff, __wce_asc_format,
|
|
||||||
wday_short[tmbuff->tm_wday],
|
|
||||||
mon_short[tmbuff->tm_mon],
|
|
||||||
tmbuff->tm_mday,
|
|
||||||
tmbuff->tm_hour,
|
|
||||||
tmbuff->tm_min,
|
|
||||||
tmbuff->tm_sec,
|
|
||||||
1900 + tmbuff->tm_year);
|
|
||||||
|
|
||||||
if (res < 0)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return buff;
|
|
||||||
}
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_bsearch.c 20 2006-11-18 17:00:30Z mloskot $
|
|
||||||
*
|
|
||||||
* Defines bsearch() function.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Mateusz Loskot
|
|
||||||
*
|
|
||||||
* 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 <stdlib.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <wce_types.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_bsearch - TODO
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
void* wceex_bsearch(const void *key, const void *base, size_t num, size_t width,
|
|
||||||
int (*compare)(const void *, const void *))
|
|
||||||
{
|
|
||||||
size_t left;
|
|
||||||
size_t middle;
|
|
||||||
size_t right;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
/* input parameters validation */
|
|
||||||
assert(key != NULL);
|
|
||||||
assert(base != NULL);
|
|
||||||
assert(compare != NULL);
|
|
||||||
|
|
||||||
res = 0;
|
|
||||||
left = 0;
|
|
||||||
right = num - 1;
|
|
||||||
|
|
||||||
while (left <= right)
|
|
||||||
{
|
|
||||||
middle = (left + right) / 2;
|
|
||||||
|
|
||||||
res = compare(((char*) base + (width * middle)), key);
|
|
||||||
if (res > 0)
|
|
||||||
{
|
|
||||||
/* search from middle to left */
|
|
||||||
right = middle - 1;
|
|
||||||
}
|
|
||||||
else if (res < 0)
|
|
||||||
{
|
|
||||||
/* search from middle to right */
|
|
||||||
left = middle + 1;
|
|
||||||
}
|
|
||||||
else if (res == 0)
|
|
||||||
{
|
|
||||||
/* middle points to the key element. */
|
|
||||||
return ((char*) base + (width * middle));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* key not found */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_clock.c 20 2006-11-18 17:00:30Z mloskot $
|
|
||||||
*
|
|
||||||
* Defines clock() function.
|
|
||||||
*
|
|
||||||
* Created by hav (TODO: Full name of hav)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 (TODO: Full name of hav)
|
|
||||||
*
|
|
||||||
* 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 <time.h>
|
|
||||||
#include <winbase.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_clock - report CPU time used
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The clock() function shall return the implementation's best approximation to
|
|
||||||
* the processor time used by the process since the beginning of
|
|
||||||
* an implementation-defined era related only to the process invocation.
|
|
||||||
*
|
|
||||||
* Windows CE specific:
|
|
||||||
* CLOCKS_PER_SEC is defined in <time.h> available in Windows CE SDK.
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
*
|
|
||||||
* To determine the time in seconds, the value returned by clock() should be
|
|
||||||
* divided by the value of the macro CLOCKS_PER_SEC.
|
|
||||||
* CLOCKS_PER_SEC is defined to be one million in <time.h>.
|
|
||||||
* If the processor time used is not available or its value cannot be represented,
|
|
||||||
* the function shall return the value ( clock_t)-1.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE Std 1003.1-2001
|
|
||||||
* The GNU C Library Manual
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clock_t wceex_clock()
|
|
||||||
{
|
|
||||||
__int64 ticks;
|
|
||||||
SYSTEMTIME stCurrent;
|
|
||||||
FILETIME ftCurrent;
|
|
||||||
|
|
||||||
GetSystemTime(&stCurrent);
|
|
||||||
|
|
||||||
if (SystemTimeToFileTime(&stCurrent, &ftCurrent))
|
|
||||||
{
|
|
||||||
ticks = *(__int64*)&ftCurrent;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The processor time used is not available or
|
|
||||||
* its value cannot be represented.
|
|
||||||
*/
|
|
||||||
ticks = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (clock_t)ticks;
|
|
||||||
}
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_ctime.c,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines ctime() function.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <wce_time.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_ctime - Convert a time value to a date and time string
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The ctime function is similar to asctime, except that you specify
|
|
||||||
* the calendar time argument as a time_t simple time value rather
|
|
||||||
* than in broken-down local time format.
|
|
||||||
* It shall be equivalent to: asctime(localtime(clock))
|
|
||||||
*
|
|
||||||
* The ctime() is not required to be thread-safe.
|
|
||||||
*
|
|
||||||
* Windows CE specific:
|
|
||||||
* ctime does not set the variable tzname.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE Std 1003.1-2001
|
|
||||||
* The GNU C Library Manual
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
char * wceex_ctime(const time_t *timer)
|
|
||||||
{
|
|
||||||
return wceex_asctime(wceex_localtime(timer));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_ctime_r - Convert a time value to a date and time string
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* This function is similar to ctime, but places the result in the string
|
|
||||||
* pointed to by buffer.
|
|
||||||
*
|
|
||||||
* The ctime() is not required to be thread-safe.
|
|
||||||
*
|
|
||||||
* Windows CE specific:
|
|
||||||
* ctime does not set the variable tzname.
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
*
|
|
||||||
* Upon success the function returns a pointer to the string the result was written into.
|
|
||||||
* Otherwise return NULL.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE Std 1003.1-2001
|
|
||||||
* The GNU C Library Manual
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
char * wceex_ctime_r(const time_t *timer, char *buf)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
XXX - mloskot - it's waiting for localtime_r function.
|
|
||||||
|
|
||||||
({ struct tm tm; asctime_r (localtime_r (time, &tm), buf); })
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_direct.h,v 1.0 2006/11/29 16:38:05 stephaned Exp $
|
|
||||||
*
|
|
||||||
* Created by Stéphane Dunand (sdunand@sirap.fr)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Stéphane Dunand
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef WCEEX_DIRECT_H
|
|
||||||
#define WCEEX_DIRECT_H 1
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
# error "Only Windows CE target is supported!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <winbase.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
int wceex_wmkdir( const wchar_t* dirname );
|
|
||||||
|
|
||||||
char* wceex_getcwd( char *buffer, int maxlen );
|
|
||||||
wchar_t* wceex_wgetcwd( wchar_t *buffer, int maxlen );
|
|
||||||
|
|
||||||
int wceex_chdir( const char *dirname );
|
|
||||||
int wceex_wchdir( const wchar_t *dirname );
|
|
||||||
|
|
||||||
DWORD wceex_GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* #ifndef WCEEX_DIRECT_H */
|
|
||||||
|
|
@ -1,227 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_directorymanagement.c,v 1.0 2006/11/29 17:00:28 stephaned Exp $
|
|
||||||
*
|
|
||||||
* Defines _getcwd(), GetCurrentDirectoryW() _wgetcwd(),
|
|
||||||
* _chdir(), _wchdir functions.
|
|
||||||
*
|
|
||||||
* Created by Stéphane Dunand (sdunand@sirap.fr)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Stéphane Dunand
|
|
||||||
*
|
|
||||||
* 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 <winbase.h>
|
|
||||||
#include <shellapi.h>
|
|
||||||
#include <wce_direct.h>
|
|
||||||
#include <wce_errno.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* InitCwd - Init the current directory with the path for the file used to create
|
|
||||||
* the calling process
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
static wchar_t Cwd[_MAX_PATH] = { '\0' };
|
|
||||||
|
|
||||||
static int InitCwd()
|
|
||||||
{
|
|
||||||
if( Cwd[0] )
|
|
||||||
return 0;
|
|
||||||
if( !GetModuleFileName( NULL, Cwd, _MAX_PATH ) )
|
|
||||||
return errno = GetLastError();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wchar_t* slash = wcsrchr( Cwd, '\\' );
|
|
||||||
if( !slash )
|
|
||||||
slash = wcsrchr( Cwd, '/' );
|
|
||||||
if( slash )
|
|
||||||
{
|
|
||||||
if( slash == Cwd )
|
|
||||||
slash++;
|
|
||||||
*slash = 0;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_getcwd - Get the current working directory
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
char* wceex_getcwd( char *buffer, int maxlen )
|
|
||||||
{
|
|
||||||
if( !buffer && (buffer = (char*)malloc(maxlen)) == NULL )
|
|
||||||
{
|
|
||||||
errno = ENOMEM;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if( InitCwd() )
|
|
||||||
return NULL;
|
|
||||||
if( !WideCharToMultiByte( CP_ACP, 0, Cwd, -1, buffer, maxlen, NULL, NULL ) )
|
|
||||||
{
|
|
||||||
errno = GetLastError();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_GetCurrentDirectoryW - Get the current working directory
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
DWORD wceex_GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer )
|
|
||||||
{
|
|
||||||
*lpBuffer = 0;
|
|
||||||
if( InitCwd() )
|
|
||||||
{
|
|
||||||
SetLastError( errno );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size_t slen = wcslen( Cwd );
|
|
||||||
if( slen >= (size_t)nBufferLength )
|
|
||||||
return slen + 1;
|
|
||||||
wcscpy( lpBuffer, Cwd );
|
|
||||||
return slen;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_wgetcwd - Get the current working directory
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
wchar_t* wceex_wgetcwd( wchar_t *buffer, int maxlen )
|
|
||||||
{
|
|
||||||
if( !buffer && (buffer = (wchar_t*)malloc(maxlen * sizeof(wchar_t))) == NULL )
|
|
||||||
{
|
|
||||||
errno = ENOMEM;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DWORD slen = wceex_GetCurrentDirectoryW( maxlen, buffer );
|
|
||||||
if( !slen )
|
|
||||||
return NULL;
|
|
||||||
if( slen >= (DWORD)maxlen )
|
|
||||||
{
|
|
||||||
errno = ERANGE;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_wchdir - Change the current working directory
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_wchdir( const wchar_t *dirname )
|
|
||||||
{
|
|
||||||
if( !dirname || *dirname == 0 )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SHFILEINFO fi;
|
|
||||||
if( !SHGetFileInfo( dirname, 0, &fi, sizeof(fi), SHGFI_ATTRIBUTES ) )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if( !(fi.dwAttributes & SFGAO_FOLDER) )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
wcscpy( Cwd, dirname );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_chdir - Change the current working directory
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_chdir( const char *dirname )
|
|
||||||
{
|
|
||||||
if( !dirname || *dirname == 0 )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wchar_t wdirname[_MAX_PATH];
|
|
||||||
if( !MultiByteToWideChar( CP_ACP, 0, dirname, -1, wdirname, _MAX_PATH ) )
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return wceex_wchdir( wdirname );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_errno.c,v 1.1 2006/02/19 22:04:53 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Global errno variable.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX - mloskot - errno is required to be thread-safe
|
|
||||||
*/
|
|
||||||
|
|
||||||
int errno;
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_errno.h,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* errno.h - system error numbers
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef WCEEX_ERRNO_H
|
|
||||||
#define WCEEX_ERRNO_H 1
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
# error "Only Winddows CE target is supported!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#if defined(_MT)
|
|
||||||
# error "errno as global variable does not work with multi threads"
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
/* XXX - mloskot - make it thread-safe by calling (*_errno()) */
|
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* #ifndef WCEEX_ERRNO_H */
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_fcntl.h 20 2006-11-18 17:00:30Z mloskot $
|
|
||||||
*
|
|
||||||
* fcntl.h - file control options
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Mateusz Loskot
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef WCEEX_FCNTL_H
|
|
||||||
#define WCEEX_FCNTL_H 1
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
# error "Only Windows CE target is supported!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* File control flags and functions
|
|
||||||
*
|
|
||||||
* Implementation based on the Open Group Base Specifications Issue 6,
|
|
||||||
* IEEE Std 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
* Windows CE Notes:
|
|
||||||
*
|
|
||||||
* Mostly, these flags are not used, but defined to feed compiler.
|
|
||||||
* Also, some programs (ie. libtiff) translate textual file flags (r, rw, etc.)
|
|
||||||
* file control flags.
|
|
||||||
* Functions fcntl() and open() are not implemented.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* File creation flags */
|
|
||||||
|
|
||||||
#define O_CREAT 0x0100 /* Open or create file if it does not exist. */
|
|
||||||
#define O_EXCL 0x0200 /* Exclusive file use. */
|
|
||||||
#define O_NOCTTY 0x0400 /* Do not assign controlling terminal. */
|
|
||||||
#define O_TRUNC 0x1000 /* Open and truncate file. */
|
|
||||||
|
|
||||||
/* File access and status flags */
|
|
||||||
|
|
||||||
#define O_RDONLY 0x0000 /* Open for read only. */
|
|
||||||
#define O_WRONLY 0x0001 /* Open for write only. */
|
|
||||||
#define O_RDWR 0x0002 /* Open for reading and writing. */
|
|
||||||
#define O_APPEND 0x2000 /* Set append mode. */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* #ifndef WCEEX_FCNTL_H */
|
|
@ -1,183 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_findfile.c,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines functions to find files.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <wce_io.h>
|
|
||||||
#include <wce_timesys.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_findclose - XXX
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* XXX
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* XXX
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
int wceex_findclose(intptr_t hFile)
|
|
||||||
{
|
|
||||||
if(!FindClose((HANDLE)hFile))
|
|
||||||
{
|
|
||||||
//errno = EINVAL;
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_findfirst - XXX
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* XXX
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* XXX
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
intptr_t wceex_findfirst(const char *filespec, struct _finddata_t *fileinfo)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATA wfd;
|
|
||||||
HANDLE hFile;
|
|
||||||
DWORD err;
|
|
||||||
wchar_t wfilename[MAX_PATH];
|
|
||||||
|
|
||||||
mbstowcs(wfilename, filespec, strlen(filespec) + 1);
|
|
||||||
|
|
||||||
/* XXX - mloskot - set errno values! */
|
|
||||||
|
|
||||||
hFile = FindFirstFile(wfilename, &wfd);
|
|
||||||
if(hFile == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
err = GetLastError();
|
|
||||||
switch (err)
|
|
||||||
{
|
|
||||||
case ERROR_NO_MORE_FILES:
|
|
||||||
case ERROR_FILE_NOT_FOUND:
|
|
||||||
case ERROR_PATH_NOT_FOUND:
|
|
||||||
//errno = ENOENT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ERROR_NOT_ENOUGH_MEMORY:
|
|
||||||
//errno = ENOMEM;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
//errno = EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fileinfo->attrib = (wfd.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) ? 0 : wfd.dwFileAttributes;
|
|
||||||
fileinfo->time_create = wceex_filetime_to_time(&wfd.ftCreationTime);
|
|
||||||
fileinfo->time_access = wceex_filetime_to_time(&wfd.ftLastAccessTime);
|
|
||||||
fileinfo->time_write = wceex_filetime_to_time(&wfd.ftLastWriteTime);
|
|
||||||
|
|
||||||
fileinfo->size = wfd.nFileSizeLow;
|
|
||||||
wcstombs(fileinfo->name, wfd.cFileName, wcslen(wfd.cFileName) + 1);
|
|
||||||
|
|
||||||
return (intptr_t)hFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_findnext - XXX
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* XXX
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* XXX
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
int wceex_findnext(intptr_t handle, struct _finddata_t *fileinfo)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATA wfd;
|
|
||||||
DWORD err;
|
|
||||||
|
|
||||||
/* XXX - mloskot - set errno values! */
|
|
||||||
|
|
||||||
if (!FindNextFile((HANDLE)handle, &wfd))
|
|
||||||
{
|
|
||||||
err = GetLastError();
|
|
||||||
switch (err) {
|
|
||||||
case ERROR_NO_MORE_FILES:
|
|
||||||
case ERROR_FILE_NOT_FOUND:
|
|
||||||
case ERROR_PATH_NOT_FOUND:
|
|
||||||
//errno = ENOENT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ERROR_NOT_ENOUGH_MEMORY:
|
|
||||||
//errno = ENOMEM;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
//errno = EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fileinfo->attrib = (wfd.dwFileAttributes == FILE_ATTRIBUTE_NORMAL)? 0 : wfd.dwFileAttributes;
|
|
||||||
fileinfo->time_create = wceex_filetime_to_time(&wfd.ftCreationTime);
|
|
||||||
fileinfo->time_access = wceex_filetime_to_time(&wfd.ftLastAccessTime);
|
|
||||||
fileinfo->time_write = wceex_filetime_to_time(&wfd.ftLastWriteTime);
|
|
||||||
|
|
||||||
fileinfo->size = wfd.nFileSizeLow;
|
|
||||||
wcstombs(fileinfo->name, wfd.cFileName, wcslen(wfd.cFileName)+1);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_getenv.c 20 2006-11-18 17:00:30Z mloskot $
|
|
||||||
*
|
|
||||||
* Defines getenv() function with dummy implementation.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mloskot@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Mateusz Loskot (mloskot@loskot.net)
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_getenv - dummy getenv() function
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* There is no concept of environment variable in Windows CE operating system.
|
|
||||||
* This function acts as a dummy compilation enabler and ALWAYS returns NULL.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* The wceex_getenv() function ALWAYS returns NULL.*
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
char* wceex_getenv(const char* varname)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Copyright (c) 1987, 1993, 1994
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
|
||||||
__RCSID("$NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declared in <unistd.h>
|
|
||||||
*/
|
|
||||||
char *optarg; /* argument associated with option */
|
|
||||||
int opterr = 1; /* if error message should be printed */
|
|
||||||
int optind = 1; /* index into parent argv vector */
|
|
||||||
int optopt; /* character checked for validity */
|
|
||||||
|
|
||||||
int optreset; /* reset getopt */
|
|
||||||
|
|
||||||
#define BADCH (int)'?'
|
|
||||||
#define BADARG (int)':'
|
|
||||||
#define EMSG ""
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_getopt - function is a command-line parser
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The parameters argc and argv are the argument count and argument array as
|
|
||||||
* passed to main(). The argument optstring is a string of recognised option
|
|
||||||
* characters. If a character is followed by a colon, the option takes an argument.
|
|
||||||
*
|
|
||||||
* The variable optind is the index of the next element of the argv[] vector to be
|
|
||||||
* processed. It is initialised to 1 by the system, and getopt() updates it when it
|
|
||||||
* finishes with each element of argv[].
|
|
||||||
*
|
|
||||||
* NOTE: Implementation of the getopt() function was grabbed from NetBSD
|
|
||||||
* operating system sources. See copyright note in the file header.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Returns the next option character specified on the command line.
|
|
||||||
* A colon (:) is returned if getopt() detects a missing argument and
|
|
||||||
* the first character of optstring was a colon (:).
|
|
||||||
* A question mark (?) is returned if getopt() encounters an option
|
|
||||||
* character not in optstring or detects a missing argument and the first
|
|
||||||
* character of optstring was not a colon (:).
|
|
||||||
* Otherwise getopt() returns -1 when all command line options are parsed.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_getopt(int argc, char * const argv[], const char *optstring)
|
|
||||||
{
|
|
||||||
static char *place = EMSG; /* option letter processing */
|
|
||||||
char *oli; /* option letter list index */
|
|
||||||
|
|
||||||
if (optreset || *place == 0) { /* update scanning pointer */
|
|
||||||
optreset = 0;
|
|
||||||
place = argv[optind];
|
|
||||||
if (optind >= argc || *place++ != '-') {
|
|
||||||
/* Argument is absent or is not an option */
|
|
||||||
place = EMSG;
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
optopt = *place++;
|
|
||||||
if (optopt == '-' && *place == 0) {
|
|
||||||
/* "--" => end of options */
|
|
||||||
++optind;
|
|
||||||
place = EMSG;
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
if (optopt == 0) {
|
|
||||||
/* Solitary '-', treat as a '-' option
|
|
||||||
if the program (eg su) is looking for it. */
|
|
||||||
place = EMSG;
|
|
||||||
if (strchr(optstring, '-') == NULL)
|
|
||||||
return -1;
|
|
||||||
optopt = '-';
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
optopt = *place++;
|
|
||||||
|
|
||||||
/* See if option letter is one the caller wanted... */
|
|
||||||
if (optopt == ':' || (oli = strchr(optstring, optopt)) == NULL) {
|
|
||||||
if (*place == 0)
|
|
||||||
++optind;
|
|
||||||
if (opterr && *optstring != ':')
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"unknown option -- %c\n", optopt);
|
|
||||||
return (BADCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Does this option need an argument? */
|
|
||||||
if (oli[1] != ':') {
|
|
||||||
/* don't need argument */
|
|
||||||
optarg = NULL;
|
|
||||||
if (*place == 0)
|
|
||||||
++optind;
|
|
||||||
} else {
|
|
||||||
/* Option-argument is either the rest of this argument or the
|
|
||||||
entire next argument. */
|
|
||||||
if (*place)
|
|
||||||
optarg = place;
|
|
||||||
else if (argc > ++optind)
|
|
||||||
optarg = argv[optind];
|
|
||||||
else {
|
|
||||||
/* option-argument absent */
|
|
||||||
place = EMSG;
|
|
||||||
if (*optstring == ':')
|
|
||||||
return (BADARG);
|
|
||||||
if (opterr)
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"option requires an argument -- %c\n",
|
|
||||||
optopt);
|
|
||||||
return (BADCH);
|
|
||||||
}
|
|
||||||
place = EMSG;
|
|
||||||
++optind;
|
|
||||||
}
|
|
||||||
return (optopt); /* return option letter */
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Defines gettimeofday function.
|
|
||||||
*
|
|
||||||
* Author of first version (timeval.h): by Wu Yongwei
|
|
||||||
* Author of Windows CE version: Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* All code here is considered in the public domain though we do wish our names
|
|
||||||
* could be retained if anyone uses them.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <wce_time.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_gettimeofday - get the date and time
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The gettimeofday() function shall obtain the current time,
|
|
||||||
* expressed as seconds and microseconds since the Epoch,
|
|
||||||
* and store it in the timeval structure pointed to by tp.
|
|
||||||
* The resolution of the system clock is unspecified.
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
*
|
|
||||||
* The gettimeofday() function shall return 0 and
|
|
||||||
* no value shall be reserved to indicate an error.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
* IEEE Standard and an Open Group Technical Standard 1003.1, 2004 Edition
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_gettimeofday(struct timeval *tp, struct timezone *tzp)
|
|
||||||
{
|
|
||||||
SYSTEMTIME st;
|
|
||||||
FILETIME ft;
|
|
||||||
LARGE_INTEGER li;
|
|
||||||
TIME_ZONE_INFORMATION tzi;
|
|
||||||
__int64 t;
|
|
||||||
static int tzflag;
|
|
||||||
|
|
||||||
if (NULL != tp)
|
|
||||||
{
|
|
||||||
GetSystemTime(&st);
|
|
||||||
SystemTimeToFileTime(&st, &ft);
|
|
||||||
li.LowPart = ft.dwLowDateTime;
|
|
||||||
li.HighPart = ft.dwHighDateTime;
|
|
||||||
t = li.QuadPart; /* In 100-nanosecond intervals */
|
|
||||||
t -= EPOCHFILETIME; /* Offset to the Epoch time */
|
|
||||||
t /= 10; /* In microseconds */
|
|
||||||
tp->tv_sec = (long)(t / 1000000);
|
|
||||||
tp->tv_usec = (long)(t % 1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != tzp)
|
|
||||||
{
|
|
||||||
GetTimeZoneInformation(&tzi);
|
|
||||||
|
|
||||||
tzp->tz_minuteswest = tzi.Bias;
|
|
||||||
if (tzi.StandardDate.wMonth != 0)
|
|
||||||
{
|
|
||||||
tzp->tz_minuteswest += tzi.StandardBias * 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tzi.DaylightDate.wMonth != 0)
|
|
||||||
{
|
|
||||||
tzp->tz_dsttime = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tzp->tz_dsttime = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_io.h,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* io.h - file handling functions
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef WCEEX_IO_H
|
|
||||||
#define WCEEX_IO_H 1
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
# error "Only Winddows CE target is supported!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <wce_time.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
I/O Types and Structures
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef _INTPTR_T_DEFINED
|
|
||||||
typedef long intptr_t;
|
|
||||||
# define _INTPTR_T_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _FSIZE_T_DEFINED
|
|
||||||
typedef unsigned long fsize_t;
|
|
||||||
# define _FSIZE_T_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_PATH 260
|
|
||||||
|
|
||||||
#ifndef _FINDDATA_T_DEFINED
|
|
||||||
struct _finddata_t
|
|
||||||
{
|
|
||||||
unsigned attrib; /* File attributes */
|
|
||||||
time_t time_create; /* -1L for FAT file systems */
|
|
||||||
time_t time_access; /* -1L for FAT file systems */
|
|
||||||
time_t time_write; /* Time of last modification */
|
|
||||||
fsize_t size; /* Size of file in bytes */
|
|
||||||
char name[MAX_PATH]; /* Name of file witout complete path */
|
|
||||||
};
|
|
||||||
# define _FINDDATA_T_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* File attribute constants for _findfirst() */
|
|
||||||
|
|
||||||
/* XXX - mloskot - macra IS_xxx */
|
|
||||||
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
|
|
||||||
#define _A_RDONLY 0x01 /* Read only file */
|
|
||||||
#define _A_HIDDEN 0x02 /* Hidden file */
|
|
||||||
#define _A_SYSTEM 0x04 /* System file */
|
|
||||||
#define _A_SUBDIR 0x10 /* Subdirectory */
|
|
||||||
#define _A_ARCH 0x20 /* Archive file */
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
I/O Functions
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
intptr_t wceex_findfirst(const char *filespec, struct _finddata_t *fileinfo);
|
|
||||||
int wceex_findnext(intptr_t handle, struct _finddata_t *fileinfo);
|
|
||||||
int wceex_findclose(intptr_t hFile);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
File-access permission functions
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_waccess( const wchar_t *path, int mode );
|
|
||||||
int wceex_access( const char *path, int mode );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* #ifndef WCEEX_IO_H */
|
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_lfind.c 20 2006-11-18 17:00:30Z mloskot $
|
|
||||||
*
|
|
||||||
* Defines lfind() function.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mloskot@loskot.net)
|
|
||||||
*
|
|
||||||
* Implementation of this function was taken from LibTIFF
|
|
||||||
* project, http://www.remotesensing.org/libtiff/
|
|
||||||
* The copyright note below has been copied without any changes.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1989, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* Roger L. Snyder.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <wce_types.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_lfind - TODO
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
void* wceex_lfind(const void *key, const void *base, size_t *nmemb, size_t size,
|
|
||||||
int(*compar)(const void *, const void *))
|
|
||||||
{
|
|
||||||
char *element, *end;
|
|
||||||
|
|
||||||
assert(key != NULL);
|
|
||||||
assert(base != NULL);
|
|
||||||
assert(compar != NULL);
|
|
||||||
|
|
||||||
element = NULL;
|
|
||||||
end = (char *)base + (*nmemb * size);
|
|
||||||
|
|
||||||
for (element = (char *)base; element < end; element += size)
|
|
||||||
{
|
|
||||||
if (!compar(element, key))
|
|
||||||
{
|
|
||||||
/* key found */
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
@ -1,228 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_localtime.c,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines localtime() function.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <wce_time.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
Constants and macros used internally
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#define SECS_PER_MIN 60
|
|
||||||
#define MINS_PER_HOUR 60
|
|
||||||
#define HOURS_PER_DAY 24
|
|
||||||
#define DAYS_PER_WEEK 7
|
|
||||||
#define DAYS_PER_NYEAR 365
|
|
||||||
#define DAYS_PER_LYEAR 366
|
|
||||||
#define SECS_PER_HOUR (SECS_PER_MIN * MINS_PER_HOUR)
|
|
||||||
#define SECS_PER_DAY ((long) SECS_PER_HOUR * HOURS_PER_DAY)
|
|
||||||
#define MONS_PER_YEAR 12
|
|
||||||
|
|
||||||
#define TM_SUNDAY 0
|
|
||||||
#define TM_MONDAY 1
|
|
||||||
#define TM_TUESDAY 2
|
|
||||||
#define TM_WEDNESDAY 3
|
|
||||||
#define TM_THURSDAY 4
|
|
||||||
#define TM_FRIDAY 5
|
|
||||||
#define TM_SATURDAY 6
|
|
||||||
|
|
||||||
#define TM_JANUARY 0
|
|
||||||
#define TM_FEBRUARY 1
|
|
||||||
#define TM_MARCH 2
|
|
||||||
#define TM_APRIL 3
|
|
||||||
#define TM_MAY 4
|
|
||||||
#define TM_JUNE 5
|
|
||||||
#define TM_JULY 6
|
|
||||||
#define TM_AUGUST 7
|
|
||||||
#define TM_SEPTEMBER 8
|
|
||||||
#define TM_OCTOBER 9
|
|
||||||
#define TM_NOVEBER 10
|
|
||||||
#define TM_DECEMBER 11
|
|
||||||
#define TM_SUNDAY 0
|
|
||||||
|
|
||||||
#define TM_YEAR_BASE 1900
|
|
||||||
|
|
||||||
#define EPOCH_YEAR 1970
|
|
||||||
#define EPOCH_WDAY TM_THURSDAY
|
|
||||||
|
|
||||||
#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
Local time functions
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
struct tm * __wceex_offtime(const time_t *timer, long tzoffset);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_localtime - Convert time_t value to tm struct.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Use offset as difference in seconds between local time and UTC time.
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
struct tm * wceex_localtime(const time_t *timer)
|
|
||||||
{
|
|
||||||
register struct tm *tmp;
|
|
||||||
|
|
||||||
long tzoffset;
|
|
||||||
TIME_ZONE_INFORMATION tzi;
|
|
||||||
|
|
||||||
// Retrive timezone offset in seconds
|
|
||||||
tzoffset = 0;
|
|
||||||
if (GetTimeZoneInformation(&tzi) != 0xFFFFFFFF)
|
|
||||||
{
|
|
||||||
tzoffset += (tzi.Bias * 60);
|
|
||||||
if (tzi.StandardDate.wMonth != 0)
|
|
||||||
{
|
|
||||||
tzoffset += (tzi.StandardBias * 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tzoffset *= -1;
|
|
||||||
tmp = __wceex_offtime(timer, tzoffset);
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_gmtime - Convert time_t value to tm struct.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function is similar to localtime, except that the broken-down
|
|
||||||
* time is expressed as Coordinated Universal Time (UTC)
|
|
||||||
* rather than relative to a local time zone.
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
struct tm * wceex_gmtime(const time_t *timer)
|
|
||||||
{
|
|
||||||
register struct tm *tmp;
|
|
||||||
|
|
||||||
tmp = __wceex_offtime(timer, 0L);
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* __wceex_offtime - Convert time_t value to tm struct.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Use offset as difference in seconds between local time and UTC time.
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
static int mon_lengths[2][MONS_PER_YEAR] =
|
|
||||||
{
|
|
||||||
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
|
|
||||||
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
|
||||||
};
|
|
||||||
|
|
||||||
static int year_lengths[2] = { DAYS_PER_NYEAR, DAYS_PER_LYEAR };
|
|
||||||
|
|
||||||
|
|
||||||
struct tm * __wceex_offtime(const time_t *timer, long tzoffset)
|
|
||||||
{
|
|
||||||
register struct tm *tmp;
|
|
||||||
register long days;
|
|
||||||
register long rem;
|
|
||||||
register int y;
|
|
||||||
register int yleap;
|
|
||||||
register int *ip;
|
|
||||||
static struct tm tm;
|
|
||||||
|
|
||||||
tmp = &tm;
|
|
||||||
days = *timer / SECS_PER_DAY;
|
|
||||||
rem = *timer % SECS_PER_DAY;
|
|
||||||
rem += tzoffset;
|
|
||||||
while (rem < 0)
|
|
||||||
{
|
|
||||||
rem += SECS_PER_DAY;
|
|
||||||
--days;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (rem >= SECS_PER_DAY)
|
|
||||||
{
|
|
||||||
rem -= SECS_PER_DAY;
|
|
||||||
++days;
|
|
||||||
}
|
|
||||||
tmp->tm_hour = (int) (rem / SECS_PER_HOUR);
|
|
||||||
|
|
||||||
rem = rem % SECS_PER_HOUR;
|
|
||||||
tmp->tm_min = (int) (rem / SECS_PER_MIN);
|
|
||||||
tmp->tm_sec = (int) (rem % SECS_PER_MIN);
|
|
||||||
tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYS_PER_WEEK);
|
|
||||||
|
|
||||||
if (tmp->tm_wday < 0)
|
|
||||||
tmp->tm_wday += DAYS_PER_WEEK;
|
|
||||||
|
|
||||||
y = EPOCH_YEAR;
|
|
||||||
|
|
||||||
if (days >= 0)
|
|
||||||
{
|
|
||||||
for ( ; ; )
|
|
||||||
{
|
|
||||||
yleap = isleap(y);
|
|
||||||
if (days < (long) year_lengths[yleap])
|
|
||||||
break;
|
|
||||||
|
|
||||||
++y;
|
|
||||||
days = days - (long) year_lengths[yleap];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
--y;
|
|
||||||
yleap = isleap(y);
|
|
||||||
days = days + (long) year_lengths[yleap];
|
|
||||||
} while (days < 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp->tm_year = y - TM_YEAR_BASE;
|
|
||||||
tmp->tm_yday = (int) days;
|
|
||||||
ip = mon_lengths[yleap];
|
|
||||||
|
|
||||||
for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
|
|
||||||
{
|
|
||||||
days = days - (long) ip[tmp->tm_mon];
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp->tm_mday = (int) (days + 1);
|
|
||||||
tmp->tm_isdst = 0;
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_mkdir.c,v 1.3 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines wmkdir, mkdir() functions.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <wce_errno.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_mkdir - Make a directory.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The mkdir() function shall create a new directory with name path.
|
|
||||||
* Internally, mkdir() function wraps CreateDirectory call from
|
|
||||||
* Windows CE API.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Upon successful completion, mkdir() shall return 0.
|
|
||||||
* Otherwise, -1 shall be returned, no directory shall be created,
|
|
||||||
* and errno shall be set with the error returned by CreateDirectory.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*******************************************************************************/
|
|
||||||
int wceex_mkdir(const char *filename)
|
|
||||||
{
|
|
||||||
int res;
|
|
||||||
size_t len;
|
|
||||||
wchar_t *widestr;
|
|
||||||
|
|
||||||
/* Covert filename buffer to Unicode. */
|
|
||||||
len = MultiByteToWideChar (CP_ACP, 0, filename, -1, NULL, 0) ;
|
|
||||||
widestr = (wchar_t*)malloc(sizeof(wchar_t) * len);
|
|
||||||
|
|
||||||
MultiByteToWideChar( CP_ACP, 0, filename, -1, widestr, len);
|
|
||||||
|
|
||||||
/* Delete file using Win32 CE API call */
|
|
||||||
res = CreateDirectory(widestr, NULL);
|
|
||||||
|
|
||||||
/* Free wide-char string */
|
|
||||||
free(widestr);
|
|
||||||
|
|
||||||
if (res)
|
|
||||||
return 0; /* success */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errno = GetLastError();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_mkdir - Make a directory.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* The wmkdir() function shall create a new directory with name path.
|
|
||||||
* Internally, wmkdir() function wraps CreateDirectory call from
|
|
||||||
* Windows CE API.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Upon successful completion, wmkdir() shall return 0.
|
|
||||||
* Otherwise, -1 shall be returned, no directory shall be created,
|
|
||||||
* and errno shall be set with the error returned by CreateDirectory.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
* IEEE 1003.1, 2004 Edition
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
int wceex_wmkdir( const wchar_t* dirname )
|
|
||||||
{
|
|
||||||
if( !CreateDirectory( dirname, NULL ) )
|
|
||||||
{
|
|
||||||
errno = GetLastError();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,155 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_mktime.c,v 1.2 2006/04/09 16:48:18 mloskot Exp $
|
|
||||||
*
|
|
||||||
* Defines functions to convert struct tm to time_t value.
|
|
||||||
*
|
|
||||||
* Created by Mateusz Loskot (mateusz@loskot.net)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Taxus SI Ltd.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contact:
|
|
||||||
* Taxus SI Ltd.
|
|
||||||
* http://www.taxussi.com.pl
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <wce_time.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
/* Function used intenally to convert struct tm to a time_t value. */
|
|
||||||
static time_t __wceex_mktime_internal(struct tm *tmbuff, time_t _loctime_offset);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_mktime - Convert local time to calendar value in seconds since epoch.
|
|
||||||
*******************************************************************************/
|
|
||||||
time_t wceex_mktime(struct tm *tmbuff)
|
|
||||||
{
|
|
||||||
time_t offset;
|
|
||||||
TIME_ZONE_INFORMATION tzi;
|
|
||||||
|
|
||||||
offset = 0;
|
|
||||||
|
|
||||||
// Retrive timezone offset in seconds
|
|
||||||
if (GetTimeZoneInformation(&tzi) != 0xFFFFFFFF)
|
|
||||||
{
|
|
||||||
offset += (tzi.Bias * 60);
|
|
||||||
if (tzi.StandardDate.wMonth != 0)
|
|
||||||
{
|
|
||||||
offset += (tzi.StandardBias * 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return __wceex_mktime_internal(tmbuff, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_gmmktime - Get Unix timestamp for a GMT date
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Given a struct tm representing a calendar time in UTC, convert it to
|
|
||||||
* seconds since epoch.
|
|
||||||
* Note that this function does not canonicalize the provided
|
|
||||||
* struct tm, nor does it allow out of range values or years before 1970.
|
|
||||||
* The tm struct values of tm_wday and tm_yday are ignored.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
* Value of time if success, otherwise (time_t)-1 is returned.
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
time_t wceex_gmmktime(struct tm *tmbuff)
|
|
||||||
{
|
|
||||||
return __wceex_mktime_internal(tmbuff, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* __wceex_mktime_internal - Convert struct tm to a time_t value.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Use offset as difference in seconds between local time and UTC time.
|
|
||||||
*
|
|
||||||
/*******************************************************************************/
|
|
||||||
|
|
||||||
/* The number of days in each month. */
|
|
||||||
#define MONTHS_NUMBER 12
|
|
||||||
|
|
||||||
static const int MONTHDAYS[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|
||||||
|
|
||||||
static time_t __wceex_mktime_internal(struct tm *tmbuff, time_t _loctime_offset)
|
|
||||||
{
|
|
||||||
time_t tres;
|
|
||||||
int doy;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* We do allow some ill-formed dates, but we don't do anything special
|
|
||||||
with them and our callers really shouldn't pass them to us. Do
|
|
||||||
explicitly disallow the ones that would cause invalid array accesses
|
|
||||||
or other algorithm problems. */
|
|
||||||
if (tmbuff->tm_mon < 0 || tmbuff->tm_mon > 11 || tmbuff->tm_year < (EPOCH_YEAR - TM_YEAR_BASE))
|
|
||||||
{
|
|
||||||
return (time_t) -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert calender time to a time_t value. */
|
|
||||||
tres = 0;
|
|
||||||
|
|
||||||
/* Sum total amount of days from the Epoch with respect to leap years. */
|
|
||||||
for (i = EPOCH_YEAR; i < tmbuff->tm_year + TM_YEAR_BASE; i++)
|
|
||||||
{
|
|
||||||
tres += 365 + IS_LEAP_YEAR(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add days of months before current month. */
|
|
||||||
doy = 0;
|
|
||||||
for (i = 0; i < tmbuff->tm_mon; i++)
|
|
||||||
{
|
|
||||||
doy += MONTHDAYS[i];
|
|
||||||
}
|
|
||||||
tres += doy;
|
|
||||||
|
|
||||||
/* Day of year */
|
|
||||||
tmbuff->tm_yday = doy + tmbuff->tm_mday;
|
|
||||||
|
|
||||||
if (tmbuff->tm_mon > 1 && IS_LEAP_YEAR(tmbuff->tm_year + TM_YEAR_BASE))
|
|
||||||
{
|
|
||||||
tres++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add days of current month and convert to total to hours. */
|
|
||||||
tres = 24 * (tres + tmbuff->tm_mday - 1) + tmbuff->tm_hour;
|
|
||||||
|
|
||||||
/* Add minutes part and convert total to minutes. */
|
|
||||||
tres = 60 * tres + tmbuff->tm_min;
|
|
||||||
|
|
||||||
/* Add seconds part and convert total to seconds. */
|
|
||||||
tres = 60 * tres + tmbuff->tm_sec;
|
|
||||||
|
|
||||||
/* For offset > 0 adjust time value for timezone
|
|
||||||
given as local to UTC time difference in seconds). */
|
|
||||||
tres += _loctime_offset;
|
|
||||||
|
|
||||||
return tres;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,479 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: wce_path.c,v 1.0 2006/11/29 16:56:01 sdunand Exp $
|
|
||||||
*
|
|
||||||
* Defines _splitpath, _wsplitpath, _makepath, _wmakepath,
|
|
||||||
* wceex_GetFullPathNameW, _fullpath, _wfullpath functions
|
|
||||||
*
|
|
||||||
* Created by Stéphane Dunand (sdunand@sirap.fr)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Stéphane Dunand
|
|
||||||
*
|
|
||||||
* 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 <string.h>
|
|
||||||
#include <wce_stdlib.h>
|
|
||||||
#include <wce_direct.h>
|
|
||||||
#include <wce_errno.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_splitpath
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Break a path name into components.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
void wceex_splitpath( const char *path,
|
|
||||||
char *drive, char *dir, char *name, char *ext )
|
|
||||||
{
|
|
||||||
char *slash, *bslash;
|
|
||||||
if( drive )
|
|
||||||
*drive = 0;
|
|
||||||
if( dir )
|
|
||||||
*dir = 0;
|
|
||||||
if( name )
|
|
||||||
*name = 0;
|
|
||||||
if( ext )
|
|
||||||
*ext = 0;
|
|
||||||
if( !path || *path == 0 )
|
|
||||||
return;
|
|
||||||
slash = strrchr( path, '/' );
|
|
||||||
bslash = strrchr( path, '\\' );
|
|
||||||
if( slash > bslash )
|
|
||||||
bslash = slash;
|
|
||||||
if( bslash )
|
|
||||||
{
|
|
||||||
if( dir )
|
|
||||||
{
|
|
||||||
size_t count = (bslash - path);
|
|
||||||
if( count >= _MAX_DIR )
|
|
||||||
count = _MAX_DIR - 1;
|
|
||||||
strncat( dir, path, count );
|
|
||||||
}
|
|
||||||
bslash++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bslash = (char*)path;
|
|
||||||
if( name )
|
|
||||||
{
|
|
||||||
char* dot;
|
|
||||||
strncat( name, bslash, _MAX_FNAME - 1 );
|
|
||||||
dot = strrchr( name, '.' );
|
|
||||||
if( dot )
|
|
||||||
*dot = 0;
|
|
||||||
}
|
|
||||||
if( ext )
|
|
||||||
{
|
|
||||||
char* dot = strrchr( bslash, '.' );
|
|
||||||
if( dot )
|
|
||||||
strncat( ext, dot, _MAX_EXT - 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_wsplitpath
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Break a path name into components.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
void wceex_wsplitpath( const wchar_t *path,
|
|
||||||
wchar_t *drive, wchar_t *dir, wchar_t *name, wchar_t *ext )
|
|
||||||
{
|
|
||||||
wchar_t *slash, *bslash;
|
|
||||||
if( drive )
|
|
||||||
*drive = 0;
|
|
||||||
if( dir )
|
|
||||||
*dir = 0;
|
|
||||||
if( name )
|
|
||||||
*name = 0;
|
|
||||||
if( ext )
|
|
||||||
*ext = 0;
|
|
||||||
if( !path || *path == 0 )
|
|
||||||
return;
|
|
||||||
slash = wcsrchr( path, '/' );
|
|
||||||
bslash = wcsrchr( path, '\\' );
|
|
||||||
if( slash > bslash )
|
|
||||||
bslash = slash;
|
|
||||||
if( bslash )
|
|
||||||
{
|
|
||||||
if( dir )
|
|
||||||
{
|
|
||||||
size_t count = (bslash - path) / sizeof(wchar_t);
|
|
||||||
if( count >= _MAX_DIR )
|
|
||||||
count = _MAX_DIR - 1;
|
|
||||||
wcsncat( dir, path, count );
|
|
||||||
}
|
|
||||||
bslash++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bslash = (wchar_t*)path;
|
|
||||||
if( name )
|
|
||||||
{
|
|
||||||
wchar_t* dot;
|
|
||||||
wcsncat( name, bslash, _MAX_FNAME - 1 );
|
|
||||||
dot = wcsrchr( name, '.' );
|
|
||||||
if( dot )
|
|
||||||
*dot = 0;
|
|
||||||
}
|
|
||||||
if( ext )
|
|
||||||
{
|
|
||||||
wchar_t* dot = wcsrchr( bslash, '.' );
|
|
||||||
if( dot )
|
|
||||||
wcsncat( ext, dot, _MAX_EXT - 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_makepath
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Create a path name from components
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
void wceex_makepath( char *path,
|
|
||||||
const char *drive, const char *dir,
|
|
||||||
const char *name, const char *ext )
|
|
||||||
{
|
|
||||||
char* ptr = path;
|
|
||||||
size_t slen, sbuf = _MAX_PATH - 1;
|
|
||||||
*path = 0;
|
|
||||||
if( drive && *drive )
|
|
||||||
{
|
|
||||||
strncat( ptr, drive, sbuf );
|
|
||||||
slen = strlen( ptr );
|
|
||||||
ptr += slen;
|
|
||||||
sbuf -= slen;
|
|
||||||
}
|
|
||||||
if( dir && *dir && sbuf )
|
|
||||||
{
|
|
||||||
strncat( ptr, dir, sbuf );
|
|
||||||
slen = strlen( ptr );
|
|
||||||
ptr += slen - 1;
|
|
||||||
sbuf -= slen;
|
|
||||||
// backslash ?
|
|
||||||
if( sbuf && *ptr != '\\' && *ptr != '/' )
|
|
||||||
{
|
|
||||||
char* slash = strchr( path, '/' );
|
|
||||||
if( !slash )
|
|
||||||
slash = strchr( path, '\\' );
|
|
||||||
ptr++;
|
|
||||||
if( slash )
|
|
||||||
*ptr = *slash;
|
|
||||||
else
|
|
||||||
*ptr = '\\';
|
|
||||||
ptr++;
|
|
||||||
*ptr = 0;
|
|
||||||
sbuf--;
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
if( name && *name && sbuf )
|
|
||||||
{
|
|
||||||
strncat( ptr, name, sbuf );
|
|
||||||
slen = strlen( ptr );
|
|
||||||
ptr += slen;
|
|
||||||
sbuf -= slen;
|
|
||||||
}
|
|
||||||
if( ext && *ext && sbuf )
|
|
||||||
{
|
|
||||||
if( *ext != '.' )
|
|
||||||
{
|
|
||||||
*ptr = '.';
|
|
||||||
ptr++;
|
|
||||||
*ptr = 0;
|
|
||||||
sbuf--;
|
|
||||||
}
|
|
||||||
if( sbuf )
|
|
||||||
strncat( ptr, ext, sbuf );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_wmakepath
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Create a path name from components
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
void wceex_wmakepath( wchar_t *path,
|
|
||||||
const wchar_t *drive, const wchar_t *dir,
|
|
||||||
const wchar_t *name, const wchar_t *ext )
|
|
||||||
{
|
|
||||||
wchar_t* ptr = path;
|
|
||||||
size_t slen, sbuf = _MAX_PATH - 1;
|
|
||||||
*path = 0;
|
|
||||||
if( drive && *drive )
|
|
||||||
{
|
|
||||||
wcsncat( ptr, drive, sbuf );
|
|
||||||
slen = wcslen( ptr );
|
|
||||||
ptr += slen;
|
|
||||||
sbuf -= slen;
|
|
||||||
}
|
|
||||||
if( dir && *dir && sbuf )
|
|
||||||
{
|
|
||||||
wcsncat( ptr, dir, sbuf );
|
|
||||||
slen = wcslen( ptr );
|
|
||||||
ptr += slen - 1;
|
|
||||||
sbuf -= slen;
|
|
||||||
// backslash ?
|
|
||||||
if( sbuf && *ptr != '\\' && *ptr != '/' )
|
|
||||||
{
|
|
||||||
wchar_t* slash = wcschr( path, '/' );
|
|
||||||
if( !slash )
|
|
||||||
slash = wcschr( path, '\\' );
|
|
||||||
ptr++;
|
|
||||||
if( slash )
|
|
||||||
*ptr = *slash;
|
|
||||||
else
|
|
||||||
*ptr = '\\';
|
|
||||||
ptr++;
|
|
||||||
*ptr = 0;
|
|
||||||
sbuf--;
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
if( name && *name && sbuf )
|
|
||||||
{
|
|
||||||
wcsncat( ptr, name, sbuf );
|
|
||||||
slen = wcslen( ptr );
|
|
||||||
ptr += slen;
|
|
||||||
sbuf -= slen;
|
|
||||||
}
|
|
||||||
if( ext && *ext && sbuf )
|
|
||||||
{
|
|
||||||
if( *ext != '.' )
|
|
||||||
{
|
|
||||||
*ptr = '.';
|
|
||||||
ptr++;
|
|
||||||
*ptr = 0;
|
|
||||||
sbuf--;
|
|
||||||
}
|
|
||||||
if( sbuf )
|
|
||||||
wcsncat( ptr, ext, sbuf );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_GetFullPathNameW
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* retrieves the full path and file name of a specified file.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
DWORD wceex_GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength,
|
|
||||||
LPWSTR lpBuffer, LPWSTR *lpFilePart )
|
|
||||||
{
|
|
||||||
int up = 0, down = 0;
|
|
||||||
size_t len_tot, len_buf = 0;
|
|
||||||
LPWSTR file;
|
|
||||||
|
|
||||||
// reference to current working directory ?
|
|
||||||
if( wcsncmp( lpFileName, L".\\", 2 ) == 0 )
|
|
||||||
down = 1;
|
|
||||||
else if( wcsncmp( lpFileName, L"./", 2 ) == 0 )
|
|
||||||
down = 2;
|
|
||||||
if( wcsncmp( lpFileName, L"..\\", 3 ) == 0 )
|
|
||||||
up = 1;
|
|
||||||
else if( wcsncmp( lpFileName, L"../", 3 ) == 0 )
|
|
||||||
up = 2;
|
|
||||||
if( down || up )
|
|
||||||
{
|
|
||||||
LPWSTR last;
|
|
||||||
len_buf = wceex_GetCurrentDirectoryW( nBufferLength, lpBuffer );
|
|
||||||
if( !len_buf )
|
|
||||||
return 0;
|
|
||||||
// backslash at the end ?
|
|
||||||
last = lpBuffer + len_buf - 1;
|
|
||||||
if( *last != '\\' && *last != '/' )
|
|
||||||
{
|
|
||||||
// test sufficient buffer before add
|
|
||||||
len_buf++;
|
|
||||||
if( len_buf >= nBufferLength )
|
|
||||||
return len_buf + wcslen( lpFileName ) + 1;
|
|
||||||
last++;
|
|
||||||
if( down == 1 || up == 1 )
|
|
||||||
*last = '\\';
|
|
||||||
else
|
|
||||||
*last = '/';
|
|
||||||
*(last + 1) = 0;
|
|
||||||
}
|
|
||||||
if( down )
|
|
||||||
{
|
|
||||||
lpBuffer = last + 1;
|
|
||||||
lpFileName += 2;
|
|
||||||
}
|
|
||||||
else if( up )
|
|
||||||
{
|
|
||||||
LPWSTR fname = (LPWSTR)lpFileName;
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
// root ?
|
|
||||||
if( last == lpBuffer )
|
|
||||||
{
|
|
||||||
errno = ERROR_BAD_PATHNAME;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// erase last backslash
|
|
||||||
*last = 0;
|
|
||||||
// parent directory
|
|
||||||
if( up == 1 )
|
|
||||||
last = wcsrchr( lpBuffer, '\\' );
|
|
||||||
else
|
|
||||||
last = wcsrchr( lpBuffer, '/' );
|
|
||||||
if( !last )
|
|
||||||
{
|
|
||||||
errno = ERROR_BAD_PATHNAME;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*(last + 1) = 0;
|
|
||||||
// next parent directory ?
|
|
||||||
fname += 3;
|
|
||||||
if( up == 1 )
|
|
||||||
{
|
|
||||||
if( wcsncmp( fname, L"..\\", 3 ) )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( wcsncmp( fname, L"../", 3 ) )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
len_buf = wcslen( lpBuffer );
|
|
||||||
lpBuffer = last + 1;
|
|
||||||
lpFileName = fname;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
len_tot = len_buf + wcslen( lpFileName );
|
|
||||||
if( len_tot >= nBufferLength )
|
|
||||||
return len_tot + 1;
|
|
||||||
wcscpy( lpBuffer, lpFileName );
|
|
||||||
// delimiter of file name ?
|
|
||||||
file = wcsrchr( lpBuffer, '\\' );
|
|
||||||
if( !file )
|
|
||||||
file = wcsrchr( lpBuffer, '/' );
|
|
||||||
if( file )
|
|
||||||
{
|
|
||||||
file++;
|
|
||||||
if( *file == 0 )
|
|
||||||
*lpFilePart = NULL;
|
|
||||||
else
|
|
||||||
*lpFilePart = file;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*lpFilePart = lpBuffer;
|
|
||||||
return len_tot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_wfullpath
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Create an absolute or full path name for the specified relative path name.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
wchar_t* wceex_wfullpath( wchar_t *absPath, const wchar_t *relPath, size_t maxLength )
|
|
||||||
{
|
|
||||||
wchar_t* lpFilePart;
|
|
||||||
DWORD ret = wceex_GetFullPathNameW( relPath, maxLength, absPath, &lpFilePart );
|
|
||||||
if( !ret || ret > maxLength )
|
|
||||||
{
|
|
||||||
*absPath = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return absPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* wceex_fullpath
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Create an absolute or full path name for the specified relative path name.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
char* wceex_fullpath( char *absPath, const char *relPath, size_t maxLength )
|
|
||||||
{
|
|
||||||
wchar_t wrelPath[_MAX_PATH*2], *wabsPath, *wret;
|
|
||||||
if( !MultiByteToWideChar( CP_ACP, 0, relPath, -1, wrelPath, _MAX_PATH*2 ) )
|
|
||||||
{
|
|
||||||
errno = ENOMEM;
|
|
||||||
*absPath = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if( (wabsPath = (wchar_t*)malloc( maxLength * sizeof(wchar_t) )) == NULL )
|
|
||||||
{
|
|
||||||
errno = ENOMEM;
|
|
||||||
*absPath = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
wret = wceex_wfullpath( wabsPath, wrelPath, maxLength );
|
|
||||||
if( wret && !WideCharToMultiByte( CP_ACP, 0, wabsPath, -1, absPath,
|
|
||||||
maxLength, NULL, NULL ) )
|
|
||||||
{
|
|
||||||
errno = GetLastError();
|
|
||||||
wret = NULL;
|
|
||||||
}
|
|
||||||
free( wabsPath );
|
|
||||||
if( !wret )
|
|
||||||
{
|
|
||||||
*absPath = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return absPath;
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user