sysosh.inc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. Basic Windows stuff
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2002-2005 by Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. { Platform specific information }
  12. type
  13. {$ifdef CPU64}
  14. THandle = QWord;
  15. ULONG_PTR = QWord;
  16. {$else CPU64}
  17. THandle = DWord;
  18. ULONG_PTR = DWord;
  19. {$endif CPU64}
  20. TThreadID = THandle;
  21. SIZE_T = ULONG_PTR;
  22. { the fields of this record are os dependent }
  23. { and they shouldn't be used in a program }
  24. { only the type TCriticalSection is important }
  25. PRTLCriticalSection = ^TRTLCriticalSection;
  26. {$ifndef WINCE}
  27. TRTLCriticalSection = packed record
  28. DebugInfo : pointer;
  29. LockCount : longint;
  30. RecursionCount : longint;
  31. OwningThread : THandle;
  32. LockSemaphore : THandle;
  33. SpinCount : ULONG_PTR;
  34. end;
  35. {$else WINCE}
  36. //CE only
  37. TRTLCriticalSection = packed record
  38. LockCount : DWord ; // Nesting count on critical section
  39. OwnerThread : THandle; // Handle of owner thread
  40. hCrit : THandle; // Handle to this critical section
  41. needtrap : DWORD; // Trap in when freeing critical section
  42. dwContentions : DWORD ; // Count of contentions
  43. end;
  44. {$endif WINCE}
  45. const
  46. {$ifdef WINCE}
  47. KernelDLL = 'coredll';
  48. ApiSuffix = 'W';
  49. {$else WINCE}
  50. KernelDLL = 'kernel32';
  51. ApiSuffix = 'A';
  52. {$endif WINCE}
  53. function OleStrToString(source: PWideChar) : UnicodeString;inline;
  54. procedure OleStrToStrVar(source : PWideChar;var dest : UnicodeString);inline;
  55. procedure OleStrToStrVar(source : PWideChar;var dest : AnsiString);inline;
  56. function StringToOleStr(const source : ansistring) : PWideChar;inline;
  57. function StringToOleStr(const source : UnicodeString) : PWideChar;inline;
  58. { package stuff }
  59. type
  60. PLibModule = ^TLibModule;
  61. TLibModule = record
  62. Next: PLibModule;
  63. Instance: THandle;
  64. CodeInstance: THandle;
  65. DataInstance: THandle;
  66. ResInstance: THandle;
  67. Reserved: PtrInt;
  68. end;
  69. var
  70. LibModuleList: PLibModule = nil;
  71. {$ifdef FPC_USE_WIN64_SEH}
  72. procedure _fpc_local_unwind(frame,target: Pointer);compilerproc;
  73. {$endif FPC_USE_WIN64_SEH}
  74. {$ifdef FPC_SECTION_THREADVARS}
  75. function fpc_tls_add(addr: pointer):pointer;compilerproc;
  76. {$endif FPC_SECTION_THREADVARS}