Commit Graph

389 Commits

Author SHA1 Message Date
sergei
167ee9867e * Moved DLL_xxx declarations to sysos.inc, so they can be reused by wince.
* systlsdir.inc: don't invent own symbols for the same purpose, defining DLL_xx conditionally is enough to avoid duplicate declarations.

git-svn-id: trunk@20363 -
2012-02-16 17:13:32 +00:00
sergei
c3b106fde3 * StringToOleStr(UnicodeString), reduced to single SetString call, this way it does not depend on private functions and does not require $ifdef's.
git-svn-id: trunk@20263 -
2012-02-05 18:43:20 +00:00
pierre
f80bc70707 + Add _FPC_TlsSize public symbol for use by heaptrc unit
git-svn-id: trunk@20180 -
2012-01-26 13:51:34 +00:00
pierre
573102fa70 * Explicitly disable checkpointer for functions using GetEnvironmentStrings
git-svn-id: trunk@20179 -
2012-01-26 13:50:36 +00:00
marco
51f99c57c3 * Add CancelIO, CancelIOex Mantis #21079
git-svn-id: trunk@20063 -
2012-01-13 09:02:54 +00:00
marco
397a6059f8 * correct INVALID_SOCKET to NOT 0, mantis #20946
git-svn-id: trunk@19883 -
2011-12-22 12:20:00 +00:00
sergei
ce2812e24a * Split combined declarations of GetModuleHandle and GetModuleFileName into separate WinCE and non-WinCE versions. Using Pointer as 'common denominator' in combined declarations was making it impossible to use e.g. GetModuleHandle('literal') in System unit.
* Also fixed parameter and return types for these declarations.

git-svn-id: trunk@19881 -
2011-12-22 02:17:02 +00:00
sergei
ebb2205c63 * Moved TExceptionRecord definition to sysos.inc, it is identical for all Windows targets.
git-svn-id: trunk@19868 -
2011-12-18 00:45:52 +00:00
sergei
abdbe49861 + SysUtils part of SEH (enabled only for win64)
* EExternal.ExceptionRecord changed from field to property and made available on all Windows, not just win32.
* CatchUnhandledException: removed AnsiString variable, ideally there should be no memory allocations in this code path.

git-svn-id: trunk@19849 -
2011-12-14 10:47:26 +00:00
sergei
bcbd25568e * Call InitHeap before InitSystemThreads in TLS callback (necessary because InitSystemThreads calls RelocateHeap), and skip both of them in initialization section of system.pp if they have been called from TLS callback. This restores correct initialization sequence which was broken by r19779, resulting in lots of debug messages about corrupted heap when running tests/test/theapthread.pp
git-svn-id: trunk@19836 -
2011-12-13 07:40:02 +00:00
sergei
76b9d7e766 - Removed Win32Wide2AnsiMove() again, it was removed already in r17202 but got restored during subsequent cpstrnew merging.
git-svn-id: trunk@19781 -
2011-12-08 21:28:12 +00:00
pierre
4a9c8e330b + Move EXEC_callback into separate file win/systlsdir.inc
* In win32/sysinitXX units, rename EntryInforation
    to SysInitEntryInformation.
    include new win/systlsdir.inc file from
    win/syswin.inc for win64 target
    and from win32/sysinit.inc for win32 target.
    Set fields of both SysInitEntryInformation and EntryInformation
    by converting them into typed constants.

git-svn-id: trunk@19779 -
2011-12-08 16:11:07 +00:00
marco
f89e32c034 * expanded VK_ codes. Patch by Nikolay N. Mantis #20801
git-svn-id: trunk@19734 -
2011-12-03 16:41:06 +00:00
sergei
32094761ef * win32/system.pp, win64/system.pp: Moved duplicated declarations of WinAPI functions to sysos.inc (Florian's comment about include ordering is no longer true, wstrings.inc comes after sysos.inc these days).
* Result of GetCurrentProcess and first argument of ReadProcessMemory are THandle, not dword.

git-svn-id: trunk@19726 -
2011-12-02 18:52:48 +00:00
sergei
37abdd52df * Reverted r19693, calling SysInitMultithreading from PROCESS_ATTACH is plain wrong because it depends on initialized thread manager. Calling InitSystemThreads is more correct, but in case of Win32 it further depends on EnrtyInformation, which is not available at this point. Properly solving the issue requires moving the entire TLS stuff into sysinit units or something like that.
git-svn-id: trunk@19715 -
2011-11-30 15:14:00 +00:00
sergei
266acd1bed * Windows TLS callbacks, call SysInitMultithreading early, it is necessary because if a statically loaded DLL creates a thread, apparently DLL_THREAD_ATTACH callback executes right away before the entry point. In turn, DLL_THREAD_ATTACH requires TLSIndex to be initialized.
git-svn-id: trunk@19693 -
2011-11-26 20:52:27 +00:00
paul
270fb09e87 rtl: add WideStringManager.GetStandardCodePageProc method to retrieve system ansi and console code pages
git-svn-id: trunk@19539 -
2011-10-25 01:39:11 +00:00
florian
3c0256bd7b * patch by Ludo Brands to fix #20481: GetFileType cannot be used on windows to determine if a handle is a console handle because the function does not distinguish between consoles and printers, resolves #20481
git-svn-id: trunk@19532 -
2011-10-23 14:20:00 +00:00
paul
5bf39cd1c1 rtl: remove ver2_2 define
git-svn-id: trunk@19471 -
2011-10-12 01:55:46 +00:00
paul
6131a9188c rtl: fix wince compilation, reimplement WinCEWide2AnsiMove, WinCEAnsi2WideMove by copying win32 code
git-svn-id: trunk@19470 -
2011-10-12 01:50:14 +00:00
paul
836889fc64 rtl: move some CP_xxx constants from syswin into systemh for generic use, redeclare UTF8Sting, RawByteString using constant identifiers instead of pure numbers. replace comparison with $ffff codepage to CP_NONE
git-svn-id: trunk@19354 -
2011-10-04 05:05:14 +00:00
pierre
7e87ca4c3c * Comment about mingw tlssup.c added
git-svn-id: trunk@19349 -
2011-10-03 22:03:02 +00:00
sergei
ad5d2ccabb * Moved command line handling and randomize() to syswin.inc, so a single copy of code is used for both win32 and win64. This implies that apostrophe is no longer supported as quoting symbol in win64.
Win64 doesn't support it itself either.

git-svn-id: trunk@19201 -
2011-09-23 21:45:02 +00:00
sergei
f35a8179b1 * Status codes are identical for win32 and win64, moved them to syswin.inc.
git-svn-id: trunk@19160 -
2011-09-20 15:01:22 +00:00
sergei
6f20627220 * Use rip-relative offsets in assembler, fixes linking text mode IDE with internal linker. The better way would be to get rid of this assembler altogether.
git-svn-id: trunk@19149 -
2011-09-19 15:18:28 +00:00
paul
9e0ad7baae merge r17318 from cpstrnew branch by florian:
* compilation fix by Inoussa OUEDRAOGO, resolves #19160

git-svn-id: trunk@19104 -
2011-09-17 13:01:20 +00:00
paul
233004f72b merge r14144 from cpstrnew branch by paul:
call MultiByteToWideChar with dwFlags=0 for UTF8 code page

git-svn-id: trunk@19100 -
2011-09-17 11:56:16 +00:00
paul
2162add8ac merge r14132 from cpstrnew branch by paul:
- a set of rtl changes from AnsiString to RawByteString to various conversion functions
- a test which proves output in cp1251 and cp866 codepages (standard for Russian windows)

git-svn-id: trunk@19093 -
2011-09-17 11:39:13 +00:00
paul
8cc22972a0 merge r13488 from cpstrnew branch by florian except ncgcon.pas which has a difficult merge conflict (code moved to another unit which is not at the branch during the revision):
* first batch of patches to make tcpstr1.pp work

git-svn-id: trunk@19085 -
2011-09-17 11:16:45 +00:00
paul
ae0d732c8f merge r13485 from cpstrnew branch by florian:
* fixed compilation of system unit after last changes

git-svn-id: trunk@19083 -
2011-09-17 11:01:42 +00:00
paul
28627482c5 merge r13483 from cpstrnew branch by florian:
+ Win32Unicode2AnsiMove and Win32Wide2AnsiMove support code page parameter
+ Win32Ansi2UnicodeMove and Win32Ansi2WideMove support code page parameter
+ code page parameter added for several compilerprocs
* unified more code between win32 and win64 (widestring conversion routines

git-svn-id: trunk@19082 -
2011-09-17 10:54:00 +00:00
marco
d6962106b9 * typecast that fixes range error, part of mantis #16172
git-svn-id: trunk@19040 -
2011-09-09 20:03:08 +00:00
marco
1f5333a80a * fixes from Mantis #20194, derived from patch and description by G. Fink.
git-svn-id: trunk@19035 -
2011-09-08 20:42:39 +00:00
marco
01d686c11d * paper size constants updated, patch by G. Fink, Mantis #20120
git-svn-id: trunk@18932 -
2011-09-01 08:40:51 +00:00
marco
9772257404 * fix for mantis #20047 ddeconnect VAR Parameter issue that can take NIL.
git-svn-id: trunk@18853 -
2011-08-26 13:16:37 +00:00
marco
bb2e98c4f1 * load listseparator from locale. Patch by Bart B. Mantis 19976
git-svn-id: trunk@18188 -
2011-08-13 09:16:46 +00:00
florian
28126cf0d5 * convert disk full to run time error 101
git-svn-id: trunk@18131 -
2011-08-07 09:15:42 +00:00
sergei
ef48f93d85 * win/systhrd.inc: modified ThreadMain so it initializes RTL if not already done, allowing TLS callbacks to be optional.
* win/syswin.inc: added a workaround for buggy ld on win64, see comments in source for details.

git-svn-id: trunk@18019 -
2011-07-25 07:41:32 +00:00
sergei
5c3aca5148 * thread.inc, DoneThread: allow CurrentTM.ReleaseThreadVars to be unassigned and reset ThreadID (in preparation to support Windows native threadvars)
* win/systhrd.inc: added error checking in several places. Fail with code 226 if resources cannot be allocated, as Delphi does.
* win/syswin.inc, Dll_entry: Don't call DoneThread in PROCESS_DETACH callback, it is redundant because the main thread is finalized by FPC_DO_EXIT. SysReleaseThreadVars is still necessary. Also removed redundant assignments to return value.

git-svn-id: trunk@17992 -
2011-07-15 23:57:23 +00:00
marco
1e9733d2d7 * several virtual* and heap* functions checked for 64-bit issues.
git-svn-id: trunk@17979 -
2011-07-11 20:38:37 +00:00
sergei
02a5efc619 * win/systhrd.inc, clean up:
- removed assembler from SysRelocateThreadVars: never actually worked, and this file is shared between different CPUs - not a proper place for assembler anyway.
- Obtain handle of kernel32.dll using GetModuleHandle, allows to get rid of UnloadLibrary call.

git-svn-id: trunk@17975 -
2011-07-11 17:18:48 +00:00
sergei
50952945e1 * Moved WideString-related code, which is identical for Win32 and Win64, into syswin.inc
* Defined HAS_WIDESTRINGMANAGER for Win32 and Win64, this allows to smartlink away part of generic widestring routines.

git-svn-id: trunk@17963 -
2011-07-08 20:07:51 +00:00
sergei
ea1e44c036 * Hacking TLS callbacks into proper shape, part 2:
- Completely removed DLL_PROCESS_DETACH callback for executables. Reason: 1) it is executed after RTL has been shut down and called ExitProcess(), at which point it is really not a good idea to do the cleanup. 2) In executable (in contrast with DLL) it is just fine to leave remaining resources alone and let OS reclaim them.
* Using 'cvar' for _tls_used and _tls_index to get proper prefixing without $ifdef's.

git-svn-id: trunk@17943 -
2011-07-06 16:43:13 +00:00
sergei
138c2b6b0a * Hacking TLS callbacks into proper shape:
- Do not call DLL hooks from exe callback handler.
  - Do not call SysInitMultitheading from DLL_THREAD_ATTACH handler, it may only be called from the main thread. See comments in syswin.inc for details. Reverts rev. 17892.
  + To guarantee that SysInitMultithreading is called from the main thread, assume executables always multithreaded, just like DLLs are.
  - Also removed all checks with MainThreadIdWin32, except checks for double DLL_PROCESS_DETACH in DLLs. They duplicate what Windows already does (the main thread invokes only PROCESS_ATTACH/PROCESS_DETACH and never THREAD_ATTACH/THREAD_DETACH callbacks).
  * Attempts to avoid double initialization/finalization (once in callback, second time in normal control flow).
  * Net result: webtbs/tw2423 and webtbs/tw15530 fixed, webtbs/tw3661 broken (because heaptrc does not support checking pointers in TLS area, and with 'always multithreaded' apps the Output varible moves into TLS).

git-svn-id: trunk@17938 -
2011-07-05 11:57:11 +00:00
pierre
450fd8784b * section specification method changed
git-svn-id: trunk@17907 -
2011-07-01 19:22:12 +00:00
pierre
8e2da253f9 * Index pointer field must be set to correct value in EXECUTABLE as it is used at program launch
git-svn-id: trunk@17897 -
2011-07-01 13:15:00 +00:00
pierre
bffd571f9d * win/sysos.inc: TTlsDirectory, new record type
Used to support TlsCallbacks.

    Tls callback code added inside
    ifdef FPC_USE_TLS_DIRECTORY.
    NOTE: This code needs compiler changes also to work.

  * win/systhread.inc:
    Exec_Tls_callback: Callback for main executable.
    Several new external variables:
    FreePascal_TLS_callback, FreePascal_end_of_TLS_callback
    need to be placed into .CRT$XL* section,
    using  name '.section .CRT$XLFPC __FPC_tls_callbacks'
    extension to be provided by compiler change.
    tls_callbacks : pointer; external name '___crt_xl_start__';
    tls_data_start : pointer; external name '___tls_start__';
    tls_data_end : pointer; external name '___tls_end__';
    provided by linker script.
    tls_index : DWord that will contain the automatic
    TlsIndex generated by executable launch code (not used by
    FPC code, but might be used by code from loaded objects).
    _tls_used: TTlsdirectory record.

  * win32/system.pp and win64/system.pp:
    Code to force loading of _tls_used record.

git-svn-id: trunk@17893 -
2011-07-01 10:40:35 +00:00
pierre
128e2e9cc5 *Dll_entry: Call SysInitMultiThreading to allocate TlsKey if not yet done
git-svn-id: trunk@17892 -
2011-07-01 10:08:40 +00:00
pierre
1339c66ec9 * SysAllocateThreadVars: Make sure the data slot is only allocated once
git-svn-id: trunk@17891 -
2011-07-01 10:07:38 +00:00
sergei
2099318c3d * win/dos.pp: cleanup GetDiskFreeSpace related stuff, patch similar to sysutils.pp rev.16540.
git-svn-id: trunk@17726 -
2011-06-12 03:35:45 +00:00