41 #ifdef _WIN32_WCE //Q_OS_WINCE 49 #include "qplatformdefs.h" 61 wchar_t* CEPrivConvCharToWide(
const char*
string)
63 size_t length = strlen(
string);
64 wchar_t* wString =
new wchar_t[length +1];
65 for (
unsigned int i = 0; i < (length +1); i++)
66 wString[i] =
string[i];
71 time_t qt_wince_ftToTime_t(
const FILETIME ft )
74 li.LowPart = ft.dwLowDateTime;
75 li.HighPart = ft.dwHighDateTime;
78 li.QuadPart /= 10000000;
86 li.QuadPart -= 11644473600;
94 li.QuadPart += 11644473600;
95 li.QuadPart *= 10000000;
98 ft.dwLowDateTime = li.LowPart;
99 ft.dwHighDateTime = li.HighPart;
113 DWORD res = GetFileAttributes( path );
114 if ( 0xFFFFFFFF == res )
117 if ( (pmode & W_OK) && (res & FILE_ATTRIBUTE_READONLY) )
120 if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) {
130 int qt_wince_open(
const char *filename,
int oflag,
int pmode )
133 return _wopen( (
wchar_t*)fn.utf16(), oflag, pmode );
143 }
else if ( oflag &
_O_RDWR ) {
146 }
else if (oflag & _O_BINARY) {
147 if ( oflag & _O_WRONLY ) {
149 }
else if ( oflag &
_O_RDWR ) {
157 if ( oflag & _O_WRONLY ) {
159 }
else if ( oflag & _O_RDWR ) {
168 int retval = (int)_wfopen( filename, flag );
169 return (retval == NULL) ? -1 : retval;
174 return fseek( (FILE*)handle, offset, origin );
177 int qt_wince__read(
int handle,
void *buffer,
unsigned int count )
179 return fread( buffer, 1, count, (FILE*)handle );
182 int qt_wince__write(
int handle,
const void *buffer,
unsigned int count )
184 return fwrite( buffer, 1, count, (FILE*)handle );
191 return fclose( (FILE*)handle );
196 return (FILE*)handle;
201 return (FILE*)handle;
206 fseek( stream, 0L, SEEK_SET );
211 return (
int) _fileno(f);
218 sprintf( name,
"tmp%i", i++ );
219 return fopen( name,
"r+" );
229 return RemoveDirectory(reinterpret_cast<const wchar_t *> (
QString::fromLatin1(dirname).utf16())) ? 0 : -1;
249 WIN32_FIND_DATA finfo;
252 if ( ff == INVALID_HANDLE_VALUE )
255 buffer->
st_ctime = qt_wince_ftToTime_t( finfo.ftCreationTime );
256 buffer->
st_atime = qt_wince_ftToTime_t( finfo.ftLastAccessTime );
257 buffer->
st_mtime = qt_wince_ftToTime_t( finfo.ftLastWriteTime );
259 buffer->
st_size = finfo.nFileSizeLow;
261 buffer->
st_mode |= (finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ?
_O_RDONLY : _O_RDWR;
262 return (FindClose(ff) == 0);
267 BY_HANDLE_FILE_INFORMATION fInfo;
268 BOOL res = GetFileInformationByHandle((
HANDLE)handle, &fInfo);
270 buffer->
st_ctime = qt_wince_ftToTime_t( fInfo.ftCreationTime );
271 buffer->
st_atime = qt_wince_ftToTime_t( fInfo.ftLastAccessTime );
272 buffer->
st_mtime = qt_wince_ftToTime_t( fInfo.ftLastWriteTime );
274 buffer->
st_size = fInfo.nFileSizeLow;
276 buffer->
st_mode |= (fInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ?
_O_RDONLY : _O_RDWR;
283 int result = oldValue;
295 BOOL success =
FALSE;
298 success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL);
299 }
else if((mode&
_S_IREAD) && !(mode&_S_IWRITE)) {
300 success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY);
302 return success ? 0 : -1;
307 return CreateFileW( reinterpret_cast<const wchar_t *>(
QString::fromLatin1(filename).utf16()), access, share, attr, dispo, flags, tempFile);
318 unsigned initflag = 0;
320 initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION;
321 return CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, initflag, NULL);
326 unsigned (__stdcall *start_address)(
void *),
332 initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION;
333 return (
unsigned long)
334 CreateThread( (LPSECURITY_ATTRIBUTES)security,
336 (LPTHREAD_START_ROUTINE)start_address,
338 (DWORD)initflag | CREATE_SUSPENDED,
343 ExitThread((DWORD)nExitCode);
350 int (__cdecl *
compare)(
const void *,
const void *))
353 size_t high = num - 1;
354 while (low <= high) {
355 size_t mid = (low + high) >> 1;
356 int c =
compare(key, (
char*)base + mid * size);
364 return (
char*) base + mid * size;
369 void *lfind(
const void* key,
const void* base,
size_t*
elements,
size_t size,
370 int (__cdecl *compare)(
const void*,
const void*))
372 const char* current = (
char*) base;
373 const char*
const end = (
char*) (current + (*elements) * size);
374 while (current != end) {
375 if (
compare(current, key) == 0)
376 return (
void*)current;
384 return GetUserDefaultLCID();
389 void *
ptr = malloc( num * size );
391 memset( ptr, 0, num * size );
398 return qAbs((
int)GetCurrentProcessId());
408 return internalEnvironment;
411 errno_t
qt_wince_getenv_s(
size_t* sizeNeeded,
char* buffer,
size_t bufferSize,
const char* varName)
416 if (!qt_app_environment().contains(varName)) {
422 QByteArray value = qt_app_environment().value(varName);
426 if (bufferSize < (
size_t)value.
size()) {
427 *sizeNeeded = value.
size();
439 if (qt_app_environment().contains(varName))
440 qt_app_environment().
remove(varName);
445 qt_app_environment()[varName] = input;
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
long qt_wince__lseek(int handle, long offset, int origin)
void * qt_wince_bsearch(const void *key, const void *base, size_t num, size_t size, int(__cdecl *compare)(const void *, const void *))
DWORD qt_wince_GetThreadLocale(void)
void qt_wince_rewind(FILE *stream)
int qt_wince__rmdir(const char *dirname)
QByteArray & append(char c)
Appends the character ch to this byte array.
errno_t qt_wince_getenv_s(size_t *, char *, size_t, const char *)
The QByteArray class provides an array of bytes.
FILETIME qt_wince_time_tToFt(time_t tt)
HANDLE qt_wince__beginthread(void(*start_address)(void *), unsigned stack_size, void *arglist)
bool qt_wince__wchmod(const wchar_t *file, int mode)
int qt_wince___fileno(FILE *)
int qt_wince__remove(const char *name)
The QString class provides a Unicode character string.
int qt_wince__fstat(int handle, struct stat *buffer)
The QHash class is a template class that provides a hash-table-based dictionary.
Q_DECL_CONSTEXPR T qAbs(const T &t)
int qt_wince__getdrive(void)
int qt_wince_SetErrorMode(int)
void qt_wince__endthreadex(unsigned nExitCode)
FILE * qt_wince__fdopen(int handle, const char *mode)
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
Compares a to b.
int access(const char *, int)
FILE * qt_wince_tmpfile(void)
int qt_wince__waccess(const wchar_t *path, int pmode)
int qt_wince__close(int handle)
#define FALSE
Synonym for false.
const T * ptr(const T &t)
BOOL qt_wince_SetWindowOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint)
#define TRUE
Synonym for true.
const char * constData() const
Returns a pointer to the data stored in the byte array.
HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE)
FILE * qt_wince_fdopen(int handle, const char *mode)
int qt_wince__mkdir(const char *dirname)
int qt_wince__access(const char *path, int pmode)
bool qt_wince__chmod(const char *file, int mode)
int qt_wince__wopen(const wchar_t *filename, int oflag, int pmode)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
int qt_wince_open(const char *filename, int oflag, int pmode=0)
errno_t qt_wince__putenv_s(const char *, const char *)
int size() const
Returns the number of bytes in this byte array.
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
static const QTextHtmlElement elements[Html_NumElements]
int qt_wince__write(int handle, const void *buffer, unsigned int count)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
unsigned long qt_wince__beginthreadex(void *security, unsigned stack_size, unsigned(__stdcall *start_address)(void *), void *arglist, unsigned initflag, unsigned *thrdaddr)
int qt_wince_stat(const char *path, struct stat *buffer)
void * qt_wince_calloc(size_t num, size_t size)
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
static const KeyPair *const end
int qt_wince__getpid(void)
QByteArray & remove(int index, int len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...
int qt_wince__rename(const char *oldname, const char *newname)
bool endsWith(const QByteArray &a) const
Returns true if this byte array ends with byte array ba; otherwise returns false. ...
int qt_wince__read(int handle, void *buffer, unsigned int count)