Commit Graph

468 Commits

Author SHA1 Message Date
paul
de6a53376c win32: update TOKEN_INFORMATION_CLASS from windows sdk
git-svn-id: trunk@25565 -
2013-09-25 08:50:38 +00:00
marco
1a4a745993 * fix for mantis #25078
git-svn-id: trunk@25546 -
2013-09-24 12:56:43 +00:00
Tomas Hajny
3e5601d89e * fix ChDir and GetDir handling for other than the current drive and avoid changing the current directory in GetDir in that case
git-svn-id: trunk@25541 -
2013-09-23 20:41:54 +00:00
nickysn
96c7a9325a * CrtOpen, CrtClose, CrtRead, CrtWrite and CrtReturn changed to procedures, instead of functions
git-svn-id: trunk@25506 -
2013-09-17 11:17:29 +00:00
Jonas Maebe
40ff1c77ca * updated GetWindowsSpecialDir():string so it uses the -A or -W api call
depending on whether the RTL is compiled in Unicode mode to avoid
    conversions

git-svn-id: branches/cpstrrtl@25310 -
2013-08-19 22:47:19 +00:00
Jonas Maebe
63e8d0c31c * do not yet map GetCommandLine() to GetCommandLineW() with -dFPC_UNICODE_RTL,
because its result is assigned to the global cmdline variable which is still
    a pchar in all cases

git-svn-id: branches/cpstrrtl@25309 -
2013-08-19 22:47:15 +00:00
Jonas Maebe
5b09435055 * explicitly call several windows *A() versions of APIs so the intended
routine is called even when we compile with -dFPC_UNICODE_RTL

git-svn-id: branches/cpstrrtl@25308 -
2013-08-19 22:47:12 +00:00
Jonas Maebe
2da7c3f05c * changed declarations in finah.inc and diskh.inc from ansistring to
rawbytestring
  * DoDirSeparators() and GetDirs() marked as "rtlproc" so they can accept
    non-rawbytestring arguments as their var-parameters

git-svn-id: branches/cpstrrtl@25306 -
2013-08-19 22:04:40 +00:00
Jonas Maebe
af3f12f60c * rawbytestring/unicodestring versions of findfirst/findnext/findclose
o these routines are now generic wrappers in filutil.inc, and call
     the platform-dependent internalfindfirst/next/close routines
   o on unix, the fnmatch routine got proper support for UTF-8 matching
     (e.g., it won't match a partial UTF-8 code point to a "?" wildcard)
   o for NativeNT, a similar (untested) UTF-16 version has been added
  + test for the above
  * rawbytestring/unicodestring versions of fileage

git-svn-id: branches/cpstrrtl@25302 -
2013-08-19 22:04:25 +00:00
Jonas Maebe
29132f45b7 * synchronised with trunk up to r25167 (fixes glib compilation via r25164,
and occasional crashes in executeprocess on libc platforms via r25167)

git-svn-id: branches/cpstrrtl@25169 -
2013-07-24 14:24:49 +00:00
Jonas Maebe
3fdb3092af + defaultfilesystemcodepage support for dynlibs
+ unicodestring overloads for (safe)loadlibrary()

git-svn-id: branches/cpstrrtl@25162 -
2013-07-22 21:45:34 +00:00
Jonas Maebe
df6a2dce00 + unicodestring support for assign/erase/rename
+ codepage support for textrec/filerec and the above routines
  * textrec/filerec now store the filename by default using widechar. It is
    possible to switch back to ansichars using the FPC_ANSI_TEXTFILEREC define.
    In that case, from now on the filename will always be stored in
    DefaultFileSystemEncoding
  * fixed potential buffer overflows and non-null-terminated file names in
    textrec/filerec
  + dodirseparators(pwidechar), changed the dodirseparators(pchar/pwidechar)
    parameters into var-parameters and gave those routines an extra parameter
    that indicates whether the p(wide)char can be changed in place if
    necessary or whether a copy must be made first (avoids us having to make
    all strings always unique everywhere, because they might be changed on
    some platforms via a pchar)
  * do_open/do_erase/do_rename got extra boolean parameters indicating whether
    the passed pchars point to data that can be freely changed (to pass on to
    dodirseparators() if applicable)
  * objects.pp: force assign(pchar) to be called, because
    assign(array[0..255]) cannot choose between pchar and rawbytestring
    versions (and removing the pchar version means that assign(pchar) will
    be mapped to assign(shortstring) in {$h-})
  * fixed up some routines in other units that depend on the format of
    the textrec/filerec.name field

git-svn-id: branches/cpstrrtl@25137 -
2013-07-19 16:30:51 +00:00
Jonas Maebe
155aafc255 * moved SYSUTILS_HAS_ANSISTR/UNICODESTR_FILEUTIL_IMPL define to interface
so declarations can also depend on it and similar defines (not yet the
    case)
  + added SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL/SYSUTILS_HAS_UNICODESTR_ENVVAR_IMPL
    to indicate whether the platform-dependent part of the unit provides
    an ansistring/unicodestring interface to get environment variables
  + Windows version of getenvironmentvariable(unicodestring)
  + generic ansistring/unicodestring versions of GetEnvironmentVariable()
    in case the platform doesn't provide them
  * result of GetEnvironmentString() is ansistring/unicodestring depending
    on the state of the FPC_RTL_UNICODE define

git-svn-id: branches/cpstrrtl@25116 -
2013-07-16 14:16:34 +00:00
Jonas Maebe
eeb98a0c0f - removed platform-specific implementations of GetCurrentDir, SetCurrentDir,
CreateDir and RemoveDir, and implemented a generic one (based on the OS/2
    version) in the shared sysutils code (so that the filesystem code page
    support for the system unit routines can be reused)
  * include both ansistring and unicodestring versions of the above routines,
    and of ForceDirectories. Exception: GetCurrentDir, which cannot be
    overloaded based on function result and whose return type currently
    dependends on the FPC_UNICODE_RTL define

git-svn-id: branches/cpstrrtl@25113 -
2013-07-16 14:15:55 +00:00
Jonas Maebe
8b77f62873 * don't truncate environment variable strings in GetEnvironmentString()
* set the correct code page for the result of GetEnvironmentString() on
    Windows and NativeNT

git-svn-id: branches/cpstrrtl@25103 -
2013-07-15 09:21:20 +00:00
Jonas Maebe
08099c8558 * explicitly call *A routines from ansistring environment variable routines
git-svn-id: branches/cpstrrtl@25102 -
2013-07-15 09:21:03 +00:00
Jonas Maebe
d919794fdf * handle the fact that GetEnvironmentStringsA returns the environment in the
OEM instead of in the Ansi code page (mantis #22524, #15233)

git-svn-id: branches/cpstrrtl@25092 -
2013-07-12 17:18:28 +00:00
Jonas Maebe
a5273abc9c + support for CP_OEMCP
* changed all mappings from CP_ACP to DefaultSystemCodePage to calls to the
    new TranslatePlaceholderCP() routine (which also handles CP_OEMCP)
  * removed unnecessary CP_ACP adaptations in fpc_AnsiStr_Concat_multi()
    for JVM target (now handled in the ansistring to unicodestring conversion
    routine)

git-svn-id: branches/cpstrrtl@25091 -
2013-07-12 17:18:24 +00:00
Jonas Maebe
ba49e4a29d * fixed do_getdir() for non-defaultdrive after r25042 ("drive" array has to
be an array of widechar now)
  * fixed restoring of original path in do_getdir() (pass contents of
    unicodestring to SetCurrentDirectoryW(), not its address)

git-svn-id: branches/cpstrrtl@25088 -
2013-07-12 17:18:11 +00:00
Jonas Maebe
26b2149ced * converted the following sysutils routines to unicodestring and
rawbytestring: FileExists, DirectoryExists, FileSetDate, FileGetAttr,
    FileSetAttr, DeleteFile, RenameFile, FileSearch, ExeSearch,
    FileIsReadOnly

git-svn-id: branches/cpstrrtl@25078 -
2013-07-09 19:01:45 +00:00
marco
609f6255d4 * added layout constants.
git-svn-id: trunk@25053 -
2013-07-06 20:46:30 +00:00
Jonas Maebe
d66d15aad3 + added mkdir/chdir/rmdir(rawbytestring) and (unicodestring) to the system unit
* renamed platform-specific pchar versions of those rouines to do_*() and
    changed them to either rawbytestring or unicodestring depending on the
    FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API setting
  * implemented generic shortstring versions of those routines on top of either
    rawbytestring or unicodestring depending on the API-kind (in case of the
    embedded target, if ansistring are not supported they will map directly
    to shortstring routines instead)
  * all platform-specific *dir() routines with rawbytestring parameters now
    receive their parameters in DefaultFileSystemCodePage
  - removed no longer required ansistring variants from the objpas unit
  - removed no longer required FPC_SYS_MKDIR etc aliases
  * factored out empty string and inoutres<>0 checks from platform-specific
    *dir() routines to generic ones
  o platform-specific notes:
   o amiga/morphos: check new pathconv(rawbytestring) function
   o macos TODO: convert PathArgToFSSpec (and the routines it calls) to
     rawbytestring
   o nativent: added SysUnicodeStringToNtStr() function
   o wii: convert dirio callbacks to use rawbytestring to avoid conversion
  + test for unicode mk/ch/rm/getdir()

git-svn-id: branches/cpstrrtl@25048 -
2013-07-04 22:28:37 +00:00
Jonas Maebe
8368f7dba5 * call unicodestring version of ExpandUNCFileName from ansistring version
instead of infinitely recursing into the ansistring version

git-svn-id: branches/cpstrrtl@25044 -
2013-07-04 22:28:20 +00:00
Jonas Maebe
08ab4dcabe * convert calls to GetCurrentDirectory to *W in Windows do_getdir()
git-svn-id: branches/cpstrrtl@25042 -
2013-07-04 22:28:13 +00:00
Jonas Maebe
b08d8091b2 * made fexpand unicodestring-safe (use charinset instead of "in" --
"widechar in set" compiles, but results in a runtime conversion of
    the widechar into an ansistring and then getting the first character
    of that ansistring, which is horribly slow -- and Delphi-incompatible,
    but introduced a long time ago because of bug #7758)
  * replaced all "in" operations in sysutils fina.inc with CharInSet for
    the same reason
  * replaced all "string" declarations in finah.inc/fina.inc with "PathStr"
    and "pchar" with "PathPChar", and include them twice in sysutilh.inc/
    sysutils.inc, once with PathStr=UnicodeString/PathPChar=PWideChar and
    once with PathStr=AnsiString/PathPChar=PAnsiChar (not rawbytestring
    because there are several routines with var-parameters and then the
    string type has to match exactly; the "rtlproc" modifier could circumvent
    this, but should be used sparingly, and additionally the routine's
    internals would then first also have to be reviewed to ensure that at
    no point they start mixing in strings with the defaultsystemcodepage
    (e.g. directory separators) without first adjusting their codepage)
  * call GetShortPathNameA or GetShortPathNameW in ExtractShortPathName on
    Windows depending on whether we are parsing the RawByteString/UnicodeString
    version of fina.inc
  + ExpandUNCFileName(unicode) version for Windows, let its
    ExpandUNCFileName(ansistring) call the unicode version (avoid data loss
    due to ansi conversion) and convert the result to
    DefaultRTLFileSystemCodePage (to have no more data loss than what's
    specified by the user)

git-svn-id: branches/cpstrrtl@24999 -
2013-06-27 21:38:10 +00:00
Jonas Maebe
62ee16278b * changed getdir(ansistring):ansistring to
getdir(rawbytestring):rawbytestring so it can accept strings in any
    encoding and cleanly return results in DefaultRTLFileSystemCodePage
  + getdir(unicodestring):unicodestring
  * renamed the getdir implementation of all platforms except for embedded-
    without-ansistring-support to do_getdir(), and depending on the
    FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API define
    changed its shortstring parameter to ansistring or unicodestring. The
    do_getdir(rawbytestring) routine should just set the code page of the
    return value to DefaultFileSystemCodePage without conversion (not
    DefaultRTLFileSystemCodePage with conversion, that conversion is performed
    in getdir if necessary; this avoids double conversions in case
    getdir(unicodestring) is called)
  + generic getdir(shortstring) for platforms supporting either ansistrings or widestrings
  o platform maintainers:
   o OS/2: adjust code to supports paths > 255 characters if those are supported
   o Wii: adjust used callback to use rawbytestring to support paths > 255 characters and
     avoid shortstring->rawbytestring conversion overhead
   o Windows: GetCurrentDirectoryW is now always used (to prevent data loss)

git-svn-id: branches/cpstrrtl@24993 -
2013-06-27 21:37:47 +00:00
Jonas Maebe
b0613d9ec5 * converted Windows FileCreate/FileOpen to use unicode interface instead of
ansistring

git-svn-id: branches/cpstrrtl@24969 -
2013-06-24 21:24:13 +00:00
marco
ac3815fd84 * hopefully final series of tchar elimination.
git-svn-id: trunk@24923 -
2013-06-21 13:55:54 +00:00
marco
d7f3ab848b * fixed some more tchar cases into a proper ifdef unicode -W else -A structure.
git-svn-id: trunk@24922 -
2013-06-21 13:11:43 +00:00
Jonas Maebe
ecd3cba02b * synchronised with trunk up to r24912
o resolved conflict in updated morphos sysutils unit
   o moved code that had been added to the now deleted  sysunix.inc to the
     unix-specific block of the fpwidestring unit's init code

git-svn-id: branches/cpstrrtl@24913 -
2013-06-17 20:50:02 +00:00
sergei
94d1e0c81c + Added KEY_WOW64_64KEY and KEY_WOW64_32KEY to Windows unit and fcl-registry/src/regdef.inc
* Fixed TRegistry.OpenKeyReadOnly and TRegistry.KeyExists methods so they preserve KEY_WOW64_xxKEY bits passed into TRegistry constructor. Based on patch from Maciej Kaczkowski, resolves #23695, #23188

git-svn-id: trunk@24824 -
2013-06-09 00:15:29 +00:00
marco
2a09070108 * add INVALID_FILE_SIZE mentioned on Lazarus list.
git-svn-id: trunk@24806 -
2013-06-05 13:23:10 +00:00
marco
9239adbc1e * added some newer additions to devmodea also to devmodeb
git-svn-id: trunk@24710 -
2013-06-01 12:51:15 +00:00
marco
54c7620793 * moved some constants from PTC after checking them with SDK
git-svn-id: trunk@24704 -
2013-06-01 12:19:01 +00:00
marco
b52717fd90 * wndclassex ifdef unicode fixed.
git-svn-id: trunk@24698 -
2013-06-01 10:27:39 +00:00
marco
56d3197ef2 * wndclass was defined with T stringtypes, even though aliased to -A variants.
W variants were ok. Rearranged to more normal ifdef unicode setup.

git-svn-id: trunk@24679 -
2013-05-31 21:39:31 +00:00
marco
8592b306f5 * some more Unicode Windows headers fixes.
git-svn-id: trunk@24673 -
2013-05-31 17:58:18 +00:00
marco
527489c1ab * some minor fixes to get unit Windows compiled with UNICODE defined.
git-svn-id: trunk@24658 -
2013-05-31 09:09:08 +00:00
marco
e57174a14f * defined -W versions for several -A functions under ifdef FPC_UNICODE_RTL
git-svn-id: trunk@24644 -
2013-05-30 15:47:41 +00:00
marco
548879f450 * set tchar to ansichar if ifndef unicode. Probably doesn't matter, since but
reads cleaner.

git-svn-id: trunk@24450 -
2013-05-05 10:25:10 +00:00
marco
3af8cab1de * corrections from Mantis #20194.
- tbitmapheader is not a redef, from redef -> struct
     - some -A types had char types that were $ifdef unicode dependent. Fixed.
     - some -A types had char types in numeric form (bchar), where Delphi
	uses Pascal char types (ansichar)  

git-svn-id: trunk@24449 -
2013-05-05 10:23:06 +00:00
marco
ea86dcb668 * parts of #23953 done. Deprecation of old shlobj structures that are still in unit windows. However shlobj first needs to honour ifdef unicode. It currently
only supports -A and -W variants, and not the suffixless aliases.

git-svn-id: trunk@24448 -
2013-05-05 09:37:00 +00:00
marco
c9dce154fd * add boolean that can be changed to avoid shutting down winsock. This can trouble other DLLs. Mantis #22597
git-svn-id: trunk@24446 -
2013-05-05 08:42:08 +00:00
svenbarth
930b76e8fb Fix compilation of WinCE. Change the fixed UNICODE define of WinCE to FPC_OS_UNICODE, so that it won't be undefined when changing the mode/string type and that the usage of a UNICODE API is independant of the mode.
Also adjusted all Windows (Win32/64/CE) units to define a "UNICODE" if "FPC_OS_UNICODE" is defined (except the Jedi units).
Also the common RTL units that checked for UNICODE now check for FPC_OS_UNICODE.

git-svn-id: trunk@24420 -
2013-05-04 11:06:32 +00:00
marco
bbc7d0c96b * vista+ gettickcount64
git-svn-id: trunk@24397 -
2013-04-30 19:12:20 +00:00
svenbarth
bd7cc36ea6 The documentation says that a "BeginThread" needs to be followed by a "CloseThread". The implementation of TThread did not respect this yet.
Note: The only RTL where this could lead to problems is for BeOS with the old threading implementation as this does not use "BeginThread" at all (the newer implementation does).

rtl/objpas/classes/classes.inc, TThread.Destroy:
  * call "CloseThread" if the thread handle is valid (mimics the logic of the Windows RTL)
rtl/win/tthread.inc, TThread.SysDestroy:
  * remove the call to "CloseHandle"; this is done by "CloseThread" afterwards

git-svn-id: trunk@24313 -
2013-04-23 20:13:07 +00:00
sergei
747342ebb2 - Removed nested comments which were causing compiler warnings.
git-svn-id: trunk@24176 -
2013-04-07 12:06:01 +00:00
marco
81eb59e081 * make ioctl related constants unsigned.
git-svn-id: trunk@23552 -
2013-01-31 18:48:32 +00:00
florian
9315eba917 * patch by Serg Bormant: fix fmShareCompat handling for win32/win64/nativent, resolves #23725
git-svn-id: trunk@23542 -
2013-01-29 21:26:17 +00:00
sergei
6788fd6433 + Win64 SEH: install a top-level exception handler around thread functions. This was a missing puzzle piece of SEH support. Now behavior of unhandled exceptions in non-main threads is consistent with that of main thread, and, in general, behavior of SEH-enabled RTL is consistent with one without SEH.
git-svn-id: trunk@23482 -
2013-01-21 17:16:15 +00:00