pocketpc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. /*
  2. * Skeleton platform-dependent support routines for PhysicsFS.
  3. *
  4. * Please see the file LICENSE in the source's root directory.
  5. *
  6. * This file written by Ryan C. Gordon.
  7. */
  8. #if HAVE_CONFIG_H
  9. # include <config.h>
  10. #endif
  11. #include <stdio.h>
  12. #include <windows.h>
  13. #define __PHYSICSFS_INTERNAL__
  14. #include "physfs_internal.h"
  15. #define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
  16. #define INVALID_SET_FILE_POINTER 0xFFFFFFFF
  17. typedef struct
  18. {
  19. HANDLE handle;
  20. int readonly;
  21. } winCEfile;
  22. const char *__PHYSFS_platformDirSeparator = "\\";
  23. static char *userDir = NULL;
  24. /*
  25. * Figure out what the last failing Win32 API call was, and
  26. * generate a human-readable string for the error message.
  27. *
  28. * The return value is a static buffer that is overwritten with
  29. * each call to this function.
  30. */
  31. static const char *win32strerror(void)
  32. {
  33. static TCHAR msgbuf[255];
  34. TCHAR *ptr = msgbuf;
  35. FormatMessage(
  36. FORMAT_MESSAGE_FROM_SYSTEM |
  37. FORMAT_MESSAGE_IGNORE_INSERTS,
  38. NULL,
  39. GetLastError(),
  40. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
  41. msgbuf,
  42. sizeof (msgbuf) / sizeof (TCHAR),
  43. NULL
  44. );
  45. /* chop off newlines. */
  46. for (ptr = msgbuf; *ptr; ptr++)
  47. {
  48. if ((*ptr == '\n') || (*ptr == '\r'))
  49. {
  50. *ptr = ' ';
  51. break;
  52. } /* if */
  53. } /* for */
  54. return((const char *) msgbuf);
  55. } /* win32strerror */
  56. static char *UnicodeToAsc(const wchar_t *w_str)
  57. {
  58. char *str = NULL;
  59. if (w_str != NULL)
  60. {
  61. int len = wcslen(w_str) + 1;
  62. str = (char *) allocator.Malloc(len);
  63. if (WideCharToMultiByte(CP_ACP,0,w_str,-1,str,len,NULL,NULL) == 0)
  64. { /*Conversion failed */
  65. allocator.Free(str);
  66. return(NULL);
  67. } /* if */
  68. else
  69. { /* Conversion successful */
  70. return(str);
  71. } /* else */
  72. } /* if */
  73. else
  74. { /* Given NULL string */
  75. return NULL;
  76. }
  77. } /* UnicodeToAsc */
  78. static wchar_t *AscToUnicode(const char *str)
  79. {
  80. wchar_t *w_str = NULL;
  81. if (str != NULL)
  82. {
  83. int len = strlen(str) + 1;
  84. w_str = (wchar_t *) allocator.Malloc(sizeof (wchar_t) * len);
  85. if (MultiByteToWideChar(CP_ACP,0,str,-1,w_str,len) == 0)
  86. {
  87. allocator.Free(w_str);
  88. return(NULL);
  89. } /* if */
  90. else
  91. {
  92. return(w_str);
  93. } /* else */
  94. } /* if */
  95. else
  96. {
  97. return(NULL);
  98. } /* else */
  99. } /* AscToUnicode */
  100. static char *getExePath()
  101. {
  102. DWORD buflen;
  103. int success = 0;
  104. TCHAR *ptr = NULL;
  105. TCHAR *retval = (TCHAR*) allocator.Malloc(sizeof (TCHAR) * (MAX_PATH + 1));
  106. char *charretval;
  107. BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
  108. retval[0] = _T('\0');
  109. buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1);
  110. if (buflen <= 0) {
  111. __PHYSFS_setError(win32strerror());
  112. } else {
  113. retval[buflen] = '\0'; /* does API always null-terminate this? */
  114. ptr = retval+buflen;
  115. while( ptr != retval )
  116. {
  117. if( *ptr != _T('\\') ) {
  118. *ptr-- = _T('\0');
  119. } else {
  120. break;
  121. }
  122. }
  123. success = 1;
  124. } /* else */
  125. if (!success)
  126. {
  127. allocator.Free(retval);
  128. return(NULL); /* physfs error message will be set, above. */
  129. } /* if */
  130. /* free up the bytes we didn't actually use. */
  131. ptr = (TCHAR *) allocator.Realloc(retval, sizeof(TCHAR)*_tcslen(retval)+1);
  132. if (ptr != NULL)
  133. retval = ptr;
  134. charretval = UnicodeToAsc(retval);
  135. allocator.Free(retval);
  136. if(charretval == NULL) {
  137. BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
  138. }
  139. return(charretval); /* w00t. */
  140. } /* getExePath */
  141. int __PHYSFS_platformInit(void)
  142. {
  143. userDir = getExePath();
  144. BAIL_IF_MACRO(userDir == NULL, NULL, 0); /* failed? */
  145. return(1); /* always succeed. */
  146. } /* __PHYSFS_platformInit */
  147. int __PHYSFS_platformDeinit(void)
  148. {
  149. allocator.Free(userDir);
  150. return(1); /* always succeed. */
  151. } /* __PHYSFS_platformDeinit */
  152. void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
  153. {
  154. /* no-op on this platform. */
  155. } /* __PHYSFS_platformDetectAvailableCDs */
  156. char *__PHYSFS_platformCalcBaseDir(const char *argv0)
  157. {
  158. return(getExePath());
  159. } /* __PHYSFS_platformCalcBaseDir */
  160. char *__PHYSFS_platformGetUserName(void)
  161. {
  162. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  163. } /* __PHYSFS_platformGetUserName */
  164. char *__PHYSFS_platformGetUserDir(void)
  165. {
  166. return userDir;
  167. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  168. } /* __PHYSFS_platformGetUserDir */
  169. PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
  170. {
  171. return(1); /* single threaded. */
  172. } /* __PHYSFS_platformGetThreadID */
  173. int __PHYSFS_platformStricmp(const char *x, const char *y)
  174. {
  175. return(_stricmp(x, y));
  176. } /* __PHYSFS_platformStricmp */
  177. int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len)
  178. {
  179. return(_strnicmp(x, y, (int) len));
  180. } /* __PHYSFS_platformStrnicmp */
  181. int __PHYSFS_platformExists(const char *fname)
  182. {
  183. int retval=0;
  184. wchar_t *w_fname=AscToUnicode(fname);
  185. if(w_fname!=NULL)
  186. {
  187. retval=(GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES);
  188. allocator.Free(w_fname);
  189. }
  190. return(retval);
  191. } /* __PHYSFS_platformExists */
  192. int __PHYSFS_platformIsSymLink(const char *fname)
  193. {
  194. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  195. } /* __PHYSFS_platformIsSymlink */
  196. int __PHYSFS_platformIsDirectory(const char *fname)
  197. {
  198. int retval=0;
  199. wchar_t *w_fname=AscToUnicode(fname);
  200. if(w_fname!=NULL)
  201. {
  202. retval=((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0);
  203. allocator.Free(w_fname);
  204. }
  205. return(retval);
  206. } /* __PHYSFS_platformIsDirectory */
  207. char *__PHYSFS_platformCvtToDependent(const char *prepend,
  208. const char *dirName,
  209. const char *append)
  210. {
  211. int len = ((prepend) ? strlen(prepend) : 0) +
  212. ((append) ? strlen(append) : 0) +
  213. strlen(dirName) + 1;
  214. char *retval = (char *) allocator.Malloc(len);
  215. char *p;
  216. BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
  217. if (prepend)
  218. strcpy(retval, prepend);
  219. else
  220. retval[0] = '\0';
  221. strcat(retval, dirName);
  222. if (append)
  223. strcat(retval, append);
  224. for (p = strchr(retval, '/'); p != NULL; p = strchr(p + 1, '/'))
  225. *p = '\\';
  226. return(retval);
  227. } /* __PHYSFS_platformCvtToDependent */
  228. void __PHYSFS_platformTimeslice(void)
  229. {
  230. Sleep(10);
  231. } /* __PHYSFS_platformTimeslice */
  232. void __PHYSFS_platformEnumerateFiles(const char *dirname,
  233. int omitSymLinks,
  234. PHYSFS_EnumFilesCallback callback,
  235. const char *origdir,
  236. void *callbackdata)
  237. {
  238. HANDLE dir;
  239. WIN32_FIND_DATA ent;
  240. char *SearchPath;
  241. wchar_t *w_SearchPath;
  242. size_t len = strlen(dirname);
  243. /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */
  244. SearchPath = (char *) alloca(len + 3);
  245. BAIL_IF_MACRO(SearchPath == NULL, ERR_OUT_OF_MEMORY, NULL);
  246. /* Copy current dirname */
  247. strcpy(SearchPath, dirname);
  248. /* if there's no '\\' at the end of the path, stick one in there. */
  249. if (SearchPath[len - 1] != '\\')
  250. {
  251. SearchPath[len++] = '\\';
  252. SearchPath[len] = '\0';
  253. } /* if */
  254. /* Append the "*" to the end of the string */
  255. strcat(SearchPath, "*");
  256. w_SearchPath=AscToUnicode(SearchPath);
  257. dir = FindFirstFile(w_SearchPath, &ent);
  258. allocator.Free(w_SearchPath);
  259. allocator.Free(SearchPath);
  260. if (dir == INVALID_HANDLE_VALUE)
  261. return;
  262. do
  263. {
  264. const char *str;
  265. if (wcscmp(ent.cFileName, L".") == 0)
  266. continue;
  267. if (wcscmp(ent.cFileName, L"..") == 0)
  268. continue;
  269. /* !!! FIXME: avoid malloc in UnicodeToAsc? */
  270. str = UnicodeToAsc(ent.cFileName);
  271. if (str == NULL)
  272. break;
  273. callback(callbackdata, origdir, str);
  274. allocator.Free(str);
  275. } while (FindNextFile(dir, &ent) != 0);
  276. FindClose(dir);
  277. } /* __PHYSFS_platformEnumerateFiles */
  278. char *__PHYSFS_platformCurrentDir(void)
  279. {
  280. return("\\");
  281. } /* __PHYSFS_platformCurrentDir */
  282. char *__PHYSFS_platformRealPath(const char *path)
  283. {
  284. char *retval = (char *) allocator.Malloc(strlen(path) + 1);
  285. strcpy(retval,path);
  286. return(retval);
  287. } /* __PHYSFS_platformRealPath */
  288. int __PHYSFS_platformMkDir(const char *path)
  289. {
  290. wchar_t *w_path = AscToUnicode(path);
  291. if(w_path!=NULL)
  292. {
  293. DWORD rc = CreateDirectory(w_path, NULL);
  294. allocator.Free(w_path);
  295. if(rc==0)
  296. {
  297. return(0);
  298. }
  299. return(1);
  300. }
  301. else
  302. {
  303. return(0);
  304. }
  305. } /* __PHYSFS_platformMkDir */
  306. static void *doOpen(const char *fname, DWORD mode, DWORD creation, int rdonly)
  307. {
  308. HANDLE fileHandle;
  309. winCEfile *retval;
  310. wchar_t *w_fname=AscToUnicode(fname);
  311. fileHandle = CreateFile(w_fname, mode, FILE_SHARE_READ, NULL,
  312. creation, FILE_ATTRIBUTE_NORMAL, NULL);
  313. allocator.Free(w_fname);
  314. if(fileHandle==INVALID_HANDLE_VALUE)
  315. {
  316. return NULL;
  317. }
  318. BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL);
  319. retval = (winCEfile *) allocator.Malloc(sizeof (winCEfile));
  320. if (retval == NULL)
  321. {
  322. CloseHandle(fileHandle);
  323. BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
  324. } /* if */
  325. retval->readonly = rdonly;
  326. retval->handle = fileHandle;
  327. return(retval);
  328. } /* doOpen */
  329. void *__PHYSFS_platformOpenRead(const char *filename)
  330. {
  331. return(doOpen(filename, GENERIC_READ, OPEN_EXISTING, 1));
  332. } /* __PHYSFS_platformOpenRead */
  333. void *__PHYSFS_platformOpenWrite(const char *filename)
  334. {
  335. return(doOpen(filename, GENERIC_WRITE, CREATE_ALWAYS, 0));
  336. } /* __PHYSFS_platformOpenWrite */
  337. void *__PHYSFS_platformOpenAppend(const char *filename)
  338. {
  339. void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0);
  340. if (retval != NULL)
  341. {
  342. HANDLE h = ((winCEfile *) retval)->handle;
  343. if (SetFilePointer(h, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER)
  344. {
  345. const char *err = win32strerror();
  346. CloseHandle(h);
  347. allocator.Free(retval);
  348. BAIL_MACRO(err, NULL);
  349. } /* if */
  350. } /* if */
  351. return(retval);
  352. } /* __PHYSFS_platformOpenAppend */
  353. PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
  354. PHYSFS_uint32 size, PHYSFS_uint32 count)
  355. {
  356. HANDLE Handle = ((winCEfile *) opaque)->handle;
  357. DWORD CountOfBytesRead;
  358. PHYSFS_sint64 retval;
  359. /* Read data from the file */
  360. /*!!! - uint32 might be a greater # than DWORD */
  361. if (!ReadFile(Handle, buffer, count * size, &CountOfBytesRead, NULL))
  362. {
  363. retval = -1;
  364. } /* if */
  365. else
  366. {
  367. /* Return the number of "objects" read. */
  368. /* !!! - What if not the right amount of bytes was read to make an object? */
  369. retval = CountOfBytesRead / size;
  370. } /* else */
  371. return(retval);
  372. } /* __PHYSFS_platformRead */
  373. PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
  374. PHYSFS_uint32 size, PHYSFS_uint32 count)
  375. {
  376. HANDLE Handle = ((winCEfile *) opaque)->handle;
  377. DWORD CountOfBytesWritten;
  378. PHYSFS_sint64 retval;
  379. /* Read data from the file */
  380. /*!!! - uint32 might be a greater # than DWORD */
  381. if (!WriteFile(Handle, buffer, count * size, &CountOfBytesWritten, NULL))
  382. {
  383. retval = -1;
  384. } /* if */
  385. else
  386. {
  387. /* Return the number of "objects" read. */
  388. /*!!! - What if not the right number of bytes was written? */
  389. retval = CountOfBytesWritten / size;
  390. } /* else */
  391. return(retval);
  392. } /* __PHYSFS_platformWrite */
  393. int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
  394. {
  395. HANDLE Handle = ((winCEfile *) opaque)->handle;
  396. DWORD HighOrderPos;
  397. DWORD rc;
  398. /* Get the high order 32-bits of the position */
  399. //HighOrderPos = HIGHORDER_UINT64(pos);
  400. HighOrderPos = (unsigned long)(pos>>32);
  401. /*!!! SetFilePointer needs a signed 64-bit value. */
  402. /* Move pointer "pos" count from start of file */
  403. rc = SetFilePointer(Handle, (unsigned long)(pos&0x00000000ffffffff),
  404. &HighOrderPos, FILE_BEGIN);
  405. if ((rc == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
  406. {
  407. BAIL_MACRO(win32strerror(), 0);
  408. }
  409. return(1); /* No error occured */
  410. } /* __PHYSFS_platformSeek */
  411. PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
  412. {
  413. HANDLE Handle = ((winCEfile *) opaque)->handle;
  414. DWORD HighPos = 0;
  415. DWORD LowPos;
  416. PHYSFS_sint64 retval;
  417. /* Get current position */
  418. LowPos = SetFilePointer(Handle, 0, &HighPos, FILE_CURRENT);
  419. if ((LowPos == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
  420. {
  421. BAIL_MACRO(win32strerror(), 0);
  422. } /* if */
  423. else
  424. {
  425. /* Combine the high/low order to create the 64-bit position value */
  426. retval = (((PHYSFS_uint64) HighPos) << 32) | LowPos;
  427. //assert(retval >= 0);
  428. } /* else */
  429. return(retval);
  430. } /* __PHYSFS_platformTell */
  431. PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
  432. {
  433. HANDLE Handle = ((winCEfile *) opaque)->handle;
  434. DWORD SizeHigh;
  435. DWORD SizeLow;
  436. PHYSFS_sint64 retval;
  437. SizeLow = GetFileSize(Handle, &SizeHigh);
  438. if ((SizeLow == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
  439. {
  440. BAIL_MACRO(win32strerror(), -1);
  441. } /* if */
  442. else
  443. {
  444. /* Combine the high/low order to create the 64-bit position value */
  445. retval = (((PHYSFS_uint64) SizeHigh) << 32) | SizeLow;
  446. //assert(retval >= 0);
  447. } /* else */
  448. return(retval);
  449. } /* __PHYSFS_platformFileLength */
  450. int __PHYSFS_platformEOF(void *opaque)
  451. {
  452. PHYSFS_sint64 FilePosition;
  453. int retval = 0;
  454. /* Get the current position in the file */
  455. if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
  456. {
  457. /* Non-zero if EOF is equal to the file length */
  458. retval = FilePosition == __PHYSFS_platformFileLength(opaque);
  459. } /* if */
  460. return(retval);
  461. } /* __PHYSFS_platformEOF */
  462. int __PHYSFS_platformFlush(void *opaque)
  463. {
  464. winCEfile *fh = ((winCEfile *) opaque);
  465. if (!fh->readonly)
  466. BAIL_IF_MACRO(!FlushFileBuffers(fh->handle), win32strerror(), 0);
  467. return(1);
  468. } /* __PHYSFS_platformFlush */
  469. int __PHYSFS_platformClose(void *opaque)
  470. {
  471. HANDLE Handle = ((winCEfile *) opaque)->handle;
  472. BAIL_IF_MACRO(!CloseHandle(Handle), win32strerror(), 0);
  473. allocator.Free(opaque);
  474. return(1);
  475. } /* __PHYSFS_platformClose */
  476. int __PHYSFS_platformDelete(const char *path)
  477. {
  478. wchar_t *w_path=AscToUnicode(path);
  479. /* If filename is a folder */
  480. if (GetFileAttributes(w_path) == FILE_ATTRIBUTE_DIRECTORY)
  481. {
  482. int retval=!RemoveDirectory(w_path);
  483. allocator.Free(w_path);
  484. BAIL_IF_MACRO(retval, win32strerror(), 0);
  485. } /* if */
  486. else
  487. {
  488. int retval=!DeleteFile(w_path);
  489. allocator.Free(w_path);
  490. BAIL_IF_MACRO(retval, win32strerror(), 0);
  491. } /* else */
  492. return(1); /* if you got here, it worked. */
  493. } /* __PHYSFS_platformDelete */
  494. void *__PHYSFS_platformCreateMutex(void)
  495. {
  496. return((void *) CreateMutex(NULL, FALSE, NULL));
  497. } /* __PHYSFS_platformCreateMutex */
  498. void __PHYSFS_platformDestroyMutex(void *mutex)
  499. {
  500. CloseHandle((HANDLE) mutex);
  501. } /* __PHYSFS_platformDestroyMutex */
  502. int __PHYSFS_platformGrabMutex(void *mutex)
  503. {
  504. return(WaitForSingleObject((HANDLE) mutex, INFINITE) != WAIT_FAILED);
  505. } /* __PHYSFS_platformGrabMutex */
  506. void __PHYSFS_platformReleaseMutex(void *mutex)
  507. {
  508. ReleaseMutex((HANDLE) mutex);
  509. } /* __PHYSFS_platformReleaseMutex */
  510. PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
  511. {
  512. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  513. } /* __PHYSFS_platformGetLastModTime */
  514. /* !!! FIXME: Don't use C runtime for allocators? */
  515. int __PHYSFS_platformAllocatorInit(void)
  516. {
  517. return(1); /* always succeeds. */
  518. } /* __PHYSFS_platformAllocatorInit */
  519. void __PHYSFS_platformAllocatorDeinit(void)
  520. {
  521. /* no-op */
  522. } /* __PHYSFS_platformAllocatorInit */
  523. void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
  524. {
  525. BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
  526. #undef malloc
  527. return(malloc((size_t) s));
  528. } /* __PHYSFS_platformMalloc */
  529. void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
  530. {
  531. BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
  532. #undef realloc
  533. return(realloc(ptr, (size_t) s));
  534. } /* __PHYSFS_platformRealloc */
  535. void __PHYSFS_platformAllocatorFree(void *ptr)
  536. {
  537. #undef free
  538. free(ptr);
  539. } /* __PHYSFS_platformAllocatorFree */
  540. /* end of pocketpc.c ... */