sysosh.inc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 = DWord;
  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. {$if defined(WIN32) or defined(WIN64)}
  46. {$define HAS_ENTRYINFORMATION_OS}
  47. TEntryInformationOS = record
  48. {$ifdef WIN32}
  49. asm_exit : Procedure;stdcall;
  50. {$endif WIN32}
  51. TlsKeyAddr : PDWord;
  52. SysInstance: {$ifdef CPU64}PQWord{$else}PLongInt{$endif};
  53. WideInitTables : Pointer;
  54. end;
  55. {$endif WIN32 or WIN64}
  56. const
  57. {$ifdef WINCE}
  58. KernelDLL = 'coredll';
  59. ApiSuffix = 'W';
  60. {$else WINCE}
  61. KernelDLL = 'kernel32';
  62. ApiSuffix = 'A';
  63. {$endif WINCE}
  64. function OleStrToString(source: PWideChar) : UnicodeString;inline;
  65. procedure OleStrToStrVar(source : PWideChar;var dest : UnicodeString);inline;
  66. procedure OleStrToStrVar(source : PWideChar;var dest : AnsiString);inline;
  67. function StringToOleStr(const source : ansistring) : PWideChar;inline;
  68. function StringToOleStr(const source : UnicodeString) : PWideChar;inline;
  69. type
  70. TStartupInfo = record
  71. cb : DWord;
  72. lpReserved : Pointer;
  73. lpDesktop : Pointer;
  74. lpTitle : Pointer;
  75. dwX : DWord;
  76. dwY : DWord;
  77. dwXSize : DWord;
  78. dwYSize : DWord;
  79. dwXCountChars : DWord;
  80. dwYCountChars : DWord;
  81. dwFillAttribute : DWord;
  82. dwFlags : DWord;
  83. wShowWindow : Word;
  84. cbReserved2 : Word;
  85. lpReserved2 : Pointer;
  86. hStdInput : THandle;
  87. hStdOutput : THandle;
  88. hStdError : THandle;
  89. end;
  90. { package stuff }
  91. type
  92. PLibModule = ^TLibModule;
  93. TLibModule = record
  94. Next: PLibModule;
  95. Instance: THandle;
  96. CodeInstance: THandle;
  97. DataInstance: THandle;
  98. ResInstance: THandle;
  99. Reserved: PtrInt;
  100. end;
  101. var
  102. LibModuleList: PLibModule = nil;
  103. {$ifdef FPC_USE_WIN64_SEH}
  104. procedure _fpc_local_unwind(frame,target: Pointer);compilerproc;
  105. {$endif FPC_USE_WIN64_SEH}
  106. {$ifdef FPC_SECTION_THREADVARS}
  107. function fpc_tls_add(addr: pointer):pointer;compilerproc;
  108. {$endif FPC_SECTION_THREADVARS}