This is a summary of the changes I made to the core APR 1.2.11 library. The
patch will follow separately. The changes target CE 5 and may have broken
earlier versions. I do not have earlier versions on which to test/build
against, but it's possible to modify these changes to revert them using the
version of the _WIN32_WCE macro if problems are suspected.

I glanced over some of the changes to trunk and noticed a few of these
changes have been implemented, in slightly different ways.

A few of the changes don't work as expected. See the e-mail containing the
test results for details.

I have a VS2005 project, but can't post it here (it gets rejected).

* Build as Unicode project.
* Conditionally exclude headers that don't exist on CE. Use APR's macros
  where possible to make the decision.
* Fix parameters passed to apr_conv_utf8_to_ucs2() in dso.c.
* Use CE's GetTempPathW() API to get the temporary path location.
* Check apr_dir_read() for ERROR_NO_MORE_FILES when it's normally expected
  to succeed.
* CE doesn't have drive letters, don't check for or use them.
* Removed use of unimplemented Windows API functions on CE. File stats
  suffered due to lack of this information.
  * apr_file_info_get() non-working flags: APR_CHR, APR_PIPE,
    APR_FINFO_IDENT, APR_FINFO_NLINK, APR_FINFO_USER, APR_FINFO_GROUP.
  * apr_stat() non-working flags: APR_CHR, APR_FINFO_TYPE, APR_FINFO_USER,
    APR_FINFO_GROUP.
* Used CeGetCanonicalPathNameW() to get root path, "drive", and to
  canonicalize paths.
* Implemented file locking (removed blocks) for CE 5 and up. Although, it
  isn't working properly for some reason; API usage is correct and works
  in separate tests.
* Replaced use of GetStdHandle/SetStdHandle() with STD*_FILENO macros
  because the CE API doesn't have the functions.
* Following flags are unsupported on CE for file creation/opening:
  FILE_WRITE_ATTRIBUTES, FILE_FLAG_DELETE_ON_CLOSE,
  FILE_FLAG_OPEN_REPARSE_POINT, READ_CONTROL, FILE_FLAG_OVERLAPPED.
* Used code for 95/98 (MoveFile instead of MoveFileEx) to implement
  apr_file_rename().
* Implemented apr_file_open_std(err|out|in)() using STD*_FILENO instead of
  GetStdHandle().
* Removed unsupported pipe-specific API usage.
* Removed use of overlapped file i/o, not supported on CE. APR_XTHREAD is
  implied on CE because it "supports" cross-thread file use natively.
* Added workaround when using WriteFile() to "append" zero amount of data.
  It normally fails, but since it doesn't do anything, the workaround
  succeeds it.
* Called FlushFileBuffers() to really flush the file buffers in
  apr_file_flush().
* Since CE doesn't support overlapped file i/o, don't bother keeping track
  of the file pointer, let the OS handle it.
* Removed _WIN32_WINNT downgrade because it prevented needed APIs from
  being defined.
* Removed exclusion of winsock2/mswsock/ws2tcpip.h, since CE 5 has them.
* Added support for IPV6, I'm developing on a platform that supports IPV6.
* Defined APR_HAVE_STR(N)ICMP to 1 because CE 5 has the necessary
  functions.
* Changed APR_PATH_MAX to use MAX_PATH on CE; it's smaller than the
  default.
* Updated APR_STATUS_IS_EDSOOPEN macro to check for
  ERROR_INVALID_PARAMETER.
* Updated APR_STATUS_IS_ESYMNOTFOUND macro to check for
  ERROR_INVALID_HANDLE.
* Defined "strcasecmp" to "_stricmp" and "strncasecmp" to "_strnicmp".
* Added APR_WIN_CE_(4|5|6) macros and version checking for newer CE
  versions.
* Removed late binding API because it isn't needed on CE.
* Added WSA overlapped member to apr_socket_t for use with WSA sockets.
* WSABUF is already defined in CE 5, as it should be; left the explicit
  definition alone for earlier versions.
* Added missing errno values needed/used internally: ENOSPC, EINVAL,
  ERANGE, BUFSIZ.
* Replaced use of _malloc_dbg/_realloc_dbg() with normal malloc/realloc().
* Modified apr_dbg_log() to use Unicode APIs.
* Replaced UuidCreate() with CoCreateGuid() which exists on CE.
* Need to use CreateFileForMappingW() to open a file before mapping it.
  Closing the mapped view automatically closes the extra handle.
* setsockopt() doesn't use errno (it doesn't exist), instead,
  apr_get_netos_error() must be used.
* Removed fake getservbyname() in favor of real one in Winsock 2.
* Replaced use of standard sockets with overlapped WSA sockets to be able
  to handle blocking sockets with a timeout. Standard sockets don't support
  timeouts on CE.
* Shared memory must also use CreateFileForMappingW() for MMap files and
  INVALID_HANDLE_VALUE for anonymous MMap files.
* Underlying implementation in apr_strtoff() doesn't use errno, need to
  detect errors manually.
* Don't prepend program path/name as first argument when passing arguments
  to newly created processes. CE 5 already takes care of it.
* CREATE_UNICODE_ENVIRONMENT is not supported on CE.
* Need to specify STACK_SIZE_PARAM_IS_A_RESERVATION to CreateThread() to
  use the given stack size instead of the default.
* Replaced combination GetSystemTime() and SystemTimeToFileTime() with
  simpler GetCurrentFT() to get the current time.

Reply via email to