Commit Graph

356 Commits

Author SHA1 Message Date
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
sergei
e3816d0db2 * Unit windirs does not need to depend on unit strings.
git-svn-id: trunk@17725 -
2011-06-12 02:56:40 +00:00
florian
0c10a5efff * line > 255 chars wrapped
git-svn-id: trunk@17650 -
2011-06-03 13:02:30 +00:00
marco
2dbdaa4b81 * fixed highbound xmmregisters. Mantis #19426
git-svn-id: trunk@17562 -
2011-05-26 18:13:07 +00:00
michael
9d580533d9 * Fixed compile error in FileCreate
git-svn-id: trunk@17549 -
2011-05-24 07:10:33 +00:00
michael
a201f07420 * Added share mode argument to FileCreate call
git-svn-id: trunk@17548 -
2011-05-23 21:11:07 +00:00
marco
5c08dd06a3 * patch from Cobines, Mantis 19227 fixing return type of shgetfileinfo*
git-svn-id: trunk@17369 -
2011-04-25 15:43:07 +00:00
sergei
62e11742bf * Reverted STD_xxx_HANDLE constants back to DWORD type (issue introduced in r15824). These are not handles, and are 32-bit even in Win64. See http://msdn.microsoft.com/en-us/library/ms683231.aspx
+ added a test to help detecting this happening again.

git-svn-id: trunk@17333 -
2011-04-17 22:27:56 +00:00
florian
6b4f13c1d7 * workaround for bug in GetThreadLocale on some W7, resolves #18574
git-svn-id: trunk@17331 -
2011-04-16 20:38:04 +00:00
paul
872d9e98ea rtl: fix return type of 2 callback procedures (UINT -> UINT_PTR)
git-svn-id: trunk@17324 -
2011-04-15 13:02:46 +00:00
paul
32ec75216c rtl: fix printer hook procedures - they return PTR_UINT instead of UINT
git-svn-id: trunk@17311 -
2011-04-13 08:47:05 +00:00
sergei
30a02b8d65 * CreateIoCompletionPort and GetCompletionPortStarus: changed type of 'completionKey' parameter to ULONG_PTR, patch from cobines, resolves #19104.
git-svn-id: trunk@17258 -
2011-04-06 03:33:45 +00:00
sergei
3a7ac49cc2 - Removed Win32Wide2AnsiMove, using Win32Unicode2AnsiMove for both Unicode-to-ansi and Wide-to-ansi conversions. In general, we don't need two different conversion routines in wideStringManager, as long as they differ only in PWideChar vs PUnicodeChar (these types are identical).
git-svn-id: trunk@17202 -
2011-03-29 05:25:05 +00:00
paul
e0671060db rtl: add missing TWMWindowPosChanged, TWMWindowPosChanging from messages interface
git-svn-id: trunk@17198 -
2011-03-28 06:28:25 +00:00
sergei
2a303c88f5 * On thread creation error, use a resourcestring message and textual representation of system error code.
- Removed an unused type declaration.

git-svn-id: trunk@17164 -
2011-03-22 15:26:28 +00:00
joost
2937190516 * Moved and renamed GetSpecialDir from sysutils to new windirs unit, so it can be used in the compiler
git-svn-id: trunk@17134 -
2011-03-14 20:43:03 +00:00
marco
1932f04719 * fix (outline)testmetric. A+W 32+64. Mantis 17727 and mantis 18835
git-svn-id: trunk@17074 -
2011-03-04 21:23:02 +00:00
sergei
7b948b1e38 * Type of lParam argument of EnumResourceNames, EnumResourceTypes, EnumResourceLanguages and corresponding callbacks must be LONG_PTR. Mantis #18816.
* Also assigned meaningful names to callback arguments.

git-svn-id: trunk@16993 -
2011-02-24 06:08:33 +00:00
sergei
5fb58e1458 + Windows unit: add GetCPInfoEx function and related definitions, patch from G.Fink, Mantis #18654
git-svn-id: trunk@16862 -
2011-02-01 13:10:15 +00:00
marco
a318f1c91e * Also changed the redef version of getprocessaffinity.. to dword_ptr.
Mants 18434

git-svn-id: trunk@16735 -
2011-01-08 12:35:10 +00:00
sergei
15e1abddf7 * Windows RTL: Simplify SysUtils.GetLocalTime(). TSystemTime type for these targets matches one defined in Windows unit, so WinAPI function result can be used directly. Resolves #18346.
git-svn-id: trunk@16665 -
2010-12-30 20:40:47 +00:00
pierre
0fabda01a8 * Added code to support Windows 95 again
This code is disabled by default, you need to complie the RTL
  with option -dSUPPORT_WIN95.

    2.4.2 release is already not usable on Windows 95 because
  the kernel32 DLL function TryEnterCriticalSection is loaded
  into system unit unconditionnally, while this function does
  not exist in Winddows 95 kernel32.

    This patch uses LoadLibrary/GetProcAddress coupple to check if
  TryEnterCriticalSection exists and provides an alternate implementation
  that will be used on Windows 95 systems only (Windows 98 kernel32
  DLL does export TryEnterCriticalSection).

git-svn-id: trunk@16579 -
2010-12-17 14:12:43 +00:00
sergei
13bea29253 * win/sysutils.pp, FileOpen and FileCreate, removed manual zero-termination of strings. This unit compiles in {$h+} state, and AnsiString zero-termination is handled automatically these days.
git-svn-id: trunk@16558 -
2010-12-12 15:07:38 +00:00
sergei
179229007e * win/sysutils.pp: fix/clean up loading dll for SHGetFolderPath.
* Don't attempt to load shell32.dll, since every system with shell32.dll that exports SHGetFolderPath also has shfolder.dll present.
  * Load shfolder.dll using a full path in order to prevent loading of malicious code by placing a same-named dll into program directory (Mantis #18185).

git-svn-id: trunk@16549 -
2010-12-11 10:05:10 +00:00
sergei
c5162a7816 * win/sysutils.pp: Use GetModuleHandle for dynamic loading of kernel32.dll instead of LoadLibrary, this is possible because kernel32 is statically linked by RTL and is therefore always loaded with application. Also makes FreeLibrary at finalization unnecessary.
- Removed checks for Windows version, they are redundant. GetProcAddress simply returns nil if the function is not present.

git-svn-id: trunk@16540 -
2010-12-11 04:47:33 +00:00
Jonas Maebe
f4c31ecf3c + widestringmanager.codepointlengthproc added, which can be used to
determine the length of a multi-byte character. The return values
    are defined to be the same as those of POSIX' mblen: -1 =
    invalid/incomplete sequence, 0 = #0, > 0 = length of sequence in
    bytes.
  + default implementation for widestringmanager.codepointlengthproc
    (assumes all code points have length 1) and Unix implementation
    (based on mb(r)len); Windows implementation is still required
  * replaced default implementation of
    widestringmanager.CharLengthPCharProc with strlen() of the input
    instead of an error (correct if all code points have length 1,
    still needs Windows implementation)
  + implemented fpc_text_read_{wide,unicode}str() and
    fpc_text_read_widechar() (mantis #18163); fpc_text_read_widechar()
    uses the new widestringmanager.codepointlengthproc()
  + unicodestring support for readstr/writestr
  * fixed declaration of fpc_Write_Text_UnicodeStr (unicodestring
    instead of widestring parameter)
  * extended test/twide*.pp tests to test the new/fixed functionality

git-svn-id: trunk@16533 -
2010-12-10 14:10:01 +00:00
sergei
4e3cedb492 * VariantInit is a procedure, not a function (according to both MSDN and Delphi docs).
git-svn-id: trunk@16525 -
2010-12-09 01:27:09 +00:00
florian
a0c25dc0f9 - removes Thread_count from the system unit of several OSes: the value of this variable was unpredictable and the hebaviour was not fixable, resolves #18089
git-svn-id: trunk@16472 -
2010-11-28 20:46:50 +00:00
michael
cc0be1be4d * Completely initialize threadvars when an external thread is detected. Needs still cleanup code (or a better thread initialization/finalization).
git-svn-id: trunk@16432 -
2010-11-25 15:50:49 +00:00
sergei
cbdc08b641 * dynlibs.pas: added 'const' modifiers to eliminate unnecessary local string copies
git-svn-id: trunk@16366 -
2010-11-18 22:09:48 +00:00
paul
4036be1221 rtl: add IO_REPARSE_TAG constants
git-svn-id: trunk@16358 -
2010-11-18 04:06:49 +00:00
michael
5cdc3c3a29 * Correction of PAFProtocols (Ivan Shikhalev, bug ID #17924
git-svn-id: trunk@16335 -
2010-11-13 15:51:43 +00:00
sergei
80d69c8a22 * win/sysutils.pp, implement CompareUnicodeString and CompareTextUnicodeString, resolves #17591.
git-svn-id: trunk@16293 -
2010-11-02 07:34:23 +00:00
sergei
a4dd7701d9 * win/sysutils.pp: removed private WinAPI function declarations. Since this unit uses Windows unit, there's no point in re-declaring stuff.
git-svn-id: trunk@16292 -
2010-11-02 07:11:17 +00:00