Win32OperatingSystem.st
author Claus Gittinger <cg@exept.de>
Wed, 27 Apr 2016 20:05:13 +0200
changeset 19666 755edabcbe67
parent 19653 ad5ce2d82380
child 19667 16bfe221f88e
child 19668 8c30d204cd7b
permissions -rw-r--r--
#BUGFIX by cg class: Win32OperatingSystem changed: #epochEndOSTime #epochStartOSTime fix for changed epoch bias (osTime already biased to 1970)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
     1
"{ Encoding: utf8 }"
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
     2
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     3
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     4
 COPYRIGHT (c) 1988 by Claus Gittinger
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
     5
 COPYRIGHT (c) 1998-2004 by eXept Software AG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
     6
	      All Rights Reserved
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     7
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     8
 This software is furnished under a license and may be used
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     9
 only in accordance with the terms of that license and with the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    10
 inclusion of the above copyright notice.   This software may not
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    11
 be provided or otherwise made available to, or used by, any
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    12
 other person.  No title to or ownership of the software is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    13
 hereby transferred.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    14
"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    15
"{ Package: 'stx:libbasic' }"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    16
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
    17
"{ NameSpace: Smalltalk }"
a7170033e17f directory access
ca
parents: 17169
diff changeset
    18
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    19
AbstractOperatingSystem subclass:#Win32OperatingSystem
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    20
	instanceVariableNames:''
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
    21
	classVariableNames:'Initialized HostName DomainName CurrentDirectory LastOsTimeLow
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
    22
		LastOsTimeHi LastTimeInfoIsLocal LastTimeInfo'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    23
	poolDictionaries:'Win32Constants'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    24
	category:'OS-Windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    25
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    26
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
    27
ByteArray variableByteSubclass:#DevModeStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    28
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    29
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    30
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    31
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
    32
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
    33
c57956a348bf printing support
fm
parents: 9431
diff changeset
    34
ByteArray variableByteSubclass:#DocInfoStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    35
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    36
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    37
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    38
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
    39
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
    40
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    41
Object subclass:#FileStatusInfo
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    42
	instanceVariableNames:'type mode uid gid size id accessed modified created statusChanged
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    43
		sourcePath linkTargetPath fullPathName alternativePathName'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    44
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    45
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    46
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    47
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    48
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    49
Object subclass:#OSProcessStatus
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    50
	instanceVariableNames:'pid status code core'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    51
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    52
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    53
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    54
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    55
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    56
SharedPool subclass:#PECOFFConstants
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    57
	instanceVariableNames:''
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    58
	classVariableNames:'PE_Signature_OFFSET_OFFSET PE_Signature COFF_HEADER_SIZE
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    59
		COFF_HEADER_Machine_OFFSET IMAGE_FILE_MACHINE_UNKNOWN
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    60
		IMAGE_FILE_MACHINE_AM33 IMAGE_FILE_MACHINE_AMD64
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    61
		IMAGE_FILE_MACHINE_ARM IMAGE_FILE_MACHINE_ARMNT
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    62
		IMAGE_FILE_MACHINE_ARM64 IMAGE_FILE_MACHINE_EBC
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    63
		IMAGE_FILE_MACHINE_I386 IMAGE_FILE_MACHINE_IA64
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    64
		IMAGE_FILE_MACHINE_M32R IMAGE_FILE_MACHINE_MIPS16
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    65
		IMAGE_FILE_MACHINE_MIPSFPU IMAGE_FILE_MACHINE_MIPSFPU16
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    66
		IMAGE_FILE_MACHINE_POWERPC IMAGE_FILE_MACHINE_POWEPCFP
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    67
		IMAGE_FILE_MACHINE_R4000 IMAGE_FILE_MACHINE_SH3
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    68
		IMAGE_FILE_MACHINE_SH3DSP IMAGE_FILE_MACHINE_SH4
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    69
		IMAGE_FILE_MACHINE_SH5 IMAGE_FILE_MACHINE_THUMB
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    70
		IMAGE_FILE_MACHINE_WCEMIPSV2'
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    71
	poolDictionaries:''
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    72
	privateIn:Win32OperatingSystem
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    73
!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    74
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    75
Object subclass:#PECOFFFileHeader
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    76
	instanceVariableNames:'file data'
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    77
	classVariableNames:''
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    78
	poolDictionaries:'Win32OperatingSystem::PECOFFConstants'
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    79
	privateIn:Win32OperatingSystem
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    80
!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
    81
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
    82
Object subclass:#PerformanceData
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    83
	instanceVariableNames:'objectArray perfTime perfFreq perfTime100nSec'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    84
	classVariableNames:'PerformanceText CounterIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    85
		HelpIndexTextDictionary'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    86
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    87
	privateIn:Win32OperatingSystem
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    88
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    89
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    90
Object subclass:#Abstract
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    91
	instanceVariableNames:'lastData lastTimestamp cachedResults'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    92
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    93
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    94
	privateIn:Win32OperatingSystem::PerformanceData
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    95
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    96
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
    97
Win32OperatingSystem::PerformanceData::Abstract subclass:#DiskIO
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    98
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    99
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   100
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   101
	privateIn:Win32OperatingSystem::PerformanceData
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
   102
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
   103
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
   104
Win32OperatingSystem::PerformanceData::Abstract subclass:#Global
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   105
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   106
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   107
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   108
	privateIn:Win32OperatingSystem::PerformanceData
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
   109
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
   110
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
   111
Win32OperatingSystem::PerformanceData::Abstract subclass:#Memory
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   112
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   113
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   114
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   115
	privateIn:Win32OperatingSystem::PerformanceData
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
   116
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
   117
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
   118
Win32OperatingSystem::PerformanceData::Abstract subclass:#Network
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   119
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   120
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   121
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   122
	privateIn:Win32OperatingSystem::PerformanceData
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
   123
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
   124
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
   125
Win32OperatingSystem::PerformanceData::Abstract subclass:#Process
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   126
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   127
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   128
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   129
	privateIn:Win32OperatingSystem::PerformanceData
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
   130
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
   131
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
   132
Win32OperatingSystem::PerformanceData::Abstract subclass:#Processor
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   133
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   134
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   135
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   136
	privateIn:Win32OperatingSystem::PerformanceData
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
   137
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
   138
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   139
ByteArray variableByteSubclass:#PrinterInfo2Structure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   140
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   141
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   142
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   143
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   144
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   145
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
   146
Object subclass:#RegistryEntry
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
   147
	instanceVariableNames:'path handle isNew'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   148
	classVariableNames:'Lobby HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   149
		HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   150
		HKEY_DYN_DATA HKEY_PERFORMANCE_TEXT HKEY_PERFORMANCE_NLSTEXT'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   151
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   152
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   153
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   154
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   155
ByteArray variableByteSubclass:#TextMetricsStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   156
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   157
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   158
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   159
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   160
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   161
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   162
Win32Handle subclass:#Win32ChangeNotificationHandle
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   163
	instanceVariableNames:''
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   164
	classVariableNames:'Lobby'
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   165
	poolDictionaries:''
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   166
	privateIn:Win32OperatingSystem
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   167
!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
   168
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
   169
Win32Handle subclass:#Win32IOHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   170
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   171
	classVariableNames:'Lobby'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   172
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   173
	privateIn:Win32OperatingSystem
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
   174
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
   175
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   176
Win32Handle subclass:#Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   177
	instanceVariableNames:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   178
	classVariableNames:'ScopeMappingTable TypeMappingTable DisplayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   179
		UsageMappingTable'
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   180
	poolDictionaries:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   181
	privateIn:Win32OperatingSystem
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   182
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   183
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   184
Object subclass:#NetworkResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   185
	instanceVariableNames:'scope type usage displayType remoteName localName provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   186
		comment'
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   187
	classVariableNames:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   188
	poolDictionaries:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   189
	privateIn:Win32OperatingSystem::Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   190
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   191
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   192
Win32Handle subclass:#Win32PrinterHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   193
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   194
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   195
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   196
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   197
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   198
9255
fded804fe4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9249
diff changeset
   199
Win32Handle subclass:#Win32ProcessHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   200
	instanceVariableNames:'pid'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   201
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   202
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   203
	privateIn:Win32OperatingSystem
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
   204
!
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
   205
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
   206
Win32OperatingSystem::Win32IOHandle subclass:#Win32SerialPortHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   207
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   208
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   209
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   210
	privateIn:Win32OperatingSystem
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
   211
!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
   212
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
   213
Win32OperatingSystem::Win32IOHandle subclass:#Win32SocketHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   214
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   215
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   216
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   217
	privateIn:Win32OperatingSystem
9092
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   218
!
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   219
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   220
ByteArray variableByteSubclass:#WinPointStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   221
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   222
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   223
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   224
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   225
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   226
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   227
!Win32OperatingSystem primitiveDefinitions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   228
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   229
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
   230
# define WINVER 0x0500   /*required for CoInitializeEx*/
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
   231
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
   232
#include "stxOSDefs.h"
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
   233
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
   234
#define USE_H_ERRNO
6095
fd28101edf09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5922
diff changeset
   235
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
   236
# if defined(i386) || defined(__i386__)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   237
#  ifndef _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   238
#   define _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   239
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   240
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   241
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   242
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   243
 * notice: although many systems' include files
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   244
 * already block against multiple inclusion, some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   245
 * do not. Therefore, this is done here again.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   246
 * (it does not hurt)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   247
 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   248
# ifndef _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   249
#  include <signal.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   250
#  define _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   251
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   252
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   253
# ifndef _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   254
#  include <sys/types.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   255
#  define _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   256
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   257
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   258
# ifndef _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   259
#  include <time.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   260
#  define _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   261
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   262
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   263
# ifndef _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   264
#  include <sys/timeb.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   265
#  define _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   266
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   267
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   268
# ifndef _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   269
#  include <sys/stat.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   270
#  define _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   271
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   272
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   273
# ifndef _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   274
#  include <errno.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   275
#  define _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   276
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   277
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   278
# ifndef _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   279
#  include <stdio.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   280
#  define _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   281
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   283
# ifndef _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   284
#  include <fcntl.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   285
#  define _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   286
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   287
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   288
// # define PROCESSDEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   289
// # define PROCESS1DEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   290
// # define PROCESS2DEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   291
// # define PROCESSDEBUG_CHILDPROCESSWAIT
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   292
// # define SELECTDEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   293
// # define SELECT1DEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   294
// # define SELECT2DEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   295
// # define WAITDEBUGWIN32
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
   296
// # define SIGNALDEBUGWIN32
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   297
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   298
# undef INT
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   299
# undef UINT
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   300
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   301
# undef Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   302
# undef Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   303
# undef Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   304
# undef Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   305
# undef Rectangle
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   306
# undef Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   307
# undef String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   308
# undef Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   309
# undef Object
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   310
# undef Class
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   311
# undef Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   312
# undef Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   313
# undef Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   314
# undef Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   315
# undef Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   316
# undef Delay
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   317
# undef Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   318
# undef Process
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   319
# undef NameSpace
10341
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   320
# undef Processor
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   321
# undef String
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   322
# undef Character
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   323
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   324
# include <stdarg.h> /* */
9092
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   325
7531
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   326
# ifndef WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   327
#  define WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   328
#  include <windows.h>
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   329
# endif
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   330
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   331
# ifndef TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   332
#  define TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   333
#  include <TLHELP32.h>         /* to get all processes in system */
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   334
#endif
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   335
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   336
# ifndef NO_GETADAPTERSINFO
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   337
#  include <iphlpapi.h>
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   338
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   339
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   340
# ifndef WINDOWSX_H_INCLUDED
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   341
#  define WINDOWSX_H_INCLUDED
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   342
#  include <windowsx.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   343
# endif
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   344
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   345
# define _WIN32_DCOM     /*required for CoInitializeEx*/
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   346
# include <objbase.h>    //for COM
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   347
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   348
# include <shlobj.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   349
# include <objbase.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   350
# include <initguid.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   351
# ifndef _STRING_H_INCLUDED_
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   352
#  define _STRING_H_INCLUDED_
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   353
#  include <string.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   354
# endif
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   355
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   356
# ifdef __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   357
#  define Array __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   358
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   359
# ifdef __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   360
#  define Number __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   361
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   362
# ifdef __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   363
#  define Method __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   364
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   365
# ifdef __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   366
#  define Point __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   367
# endif
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   368
# ifdef __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   369
#  define Rectangle __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   370
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   371
# ifdef __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   372
#  define Block __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   373
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   374
# ifdef __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   375
#  define String __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   376
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   377
# ifdef __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   378
#  define Message __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   379
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   380
# ifdef __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   381
#  define Object __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   382
# endif
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   383
# ifndef __DEF_Class
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   384
#  define Class __DEF_Class
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   385
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   386
# ifdef __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   387
#  define Context __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   388
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   389
# ifdef __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   390
#  define Date __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   391
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   392
# ifdef __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   393
#  define Time __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   394
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   395
# ifdef __DEF_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   396
#  define Set __DEF_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   397
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   398
# ifdef __DEF_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   399
#  define Signal __DEF_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   400
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   401
# ifdef __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   402
#  define Delay __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   403
# endif
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   404
# ifdef __DEF_Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   405
#  define Message __DEF_Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   406
# endif
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   407
# ifdef __DEF_Process
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   408
#  define Process __DEF_Process
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   409
# endif
10341
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   410
# ifdef __DEF_Processor
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   411
#  define Processor __DEF_Processor
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   412
# endif
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   413
# ifdef __DEF_NameSpace
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   414
#  define NameSpace __DEF_NameSpace
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   415
# endif
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   416
# ifdef __DEF_String
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   417
#  define String __DEF_String
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   418
# endif
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   419
# ifdef __DEF_Character
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   420
#  define Character __DEF_Character
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   421
# endif
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   422
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   423
# define INT STX_INT
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   424
# define UINT STX_UINT
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   425
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   426
typedef int (*intf)(int);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   427
BOOL __signalUserInterruptWIN32(DWORD sig);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   428
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   429
# if defined (HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   430
#  ifndef _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   431
#   include <locale.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   432
#   define _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   433
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   434
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   435
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   436
# ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   437
#  include <dir.h>
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   438
#  define xMAXPATHLEN MAXPATH
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   439
#  define MAXFILELEN MAXFILE
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   440
14740
609c0c77a4c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14731
diff changeset
   441
#  if 0
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   442
OBJ _SEND0(OBJ, OBJ, OBJ, inlineCachePtr);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   443
OBJ _SEND1(OBJ, OBJ, OBJ, inlineCachePtr, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   444
OBJ _SEND2(OBJ, OBJ, OBJ, inlineCachePtr, OBJ, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   445
OBJ _SEND3(OBJ, OBJ, OBJ, inlineCachePtr, OBJ, OBJ, OBJ);
14740
609c0c77a4c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14731
diff changeset
   446
#  endif
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   447
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   448
# endif /* BORLANDC */
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   450
# ifndef __BORLANDC__
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   451
#   define chmod _chmod
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   452
# endif /* not BORLANDC */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   453
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   454
# ifndef MAXPATHLEN
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   455
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   456
#  ifdef FILENAME_MAX
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   457
#   define xMAXPATHLEN FILENAME_MAX
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   458
#  endif
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   459
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   460
#  ifndef MAXPATHLEN
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   461
#   define MAXPATHLEN 1024
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   462
#  endif
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   463
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   464
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   465
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   466
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   467
 * sigaction dummies (you won't believe these call themself ``POSIX'' systems ...)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   468
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   469
# ifndef SA_RESTART
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   470
#  define SA_RESTART    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   471
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   472
# ifndef SA_SIGINFO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   473
#  define SA_SIGINFO    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   474
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   475
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   476
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   477
#  include <sys/wait.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   478
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   479
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   480
# if defined(HAS_SYSINFO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   481
#  include <sys/systeminfo.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   482
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   483
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   484
# ifndef __BORLANDC__
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   485
#  ifndef COINIT_MULTITHREADED
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   486
#   define COINIT_MULTITHREADED 0x0
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   487
#  endif
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   488
# endif
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   489
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   490
#define SIGHANDLER_ARG int
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   491
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   492
#define _HANDLEVal(o)        (HANDLE)(__externalAddressVal(o))
14636
26765f6a6b11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
   493
#define _SETHANDLEVal(o, v)  (__externalAddressVal(o) = (v))
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   494
15871
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   495
#if defined(__BORLANDC__)
18548
1a1879f23a05 Mingw fixes
Stefan Vogel <sv@exept.de>
parents: 18543
diff changeset
   496
HANDLE _get_osfhandle(int);     // not for MINGW!
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
   497
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
   498
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
   499
#if defined(__BORLANDC__) || !defined(TOKEN_EXECUTE)
15871
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   500
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   501
typedef enum _TOKEN_ELEVATION_TYPE {
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   502
    TokenElevationTypeDefault = 1,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   503
    TokenElevationTypeFull,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   504
    TokenElevationTypeLimited,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   505
} TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   506
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   507
typedef struct _TOKEN_ELEVATION {
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   508
    DWORD TokenIsElevated;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   509
} TOKEN_ELEVATION, *PTOKEN_ELEVATION;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   510
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   511
typedef enum _TOKEN_INFORMATION_CLASS_V2 {
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   512
    nTokenUser = 1,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   513
    nTokenGroups,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   514
    nTokenPrivileges,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   515
    nTokenOwner,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   516
    nTokenPrimaryGroup,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   517
    nTokenDefaultDacl,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   518
    nTokenSource,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   519
    nTokenType,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   520
    nTokenImpersonationLevel,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   521
    nTokenStatistics,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   522
    nTokenRestrictedSids,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   523
    nTokenSessionId,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   524
    nTokenGroupsAndPrivileges,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   525
    nTokenSessionReference,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   526
    nTokenSandBoxInert,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   527
    nTokenAuditPolicy,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   528
    nTokenOrigin,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   529
    nTokenElevationType,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   530
    nTokenLinkedToken,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   531
    nTokenElevation,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   532
    nTokenHasRestrictions,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   533
    nTokenAccessInformation,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   534
    nTokenVirtualizationAllowed,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   535
    nTokenVirtualizationEnabled,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   536
    nTokenIntegrityLevel,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   537
    nTokenUIAccess,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   538
    nTokenMandatoryPolicy,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   539
    nTokenLogonSid,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   540
    nMaxTokenInfoClass  // MaxTokenInfoClass should always be the last enum
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   541
} TOKEN_INFORMATION_CLASS_V2, *PTOKEN_INFORMATION_CLASS_V2;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   542
# define TokenElevationType (TOKEN_INFORMATION_CLASS)nTokenElevationType
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   543
# define TokenElevation     (TOKEN_INFORMATION_CLASS)nTokenElevation
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
   544
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
   545
#endif /* BORLAND */
15871
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   546
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   547
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   548
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   549
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   550
!Win32OperatingSystem primitiveVariables!
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   551
%{
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   552
static int coInitialized = 0;
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   553
%}
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   554
! !
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   555
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   556
!Win32OperatingSystem primitiveFunctions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   557
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   558
#define __wait wait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   559
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   560
static int
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
   561
_canAccessIOWithoutBlocking (HANDLE handle, int readMode)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   562
{
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   563
    struct timeval tv;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   564
    fd_set         fds;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   565
    int            n;
10454
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   566
    int winErrNo;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   567
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
   568
    FD_ZERO(&fds);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
   569
    FD_SET (handle, &fds);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   570
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   571
    tv.tv_sec  = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   572
    tv.tv_usec = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   573
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   574
    if (readMode) {
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   575
	n = select (1 , &fds, NULL, NULL, &tv);  // first parameter to select is ignored in windows
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   576
    } else {
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   577
	n = select (1, NULL, &fds, NULL, &tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   578
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   579
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   580
    if (n == 0) {
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   581
	return (0);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   582
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   583
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   584
    if (n > 0) {
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   585
	return (FD_ISSET(handle, &fds) ? 1 : 0);
10454
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   586
    }
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   587
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   588
    winErrNo = WSAGetLastError();
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   589
    switch (winErrNo) {
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   590
	case WSAENOTSOCK:
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   591
	    if (readMode) {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   592
		DWORD  w = 0;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   593
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   594
		if (PeekNamedPipe (handle, 0, 0, 0, & w, 0)) {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   595
		    return (w > 0);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   596
		}
10458
678c2c39488f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10454
diff changeset
   597
#if 0
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   598
		console_fprintf(stderr, "_canAccessIOWithoutBlocking non Socket\n");
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   599
#endif
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   600
		return (-1);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   601
	    }
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   602
	    /* in writeMode we return always true for none-sockets */
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   603
	    return (1);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   604
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   605
	case WSAEINPROGRESS:
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   606
	case WSAEWOULDBLOCK:
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   607
	    return (0);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   608
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   609
	default:
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   610
	    console_fprintf(stderr, "_canAccessIOWithoutBlocking -> %d (0x%x)\n", winErrNo, winErrNo);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   611
	    return (-1);
10454
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   612
    }
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   613
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   614
    /* not reached */
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   615
    return (0);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   616
}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   617
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   618
#define _canReadWithoutBlocking(fd)     _canAccessIOWithoutBlocking(fd, 1)
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   619
#define _canWriteWithoutBlocking(fd)    _canAccessIOWithoutBlocking(fd, 0)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   620
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   621
/*
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   622
 * Attention: some API calls are not available on old NT4.0/W95/W98
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   623
 * For those, the dll does not include the calls directly, but tries to
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   624
 * load the library and looks what we get.
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   625
 * Here are support functions to load the libs.
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   626
 */
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   627
static FARPROC
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   628
__get_functionAddress(HINSTANCE *pLibHandle, char *libraryName, char *functionName)
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   629
{
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   630
    FARPROC entry;
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   631
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   632
    if (*pLibHandle == NULL) {
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   633
	*pLibHandle = LoadLibrary(libraryName);
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   634
    }
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   635
    entry = GetProcAddress(*pLibHandle, functionName);
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   636
    return entry;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   637
}
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   638
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   639
static FARPROC
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   640
__get_kernel32_functionAddress(char *functionName)
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   641
{
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   642
    static HINSTANCE libHandle = NULL;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   643
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   644
    return __get_functionAddress(&libHandle, "kernel32.DLL", functionName);
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   645
}
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   646
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   647
static FARPROC
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   648
__get_iphlpapi_functionAddress(functionName)
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   649
    char *functionName;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   650
{
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   651
    static HINSTANCE libHandle = NULL;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   652
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   653
    return __get_functionAddress(&libHandle, "iphlpapi.DLL", functionName);
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   654
}
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   655
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   656
static FARPROC
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   657
__get_ole32_functionAddress(functionName)
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   658
    char *functionName;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   659
{
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   660
    static HINSTANCE libHandle = NULL;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   661
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   662
    return __get_functionAddress(&libHandle, "ole32.DLL", functionName);
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   663
}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   664
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   665
#if 0
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   666
// original: biased for 1.1.1601
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   667
// obsolete...
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   668
OBJ
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   669
FileTimeToOsTime(LPFILETIME pft)
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   670
{
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   671
    LONGLONG lTime = ((LONGLONG)pft->dwHighDateTime << 32) + pft->dwLowDateTime;
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   672
    lTime = (lTime / 10000);    // convert multiple of 100ns to milliseconds
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   673
#if __POINTER_SIZE__ == 8
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   674
    return(__MKUINT(lTime));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   675
#else
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   676
    return(__MKLARGEINT64(1, (unsigned INT)(lTime & 0xFFFFFFFF), (unsigned INT)(lTime >> 32)));
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   677
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   678
}
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   679
#endif
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   680
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   681
// biased for 1.1.1970
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   682
// (renamed to catch references from other classes)
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   683
OBJ
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   684
FileTimeToOsTime1970(LPFILETIME pft)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   685
{
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   686
    LONGLONG lTime = ((LONGLONG)pft->dwHighDateTime << 32) + pft->dwLowDateTime;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   687
    lTime = (lTime / 10000);    // convert multiple of 100ns to milliseconds
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   688
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   689
#if __POINTER_SIZE__ == 8
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   690
    lTime -= 11644473600000LL;  // the number of millis from 1.1.1601 to 1.1.1970
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   691
    return(__MKINT(lTime));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   692
#else
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
   693
    if (lTime >= (LONGLONG)11644473600000L) {
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
   694
	lTime -= (LONGLONG)11644473600000L;  // the number of millis from 1.1.1601 to 1.1.1970
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   695
	return(__MKLARGEINT64(1, (unsigned INT)(lTime & 0xFFFFFFFF), (unsigned INT)(lTime >> 32)));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   696
    } else {
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
   697
	lTime = (LONGLONG)11644473600000L - lTime;
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   698
	return(__MKLARGEINT64(-1, (unsigned INT)(lTime & 0xFFFFFFFF), (unsigned INT)(lTime >> 32)));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   699
    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
   700
#endif
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   701
}
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   702
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   703
#if 0
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   704
// obsolete; biased for 1.1.1601
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   705
int
16948
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
   706
OsTimeToFileTime(OBJ tLow, OBJ tHigh, LPFILETIME pft) {
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   707
    LONGLONG lTime;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   708
    UINT low = __unsignedLongIntVal(tLow);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   709
    UINT hi = __unsignedLongIntVal(tHigh);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   710
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   711
    if (hi == 0 && !__isSmallInteger(tHigh))
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   712
	return(0);      // conversion error
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   713
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   714
    lTime = ((LONGLONG)hi << 32) + (LONGLONG)low;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   715
    lTime = lTime * 10000;      // convert to multiple of 100ns
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
   716
16951
cf9c2837afb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16948
diff changeset
   717
    pft->dwHighDateTime = (UINT)(lTime >> 32);
cf9c2837afb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16948
diff changeset
   718
    pft->dwLowDateTime = (UINT)(lTime & 0xFFFFFFFF);
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
   719
    return(1);
16948
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
   720
}
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   721
#endif
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   722
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   723
// biased for 1.1.1970
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   724
// renamed to catch any references from other classes.
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   725
int
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   726
OsTime1970ToFileTime(OBJ tLow, OBJ tHigh, LPFILETIME pft) {
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   727
    LONGLONG lTime;
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   728
    UINT low = __unsignedLongIntVal(tLow);
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   729
    UINT hi = __unsignedLongIntVal(tHigh);
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   730
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   731
    if (hi == 0 && !__isSmallInteger(tHigh))
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   732
	return(0);      // conversion error
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   733
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   734
    lTime = ((LONGLONG)hi << 32) + (LONGLONG)low;
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   735
    lTime += 11644473600000LL;  // rebias to 1.1.1601
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   736
    lTime = lTime * 10000;      // convert to multiple of 100ns
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   737
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   738
    pft->dwHighDateTime = (UINT)(lTime >> 32);
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   739
    pft->dwLowDateTime = (UINT)(lTime & 0xFFFFFFFF);
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   740
    return(1);
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
   741
}
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   742
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   743
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   744
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   745
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   746
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   747
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   748
copyright
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   749
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   750
 COPYRIGHT (c) 1988 by Claus Gittinger
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   751
 COPYRIGHT (c) 1998-2004 by eXept Software AG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   752
	      All Rights Reserved
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   753
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   754
 This software is furnished under a license and may be used
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   755
 only in accordance with the terms of that license and with the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   756
 inclusion of the above copyright notice.   This software may not
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   757
 be provided or otherwise made available to, or used by, any
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   758
 other person.  No title to or ownership of the software is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   759
 hereby transferred.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   760
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   761
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   762
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   763
documentation
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   764
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   765
    this class resulted from extracting WIN32 specifics of the old
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   766
    OperatingSystemClass into this sub-class.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   767
    You may find some leftover unix stuff, which will go away sooner
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   768
    or later.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   769
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   770
    this class realizes access to most (all ?) required operating system services;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   771
    some of it is very specific for unix, so do not depend on
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   772
    things available here in your applications
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   773
    - some may not be found in other OS's or be slightly different ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   774
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   775
    (On the other hand: I do not want to hide all features
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   776
     from you - in some situations it MAY be interesting to be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   777
     able to get down to a select or fork system call easily (at least on Unix systems).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   778
     You decide - portability vs. functionality)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   779
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   780
    [Class variables:]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   781
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   782
	HostName        <String>        remembered hostname
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   783
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   784
	DomainName      <String>        remembered domainname
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   785
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   786
	CurrentDirectory <String>       remembered currentDirectories path
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   787
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   788
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   789
	Claus Gittinger (initial version & cleanup)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   790
	Manfred Dierolf (many features)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   791
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   792
    [see also:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   793
	OSProcessStatus
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   794
	Filename Date Time
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   795
	ExternalStream FileStream PipeStream Socket
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   796
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   797
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   798
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   799
examples
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   800
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   801
  various queries
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   802
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   803
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   804
	showCR:'hello ' , (OperatingSystem getLoginName)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   805
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   806
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   807
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   808
    OperatingSystem isUNIXlike ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   809
	Transcript showCR:'this is some UNIX-like OS'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   810
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   811
	Transcript showCR:'this OS is not UNIX-like'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   812
    ]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   813
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   814
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   815
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   816
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   817
	showCR:'this machine is called ' , OperatingSystem getHostName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   818
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   819
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   820
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   821
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   822
	showCR:('this machine is in the '
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   823
	       , OperatingSystem getDomainName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   824
	       , ' domain')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   825
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   826
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   827
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   828
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   829
	showCR:('this machine''s CPU is a '
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   830
	       , OperatingSystem getCPUType
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   831
	       )
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   832
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   833
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   834
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   835
    Transcript showCR:'executing ls command ...'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   836
    OperatingSystem executeCommand:'ls'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   837
    Transcript showCR:'... done.'.
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   838
								[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   839
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   840
  locking a file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   841
  (should be executed on two running smalltalks - not in two threads):
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   842
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   843
    |f|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   844
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   845
    f := 'testFile' asFilename readWriteStream.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   846
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   847
    10 timesRepeat:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   848
	'about to lock ...' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   849
	[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   850
	  OperatingSystem
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   851
	    lockFD:(f fileDescriptor)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   852
	    shared:false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   853
	    blocking:false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   854
	] whileFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   855
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   856
	    Delay waitForSeconds:1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   857
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   858
	'LOCKED ...' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   859
	Delay waitForSeconds:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   860
	'unlock ...' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   861
	(OperatingSystem
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   862
	    unlockFD:(f fileDescriptor)) printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   863
	Delay waitForSeconds:3.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   864
    ]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   865
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   866
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   867
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   868
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   869
!Win32OperatingSystem class methodsFor:'initialization'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   870
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   871
coInitialize
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   872
%{
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   873
    HRESULT hres;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   874
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   875
    if( ! coInitialized ) {
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
   876
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   877
	hres = CoInitializeEx(NULL, COINIT_MULTITHREADED);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   878
	if (! SUCCEEDED(hres)) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   879
	    console_fprintf(stderr, "OperatingSystem [info]: Could not open the COM library hres = %08x\n", hres );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   880
	    goto error;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   881
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   882
	coInitialized = 1;
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
   883
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   884
#ifdef COM_DEBUG
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
   885
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   886
	console_fprintf(stderr, "OperatingSystem [info]: COM initialized\n" );
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
   887
#endif
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   888
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   889
    RETURN (self );
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   890
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   891
error: ;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   892
%}.
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   893
    self primitiveFailed
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   894
!
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   895
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
   896
getOSVersion
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   897
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   898
    OSVERSIONINFO osvi;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   899
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   900
    memset(&osvi, 0, sizeof(OSVERSIONINFO));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   901
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   902
    GetVersionEx (&osvi);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   903
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
   904
    RETURN(__mkSmallInteger(osvi.dwPlatformId));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   905
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   906
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   907
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   908
initialize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   909
    "initialize the class"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   910
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   911
    "/ attention: must be ok to be called twice during startup.
16374
6d37c2c45365 fix typo in prev version
Stefan Vogel <sv@exept.de>
parents: 16367
diff changeset
   912
    Initialized isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   913
	Initialized := true.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   914
	ObjectMemory addDependent:self.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   915
	HostName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   916
	DomainName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   917
	LastErrorNumber := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   918
	PipeFailed := false.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   919
	self coInitialize.
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   920
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   921
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   922
    "Modified: 13.9.1997 / 10:47:32 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   923
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   924
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   925
update:something with:aParameter from:changedObject
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   926
    "catch image restart and flush some cached data"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   927
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   928
    something == #earlyRestart ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   929
	"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   930
	 flush cached data
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   931
	"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   932
	HostName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   933
	DomainName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   934
	LastErrorNumber := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   935
	PipeFailed := false.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   936
	self coInitialize.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   937
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   938
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   939
    "Modified: 22.4.1996 / 13:10:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   940
    "Created: 15.6.1996 / 15:22:37 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   941
    "Modified: 7.1.1997 / 19:36:11 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   942
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   943
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
   944
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   945
!Win32OperatingSystem class methodsFor:'OS signal constants'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   946
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   947
sigABRT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   948
    "return the signal number for SIGABRT - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   949
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   950
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   951
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   952
#ifdef SIGABRT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   953
    RETURN ( __mkSmallInteger(SIGABRT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   954
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   955
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   956
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   957
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   958
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   959
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   960
sigALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   961
    "return the signal number for SIGALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   962
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   964
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   965
#ifdef SIGALRM
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   966
    RETURN ( __mkSmallInteger(SIGALRM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   967
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   968
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   969
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   970
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   971
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   972
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   973
sigBREAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   974
    "return the signal number for SIGBREAK - 0 if not supported.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   975
     This is an MSDOS specific signal"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   976
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   977
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   978
#ifdef SIGBREAK
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   979
    RETURN ( __mkSmallInteger(SIGBREAK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   980
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   981
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   982
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   983
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   984
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   985
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   986
sigBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   987
    "return the signal number for SIGBUS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   988
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   989
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   990
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   991
#ifdef SIGBUS
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   992
    RETURN ( __mkSmallInteger(SIGBUS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   993
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   994
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   995
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   996
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   997
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   998
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   999
sigCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1000
    "return the signal number for SIGCHLD - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1001
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1003
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1004
#if defined(SIGCHLD)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1005
    RETURN ( __mkSmallInteger(SIGCHLD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1006
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1007
# if  defined(SIGCLD)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1008
    RETURN ( __mkSmallInteger(SIGCLD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1009
# else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1010
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1011
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1012
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1013
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1014
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1015
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1016
sigCONT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1017
    "return the signal number for SIGCONT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1018
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1019
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1020
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1021
#if defined(SIGCONT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1022
    RETURN ( __mkSmallInteger(SIGCONT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1023
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1024
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1025
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1026
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1027
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1028
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1029
sigDANGER
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1030
    "return the signal number for SIGDANGER - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1031
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1032
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1033
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1034
#if defined(SIGDANGER)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1035
    RETURN ( __mkSmallInteger(SIGDANGER) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1036
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1037
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1038
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1039
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1040
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1041
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1042
sigEMT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1043
    "return the signal number for SIGEMT - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1044
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1045
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1046
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1047
#ifdef SIGEMT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1048
    RETURN ( __mkSmallInteger(SIGEMT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1049
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1050
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1051
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1052
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1053
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1054
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1055
sigFP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1056
    "return the signal number for SIGFP - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1057
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1058
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1059
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1060
#ifdef SIGFPE
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1061
    RETURN ( __mkSmallInteger(SIGFPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1062
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1063
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1064
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1065
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1066
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1067
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1068
sigGRANT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1069
    "return the signal number for SIGGRANT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1070
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1071
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1072
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1073
#if defined(SIGGRANT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1074
    RETURN ( __mkSmallInteger(SIGGRANT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1075
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1076
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1077
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1078
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1079
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1080
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1081
sigHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1082
    "return the signal number for SIGHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1083
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1084
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1085
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1086
#ifdef SIGHUP
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1087
    RETURN ( __mkSmallInteger(SIGHUP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1088
#else
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  1089
    RETURN ( __mkSmallInteger(1) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1090
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1091
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1092
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1093
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1094
sigILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1095
    "return the signal number for SIGILL - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1096
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1097
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1098
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1099
#ifdef SIGILL
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1100
    RETURN ( __mkSmallInteger(SIGILL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1101
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1102
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1103
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1104
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1105
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1106
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1107
sigINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1108
    "return the signal number for SIGINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1109
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1110
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1111
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1112
#ifdef SIGINT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1113
    RETURN ( __mkSmallInteger(SIGINT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1114
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1115
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1116
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1117
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1118
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1119
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1120
sigIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1121
    "return the signal number for SIGIO - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1122
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1123
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1124
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1125
#if defined(SIGIO)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1126
    RETURN ( __mkSmallInteger(SIGIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1127
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1128
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1129
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1130
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1131
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1132
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1133
sigIOT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1134
    "return the signal number for SIGIOT - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1135
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1136
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1137
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1138
#ifdef SIGIOT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1139
    RETURN ( __mkSmallInteger(SIGIOT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1140
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1141
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1142
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1143
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1144
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1145
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1146
sigKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1147
    "return the signal number for SIGKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1148
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1150
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1151
#ifdef SIGKILL
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1152
    RETURN ( __mkSmallInteger(SIGKILL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1153
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1154
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1155
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1156
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1157
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1158
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1159
sigLOST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1160
    "return the signal number for SIGLOST - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1161
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1162
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1163
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1164
#if defined(SIGLOST)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1165
    RETURN ( __mkSmallInteger(SIGLOST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1166
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1167
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1168
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1169
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1170
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1171
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1172
sigMIGRATE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1173
    "return the signal number for SIGMIGRATE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1174
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1176
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1177
#if defined(SIGMIGRATE)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1178
    RETURN ( __mkSmallInteger(SIGMIGRATE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1179
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1180
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1181
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1182
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1183
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1184
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1185
sigMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1186
    "return the signal number for SIGMSG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1187
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1188
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1189
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1190
#if defined(SIGMSG)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1191
    RETURN ( __mkSmallInteger(SIGMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1192
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1193
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1194
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1195
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1196
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1197
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1198
sigPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1199
    "return the signal number for SIGPIPE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1200
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1201
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1202
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1203
#ifdef SIGPIPE
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1204
    RETURN ( __mkSmallInteger(SIGPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1205
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1206
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1207
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1208
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1209
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1210
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1211
sigPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1212
    "return the signal number for SIGPOLL - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1213
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1214
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1215
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1216
#if defined(SIGPOLL)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1217
    RETURN ( __mkSmallInteger(SIGPOLL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1218
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1219
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1220
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1221
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1222
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1224
sigPRE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1225
    "return the signal number for SIGPRE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1226
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1227
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1228
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1229
#if defined(SIGPRE)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1230
    RETURN ( __mkSmallInteger(SIGPRE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1231
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1232
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1233
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1234
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1235
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1236
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1237
sigPROF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1238
    "return the signal number for SIGPROF - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1239
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1240
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1241
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1242
#if defined(SIGPROF)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1243
    RETURN ( __mkSmallInteger(SIGPROF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1244
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1245
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1246
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1247
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1248
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1249
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1250
sigPWR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1251
    "return the signal number for SIGPWR - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1252
     (not available on all systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1253
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1254
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1255
#if defined(SIGPWR)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1256
    RETURN ( __mkSmallInteger(SIGPWR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1257
#else
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  1258
    RETURN ( __mkSmallInteger(30) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1259
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1260
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1261
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1262
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1263
sigQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1264
    "return the signal number for SIGQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1265
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1266
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1267
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1268
#ifdef SIGQUIT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1269
    RETURN ( __mkSmallInteger(SIGQUIT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1270
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1271
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1272
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1273
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1274
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1275
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1276
sigRETRACT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1277
    "return the signal number for SIGRETRACT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1278
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1279
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1280
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1281
#if defined(SIGRETRACT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1282
    RETURN ( __mkSmallInteger(SIGRETRACT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1283
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1284
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1285
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1286
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1287
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1288
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1289
sigSAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1290
    "return the signal number for SIGSAK - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1291
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1292
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1293
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1294
#if defined(SIGSAK)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1295
    RETURN ( __mkSmallInteger(SIGSAK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1296
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1297
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1298
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1299
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1300
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1301
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1302
sigSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1303
    "return the signal number for SIGSEGV - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1304
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1305
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1306
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1307
#ifdef SIGSEGV
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1308
    RETURN ( __mkSmallInteger(SIGSEGV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1309
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1310
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1311
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1312
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1313
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1314
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1315
sigSOUND
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1316
    "return the signal number for SIGSOUND - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1317
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1318
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1319
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1320
#if defined(SIGSOUND)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1321
    RETURN ( __mkSmallInteger(SIGSOUND) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1322
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1323
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1324
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1325
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1326
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1327
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1328
sigSTOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1329
    "return the signal number for SIGSTOP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1330
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1331
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1332
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1333
#if defined(SIGSTOP)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1334
    RETURN ( __mkSmallInteger(SIGSTOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1335
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1336
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1337
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1338
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1339
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1340
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1341
sigSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1342
    "return the signal number for SIGSYS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1343
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1344
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1345
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1346
#ifdef SIGSYS
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1347
    RETURN ( __mkSmallInteger(SIGSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1348
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1349
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1350
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1351
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1352
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1353
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1354
sigTERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1355
    "return the signal number for SIGTERM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1356
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1357
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1358
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1359
#ifdef SIGTERM
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1360
    RETURN ( __mkSmallInteger(SIGTERM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1361
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1362
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1363
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1364
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1365
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1366
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1367
sigTRAP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1368
    "return the signal number for SIGTRAP - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1369
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1370
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1371
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1372
#ifdef SIGTRAP
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1373
    RETURN ( __mkSmallInteger(SIGTRAP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1374
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1375
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1376
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1377
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1378
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1379
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1380
sigTSTP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1381
    "return the signal number for SIGTSTP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1382
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1383
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1384
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1385
#if defined(SIGTSTP)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1386
    RETURN ( __mkSmallInteger(SIGTSTP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1387
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1388
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1389
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1390
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1391
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1392
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1393
sigTTIN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1394
    "return the signal number for SIGTTIN - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1395
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1396
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1397
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1398
#if defined(SIGTTIN)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1399
    RETURN ( __mkSmallInteger(SIGTTIN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1400
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1401
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1402
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1403
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1404
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1405
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1406
sigTTOU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1407
    "return the signal number for SIGTTOU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1408
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1409
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1410
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1411
#if defined(SIGTTOU)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1412
    RETURN ( __mkSmallInteger(SIGTTOU) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1413
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1414
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1415
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1416
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1417
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1418
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1419
sigURG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1420
    "return the signal number for SIGURG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1421
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1422
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1423
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1424
#if defined(SIGURG)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1425
    RETURN ( __mkSmallInteger(SIGURG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1426
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1427
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1428
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1429
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1430
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1431
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1432
sigUSR1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1433
    "return the signal number for SIGUSR1 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1434
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1435
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1436
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1437
#if defined(SIGUSR1)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1438
    RETURN ( __mkSmallInteger(SIGUSR1) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1439
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1440
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1441
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1442
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1443
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1444
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1445
sigUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1446
    "return the signal number for SIGUSR2 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1447
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1448
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1449
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1450
#if defined(SIGUSR2)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1451
    RETURN ( __mkSmallInteger(SIGUSR2) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1452
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1453
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1454
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1455
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1456
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1457
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1458
sigVTALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1459
    "return the signal number for SIGVTALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1460
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1461
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1462
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1463
#if defined(SIGVTALRM)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1464
    RETURN ( __mkSmallInteger(SIGVTALRM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1465
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1466
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1467
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1468
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1469
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1470
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1471
sigWINCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1472
    "return the signal number for SIGWINCH - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1473
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1474
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1475
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1476
#if defined(SIGWINCH)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1477
    RETURN ( __mkSmallInteger(SIGWINCH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1478
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1479
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1480
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1481
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1482
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1483
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1484
sigXCPU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1485
    "return the signal number for SIGXCPU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1486
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1487
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1488
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1489
#if defined(SIGXCPU)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1490
    RETURN ( __mkSmallInteger(SIGXCPU) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1491
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1492
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1493
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1494
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1495
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1496
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1497
sigXFSZ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1498
    "return the signal number for SIGXFSZ - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1499
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1500
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1501
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1502
#if defined(SIGXFSZ)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1503
    RETURN ( __mkSmallInteger(SIGXFSZ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1504
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1505
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1506
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1507
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1508
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1509
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1510
!Win32OperatingSystem class methodsFor:'VM messages'!
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1511
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1512
win32LogFile
11513
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1513
    "return the name of the log file.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1514
     This is mostly used by standAlone apps, without a console,
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1515
     which write their log info into a file named xxx_log_xxx.log.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1516
     The default logFilename is defined be the make-build process, and
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1517
     can be overwritten by a command line argumen (--logFile). In order to
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1518
     provide access to that files path (for example, to open an editor on it),
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
  1519
     use this method to ask for the files name.
11513
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1520
     Returns nil, of nothing has been written to the logfile, yet.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1521
     Enforce a logFile, by doing an errorPrint or infoPrint first."
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1522
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1523
    |ret|
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1524
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1525
%{
11512
c6a1dc4bad14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11511
diff changeset
  1526
    extern char *__win32_getLogFilename();
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1527
    char *lp;
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1528
11512
c6a1dc4bad14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11511
diff changeset
  1529
    lp = __win32_getLogFilename();
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1530
    if (lp) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1531
	ret = __MKSTRING(lp);
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1532
    }
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1533
%}.
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1534
    ^ ret
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1535
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1536
    "
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1537
     Win32OperatingSystem win32LogFile
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1538
    "
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1539
!
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1540
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1541
win32LogFile:aFilenameOrNil
11513
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1542
    "change the file, into which log info is written.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1543
     This is mostly used by standAlone apps, without a console,
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1544
     which write their log info into a file named xxx_log_xxx.log"
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1545
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1546
    |logFilePath|
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1547
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1548
    aFilenameOrNil notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1549
	logFilePath := aFilenameOrNil asFilename pathName
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1550
    ].
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1551
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1552
%{
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1553
    extern void __win32_setLogFile();
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1554
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  1555
    if (__isStringLike(logFilePath)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1556
	__win32_setLogFile(__stringVal(logFilePath));
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1557
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1558
	__win32_setLogFile( NULL );
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1559
    }
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1560
%}
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1561
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1562
    "
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1563
     Win32OperatingSystem win32LogFile:'myLog.log'
9210
ed7cf7380224 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9209
diff changeset
  1564
     Win32OperatingSystem win32LogFile:nil
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1565
    "
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1566
! !
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1567
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1568
!Win32OperatingSystem class methodsFor:'accessing'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1569
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1570
performanceData
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  1571
    ^ PerformanceData
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1572
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1573
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1574
!Win32OperatingSystem class methodsFor:'clipboard'!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1575
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1576
clipboardContainsBitmap
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1577
	"Answer whether the clipboard contains a bitmap."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1578
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1579
    ^self clipboardContainsFormat: 2 "CfBitmap"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1580
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1581
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1582
clipboardContainsFormat: aCfConstant
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1583
	"Answer true if the clipboard contains data in
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1584
	 the format described by aCfConstant.  "
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1585
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1586
    ^self primIsClipboardFormatAvailable: aCfConstant
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1587
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1588
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1589
closeClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1590
    | result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1591
    result := self primCloseClipboard.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1592
    result ifFalse: [ ^self error].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1593
    ^result
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1594
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1595
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1596
emptyClipboard
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1597
	"Private - empty the clipboard. Note: it must be opened first."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1598
    | result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1599
    result := self primEmptyClipboard.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1600
    result ifFalse: [ ^self error].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1601
    ^result
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1602
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1603
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1604
getDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1605
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1606
    ^self primGetDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1607
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1608
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1609
openClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1610
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1611
    ^self openClipboard: self getDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1612
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1613
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1614
openClipboard: aHwnd
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1615
    | result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1616
    result := self primOpenClipboard: aHwnd.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1617
    result ifFalse: [ ^self error].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1618
    ^result
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1619
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1620
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1621
primCloseClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1622
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1623
    <apicall: bool "CloseClipboard" () module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1624
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1625
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1626
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1627
primEmptyClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1628
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1629
    <apicall: bool "EmptyClipboard" () module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1630
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1631
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1632
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1633
primGetDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1634
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1635
    <apicall: ulongReturn "GetDesktopWindow" () module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1636
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1637
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1638
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1639
primIsClipboardFormatAvailable: aCfConstant
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1640
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1641
    <apicall: boolean "IsClipboardFormatAvailable" (ulong) module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1642
     ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1643
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1644
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1645
primOpenClipboard: aHwnd
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1646
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1647
    <apicall: bool "OpenClipboard" (ulong) module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1648
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1649
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1650
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1651
primSetClipboardData: aCfConstant hMem: aMemHandle
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1652
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1653
    <apicall: ulongReturn "SetClipboardData" (ulong ulong) module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1654
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1655
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1656
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1657
setBitmapToClipboard: aBitmap
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1658
	"Copy aBitmap to the clipboard."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1659
    | handle |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1660
    aBitmap isNil ifTrue:[ ^nil ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1661
    aBitmap id isNil ifTrue:[aBitmap onDevice: Screen current].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1662
    handle := aBitmap id.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1663
    handle isNil ifTrue: [ ^nil ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1664
    self openClipboard ifFalse: [ ^nil ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1665
    self emptyClipboard.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1666
    self setClipboardData: 2 "CfBitmap" hMem: handle.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1667
    self closeClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1668
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1669
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1670
	self setBitmapToClipboard: Image fromUser
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1671
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1672
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1673
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1674
setClipboardData: aCfConstant hMem: aMemHandle
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1675
    |result|
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1676
    result := self primSetClipboardData: aCfConstant hMem: aMemHandle address.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1677
    result = 0 ifTrue: [ ^self error ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1678
! !
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  1679
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1680
!Win32OperatingSystem class methodsFor:'directory access'!
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1681
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1682
linkInfoFor:osPathname fileSize:fileSize fileAttributes:osFileAttributes osCrtTime:osCrtTime osAccTime:osAccTime osModTime:osModTime
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1683
    |type modeBits crtTime accTime modTime|
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1684
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1685
%{
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1686
    DWORD  __fileAttr = __unsignedLongIntVal( osFileAttributes );
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1687
    int    __modeBits = 0;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1688
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1689
    if (__fileAttr & FILE_ATTRIBUTE_DIRECTORY) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1690
	type = @symbol(directory);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1691
	__modeBits = 0777;   /* executable and WRITABLE - refer to comment in #isWritable: */
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1692
    } else if (__fileAttr & FILE_ATTRIBUTE_REPARSE_POINT) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1693
	type = @symbol(symbolicLink);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1694
	__modeBits = 0777;   /* even in UNIX symlinks have 0777 */
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1695
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1696
	type = @symbol(regular);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1697
	if (__fileAttr & FILE_ATTRIBUTE_READONLY) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1698
	    __modeBits = 0444;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1699
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1700
	    __modeBits = 0666;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1701
	}
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1702
    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1703
    modeBits = __mkSmallInteger(__modeBits);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1704
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1705
%}.
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1706
    osCrtTime isNil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1707
	ifTrue: [crtTime := Timestamp now]
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  1708
	ifFalse:[crtTime := Timestamp new fromOSTime:(osCrtTime "- OperatingSystem osTimeOf19700101 -- already done")].
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1709
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1710
    osAccTime isNil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1711
	ifTrue: [accTime := Timestamp now]
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  1712
	ifFalse:[accTime := Timestamp new fromOSTime:(osAccTime "- OperatingSystem osTimeOf19700101 -- already done")].
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1713
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1714
    osModTime isNil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1715
	ifTrue: [modTime := accTime]
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  1716
	ifFalse:[modTime := Timestamp new fromOSTime:(osModTime "- OperatingSystem osTimeOf19700101 -- already done")].
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1717
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1718
    ^ FileStatusInfo
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1719
		type:type
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1720
		mode:modeBits
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1721
		uid:nil
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1722
		gid:nil
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1723
		size:fileSize
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1724
		id:0
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1725
		accessed:accTime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1726
		modified:modTime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1727
		created:crtTime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1728
		sourcePath:osPathname
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1729
		fullName:nil
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1730
		alternativeName:nil.
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1731
!
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1732
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1733
nextLinkInfoFrom:aDirectoryStream dirPointer:dirPointer
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1734
    "return the next FileStatusInfo or nil at the end"
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1735
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1736
    |resultInfo error fileSize osPathname osModTime osCrtTime osAccTime osFileAttributes|
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1737
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1738
%{
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1739
    HANDLE d;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1740
    WIN32_FIND_DATAW data;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1741
    int rslt;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1742
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1743
    if ((dirPointer != nil)
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1744
    && __isExternalAddressLike(dirPointer)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1745
	// __INST(lastErrorNumber) = nil;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1746
	d = __externalAddressVal(dirPointer);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1747
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1748
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1749
	    __threadErrno = 0;
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  1750
	    rslt = (int)(STX_API_NOINT_CALL2( "FindNextFileW", FindNextFileW, d, &data ));
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1751
	} while ((rslt < 0) && (__threadErrno == EINTR));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1752
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1753
	if (rslt > 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1754
	    fileSize  = __MKLARGEINT64(1, data.nFileSizeLow, data.nFileSizeHigh);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1755
	    osPathname = __mkStringOrU16String_maxlen( data.cFileName, MAXPATHLEN );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1756
	    osFileAttributes = __mkSmallInteger( data.dwFileAttributes );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1757
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  1758
	    osCrtTime = FileTimeToOsTime1970(&data.ftCreationTime);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  1759
	    osAccTime = FileTimeToOsTime1970(&data.ftLastAccessTime);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  1760
	    osModTime = FileTimeToOsTime1970(&data.ftLastWriteTime);
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1761
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1762
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1763
	    error = __mkSmallInteger( __threadErrno );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1764
	}
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1765
    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1766
%}.
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1767
    (error notNil and:[error ~~ 0]) ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1768
	^ StreamIOError newException
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1769
	    errorCode:error;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1770
	    osErrorHolder:(OperatingSystem errorHolderForNumber:error);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1771
	    parameter:aDirectoryStream;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1772
	    raiseRequest
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1773
    ].
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1774
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1775
    osPathname isNil ifTrue:[^ nil].
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1776
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1777
    ^ self
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1778
	linkInfoFor:osPathname
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1779
	fileSize:fileSize
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1780
	fileAttributes:osFileAttributes
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1781
	osCrtTime:osCrtTime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1782
	osAccTime:osAccTime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1783
	osModTime:osModTime
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1784
! !
a7170033e17f directory access
ca
parents: 17169
diff changeset
  1785
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1786
!Win32OperatingSystem class methodsFor:'error messages'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1787
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1788
currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1789
    "returns the OS's last error nr (i.e. the value of errno).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1790
     Notice, that the value of this flag is only valid immediately
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1791
     after the error occurred - it gets updated with every other
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1792
     request to the OS.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1793
     Use lastErrorNumber - currentErrorNumber is invalidated by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1794
     many, many internal calls."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1795
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1796
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1797
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1798
     RETURN ( __mkSmallInteger(__threadErrno) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1799
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1800
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1801
      OperatingSystem currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1802
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1803
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1804
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1805
errorHolderForNumber:errNr
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  1806
    "return an osErrorHolder for the given error number (as returned by a system call)."
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1807
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1808
    |sym typ holder|
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1809
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1810
%{
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1811
    /* claus:
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1812
     * I made this primitive code, since errnos are not
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1813
     * standard across operating systems
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1814
     */
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1815
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  1816
    if (__isSmallInteger(errNr) || (__unsignedLongIntVal(errNr) > 0)) {
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  1817
      int __eno = __unsignedLongIntVal(errNr);
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1818
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1819
      if (__isWIN32Error(__eno)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1820
	switch (__eno & 0xFFFF) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1821
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1822
	     * WIN32 GetLastError returns
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1823
	     */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1824
	    case ERROR_INVALID_FUNCTION:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1825
		sym = @symbol(ERROR_INVALID_FUNCTION);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1826
		typ = @symbol(illegalOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1827
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1828
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1829
	    case ERROR_BAD_FORMAT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1830
		sym = @symbol(ERROR_BAD_FORMAT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1831
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1832
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1833
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1834
	    case ERROR_FILE_NOT_FOUND:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1835
		sym = @symbol(ERROR_FILE_NOT_FOUND);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1836
		typ = @symbol(nonexistentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1837
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1838
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1839
	    case ERROR_PATH_NOT_FOUND:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1840
		sym = @symbol(ERROR_PATH_NOT_FOUND);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1841
		typ = @symbol(nonexistentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1842
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1843
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1844
	    case ERROR_TOO_MANY_OPEN_FILES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1845
		sym = @symbol(ERROR_TOO_MANY_OPEN_FILES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1846
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1847
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1848
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1849
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1850
	     * what a nice errorCode - thats the most "useful" one I ever
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1851
	     * encountered ... (... those stupid micro-softies ...)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1852
	     */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1853
	    case ERROR_OPEN_FAILED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1854
		sym = @symbol(ERROR_OPEN_FAILED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1855
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1856
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1857
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1858
	    case ERROR_ACCESS_DENIED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1859
		sym = @symbol(ERROR_ACCESS_DENIED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1860
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1861
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1862
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1863
	    case ERROR_INVALID_HANDLE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1864
		sym = @symbol(ERROR_INVALID_HANDLE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1865
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1866
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1867
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1868
	    case ERROR_NOT_ENOUGH_MEMORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1869
		sym = @symbol(ERROR_NOT_ENOUGH_MEMORY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1870
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1871
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1872
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1873
	    case ERROR_NO_SYSTEM_RESOURCES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1874
		sym = @symbol(ERROR_NO_SYSTEM_RESOURCES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1875
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1876
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1877
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1878
	    case ERROR_NONPAGED_SYSTEM_RESOURCES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1879
		sym = @symbol(ERROR_NONPAGED_SYSTEM_RESOURCES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1880
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1881
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1882
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1883
	    case ERROR_PAGED_SYSTEM_RESOURCES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1884
		sym = @symbol(ERROR_PAGED_SYSTEM_RESOURCES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1885
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1886
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1887
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1888
	    case ERROR_INVALID_ACCESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1889
		sym = @symbol(ERROR_INVALID_ACCESS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1890
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1891
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1892
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1893
	    case ERROR_INVALID_DATA:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1894
		sym = @symbol(ERROR_INVALID_DATA);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1895
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1896
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1897
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1898
	    case ERROR_INVALID_NAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1899
		sym = @symbol(ERROR_INVALID_NAME);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1900
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1901
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1902
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1903
	    case ERROR_ARENA_TRASHED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1904
		sym = @symbol(ERROR_ARENA_TRASHED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1905
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1906
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1907
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1908
	    case ERROR_OUTOFMEMORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1909
		sym = @symbol(ERROR_OUTOFMEMORY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1910
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1911
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1912
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1913
	    case ERROR_BROKEN_PIPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1914
		sym = @symbol(ERROR_BROKEN_PIPE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1915
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1916
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1917
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1918
	    case ERROR_GEN_FAILURE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1919
		sym = @symbol(ERROR_GEN_FAILURE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1920
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1921
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1922
	    case ERROR_WRITE_PROTECT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1923
		sym = @symbol(ERROR_WRITE_PROTECT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1924
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1925
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1926
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1927
	    case ERROR_WRITE_FAULT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1928
		sym = @symbol(ERROR_WRITE_FAULT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1929
		typ = @symbol(transferFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1930
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1931
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1932
	    case ERROR_READ_FAULT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1933
		sym = @symbol(ERROR_READ_FAULT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1934
		typ = @symbol(transferFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1935
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1936
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1937
	    case ERROR_HANDLE_DISK_FULL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1938
		sym = @symbol(ERROR_HANDLE_DISK_FULL);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1939
		typ = @symbol(volumeFullSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1940
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1941
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1942
	    case ERROR_DISK_FULL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1943
		sym = @symbol(ERROR_DISK_FULL);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1944
		typ = @symbol(volumeFullSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1945
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1946
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1947
	    case ERROR_SHARING_VIOLATION:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1948
		sym = @symbol(ERROR_SHARING_VIOLATION);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1949
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1950
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1951
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1952
	    case ERROR_LOCK_VIOLATION:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1953
		sym = @symbol(ERROR_LOCK_VIOLATION);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1954
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1955
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1956
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1957
	    case ERROR_INVALID_PARAMETER:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1958
		sym = @symbol(ERROR_INVALID_PARAMETER);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1959
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1960
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1961
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1962
	    case ERROR_NET_WRITE_FAULT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1963
		sym = @symbol(ERROR_NET_WRITE_FAULT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1964
		typ = @symbol(transferFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1965
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1966
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1967
	    case ERROR_NOT_SUPPORTED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1968
		sym = @symbol(ERROR_NOT_SUPPORTED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1969
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1970
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1971
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1972
	    case ERROR_REM_NOT_LIST:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1973
		sym = @symbol(ERROR_REM_NOT_LIST);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1974
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1975
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1976
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1977
	    case ERROR_NETWORK_ACCESS_DENIED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1978
		sym = @symbol(ERROR_NETWORK_ACCESS_DENIED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1979
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1980
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1981
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1982
	    case ERROR_DUP_NAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1983
		sym = @symbol(ERROR_DUP_NAME);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1984
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1985
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1986
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1987
	    case ERROR_BAD_NETPATH:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1988
		sym = @symbol(ERROR_BAD_NETPATH);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1989
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1990
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1991
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1992
	    case ERROR_NETWORK_BUSY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1993
		sym = @symbol(ERROR_NETWORK_BUSY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1994
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1995
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1996
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1997
	    case ERROR_DRIVE_LOCKED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1998
		sym = @symbol(ERROR_DRIVE_LOCKED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  1999
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2000
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2001
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2002
	    case ERROR_INVALID_DRIVE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2003
		sym = @symbol(ERROR_INVALID_DRIVE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2004
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2005
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2006
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2007
	    case ERROR_WRONG_DISK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2008
		sym = @symbol(ERROR_WRONG_DISK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2009
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2010
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2011
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2012
	    case ERROR_CURRENT_DIRECTORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2013
		sym = @symbol(ERROR_CURRENT_DIRECTORY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2014
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2015
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2016
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2017
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2018
	     * what a nice errorCode - thats the most "useful" one I ever
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2019
	     * encountered ... (... those stupid micro-softies ...)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2020
	     */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2021
	    case ERROR_CANNOT_MAKE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2022
		sym = @symbol(ERROR_CANNOT_MAKE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2023
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2024
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2025
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2026
	    case ERROR_NO_MORE_FILES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2027
		sym = @symbol(ERROR_NO_MORE_FILES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2028
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2029
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2030
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2031
	    case ERROR_NOT_READY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2032
		sym = @symbol(ERROR_NOT_READY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2033
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2034
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2035
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2036
	    case ERROR_NOT_DOS_DISK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2037
		sym = @symbol(ERROR_NOT_DOS_DISK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2038
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2039
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2040
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2041
	    case ERROR_OUT_OF_PAPER:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2042
		sym = @symbol(ERROR_OUT_OF_PAPER);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2043
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2044
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2045
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2046
	    case ERROR_PRINTQ_FULL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2047
		sym = @symbol(ERROR_PRINTQ_FULL);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2048
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2049
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2050
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2051
	    case ERROR_FILE_EXISTS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2052
		sym = @symbol(ERROR_FILE_EXISTS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2053
		typ = @symbol(existingReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2054
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2055
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2056
	    default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2057
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2058
	}
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2059
      } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2060
	switch (__eno) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2061
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2062
	     * POSIX errnos - these should be defined
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2063
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2064
#ifdef EPERM
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2065
	    case EPERM:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2066
		sym = @symbol(EPERM);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2067
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2068
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2069
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2070
#ifdef ENOENT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2071
	    case ENOENT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2072
		sym = @symbol(ENOENT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2073
		typ = @symbol(nonexistentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2074
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2075
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2076
#ifdef ESRCH
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2077
	    case ESRCH:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2078
		sym = @symbol(ESRCH);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2079
		typ = @symbol(unavailableReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2080
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2081
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2082
#ifdef EINTR
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2083
	    case EINTR:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2084
		sym = @symbol(EINTR);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2085
		typ = @symbol(transientErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2086
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2087
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2088
#ifdef EIO
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2089
	    case EIO:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2090
		sym = @symbol(EIO);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2091
		typ = @symbol(transferFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2092
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2093
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2094
#ifdef ENXIO
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2095
	    case ENXIO:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2096
		sym = @symbol(ENXIO);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2097
		typ = @symbol(unavailableReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2098
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2099
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2100
#ifdef E2BIG
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2101
	    case E2BIG:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2102
		sym = @symbol(E2BIG);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2103
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2104
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2105
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2106
#ifdef ENOEXEC
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2107
	    case ENOEXEC:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2108
		sym = @symbol(ENOEXEC);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2109
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2110
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2111
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2112
#ifdef EBADF
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2113
	    case EBADF:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2114
		sym = @symbol(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2115
		typ = @symbol(badAccessorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2116
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2117
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2118
#ifdef ECHILD
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2119
	    case ECHILD:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2120
		sym = @symbol(ECHILD);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2121
		typ = @symbol(informationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2122
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2123
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2124
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2125
	    case EAGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2126
		sym = @symbol(EAGAIN);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2127
		typ = @symbol(notReadySignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2128
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2129
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2130
#ifdef ENOMEM
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2131
	    case ENOMEM:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2132
		sym = @symbol(ENOMEM);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2133
		typ = @symbol(noMemorySignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2134
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2135
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2136
#ifdef EACCES
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2137
	    case EACCES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2138
		sym = @symbol(EACCES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2139
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2140
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2141
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2142
#ifdef EFAULT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2143
	    case EFAULT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2144
		sym = @symbol(EFAULT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2145
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2146
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2147
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2148
#ifdef EBUSY
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2149
	    case EBUSY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2150
		sym = @symbol(EBUSY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2151
		typ = @symbol(unavailableReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2152
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2153
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2154
#ifdef EEXIST
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2155
	    case EEXIST:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2156
		sym = @symbol(EEXIST);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2157
		typ = @symbol(existingReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2158
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2159
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2160
#ifdef EXDEV
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2161
	    case EXDEV:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2162
		sym = @symbol(EXDEV);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2163
		typ = @symbol(inappropriateReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2164
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2165
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2166
#ifdef ENODEV
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2167
	    case ENODEV:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2168
		sym = @symbol(ENODEV);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2169
		typ = @symbol(inaccessibleSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2170
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2171
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2172
#ifdef ENOTDIR
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2173
	    case ENOTDIR:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2174
		sym = @symbol(ENOTDIR);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2175
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2176
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2177
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2178
#ifdef EISDIR
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2179
	    case EISDIR:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2180
		sym = @symbol(EISDIR);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2181
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2182
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2183
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2184
#ifdef EINVAL
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2185
	    case EINVAL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2186
		sym = @symbol(EINVAL);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2187
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2188
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2189
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2190
#ifdef ENFILE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2191
	    case ENFILE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2192
		sym = @symbol(ENFILE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2193
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2194
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2195
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2196
#ifdef EMFILE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2197
	    case EMFILE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2198
		sym = @symbol(EMFILE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2199
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2200
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2201
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2202
#ifdef ENOTTY
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2203
	    case ENOTTY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2204
		sym = @symbol(ENOTTY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2205
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2206
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2207
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2208
#ifdef EFBIG
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2209
	    case EFBIG:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2210
		sym = @symbol(EFBIG);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2211
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2212
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2213
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2214
#ifdef ENOSPC
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2215
	    case ENOSPC:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2216
		sym = @symbol(ENOSPC);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2217
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2218
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2219
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2220
#ifdef ESPIPE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2221
	    case ESPIPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2222
		sym = @symbol(ESPIPE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2223
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2224
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2225
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2226
#ifdef EROFS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2227
	    case EROFS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2228
		sym = @symbol(EROFS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2229
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2230
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2231
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2232
#ifdef EMLINK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2233
	    case EMLINK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2234
		sym = @symbol(EMLINK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2235
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2236
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2237
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2238
#ifdef EPIPE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2239
	    case EPIPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2240
		sym = @symbol(EPIPE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2241
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2242
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2243
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2244
#ifdef EDOM
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2245
	    case EDOM:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2246
		sym = @symbol(EDOM);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2247
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2248
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2249
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2250
#ifdef ERANGE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2251
	    case ERANGE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2252
		sym = @symbol(ERANGE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2253
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2254
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2255
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2256
#ifdef EDEADLK
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2257
# if EDEADLK != EWOULDBLOCK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2258
	    case EDEADLK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2259
		sym = @symbol(EDEADLK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2260
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2261
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2262
# endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2263
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2264
#ifdef ENAMETOOLONG
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2265
	    case ENAMETOOLONG:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2266
		sym = @symbol(ENAMETOOLONG);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2267
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2268
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2269
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2270
#ifdef ENOLCK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2271
	    case ENOLCK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2272
		sym = @symbol(ENOLCK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2273
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2274
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2275
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2276
#ifdef ENOSYS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2277
	    case ENOSYS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2278
		sym = @symbol(ENOSYS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2279
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2280
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2281
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2282
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2283
	    case ENOTEMPTY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2284
		sym = @symbol(ENOTEMPTY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2285
		typ = @symbol(inappropriateReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2286
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2287
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2288
#ifdef EILSEQ
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2289
	    case EILSEQ:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2290
		sym = @symbol(EILSEQ);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2291
		typ = @symbol(transferFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2292
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2293
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2294
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2295
	     * XPG3 errnos - defined on most systems
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2296
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2297
#ifdef ENOTBLK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2298
	    case ENOTBLK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2299
		sym = @symbol(ENOTBLK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2300
		typ = @symbol(inappropriateReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2301
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2302
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2303
#ifdef ETXTBSY
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2304
	    case ETXTBSY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2305
		sym = @symbol(ETXTBSY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2306
		typ = @symbol(inaccessibleSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2307
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2308
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2309
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2310
	     * some others
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2311
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2312
#ifdef EWOULDBLOCK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2313
	    case EWOULDBLOCK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2314
		sym = @symbol(EWOULDBLOCK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2315
		typ = @symbol(notReadySignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2316
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2317
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2318
#ifdef ENOMSG
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2319
	    case ENOMSG:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2320
		sym = @symbol(ENOMSG);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2321
		typ = @symbol(noDataSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2322
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2323
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2324
#ifdef ELOOP
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2325
	    case ELOOP:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2326
		sym = @symbol(ELOOP);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2327
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2328
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2329
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2330
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2331
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2332
	     * some stream errors
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2333
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2334
#ifdef ETIME
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2335
	    case ETIME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2336
		sym = @symbol(ETIME);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2337
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2338
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2339
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2340
#ifdef ENOSR
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2341
	    case ENOSR:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2342
		sym = @symbol(ENOSR);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2343
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2344
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2345
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2346
#ifdef ENOSTR
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2347
	    case ENOSTR:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2348
		sym = @symbol(ENOSTR);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2349
		typ = @symbol(inappropriateReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2350
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2351
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2352
#ifdef ECOMM
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2353
	    case ECOMM:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2354
		sym = @symbol(ECOMM);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2355
		typ = @symbol(transferFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2356
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2357
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2358
#ifdef EPROTO
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2359
	    case EPROTO:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2360
		sym = @symbol(EPROTO);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2361
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2362
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2363
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2364
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2365
	     * nfs errors
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2366
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2367
#ifdef ESTALE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2368
	    case ESTALE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2369
		sym = @symbol(ESTALE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2370
		typ = @symbol(unavailableReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2371
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2372
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2373
#ifdef EREMOTE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2374
	    case EREMOTE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2375
		sym = @symbol(EREMOTE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2376
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2377
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2378
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2379
	    /*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2380
	     * some networking errors
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2381
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2382
#ifdef EINPROGRESS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2383
	    case EINPROGRESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2384
		sym = @symbol(EINPROGRESS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2385
		typ = @symbol(operationStartedSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2386
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2387
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2388
#ifdef EALREADY
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2389
	    case EALREADY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2390
		sym = @symbol(EALREADY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2391
		typ = @symbol(operationStartedSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2392
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2393
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2394
#ifdef ENOTSOCK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2395
	    case ENOTSOCK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2396
		sym = @symbol(ENOTSOCK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2397
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2398
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2399
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2400
#ifdef EDESTADDRREQ
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2401
	    case EDESTADDRREQ:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2402
		sym = @symbol(EDESTADDRREQ);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2403
		typ = @symbol(underspecifiedSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2404
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2405
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2406
#ifdef EMSGSIZE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2407
	    case EMSGSIZE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2408
		sym = @symbol(EMSGSIZE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2409
		typ = @symbol(rangeErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2410
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2411
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2412
#ifdef EPROTOTYPE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2413
	    case EPROTOTYPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2414
		sym = @symbol(EPROTOTYPE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2415
		typ = @symbol(wrongSubtypeForOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2416
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2417
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2418
#ifdef ENOPROTOOPT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2419
	    case ENOPROTOOPT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2420
		sym = @symbol(ENOPROTOOPT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2421
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2422
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2423
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2424
#ifdef EPROTONOSUPPORT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2425
	    case EPROTONOSUPPORT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2426
		sym = @symbol(EPROTONOSUPPORT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2427
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2428
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2429
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2430
#ifdef ESOCKTNOSUPPORT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2431
	    case ESOCKTNOSUPPORT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2432
		sym = @symbol(ESOCKTNOSUPPORT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2433
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2434
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2435
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2436
#ifdef EOPNOTSUPP
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2437
	    case EOPNOTSUPP:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2438
		sym = @symbol(EOPNOTSUPP);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2439
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2440
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2441
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2442
#ifdef EPFNOSUPPORT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2443
	    case EPFNOSUPPORT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2444
		sym = @symbol(EPFNOSUPPORT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2445
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2446
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2447
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2448
#ifdef EAFNOSUPPORT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2449
	    case EAFNOSUPPORT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2450
		sym = @symbol(EAFNOSUPPORT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2451
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2452
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2453
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2454
#ifdef EADDRINUSE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2455
	    case EADDRINUSE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2456
		sym = @symbol(EADDRINUSE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2457
		typ = @symbol(existingReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2458
		break;
15816
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2459
#endif
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2460
#ifdef WSAEADDRINUSE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2461
	    case WSAEADDRINUSE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2462
		sym = @symbol(WSAEADDRINUSE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2463
		typ = @symbol(existingReferentSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2464
		break;
15816
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2465
#endif
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2466
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2467
#ifdef EADDRNOTAVAIL
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2468
	    case EADDRNOTAVAIL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2469
		sym = @symbol(EADDRNOTAVAIL);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2470
		typ = @symbol(noPermissionsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2471
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2472
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2473
#ifdef ETIMEDOUT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2474
	    case ETIMEDOUT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2475
		sym = @symbol(ETIMEDOUT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2476
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2477
		break;
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  2478
#endif
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  2479
#ifdef WSAETIMEDOUT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2480
	    case WSAETIMEDOUT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2481
		sym = @symbol(ETIMEDOUT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2482
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2483
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2484
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2485
#ifdef ECONNREFUSED
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2486
	    case ECONNREFUSED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2487
		sym = @symbol(ECONNREFUSED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2488
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2489
		break;
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  2490
#endif
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  2491
#ifdef WSAECONNREFUSED
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2492
	    case WSAECONNREFUSED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2493
		sym = @symbol(ECONNREFUSED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2494
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2495
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2496
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2497
#ifdef ENETDOWN
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2498
	    case ENETDOWN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2499
		sym = @symbol(ENETDOWN);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2500
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2501
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2502
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2503
#ifdef ENETUNREACH
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2504
	    case ENETUNREACH:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2505
		sym = @symbol(ENETUNREACH);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2506
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2507
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2508
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2509
#ifdef ENETRESET
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2510
	    case ENETRESET:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2511
		sym = @symbol(ENETRESET);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2512
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2513
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2514
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2515
#ifdef ECONNABORTED
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2516
	    case ECONNABORTED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2517
		sym = @symbol(ECONNABORTED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2518
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2519
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2520
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2521
#ifdef ECONNRESET
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2522
	    case ECONNRESET:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2523
		sym = @symbol(ECONNRESET);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2524
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2525
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2526
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2527
#ifdef EISCONN
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2528
	    case EISCONN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2529
		sym = @symbol(EISCONN);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2530
		typ = @symbol(unpreparedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2531
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2532
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2533
#ifdef ENOTCONN
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2534
	    case ENOTCONN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2535
		sym = @symbol(ENOTCONN);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2536
		typ = @symbol(unpreparedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2537
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2538
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2539
#ifdef ESHUTDOWN
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2540
	    case ESHUTDOWN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2541
		sym = @symbol(ESHUTDOWN);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2542
		typ = @symbol(unpreparedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2543
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2544
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2545
#ifdef EHOSTDOWN
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2546
	    case EHOSTDOWN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2547
		sym = @symbol(EHOSTDOWN);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2548
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2549
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2550
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2551
#ifdef EHOSTUNREACH
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2552
	    case EHOSTUNREACH:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2553
		sym = @symbol(EHOSTUNREACH);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2554
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2555
		break;
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  2556
#endif
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  2557
#ifdef WSAHOSTUNREACH
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2558
	    case WSAHOSTUNREACH:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2559
		sym = @symbol(EHOSTUNREACH);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2560
		typ = @symbol(peerFaultSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2561
		break;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2562
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2563
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2564
#ifdef WSAEFAULT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2565
	    case WSAEFAULT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2566
		sym = @symbol(WSAEFAULT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2567
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2568
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2569
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2570
#ifdef WSAEINTR
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2571
	    case WSAEINTR:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2572
		sym = @symbol(WSAEINTR);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2573
		typ = @symbol(transientErrorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2574
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2575
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2576
#ifdef WSAEBADF
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2577
	    case WSAEBADF:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2578
		sym = @symbol(WSAEBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2579
		typ = @symbol(badAccessorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2580
		break;
15816
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2581
#endif
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2582
#ifdef WSAEACCES
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2583
	    case WSAEACCES:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2584
		sym = @symbol(WSAEACCES);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2585
		typ = @symbol(badAccessorSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2586
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2587
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2588
#ifdef WSAEINVAL
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2589
	    case WSAEINVAL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2590
		sym = @symbol(WSAEINVAL);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2591
		typ = @symbol(invalidArgumentsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2592
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2593
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2594
#ifdef WSAEMFILE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2595
	    case WSAEMFILE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2596
		sym = @symbol(WSAEMFILE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2597
		typ = @symbol(noResourcesSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2598
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2599
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2600
#ifdef WSAEWOULDBLOCK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2601
	    case WSAEWOULDBLOCK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2602
		sym = @symbol(WSAEWOULDBLOCK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2603
		typ = @symbol(notReadySignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2604
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2605
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2606
#ifdef WSAEINPROGRESS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2607
	    case WSAEINPROGRESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2608
		sym = @symbol(WSAEINPROGRESS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2609
		typ = @symbol(operationStartedSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2610
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2611
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2612
#ifdef WSAEALREADY
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2613
	    case WSAEALREADY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2614
		sym = @symbol(WSAEALREADY);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2615
		typ = @symbol(operationStartedSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2616
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2617
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2618
#ifdef WSAENOTSOCK
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2619
	    case WSAENOTSOCK:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2620
		sym = @symbol(WSAENOTSOCK);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2621
		typ = @symbol(inappropriateOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2622
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2623
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2624
#ifdef WSAEPROTONOSUPPORT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2625
	    case WSAEPROTONOSUPPORT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2626
		sym = @symbol(WSAEPROTONOSUPPORT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2627
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2628
		break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2629
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2630
#ifdef WSAESOCKTNOSUPPORT
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2631
	    case WSAESOCKTNOSUPPORT:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2632
		sym = @symbol(WSAESOCKTNOSUPPORT);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2633
		typ = @symbol(unsupportedOperationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2634
		break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2635
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2636
#ifdef E_NOINTERFACE
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2637
	    case E_NOINTERFACE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2638
		sym = @symbol(E_NOINTERFACE);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2639
		typ = @symbol(noInterfaceSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2640
		break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2641
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2642
#ifdef CO_E_NOTINITIALIZED
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2643
	    case CO_E_NOTINITIALIZED:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2644
		sym = @symbol(CO_E_NOTINITIALIZED);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2645
		typ = @symbol(coNotInitializedSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2646
		break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2647
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2648
#ifdef REGDB_E_CLASSNOTREG
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2649
	    case REGDB_E_CLASSNOTREG:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2650
		sym = @symbol(REGDB_E_CLASSNOTREG);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2651
		typ = @symbol(classNotRegisteredSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2652
		break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2653
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2654
#ifdef CLASS_E_NOAGGREGATION
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2655
	    case CLASS_E_NOAGGREGATION:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2656
		sym = @symbol(CLASS_E_NOAGGREGATION);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2657
		typ = @symbol(noAggregationSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2658
		break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2659
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2660
#ifdef DISP_E_UNKNOWNNAME
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2661
	    case DISP_E_UNKNOWNNAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2662
		sym = @symbol(DISP_E_UNKNOWNNAME);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2663
		typ = @symbol(unknownNameSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2664
		break;
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2665
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2666
#ifdef OLEOBJ_E_NOVERBS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2667
	    case OLEOBJ_E_NOVERBS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2668
		sym = @symbol(OLEOBJ_E_NOVERBS);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2669
		typ = @symbol(noVerbsSignal);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2670
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2671
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2672
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2673
	    default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2674
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2675
	}
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2676
      }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2677
    }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2678
%}.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2679
    holder := OSErrorHolder new.
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2680
    sym isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2681
	sym := #ERROR_OTHER.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2682
	errNr notNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2683
	    "keep symbols as symbols"
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2684
	    holder parameter:(errNr isString ifTrue:[errNr] ifFalse:[errNr asString]).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2685
	].
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2686
    ].
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2687
    holder errorSymbol:sym errorCategory:(typ ? #defaultOsErrorSignal).
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2688
    ^ holder
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2689
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2690
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2691
    "
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2692
     OperatingSystem errorHolderForNumber:4
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2693
     OperatingSystem errorHolderForNumber:#badArgument
15464
032fb42505bf class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15414
diff changeset
  2694
     self errorHolderForNumber:16777296
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2695
     self errorHolderForNumber:(self errorNumberFor:#EPERM)
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2696
     self errorHolderForNumber:(self errorNumberFor:#EIO)
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2697
     self errorHolderForNumber:(self errorNumberFor:#ENXIO)
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2698
     self errorHolderForNumber:(self errorNumberFor:#E_NOINTERFACE)
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2699
    "
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2700
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2701
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2702
errorNumberFor:aSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2703
    "given a symbolic error, return the numeric;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2704
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2705
     Use this, since error numbers are really not standard across unix systems."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2706
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2707
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2708
    OBJ sym = aSymbol;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2709
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2710
    /*
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  2711
     * WIN32 GetLastError error codes - use __WIN32_ERR() to return the same as
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  2712
     * the smalltalk methods
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2713
     */
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2714
#ifdef ERROR_INVALID_FUNCTION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2715
    if (sym == @symbol(ERROR_INVALID_FUNCTION)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2716
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_FUNCTION)) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2717
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2718
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2719
#ifdef ERROR_BAD_FORMAT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2720
    if (sym == @symbol(ERROR_BAD_FORMAT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2721
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_BAD_FORMAT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2722
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2723
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2724
#ifdef ERROR_FILE_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2725
    if (sym == @symbol(ERROR_FILE_NOT_FOUND)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2726
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_FILE_NOT_FOUND)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2727
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2728
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2729
#ifdef ERROR_PATH_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2730
    if (sym == @symbol(ERROR_PATH_NOT_FOUND)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2731
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_PATH_NOT_FOUND)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2732
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2733
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2734
#ifdef ERROR_TOO_MANY_OPEN_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2735
    if (sym == @symbol(ERROR_TOO_MANY_OPEN_FILES)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2736
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_TOO_MANY_OPEN_FILES)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2737
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2738
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2739
#ifdef ERROR_OPEN_FAILED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2740
    if (sym == @symbol(ERROR_OPEN_FAILED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2741
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_OPEN_FAILED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2742
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2743
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2744
#ifdef ERROR_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2745
    if (sym == @symbol(ERROR_ACCESS_DENIED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2746
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_ACCESS_DENIED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2747
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2748
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2749
#ifdef ERROR_INVALID_HANDLE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2750
    if (sym == @symbol(ERROR_INVALID_HANDLE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2751
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_HANDLE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2752
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2753
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2754
#ifdef ERROR_NOT_ENOUGH_MEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2755
    if (sym == @symbol(ERROR_NOT_ENOUGH_MEMORY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2756
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_ENOUGH_MEMORY)));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2757
    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2758
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2759
#ifdef ERROR_NO_SYSTEM_RESOURCES
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2760
    if (sym == @symbol(ERROR_NO_SYSTEM_RESOURCES)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2761
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NO_SYSTEM_RESOURCES)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2762
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2763
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2764
#ifdef ERROR_INVALID_ACCESS
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2765
    if (sym == @symbol(ERROR_INVALID_ACCESS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2766
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_ACCESS)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2767
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2768
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2769
#ifdef ERROR_INVALID_DATA
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2770
    if (sym == @symbol(ERROR_INVALID_DATA)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2771
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_DATA)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2772
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2773
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2774
#ifdef ERROR_INVALID_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2775
    if (sym == @symbol(ERROR_INVALID_NAME)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2776
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_NAME)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2777
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2778
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2779
#ifdef ERROR_ARENA_TRASHED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2780
    if (sym == @symbol(ERROR_ARENA_TRASHED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2781
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_ARENA_TRASHED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2782
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2783
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2784
#ifdef ERROR_OUTOFMEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2785
    if (sym == @symbol(ERROR_OUTOFMEMORY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2786
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_OUTOFMEMORY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2787
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2788
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2789
#ifdef ERROR_BROKEN_PIPE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2790
    if (sym == @symbol(ERROR_BROKEN_PIPE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2791
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_BROKEN_PIPE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2792
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2793
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2794
#ifdef ERROR_GEN_FAILURE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2795
    if (sym == @symbol(ERROR_GEN_FAILURE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2796
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_GEN_FAILURE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2797
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2798
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2799
#ifdef ERROR_WRITE_PROTECT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2800
    if (sym == @symbol(ERROR_WRITE_PROTECT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2801
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_WRITE_PROTECT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2802
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2803
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2804
#ifdef ERROR_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2805
    if (sym == @symbol(ERROR_WRITE_FAULT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2806
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_WRITE_FAULT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2807
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2808
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2809
#ifdef ERROR_READ_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2810
    if (sym == @symbol(ERROR_READ_FAULT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2811
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_READ_FAULT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2812
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2813
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2814
#ifdef ERROR_HANDLE_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2815
    if (sym == @symbol(ERROR_HANDLE_DISK_FULL)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2816
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_HANDLE_DISK_FULL)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2817
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2818
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2819
#ifdef ERROR_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2820
    if (sym == @symbol(ERROR_DISK_FULL)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2821
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_DISK_FULL)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2822
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2823
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2824
#ifdef ERROR_ERROR_SHARING_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2825
    if (sym == @symbol(ERROR_ERROR_SHARING_VIOLATION)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2826
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_ERROR_SHARING_VIOLATION)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2827
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2828
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2829
#ifdef ERROR_LOCK_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2830
    if (sym == @symbol(ERROR_LOCK_VIOLATION)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2831
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_LOCK_VIOLATION)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2832
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2833
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2834
#ifdef ERROR_INVALID_PARAMETER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2835
    if (sym == @symbol(ERROR_INVALID_PARAMETER)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2836
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_PARAMETER)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2837
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2838
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2839
#ifdef ERROR_NET_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2840
    if (sym == @symbol(ERROR_NET_WRITE_FAULT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2841
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NET_WRITE_FAULT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2842
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2843
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2844
#ifdef ERROR_NOT_SUPPORTED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2845
    if (sym == @symbol(ERROR_NOT_SUPPORTED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2846
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_SUPPORTED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2847
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2848
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2849
#ifdef ERROR_REM_NOT_LIST
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2850
    if (sym == @symbol(ERROR_REM_NOT_LIST)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2851
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_REM_NOT_LIST)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2852
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2853
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2854
#ifdef ERROR_NETWORK_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2855
    if (sym == @symbol(ERROR_NETWORK_ACCESS_DENIED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2856
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NETWORK_ACCESS_DENIED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2857
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2858
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2859
#ifdef ERROR_DUP_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2860
    if (sym == @symbol(ERROR_DUP_NAME)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2861
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_DUP_NAME)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2862
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2863
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2864
#ifdef ERROR_BAD_NETPATH
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2865
    if (sym == @symbol(ERROR_BAD_NETPATH)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2866
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_BAD_NETPATH)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2867
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2868
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2869
#ifdef ERROR_NETWORK_BUSY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2870
    if (sym == @symbol(ERROR_NETWORK_BUSY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2871
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NETWORK_BUSY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2872
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2873
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2874
#ifdef ERROR_DRIVE_LOCKED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2875
    if (sym == @symbol(ERROR_DRIVE_LOCKED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2876
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_DRIVE_LOCKED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2877
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2878
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2879
#ifdef ERROR_INVALID_DRIVE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2880
    if (sym == @symbol(ERROR_INVALID_DRIVE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2881
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_DRIVE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2882
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2883
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2884
#ifdef ERROR_WRONG_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2885
    if (sym == @symbol(ERROR_WRONG_DISK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2886
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_WRONG_DISK)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2887
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2888
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2889
#ifdef ERROR_CURRENT_DIRECTORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2890
    if (sym == @symbol(ERROR_CURRENT_DIRECTORY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2891
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_CURRENT_DIRECTORY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2892
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2893
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2894
#ifdef ERROR_CANNOT_MAKE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2895
    if (sym == @symbol(ERROR_CANNOT_MAKE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2896
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_CANNOT_MAKE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2897
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2898
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2899
#ifdef ERROR_NO_MORE_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2900
    if (sym == @symbol(ERROR_NO_MORE_FILES)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2901
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NO_MORE_FILES)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2902
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2903
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2904
#ifdef ERROR_NOT_READY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2905
    if (sym == @symbol(ERROR_NOT_READY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2906
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_READY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2907
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2908
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2909
#ifdef ERROR_NOT_DOS_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2910
    if (sym == @symbol(ERROR_NOT_DOS_DISK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2911
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_DOS_DISK)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2912
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2913
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2914
#ifdef ERROR_OUT_OF_PAPER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2915
    if (sym == @symbol(ERROR_OUT_OF_PAPER)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2916
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_OUT_OF_PAPER)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2917
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2918
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2919
#ifdef ERROR_PRINTQ_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2920
    if (sym == @symbol(ERROR_PRINTQ_FULL)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2921
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_PRINTQ_FULL)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2922
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2923
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2924
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2925
    /*
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2926
     * POSIX errnos - these should be defined
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2927
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2928
#ifdef EPERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2929
    if (sym == @symbol(EPERM)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2930
	RETURN ( __mkSmallInteger(EPERM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2931
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2932
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2933
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2934
#ifdef ENOENT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2935
    if (sym == @symbol(ENOENT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2936
	RETURN ( __mkSmallInteger(ENOENT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2937
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2938
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2939
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2940
#ifdef ESRCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2941
    if (sym == @symbol(ESRCH)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2942
	RETURN ( __mkSmallInteger(ESRCH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2943
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2944
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2945
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2946
#ifdef EINTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2947
    if (sym == @symbol(EINTR)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2948
	RETURN ( __mkSmallInteger(EINTR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2949
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2950
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2951
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2952
#ifdef EIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2953
    if (sym == @symbol(EIO)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2954
	RETURN ( __mkSmallInteger(EIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2955
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2956
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2957
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2958
#ifdef ENXIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2959
    if (sym == @symbol(ENXIO)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2960
	RETURN ( __mkSmallInteger(ENXIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2961
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2962
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2964
#ifdef E2BIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2965
    if (sym == @symbol(E2BIG)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2966
	RETURN ( __mkSmallInteger(E2BIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2967
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2968
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2969
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2970
#ifdef ENOEXEC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2971
    if (sym == @symbol(ENOEXEC)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2972
	RETURN ( __mkSmallInteger(ENOEXEC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2973
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2974
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2975
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2976
#ifdef EBADF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2977
    if (sym == @symbol(EBADF)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2978
	RETURN ( __mkSmallInteger(EBADF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2979
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2980
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2981
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2982
#ifdef ECHILD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2983
    if (sym == @symbol(ECHILD)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2984
	RETURN ( __mkSmallInteger(ECHILD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2985
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2986
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2987
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2988
#if defined(EAGAIN)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2989
    if (sym == @symbol(EAGAIN)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2990
	RETURN ( __mkSmallInteger(EAGAIN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2991
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2992
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2993
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2994
#ifdef ENOMEM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2995
    if (sym == @symbol(ENOMEM)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  2996
	RETURN ( __mkSmallInteger(ENOMEM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2997
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2998
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2999
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3000
#ifdef EACCES
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3001
    if (sym == @symbol(EACCES)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3002
	RETURN ( __mkSmallInteger(EACCES) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3003
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3004
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3005
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3006
#ifdef EFAULT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3007
    if (sym == @symbol(EFAULT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3008
	RETURN ( __mkSmallInteger(EFAULT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3009
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3010
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3011
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3012
#ifdef EBUSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3013
    if (sym == @symbol(EBUSY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3014
	RETURN ( __mkSmallInteger(EBUSY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3015
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3016
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3017
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3018
#ifdef EXDEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3019
    if (sym == @symbol(EXDEV)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3020
	RETURN ( __mkSmallInteger(EXDEV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3021
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3022
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3023
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3024
#ifdef ENODEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3025
    if (sym == @symbol(ENODEV)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3026
	RETURN ( __mkSmallInteger(ENODEV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3027
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3028
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3029
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3030
#ifdef ENOTDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3031
    if (sym == @symbol(ENOTDIR)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3032
	RETURN ( __mkSmallInteger(ENOTDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3033
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3034
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3035
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3036
#ifdef EISDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3037
    if (sym == @symbol(EISDIR)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3038
	RETURN ( __mkSmallInteger(EISDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3039
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3040
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3041
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3042
#ifdef EINVAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3043
    if (sym == @symbol(EINVAL)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3044
	RETURN ( __mkSmallInteger(EINVAL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3045
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3046
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3047
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3048
#ifdef ENFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3049
    if (sym == @symbol(ENFILE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3050
	RETURN ( __mkSmallInteger(ENFILE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3051
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3052
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3053
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3054
#ifdef EMFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3055
    if (sym == @symbol(EMFILE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3056
	RETURN ( __mkSmallInteger(EMFILE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3057
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3058
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3059
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3060
#ifdef ENOTTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3061
    if (sym == @symbol(ENOTTY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3062
	RETURN ( __mkSmallInteger(ENOTTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3063
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3064
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3065
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3066
#ifdef EFBIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3067
    if (sym == @symbol(EFBIG)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3068
	RETURN ( __mkSmallInteger(EFBIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3069
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3070
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3071
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3072
#ifdef ENOSPC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3073
    if (sym == @symbol(ENOSPC)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3074
	RETURN ( __mkSmallInteger(ENOSPC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3075
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3076
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3077
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3078
#ifdef ESPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3079
    if (sym == @symbol(ESPIPE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3080
	RETURN ( __mkSmallInteger(ESPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3081
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3082
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3083
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3084
#ifdef EROFS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3085
    if (sym == @symbol(EROFS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3086
	RETURN ( __mkSmallInteger(EROFS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3087
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3088
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3089
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3090
#ifdef EMLINK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3091
    if (sym == @symbol(EMLINK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3092
	RETURN ( __mkSmallInteger(EMLINK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3093
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3094
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3095
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3096
#ifdef EPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3097
    if (sym == @symbol(EPIPE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3098
	RETURN ( __mkSmallInteger(EPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3099
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3100
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3101
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3102
#ifdef EDOM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3103
    if (sym == @symbol(EDOM)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3104
	RETURN ( __mkSmallInteger(EDOM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3105
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3106
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3107
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3108
#ifdef ERANGE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3109
    if (sym == @symbol(ERANGE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3110
	RETURN ( __mkSmallInteger(ERANGE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3111
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3112
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3113
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3114
#ifdef EDEADLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3115
    if (sym == @symbol(EDEADLK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3116
	RETURN ( __mkSmallInteger(EDEADLK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3117
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3118
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3119
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3120
#ifdef ENAMETOOLONG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3121
    if (sym == @symbol(ENAMETOOLONG)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3122
	RETURN ( __mkSmallInteger(ENAMETOOLONG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3123
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3124
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3125
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3126
#ifdef ENOLCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3127
    if (sym == @symbol(ENOLCK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3128
	RETURN ( __mkSmallInteger(ENOLCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3129
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3130
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3131
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3132
#ifdef ENOSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3133
    if (sym == @symbol(ENOSYS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3134
	RETURN ( __mkSmallInteger(ENOSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3135
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3136
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3137
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3138
#ifdef ENOTEMPTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3139
    if (sym == @symbol(ENOTEMPTY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3140
	RETURN ( __mkSmallInteger(ENOTEMPTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3141
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3142
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3143
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3144
#ifdef EEXIST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3145
    if (sym == @symbol(EEXIST)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3146
	RETURN ( __mkSmallInteger(EEXIST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3147
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3148
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3150
#ifdef EILSEQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3151
    if (sym == @symbol(EILSEQ)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3152
	RETURN ( __mkSmallInteger(EILSEQ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3153
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3154
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3156
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3157
     * XPG3 errnos - defined on most systems
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3158
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3159
#ifdef ENOTBLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3160
    if (sym == @symbol(ENOTBLK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3161
	RETURN ( __mkSmallInteger(ENOTBLK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3162
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3163
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3164
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3165
#ifdef ETXTBSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3166
    if (sym == @symbol(ETXTBSY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3167
	RETURN ( __mkSmallInteger(ETXTBSY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3168
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3169
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3170
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3171
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3172
     * some others
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3173
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3174
#ifdef EWOULDBLOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3175
    if (sym == @symbol(EWOULDBLOCK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3176
	RETURN ( __mkSmallInteger(EWOULDBLOCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3177
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3178
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3179
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3180
#ifdef ENOMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3181
    if (sym == @symbol(ENOMSG)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3182
	RETURN ( __mkSmallInteger(ENOMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3183
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3184
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3185
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3186
#ifdef ELOOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3187
    if (sym == @symbol(ELOOP)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3188
	RETURN ( __mkSmallInteger(ELOOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3189
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3190
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3191
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3192
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3193
     * some stream errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3194
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3195
#ifdef ETIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3196
    if (sym == @symbol(ETIME)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3197
	RETURN ( __mkSmallInteger(ETIME) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3198
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3199
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3201
#ifdef ENOSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3202
    if (sym == @symbol(ENOSR)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3203
	RETURN ( __mkSmallInteger(ENOSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3204
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3205
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3206
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3207
#ifdef ENOSTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3208
    if (sym == @symbol(ENOSTR)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3209
	RETURN ( __mkSmallInteger(ENOSTR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3210
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3211
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3212
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3213
#ifdef ECOMM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3214
    if (sym == @symbol(ECOMM)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3215
	RETURN ( __mkSmallInteger(ECOMM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3216
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3217
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3218
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3219
#ifdef EPROTO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3220
    if (sym == @symbol(EPROTO)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3221
	RETURN ( __mkSmallInteger(EPROTO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3222
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3223
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3224
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3225
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3226
     * nfs errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3227
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3228
#ifdef ESTALE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3229
    if (sym == @symbol(ESTALE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3230
	RETURN ( __mkSmallInteger(ESTALE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3231
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3232
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3233
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3234
#ifdef EREMOTE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3235
    if (sym == @symbol(EREMOTE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3236
	RETURN ( __mkSmallInteger(EREMOTE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3237
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3238
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3240
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3241
     * some networking errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3242
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3243
#ifdef EINPROGRESS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3244
    if (sym == @symbol(EINPROGRESS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3245
	RETURN ( __mkSmallInteger(EINPROGRESS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3246
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3247
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3248
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3249
#ifdef EALREADY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3250
    if (sym == @symbol(EALREADY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3251
	RETURN ( __mkSmallInteger(EALREADY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3252
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3253
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3254
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3255
#ifdef ENOTSOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3256
    if (sym == @symbol(ENOTSOCK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3257
	RETURN ( __mkSmallInteger(ENOTSOCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3258
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3259
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3260
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3261
#ifdef EDESTADDRREQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3262
    if (sym == @symbol(EDESTADDRREQ)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3263
	RETURN ( __mkSmallInteger(EDESTADDRREQ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3264
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3265
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3266
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3267
#ifdef EMSGSIZE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3268
    if (sym == @symbol(EMSGSIZE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3269
	RETURN ( __mkSmallInteger(EMSGSIZE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3270
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3271
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3272
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3273
#ifdef EPROTOTYPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3274
    if (sym == @symbol(EPROTOTYPE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3275
	RETURN ( __mkSmallInteger(EPROTOTYPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3276
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3277
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3278
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3279
#ifdef ENOPROTOOPT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3280
    if (sym == @symbol(ENOPROTOOPT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3281
	RETURN ( __mkSmallInteger(ENOPROTOOPT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3282
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3283
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3284
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3285
#ifdef EPROTONOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3286
    if (sym == @symbol(EPROTONOSUPPORT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3287
	RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3288
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3289
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3290
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3291
#ifdef ESOCKTNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3292
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3293
	RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3294
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3295
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3296
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3297
#ifdef EOPNOTSUPP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3298
    if (sym == @symbol(EOPNOTSUPP)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3299
	RETURN ( __mkSmallInteger(EOPNOTSUPP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3300
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3301
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3302
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3303
#ifdef EPFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3304
    if (sym == @symbol(EPFNOSUPPORT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3305
	RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3306
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3307
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3308
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3309
#ifdef EAFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3310
    if (sym == @symbol(EAFNOSUPPORT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3311
	RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3312
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3313
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3314
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3315
#ifdef EADDRINUSE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3316
    if (sym == @symbol(EADDRINUSE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3317
	RETURN ( __mkSmallInteger(EADDRINUSE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3318
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3319
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3320
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3321
#ifdef EADDRNOTAVAIL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3322
    if (sym == @symbol(EADDRNOTAVAIL)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3323
	RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3324
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3325
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3326
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3327
#ifdef ETIMEDOUT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3328
    if (sym == @symbol(ETIMEDOUT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3329
	RETURN ( __mkSmallInteger(ETIMEDOUT) );
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  3330
    }
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  3331
#endif
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  3332
#ifdef WSAETIMEDOUT
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
  3333
    if (sym == @symbol(ETIMEDOUT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3334
	RETURN ( __mkSmallInteger(WSAETIMEDOUT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3335
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3336
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3337
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3338
#ifdef ECONNREFUSED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3339
    if (sym == @symbol(ECONNREFUSED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3340
	RETURN ( __mkSmallInteger(ECONNREFUSED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3341
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3342
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3343
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3344
#ifdef ENETDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3345
    if (sym == @symbol(ENETDOWN)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3346
	RETURN ( __mkSmallInteger(ENETDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3347
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3348
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3349
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3350
#ifdef ENETUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3351
    if (sym == @symbol(ENETUNREACH)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3352
	RETURN ( __mkSmallInteger(ENETUNREACH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3353
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3354
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3355
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3356
#ifdef ENETRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3357
    if (sym == @symbol(ENETRESET)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3358
	RETURN ( __mkSmallInteger(ENETRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3359
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3360
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3361
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3362
#ifdef ECONNABORTED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3363
    if (sym == @symbol(ECONNABORTED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3364
	RETURN ( __mkSmallInteger(ECONNABORTED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3365
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3366
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3367
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3368
#ifdef ECONNRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3369
    if (sym == @symbol(ECONNRESET)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3370
	RETURN ( __mkSmallInteger(ECONNRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3371
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3372
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3373
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3374
#ifdef EISCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3375
    if (sym == @symbol(EISCONN)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3376
	RETURN ( __mkSmallInteger(EISCONN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3377
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3378
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3379
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3380
#ifdef ENOTCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3381
    if (sym == @symbol(ENOTCONN)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3382
	RETURN ( __mkSmallInteger(ENOTCONN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3383
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3384
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3385
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3386
#ifdef ESHUTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3387
    if (sym == @symbol(ESHUTDOWN)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3388
	RETURN ( __mkSmallInteger(ESHUTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3389
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3390
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3391
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3392
#ifdef EHOSTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3393
    if (sym == @symbol(EHOSTDOWN)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3394
	RETURN ( __mkSmallInteger(EHOSTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3395
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3396
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3397
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3398
#ifdef EHOSTUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3399
    if (sym == @symbol(EHOSTUNREACH)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3400
	RETURN ( __mkSmallInteger(EHOSTUNREACH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3401
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3402
#endif
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3403
    /*
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3404
     * windows socket errors
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3405
     */
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3406
#ifdef WSAEINTR
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3407
    if (sym == @symbol(WSAEINTR)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3408
	RETURN ( __mkSmallInteger(WSAEINTR) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3409
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3410
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3411
#ifdef WSAEBADF
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3412
    if (sym == @symbol(WSAEBADF)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3413
	RETURN ( __mkSmallInteger(WSAEBADF) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3414
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3415
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3416
#ifdef WSAEACCESS
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3417
    if (sym == @symbol(WSAEACCESS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3418
	RETURN ( __mkSmallInteger(WSAEACCESS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3419
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3420
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3421
#ifdef WSAEFAULT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3422
    if (sym == @symbol(WSAEFAULT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3423
	RETURN ( __mkSmallInteger(WSAEFAULT) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3424
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3425
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3426
#ifdef WSAEINVAL
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3427
    if (sym == @symbol(WSAEINVAL)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3428
	RETURN ( __mkSmallInteger(WSAEINVAL) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3429
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3430
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3431
#ifdef WSAEMFILE
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3432
    if (sym == @symbol(WSAEMFILE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3433
	RETURN ( __mkSmallInteger(WSAEMFILE) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3434
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3435
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3436
#ifdef WSAEWOULDBLOCK
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3437
    if (sym == @symbol(WSAEWOULDBLOCK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3438
	RETURN ( __mkSmallInteger(WSAEWOULDBLOCK) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3439
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3440
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3441
#ifdef WSAEINPROGRESS
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3442
    if (sym == @symbol(WSAEINPROGRESS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3443
	RETURN ( __mkSmallInteger(WSAEINPROGRESS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3444
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3445
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3446
#ifdef WSAEALREADY
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3447
    if (sym == @symbol(WSAEALREADY)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3448
	RETURN ( __mkSmallInteger(WSAEALREADY) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3449
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3450
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3451
#ifdef WSAENOTSOCK
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3452
    if (sym == @symbol(WSAENOTSOCK)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3453
	RETURN ( __mkSmallInteger(WSAENOTSOCK) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3454
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3455
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3456
#ifdef WSAEPROTONOSUPPORT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3457
    if (sym == @symbol(WSAEPROTONOSUPPORT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3458
	RETURN ( __mkSmallInteger(WSAEPROTONOSUPPORT) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3459
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3460
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3461
#ifdef WSAESOCKTNOSUPPORT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3462
    if (sym == @symbol(WSAESOCKTNOSUPPORT)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3463
	RETURN ( __mkSmallInteger(WSAESOCKTNOSUPPORT) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3464
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3465
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3466
#ifdef E_NOINTERFACE
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3467
    if (sym == @symbol(E_NOINTERFACE)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3468
	RETURN ( __MKUINT(E_NOINTERFACE) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3469
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3470
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3471
#ifdef CO_E_NOTINITIALIZED
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3472
    if (sym == @symbol(CO_E_NOTINITIALIZED)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3473
	RETURN ( __MKUINT(CO_E_NOTINITIALIZED) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3474
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3475
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3476
#ifdef REGDB_E_CLASSNOTREG
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3477
    if (sym == @symbol(REGDB_E_CLASSNOTREG)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3478
	RETURN ( __MKUINT(REGDB_E_CLASSNOTREG) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3479
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3480
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3481
#ifdef CLASS_E_NOAGGREGATION
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3482
    if (sym == @symbol(CLASS_E_NOAGGREGATION)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3483
	RETURN ( __MKUINT(CLASS_E_NOAGGREGATION) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3484
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3485
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3486
#ifdef DISP_E_UNKNOWNNAME
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3487
    if (sym == @symbol(DISP_E_UNKNOWNNAME)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3488
	RETURN ( __MKUINT(DISP_E_UNKNOWNNAME) );
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3489
    }
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3490
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3491
#ifdef OLEOBJ_E_NOVERBS
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3492
    if (sym == @symbol(OLEOBJ_E_NOVERBS)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  3493
	RETURN ( __MKUINT(OLEOBJ_E_NOVERBS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3494
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3495
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3496
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3497
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3498
    ^ -1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3499
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3500
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3501
!Win32OperatingSystem class methodsFor:'executing OS commands'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3502
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3503
canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3504
    "return true, if the OS can execute aCommand."
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3505
8800
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3506
"/    |fn|
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3507
"/
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3508
"/    fn := aCommandString asFilename.
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3509
"/    ( #('com' 'exe') includes:fn suffix) ifFalse:[^ false].
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3510
    ^ super canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3511
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3512
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3513
     OperatingSystem canExecuteCommand:'fooBar'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3514
     OperatingSystem canExecuteCommand:'ls'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3515
     OperatingSystem canExecuteCommand:'cvs'
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3516
     OperatingSystem canExecuteCommand:'diff'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3517
     OperatingSystem canExecuteCommand:'cvs.exe'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3518
     OperatingSystem canExecuteCommand:'C:\Dokumente und Einstellungen\penk\work\stx\projects\smalltalk\cvs.exe'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3519
     OperatingSystem canExecuteCommand:'C:\Windows\cvs.exe'
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
  3520
     OperatingSystem canExecuteCommand:'C:\Windows\system32\mspaint.exe'
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3521
    "
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3522
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3523
    "Created: 4.11.1995 / 19:13:54 / cg"
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3524
!
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3525
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3526
commandAndArgsForOSCommand:aCommandString
17521
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3527
    "get a shell and shell arguments for command execution.
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3528
     If aCommandString is a String, the commandString is passed to a shell for execution
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3529
     - see the description of 'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3530
     If aCommandString is an Array, the first element is the command to be executed,
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3531
     and the other elements are the arguments to the command. No shell is invoked in this case."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3532
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3533
    |shell args wDir cmdName path hasRedirection|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3534
17521
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3535
    aCommandString isNonByteCollection ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3536
	"easy: the caller does not want a shell to be executed"
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3537
	^ Array with:aCommandString first with:(aCommandString asStringWith:' ').
17521
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3538
    ].
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  3539
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3540
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3541
    "/ 'x:\WINNT\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3542
    "/ or 'x:\WINDOWS\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3543
    "/ or 'x:\WINDOWS\System\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3544
    "/ or whatever ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3545
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3546
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3547
    "/ to workaround a bug in win95's command.com
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3548
    "/ (which always returns a 0-exit code
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3549
    "/  - even if the command failed),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3550
    "/ Here, we see if the command is found along the path and
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3551
    "/ call it directly if found.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3552
    "/ If not found, assume its a builtIn or batch command
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3553
    "/ and pass it to command.com.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3554
    "/ Also use command.com, if any I/O redirection is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3555
    "/ involved, since that is (not yet) handled here.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3556
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3557
    "/ I know: this is a kludge but should work for now...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3558
    "/ ...this will change in an upcoming version to include
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3559
    "/ command.com command-line parsing here (sigh).
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3560
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3561
    hasRedirection := (aCommandString isNil or:[aCommandString includesAny:'<>|']).
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  3562
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  3563
    hasRedirection ifFalse:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3564
	"/ test whether the commandString is an executable;
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3565
	"/ then, no shell is required
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3566
	cmdName := aCommandString withoutSeparators.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3567
	(cmdName notEmpty and:[(cmdName startsWith:$") not]) ifTrue:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3568
	    |index file suffix|
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3569
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3570
	    index := cmdName indexOfSeparatorStartingAt:1.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3571
	    index ~~ 0 ifTrue:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3572
		args := cmdName copyFrom:(index+1).
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3573
		cmdName := cmdName copyFrom:1 to:(index-1).
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3574
	    ] ifFalse:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3575
		args := ''.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3576
	    ].
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3577
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3578
	    file   := cmdName asFilename.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3579
	    suffix := file suffix.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3580
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3581
	    suffix isEmptyOrNil ifTrue:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3582
		suffix := 'exe'.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3583
		file := file withSuffix:suffix.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3584
	    ].
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3585
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3586
	    (file exists and:[suffix = 'exe' or:[suffix = 'com']]) ifTrue:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3587
		"/ is an executable, no shell required
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3588
		path := file fullAlternativePathName.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3589
		^ Array with:path with:aCommandString.
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3590
"/                ^ Array with:path with:(path, ' ', args).
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3591
	    ].
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3592
	    path := self pathOfCommand:cmdName.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3593
	    path notNil ifTrue:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3594
		"/ is an executable, no shell required
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3595
		^ Array with:path with:aCommandString.
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3596
"/                ^ Array with:path with:(path, ' ', args).
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3597
	    ].
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3598
	].
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3599
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3600
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3601
    shell := self getEnvironment:'COMSPEC'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3602
    shell isNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3603
	wDir := self getWindowsSystemDirectory asFilename.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3604
	shell := #('cmd.exe' 'command.com') detect:[:eachCommand|
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3605
			(wDir / eachCommand) isExecutable
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3606
		    ] ifNone:[
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3607
			self error:'no cmd.exe available'.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3608
		    ].
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3609
	shell := (wDir / shell) pathName.
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3610
    ].
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3611
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3612
    aCommandString isEmptyOrNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  3613
	^ Array with:shell with:nil
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3614
    ].
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3615
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3616
    ^ Array with:shell with:(' /c "' , aCommandString, '"')
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3617
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3618
   "
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3619
     self commandAndArgsForOSCommand:'diff'
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3620
     self commandAndArgsForOSCommand:'dir/w'
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3621
     self commandAndArgsForOSCommand:'dir >nul:'
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3622
   "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3623
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3624
    "Modified: / 20-01-1998 / 16:57:19 / md"
10386
491685fba02e command execution (no need for command.com when executable
Claus Gittinger <cg@exept.de>
parents: 10373
diff changeset
  3625
    "Modified: / 11-02-2007 / 20:51:08 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3626
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3627
7080
a82683bc1843 Cleanup closeDescriptor handling in exec:withArguments:...
Stefan Vogel <sv@exept.de>
parents: 7077
diff changeset
  3628
exec:aCommandPath withArguments:argString environment:environment fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3629
    "Internal lowLevel entry for combined fork & exec for WIN32
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3630
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3631
     If fork is false (chain a command):
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3632
	 execute the OS command specified by the argument, aCommandPath, with
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3633
	 arguments in argArray (no arguments, if nil).
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3634
	 If successful, this method does not return and smalltalk is gone.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3635
	 If not successful, it does return.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3636
	 Normal use is with forkForCommand.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3637
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3638
     If fork is true (subprocess command execution):
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3639
	fork a child to do the above.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3640
	The Win32ProcessHandle of the child process is returned; nil if the fork failed.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3641
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3642
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3643
	fdArray[1] = 15 -> use fd 15 as stdin.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3644
	If an element of the array is set to nil, the corresponding filedescriptor
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3645
	will be closed for the child.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3646
	fdArray[0] == StdIn for child
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3647
	fdArray[1] == StdOut for child
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3648
	fdArray[2] == StdErr for child
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3649
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3650
     NOTE that in WIN32 the fds are HANDLES.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3651
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3652
     If newPgrp is true, the subprocess will be established in a new process group.
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3653
	The processgroup will be equal to id.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3654
	newPgrp is not used on WIN32 and VMS systems."
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3655
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3656
    |dirPath rslt|
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3657
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3658
    aDirectory notNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3659
	dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3660
	(dirPath endsWith:':') ifTrue:[
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3661
	    dirPath := dirPath , '\'.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3662
	].
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3663
    ].
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3664
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3665
    rslt := self
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3666
	primExec:aCommandPath
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3667
	commandLine:argString
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3668
	fileDescriptors:fdArray
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3669
	fork:doFork
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3670
	newPgrp:newPgrp
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3671
	inPath:dirPath
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3672
	createFlags:nil
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3673
	inheritHandles:true.
7841
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  3674
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  3675
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3676
    ^ rslt
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3677
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3678
    "Modified: / 31.1.1998 / 10:54:24 / md"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3679
    "Modified: / 15.5.1999 / 18:07:51 / cg"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3680
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3681
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3682
getStatusOfProcess:aProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3683
    "wait for a process to terminate and fetch its exit status.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3684
     This is required to avoid zombie processes."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3685
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3686
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3687
    DWORD endStatus;
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3688
    INT status = -1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3689
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3690
    if (__isExternalAddressLike(aProcessId)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3691
	HANDLE handle = _HANDLEVal(aProcessId);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3692
	if (handle) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3693
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3694
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3695
		__threadErrno = 0;
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3696
		endStatus = (INT)STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, handle, INFINITE);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3697
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3698
#else
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3699
	    endStatus = (INT)WaitForSingleObject(handle , INFINITE);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3700
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3701
	    if (endStatus != WAIT_FAILED) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3702
		if (GetExitCodeProcess(handle,&endStatus)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3703
		    status = endStatus;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3704
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3705
		    console_fprintf(stderr, "getexitcode status = %d\n",status);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3706
		} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3707
		    console_fprintf(stderr, "getexitcode failed.\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3708
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3709
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3710
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3711
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3712
	RETURN ( __mkSmallInteger(status));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3713
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3714
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3715
    self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3716
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3717
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3718
pathOfCommand:aCommand
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3719
    "find where aCommand's executable file is;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3720
     return its full pathName if there is such a command, otherwise
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3721
     return nil."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3722
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3723
    |cmdFile path rentry rpath f fExt|
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3724
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3725
    cmdFile := aCommand asFilename.
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3726
    cmdFile isAbsolute ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3727
	cmdFile exists ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3728
	    ^ aCommand
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3729
	].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3730
	^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3731
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3732
10334
6fe7d98b0c7b care for executable to be under a subdir (debug\stx.exe)
Claus Gittinger <cg@exept.de>
parents: 10311
diff changeset
  3733
    (aCommand includes:Filename separator) ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3734
	path := Filename currentDirectory construct:aCommand.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3735
	(path exists
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3736
	or:[ (path := path withSuffix:'com') exists
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3737
	or:[ (path := path withSuffix:'exe') exists ]]) ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3738
	    path isExecutable ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3739
		^ path pathName
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3740
	    ].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3741
	].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3742
	^ nil
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3743
    ].
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3744
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3745
    path := (self getEnvironment:'PATH') ? ''.
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  3746
    (rentry := self registryEntry key: 'HKEY_CURRENT_USER\Environment') notNil ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3747
	rpath := rentry valueNamed: 'PATH'.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3748
	rpath notNil ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3749
	    path := path , self pathSeparator , rpath
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3750
	].
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3751
    ].
13956
80a50d0484fb changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13954
diff changeset
  3752
    path := '.;',path.
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3753
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3754
    (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:eachDirectory |
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3755
	eachDirectory isEmpty ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3756
	    f := cmdFile
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3757
	] ifFalse:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3758
	    f := eachDirectory asFilename construct:aCommand.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3759
	].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3760
	f suffix isEmpty ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3761
	    self executableFileExtensions do:[:ext |
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3762
		ext notEmpty ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3763
		    fExt := (f pathName , '.' , ext) asFilename.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3764
		] ifFalse:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3765
		    fExt := f.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3766
		].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3767
		fExt isExecutable ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3768
		    ^ fExt pathName
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3769
		].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3770
	    ].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3771
	] ifFalse:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3772
	    f isExecutable ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3773
		^ f pathName
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3774
	    ].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3775
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3776
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3777
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3778
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3779
    "windows:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3780
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3781
     OperatingSystem pathOfCommand:'bcc32'
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3782
     OperatingSystem pathOfCommand:'diff'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  3783
     OperatingSystem pathOfCommand:'cvs'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  3784
     OperatingSystem pathOfCommand:'cvs.exe'
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3785
     OperatingSystem pathOfCommand:'stx.exe'
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3786
     OperatingSystem pathOfCommand:'stx'
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3787
    "
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3788
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  3789
    "Modified: / 23-08-2011 / 21:11:47 / jv"
13956
80a50d0484fb changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13954
diff changeset
  3790
    "Modified: / 20-01-2012 / 13:32:55 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3791
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3792
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3793
primExec:commandPath commandLine:commandLine fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inPath:dirName createFlags:flagsOrNil inheritHandles:inheritHandles
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3794
    "Internal lowLevel entry for combined fork & exec for WIN32"
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3795
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3796
    |handle
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3797
	 commandPathUni16 commandLineUni16 dirNameUni16|
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3798
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3799
    handle := Win32ProcessHandle new.
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3800
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3801
    commandPathUni16 := commandPath.
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3802
    commandLineUni16 := commandLine.
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3803
    dirNameUni16 := dirName.
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3804
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3805
    commandPathUni16 notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3806
	commandPathUni16 := commandPathUni16 asUnicode16String.
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3807
    ].
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3808
    commandLineUni16 notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3809
	commandLineUni16 := commandLineUni16 asUnicode16String.
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3810
    ].
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3811
    dirNameUni16 notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3812
	dirNameUni16 := dirNameUni16 asUnicode16String.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3813
    ].
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3814
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3815
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3816
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3817
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3818
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3819
     * if fork is false, chain to another command (not yet supported)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3820
     * otherwise, spawn a subprocess and let it execute the command.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3821
     * Currently, only the forking version is supported (who chains anyway ?)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3822
     */
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3823
    int i, l; // i -> for iteration, l -> for length
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3824
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3825
    /*
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3826
     * CreateProcess supports 32767 characters/bytes including all variables and values
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3827
     * so take a good average for its arguments 4096
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3828
     * ATTENTION this value is also used hardcoded in the following code to check the length
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3829
     */
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3830
    wchar_t cmdPathW[4096];
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3831
    wchar_t cmdLineW[4096];
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3832
    wchar_t dirNameW[4096];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3833
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3834
    /*
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3835
     * pass pointers to CreateProcess
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3836
     * NULL pointers used to indicate no value
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3837
     * so only set the pointer if the value is valid
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3838
     */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3839
    wchar_t *cmdPathWP = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3840
    wchar_t *cmdLineWP = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3841
    wchar_t *dirNameWP = NULL;
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3842
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3843
    DWORD               fdwCreate = 0;
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3844
    STARTUPINFOW        lpsiStartInfo;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3845
    PROCESS_INFORMATION lppiProcInfo;
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3846
    SECURITY_ATTRIBUTES securityAttributes;
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3847
    SECURITY_DESCRIPTOR securityDescriptor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3848
19578
65f1cf4136a7 #BUGFIX by sr
sr
parents: 19532
diff changeset
  3849
    if ((__isUnicode16String(commandPathUni16) || (commandPathUni16 == nil)) && __isUnicode16String(commandLineUni16)) {
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3850
	HANDLE stdinHandle = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3851
	HANDLE stdoutHandle = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3852
	HANDLE stderrHandle = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3853
	int mustClose_stdinHandle = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3854
	int mustClose_stdoutHandle = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3855
	int mustClose_stderrHandle = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3856
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3857
	/*
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3858
	 * terminate the multi byte strings
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3859
	 */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3860
	// #commandPathUni16
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3861
	if (commandPathUni16 != nil) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3862
	    l = __unicode16StringSize(commandPathUni16);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3863
	    if (l >= 4096) { // >= need 1 space for terminator
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3864
		#ifdef PROCESSDEBUGWIN32
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3865
		console_fprintf(stderr, "argument #commandPathUni16 is to long\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3866
		#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3867
		RETURN(nil);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3868
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3869
	    for (i = 0; i < l; i++) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3870
		cmdPathW[i] = __unicode16StringVal(commandPathUni16)[i];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3871
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3872
	    cmdPathW[i] = 0; // set terminator
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3873
	    cmdPathWP = &cmdPathW[0];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3874
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3875
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3876
	// commandLineUni16
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3877
	l = __unicode16StringSize(commandLineUni16);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3878
	if (l >= 4096) { // >= need 1 space for terminator
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3879
	    #ifdef PROCESSDEBUGWIN32
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3880
	    console_fprintf(stderr, "argument #commandLineUni16 is to long\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3881
	    #endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3882
	    RETURN(nil);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3883
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3884
	for (i = 0; i < l; i++) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3885
	    cmdLineW[i] = __unicode16StringVal(commandLineUni16)[i];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3886
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3887
	cmdLineW[i] = 0; // set terminator
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3888
	cmdLineWP = &cmdLineW[0];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3889
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3890
	// #dirNameUni16
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3891
	if (__isUnicode16String(dirNameUni16)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3892
	    l = __unicode16StringSize(dirNameUni16);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3893
	    if (l >= 4096) { // >= need 1 space for terminator
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3894
		#ifdef PROCESSDEBUGWIN32
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3895
		console_fprintf(stderr, "argument #dirNameUni16 is to long\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3896
		#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3897
		RETURN(nil);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3898
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3899
	    for (i = 0; i < l; i++) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3900
		dirNameW[i] = __unicode16StringVal(dirNameUni16)[i];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3901
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3902
	    dirNameW[i] = 0; // set terminator
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3903
	    dirNameWP = &dirNameW[0];
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3904
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3905
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3906
	/*
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3907
	 * create descriptors as req'd
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3908
	 */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3909
	memset(&securityAttributes, 0, sizeof(securityAttributes));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3910
	securityAttributes.nLength = sizeof(securityAttributes);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3911
	securityAttributes.bInheritHandle = (inheritHandles == true) ? TRUE : FALSE;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3912
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3913
	InitializeSecurityDescriptor(&securityDescriptor, SECURITY_DESCRIPTOR_REVISION);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3914
	SetSecurityDescriptorDacl(&securityDescriptor, -1, 0, 0);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3915
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3916
	securityAttributes.lpSecurityDescriptor = &securityDescriptor;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3917
	memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3918
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3919
	memset(&lpsiStartInfo, 0, sizeof(lpsiStartInfo));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3920
	lpsiStartInfo.cb                = sizeof(lpsiStartInfo);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3921
	lpsiStartInfo.lpReserved        = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3922
	lpsiStartInfo.lpDesktop         = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3923
	lpsiStartInfo.lpTitle           = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3924
	lpsiStartInfo.dwX               = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3925
	lpsiStartInfo.dwY               = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3926
	lpsiStartInfo.dwXSize           = 100;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3927
	lpsiStartInfo.dwYSize           = 100;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3928
	lpsiStartInfo.dwXCountChars     = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3929
	lpsiStartInfo.dwYCountChars     = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3930
	lpsiStartInfo.dwFillAttribute   = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3931
	lpsiStartInfo.dwFlags           = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3932
	lpsiStartInfo.wShowWindow       = SW_HIDE /*SW_SHOWDEFAULT*/;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3933
	lpsiStartInfo.cbReserved2       = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3934
	lpsiStartInfo.lpReserved2       = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3935
	lpsiStartInfo.hStdInput         = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3936
	lpsiStartInfo.hStdOutput        = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3937
	lpsiStartInfo.hStdError         = NULL;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3938
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3939
	/*
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3940
	 * set create process flags
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3941
	 * if the flags arg is nil, use common defaults;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3942
	 * if non-nil, it must be a positive integer containing the fdwCreate bits.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3943
	 */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3944
	if (flagsOrNil != nil) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3945
	    fdwCreate = __longIntVal(flagsOrNil);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3946
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3947
	    fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3948
	    if (newPgrp == true) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3949
		fdwCreate |= CREATE_NEW_PROCESS_GROUP;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3950
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3951
	    fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3952
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3953
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3954
	if (fdArray == nil) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3955
	    stdinHandle  = (HANDLE) _get_osfhandle (0);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3956
	    stdoutHandle = (HANDLE) _get_osfhandle (1);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3957
	    stderrHandle  = (HANDLE) _get_osfhandle (2);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3958
	} else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3959
	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3960
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3961
		    stdinHandle = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3962
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3963
		    stdinHandle = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3964
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3965
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3966
	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3967
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3968
		    stdoutHandle = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3969
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3970
		    stdoutHandle = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3971
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3972
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3973
	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3974
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3975
		    stderrHandle  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3976
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3977
		    stderrHandle = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3978
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3979
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3980
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3981
	    console_fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3982
	}
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3983
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3984
#if defined(PROCESSDEBUGWIN32)
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3985
	console_fprintf(stderr, "stdin %x\n", stdinHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3986
	console_fprintf(stderr, "stdout %x\n", stdoutHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3987
	console_fprintf(stderr, "stderr %x\n", stderrHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3988
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3989
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3990
	{
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3991
	    HANDLE childHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3992
	    int sameHandle = (stdoutHandle == stderrHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3993
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3994
	    // these MUST be inheritable!
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3995
	    if (stdinHandle) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3996
#if 0
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3997
		if (SetHandleInformation(stdinHandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3998
		    // good
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  3999
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4000
		    console_fprintf(stderr, "Win32OS [warning]: SetHandleInformation failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4001
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4002
#else
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4003
		if (DuplicateHandle(GetCurrentProcess(), stdinHandle, GetCurrentProcess(),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4004
				      &childHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4005
		    stdinHandle = childHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4006
		    mustClose_stdinHandle = 1;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4007
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4008
		    console_fprintf(stderr, "Win32OS [warning]: duplicateHandle failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4009
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4010
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4011
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4012
	    if (stdoutHandle) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4013
#if 0
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4014
		if (SetHandleInformation(stdoutHandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4015
		    // good
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4016
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4017
		    console_fprintf(stderr, "Win32OS [warning]: SetHandleInformation failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4018
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4019
#else
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4020
		if (DuplicateHandle(GetCurrentProcess(), stdoutHandle, GetCurrentProcess(),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4021
				      &childHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4022
		    stdoutHandle = childHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4023
		    mustClose_stdoutHandle = 1;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4024
		} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4025
		    console_fprintf(stderr, "Win32OS [warning]: duplicateHandle failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4026
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4027
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4028
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4029
	    if (stderrHandle) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4030
		if (sameHandle) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4031
		    stderrHandle = stdoutHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4032
		} else {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4033
#if 0
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4034
		    if (SetHandleInformation(stderrHandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4035
			// good
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4036
		    } else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4037
			console_fprintf(stderr, "Win32OS [warning]: SetHandleInformation failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4038
		    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4039
#else
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4040
		    if (DuplicateHandle(GetCurrentProcess(), stderrHandle, GetCurrentProcess(),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4041
					  &childHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4042
			stderrHandle = childHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4043
			mustClose_stderrHandle = 1;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4044
		    } else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4045
			console_fprintf(stderr, "Win32OS [warning]: duplicateHandle failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4046
		    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4047
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4048
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4049
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4050
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4051
	lpsiStartInfo.hStdInput  = stdinHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4052
	lpsiStartInfo.hStdOutput = stdoutHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4053
	lpsiStartInfo.hStdError  = stderrHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4054
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4055
	if (doFork == true) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4056
#ifdef PROCESSDEBUGWIN32
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4057
	    console_fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4058
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4059
	    if (CreateProcessW( cmdPathWP,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4060
				cmdLineWP,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4061
				&securityAttributes, NULL /* &securityAttributes */,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4062
				securityAttributes.bInheritHandle,      /* inherit handles */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4063
				fdwCreate | CREATE_SUSPENDED,           /* resume after setting affinity */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4064
				NULL,                                   /* env */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4065
				dirNameWP,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4066
				&lpsiStartInfo,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4067
				&lppiProcInfo ))
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4068
	    {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4069
		DWORD_PTR processAffinityMask, systemAffinityMask;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4070
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4071
		/*
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4072
		 * Process was created suspended, now set the affinity mask
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4073
		 * to any processor, and resume the processes main thread.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4074
		 * (librun/process.s limited the affinity to a single processor).
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4075
		 */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4076
		GetProcessAffinityMask(lppiProcInfo.hProcess, &processAffinityMask, &systemAffinityMask);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4077
		SetProcessAffinityMask(lppiProcInfo.hProcess, systemAffinityMask);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4078
		if ((fdwCreate & CREATE_SUSPENDED) == 0) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4079
		    ResumeThread(lppiProcInfo.hThread);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4080
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4081
		CloseHandle(lppiProcInfo.hThread);
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4082
15547
088a34ccacb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15546
diff changeset
  4083
#if 0
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4084
		// only works with real console handles
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4085
		{
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4086
		    // change the child's stdIn (console) mode
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4087
		    DWORD mode = 0;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4088
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4089
		    if (! GetConsoleMode(stdinHandle, &mode)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4090
			console_fprintf(stderr, "Win32OS [warning]: GetConsoleMode failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4091
		    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4092
		    if (! SetConsoleMode(stdinHandle, mode & (~ENABLE_ECHO_INPUT))){
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4093
			console_fprintf(stderr, "Win32OS [warning]: SetConsoleMode failed in createProcess\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4094
		    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4095
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4096
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4097
		if (mustClose_stdinHandle) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4098
		    CloseHandle(stdinHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4099
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4100
		if (mustClose_stdoutHandle) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4101
		    CloseHandle(stdoutHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4102
		}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4103
		if (mustClose_stderrHandle) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4104
		    CloseHandle(stderrHandle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4105
		}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4106
#ifdef PROCESSDEBUGWIN32
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4107
		console_fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4108
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4109
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4110
		__externalAddressVal(handle) = lppiProcInfo.hProcess;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4111
		((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4112
		RETURN (handle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4113
	    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4114
#ifdef PROCESSDEBUGWIN32
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4115
	    console_fprintf(stderr, "created process error %d\n", GetLastError());
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4116
#endif
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4117
	    RETURN (nil);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4118
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4119
	    ; /* should never be called that way */
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  4120
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4121
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4122
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4123
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4124
     path-argument not string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4125
     or argArray not an array/nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4126
     or malloc failed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4127
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4128
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4129
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4130
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4131
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  4132
shellExecute:hwndArg lpOperation:lpOperationArg lpFile:lpFileArg lpParameters:lpParametersArg lpDirectory:lpDirectoryArg nShowCmd:nShowCmd
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4133
    "Opens or prints the specified file, which can be an executable, document file, or directory.
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4134
     If its a directory, an explorer window is opened (see example below).
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
  4135
     Can be used to open a browser or viewer on html-files, pdf-files etc.
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
  4136
     lpDirectory: the pathname string of the directory used for the command,
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4137
		  or nil for the current directory."
13159
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  4138
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  4139
    |errorNumber handle|
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  4140
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  4141
    handle := Win32ProcessHandle new.
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4142
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4143
%{
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4144
    SHELLEXECUTEINFO shExecInfo = {0};
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4145
    shExecInfo.cbSize = sizeof(shExecInfo);
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4146
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4147
    if (__isSmallInteger(nShowCmd)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4148
	shExecInfo.nShow = __intVal(nShowCmd);
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4149
    } else {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4150
	if (nShowCmd == @symbol(SW_SHOW)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4151
	    shExecInfo.nShow = SW_SHOW;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4152
	} else if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4153
	    shExecInfo.nShow = SW_SHOWNORMAL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4154
	} else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4155
	    shExecInfo.nShow = SW_SHOWDEFAULT;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4156
	} else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4157
	    shExecInfo.nShow = SW_SHOWMAXIMIZED;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4158
	} else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4159
	    shExecInfo.nShow = SW_SHOWMINIMIZED;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4160
	} else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4161
	    shExecInfo.nShow = SW_SHOWMINNOACTIVE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4162
	} else if (nShowCmd == @symbol(SW_SHOWNA)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4163
	    shExecInfo.nShow = SW_SHOWNA;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4164
	} else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4165
	    shExecInfo.nShow = SW_SHOWNOACTIVATE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4166
	} else if (nShowCmd == @symbol(SW_MAXIMIZE)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4167
	    shExecInfo.nShow = SW_MAXIMIZE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4168
	} else if (nShowCmd == @symbol(SW_RESTORE)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4169
	    shExecInfo.nShow = SW_RESTORE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4170
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4171
	    goto badArgument;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4172
	}
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4173
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  4174
    if (((lpOperationArg == nil) || __isStringLike(lpOperationArg))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  4175
     && ((lpFileArg == nil) || __isStringLike(lpFileArg))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  4176
     && ((lpParametersArg == nil) || __isStringLike(lpParametersArg))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  4177
     && ((lpDirectoryArg == nil) || __isStringLike(lpDirectoryArg))
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4178
    ) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4179
	// hProcess member receives the process handle
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4180
	shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4181
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4182
	shExecInfo.hwnd = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4183
	shExecInfo.lpVerb        = (lpOperationArg != nil) ? __stringVal(lpOperationArg) : NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4184
	shExecInfo.lpFile        = (lpFileArg != nil) ? __stringVal(lpFileArg) : NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4185
	shExecInfo.lpParameters  = (lpParametersArg != nil) ? __stringVal(lpParametersArg) : NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4186
	shExecInfo.lpDirectory   = (lpDirectoryArg != nil) ? __stringVal(lpDirectoryArg) : NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4187
	if (hwndArg != nil) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4188
	    if (__isExternalAddressLike(hwndArg)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4189
		shExecInfo.hwnd = (HANDLE)(__externalAddressVal(hwndArg));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4190
	    } else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4191
		goto badArgument;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4192
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4193
	if (ShellExecuteEx(&shExecInfo)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4194
	    if (shExecInfo.hProcess) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4195
		DWORD_PTR processAffinityMask, systemAffinityMask;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4196
		/*
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4197
		 * Set the affinity mask
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4198
		 * to any processor, and resume the processes main thread.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4199
		 * (librun/process.s limited the affinity to a single processor).
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4200
		 */
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4201
		GetProcessAffinityMask(shExecInfo.hProcess, &processAffinityMask, &systemAffinityMask);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4202
		SetProcessAffinityMask(shExecInfo.hProcess, systemAffinityMask);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4203
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4204
		// new (does not work, yet):
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4205
		// __externalAddressVal(handle) = shExecInfo.hProcess;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4206
		// RETURN (handle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4207
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4208
		// old:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4209
		CloseHandle(shExecInfo.hProcess);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4210
		RETURN (self); /* OK */
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4211
	    } else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4212
		RETURN (self); /* OK */
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4213
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4214
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4215
	    /* error */
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4216
	    errorNumber = __mkSmallInteger(__WIN32_ERR(GetLastError()));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4217
	}
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4218
    }
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4219
badArgument: ;
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4220
%}.
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4221
    errorNumber isNil ifTrue:[
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4222
	self primitiveFailed:'invalid argument(s)'.
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4223
    ] ifFalse:[
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4224
	(OperatingSystem errorHolderForNumber:errorNumber)
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4225
	    parameter:lpFileArg;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4226
	    reportError
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4227
    ].
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4228
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4229
    "
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4230
     self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4231
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4232
	lpOperation:'open'
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4233
	lpFile:(Filename currentDirectory pathName)
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4234
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4235
	lpDirectory:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4236
	nShowCmd:#SW_SHOWNORMAL
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4237
    self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4238
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4239
	lpOperation:'explore'
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4240
	lpFile:(Filename currentDirectory pathName)
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4241
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4242
	lpDirectory:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4243
	nShowCmd:#SW_SHOWNORMAL
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4244
    "
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4245
!
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  4246
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4247
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4248
    errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4249
    environment:anEvironmentDictionary inDirectory:dir
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4250
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4251
    "start executing the OS command as specified by the argument, aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4252
     as a separate process; do not wait for the command to finish.
17521
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4253
     If aCommandString is a String, the commandString is passed to a shell for execution
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4254
     - see the description of 'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4255
     If aCommandString is an Array, the first element is the command to be executed,
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4256
     and the other elements are the arguments to the command. No shell is invoked in this case.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4257
     The command gets stdIn, stdOut and stdErr assigned from the arguments;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4258
     each may be nil.
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  4259
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  4260
     Return the Win32ProcessHandle if successful, nil otherwise.
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  4261
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4262
     Use #monitorPid:action: for synchronization and exec status return,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4263
     or #killProcess: to stop it."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4264
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4265
    |shellAndArgs nullStream in out err rslt|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4266
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4267
    aCommandString isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4268
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4269
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4270
    (in := anExternalInStream) isNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4271
	nullStream := Filename nullDevice readWriteStream.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4272
	in := nullStream.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4273
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4274
    (out := anExternalOutStream) isNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4275
	nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4276
	out := nullStream.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4277
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4278
    (err := anExternalErrStream) isNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4279
	err := out
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4280
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4281
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4282
    rslt := self
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4283
	exec:(shellAndArgs at:1)
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4284
	withArguments:(shellAndArgs at:2)
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4285
	environment:anEvironmentDictionary
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4286
	fileDescriptors:(Array with:in fileHandle
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4287
			       with:out fileHandle
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4288
			       with:err fileHandle
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4289
			       with:(anAuxiliaryStream notNil ifTrue:[anAuxiliaryStream fileHandle] ifFalse:[nil]))
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4290
	fork:true
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4291
	newPgrp:true
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4292
	inDirectory:dir.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4293
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4294
    nullStream notNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4295
	nullStream close.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4296
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4297
    ^ rslt
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4298
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4299
    "blocking at current prio (i.e. only higher prio threads execute):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4300
17521
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4301
     OperatingSystem executeCommand:'dir > out'.
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4302
     OperatingSystem executeCommand:'tree /A' outputTo:Transcript.
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4303
     OperatingSystem executeCommand:#('c:\windows\system32\tree.com' '/A' '/F') outputTo:Transcript.
d6bc616e4dba class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17286
diff changeset
  4304
     OperatingSystem executeCommand:#('c:\windows\system32\where.exe' '/T' '*.dll') outputTo:Transcript.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4305
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4306
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4307
    "non-blocking (lower prio threads continue):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4308
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4309
     |in out err pid sema|
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4310
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4311
     in := 'out' asFilename readStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4312
     out := 'out2' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4313
     err := 'err' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4314
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4315
     sema := Semaphore new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4316
     pid := OperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4317
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4318
     The following will no longer work. monitorPid has disappeared
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4319
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4320
     pid notNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
  4321
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4322
     ].
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4323
     in close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4324
     out close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4325
     err close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4326
     sema wait.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4327
     Transcript showCR:'finished'
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4328
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4329
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  4330
    "Modified: / 21-03-1997 / 10:04:35 / dq"
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  4331
    "Modified: / 15-07-1997 / 16:03:51 / stefan"
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  4332
    "Created: / 12-11-1998 / 14:39:20 / cg"
10386
491685fba02e command execution (no need for command.com when executable
Claus Gittinger <cg@exept.de>
parents: 10373
diff changeset
  4333
    "Modified: / 11-02-2007 / 20:13:28 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4334
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4335
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4336
!Win32OperatingSystem class methodsFor:'file access'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4337
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4338
closeFd:anIntegerOrHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4339
    "low level close of a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4340
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4341
%{
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4342
    if (__isSmallInteger(anIntegerOrHandle)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4343
	close(__intVal(anIntegerOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4344
	RETURN(self);
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4345
    }
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4346
    if (__isExternalAddressLike(anIntegerOrHandle)) {
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4347
       if (!CloseHandle( __externalAddressVal(anIntegerOrHandle))) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4348
	   console_fprintf( stderr, "Win32OS [warning]: Could not close handle : %x\n", __externalAddressVal(anIntegerOrHandle));
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4349
       }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4350
       RETURN(self);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4351
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4352
%}.
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4353
    ^ self primitiveFailed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4354
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4355
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4356
createDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4357
    "create a new directory with name 'aPathName', which may be an absolute
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4358
     path, or relative to the current directory.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4359
     Return true if successful (or the directory existed already), false if failed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4360
     This is a low-level entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4361
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4362
    "/ if it already exists this is ok
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4363
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4364
    (self isDirectory:aPathName) ifTrue:[^ true].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4365
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4366
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4367
    SECURITY_ATTRIBUTES sa;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4368
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4369
    sa.nLength = sizeof( sa );
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4370
    sa.lpSecurityDescriptor = NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4371
    // sa.bInheritHandle = TRUE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4372
    sa.bInheritHandle = FALSE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4373
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4374
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4375
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4376
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4377
	ret = CreateDirectoryA(__stringVal(aPathName), &sa);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4378
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4379
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4380
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4381
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4382
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4383
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4384
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4385
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4386
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4387
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4388
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4389
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4390
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4391
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4392
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4393
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4394
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4395
	_wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4396
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4397
	ret = CreateDirectoryW(_wPathName, &sa);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4398
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4399
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4400
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4401
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4402
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4403
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4404
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4405
%}.
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4406
    ^ self primitiveFailed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4408
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4409
     OperatingSystem createDirectory:'foo'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4410
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4411
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4412
    "Modified: 20.12.1995 / 11:24:13 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4413
    "Modified: 29.6.1996 / 14:06:54 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4414
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4415
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4416
createFileForReadAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4417
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4418
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4419
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4420
createFileForReadWrite:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4421
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE' #'CREATE_ALWAYS')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4422
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4423
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4424
createHardLinkFrom:oldPath to:newPath
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4425
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4426
     Return true if successful, false if not."
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4427
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4428
    self executeCommand:('mklink/h "%1" "%2"' bindWith:newPath with:oldPath)
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4429
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4430
    "Created: / 19-01-2011 / 08:42:11 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4431
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4432
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4433
createSymbolicLinkFrom:oldPath to:newPath
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4434
    "make a link from the file 'oldPath' to the file 'newPath'.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4435
     The link will be a soft (symbolic) link.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4436
     Return true if successful, false if not."
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4437
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4438
    self executeCommand:('mklink "%1" "%2"' bindWith:newPath with:oldPath)
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4439
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4440
    "Created: / 19-01-2011 / 08:41:44 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4441
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4442
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4443
getLastError
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4444
%{
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4445
    RETURN ( __mkSmallInteger( __WIN32_ERR(GetLastError()) ));
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4446
%}.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4447
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4448
    "Created: / 31-07-2006 / 12:40:39 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4449
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4450
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4451
getLinkTarget:aPathName
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4452
    "given a filename, which represents a link-file (.lnk),
10161
fd6b02ffb383 avoid recursion
Claus Gittinger <cg@exept.de>
parents: 10160
diff changeset
  4453
     return its resolved path, or nil"
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4454
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4455
    |resolvedPath|
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4456
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4457
%{  /* STACK:100000 */
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4458
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4459
    static IShellLink   * ipShellLink   = NULL;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4460
    static IPersistFile * ipPersistFile = NULL;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4461
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4462
    HRESULT hres;
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4463
    WIN32_FIND_DATA wfd;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4464
    WORD wsz[MAXPATHLEN];
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4465
    char szGotPath[MAXPATHLEN];
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  4466
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4467
    if (! __isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4468
	console_fprintf(stderr, "OperatingSystem [info]: invalid argument\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4469
	goto error;
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4470
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4471
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4472
    if( ! coInitialized ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4473
	console_fprintf(stderr, "OperatingSystem [info]: com not initialized\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4474
	goto error;
11193
a432bfa95db0 CoInitialize -> coInitializeEx(MULTITHREADED)
Claus Gittinger <cg@exept.de>
parents: 11135
diff changeset
  4475
    }
a432bfa95db0 CoInitialize -> coInitializeEx(MULTITHREADED)
Claus Gittinger <cg@exept.de>
parents: 11135
diff changeset
  4476
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4477
    if ( ipShellLink == NULL ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4478
	hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4479
				&IID_IShellLink, (LPVOID *)&ipShellLink);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4480
	if (! SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4481
	    console_fprintf(stderr, "OperatingSystem [info]: CoCreateInstance Error - hres = %08x\n", hres);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4482
	    ipShellLink = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4483
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4484
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4485
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4486
	hres = ipShellLink->lpVtbl->QueryInterface( ipShellLink, &IID_IPersistFile, (void **)&ipPersistFile );
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4487
	if (! SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4488
	    console_fprintf(stderr, "OperatingSystem [info]: QueryInterface Error - hres = %08x\n", hres);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4489
	    ipShellLink->lpVtbl->Release(ipShellLink);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4490
	    ipShellLink   = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4491
	    ipPersistFile = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4492
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4493
	}
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4494
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4495
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4496
    MultiByteToWideChar(CP_ACP, 0, __stringVal(aPathName), -1, wsz, MAXPATHLEN);
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4497
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4498
    hres = ipPersistFile->lpVtbl->Load(ipPersistFile, wsz, STGM_READ);
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4499
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4500
    if (SUCCEEDED(hres)) {
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4501
	hres = ipShellLink->lpVtbl->GetPath(ipShellLink, szGotPath, MAXPATHLEN,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4502
		    (WIN32_FIND_DATA *)&wfd, 0 /* SLGP_SHORTPATH */ );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4503
	if (SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4504
	    resolvedPath = __MKSTRING(szGotPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4505
	} else {
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4506
#ifdef COM_DEBUG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4507
	    console_fprintf(stderr, "OperatingSystem [info]: GetPath failed - hres = %08x\n", hres );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4508
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4509
	}
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4510
    } else {
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4511
#ifdef COM_DEBUG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4512
	console_fprintf(stderr, "OperatingSystem [info]: Load failed - hres = %08x\n", hres );
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4513
#endif
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4514
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4515
    /* ipPersistFile->lpVtbl->Release(ipPersistFile);  */
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4516
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4517
error: ;
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4518
%}.
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4519
    resolvedPath notNil ifTrue:[^ resolvedPath ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4520
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4521
    "/ self primitiveFailed.
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4522
    ^ nil.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4523
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4524
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4525
     OperatingSystem getLinkTarget:'C:\Dokumente und Einstellungen\cg\Favoriten\Incoming.lnk'
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4526
     OperatingSystem getLinkTarget:'C:\Dokumente und Einstellungen\cg\Favoriten\cg auf G5.lnk'
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4527
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4528
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4529
    "Created: / 07-11-2006 / 10:52:44 / cg"
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4530
    "Modified: / 07-02-2007 / 10:37:48 / cg"
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4531
!
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4532
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4533
linkFile:oldPath to:newPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4534
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4535
     Return true if successful, false if not."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4536
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4537
    (oldPath isString not or:[newPath isString not]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4538
	"/
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4539
	"/ bad argument(s) given
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4540
	"/
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4541
	^ self primitiveFailed
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4542
    ].
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4543
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4544
    ^ self createHardLinkFrom:oldPath to:newPath
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4545
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4546
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4547
     OperatingSystem linkFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4548
    "
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4549
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4550
    "Modified: / 19-01-2011 / 08:42:53 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4551
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4552
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4553
openFile:pathName attributes:attributeSpec
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4554
    "non public internal helper.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4555
     open a file, return an os specific fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4556
     attributes is a collection of symbols specifying how the file is
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4557
     to be opened."
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4558
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4559
    |fileHandle errorNumber argumentError|
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4560
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4561
    fileHandle := Win32Handle new.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4562
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4563
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4564
    HANDLE h;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4565
    char *name;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4566
    wchar_t _wPathName[MAXPATHLEN+1];
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4567
    OBJ *ap;
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4568
    int numAttrib;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4569
    int i, l;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4570
    DWORD access, share, create, attr;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4571
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4572
    if (__isStringLike(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4573
	name = __stringVal(pathName);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4574
    } else if (__isUnicode16String(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4575
	l = __unicode16StringSize(pathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4576
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4577
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4578
	    _wPathName[i] = __unicode16StringVal(pathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4579
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4580
	_wPathName[i] = 0;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4581
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4582
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4583
	argumentError = @symbol(badPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4584
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4585
    }
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4586
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  4587
    if (! __isArrayLike(attributeSpec)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4588
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4589
	argumentError = @symbol(badAttributeSpec);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4590
	goto badArgument;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4591
    }
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4592
    ap = __ArrayInstPtr(attributeSpec)->a_element;
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4593
    numAttrib = __arraySize(attributeSpec);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4594
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4595
    share = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4596
    access = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4597
    create = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4598
    attr = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4599
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4600
    for (i=0; i<numAttrib;i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4601
	OBJ attrSym = ap[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4602
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4603
	if (attrSym == @symbol(FILE_SHARE_READ)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4604
	    share |= FILE_SHARE_READ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4605
	} else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4606
	    share |= FILE_SHARE_WRITE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4607
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4608
	} else if (attrSym == @symbol(GENERIC_READ)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4609
	    access |= GENERIC_READ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4610
	} else if (attrSym == @symbol(GENERIC_WRITE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4611
	    access |= GENERIC_WRITE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4612
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4613
	} else if (attrSym == @symbol(CREATE_NEW)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4614
	    create |= CREATE_NEW;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4615
	} else if (attrSym == @symbol(CREATE_ALWAYS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4616
	    create |= CREATE_ALWAYS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4617
	} else if (attrSym == @symbol(OPEN_EXISTING)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4618
	    create |= OPEN_EXISTING;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4619
	} else if (attrSym == @symbol(OPEN_ALWAYS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4620
	    create |= OPEN_ALWAYS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4621
	} else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4622
	    create |= TRUNCATE_EXISTING;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4623
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4624
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4625
	    attr |= FILE_ATTRIBUTE_HIDDEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4626
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4627
	    attr |= FILE_ATTRIBUTE_READONLY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4628
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4629
	    attr |= FILE_ATTRIBUTE_READONLY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4630
	} else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4631
	    attr |= FILE_FLAG_WRITE_THROUGH;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4632
	} else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4633
	    attr |= FILE_FLAG_SEQUENTIAL_SCAN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4634
	} else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4635
	    attr |= FILE_FLAG_DELETE_ON_CLOSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4636
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4637
	    console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4638
	}
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4639
    }
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4640
    if (create == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4641
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4642
	argumentError = @symbol(missingCreateMode);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4643
	goto badArgument;
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4644
    }
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  4645
#ifdef PROCESSDEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  4646
    console_fprintf(stderr, "name:<%s> access:%x share:%x create:%x attr:%x\n",
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4647
		name, access, share, create, attr);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4648
#endif
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4649
    if (__isStringLike(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4650
	h = CreateFileA(name, access, share, 0 /* sa */, create, attr, 0 /* hTempl */);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4651
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4652
	h = CreateFileW(_wPathName, access, share, 0 /* sa */, create, attr, 0 /* hTempl */);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4653
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4654
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4655
    if (h != INVALID_HANDLE_VALUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4656
	__externalAddressVal(fileHandle) = (void *)h;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4657
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4658
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4659
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4660
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4661
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4662
badArgument: ;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4663
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4664
    fileHandle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4665
	fileHandle registerForFinalization.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4666
	^ fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4667
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4668
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4669
	self error:'invalid argument(s): ', argumentError.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4670
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4671
	(self errorHolderForNumber:errorNumber) reportError
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4672
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4673
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4674
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4675
openFileForAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4676
    "noone sends this message yet"
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4677
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4678
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4679
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4680
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4681
openFileForRead:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4682
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4683
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4684
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4685
openFileForReadAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4686
    "noone sends this message yet"
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4687
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4688
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4689
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4690
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4691
openFileForReadWrite:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4692
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4693
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4694
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4695
openFileForWrite:pathName
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  4696
     ^ self openFile:pathName attributes:#(#'GENERIC_WRITE' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4697
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4698
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4699
recursiveCopyDirectory:sourcePathName to:destination
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4700
    "copy the directory named 'sourcePathName' and all contained files/directories to 'destination'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4701
     Return true if successful."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4702
18979
b07c5e5e2782 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18964
diff changeset
  4703
    ^ OperatingSystem executeCommand:('xcopy %1 %2 /q /s /e /h /r /o /g /y' bindWith:sourcePathName with:destination)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4704
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4705
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4706
removeDirectory:fullPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4707
    "remove the directory named 'fullPathName'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4708
     The directory must be empty and you must have appropriate access rights.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4709
     Return true if successful, false if directory is not empty or no permission.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4710
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4711
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4712
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4713
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4714
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4715
    if (__isStringLike(fullPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4716
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4717
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4718
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4719
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4720
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4721
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4722
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4723
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  4724
		ret = (int)(STX_API_NOINT_CALL1( "RemoveDirectoryA", RemoveDirectoryA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4725
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4726
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4727
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4728
	ret = RemoveDirectoryA((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4729
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4730
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4731
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4732
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4733
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4734
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4735
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4736
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4737
    if (__isUnicode16String(fullPathName)) {
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4738
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4739
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4740
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4741
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4743
	    l = __unicode16StringSize(fullPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4744
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4745
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4746
		_wPathName[i] = __unicode16StringVal(fullPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4747
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4748
	    _wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4749
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4750
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4751
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  4752
		ret = (int)(STX_API_NOINT_CALL1( "RemoveDirectoryW", RemoveDirectoryW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4753
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4754
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4755
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4756
	ret = RemoveDirectoryW((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4757
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4758
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4759
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4760
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4761
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4762
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4763
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4764
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4765
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4766
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4767
    "/ either not a string argument,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4768
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4769
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4770
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4771
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4772
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4773
     OperatingSystem createDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4774
     OperatingSystem removeDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4775
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4776
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4777
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4778
removeFile:fullPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4779
    "remove the file named 'fullPathName'; return true if successful.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4780
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4781
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4782
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4783
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4784
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4785
    if (__isStringLike(fullPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4786
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4787
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4788
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4789
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4790
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4791
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4792
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4793
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  4794
		ret = (int)(STX_API_NOINT_CALL1( "DeleteFileA", DeleteFileA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4795
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4796
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4797
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4798
	ret = DeleteFileA((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4799
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4800
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4801
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4802
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4803
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4804
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4805
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4806
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4807
    if (__isUnicode16String(fullPathName)) {
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4808
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4809
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4810
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4811
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4812
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4813
	    l = __unicode16StringSize(fullPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4814
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4815
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4816
		_wPathName[i] = __unicode16StringVal(fullPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4817
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4818
	    _wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4819
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4820
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4821
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  4822
		ret = (int)(STX_API_NOINT_CALL1( "DeleteFileW", DeleteFileW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4823
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4824
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4825
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4826
	ret = DeleteFileW((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4827
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4828
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4829
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4830
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4831
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4832
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4833
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4834
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4835
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4836
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4837
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4838
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4839
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4840
renameFile:oldPath to:newPath
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4841
    "rename the file 'oldPath' to 'newPath'.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4842
     Someone else has to care for the names to be correct and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4843
     correct for the OS used - therefore, this should not be called
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4844
     directlt. Instead, use Filename protocol to rename; this cares for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4845
     any invalid names.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4846
     Returns true if successful, false if not"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4847
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4848
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4849
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4850
    int eno;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4851
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4852
    if (__isStringLike(oldPath) && __isStringLike(newPath)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4853
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4854
	char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4855
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4856
	strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4857
	strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4858
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4859
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4860
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4861
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4862
	    ret = STX_C_NOINT_CALL2( "rename", rename, _oldPath, _newPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4863
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4864
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4865
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4866
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4867
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4868
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4869
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4870
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4871
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4872
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4873
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4874
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4875
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4876
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4877
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4878
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4879
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4880
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4881
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4882
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4883
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4884
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4885
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4886
     OperatingSystem renameFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4887
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4888
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4889
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4890
truncateFile:aPathName to:newSize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4891
    "change a files size return true on success, false on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4892
     This may not be supported on all architectures.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4893
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4894
     This is a low-level entry - use Filename protocol."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4895
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4896
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4897
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4898
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4899
!Win32OperatingSystem class methodsFor:'file access rights'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4900
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4901
accessMaskFor:aSymbol
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4902
    "return the access bits mask for numbers as returned by
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4903
     OperatingSystem>>accessModeOf:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4904
     and expected by OperatingSystem>>changeAccessModeOf:to:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4905
     Since these numbers are OS dependent, always use the mask
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4906
     (never hardcode 8rxxx into your code)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4907
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4908
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4909
    /* posix systems should define these ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4910
#   ifndef S_IRUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4911
#    define S_IRUSR 0400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4912
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4913
#   ifndef S_IWUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4914
#    define S_IWUSR 0200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4915
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4916
#   ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4917
#    define S_IXUSR 0100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4918
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4919
#   ifndef S_IRGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4920
#    define S_IRGRP 0040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4921
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4922
#   ifndef S_IWGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4923
#    define S_IWGRP 0020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4924
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4925
#   ifndef S_IXGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4926
#    define S_IXGRP 0010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4927
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4928
#   ifndef S_IROTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4929
#    define S_IROTH 0004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4930
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4931
#   ifndef S_IWOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4932
#    define S_IWOTH 0002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4933
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4934
#   ifndef S_IXOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4935
#    define S_IXOTH 0001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4936
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4938
    if (aSymbol == @symbol(readUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4939
	RETURN ( __mkSmallInteger(S_IRUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4940
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4941
    if (aSymbol == @symbol(writeUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4942
	RETURN ( __mkSmallInteger(S_IWUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4943
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4944
    if (aSymbol == @symbol(executeUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4945
	RETURN ( __mkSmallInteger(S_IXUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4946
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4947
    if (aSymbol == @symbol(readGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4948
	RETURN ( __mkSmallInteger(S_IRGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4949
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4950
    if (aSymbol == @symbol(writeGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4951
	RETURN ( __mkSmallInteger(S_IWGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4952
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4953
    if (aSymbol == @symbol(executeGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4954
	RETURN ( __mkSmallInteger(S_IXGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4955
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4956
    if (aSymbol == @symbol(readOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4957
	RETURN ( __mkSmallInteger(S_IROTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4958
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4959
    if (aSymbol == @symbol(writeOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4960
	RETURN ( __mkSmallInteger(S_IWOTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4961
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4962
    if (aSymbol == @symbol(executeOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4963
	RETURN ( __mkSmallInteger(S_IXOTH) );
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  4964
    }
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  4965
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  4966
    // These are not defined for Win32 - simply ignore them
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4967
    // (but handle them for UNIX compatibility
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4968
    if (aSymbol == @symbol(setUid)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4969
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4970
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4971
    if (aSymbol == @symbol(setGid)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4972
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4973
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4974
    if (aSymbol == @symbol(removeOnlyByOwner)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4975
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4976
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4977
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4978
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4979
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4980
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4981
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4982
     OperatingSystem accessMaskFor:#readUser
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4983
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4984
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4985
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4986
accessModeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4987
    "return a number representing access rights rwxrwxrwx for owner,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4988
     group and others. Return nil if such a file does not exist.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4989
     Notice that the returned number is OS dependent - use the
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4990
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4991
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4992
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4993
     this could have been implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4994
	(self infoOf:aPathName) at:#mode
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4995
     but for huge directory searches the code below is faster
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4996
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4997
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4998
%{
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4999
    struct stat buf;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5000
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5001
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5002
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5003
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5004
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5005
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5006
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5007
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5008
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5009
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5010
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5011
	    ret = STX_C_NOINT_CALL2( "stat", stat, _aPathName, &buf);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5012
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5013
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5014
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5015
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5016
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5017
	    ret = stat( (char *)__stringVal(aPathName), &buf);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5018
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5019
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5020
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5021
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5022
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5023
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5024
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5025
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5026
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5027
	    RETURN ( nil );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5028
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5029
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5030
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5031
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5032
   ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5033
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5034
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5035
    (OperatingSystem accessModeOf:'/') printStringRadix:8
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5036
    (OperatingSystem accessModeOf:'Make.proto') printStringRadix:8
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5037
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5038
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5039
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5040
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5041
accessModeOfFd:aFileDescriptor
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5042
    "return a number representing access rights rwxrwxrwx for owner,
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5043
     group and others. Return nil if such a file does not exist.
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5044
     Notice that the returned number is OS dependent - use the
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5045
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5046
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5047
    "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5048
     this could have been implemented as:
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5049
	(self infoOf:aPathName) at:#mode
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5050
     but for huge directory searches the code below is faster
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5051
    "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5052
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5053
%{
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5054
    struct stat buf;
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5055
    int ret;
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5056
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5057
    if (__isSmallInteger(aFileDescriptor)) {
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5058
#ifdef DO_WRAP_CALLS
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5059
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5060
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5061
	    // do not cast to INT - will loose sign bit then!
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5062
	    ret = STX_C_NOINT_CALL2( "fstat", fstat, __smallIntegerVal(aFileDescriptor), &buf);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5063
	} while ((ret < 0) && (__threadErrno == EINTR));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5064
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5065
	__BEGIN_INTERRUPTABLE__
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5066
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5067
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5068
	    // do not cast to INT - will loose sign bit then!
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5069
	    ret = fstat( __smallIntegerVal(aFileDescriptor), &buf);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5070
	} while ((ret < 0) && (__threadErrno == EINTR));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5071
	__END_INTERRUPTABLE__
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5072
	if (ret < 0) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5073
	    __threadErrno = __WIN32_ERR(GetLastError());
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5074
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5075
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5076
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5077
	if (ret < 0) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5078
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5079
	    RETURN ( nil );
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5080
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5081
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5082
    }
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5083
%}.
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5084
   ^ self primitiveFailed
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5085
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5086
   "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5087
    'c:\windows' asFilename readingFileDo:[:s|
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5088
	(OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8.
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5089
    ].
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5090
    'Make.proto' asFilename readingFileDo:[:s|
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5091
	(OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8.
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5092
    ].
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5093
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5094
   "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5095
!
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5096
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5097
changeAccessModeOf:aPathName to:modeBits
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5098
    "change the access rights of aPathName to the OS dependent modeBits.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5099
     You should construct this mask using accessMaskFor, to be OS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5100
     independent. Return true if changed,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5101
     false if such a file does not exist or change was not allowd."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5102
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5103
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5104
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5105
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5106
    if (__isStringLike(aPathName) && __isSmallInteger(modeBits)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5107
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5108
	int chmod();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5109
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5110
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5111
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5112
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5113
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5114
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5115
	    ret = STX_C_NOINT_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5116
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5117
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5118
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5119
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5120
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5121
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5122
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5123
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5124
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5125
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5126
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5127
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5128
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5129
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5130
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5131
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5132
	RETURN ( true );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5133
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5134
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5135
    ^ self primitiveFailed
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5136
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5137
   "
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5138
    (OperatingSystem accessModeOf:'Make.proto') printStringRadix:8
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5139
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5140
   "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5141
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5142
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5143
!Win32OperatingSystem class methodsFor:'file dialogs'!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5144
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5145
commDlgExtendedError
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5146
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5147
    <apicall: ulong "CommDlgExtendedError" () module: "comdlg32.dll" >
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5148
    ^self primitiveFailed
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5149
!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5150
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5151
getOpenFilename: openFilenameStructureExternalAddress
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5152
    "Opens a windows native file dialog without blocking stx
19416
90a164f523de #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19369
diff changeset
  5153
     for an OpenFilenameStructure stored in an externalStructure"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5154
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5155
    | rslt |
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5156
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5157
%{  /* STACK: 32000*/
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5158
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5159
    void *__address;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5160
    int __rslt;
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5161
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5162
    if (__isExternalAddressLike(openFilenameStructureExternalAddress)
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  5163
     || __isExternalBytesLike(openFilenameStructureExternalAddress)){
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5164
	__address = __externalAddressVal(openFilenameStructureExternalAddress);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5165
	__rslt = __STX_API_CALL1( "GetOpenFileNameA", (void *)GetOpenFileNameA, __address);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5166
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5167
	if (__rslt == TRUE) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5168
	    rslt = true;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5169
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5170
	    rslt = false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5171
	}
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5172
    }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5173
%}.
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5174
    rslt isNil ifTrue:[ self primitiveFailed ].
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5175
    ^ rslt
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5176
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5177
    "Modified (format): / 11-02-2014 / 21:18:02 / cg"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5178
!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5179
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5180
getSaveFilename: openFilenameStructureExternalAddress
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5181
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5182
    "Opens a windows native file dialog without blocking stx
19416
90a164f523de #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19369
diff changeset
  5183
     for an OpenFilenameStructure stored in an externalStructure."
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5184
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5185
    | rslt |
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5186
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5187
%{  /* STACK: 32000*/
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5188
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5189
    void  *__address;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5190
    int __rslt;
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5191
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5192
    if (__isExternalAddressLike(openFilenameStructureExternalAddress)
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  5193
     || __isExternalBytesLike(openFilenameStructureExternalAddress)){
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5194
	__address = __externalAddressVal(openFilenameStructureExternalAddress);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5195
	__rslt = __STX_API_CALL1( "GetSaveFileName", (void *)GetSaveFileName, __address);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5196
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5197
	if (__rslt == TRUE) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5198
	    rslt = true;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5199
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5200
	    rslt = false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5201
	}
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5202
    }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5203
%}.
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5204
    rslt isNil ifTrue:[ self primitiveFailed ].
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5205
    ^ rslt
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5206
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5207
    "Modified: / 11-02-2014 / 21:18:20 / cg"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5208
! !
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5209
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5210
!Win32OperatingSystem class methodsFor:'file queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5211
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5212
caseSensitiveFilenames
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5213
    "return true, if the OS has caseSensitive file naming.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5214
     On MSDOS, this will return false;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5215
     on a real OS, we return true."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5216
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5217
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5218
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5219
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5220
clearHidden:aPathName
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5221
    "set the hidden attribute; Return true if the operation succeeded"
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5222
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5223
    |attr|
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5224
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5225
    attr := self primGetFileAttributes:aPathName.
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5226
    (attr bitTest:FILE_ATTRIBUTE_HIDDEN ) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5227
	^ self primSetFileAttributes:aPathName to:(attr bitClear:2).
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5228
    ].
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5229
    ^ true
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5230
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5231
    "Created: / 29-07-2010 / 11:31:55 / sr"
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5232
!
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5233
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5234
compressPath:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5235
    "return the pathName compressed - that is, remove all ..-entries
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5236
     and . entries. This does not always (in case of symbolic links)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5237
     return the true pathName and is therefore used as a fallback
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5238
     if realPath and popen failed."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5240
    |names n "{ Class: SmallInteger }" |
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5241
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5242
    names := pathName
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5243
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5244
    names := names asOrderedCollection.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5245
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5246
     cut off initial double-slashes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5247
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5248
    [names startsWith:#('' '')] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5249
	names removeFirst.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5250
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5251
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5252
     cut off double-slashes at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5253
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5254
    [names endsWith:#('')] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5255
	names removeLast.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5256
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5257
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5258
     cut off current-dir at beginning
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5259
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5260
    n := names size.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5261
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5262
	names removeFirst.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5263
	n := n - 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5264
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5265
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5266
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5267
     cut off parent-dirs at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5268
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5269
    [(n > 2)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5270
     and:[(names endsWith:#('..'))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5271
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5272
	names removeLast; removeLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5273
	n := n - 2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5274
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5275
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5276
    ^ names asStringWith:self fileSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5277
		    from:1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5278
		    to:n
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5279
		    compressTabs:false final:nil
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5280
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5281
    "
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5282
     OperatingSystem compressPath:'.\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5283
     OperatingSystem compressPath:'\foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5284
     OperatingSystem compressPath:'foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5285
     OperatingSystem compressPath:'foo\bar\baz\..\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5286
     OperatingSystem compressPath:'foo\bar\baz\..\\\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5287
     OperatingSystem compressPath:'\\\foo\bar\baz\..\\\'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5288
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5289
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5290
    "Modified: 1.11.1996 / 20:13:48 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5291
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5292
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5293
fileSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5294
    "return the character used to separate names in a path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5295
     This character differs for MSDOS and other systems,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5296
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5297
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5298
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5299
    ^ $\
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5300
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5301
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5302
getCurrentDirectory
14731
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5303
    "get the current directory"
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5304
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  5305
%{  /* NOCONTEXT */
14731
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5306
    int ret;
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5307
    wchar_t _aPathName[MAXPATHLEN+1];
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5308
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5309
    ret = GetCurrentDirectoryW(MAXPATHLEN, _aPathName);
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5310
    if (ret == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5311
	__threadErrno = __WIN32_ERR(GetLastError());
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  5312
    }
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  5313
    RETURN(__mkStringOrU16String_maxlen(_aPathName, MAXPATHLEN));
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  5314
%}.
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5315
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5316
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5317
     self getCurrentDirectory
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5318
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5319
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5320
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5321
getDiskInfoOf:volumeNameArg
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5322
    "returns a dictionary filled with any of:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5323
	freeBytes
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5324
	totalBytes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5325
     and possibly additional (OS-specific) information"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5326
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5327
    |volumeName info ok sectorsPerCluster bytesPerSector freeClusters totalClusters
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5328
     type freeBytesForUsersQuota freeBytes totalBytes |
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5329
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5330
    volumeName := volumeNameArg.
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5331
    (volumeName endsWith:$\) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5332
	volumeName := volumeName , '\'
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5333
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5334
%{
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5335
    typedef BOOL (WINAPI *P_GDFSE)(LPCTSTR, PULARGE_INTEGER,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5336
				   PULARGE_INTEGER, PULARGE_INTEGER);
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5337
    P_GDFSE pGetDiskFreeSpaceEx = NULL;
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5338
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5339
    DWORD __sectorsPerCluster, __bytesPerSector, __freeClusters, __totalClusters;
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5340
    BOOL  fResult = 0;
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5341
    unsigned __int64 i64FreeBytesForUsersQuota, i64TotalBytes, i64FreeBytes;
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5342
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5343
    if (__isStringLike(volumeName) || __isSymbol(volumeName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5344
	 /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5345
	  *  Use GetDiskFreeSpaceEx if available; otherwise, use GetDiskFreeSpace.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5346
	  *  Notice that GetDiskFreeSpace does not work correctly under win2k,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5347
	  *  and GetDiskFreeSpaceEx is not avail. for all win versions (can microsoft ever do something right ?).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5348
	  */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5349
	pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress (
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5350
					    GetModuleHandle ("kernel32.dll"),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5351
							     "GetDiskFreeSpaceExA");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5352
	if (pGetDiskFreeSpaceEx) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5353
	    fResult = pGetDiskFreeSpaceEx (__stringVal(volumeName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5354
				 (PULARGE_INTEGER)&i64FreeBytesForUsersQuota,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5355
				 (PULARGE_INTEGER)&i64TotalBytes,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5356
				 (PULARGE_INTEGER)&i64FreeBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5357
	    if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5358
		freeBytesForUsersQuota = __MKUINT64(&i64FreeBytesForUsersQuota);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5359
		totalBytes = __MKUINT64(&i64TotalBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5360
		freeBytes = __MKUINT64(&i64FreeBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5361
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5362
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5363
	fResult = GetDiskFreeSpace(__stringVal(volumeName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5364
			     &__sectorsPerCluster,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5365
			     &__bytesPerSector,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5366
			     &__freeClusters,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5367
			     &__totalClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5368
	if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5369
	    sectorsPerCluster = __MKUINT(__sectorsPerCluster);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5370
	    bytesPerSector = __MKUINT(__bytesPerSector);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5371
	    freeClusters = __MKUINT(__freeClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5372
	    totalClusters = __MKUINT(__totalClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5373
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5374
	switch (GetDriveType(__stringVal(volumeName))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5375
	    case DRIVE_REMOVABLE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5376
		type = @symbol(removable); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5377
	    case DRIVE_FIXED:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5378
		type = @symbol(fixed); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5379
	    case DRIVE_REMOTE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5380
		type = @symbol(network); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5381
	    case DRIVE_CDROM:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5382
		type = @symbol(cdrom); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5383
	    case DRIVE_RAMDISK:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5384
		type = @symbol(ramdisk); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5385
	    case DRIVE_UNKNOWN:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5386
	    default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5387
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5388
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5389
	if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5390
	    ok = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5391
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5392
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5393
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5394
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5395
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5396
%}.
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5397
    ok == true ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5398
	self primitiveFailed.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5399
	^ self
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5400
    ].
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5401
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5402
    info := IdentityDictionary new.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5403
    info at:#sectorsPerCluster put:sectorsPerCluster.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5404
    info at:#bytesPerSector put:bytesPerSector.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5405
    info at:#freeClusters put:freeClusters.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5406
    info at:#totalClusters put:totalClusters.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5407
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5408
    info at:#freeBytes put:(freeBytes notNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5409
				ifTrue:[freeBytes]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5410
				ifFalse:[freeClusters * sectorsPerCluster * bytesPerSector]).
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5411
    info at:#totalBytes put:(totalBytes notNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5412
				ifTrue:[totalBytes]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5413
				ifFalse:[totalClusters * sectorsPerCluster * bytesPerSector]).
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5414
    info at:#freeBytesForUsersQuota put:freeBytesForUsersQuota.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5415
    type notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5416
	info at:#type put:type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5417
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5418
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5419
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5420
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5421
     self getDiskInfoOf:'c:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5422
     self getDiskInfoOf:'d:\'
9922
124793486a62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9484
diff changeset
  5423
     self getDiskInfoOf:'e:\'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5424
     self getDiskInfoOf:'f:\'. OperatingSystem lastErrorString
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5425
    "
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5426
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5427
    "Modified: / 26-09-2006 / 16:19:33 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5428
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5429
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5430
getDriveList
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5431
    "return a list of volumes in the system.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5432
     On unix, no such thing like a volume exists
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5433
     - there, a syntetic list with root, home & current is returned.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5434
     On MSDOS, a list of drive letters is (eventually) returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5435
     On VMS, a list of volumes is (eventually) returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5436
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5437
    |list|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5438
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5439
    list := OrderedCollection new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5440
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5441
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5442
     * add drive letters as strings to list ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5443
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5444
    char buffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5445
    char *cp;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5446
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5447
    GetLogicalDriveStrings(1023, buffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5448
    for (cp=buffer; *cp; ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5449
      __SSEND1(list, @symbol(add:), 0, __MKSTRING(cp));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5450
      cp += strlen(cp) + 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5451
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5452
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5453
    ^ list
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5454
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5455
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5456
getDriveType:aPathName
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5457
    "returns:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5458
	0 -> Unknown
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5459
	1 -> Invalid
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5460
	2 -> removable
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5461
	3 -> fixed
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5462
	4 -> remote
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5463
	5 -> cdrom
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5464
	6 -> ramdisk.
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5465
    This is a stupid interface - do not use."
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5466
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5467
%{
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5468
    int ret;
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5469
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5470
    if (__isStringLike(aPathName)) {
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5471
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5472
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5473
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5474
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5475
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5476
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5477
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5478
	    ret = (int)(STX_API_NOINT_CALL1( "GetDriveType", GetDriveType, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5479
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5480
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5481
	ret = GetDriveType((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5482
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5483
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5484
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5485
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5486
	RETURN (__MKSMALLINT(ret));
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5487
    }
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5488
%}.
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5489
    ^ self primitiveFailed
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5490
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5491
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5492
     self getDriveType:'x:\'
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5493
     self getDriveType:'C:\'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5494
     self getDriveType:'D:\'
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5495
    "
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5496
!
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5497
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5498
getFileVersionInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5499
    "retrieves the versionData from an executable or dll.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5500
     The returned value is either a byteArray, which should be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5501
     processed further with extractVersionValue (VerQueryValue),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5502
     or nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5503
     This is a WIN32 specific entry, not for common usage."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5504
%{
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5505
    int sz;
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5506
    DWORD dummy;
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5507
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5508
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5509
	sz = GetFileVersionInfoSizeA(__stringVal(aPathName), &dummy);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5510
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5511
	sz = GetFileVersionInfoSizeW(__unicode16StringVal(aPathName), &dummy);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5512
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5513
	goto badArgument;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5514
    }
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5515
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5516
    if (sz > 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5517
	OBJ versionData;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5518
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5519
	versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5520
	if (versionData == nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5521
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5522
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5523
	if (GetFileVersionInfo(__stringVal(aPathName), 0, sz, __ByteArrayInstPtr(versionData)->ba_element) == FALSE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5524
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5525
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5526
	RETURN (versionData);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5527
    }
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5528
    RETURN (nil);
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5529
badArgument: ;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5530
%}.
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5531
    self primitiveFailed
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5532
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5533
    "Modified: / 05-07-2006 / 16:56:06 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5534
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5535
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5536
getLongPathName:aPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5537
    "get the full (long, not 8.3) version of aPathName"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5538
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5539
%{
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5540
    int ret;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5541
    wchar_t _aPathName[MAXPATHLEN+1];
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5542
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5543
    if (__isStringLike(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5544
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5545
	INT l = __stringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5546
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5547
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5548
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5549
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5550
	    _aPathName[i] = __stringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5551
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5552
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5553
    } else if (__isUnicode16String(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5554
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5555
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5556
	INT l = __unicode16StringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5557
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5558
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5559
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5560
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5561
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5562
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5563
    } else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5564
	goto badArgument;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5565
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5566
#ifdef DO_WRAP_CALLS
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5567
     do {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5568
	 __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5569
	 // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5570
	 ret = (int)(STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, _aPathName, _aPathName, MAXPATHLEN));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5571
     } while ((ret == 0) && (__threadErrno == EINTR));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5572
#else
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5573
     ret = GetLongPathNameW(_aPathName, _aPathName, MAXPATHLEN);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5574
     if (ret == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5575
	 __threadErrno = __WIN32_ERR(GetLastError());
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5576
     }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5577
#endif
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  5578
     RETURN (__mkStringOrU16String_maxlen(_aPathName, MAXPATHLEN));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5579
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5580
badArgument:;
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5581
%}.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5582
    ^ self primitiveFailed
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5583
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5584
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5585
     self getLongPathName:'x:\'
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5586
     self getLongPathName:'c:\Dokumente und Einstellungen'
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5587
     self getShortPathName:'c:\Dokumente und Einstellungen'
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5588
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5589
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5590
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5591
getNullDevice
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5592
    "get the name of the null-device."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5593
8755
8e67c864b126 Fix #getNullDevice
Stefan Vogel <sv@exept.de>
parents: 8742
diff changeset
  5594
    ^ 'nul:'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5595
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5596
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5597
getObjectFileInfoFor:aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5598
    "Return and info object for given executable or shared object
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5599
     or throw an error if given file is not a valid an executable now
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5600
     shared object.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5601
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5602
     The info object returned is OS-specific, however it responds to at
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5603
     least
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  5604
	#isFor32BitArchitecture
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  5605
	#isFor64BitArchitecture ... returns true, if the given object is for
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  5606
				     32bit, 64bit architecture respectively
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5607
    "
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5608
    ^ PECOFFFileHeader fromFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5609
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5610
    "Created: / 18-03-2015 / 09:52:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5611
!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5612
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5613
getShortPathName:aPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5614
    "get the full (long, not 8.3) version of aPathName"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5615
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5616
%{
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5617
    int ret;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5618
    wchar_t _aPathName[MAXPATHLEN+1];
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5619
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5620
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5621
	int i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5622
	int l = __stringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5623
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5624
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5625
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5626
	    _aPathName[i] = __stringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5627
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5628
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5629
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5630
	int i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5631
	int l = __unicode16StringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5632
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5633
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5634
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5635
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5636
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5637
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5638
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5639
	goto badArgument;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5640
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5641
#ifdef DO_WRAP_CALLS
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5642
     do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5643
	 __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5644
	 // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5645
	 ret = (int)(STX_API_NOINT_CALL3( "GetShortPathNameW", GetShortPathNameW, _aPathName, _aPathName, MAXPATHLEN));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5646
     } while ((ret == 0) && (__threadErrno == EINTR));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5647
#else
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5648
     ret = GetShortPathNameW(_aPathName, _aPathName, MAXPATHLEN);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5649
     if (ret == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5650
	 __threadErrno = __WIN32_ERR(GetLastError());
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5651
     }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5652
#endif
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5653
     RETURN ( __MKU16STRING(_aPathName));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5654
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5655
badArgument:;
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5656
%}.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5657
    ^ self primitiveFailed
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5658
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5659
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5660
     self getShortPathName:'x:\'
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5661
     self getShortPathName:'c:\Dokumente und Einstellungen'
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5662
     self getLongPathName:'c:\Dokumente und Einstellungen'
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5663
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5664
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5665
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5666
getVolumeInformation: rootPath
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5667
    name: volumeNameBuffer
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5668
    nameSize: volumeNameSize
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5669
    serialNumber: serialNumber
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5670
    maximumComponentLength: maximumComponentLength
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5671
    fileSystemFlags: fileSystemFlags
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5672
    fileSystemName: fileSystemName
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5673
    fileSystemNameSize: fileSystemNameSize
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5674
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5675
    <apicall: boolean "GetVolumeInformationA" (struct struct ulong struct struct struct struct ulong) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5676
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5677
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5678
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5679
infoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5680
    "return some object filled with info for the file 'aPathName';
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5681
     the info (for which corresponding access methods are understood by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5682
     the returned object) is:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5683
	 type            - a symbol giving the files type
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5684
	 mode            - numeric access mode
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5685
	 uid             - owners user id
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5686
	 gid             - owners group id
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5687
	 size            - files size
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5688
	 id              - files number (i.e. inode number)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5689
	 accessed        - last access time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5690
	 modified        - last modification time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5691
	 statusChanged   - last status change time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5692
	 alternativeName - (windows only:) the MSDOS name of the file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5693
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5694
     Some of the fields may be returned as nil on systems which do not provide
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5695
     all of the information.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5696
     Return nil if such a file does not exist.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5697
     For symbolic links (if supported by the OS),
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5698
     the info of the pointed-to-file (i.e. the target) is returned;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5699
     use #linkInfoOf: to get info about the link itself.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5700
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5701
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5702
    |info target|
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5703
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5704
    info := self linkInfoOf:aPathName.
10164
2a98bef917b7 care for nil linkInfo
ca
parents: 10161
diff changeset
  5705
    (info notNil and:[info isSymbolicLink]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5706
	target := info path.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5707
	target notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5708
	    ^ self linkInfoOf:target.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5709
	]
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5710
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5711
    ^ info
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5712
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5713
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  5714
    OperatingSystem infoOf:'c:\windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5715
    OperatingSystem infoOf:'stx.exe'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5716
    (OperatingSystem infoOf:'/') uid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5717
    (OperatingSystem infoOf:'/') accessed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5718
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  5719
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  5720
    "Modified: / 07-02-2007 / 10:37:14 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5721
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5722
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5723
isDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5724
    "return true, if 'aPathName' is a valid directory path name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5725
     (i.e. exists and is a directory).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5726
     This also returns true for symbolic links pointing to a directory;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5727
     if you need to check for this, use #linkInfo:."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5728
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5729
%{
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5730
    int ret;
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5731
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5732
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5733
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5734
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5735
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5736
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5737
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5738
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5739
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5740
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5741
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5742
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5743
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5744
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5745
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5746
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5747
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5748
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5749
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5750
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5751
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5752
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5753
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5754
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5755
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5756
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5757
	_wPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5758
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5759
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5760
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5761
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5762
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5763
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5764
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5765
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5766
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5767
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5768
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5769
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5770
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5771
	goto err;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5772
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5773
    if (ret < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5774
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5775
	RETURN ( false );
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5776
    }
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5777
    RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5778
err:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5779
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5780
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5781
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5782
    "an alternative implementation would be:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5783
	^ (self infoOf:aPathName) type == #directory
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5784
    "
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5785
    "
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5786
     self isDirectory:'.'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5787
     self isDirectory:'.' asUnicode16String
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5788
    "
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5789
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5790
    "Modified: / 05-07-2006 / 17:23:42 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5791
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5792
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5793
isExecutable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5794
    "return true, if the given file is executable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5795
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5796
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5797
    "/
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5798
    "/ under windows, there is no executable attribute ...
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5799
    "/ so, only check for the files existence here.
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5800
    "/
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5801
    ^ self isValidPath:aPathName.
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5802
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5803
    "Modified: / 05-07-2006 / 17:23:19 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5804
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5805
10596
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5806
isHidden:aPathName
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5807
    "return true, if the given file is hidden"
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5808
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5809
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5810
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5811
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5812
    attr notNil ifTrue:[^ attr bitTest: FILE_ATTRIBUTE_HIDDEN ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5813
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5814
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5815
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5816
     self isHidden:'.'
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5817
     self isHidden:'.' asUnicode16String
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5818
    "
10596
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5819
!
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5820
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5821
isReadable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5822
    "return true, if the file/dir 'aPathName' is readable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5823
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5824
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5825
%{
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5826
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5827
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5828
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5829
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5830
	 * under windows, all files are readable ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5831
	 * so, only check for the files existence here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5832
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  5833
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5834
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5835
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5836
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5837
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5838
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5839
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5840
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5841
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5842
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5843
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5844
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5845
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5846
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5847
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5848
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5849
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5850
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5851
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5852
	RETURN (true);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5853
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5854
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5855
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5856
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5857
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5858
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5859
	 * under windows, all files are readable ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5860
	 * so, only check for the files existence here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5861
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5862
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5863
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5864
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5865
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5866
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5867
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5868
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5869
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5870
	_wPathName[i] = 0;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5871
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5872
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5873
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5874
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5875
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5876
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5877
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5878
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5879
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5880
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5881
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5882
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5883
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5884
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5885
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5886
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5887
	RETURN (true);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5888
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5889
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5890
    ^ self primitiveFailed
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5891
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5892
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5893
     self isReadable:'.'
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5894
     self isReadable:'.' asUnicode16String
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5895
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5896
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5897
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5898
isTemporary:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5899
    "return true, if the given file is a temporary file"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5900
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5901
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5902
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5903
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5904
    attr notNil ifTrue:[^ attr bitTest: FILE_ATTRIBUTE_TEMPORARY ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5905
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5906
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5907
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5908
     self isTemporary:'.'
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5909
     self isTemporary:'.' asUnicode16String
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5910
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5911
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5912
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5913
isValidPath:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5914
    "return true, if 'aPathName' is a valid path name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5915
     (i.e. the file or directory exists)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5916
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5917
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5918
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5919
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5920
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5921
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5922
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5923
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5924
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5925
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5926
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5927
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5928
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5929
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5930
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5931
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5932
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5933
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5934
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5935
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5936
    } else  if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5937
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5938
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5939
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5940
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5941
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5942
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5943
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5944
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5945
	_wPathName[i] = 0;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5946
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5947
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5948
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5949
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  5950
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5951
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5952
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5953
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5954
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5955
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5956
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5957
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5958
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5959
	goto err;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5960
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5961
    if (ret == -1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5962
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5963
	RETURN ( false );
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5964
    }
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5965
    RETURN (true);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5966
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5967
err:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5968
%}.
15039
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5969
    aPathName isString ifTrue:[
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5970
	aPathName isUnicode32String ifTrue:[
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5971
	    "/ WIN32 only support 16 bit (wide) strings
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5972
	    ^ self isValidPath:aPathName asUnicode16String
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5973
	]
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5974
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5975
    ^ self primitiveFailed
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5976
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5977
    "Modified: / 05-07-2006 / 17:23:51 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5978
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5979
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5980
isWritable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5981
    "return true, if the given file is writable.
11779
73c3f28d8960 Fix write access checking fpr directories in Windows.
Stefan Vogel <sv@exept.de>
parents: 11767
diff changeset
  5982
     For symbolic links, the pointed-to-file is checked.
73c3f28d8960 Fix write access checking fpr directories in Windows.
Stefan Vogel <sv@exept.de>
parents: 11767
diff changeset
  5983
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5984
     In Windows, files can possibly be created in and deleted from directories marked as read only.
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5985
     See http://support.microsoft.com/kb/326549.
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5986
     So we always return true for directories."
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5987
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5988
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5989
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5990
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5991
    attr notNil ifTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  5992
	^ (attr bitAnd: (FILE_ATTRIBUTE_DIRECTORY bitOr: FILE_ATTRIBUTE_READONLY ))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  5993
	    ~~ FILE_ATTRIBUTE_READONLY
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5994
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5995
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5996
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5997
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5998
     self isWritable:'.'
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5999
     self isWritable:'.' asUnicode16String
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6000
     self isWritable:'' asUnicode16String
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6001
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6002
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6003
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6004
linkInfoOf:aPathName
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6005
    "return some object filled with info for the file 'aPathName';
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6006
     the info (for which corresponding access methods are understood by
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6007
     the returned object) is:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6008
	 type            - a symbol giving the files type
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6009
	 mode            - numeric access mode
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6010
	 uid             - owners user id
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6011
	 gid             - owners group id
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6012
	 size            - files size
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6013
	 id              - files number (i.e. inode number)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6014
	 accessed        - last access time (as Timestamp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6015
	 modified        - last modification time (as Timestamp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6016
	 statusChanged   - last status change time (as Timestamp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6017
	 alternativeName - (windows only:) the MSDOS name of the file
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6018
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6019
     Some of the fields may be returned as nil on systems which do not provide
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6020
     all of the information.
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6021
     Return nil if such a file does not exist.
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6022
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6023
     Return the info about the link itself,
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6024
     on contrast to #infoOf:, which returns the info of the pointed to file
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6025
     in case of a symbolic link.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6026
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6027
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6028
    |info type mode uid gid size id
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6029
     atime mtime ctime
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
  6030
     aOsTime mOsTime cOsTime
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
  6031
     fileName alternativeName|
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6032
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6033
%{
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6034
    BOOL result;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6035
    int ret;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6036
    wchar_t alternativeFileNameBuffer[15];
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6037
    wchar_t fileNameBuffer[MAXPATHLEN+1];
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6038
    int modeBits = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6039
    WIN32_FILE_ATTRIBUTE_DATA fileAttributeData;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6040
    unsigned INT ino;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6041
    wchar_t _aPathName[MAXPATHLEN+1];
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6042
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6043
    if (__isStringLike(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6044
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6045
	int l = __stringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6046
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6047
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6048
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6049
	    _aPathName[i] = __stringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6050
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6051
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6052
    } else if (__isUnicode16String(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6053
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6054
	int l = __unicode16StringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6055
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6056
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6057
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6058
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6059
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6060
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6061
    } else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6062
	goto badArgument;
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  6063
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6064
#ifdef DO_WRAP_CALLS
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6065
    {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6066
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6067
	    __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6068
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6069
	    result = (int)(STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData));
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6070
	} while (!result && (__threadErrno == EINTR));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6071
    }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6072
#else
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  6073
    result = GetFileAttributesExW(_aPathName, GetFileExInfoStandard, &fileAttributeData);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6074
    if (!result) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6075
	__threadErrno = __WIN32_ERR(GetLastError());
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6076
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6077
#endif
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6078
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6079
    if (!result) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6080
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6081
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6082
	id = __mkSmallInteger(0);   /* could get it by opening ... */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6083
	size = __MKLARGEINT64(1, fileAttributeData.nFileSizeLow, fileAttributeData.nFileSizeHigh);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6084
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6085
//        if (fileAttributeData.cFileName[0] != '\0') {
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6086
//            bcopy(fileAttributeData.cFileName, fileNameBuffer, MAXPATHLEN*sizeof(wchar_t));
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6087
//            fileNameBuffer[MAXPATHLEN] = '\0';
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  6088
//            fileName = __mkStringOrU16String_maxlen(fileNameBuffer, MAXPATHLEN);             /* FULL name */
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6089
//        }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6090
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6091
//        if (fileAttributeData.cAlternateFileName[0] != '\0') {
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6092
//            bcopy(fileAttributeData.cAlternateFileName, alternativeFileNameBuffer, 14*sizeof(wchar_t));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6093
//            alternativeFileNameBuffer[14] = '\0';
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  6094
//            alternativeName = __mkStringOrU16String_maxlen(alternativeFileNameBuffer, 14); /* DOS name */
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6095
//        }
11779
73c3f28d8960 Fix write access checking fpr directories in Windows.
Stefan Vogel <sv@exept.de>
parents: 11767
diff changeset
  6096
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6097
	/*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6098
	 * simulate access bits
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6099
	 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6100
	if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6101
	    modeBits = 0444;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6102
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6103
	    modeBits = 0666;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6104
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6105
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6106
	if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6107
	    type = @symbol(directory);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6108
	    modeBits = 0777;   /* executable and WRITABLE - refer to comment in #isWritable: */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6109
	} else if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6110
	    type = @symbol(symbolicLink);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6111
	    modeBits = 0777;   /* even in UNIX symlinks have 0777 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6112
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6113
	    type = @symbol(regular);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6114
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6115
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6116
	mode = __mkSmallInteger(modeBits);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6117
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6118
	cOsTime = FileTimeToOsTime1970(&fileAttributeData.ftCreationTime);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6119
	aOsTime = FileTimeToOsTime1970(&fileAttributeData.ftLastAccessTime);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6120
	mOsTime = FileTimeToOsTime1970(&fileAttributeData.ftLastWriteTime);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6121
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6122
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6123
  badArgument: ;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6124
%}.
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  6125
10161
fd6b02ffb383 avoid recursion
Claus Gittinger <cg@exept.de>
parents: 10160
diff changeset
  6126
    (aPathName endsWith:'.lnk') ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6127
	type := #symbolicLink.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6128
	"/ now done lazyly in FileStatusInfo, when the path is accessed
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6129
	"/ path := self getLinkTarget:aPathName.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6130
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6131
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6132
    mode isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6133
	(self isDirectory:aPathName) ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6134
	    "/ the code above fails for root directories (these do not exist).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6135
	    "/ simulate here
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6136
	    mode := 8r777.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6137
	    type := #directory.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6138
	    uid := gid := 0.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6139
	    size := 0.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6140
	    id := 0.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6141
	    atime := mtime := ctime := Timestamp now.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6142
	].
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6143
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6144
    mode notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6145
	atime isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6146
	    "/ rebias to 1970 by subtracting the number of millis from 1.1.1601 to 1.1.1970
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6147
	    "/ aOsTime := aOsTime - self osTimeOf19700101. -- already done
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6148
	    atime := Timestamp new fromOSTime:aOsTime.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6149
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6150
	mtime isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6151
	    "/ rebias to 1970 by subtracting the number of millis from 1.1.1601 to 1.1.1970
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6152
	    "/ mOsTime := mOsTime - self osTimeOf19700101. -- already done
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6153
	    mtime := Timestamp new fromOSTime:mOsTime.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6154
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6155
	ctime isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6156
	    "/ rebias to 1970 by subtracting the number of millis from 1.1.1601 to 1.1.1970
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6157
	    "/ cOsTime := cOsTime - self osTimeOf19700101. -- already done
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6158
	    ctime := Timestamp new fromOSTime:cOsTime.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6159
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6160
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6161
	info := FileStatusInfo
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6162
		    type:type mode:mode
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6163
		    uid:uid gid:gid
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6164
		    size:size
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6165
		    id:id
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6166
		    accessed:atime modified:mtime created:ctime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6167
		    sourcePath:aPathName
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6168
		    fullName:fileName alternativeName:alternativeName.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6169
	^ info
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6170
   ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6171
   ^ nil
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6172
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6173
   "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6174
    OperatingSystem linkInfoOf:'c:\windows'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6175
    OperatingSystem linkInfoOf:'stx.exe'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6176
    (OperatingSystem linkInfoOf:'/') uid
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6177
    (OperatingSystem linkInfoOf:'/') accessed
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  6178
    OperatingSystem linkInfoOf:'C:\Dokumente und Einstellungen\stefan\Desktop\System.lnk'
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6179
   "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6180
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  6181
    "Modified: / 07-02-2007 / 10:30:14 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6182
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6183
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6184
mimeTypeForSuffix:aFileSuffix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6185
    "given a file suffix, return a corresponding mimeType.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6186
     Here, the Registry is consulted.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6187
     Returns nil if no mimeType for the given suffix is known."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6188
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6189
    ^ RegistryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6190
	stringValueFor:'Content Type'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6191
	atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6192
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6193
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6194
     self mimeTypeForSuffix:'au'
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6195
     self mimeTypeForSuffix:'st'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6196
     self mimeTypeForSuffix:'dll'
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6197
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6198
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6200
parentDirectoryName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6201
    "return the name used to refer to parent directories.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6202
     In MSDOS, Unix and other systems this is '..', but maybe different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6203
     for other systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6204
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6205
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6206
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6207
    ^ '..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6208
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6209
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6210
pathNameOf:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6211
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6212
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6213
     This method needs the path to be valid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6214
     (i.e. all directories must exist, be readable and executable).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6215
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6216
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6217
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6218
    |p path|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6219
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6220
    "some systems have a convenient function for this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6221
    path := self primPathNameOf:pathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6222
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6223
    path isNil ifTrue:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6224
	(self isValidPath:pathName) ifFalse:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6225
	    p := pathName.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6226
	    [(p size > 1)
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6227
	     and:[p endsWith:(self fileSeparator)]
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6228
	    ] whileTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6229
		p := p copyButLast:1.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6230
	    ].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6231
	    ^ p
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6232
	].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6233
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6234
	"/
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6235
	"/ return the original - there is nothing else can we do
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6236
	"/
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6237
	path := self compressPath:pathName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6238
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6239
    ^ path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6240
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6241
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6242
     OperatingSystem pathNameOf:'.'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6243
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6244
     OperatingSystem pathNameOf:'../../..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6245
     OperatingSystem pathNameOf:'..'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6246
     OperatingSystem pathNameOf:'/tmp////'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6247
     OperatingSystem pathNameOf:'/foo/bar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6248
     OperatingSystem pathNameOf:'/foo/bar/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6249
     OperatingSystem pathNameOf:'/foo/bar//'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6250
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6251
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6252
    "Modified: 29.11.1996 / 18:02:12 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6253
    "Modified: 10.1.1997 / 19:10:42 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6254
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6255
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6256
primGetFileAttributes:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6257
    "get the file-attributes"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6258
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6259
    |errorNumber|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6260
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6261
%{
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6262
    int ret;
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6263
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6264
    if (__isStringLike(aPathName)) {
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6265
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6266
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6267
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6268
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6269
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6270
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6271
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6272
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6273
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6274
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6275
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6276
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6277
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6278
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6279
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6280
	if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6281
	    RETURN ( __mkSmallInteger(ret) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6282
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6283
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6284
	RETURN (nil);
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6285
    }
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6286
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6287
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6288
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6289
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6290
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6291
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6292
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6293
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6294
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6295
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6296
	_wPathName[i] = 0;
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6297
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6298
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6299
	    __threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6300
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6301
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6302
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6303
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6304
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6305
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6306
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6307
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6308
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6309
	if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6310
	    RETURN ( __mkSmallInteger(ret) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6311
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6312
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6313
	RETURN (nil);
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6314
    }
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6315
%}.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6316
    ^ self primitiveFailed
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6317
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6318
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6319
     self primGetFileAttributes:'.'
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6320
     self primGetFileAttributes:'bc.mak'
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6321
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6322
     self primGetFileAttributes:'.' asUnicodeString
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6323
     self primGetFileAttributes:'bc.mak' asUnicodeString
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6324
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6325
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6326
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6327
primIdOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6328
    "the actual code to return the fileNumber (i.e. inode number) of a file."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6329
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6330
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6331
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6332
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6333
primPathNameOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6334
    "return the pathName of the argument, aPathString,
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6335
     - thats the full pathname of the directory, starting at 'X:\'.
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6336
     This method here returns nil, if the OS cannot perform the operation.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6337
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6338
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6339
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6340
    |error|
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6341
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6342
%{
9390
a0c059f2477c #primPathNameOf: -- allow symbol as arg (sv)
ca
parents: 9384
diff changeset
  6343
    if (__isStringLike(aPathName)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6344
	char nameBuffer[MAXPATHLEN + 1];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6345
	char nameBuffer2[MAXPATHLEN + 1];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6346
	char *returnedName = NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6347
	int rslt;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6348
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6349
#ifdef DO_WRAP_CALLS
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6350
	char _aPathName[MAXPATHLEN+1];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6351
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6352
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6353
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6354
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6355
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6356
	    rslt = (int)(STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL));
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6357
	} while ((rslt < 0) && (__threadErrno == EINTR));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6358
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6359
	rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6360
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6361
	returnedName = nameBuffer;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6362
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6363
	if (rslt > 0) {
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  6364
#ifdef DO_WRAP_CALLS
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6365
	    do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6366
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6367
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6368
		rslt = (int)(STX_API_NOINT_CALL3( "GetLongPathNameA", GetLongPathNameA, nameBuffer, nameBuffer2, MAXPATHLEN));
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6369
	    } while ((rslt < 0) && (__threadErrno == EINTR));
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6370
#else
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6371
	    rslt = GetLongPathNameA(nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6372
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6373
	    returnedName = nameBuffer2;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6374
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6375
	if (rslt > 0) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6376
	    RETURN ( __MKSTRING(returnedName) );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6377
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6378
	__threadErrno = __WIN32_ERR(GetLastError());
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6379
	RETURN (nil);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6380
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6381
    if (__isUnicode16String(aPathName)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6382
	wchar_t nameBuffer[MAXPATHLEN + 1];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6383
	wchar_t nameBuffer2[MAXPATHLEN + 1];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6384
	wchar_t *returnedName = NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6385
	int rslt;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6386
	wchar_t _aPathName[MAXPATHLEN+1];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6387
	int i, l;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6388
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6389
	l = __unicode16StringSize(aPathName);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6390
	if (l > MAXPATHLEN) l = MAXPATHLEN;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6391
	for (i=0; i<l; i++) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6392
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6393
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6394
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6395
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6396
#ifdef DO_WRAP_CALLS
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6397
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6398
	    __threadErrno = 0;
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6399
	    rslt = (int)(STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL));
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6400
	} while ((rslt < 0) && (__threadErrno == EINTR));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6401
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6402
	rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6403
#endif
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6404
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6405
	returnedName = nameBuffer;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6406
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6407
	if (rslt > 0) {
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6408
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6409
#ifdef DO_WRAP_CALLS
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6410
	    do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6411
		__threadErrno = 0;
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6412
		rslt = (int)(STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, nameBuffer, nameBuffer2, MAXPATHLEN));
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6413
	    } while ((rslt < 0) && (__threadErrno == EINTR));
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6414
#else
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6415
	    rslt = GetLongPathNameW(nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6416
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6417
	    returnedName = nameBuffer2;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6418
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6419
	if (rslt > 0) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6420
	    RETURN ( __MKU16STRING(returnedName) );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6421
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6422
	__threadErrno = __WIN32_ERR(GetLastError());
15377
3ea5dc7aae24 ouch: primPathName with an Unicode argument reported primFail
Claus Gittinger <cg@exept.de>
parents: 15369
diff changeset
  6423
	RETURN (nil);
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6424
    }
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6425
    error = @symbol(argument);     // argument is not a string or unicode16string
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6426
%}.
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6427
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6428
    error notNil ifTrue:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6429
	self primitiveFailed:error.
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6430
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6431
    ^ nil
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6432
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6433
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  6434
     self primPathNameOf:'.'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6435
     self primPathNameOf:'.' asUnicode16String
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6436
     self primPathNameOf:5555
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6437
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6438
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6439
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6440
primSetCurrentDirectoryA:pathName
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6441
    <apicall: bool "SetCurrentDirectoryA" ( pointer ) module: "kernel32.dll" >
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6442
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6443
    self primitiveFailed.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6444
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6445
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6446
     self primSetCurrentDirectory:'C:\Dokumente und Einstellungen\User\Eigene Dateien\work5\stx\projects\smalltalk'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6447
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6448
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6449
    "Created: / 27-07-2006 / 14:47:12 / fm"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6450
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6451
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6452
primSetCurrentDirectoryW:pathName
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6453
    <apicall: bool "SetCurrentDirectoryW" ( pointer ) module: "kernel32.dll" >
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6454
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6455
    self primitiveFailed.
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6456
!
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6457
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6458
primSetFileAttributes:aPathName to:anInteger
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6459
    "set the file-attributes; return true if the set did happen"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6460
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6461
    |errorNumber|
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6462
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6463
%{
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6464
    int ret;
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6465
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6466
    if (__isSmallInteger(anInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6467
	if (__isStringLike(aPathName)) {
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6468
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6469
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6470
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6471
	    strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6472
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6473
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6474
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6475
		ret = (int)(STX_API_NOINT_CALL2( "SetFileAttributesA", SetFileAttributesA, _aPathName, __intVal(anInteger)));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6476
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6477
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6478
	    ret = SetFileAttributesA((char *) __stringVal(aPathName), __intVal(anInteger));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6479
	    if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6480
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6481
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6482
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6483
	    if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6484
		RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6485
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6486
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6487
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6488
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6489
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6490
	if (__isUnicode16String(aPathName)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6491
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6492
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6493
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6494
	    l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6495
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6496
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6497
		_wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6498
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6499
	    _wPathName[i] = 0;
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6500
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6501
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6502
		__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6503
		// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6504
		ret = (int)(STX_API_NOINT_CALL2( "SetFileAttributesW", SetFileAttributesW, _wPathName, __intVal(anInteger)));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6505
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6506
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6507
	    ret = SetFileAttributesW(_wPathName, __intVal(anInteger));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6508
	    if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6509
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6510
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6511
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6512
	    if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6513
		RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6514
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6515
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6516
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6517
	}
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6518
    }
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6519
%}.
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6520
    ^ self primitiveFailed
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6521
!
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6522
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6523
setCurrentDirectory:pathName
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6524
    pathName bitsPerCharacter == 16 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6525
	self primSetCurrentDirectoryW:(pathName copyWith:(Character value:0))
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6526
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6527
	self primSetCurrentDirectoryA:pathName
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6528
    ].
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6529
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6530
    "
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6531
     self getCurrentDirectory
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6532
     self setCurrentDirectory:'C:\Users\cg\work\stx\projects'
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6533
     self getCurrentDirectory
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6534
     self setCurrentDirectory:'C:\Users\cg\work\stx\projects\smalltalk'
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6535
    "
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6536
!
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6537
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6538
setHidden:aPathName
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6539
    "set the hidden attribute. Return true if the operation succeeded"
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6540
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6541
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6542
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6543
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6544
    (attr bitTest:FILE_ATTRIBUTE_HIDDEN ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6545
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6546
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6547
    ^ true  "/ aready set
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6548
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6549
    "Modified: / 29-07-2010 / 11:32:26 / sr"
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6550
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6551
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6552
setNormal:aPathName
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6553
    " sets all file attributes to the normal state
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6554
      e.g. set the hidden attribute to false (unhidden)"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6555
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6556
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6557
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6558
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6559
    (attr bitTest:FILE_ATTRIBUTE_NORMAL ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6560
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6561
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6562
    ^ true  "/ aready set
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6563
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6564
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6565
setTemporary:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6566
    " set the temporary attribute of aPathName"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6567
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6568
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6569
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6570
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6571
    (attr bitTest:FILE_ATTRIBUTE_TEMPORARY ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6572
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6573
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6574
    ^ true  "/ aready set
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6575
!
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6576
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6577
timeOfLastAccess:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6578
    "return the time, when the file was last accessed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6579
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6580
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6581
    "could be implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6582
	(self infoOf:aPathName) accessed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6583
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6584
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6585
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6586
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  6587
    i notNil ifTrue:[^ i accessTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6588
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6589
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6590
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6591
     OperatingSystem timeOfLastAccess:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6592
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6593
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6594
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6595
timeOfLastChange:aPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6596
    "return the time, when the file was last changed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6597
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6598
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6599
    "could be implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6600
	(self infoOf:aPathName) modified
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6601
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6602
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6603
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6604
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6605
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  6606
    i notNil ifTrue:[^ i modificationTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6607
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6608
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6609
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6610
     OperatingSystem timeOfLastChange:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6611
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6612
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6613
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6614
typeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6615
    "return the type of a file as a symbol; for nonexistent files,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6616
     nil is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6617
     Notice: for symbolic links, the type of the pointed-to file is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6618
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6619
    |i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6620
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6621
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6622
     this could have been implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6623
	(self infoOf:aPathName) type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6624
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6625
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6626
    i := self infoOf:aPathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6627
    i notNil ifTrue:[^ i type].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6628
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6629
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6630
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6631
     OperatingSystem typeOf:'/'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6632
     OperatingSystem typeOf:'.'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6633
     OperatingSystem typeOf:'Make.proto'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6634
     OperatingSystem typeOf:'resources/motif.style'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6635
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6636
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6637
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6638
volumeLabelOf: aFilenameOrString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6639
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6640
	"Answer the volume label of the disk containing aFilenameOrString."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6641
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6642
    | volName |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6643
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6644
    volName := String new: 255.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6645
    ( self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6646
	getVolumeInformation: aFilenameOrString asFilename volume, '\'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6647
	name: volName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6648
	nameSize: volName size
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6649
	serialNumber: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6650
	maximumComponentLength: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6651
	fileSystemFlags: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6652
	fileSystemName: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6653
	fileSystemNameSize: 0 )
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6654
	    ifFalse: [
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6655
		Transcript showCR:'GetVolumeInformation error'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6656
		^ ''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6657
	].
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6658
    ^ volName copyUpTo: Character null
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6659
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6660
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6661
	self volumeLabelOf: 'C:\pepe.pep'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6662
	self volumeLabelOf: 'C:'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6663
	self volumeLabelOf: 'C:\\'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6664
	self volumeLabelOf: 'C:\'
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6665
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6666
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6667
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6668
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6669
volumeNameOf:aPathString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6670
    "return the volumeName of the argument, aPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6671
     - thats the name of the volume where aPath is.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6672
     Not all OperatingSystem support/use volumes; on unix,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6673
     this always returns an empty string."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6674
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  6675
    aPathString size < 2 ifTrue:[^ ''].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6676
    (aPathString at:2) == $: ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6677
	^ (aPathString at:1) asString.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6678
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6679
    ^ ''
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6680
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6681
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6682
!Win32OperatingSystem class methodsFor:'help support'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6683
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6684
openDocumentationFilename: aFilenameOrString
12154
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6685
    <resource: #obsolete>
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6686
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6687
    self obsoleteMethodWarning:'call openApplicationForDocument:operation: and provide a proper error handler yourself'.
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6688
9990
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6689
    "open a windows-shell application to present the document contained in aFilenameOrString.
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6690
     This looks for the files extension, and is typically used to present help-files,
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6691
     html documents, pdf documents etc."
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6692
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6693
    Error
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6694
	handle:[:ex |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6695
	    Dialog warn:'Shell execution failed'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6696
	] do:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6697
	    self openApplicationForDocument:aFilenameOrString operation:#open
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6698
	]
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6699
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6700
    "
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6701
     self openDocumentationFilename: 'C:\WINDOWS\Help\clipbrd.chm' asFilename
10364
43968474508b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10352
diff changeset
  6702
     self openDocumentationFilename: Filename currentDirectory
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6703
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6704
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6705
    "Created: / 04-08-2006 / 18:04:52 / fm"
10364
43968474508b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10352
diff changeset
  6706
    "Modified: / 26-01-2007 / 14:05:44 / cg"
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6707
!
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6708
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6709
openHelpFile: helpFilename inContextID: contextID withOwner: anApplicationModel
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6710
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6711
    |ownerHandle macro|
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6712
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6713
    anApplicationModel notNil ifTrue:[ownerHandle := anApplicationModel window id].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6714
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6715
    contextID isNil ifTrue: [^self primWinHelp: ownerHandle helpFile: helpFilename command: 3 "HelpIndex" dwData: nil ].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6716
    contextID isInteger ifTrue: [^self primWinHelp: ownerHandle helpFile: helpFilename command: 1 "HelpContext" dwData: contextID ].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6717
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6718
    self primWinHelp: ownerHandle helpFile: helpFilename command: 3 "HelpIndex" dwData: nil.       "force the help window open if not currently"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6719
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6720
    macro := 'JumpId("', helpFilename asFilename baseName , '", "', contextID, '")'.
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6721
    self primWinHelp: nil helpFile: helpFilename command: 258 "HelpCommand" dwData: macro
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6722
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6723
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6724
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6725
    self openHelpFile: 'C:\vsw311\dapas.hlp' inContextID: 'IDH_ACI' withOwner: nil
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6726
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6727
!
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6728
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6729
primWinHelp: hWnd helpFile: aString command: anInteger dwData: anObject
10276
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6730
    <apicall: bool "WinHelpA" ( handle lpstr int32 lpstr ) module: "user32.dll" >
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6731
    self primitiveFailed.
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6732
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6733
"
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6734
    anInteger
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6735
    - 1         HelpContext     to open in the specified contextID
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6736
    - 3         HelpIndex       to open in the help index
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6737
    - 258       HelpCommand     execute a macro string
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6738
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6739
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6740
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6741
    self primWinHelp: nil helpFile: 'C:\vsw311\dapas.hlp' command: 3 dwData: nil
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6742
"
10276
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6743
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6744
    "Modified: / 19-12-2006 / 11:48:15 / User"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6745
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6746
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6747
!Win32OperatingSystem class methodsFor:'interrupts & signals'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6748
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6749
blockingTest
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6750
    "this is a test method;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6751
     For testing double CTRL-C in blocking primitives"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6753
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6754
    while(1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6755
	console_printf("blocking...");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6756
	Sleep(50);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6757
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6758
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6759
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6760
     OperatingSystem blockingTest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6761
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6762
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6763
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6764
blockingTest2
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6765
    "this is a test method;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6766
     For testing single CTRL-C in blocking primitives"
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6767
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6768
%{
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6769
    while(1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6770
	console_printf("blocking...");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6771
	STX_API_CALL1("Sleep", Sleep, 50);
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6772
    }
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6773
%}.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6774
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6775
     OperatingSystem blockingTest2
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6776
    "
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6777
!
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6778
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6779
blockingTest3
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6780
    "this is a test method;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6781
     For testing single CTRL-C in non-interruptable blocking primitives.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6782
     This one should continue after typing continue in the debugger"
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6783
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6784
%{
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6785
    int ret;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6786
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6787
    do {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6788
	// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6789
	ret = (int)(STX_API_NOINT_CALL1("Sleep", Sleep, 60000));
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6790
    } while (ret < 0 && __threadErrno == EINTR);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6791
%}.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6792
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6793
     OperatingSystem blockingTest3
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6794
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6795
!
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6796
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6797
blockingTest4
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6798
    "this is a test method;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6799
     For testing single CTRL-C in non-interruptable blocking primitives.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6800
     This one start a new sleep after typing continue in the debugger"
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6801
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6802
%{
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6803
    int ret;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6804
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6805
    do {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6806
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6807
	ret = STX_API_CALL1("Sleep", Sleep, 60000);
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6808
    } while (ret < 0 && __threadErrno == EINTR);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6809
%}.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6810
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6811
     OperatingSystem blockingTest4
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6812
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6813
!
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6814
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6815
defaultSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6816
    "revert to the default action on arrival of a (Unix-)signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6817
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6818
     WARNING: for some signals, it is no good idea to revert to default;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6819
     for example, the default for SIGINT (i.e. ^C) is to exit; while the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6820
     default for SIGQUIT (^ \) is to dump core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6821
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6822
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6823
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6824
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6825
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6826
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6827
    if (__isSmallInteger(signalNumber)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6828
#ifdef SIG_DFL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6829
	signal(__intVal(signalNumber), SIG_DFL);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6830
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6831
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6832
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6833
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6834
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6835
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6836
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6837
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6838
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6839
    "you better save a snapshot image before trying this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6840
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6841
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6842
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6843
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6844
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6845
     'normal ^C handling again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6846
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6847
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6848
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6849
disableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6850
    "turn off IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6851
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6852
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6853
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6854
     or if the OS does not support IO interrupts.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6855
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6856
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6857
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6858
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6859
disableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6860
    "disable (Unix-) signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6861
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6862
     WARNING: for some signals, it is no good idea to disable
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6863
     them; for example, disabling the SIGINT signal turns off ^C
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6864
     handling.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6865
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6866
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6867
     a signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6868
     Use only for fully debugged stand alone applications."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6869
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6870
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6871
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6872
    if (__isSmallInteger(signalNumber)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6873
	int sigNo = __intVal(signalNumber);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6874
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6875
	if (sigNo == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6876
	    RETURN (self);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6877
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6878
#ifdef SIG_IGN
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6879
	signal(sigNo, SIG_IGN);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6880
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6881
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6882
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6883
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6884
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6885
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6886
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6887
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6888
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6889
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6890
     'now, ^C is totally ignored ...' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6891
     OperatingSystem disableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6892
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6893
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6894
     '^C handled again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6895
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6896
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6897
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6898
disableTimer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6899
    "disable timer interrupts.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6900
     WARNING:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6901
	the system will not operate correctly with timer interrupts
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6902
	disabled, because no scheduling or timeouts are possible."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6903
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6904
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6905
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6906
    extern void __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6907
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6908
    __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6909
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6910
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6911
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6912
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6913
enableChildSignalInterrupts
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  6914
    "childSignal interrupts are not supported in windows"
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  6915
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  6916
    ^ self
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6917
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6918
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6919
enableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6920
    "turn on IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6921
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6922
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6923
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6924
     or if the system does not support SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6925
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6926
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6927
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6928
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6929
enableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6930
    "enable (Unix-)signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6931
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6932
     The signal will be delivered to one of the standard handlers
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6933
     (SIGINT, SIGQUIT, etc) or to a general handler, which
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6934
     sends #signalInterrupt:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6935
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6936
     NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6937
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6938
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6939
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6940
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6941
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  6942
# define SIG_LIMIT 30
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6943
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6944
#if defined(SIGPOLL) && !defined(SIGIO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6945
# define SIGIO SIGPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6946
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6947
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6948
#ifdef SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6949
# define CHILD_SIGNAL   SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6950
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6951
# ifdef SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6952
#  define CHILD_SIGNAL  SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6953
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6954
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6955
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6956
    int sigNr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6957
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6958
#if defined(SIGINT) || defined(SIGQUIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6959
# ifndef __signalUserInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6960
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6961
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6962
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6964
#ifdef SIGFPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6965
# ifndef __signalFpExceptionInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6966
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6967
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6968
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6969
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6970
#ifdef SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6971
# ifndef __signalIoInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6972
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6973
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6974
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6975
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6976
#ifdef CHILD_SIGNAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6977
# ifndef __signalChildInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6978
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6979
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6980
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6981
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6982
#ifdef SIGPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6983
# ifndef __signalPIPEInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6984
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6985
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6986
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6987
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6988
#ifdef SIGBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6989
# ifndef __signalBUSInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6990
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6991
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6992
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6993
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6994
#ifdef SIGSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6995
# ifndef __signalSEGVInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6996
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6997
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6998
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6999
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7000
#if defined(SIGILL) || defined(SIGEMT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7001
# ifndef __signalTrapInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7002
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7003
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7004
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7005
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7006
#ifdef SIGALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7007
# ifndef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7008
#  ifndef __signalTimerInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7009
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7010
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7011
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7012
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7013
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7014
#ifndef __signalInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7015
    extern void __signalInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7016
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7017
    void (*handler)(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7018
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7019
    if (__isSmallInteger(signalNumber)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7020
     && ((sigNr = __intVal(signalNumber)) >= 0)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7021
#ifdef SIG_LIMIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7022
     &&  (sigNr <= SIG_LIMIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7023
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7024
    ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7025
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7026
	 * standard signals are forced into standard handlers
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7027
	 * - all others go into general signalInterrupt
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7028
	 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7029
#if defined(SIGPOLL) && defined(SIGIO)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7030
	if (sigNr == SIGPOLL)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7031
	    sigNr = SIGIO;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7032
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7033
	switch (sigNr) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7034
	    case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7035
		/* enabling a non-supported signal */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7036
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7037
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7038
#ifdef SIGBREAK
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7039
	    case SIGBREAK:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7040
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7041
#ifdef SIGINT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7042
	    case SIGINT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7043
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7044
#ifdef SIGQUIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7045
	    case SIGQUIT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7046
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7047
#ifdef SIGNALDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7048
		console_printf("ConsoleSignal %d\n",sigNr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7049
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7050
		SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7051
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7052
#ifdef SIGFPE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7053
	    case SIGFPE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7054
		handler = __signalFpExceptionInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7055
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7056
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7057
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7058
#ifdef SIGPIPE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7059
	    case SIGPIPE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7060
		handler = __signalPIPEInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7061
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7062
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7063
#ifdef SIGBUS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7064
	    case SIGBUS:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7065
		handler = __signalBUSInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7066
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7067
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7068
#ifdef SIGSEGV
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7069
	    case SIGSEGV:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7070
		handler = __signalSEGVInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7071
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7072
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7073
#ifdef SIGILL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7074
	    case SIGILL:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7075
		handler = __signalTrapInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7076
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7077
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7078
#ifdef SIGEMT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7079
	    case SIGEMT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7080
		handler = __signalTrapInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7081
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7082
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7083
#ifdef SIGIO
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7084
	    case SIGIO:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7085
		handler = __signalIoInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7086
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7087
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7088
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7089
#ifdef CHILD_SIGNAL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7090
	    case CHILD_SIGNAL:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7091
		handler = __signalChildInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7092
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7093
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7094
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7095
	    default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7096
		handler = __signalInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7097
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7098
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7099
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7100
	{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7101
#ifdef HAS_SIGACTION
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7102
	    struct sigaction act;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7103
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7104
	    /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7105
	     * Do not add SA_RESTART here. A signal can cause a
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7106
	     * thread switch, another thread can do a garbage collect
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7107
	     * and restarted system calls may write into old
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7108
	     * (collected) addresses.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7109
	     */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7110
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7111
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7112
	    sigemptyset(&act.sa_mask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7113
	    act.sa_handler = handler;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7114
	    sigaction(sigNr, &act, 0);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7115
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7116
# ifdef HAS_SIGVEC
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7117
	    struct sigvec vec;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7118
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7119
	    vec.sv_flags = SV_INTERRUPT;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7120
	    sigemptyset(&vec.sv_mask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7121
	    vec.sv_handler = handler;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7122
	    sigvec(sigNr, &vec, NULL);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7123
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7124
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7125
#   ifdef SIGNALDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7126
	    console_printf("signal %d can't change handler\n",sigNr);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7127
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7128
#  else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7129
	    (void) signal(sigNr, handler);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7130
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7131
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7132
#endif
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7133
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7134
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7135
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7136
	 * maybe, we should Return the old enable-status
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7137
	 * as boolean here ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7138
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7139
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7140
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7141
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7142
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7143
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7144
     this error is triggered on non-integer argument, or
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7145
     if the signal number is not in the valid range (1..NSIG)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7146
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7147
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7148
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7150
enableTimer:milliSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7151
    "setup for a timerInterrupt, to be signalled after some (real) time."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7152
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7153
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7154
    extern void __win32SetTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7156
    if (__isSmallInteger(milliSeconds)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7157
	__win32SetTimer( __intVal(milliSeconds) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7158
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7159
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7160
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7161
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7162
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7163
6535
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7164
isFatalSignal:aNumber
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7165
   "return true if a signal with number aNumber is a fatal signal,
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7166
    i.e. some severe internal error occured"
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7167
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7168
   ^ (aNumber == self sigSEGV)
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7169
     or:[aNumber == self sigILL
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7170
     or:[aNumber == self sigBUS]]
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7171
!
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7172
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7173
killProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7174
    "kill a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7175
     The process terminates immediately and has no chance to perform any cleanup actions.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7176
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7177
     WARNING: in order to avoid zombie processes (on unix),
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7178
	      you have to fetch the processes exitstatus with
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7179
	      OperatingSystem>>getStatusOfProcess:aProcessId."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7180
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7181
    self terminateProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7182
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7183
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7184
killProcessGroup:processGroupId
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7185
    "kill a process group.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7186
     The process(es) terminate immediately and has no chance to perform any cleanup actions.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7187
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7188
     WARNING: in order to avoid zombie processes (on unix),
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7189
	      you have to fetch the processes exitstatus with
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7190
	      OperatingSystem>>getStatusOfProcess:aProcessId."
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7191
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7192
    self terminateProcessGroup:processGroupId
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7193
!
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7194
18414
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7195
microsecondSleep:micros
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  7196
    "cease ANY action for some time.
18414
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7197
     This suspends the whole smalltalk (unix/windows-) process for some time.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7198
     Not really useful since not even low-prio processes and interrupt
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7199
     handling will run during the sleep.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7200
     Use either OperatingSystem>>millisecondDelay: (which makes all
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  7201
     threads sleep, but handles interrupts) or use a Delay
18414
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7202
     (which makes only the calling thread sleep)."
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7203
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7204
    |uLow uHigh|
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7205
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7206
    uLow := micros // 1000000.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7207
    uHigh := micros \\ 1000000.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7208
%{
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7209
    struct timeval tv;
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7210
    fd_set dummy;
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7211
    int success;
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7212
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7213
    SOCKET s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7214
    FD_ZERO(&dummy);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7215
    FD_SET(s, &dummy);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7216
    tv.tv_sec = __intVal(uLow);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7217
    tv.tv_usec = __intVal(uHigh);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7218
    success = (0 == select(0, 0, 0, &dummy, &tv));
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7219
    closesocket(s);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7220
    RETURN (success ? true : false);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7221
%}
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7222
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7223
    "
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7224
     Timestamp now printCR.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7225
     OperatingSystem microsecondSleep:100.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7226
     Timestamp now printCR.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7227
    "
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7228
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7229
    "Created: / 28-05-2015 / 14:14:53 / gg"
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7230
!
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7231
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7232
sendSignal:signalNumber to:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7233
    "send a unix signal to some process (maybe myself).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7234
     Returns false if any error occurred, true otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7235
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7236
     Do not confuse UNIX signals with Smalltalk-Signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7237
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7238
     WARNING: in order to avoid zombie processes (on unix),
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7239
	      you may have to fetch the processes exitstatus with
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7240
	      OperatingSystem>>getStatusOfProcess:aProcessId
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7241
	      if the signal terminates that process."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7242
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7243
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7244
    "/ either invalid argument (non-integers)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7245
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7246
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7247
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7248
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7249
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7250
sendSignal:signalNumber to:processId toGroup:toGroupBoolean toAll:toAllBoolean
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7251
    "send a unix signal to some process (maybe myself).
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7252
     Returns false if any error occurred, true otherwise.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7253
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7254
     Do not confuse UNIX signals with Smalltalk-Signals.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7255
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7256
     WARNING: in order to avoid zombie processes (on unix),
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7257
	      you may have to fetch the processes exitstatus with
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7258
	      OperatingSystem>>getStatusOfProcess:aProcessId
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7259
	      if the signal terminates that process."
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7260
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7261
    "/
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7262
    "/ either invalid argument (non-integers)
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7263
    "/ or not supported by OS
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7264
    "/
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7265
    ^ self primitiveFailed
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7266
!
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7267
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7268
terminateProcess:processHandleOrPid
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7269
    "terminate a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7270
     The process has a chance to do some cleanup.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7271
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7272
     ATTENTION WIN32:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7273
	 Under unix, we have terminateProcess, which does a soft
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7274
	 terminate (giving the process a chance to cleanup) and
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7275
	 killProcess, which does a hard terminate.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7276
	 Under WIN32, both (currently) use the TerminateProcess
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7277
	 function, which unconditionally causes a process to exit.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7278
	 I.e. under WIN32, the process has no chance to perform cleanup.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7279
	 Use it only in extreme circumstances. The state of
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7280
	 global data maintained by dynamic-link libraries (DLLs)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7281
	 may be compromised if TerminateProcess is used.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7282
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7283
     TODO: send a WM_QUIT instead, to allow for proper shutdown."
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  7284
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7285
    self terminateProcess:processHandleOrPid exitCode:0
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7286
!
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7287
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7288
terminateProcess:processHandleOrPid exitCode:exitCode
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  7289
    "terminate a process.
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  7290
     The process should have a chance to do some cleanup.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7291
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7292
     ATTENTION WIN32:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7293
	 Under unix, we have terminateProcess, which does a soft
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7294
	 terminate (giving the process a chance to cleanup) and
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7295
	 killProcess, which does a hard terminate.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7296
	 Under WIN32, both (currently) use the TerminateProcess
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7297
	 function, which unconditionally causes a process to exit.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7298
	 I.e. under WIN32, the process has no chance to perform cleanup.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7299
	 Use it only in extreme circumstances. The state of
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7300
	 global data maintained by dynamic-link libraries (DLLs)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7301
	 may be compromised if TerminateProcess is used.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7302
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7303
     TODO: send a WM_QUIT instead, to allow for proper shutdown."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7304
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7305
%{
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7306
    if (__isExternalAddressLike(processHandleOrPid) ) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7307
	HANDLE hProcess = _HANDLEVal(processHandleOrPid);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7308
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7309
	if (hProcess != 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7310
	    TerminateProcess( hProcess, __intVal(exitCode) );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7311
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7312
	RETURN( true );
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7313
    } else if( __isSmallInteger(processHandleOrPid) ) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7314
	HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, __smallIntegerVal(processHandleOrPid));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7315
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7316
	if( hProcess != 0 ) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7317
	    TerminateProcess( hProcess, __intVal(exitCode) );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7318
	    CloseHandle(hProcess);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7319
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7320
	RETURN( true );
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7321
    }
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7322
%}.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7323
    self primitiveFailed:#invalidParameter.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7324
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7325
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7326
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7327
    "Modified: / 27.1.1998 / 20:05:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7328
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7329
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7330
terminateProcessGroup:processGroupHandleOrPid
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7331
    "terminate a process group (that is all subprocesses of a process).
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7332
     The process(es) have a chance to do some cleanup.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7333
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7334
     ATTENTION WIN32:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7335
	 Under unix, we have terminateProcess, which does a soft
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7336
	 terminate (giving the process a chance to cleanup) and
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7337
	 killProcess, which does a hard terminate.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7338
	 Under WIN32, both (currently) use the TerminateProcess
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7339
	 function, which unconditionally causes a process to exit.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7340
	 I.e. under WIN32, the process has no chance to perform cleanup.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7341
	 Use it only in extreme circumstances. The state of
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7342
	 global data maintained by dynamic-link libraries (DLLs)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7343
	 may be compromised if TerminateProcess is used.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7344
     TODO: send a WM_QUIT instead, to allow for proper shutdown."
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7345
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7346
    | pid list groupsToTerminate anyMore |
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7347
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7348
    list := self getAllProcesses.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7349
    list size == 0 ifTrue:[^ self ].
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7350
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7351
    processGroupHandleOrPid isInteger ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7352
	pid := processGroupHandleOrPid
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7353
    ] ifFalse:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7354
	pid := processGroupHandleOrPid pid.
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7355
    ].
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7356
    groupsToTerminate := Set with:pid.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7357
    list := list asSet.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7358
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7359
    "/ Transcript show:'terminate group '; showCR:pid.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7360
    anyMore := true.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7361
    [anyMore] whileTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7362
	anyMore := false.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7363
	list doWithExit:[:anOSProcess :exit |
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7364
	    |pid|
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7365
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7366
	    (groupsToTerminate includes:anOSProcess parentPid) ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7367
		pid := anOSProcess pid.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7368
		groupsToTerminate add:pid.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7369
		"/ Transcript show:'terminate '; showCR:pid.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7370
		self terminateProcess:( pid ).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7371
		list remove:anOSProcess.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7372
		anyMore := true.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7373
		"/ need to restart: we have removed an element inside the loop
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7374
		exit value:nil
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7375
	    ].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7376
	].
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7377
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7378
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7379
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7380
!Win32OperatingSystem class methodsFor:'ipc support'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7381
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7382
makePipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7383
    "make a pipe, return array with two filedescriptors on success,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7384
     nil on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7385
     This is a lowLevel entry, not for public use.
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7386
     See NonPositionableExternalStream>>makePipe for a more user-friendly, public interface."
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7387
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7388
    |fd1 fd2 error|
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7389
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7390
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7391
    HANDLE   pipeRead  = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7392
    HANDLE   pipeWrite = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7393
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7394
    SECURITY_ATTRIBUTES sa;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7395
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7396
    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7397
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7398
    sa.lpSecurityDescriptor = NULL;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  7399
    // sa.bInheritHandle = TRUE;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  7400
    sa.bInheritHandle = FALSE;
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7401
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7402
    if( ! CreatePipe( &pipeRead, &pipeWrite, &sa, 0 ) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7403
	@global(LastErrorNumber) = error = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7404
	goto out;
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7405
    }
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7406
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7407
#if 1
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7408
    fd1 = __MKEXTERNALADDRESS(pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7409
    fd2 = __MKEXTERNALADDRESS(pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7410
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7411
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7412
     * make fileDescriptors from handles
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7413
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7414
# ifdef PROCESSDEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  7415
    console_printf("piperead %x\n",pipeRead);
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  7416
    console_printf("pipewrite %x\n",pipeWrite);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7417
# endif
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7418
    fd1 = __mkSmallInteger(_open_osfhandle(pipeRead, O_BINARY));
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7419
    fd2 = __mkSmallInteger(_open_osfhandle(pipeWrite, O_BINARY));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7420
#endif
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7421
out:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7422
%}.
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
  7423
    (fd1 notNil and:[fd2 notNil]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7424
	(fd1 ~~ -1 and:[fd2 ~~ -1]) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7425
	    ^ Array with:fd1 with:fd2.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7426
	].
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7427
    ].
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7428
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7429
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7430
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7431
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7432
!Win32OperatingSystem class methodsFor:'misc'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7433
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7434
closePid:pid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7435
    "free pid resource"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7436
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7437
    if (__isExternalAddressLike(pid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7438
	HANDLE __pid = _HANDLEVal(pid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7439
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7440
	if (__pid != 0) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7441
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7442
	    console_printf("Close ProcessHandle %x\n", __pid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7443
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7444
	    CloseHandle(__pid);
14636
26765f6a6b11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  7445
	    _SETHANDLEVal(pid, 0);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7446
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7447
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7448
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7449
    ^ true.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7450
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7451
    "Created: 28.1.1998 / 14:23:04 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7452
    "Modified: 28.1.1998 / 14:27:18 / md"
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7453
!
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7454
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7455
duplicateHandle:aHandle to:targetProcessHandle
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7456
    |hMe spaceForTargetHandle rslt addr|
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7457
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7458
    spaceForTargetHandle := ExternalLong unprotectedNew.
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7459
    hMe := self getCurrentProcess.
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7460
    rslt := self
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7461
		primDuplicateHandle_hSourcProcessHandle:hMe
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7462
		hSourceHandle:aHandle
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7463
		hTargetProcesshandle:targetProcessHandle ? hMe
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7464
		lpTargetHandle:spaceForTargetHandle
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7465
		dwDesiredAccess:0
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7466
		bInheritHandle:false
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7467
		dwOptions:2 "DUPLICATE_SAME_ACCESS".
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7468
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7469
    rslt ifFalse:[
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7470
	spaceForTargetHandle free.
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7471
	self primitiveFailed:self primGetLastError.
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7472
	^ nil
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7473
    ].
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7474
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7475
    addr := spaceForTargetHandle value.
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7476
    spaceForTargetHandle free.
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7477
    ^ ExternalAddress newAddress:addr.
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7478
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7479
    "Created: / 18-09-2007 / 16:34:25 / cg"
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7480
    "Modified: / 21-11-2012 / 12:14:06 / anwild"
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7481
!
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7482
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7483
getAllProcesses
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7484
    "answer a sequence of OSProcess, all processes running in system"
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7485
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7486
    |list st_perProc f|
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7487
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7488
    list := OrderedCollection new.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7489
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7490
%{
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7491
#ifdef TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7492
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7493
    HANDLE hProcessSnap;
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7494
    PROCESSENTRY32 pe32;
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7495
    hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7496
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7497
    if( hProcessSnap != INVALID_HANDLE_VALUE ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7498
	pe32.dwSize = sizeof(PROCESSENTRY32);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7499
	Process32First( hProcessSnap, & pe32 );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7500
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7501
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7502
	    st_perProc = __SSEND0(@global(OSProcess), @symbol(new), 0);
15369
4c2d17d8fa1a fixed wrong getAllProcesses: could crash the VM when a garbage collect
Claus Gittinger <cg@exept.de>
parents: 15339
diff changeset
  7503
	    f = __MKSTRING(pe32.szExeFile);
4c2d17d8fa1a fixed wrong getAllProcesses: could crash the VM when a garbage collect
Claus Gittinger <cg@exept.de>
parents: 15339
diff changeset
  7504
	    __SSEND1(st_perProc, @symbol(commandLine:), 0, f );
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7505
	    __SSEND1(st_perProc, @symbol(pid:), 0, __mkSmallInteger(pe32.th32ProcessID) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7506
	    __SSEND1(st_perProc, @symbol(parentPid:), 0, __mkSmallInteger(pe32.th32ParentProcessID) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7507
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7508
	    __SSEND1(list, @symbol(add:), 0, st_perProc );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7509
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7510
	while(Process32Next(hProcessSnap,&pe32));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7511
	CloseHandle( hProcessSnap );
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  7512
    }
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  7513
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7514
#endif  /* TLHELP32_H_INCLUDE */
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7515
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7516
%}.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7517
    ^ list
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7518
!
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7519
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7520
getCurrentProcess
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7521
    <apicall: handle "GetCurrentProcess" ( ) module: "kernel32.dll" >
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7522
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7523
    "
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7524
     self getCurrentProcess
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7525
    "
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7526
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7527
    "Created: / 18-09-2007 / 16:32:22 / cg"
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7528
!
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7529
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7530
getPrivateProfileString:appNameString key:keyNameString default:defaultString fileName:fileName
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7531
    ^ self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7532
	getProfileString:appNameString key:keyNameString default:defaultString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7533
	fileName:fileName private:true
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7534
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7535
    "Modified: / 27-07-2006 / 11:57:03 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7536
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7537
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7538
getProfileString:appNameString key:keyNameString default:defaultString
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7539
%{
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7540
    char *__appNameString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7541
    char *__keyNameString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7542
    char *__defaultString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7543
    char *__returnedString = NULL;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7544
    char quickBuffer[1024];
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7545
    char *usedBuffer = quickBuffer;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7546
    int bufferSize = sizeof(quickBuffer);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7547
    int nChars;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7548
    OBJ retVal;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7549
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7550
    if (__isStringLike(appNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7551
	__appNameString = __stringVal(appNameString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7552
    } else if (appNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7553
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7554
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7555
    if (__isStringLike(keyNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7556
	__keyNameString = __stringVal(keyNameString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7557
    } else if (keyNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7558
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7559
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7560
    if (__isStringLike(defaultString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7561
	__defaultString = __stringVal(defaultString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7562
    } else if (defaultString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7563
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7564
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7565
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7566
	nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7567
	if (nChars >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7568
	    if (nChars != bufferSize-1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7569
		retVal = __MKSTRING_L(usedBuffer, nChars);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7570
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7571
		RETURN (retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7572
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7573
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7574
	    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7575
		/* use a bigger buffer */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7576
		char *newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7577
		int newBufferSize = bufferSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7578
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7579
		newBuffer = (char *)malloc( newBufferSize );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7580
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7581
		usedBuffer = newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7582
		bufferSize = newBufferSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7583
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7584
	}
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7585
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7586
    } while (nChars > 0);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7587
    RETURN (nil);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7588
  primitiveFail: ;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7589
%}.
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7590
    self primitiveFailed
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7591
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7592
    "Created: / 27-07-2006 / 11:54:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7593
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7594
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7595
getProfileString:appNameString key:keyNameString default:defaultString fileName:fileName private:private
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7596
%{
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7597
    char *__appNameString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7598
    char *__keyNameString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7599
    char *__defaultString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7600
    char *__returnedString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7601
    char *__fileName = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7602
    char quickBuffer[1024];
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7603
    char *usedBuffer = quickBuffer;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7604
    int bufferSize = sizeof(quickBuffer);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7605
    int nChars;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7606
    OBJ retVal;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7607
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7608
    if (__isStringLike(appNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7609
	__appNameString = __stringVal(appNameString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7610
    } else if (appNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7611
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7612
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7613
    if (__isStringLike(keyNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7614
	__keyNameString = __stringVal(keyNameString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7615
    } else if (keyNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7616
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7617
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7618
    if (__isStringLike(defaultString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7619
	__defaultString = __stringVal(defaultString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7620
    } else if (defaultString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7621
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7622
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7623
    if (private == true) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7624
	if (! __isStringLike(fileName)) goto primitiveFail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7625
	__fileName = __stringVal(fileName);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7626
    }
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7627
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7628
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7629
	if (private == true) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7630
	    nChars = GetPrivateProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize, __fileName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7631
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7632
	    nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7633
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7634
	if (nChars >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7635
	    if (nChars != bufferSize-1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7636
		retVal = __MKSTRING_L(usedBuffer, nChars);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7637
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7638
		RETURN (retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7639
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7640
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7641
	    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7642
		/* use a bigger buffer */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7643
		char *newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7644
		int newBufferSize = bufferSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7645
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7646
		newBuffer = (char *)malloc( newBufferSize );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7647
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7648
		usedBuffer = newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7649
		bufferSize = newBufferSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7650
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7651
	}
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7652
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7653
    } while (nChars > 0);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7654
    RETURN (nil);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7655
  primitiveFail: ;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7656
%}.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7657
    self primitiveFailed
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7658
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7659
    "Created: / 27-07-2006 / 11:55:25 / fm"
10274
a90d2c9d04b0 writePrivateProfileString
fm
parents: 10180
diff changeset
  7660
!
a90d2c9d04b0 writePrivateProfileString
fm
parents: 10180
diff changeset
  7661
10615
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7662
hInstance
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7663
    "very Win32 specific: get the HINSTANCE of the executable"
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7664
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7665
%{
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7666
    extern void *__getHInstance();
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7667
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7668
    RETURN (__MKEXTERNALADDRESS(__getHInstance()));
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7669
%}
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7670
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7671
    "
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7672
     Win32OperatingSystem hInstance
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7673
    "
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7674
!
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7675
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7676
isValidHandle:anExternalAddress
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7677
    |newHandle|
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7678
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7679
    newHandle := self duplicateHandle:anExternalAddress to:nil.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7680
    newHandle isNil ifTrue:[
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7681
	^ false.
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7682
    ].
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7683
"/    self closeHandle:newHandle.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7684
    ^ true.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7685
!
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7686
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7687
playSound:fileName
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7688
    self playSound:fileName mode:1
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7689
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7690
"/#define SND_SYNC            0x0000  /* play synchronously (default) */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7691
"/#define SND_ASYNC           0x0001  /* play asynchronously */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7692
"/#define SND_NODEFAULT       0x0002  /* silence (!!default) if sound not found */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7693
"/#define SND_LOOP            0x0008  /* loop the sound until next sndPlaySound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7694
"/#define SND_NOSTOP          0x0010  /* don't stop any currently playing sound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7695
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7696
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7697
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7698
	playSound:'C:\Dokumente und Einstellungen\cg\work\exept\expecco\resources\sounds\start.wav'
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7699
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7700
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7701
    "Created: / 06-11-2007 / 00:46:57 / cg"
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7702
!
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7703
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7704
playSound:fileName mode:modeInteger
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7705
    <apicall: void "sndPlaySoundA" ( lpstr uint32) module: "winmm.dll" >
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7706
    self primitiveFailed.
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7707
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7708
"/#define SND_SYNC            0x0000  /* play synchronously (default) */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7709
"/#define SND_ASYNC           0x0001  /* play asynchronously */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7710
"/#define SND_NODEFAULT       0x0002  /* silence (!!default) if sound not found */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7711
"/#define SND_LOOP            0x0008  /* loop the sound until next sndPlaySound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7712
"/#define SND_NOSTOP          0x0010  /* don't stop any currently playing sound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7713
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7714
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7715
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7716
	playSound:'C:\Dokumente und Einstellungen\cg\work\exept\expecco\resources\sounds\start.wav'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7717
	mode:1
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7718
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7719
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7720
    "Modified: / 06-11-2007 / 00:46:27 / cg"
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7721
!
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7722
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7723
primCloseHandle: handle
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7724
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7725
    <apicall: ulongReturn "CloseHandle" ( handle ) module: "kernel32.dll" >
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7726
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7727
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7728
primDuplicateHandle_hSourcProcessHandle:hSourceProcess
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7729
    hSourceHandle:hSourceHandle
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7730
    hTargetProcesshandle:hTargetProcessHandle
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7731
    lpTargetHandle:lpTargetHandle
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7732
    dwDesiredAccess:desiredAccess
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7733
    bInheritHandle:bInheritHandle
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7734
    dwOptions:dwOptions
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7735
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7736
    <apicall: bool "DuplicateHandle" ( handle, handle, handle, pointer, dword, bool, dword) module: "kernel32.dll" >
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7737
    self primitiveFailed.
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7738
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7739
    "Created: / 18-09-2007 / 16:31:23 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7740
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7741
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7742
primGetLastError
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7743
%{  /* NOCONTEXT */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7744
    DWORD e;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7745
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7746
    e = GetLastError();
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7747
    RETURN(__MKUINT(e));
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7748
%}.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7749
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7750
    "/ <apicall: dword "GetLastError" () module: "kernel32.dll" >
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7751
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7752
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7753
	self primGetLastError
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7754
    "
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7755
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7756
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7757
primSetLastError: i
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7758
%{  /* NOCONTEXT */
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7759
    if (__isSmallInteger(i)) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7760
	SetLastError(__intVal(i));
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7761
	RETURN(self);
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7762
    }
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7763
%}.
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7764
    self primitiveFailed.
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7765
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7766
   "/ <apicall: void "SetLastError" (dword) module: "kernel32.dll" >
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7767
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7768
    "
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7769
	self primSetLastError: 0
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7770
    "
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7771
!
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7772
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7773
primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7774
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7775
    <apicall: bool "WritePrivateProfileStringA" ( lpstr lpstr lpstr lpstr ) module: "Kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7776
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7777
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7778
    "Created: / 18-12-2006 / 13:01:41 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7779
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7780
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7781
writePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7782
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7783
   ^self primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7784
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7785
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7786
    |profileStringToWrite recoveredProfileString|
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7787
    profileStringToWrite :=  'c:\vsw311'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7788
    self writePrivateProfileString: 'PAV-Editor' keyName: 'ExportPath' profileString: profileStringToWrite fileName: 'C:\vsw311\dapas.ini'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7789
    recoveredProfileString := self getProfileString:'PAV-Editor' key:'ExportPath' default:'@@@nil@@@' fileName:'C:\vsw311\dapas.ini' private:true.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7790
    self assert: (profileStringToWrite = recoveredProfileString).
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7791
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7792
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7793
    "Modified: / 18-12-2006 / 13:20:20 / User"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7794
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7795
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7796
!Win32OperatingSystem class methodsFor:'mutex'!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7797
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7798
createMutexNamed: name
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7799
    "Returns an array with the handle and the lastErrorCode"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7800
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7801
    |handle lastErrorCode|
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7802
12986
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7803
    "/ "Without clear reasons, before creating the mutex we must call #printCR"
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7804
    "/ 'Creating mutex' printCR.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7805
    self primSetLastError: 0.
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7806
    self primGetLastError.
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7807
    handle := self primCreateMutex:nil initialOwner: true name: name.
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7808
    lastErrorCode := self primGetLastError.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7809
    "/ lastErrorCode printCR.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7810
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7811
"/    self assert: lastErrorCode == 0.
11342
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7812
"/    lastErrorCode == 5 "ERROR_ACCESS_DENIED" ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7813
"/    lastErrorCode == 183 "ERROR_ALREADY_EXISTS" ifTrue:[Transcript showCR: 'Mutex already exists (GetLastError = ERROR_ALREADY_EXISTS)'.].
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7814
    (handle isNil or:[handle address ~~ 0]) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7815
	Transcript showCR: 'CreateMutexNamed: "', name printString, '" failed'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7816
	handle := nil.
11342
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7817
    ].
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7818
    ^ Array with: handle with: lastErrorCode
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7819
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7820
    "
12986
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7821
     self createMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7822
     self releaseMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7823
    "
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7824
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7825
    "Modified: / 03-08-2010 / 16:57:36 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7826
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7827
11086
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7828
existsMutexNamed: name
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7829
    |handle lastErrorCode handleAndLastErrorCode|
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7830
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7831
    handleAndLastErrorCode := self createMutexNamed: name.
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7832
    handle := handleAndLastErrorCode first.
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7833
    lastErrorCode := handleAndLastErrorCode second.
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7834
"/    self assert: lastErrorCode == 0.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7835
    ^ handle isNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7836
	or:[lastErrorCode == 183 "ERROR_ALREADY_EXISTS"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7837
	    or:[ lastErrorCode == 5 "ERROR_ACCESS_DENIED"]]
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7838
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7839
    "Modified: / 03-08-2010 / 16:59:41 / cg"
11086
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7840
!
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7841
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7842
openMutexNamed: name
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7843
    "If the function succeeds, the return value is a handle to the mutex object.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7844
     If the function fails, the return value is NULL. To get extended error information, call GetLastError.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7845
     If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND."
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7846
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7847
    |handle |
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7848
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7849
    handle := self primOpenMutex:nil initialOwner: true name: name.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7850
"/    lastErrorCode := self primGetLastError.
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7851
"/    lastErrorCode = 2 ifTrue:[Transcript showCR: 'Mutex does not exist (GetLastError = ERROR_FILE_NOT_FOUND)'.].
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7852
"/    lastErrorCode = 5 ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7853
    (handle isNil or:[handle address ~~ 0]) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7854
	Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7855
	^ nil.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7856
    ].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7857
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7858
    ^ handle
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7859
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7860
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7861
    "
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7862
    self openMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7863
    "
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7864
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7865
    "Modified: / 03-08-2010 / 16:59:37 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7866
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7867
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7868
primCreateMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7869
    "If the function succeeds, the return value is a handle to the newly created mutex object.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7870
     If the function fails, the return value is NULL.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7871
     If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object."
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7872
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7873
    <apicall: handle "CreateMutexA" (lpstr bool lpstr) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7874
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7875
    "Modified: / 03-08-2010 / 16:59:26 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7876
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7877
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7878
primOpenMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7879
    "If the function succeeds, the return value is a handle to the mutex object.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7880
     If the function fails, the return value is NULL. To get extended error information, call GetLastError.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7881
     If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND."
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7882
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7883
    <apicall: handle "OpenMutexA" (lpstr bool lpstr) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7884
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7885
    "Modified: / 03-08-2010 / 16:59:11 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7886
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7887
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7888
primReleaseMutex: hMutex
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7889
    "If the function succeeds, the return value is nonzero.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7890
     If the function fails, the return value is zero."
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7891
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7892
    <apicall: bool "ReleaseMutex" (handle) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7893
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7894
    "Modified: / 03-08-2010 / 16:59:55 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7895
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7896
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7897
primWaitForSingleObject: handle milliseconds: dwMilliseconds
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7898
    "If the function succeeds, the return value indicates the event that caused the function to return.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7899
     If the function fails, the return value is WAIT_FAILED ((DWORD)0xFFFFFFFF)."
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7900
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7901
    <apicall: dword "WaitForSingleObject" (handle dword) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7902
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7903
    "Modified: / 03-08-2010 / 17:00:02 / cg"
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7904
!
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7905
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7906
releaseMutex: hMutex
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7907
    "Returns true if the Mutex was released. Otherwise, returns false."
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7908
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7909
    | released|
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7910
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7911
    hMutex isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7912
	Transcript showCR: 'hMutex is nil - cannot release'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7913
	^ false
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7914
    ].
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7915
    released := self primReleaseMutex: hMutex.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7916
    released ifFalse:[Transcript showCR: 'Release Mutex failed'.].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7917
    ^ released
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7918
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7919
    "Modified: / 03-08-2010 / 17:00:05 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7920
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7921
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7922
releaseMutexNamed: name
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7923
    "Returns true if the Mutex was released. Otherwise, returns false."
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7924
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7925
    | hMutex |
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7926
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7927
    hMutex := self openMutexNamed: name.
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7928
    hMutex isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7929
	Transcript showCR: 'Cannot release Mutex named: "', name printString,'"'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7930
	^ false
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7931
    ].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7932
    ^ self releaseMutex: hMutex.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7933
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7934
    "Modified: / 03-08-2010 / 16:58:25 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7935
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7936
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7937
waitForSingleObject: handle
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7938
    |result|
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7939
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7940
    result := self primWaitForSingleObject: handle milliseconds: 500.
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7941
    ^ result
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7942
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7943
    "Modified: / 03-08-2010 / 17:00:10 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7944
! !
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7945
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7946
!Win32OperatingSystem class methodsFor:'network resources'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7947
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7948
networkResourceAccessor
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7949
    "answer the Win32NetworkResourceHandle or nil if not supported"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7950
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7951
    ^ Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7952
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7953
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7954
!Win32OperatingSystem class methodsFor:'notifications'!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7955
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7956
createChangeNotificationHandleFor:aDirectoryPathName flags:changeFlags
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7957
    |handle|
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7958
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7959
    handle := Win32ChangeNotificationHandle new.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7960
%{
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7961
    if (__isString(aDirectoryPathName)
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7962
     && __isSmallInteger(changeFlags)) {
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7963
	char *__dirName = __stringVal(aDirectoryPathName);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7964
	INT __flags = __intVal(changeFlags);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7965
	HANDLE __changeHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7966
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7967
	__changeHandle = FindFirstChangeNotification(__dirName, FALSE, __flags);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7968
	if (__changeHandle == INVALID_HANDLE_VALUE) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7969
	    console_printf("failed to create handle\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7970
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7971
	    __externalAddressVal(handle) = __changeHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7972
	    RETURN (handle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7973
	}
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7974
    }
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7975
%}.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7976
    self primitiveFailed
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7977
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7978
    "
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7979
	|h|
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7980
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7981
	[
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7982
	    h := OperatingSystem createChangeNotificationHandleFor:'.'
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7983
		flags:(FILE_NOTIFY_CHANGE_FILE_NAME  |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7984
		       FILE_NOTIFY_CHANGE_DIR_NAME |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7985
		       FILE_NOTIFY_CHANGE_ATTRIBUTES |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7986
		       FILE_NOTIFY_CHANGE_SIZE |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7987
		       FILE_NOTIFY_CHANGE_LAST_WRITE).
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7988
	    Transcript showCR:'waiting...'.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7989
	    OperatingSystem waitForSingleObject:h withTimeout:1000.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7990
	    Transcript showCR:'got a change...'.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7991
	    h close.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7992
	] fork.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7993
	Delay waitForSeconds:0.25.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7994
	Transcript showCR:'changing...'.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  7995
	'./bla' asFilename contents:'hello'.
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7996
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7997
    "
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7998
! !
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7999
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8000
!Win32OperatingSystem class methodsFor:'os queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8002
executableFileExtensions
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8003
    "return a collection of extensions for executable program files.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8004
     Only req'd for msdos like systems ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8005
13616
69b0892613ed changed: #executableFileExtensions
Claus Gittinger <cg@exept.de>
parents: 13583
diff changeset
  8006
    ^ #('com' 'exe' 'bat')
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8007
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  8008
    "Created: / 02-05-1997 / 11:42:29 / cg"
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  8009
    "Modified: / 23-08-2011 / 21:14:45 / jv"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8010
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8011
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8012
getDomainName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8013
    "return the DNS domain this host is in.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8014
     Notice:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8015
	not all systems support this; on some, 'unknown' is returned."
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8016
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8017
    |domainName idx hostName k|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8018
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8019
    DomainName notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8020
	^ DomainName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8021
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8022
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8023
    "/ sometimes, we can extract the domainName from the hostName ...
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8024
    hostName := self getHostName.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8025
    hostName notEmptyOrNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8026
	idx := hostName indexOf:$..
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8027
	idx ~~ 0 ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8028
	    domainName := hostName copyFrom:idx+1.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8029
	]
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8030
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8031
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8032
    domainName isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8033
	domainName := self getEnvironment:'DOMAIN'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8034
	domainName isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8035
	    domainName := self getEnvironment:'DOMAINNAME'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8036
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8037
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8038
	domainName isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8039
	    "/ ok, search the registry ...
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8040
	    "/ under NT and later, it is found there ...
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8041
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8042
	    k notNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8043
		domainName := k valueNamed:'Domain'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8044
		k close.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8045
	    ].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8046
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8047
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8048
	domainName isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8049
	    ^ 'unknown'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8050
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8051
	DomainName := domainName.     "cache only, if it is fixed"
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8052
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8053
    ^ domainName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8054
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8055
    "
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  8056
     DomainName := nil.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  8057
     OperatingSystem getDomainName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8058
     OperatingSystem getHostName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8059
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8060
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8061
    "Modified: 26.4.1996 / 10:04:54 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8062
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8063
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8064
getEnvironment:aStringOrSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8065
    "get an environment string"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8066
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8067
%{  /* NOCONTEXT */
19284
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8068
#   define ENV_BUFSIZE 2048
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8069
    WCHAR _varName[ENV_BUFSIZE];
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8070
    WCHAR buff[ENV_BUFSIZE];
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8071
    int nNeeded;
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8072
    OBJ ret = nil;
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8073
    int i, l;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8074
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  8075
    if (__isStringLike(aStringOrSymbol)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8076
	l = __stringSize(aStringOrSymbol);
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8077
	if (l > ENV_BUFSIZE-1)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8078
	    goto badArgument;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8079
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8080
	    _varName[i] = __stringVal(aStringOrSymbol)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8081
	}
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8082
    } else if (__isUnicode16String(aStringOrSymbol)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8083
	l = __unicode16StringSize(aStringOrSymbol);
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8084
	if (l > ENV_BUFSIZE-1)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8085
	    goto badArgument;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8086
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8087
	    _varName[i] = __unicode16StringVal(aStringOrSymbol)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8088
	}
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8089
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8090
	goto badArgument;
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8091
    }
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8092
    _varName[l] = 0;
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8093
19284
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8094
    nNeeded = GetEnvironmentVariableW(_varName, buff, ENV_BUFSIZE);
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8095
    if (nNeeded > sizeof(buff)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8096
	WCHAR *buff2;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8097
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8098
	buff2 = (char *)malloc(nNeeded * sizeof(WCHAR));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8099
	GetEnvironmentVariableW(_varName, buff2, nNeeded);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8100
	ret = __mkStringOrU16String_maxlen(buff2, nNeeded);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8101
	free(buff2);
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8102
    } else if (nNeeded > 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8103
	ret = __mkStringOrU16String_maxlen(buff, nNeeded);
19284
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8104
	// console_printf("getenv() -> %"_lx_"\n", (INT)ret);
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8105
    }
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8106
    RETURN (ret);
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8107
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8108
badArgument:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8109
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8110
.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8111
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8112
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8113
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8114
     OperatingSystem getEnvironment:'PATH'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8115
    "
10294
f9fd95f04653 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10287
diff changeset
  8116
10297
d93eeb6c92eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10294
diff changeset
  8117
    "Modified: / 09-01-2007 / 20:14:35 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8118
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8119
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  8120
getHostName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8121
    "return the hostname we are running on
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8122
      - if possible, the fully qualified host name."
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8123
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8124
    |hostName|
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8125
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8126
%{  /* STACK: 2048 */
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8127
#if defined(__MINGW32__)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8128
    char bufferA[512];
14783
93bf8545cbd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14782
diff changeset
  8129
    DWORD buffSize = sizeof(bufferA);
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8130
#else
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  8131
    WCHAR buffer[512];
14087
6b3dea4f8fc9 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 14083
diff changeset
  8132
    DWORD buffSize = sizeof(buffer)/sizeof(buffer[0]);
14783
93bf8545cbd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14782
diff changeset
  8133
#endif
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8134
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  8135
    // Note: GetComputerNameExA can fail in certain locales!
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8136
#if defined(__MINGW32__)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8137
    if (GetComputerNameA(bufferA, &buffSize) == TRUE) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8138
	RETURN(__MKSTRING_L(bufferA, buffSize));
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  8139
    }
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  8140
#else
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  8141
    if (GetComputerNameExW(ComputerNameDnsFullyQualified, buffer, &buffSize) == TRUE) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8142
	RETURN(__mkStringOrU16String_maxlen(buffer, buffSize));
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8143
    }
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8144
#endif
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8145
%}.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8146
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8147
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8148
     OperatingSystem getHostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8149
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8150
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8151
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8152
getLanguage
10311
1cf7f6da9fad comment
Claus Gittinger <cg@exept.de>
parents: 10297
diff changeset
  8153
    "get the LANGUAGE setting (example: de_DE.iso8859-15@euro).
1cf7f6da9fad comment
Claus Gittinger <cg@exept.de>
parents: 10297
diff changeset
  8154
     An environment value has higher preceedence than the system language setting."
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8155
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8156
    |lang|
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8157
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8158
    lang := self getEnvironment:'LANG'.
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8159
    (lang isNil or:[lang = 'default']) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8160
	"/ ok, search the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8161
	"/ under XP, it is found there ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8162
	lang := RegistryEntry
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8163
		    stringValueFor:'sLanguage'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8164
		    atKey:'HKEY_CURRENT_USER\Control Panel\International'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8165
	lang notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8166
	    lang := self mapLanguage:lang.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8167
	].
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8168
    ].
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8169
    ^ lang
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8170
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8171
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  8172
     OperatingSystem getLanguage
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8173
    "
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8174
    "Modified: 26.4.1996 / 10:04:54 / stefan"
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8175
!
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8176
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8177
getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8178
    "return a dictionary filled with values from the locale information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8179
     Not all fields may be present, depending on the OS's setup and capabilities.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8180
     Possible fields are:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8181
	decimalPoint                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8182
	thousandsSep                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8183
	internationalCurrencySymbol     <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8184
	currencySymbol                  <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8185
	monetaryDecimalPoint            <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8186
	monetaryThousandsSeparator      <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8187
	positiveSign                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8188
	negativeSign                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8189
	internationalFractionalDigits   <Integer>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8190
	fractionalDigits                <Integer>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8191
	positiveSignPrecedesCurrencySymbol      <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8192
	negativeSignPrecedesCurrencySymbol      <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8193
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8194
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8195
	positiveSignPosition                            <Symbol>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8196
							one of: #parenthesesAround,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8197
								#signPrecedes,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8198
								#signSuceeds,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8199
								#signPrecedesCurrencySymbol,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8200
								#signSuceedsCurrencySymbol
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8201
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8202
	negativeSignPosition                            <like above>
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8203
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8204
     it is up to the application to deal with undefined values.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8205
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8206
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8207
     it should be used by applications as required.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8208
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8209
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8210
    |info val|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8211
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8212
    LocaleInfo notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8213
	"/ return the internal info; useful on systems which do not
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8214
	"/ support this.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8215
	^ LocaleInfo
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8216
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8217
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8218
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8219
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8220
    char *decimalPoint;         /* something like "." (US) or "," (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8221
    char *thousandsSep;         /* something like "," (US) or "." (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8222
    char *intCurrencySymbol;    /* international currency symbol; something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8223
    char *currencySymbol;       /* local currency symbol;         something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8224
    char *monDecimalPoint;      /* money: decimal point */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8225
    char *monThousandsSep;      /* money: thousands sep */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8226
    char *positiveSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8227
    char *negativeSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8228
    int   intFractDigits;       /* money: international digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8229
    int   fractDigits;          /* money: local digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8230
    int   csPosPrecedes;        /* money: 1 if currency symbol precedes a positive value; 0 if it sceeds */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8231
    int   csNegPrecedes;        /* money: 1 if currency symbol precedes a negative value; 0 if it sceeds */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8232
    int   csPosSepBySpace;      /* money: 1 if currency symbol should be separated by a space from a positive value; 0 if no space */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8233
    int   csNegSepBySpace;      /* money: 1 if currency symbol should be separated by a space from a negative value; 0 if no space */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8234
    int   csPosSignPosition;    /* money: 0: ()'s around the value & currency symbol */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8235
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8236
				/*        2: sign succeeds the value & currency symbol */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8237
				/*        3: sign immediately precedes the currency symbol */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8238
				/*        4: sign immediately suceeds the currency symbol */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8240
#if defined(HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8241
    struct lconv *conf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8242
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8243
    conf = localeconv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8244
    if (conf) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8245
	decimalPoint = conf->decimal_point;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8246
	thousandsSep = conf->thousands_sep;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8247
	intCurrencySymbol = conf->int_curr_symbol;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8248
	currencySymbol = conf->currency_symbol;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8249
	monDecimalPoint = conf->mon_decimal_point;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8250
	monThousandsSep = conf->mon_thousands_sep;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8251
	positiveSign = conf->positive_sign;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8252
	negativeSign = conf->negative_sign;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8253
	intFractDigits = conf->int_frac_digits;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8254
	fractDigits = conf->frac_digits;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8255
	csPosPrecedes = conf->p_cs_precedes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8256
	csNegPrecedes = conf->n_cs_precedes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8257
	csPosSepBySpace = conf->p_sep_by_space;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8258
	csNegSepBySpace = conf->n_sep_by_space;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8259
	csPosSignPosition = conf->p_sign_posn;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8260
	csNegSignPosition = conf->n_sign_posn;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8261
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8262
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8263
    decimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8264
    thousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8265
    intCurrencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8266
    currencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8267
    monDecimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8268
    monThousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8269
    positiveSign =  (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8270
    negativeSign =(char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8271
    intFractDigits = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8272
    fractDigits = -1;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8273
    csPosPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8274
    csNegPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8275
    csPosSepBySpace = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8276
    csNegSepBySpace = -1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8277
    csPosSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8278
    csNegSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8279
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8280
    if (decimalPoint) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8281
	val = __MKSTRING(decimalPoint);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8282
	__AT_PUT_(info, @symbol(decimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8283
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8284
    if (thousandsSep) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8285
	val = __MKSTRING(thousandsSep);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8286
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8287
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8288
    if (intCurrencySymbol) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8289
	val = __MKSTRING(intCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8290
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8291
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8292
    if (currencySymbol) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8293
	val = __MKSTRING(currencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8294
	__AT_PUT_(info, @symbol(currencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8295
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8296
    if (monDecimalPoint) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8297
	val = __MKSTRING(monDecimalPoint);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8298
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8299
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8300
    if (monThousandsSep) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8301
	val = __MKSTRING(monThousandsSep);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8302
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8303
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8304
    if (positiveSign) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8305
	val = __MKSTRING(positiveSign);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8306
	__AT_PUT_(info, @symbol(positiveSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8307
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8308
    if (negativeSign) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8309
	val = __MKSTRING(negativeSign);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8310
	__AT_PUT_(info, @symbol(negativeSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8311
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8312
    if (intFractDigits >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8313
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __mkSmallInteger(intFractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8314
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8315
    if (fractDigits >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8316
	__AT_PUT_(info, @symbol(fractionalDigits),  __mkSmallInteger(fractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8317
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8318
    if (csPosPrecedes >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8319
	if (csPosPrecedes == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8320
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8321
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8322
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8323
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8324
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8325
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8326
    if (csNegPrecedes >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8327
	if (csNegPrecedes == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8328
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8329
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8330
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8331
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8332
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8333
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8334
    if (csPosSepBySpace >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8335
	if (csPosSepBySpace == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8336
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8337
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8338
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8339
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8340
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8341
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8342
    if (csNegSepBySpace >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8343
	if (csNegSepBySpace == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8344
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8345
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8346
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8347
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8348
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8349
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8350
    switch (csPosSignPosition) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8351
	case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8352
	    val = @symbol(parenthesesAround);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8353
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8354
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8355
	case 1:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8356
	    val = @symbol(signPrecedes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8357
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8358
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8359
	case 2:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8360
	    val = @symbol(signSuceeds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8361
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8362
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8363
	case 3:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8364
	    val = @symbol(signPrecedesCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8365
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8366
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8367
	case 4:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8368
	    val = @symbol(signSuceedsCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8369
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8370
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8371
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8372
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8373
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8374
    if (val != nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8375
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8376
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8377
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8378
    switch (csNegSignPosition) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8379
	case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8380
	    val = @symbol(parenthesesAround);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8381
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8382
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8383
	case 1:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8384
	    val = @symbol(signPrecedes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8385
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8386
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8387
	case 2:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8388
	    val = @symbol(signSuceeds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8389
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8390
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8391
	case 3:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8392
	    val = @symbol(signPrecedesCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8393
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8394
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8395
	case 4:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8396
	    val = @symbol(signSuceedsCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8397
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8398
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8399
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8400
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8401
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8402
    if (val != nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8403
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8404
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8405
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8406
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8408
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8409
     OperatingSystem getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8410
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8411
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8412
    "Created: 23.12.1995 / 14:19:20 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8413
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8414
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8415
getNetworkAddresses
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8416
    "return a dictionary filled with
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8417
	key -> name of interface
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8418
	value -> the network adsress (as SocketAddress)
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8419
     for each interface
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8420
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8421
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8422
    |info nAdapters rawData entry
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8423
     name description macAddress ipAddress ipAddressMask|
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8424
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8425
    rawData := Array new:50.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8426
%{
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8427
/*
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8428
 * temporary undef String to avoid a #define-conflict
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8429
 * between ST/X's String and Windows String typedef
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8430
 */
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8431
# undef String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8432
# undef Context
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8433
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8434
    IP_ADAPTER_INFO AdapterInfo[32];
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8435
    DWORD dwBufLen = sizeof(AdapterInfo);
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8436
    DWORD dwStatus;
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8437
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8438
    dwStatus = GetAdaptersInfo(
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8439
			    AdapterInfo,                 // [out] buffer to receive data
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8440
			    &dwBufLen);                  // [in] size of receive data buffer
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8441
    if (dwStatus == ERROR_SUCCESS) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8442
	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8443
	unsigned char *bP;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8444
	int nA = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8445
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8446
	bP = __byteArrayVal(rawData);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8447
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8448
	    name = __MKSTRING(pAdapterInfo->AdapterName);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8449
	    description = __MKSTRING(pAdapterInfo->Description);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8450
	    macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8451
	    ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8452
	    ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8453
	    entry = __ARRAY_NEW_INT(5);
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8454
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8455
/*
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8456
 * back to ST/X's String definition
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8457
 */
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8458
# ifdef __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8459
#  define String __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8460
# endif
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8461
# ifdef __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8462
#  define Context __DEF_Context
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8463
# endif
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8464
	    __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8465
	    __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8466
	    __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8467
	    __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8468
	    __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8469
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8470
	    __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8471
	    nA++;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8472
	    pAdapterInfo = pAdapterInfo->Next;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8473
	} while(pAdapterInfo);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8474
	nAdapters = __mkSmallInteger(nA);
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8475
    }
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8476
%}.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8477
    "Keep the order as returned by the OS"
18674
242c1aae7702 bugfix - D134619 - Fix error when not network interface enabled
Michael Beyl <mb@exept.de>
parents: 18629
diff changeset
  8478
    info := OrderedDictionary new:nAdapters ? 0.
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8479
    nAdapters notNil ifTrue:[
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8480
	1 to:nAdapters do:[:i |
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8481
	    |entry name description macAddr ipAddr|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8482
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8483
	    entry := rawData at:i.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8484
	    name := entry at:1.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8485
	    "/ description := entry at:2.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8486
	    ipAddr := entry at:4.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8487
	    ipAddr := IPSocketAddress addressString:ipAddr.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8488
	    "take the first name"
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8489
	    (ipAddr hostAddress contains:[:b| b ~~ 0]) ifTrue:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8490
		info at:name ifAbsentPut:ipAddr.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8491
	    ]
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8492
	].
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8493
    ].
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8494
    ^ info
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8495
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8496
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8497
     OperatingSystem getNetworkAddresses
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8498
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8499
!
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8500
7287
b10efc6c9407 Fix spelling (getNetworkMACAddresses)
Stefan Vogel <sv@exept.de>
parents: 7199
diff changeset
  8501
getNetworkMACAddresses
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8502
    "return a dictionary filled with
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8503
	key -> name of interface
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8504
	value -> the MAC adress (as ByteArray)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8505
     for each interface
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8506
    "
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8507
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8508
    |info nAdapters rawData entry
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8509
     name description macAddress ipAddress ipAddressMask|
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8510
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8511
    rawData := Array new:50.
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8512
%{
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8513
/*
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8514
 * temporary undef String to avoid a #define-conflict
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8515
 * between ST/X's String and Windows String typedef
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8516
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8517
# undef String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8518
# undef Context
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8519
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8520
    IP_ADAPTER_INFO AdapterInfo[32];
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8521
    DWORD dwBufLen = sizeof(AdapterInfo);
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8522
    DWORD dwStatus;
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8523
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8524
    dwStatus = GetAdaptersInfo(
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8525
			    AdapterInfo,                 // [out] buffer to receive data
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8526
			    &dwBufLen);                  // [in] size of receive data buffer
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8527
    if (dwStatus == ERROR_SUCCESS) {
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8528
	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8529
	unsigned char *bP;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8530
	int nA = 0;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8531
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8532
	bP = __byteArrayVal(rawData);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8533
	do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8534
	    name = __MKSTRING(pAdapterInfo->AdapterName);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8535
	    description = __MKSTRING(pAdapterInfo->Description);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8536
	    macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8537
	    ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8538
	    ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8539
	    entry = __ARRAY_NEW_INT(5);
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  8540
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8541
/*
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8542
 * back to ST/X's String definition
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8543
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8544
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8545
#  define String __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8546
# endif
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8547
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8548
#  define Context __DEF_Context
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8549
# endif
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8550
	    __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8551
	    __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8552
	    __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8553
	    __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8554
	    __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8555
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8556
	    __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8557
	    nA++;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8558
	    pAdapterInfo = pAdapterInfo->Next;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8559
	} while(pAdapterInfo);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8560
	nAdapters = __mkSmallInteger(nA);
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8561
    }
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8562
%}.
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8563
    "Keep the order as reurned by the OS"
18674
242c1aae7702 bugfix - D134619 - Fix error when not network interface enabled
Michael Beyl <mb@exept.de>
parents: 18629
diff changeset
  8564
    info := OrderedDictionary new:nAdapters ? 0.
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8565
    nAdapters notNil ifTrue:[
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8566
	1 to:nAdapters do:[:i |
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8567
	    |entry name description macAddr ipAddr|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8568
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8569
	    entry := rawData at:i.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8570
	    name := entry at:1.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8571
	    "/ description := entry at:2.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8572
	    macAddr := entry at:3.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8573
	    "/ ipAddr := entry at:4.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8574
	    info at:name put:macAddr.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8575
	].
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8576
    ].
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8577
    ^ info
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8578
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8579
    "
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8580
     OperatingSystem getNetworkMACAddresses
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8581
    "
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8582
!
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8583
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8584
getNumberOfProcessors
12649
7d8aad540a9b changed comment: #getNumberOfProcessors
Stefan Vogel <sv@exept.de>
parents: 12638
diff changeset
  8585
    "answer the number of physical processors in the system"
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8586
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8587
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8588
	SYSTEM_INFO sInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8589
	GetSystemInfo(&sInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8590
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8591
	return __mkSmallInteger(sInfo.dwNumberOfProcessors);
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8592
    %}.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8593
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8594
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8595
	self getNumberOfProcessors
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8596
    "
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8597
!
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8598
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8599
getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8600
    "return the (unix-)processId"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8601
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8602
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8603
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8604
    int pid = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8605
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8606
    pid = GetCurrentProcessId() & 0x3FFFFFFF;
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  8607
    RETURN ( __mkSmallInteger(pid) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8608
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8609
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8610
     OperatingSystem getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8611
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8612
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8613
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8614
getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8615
    "if supported by the OS, return the systemID;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8616
     a unique per machine identification.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8617
     WARNING:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8618
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8619
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8620
%{  /* NO_CONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8621
#if defined(HAS_GETHOSTID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8622
    int runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8623
    OBJ arr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8624
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8625
    runningId = gethostid();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8626
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8627
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8628
    RETURN (arr);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8629
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8630
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8631
    {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8632
	char buffer[128];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8633
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8634
	buffer[0] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8635
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8636
	    buffer[127] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8637
	    if (strlen(buffer) > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8638
		RETURN(__MKSTRING(buffer));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8639
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8640
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8641
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8642
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8643
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8644
    ^ 'unknown'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8645
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8646
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8647
     OperatingSystem getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8648
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8649
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8650
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8651
getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8652
    "return info on the system weare running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8653
     If the system supports the uname system call, that info is returned;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8654
     otherwise, some simulated info is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8655
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8656
     WARNING:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8657
       Do not depend on the amount and contents of the returned information, some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8658
       systems may return more/less than others. Also, the contents depends on the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8659
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8660
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8661
       This method is mainly provided to augment error reports with some system
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8662
       information.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8663
       (in case of system/version specific OS errors, conditional workarounds and patches
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8664
	may be based upon this info).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8665
       Your application should NOT depend upon this in any way.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8666
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8667
     The returned info may (or may not) contain:
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8668
	#system -> some operating system identification (irix, Linux, nt, win32s ...)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8669
	#version -> OS version (some os version identification)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8670
	#release -> OS release (3.5, 1.2.1 ...)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8671
	#node   -> some host identification (hostname)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8672
	#domain  -> domain name (hosts domain)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8673
	#machine -> type of machine (i586, mips ...)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8674
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8675
     win32:
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8676
	#physicalRam -> total amount of physical memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8677
	#freeRam -> amount of free memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8678
	#swapSize -> size of swapSpace (page file)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8679
	#freeSwap -> free bytes in swapSpace
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8680
	#virtualRam -> total amount of virtual memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8681
	#freeVirtual -> amount of free virtual memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8682
	#memoryLoad -> percentage of memory usage (useless)
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8683
    "
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8684
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8685
    |sys node rel ver minorVer majorVer mach dom info arch
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8686
     physicalRam freeRam swapSize freeSwap
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8687
     virtualRam freeVirtual memoryLoad numberOfCPUs|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8688
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8689
%{  /* STACK: 4096 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8690
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8691
    char vsnBuffer[32];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8692
    char *s;
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8693
    int winVer, verMinor, verMajor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8694
    DWORD vsn;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8695
    SYSTEM_INFO sysInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8696
    MEMORYSTATUS memStatus;
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8697
    int len;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8698
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8699
    vsn = GetVersion();
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8700
    winVer = LOWORD(vsn);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8701
    verMinor = HIBYTE(winVer);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8702
    verMajor = LOBYTE(winVer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8703
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8704
    minorVer = __mkSmallInteger(verMinor);
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8705
    majorVer = __mkSmallInteger(verMajor);
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8706
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8707
    if (HIWORD(vsn) & 0x8000) {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8708
	sys = @symbol(win95);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8709
    } else {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8710
	if ((verMajor > 5)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8711
	 || ((verMajor == 5) && (verMinor >= 1))) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8712
	    sys = @symbol(xp);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8713
	    if (verMajor >= 6) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8714
		sys = @symbol(vista);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8715
		if (verMinor >= 1) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8716
		    sys = @symbol(win7);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8717
		    if (verMinor >= 2) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8718
			sys = @symbol(win8);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8719
		    }
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8720
		}
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8721
	    }
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8722
	} else {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8723
	    sys = @symbol(nt);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8724
	}
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8725
    }
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8726
    len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8727
    rel = __MKSTRING_L(vsnBuffer, len);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8728
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8729
    GetSystemInfo(&sysInfo);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8730
    memStatus.dwLength = sizeof(memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8731
    GlobalMemoryStatus(&memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8732
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8733
    memoryLoad = __MKUINT(memStatus.dwMemoryLoad);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8734
    physicalRam = __MKUINT(memStatus.dwTotalPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8735
    freeRam = __MKUINT(memStatus.dwAvailPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8736
    swapSize = __MKUINT(memStatus.dwTotalPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8737
    freeSwap = __MKUINT(memStatus.dwAvailPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8738
    virtualRam = __MKUINT(memStatus.dwTotalVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8739
    freeVirtual = __MKUINT(memStatus.dwAvailVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8740
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8741
#if defined(__BORLANDC__) && (__BORLANDC__ <= 1339)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8742
    /* BorlandC3 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8743
    switch (sysInfo.u.s.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8744
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8745
    /* MSC, BorlandC4 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8746
    switch (sysInfo.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8747
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8748
    {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8749
#ifdef PROCESSOR_ARCHITECTURE_INTEL
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8750
	case PROCESSOR_ARCHITECTURE_INTEL:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8751
	    arch = @symbol(intel);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8752
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8753
#endif
13534
a788fd375ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
  8754
#ifdef PROCESSOR_ARCHITECTURE_AMD64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8755
	case PROCESSOR_ARCHITECTURE_AMD64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8756
	    arch = @symbol(x64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8757
	    break;
13534
a788fd375ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
  8758
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8759
#ifdef PROCESSOR_ARCHITECTURE_MIPS
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8760
	case PROCESSOR_ARCHITECTURE_MIPS:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8761
	    arch = @symbol(mips);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8762
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8763
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8764
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8765
	case PROCESSOR_ARCHITECTURE_ALPHA:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8766
	    arch = @symbol(alpha);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8767
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8768
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8769
#ifdef PROCESSOR_ARCHITECTURE_ALPHA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8770
	case PROCESSOR_ARCHITECTURE_ALPHA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8771
	    arch = @symbol(alpha64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8772
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8773
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8774
#ifdef PROCESSOR_ARCHITECTURE_PPC
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8775
	case PROCESSOR_ARCHITECTURE_PPC:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8776
	    arch = @symbol(ppc);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8777
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8778
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8779
#ifdef PROCESSOR_ARCHITECTURE_ARM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8780
	case PROCESSOR_ARCHITECTURE_ARM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8781
	    arch = @symbol(arm);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8782
	    break;
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8783
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8784
#ifdef PROCESSOR_ARCHITECTURE_SHX
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8785
	case PROCESSOR_ARCHITECTURE_SHX:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8786
	    arch = @symbol(shx);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8787
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8788
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8789
#ifdef PROCESSOR_ARCHITECTURE_IA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8790
	case PROCESSOR_ARCHITECTURE_IA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8791
	    arch = @symbol(ia64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8792
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8793
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8794
#ifdef PROCESSOR_ARCHITECTURE_MSIL
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8795
	case PROCESSOR_ARCHITECTURE_MSIL:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8796
	    arch = @symbol(msil);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8797
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8798
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8799
#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8800
	case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8801
	    arch = @symbol(ia32_on_win64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8802
	    break;
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8803
#endif
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8804
	default:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8805
	    arch = @symbol(unknown);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8806
	    break;
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8807
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8808
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8809
    switch (sysInfo.dwProcessorType) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8810
#ifdef PROCESSOR_INTEL_386
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8811
	case PROCESSOR_INTEL_386:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8812
	    mach = @symbol(i386);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8813
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8814
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8815
#ifdef PROCESSOR_INTEL_486
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8816
	case PROCESSOR_INTEL_486:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8817
	    mach = @symbol(i486);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8818
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8819
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8820
#ifdef PROCESSOR_INTEL_PENTIUM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8821
	case PROCESSOR_INTEL_PENTIUM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8822
	    mach = @symbol(i586);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8823
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8824
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8825
#ifdef PROCESSOR_INTEL_860
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8826
	case PROCESSOR_INTEL_860:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8827
	    mach = @symbol(i860);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8828
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8829
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8830
#ifdef PROCESSOR_INTEL_IA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8831
	case PROCESSOR_INTEL_IA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8832
	    mach = @symbol(ia64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8833
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8834
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8835
#ifdef PROCESSOR_AMD_X8664
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8836
	case PROCESSOR_AMD_X8664:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8837
	    mach = @symbol(x86_64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8838
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8839
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8840
#ifdef PROCESSOR_MIPS_R2000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8841
	case PROCESSOR_MIPS_R2000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8842
	    mach = @symbol(r2000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8843
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8844
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8845
#ifdef PROCESSOR_MIPS_R3000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8846
	case PROCESSOR_MIPS_R3000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8847
	    mach = @symbol(r3000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8848
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8849
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8850
#ifdef PROCESSOR_MIPS_R4000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8851
	case PROCESSOR_MIPS_R4000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8852
	    mach = @symbol(r4000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8853
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8854
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8855
#ifdef PROCESSOR_ALPHA_21064
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8856
	case PROCESSOR_ALPHA_21064:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8857
	    mach = @symbol(alpha21064);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8858
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8859
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8860
#ifdef PROCESSOR_ARM720
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8861
	case PROCESSOR_ARM720:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8862
	    mach = @symbol(arm720);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8863
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8864
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8865
#ifdef PROCESSOR_ARM820
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8866
	case PROCESSOR_ARM820:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8867
	    mach = @symbol(arm820);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8868
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8869
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8870
#ifdef PROCESSOR_ARM920
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8871
	case PROCESSOR_ARM920:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8872
	    mach = @symbol(arm920);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8873
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8874
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8875
#ifdef PROCESSOR_ARM_7TDMI
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8876
	case PROCESSOR_ARM_7TDMI:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8877
	    mach = @symbol(arm70001);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8878
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8879
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8880
#ifdef PROCESSOR_STRONGARM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8881
	case PROCESSOR_STRONGARM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8882
	    mach = @symbol(strongarm);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8883
	    break;
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8884
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8885
#ifdef PROCESSOR_PPC_601
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8886
	case PROCESSOR_PPC_601:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8887
	    mach = @symbol(ppc601);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8888
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8889
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8890
#ifdef PROCESSOR_PPC_603
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8891
	case PROCESSOR_PPC_603:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8892
	    mach = @symbol(ppc603);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8893
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8894
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8895
#ifdef PROCESSOR_PPC_604
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8896
	case PROCESSOR_PPC_604:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8897
	    mach = @symbol(ppc604);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8898
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8899
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8900
#ifdef PROCESSOR_PPC_620
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8901
	case PROCESSOR_PPC_620:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8902
	    mach = @symbol(ppc620);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8903
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8904
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8905
#ifdef PROCESSOR_HITACHI_SH3
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8906
	case PROCESSOR_HITACHI_SH3:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8907
	    mach = @symbol(sh3);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8908
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8909
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8910
#ifdef PROCESSOR_HITACHI_SH3E
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8911
	case PROCESSOR_HITACHI_SH3E:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8912
	    mach = @symbol(sh3e);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8913
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8914
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8915
#ifdef PROCESSOR_HITACHI_SH4
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8916
	case PROCESSOR_HITACHI_SH4:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8917
	    mach = @symbol(sh4);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8918
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8919
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8920
#ifdef PROCESSOR_MOTOROLA_821
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8921
	case PROCESSOR_MOTOROLA_821:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8922
	    mach = @symbol(mc821);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8923
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8924
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8925
#ifdef PROCESSOR_SHx_SH3
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8926
	case PROCESSOR_SHx_SH3:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8927
	    mach = @symbol(shx_sh3);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8928
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8929
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8930
#ifdef PROCESSOR_SHx_SH4
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8931
	case PROCESSOR_SHx_SH4:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8932
	    mach = @symbol(shx_sh4);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8933
	    break;
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8934
#endif
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8935
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8936
	default:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8937
	    sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8938
	    mach =  __MKSTRING(vsnBuffer);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8939
	    break;
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8940
    }
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8941
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8942
    numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8943
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8944
    node isNil ifTrue:[
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8945
	node := self getHostName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8946
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8947
    dom isNil ifTrue:[
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8948
	dom := self getDomainName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8949
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8950
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8951
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8952
    info at:#system put:sys.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8953
    info at:#node put:node.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8954
    rel notNil ifTrue:[info at:#release put:rel].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8955
    ver notNil ifTrue:[info at:#version put:ver].
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8956
    majorVer notNil ifTrue:[info at:#majorVersion put:majorVer].
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8957
    minorVer notNil ifTrue:[info at:#minorVersion put:minorVer].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8958
    mach notNil ifTrue:[info at:#machine put:mach. info at:#cpuType put:mach].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8959
    arch notNil ifTrue:[info at:#architecture put:arch].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8960
    dom notNil ifTrue:[info at:#domain put:dom].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8961
    numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8962
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8963
    info at:#memoryLoad put:memoryLoad.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8964
    info at:#physicalRam put:physicalRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8965
    info at:#freeRam put:freeRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8966
    info at:#swapSize put:swapSize.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8967
    info at:#freeSwap put:freeSwap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8968
    info at:#virtualRam put:virtualRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8969
    info at:#freeVirtual put:freeVirtual.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8970
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8971
    info at:#osType put:(self getOSType).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8972
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8973
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8974
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8975
     OperatingSystem getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8976
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8977
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8978
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8979
getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8980
    "return a string giving the type of system we're running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8981
     This is almost the same as getOSType, but the returned string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8982
     is slightly different for some systems (i.e. iris vs. irix).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8983
     Dont depend on this - use getOSType. I dont really see a point
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8984
     here ...
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8985
     (except for slight differences between next/mach and other machs)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8986
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8987
    ^ #win32
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8988
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8989
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8990
     OperatingSystem getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8991
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8992
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8993
12837
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8994
getThreadId
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8995
    "return the (windows-) threadId"
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8996
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8997
%{  /* NOCONTEXT */
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8998
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8999
    int pid = 0;
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9000
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9001
    pid = GetCurrentThreadId() & 0x3FFFFFFF;
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9002
    RETURN ( __mkSmallInteger(pid) );
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9003
%}
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9004
    "
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9005
     OperatingSystem getThreadId
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9006
    "
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9007
!
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9008
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9009
getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9010
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9011
     Return the windows directory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9012
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9013
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9014
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9015
%{
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  9016
    char buffer[MAXPATHLEN+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9017
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9018
    if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9019
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9020
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9021
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9022
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9023
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9024
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9025
     OperatingSystem getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9026
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9027
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9028
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9029
getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9030
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9031
     Return the windows system directory
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9032
     (which - depending on the system - may be \WINNT\SYSTEM32,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9033
      \WINDOWS\SYSTEM or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9034
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9035
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9036
%{
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  9037
    char buffer[MAXPATHLEN+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9038
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9039
    if (GetSystemDirectory(buffer, MAXPATHLEN)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9040
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9041
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9042
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9043
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9044
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9045
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9046
     OperatingSystem getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9047
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9048
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9049
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9050
hasConsole
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9051
    "return true, if there is some kind of console available
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9052
     (i.e. for proper stdIn, stdOut and stdErr handling).
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
  9053
     This only returns false when running únder windows, and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9054
     the system is running as a pure windows application.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9055
     If false, the miniDebugger is useless and not used."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9056
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9057
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9058
    extern int __getNoConsoleFlag();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9059
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9060
    RETURN ( __getNoConsoleFlag() ? false : true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9061
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9062
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9063
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9064
isMSDOSlike
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9065
    "return true, if the OS we're running on is msdos like
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9066
     (in contrast to unix-like or vms-like).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9067
     This returns true for any of msdos, win32s, win95,
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9068
     winNT, winXP, Vista, Win7, win8 and os/2."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9069
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9070
    ^ true
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9071
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9072
    "Modified (comment): / 27-10-2012 / 14:00:52 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9073
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9074
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9075
isMSWINDOWSNTlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9076
    "This returns true if running in a Windows-NT system."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9077
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
  9078
     ^ true.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9079
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9080
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9081
isMSWINDOWSlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9082
    "return true, if running on a MS-Windows like system.
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9083
     This returns true for any of win32s, win95, winNT, XP, Vista, Win7, Win8 etc."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9084
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9085
    ^ true
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9086
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9087
    "Modified (comment): / 27-10-2012 / 14:01:30 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9088
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9089
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9090
isProcessIdPresent:processHandleOrPid
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9091
    "answer true, if a process with process id pid (or handle) is present, false if not.
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9092
     Raise an error, if an exception occures"
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9093
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9094
    |error|
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9095
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9096
%{
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9097
    HANDLE processHandle, processHandleToClose = 0;
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9098
    int err;
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9099
    DWORD exitCode;
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9100
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9101
    if (__isExternalAddressLike(processHandleOrPid) ) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9102
	processHandle = _HANDLEVal(processHandleOrPid);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9103
	if (processHandle == 0) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9104
	    error = @symbol(invalidParameter);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9105
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9106
	}
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9107
    } else if( __isSmallInteger(processHandleOrPid) ) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9108
	// assume, that synchronize needs less privilege...
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9109
	processHandle = processHandleToClose = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9110
	if (!processHandle) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9111
	    goto checkError;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9112
	}
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9113
    } else {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9114
	error = @symbol(invalidParameter);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9115
	goto out;
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9116
    }
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9118
    /* check if the handle still refers to a running process */
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9119
    if (GetExitCodeProcess(processHandle, &exitCode) != 0) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9120
	if (processHandleToClose)
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9121
	    CloseHandle(processHandleToClose);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9122
	if (exitCode == STILL_ACTIVE) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9123
	    RETURN(true);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9124
	} else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9125
	    RETURN(false);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9126
	}
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9127
    } else if (processHandleToClose) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9128
	CloseHandle(processHandleToClose);
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9129
    }
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9130
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9131
checkError:
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9132
    err = GetLastError();
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9133
    // we do not have access to the process (so pid does exist ;-))
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9134
    if (err == ERROR_ACCESS_DENIED) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9135
	RETURN(true);
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9136
    }
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9137
    // pid does not exist
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9138
    if (err == ERROR_INVALID_PARAMETER) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9139
	RETURN(false);
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9140
    }
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9141
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9142
    // any other error - raise signal
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9143
    __threadErrno = __WIN32_ERR(err);
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9144
    error = __mkSmallInteger(__threadErrno);
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9145
out:;
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9146
%}.
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9147
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9148
    self primitiveFailed:error.
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9149
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9150
    "
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9151
      self isProcessIdPresent:(self getProcessId)
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9152
      self isProcessIdPresent:10196
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9153
      self isProcessIdPresent:512
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9154
      self isProcessIdPresent:'abc'
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9155
    "
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9156
!
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9157
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9158
isVistaLike
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9159
    "return true, if running on a Vista (or newer) like system.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9160
     (also true for server 2008)"
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9161
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9162
    ^ (self getSystemInfo at:#majorVersion) >= 6
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9163
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9164
    "
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9165
     self isVistaLike
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9166
    "
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9167
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9168
    "Modified (comment): / 27-10-2012 / 13:59:53 / cg"
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9169
!
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9170
19335
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9171
isWin10Like
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9172
    "return true, if running on a Windows10 (or newer) like system.
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9173
     (also true for server 2016)"
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9174
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9175
    |sysInfo major|
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9176
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9177
    sysInfo := self getSystemInfo.
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9178
    major := sysInfo at:#majorVersion.
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9179
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9180
    ^ (major >= 10)
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9181
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9182
    "
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9183
     self isWin10Like
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9184
    "
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9185
!
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9186
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9187
isWin7Like
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9188
    "return true, if running on a Windows7 (or newer) like system."
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9189
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9190
    |sysInfo major|
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9191
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9192
    sysInfo := self getSystemInfo.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9193
    major := sysInfo at:#majorVersion.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9194
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9195
    ^ (major == 6 and:[(sysInfo at:#minorVersion) >= 1])
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9196
      or:[major > 6]
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9197
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9198
    "
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9199
     self isWin7Like
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9200
    "
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9201
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9202
    "Modified (comment): / 27-10-2012 / 13:59:14 / cg"
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9203
!
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9204
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9205
isWin8Like
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9206
    "return true, if running on a Windows8 (or newer) like system.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9207
     (also true for server 2012)"
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9208
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9209
    |sysInfo major|
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9210
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9211
    sysInfo := self getSystemInfo.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9212
    major := sysInfo at:#majorVersion.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9213
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9214
    ^ (major == 6 and:[(sysInfo at:#minorVersion) >= 2])
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9215
      or:[major > 6]
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9216
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9217
    "
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9218
     self isWin8Like
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9219
    "
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9220
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9221
    "Created: / 27-10-2012 / 13:59:03 / cg"
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9222
!
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9223
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9224
maxFileNameLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9225
    "return the max number of characters in a filename.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9226
     CAVEAT:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9227
	 Actually, the following is somewhat wrong - some systems
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9228
	 support different sizes, depending on the volume.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9229
	 We return a somewhat conservative number here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9230
	 Another entry, to query for volume specific max
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9231
	 will be added in the future."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9232
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9233
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9234
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9235
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9236
     * TODO: newer systems provide a query function for this ... use it
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9237
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9238
     /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9239
      * mhmh - depends on the filesystem type
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9240
      */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  9241
     RETURN ( __mkSmallInteger(MAXFILELEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9242
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9243
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9244
     OperatingSystem maxFileNameLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9245
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9246
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9247
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9248
maxPathLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9249
    "return the max number of characters in a pathName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9250
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9251
%{  /* NOCONTEXT */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  9252
    RETURN ( __mkSmallInteger(MAXPATHLEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9253
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9254
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9255
     OperatingSystem maxPathLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9256
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9257
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9258
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9259
osName
13533
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9260
    |osVersion|
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9261
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9262
    osVersion := OperatingSystem osVersion.
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  9263
    ^ 'Windows ',
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  9264
	(#('2000' 'XP' 'Server2003' 'VISTA' '7' '8')
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  9265
	    at: (#('5.0' '5.1' '5.2' '6.0' '6.1' '6.2') indexOf:osVersion)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9266
	    ifAbsent:osVersion).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9267
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9268
    "
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9269
     self osName
13533
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9270
    "
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9271
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9272
    "Modified (comment): / 30-07-2011 / 17:00:50 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9273
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9274
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9275
osVersion
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9276
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9277
    ^OperatingSystem getSystemInfo at:#release
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9278
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9279
    "Created: / 19-01-2007 / 13:15:47 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9280
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9281
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9282
pathSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9283
    "return the character which separates items in the PATH variable"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9284
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9285
    ^ $;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9286
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9287
    "Created: 2.5.1997 / 11:36:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9288
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9289
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9290
platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9291
    "return a string describing the OS platform very we're running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9292
     This returns #unix for all unix derivatives,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9293
     #os2, #win32, #vms or #mac for the others.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9294
     I.e. it is much less specific than getOSType or getSystemType."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9295
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9296
    ^ #win32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9297
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9298
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9299
     OperatingSystem platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9300
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9301
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9302
    "Modified: 20.6.1997 / 17:37:26 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9303
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9304
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9305
randomBytesInto:bufferOrInteger
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9306
    "If bufferOrInteger is a String or a ByteArray,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9307
	fill a given buffer with random bytes from the RtlGenRandom function
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9308
	and nswer the buffer.
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9309
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9310
     If bufferOrInteger is a SmallInteger,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9311
	return this many bytes (max 4) as a SmallInteger.
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9312
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9313
     Return nil on error (and raise PrimitiveFailure).
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9314
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9315
     NOTE: This is a private interface, please use RandomGenerator!!"
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9316
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9317
%{
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9318
//    BOOLEAN RtlGenRandom(
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9319
//      __out  PVOID RandomBuffer,
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9320
//      __in   ULONG RandomBufferLength
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9321
//    );
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9322
    static BOOL (__stdcall *P_RtlGenRandom)(PVOID , ULONG) = 0;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9323
    unsigned char *__buffer;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9324
    int __bufferSize;
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9325
    int __useLocalBuffer = 0;
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9326
    unsigned int __localBuffer = 0;
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9327
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9328
    if (__isSmallInteger(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9329
	__useLocalBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9330
	__buffer = (unsigned char *)&__localBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9331
	__bufferSize = __smallIntegerVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9332
	if (__bufferSize > sizeof(INT))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9333
	    __bufferSize = sizeof(INT);
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9334
    } else if (__isString(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9335
	__buffer = __stringVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9336
	__bufferSize = __stringSize(bufferOrInteger);
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9337
    } else if (__isByteArray(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9338
	__buffer = __byteArrayVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9339
	__bufferSize = __byteArraySize(bufferOrInteger);
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9340
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9341
	goto error;
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9342
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9343
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9344
    if (P_RtlGenRandom == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9345
	HINSTANCE hAdvapi32 = LoadLibrary("advapi32.dll");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9346
	// console_printf("hAdvapi32: %x\n", hAdvapi32);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9347
	if (hAdvapi32) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9348
	    P_RtlGenRandom = (BOOL (__stdcall *)(PVOID , ULONG))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9349
				GetProcAddress(hAdvapi32, "SystemFunction036");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9350
	    // console_printf("P_RtlGenRandom: %x\n", P_RtlGenRandom);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9351
	    if (P_RtlGenRandom == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9352
		goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9353
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9354
	}
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9355
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9356
    if ((*P_RtlGenRandom)(__buffer, __bufferSize)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9357
	if (__useLocalBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9358
	    RETURN(__mkSmallInteger(__localBuffer & _MAX_INT));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9359
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9360
	RETURN (bufferOrInteger);
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9361
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9362
error: ;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9363
%}.
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9364
    self primitiveFailed.
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9365
    ^ nil
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9366
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9367
    "
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9368
     self randomBytesInto:(ByteArray new:4)
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9369
     self randomBytesInto:4
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9370
     self randomBytesInto:1
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9371
    "
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9372
!
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9373
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9374
setEnvironment:aStringOrSymbol to:newValueString
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9375
    "set an environment variable"
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9376
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9377
%{  /* NOCONTEXT */
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9378
    char *env;
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9379
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9380
    if (__isStringLike(aStringOrSymbol)
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9381
     && __isStringLike(newValueString) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9382
	if (SetEnvironmentVariable(__stringVal(aStringOrSymbol), __stringVal(newValueString)) != 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9383
	    RETURN(self);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9384
	}
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9385
    }
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9386
%}.
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9387
    self primitiveFailed
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9388
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9389
    "
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9390
     OperatingSystem getEnvironment:'PATH'
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9391
     OperatingSystem setEnvironment:'PATH' to:('c:\cygwin\bin;' , (OperatingSystem getEnvironment:'PATH'))
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9392
    "
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9393
!
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9394
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9395
setLocaleInfo:anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9396
    "set the locale information; if set, this oerrides the OS's settings.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9397
     (internal in ST/X only - the OS's settings remain unaffected)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9398
     See description of fields in #getLocaleInfo.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9399
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9400
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9401
     it should be used by applications as required."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9402
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9403
    LocaleInfo := anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9404
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9405
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9406
     |d|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9408
     d := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9409
     d at:#decimalPoint                 put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9410
     d at:#thousandsSeparator           put:','         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9411
     d at:#currencySymbol               put:'USD'       .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9412
     d at:#monetaryDecimalPoint         put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9413
     d at:#monetaryThousandsSeparator   put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9414
     d at:#fractionalDigits             put:2           .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9415
     d at:#positiveSign                 put:'+'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9416
     d at:#negativeSign                 put:'-'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9417
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9418
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9419
     OperatingSystem setLocaleInfo:d
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9420
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9421
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9422
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9423
supportsChildInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9424
    "return true, if the OS supports childProcess termination signalling
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9425
     through interrupts (i.e. SIGCHILD)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9426
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9427
%{  /* NOCONTEXT */
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9428
#if defined(SIGCHLD) || defined(SIGCLD)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9429
    RETURN (true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9430
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9431
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9432
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9433
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9434
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9435
     OperatingSystem supportsChildInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9436
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9437
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9438
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9439
supportsFileOwnerGroups
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9440
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9441
     group ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9442
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9443
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9444
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9445
    "Created: / 10.9.1998 / 17:57:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9446
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9447
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9448
supportsFileOwners
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9449
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9450
     ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9451
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9452
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9453
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9454
    "Created: / 10.9.1998 / 17:55:16 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9455
    "Modified: / 10.9.1998 / 17:57:11 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9456
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9457
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9458
supportsIOInterrupts
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9459
    "return true, if the OS supports IO availability interrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9460
     (i.e. SIGPOLL/SIGIO).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9461
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9462
     Currently, this mechanism does not work on all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9463
     systems ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9464
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9465
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9466
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9467
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9468
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9469
     OperatingSystem supportsIOInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9470
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9471
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9472
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9473
supportsNonBlockingIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9474
    "return true, if the OS supports nonblocking IO."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9475
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9476
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9477
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9478
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9479
     OperatingSystem supportsNonBlockingIO
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9480
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9481
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9482
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9483
supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9484
    "return true, if the OS supports selecting on multiple
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9485
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9486
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9487
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9488
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9489
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9490
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9491
# if defined(WIN32S)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9492
    RETURN (false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9493
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9494
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9495
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9496
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9497
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9498
     OperatingSystem supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9499
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9500
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9501
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9502
supportsSelectOnPipes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9503
    "return true, if the OS supports selecting on pipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9504
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9505
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9506
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9507
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9508
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9509
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9510
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9511
     OperatingSystem supportsSelectOnPipes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9512
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9513
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9514
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9515
    "Created: / 14.12.1999 / 19:43:13 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9516
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9517
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9518
supportsSelectOnSockets
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9519
    "return true, if the OS supports selecting on socket
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9520
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9521
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9522
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9523
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9524
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9525
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9526
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9527
     OperatingSystem supportsSelectOnSockets
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9528
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9529
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9530
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9531
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9532
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9533
supportsVolumes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9534
    "return true, if the OS supports disk volumes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9535
     False is returned for UNIX, true for MSDOS and VMS"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9536
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9537
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9538
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9539
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9540
!Win32OperatingSystem class methodsFor:'path queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9541
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9542
defaultPackagePath
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9543
    |pPath pkgDirPath dirs p|
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9544
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9545
    pPath := super defaultPackagePath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9546
    pkgDirPath := self stxPackageDirPath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9547
    pkgDirPath notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9548
	"/ and also add the packageDirPath from the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9549
	dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9550
	dirs do:[:aDir |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9551
	    (pPath includes:aDir) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9552
		pPath add:aDir.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9553
	    ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9554
	]
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9555
    ] ifFalse:[
13341
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9556
"/        #(
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9557
"/            '\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9558
"/            '\programme\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9559
"/            '\programme\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9560
"/            '\programs\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9561
"/            '\programs\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9562
"/        ) do:[:d | |dd|
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9563
"/            dd := d asFilename constructString:'packages'.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9564
"/            (pPath includes:dd) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9565
"/                pPath add:dd.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9566
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9567
"/            dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9568
"/            (pPath includes:dd) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9569
"/                pPath add:dd.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9570
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9571
"/        ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9572
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9573
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9574
    "/ under windows, the commandName includes the path - good.
5922
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  9575
    p := Smalltalk commandName.
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  9576
    p notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9577
	p := p asFilename directory constructString:'packages'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9578
	(pPath includes:p) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9579
	    pPath add:p.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9580
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9581
    ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9582
    pPath := pPath select:[:p | p asFilename exists].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9583
    ^ pPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9584
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9585
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9586
     self defaultPackagePath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9587
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9588
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9589
    "Created: / 24.12.1999 / 00:10:41 / cg"
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9590
    "Modified: / 24.12.1999 / 00:33:26 / cg"
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9591
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9592
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9593
defaultSystemPath
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9594
    |sysPath libDirPath|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9595
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9596
    sysPath := super defaultSystemPath.
9014
f4df89a42724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9013
diff changeset
  9597
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9598
    libDirPath := self stxLibDirPath.
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9599
    libDirPath notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9600
	"/ and also add the libDirPath from the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9601
	(sysPath includes:libDirPath) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9602
	    sysPath add:libDirPath
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9603
	].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9604
    ].
13341
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9605
"/    #(
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9606
"/        '\programs\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9607
"/        '\programme\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9608
"/        '\programs\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9609
"/        '\programme\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9610
"/        '\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9611
"/    ) do:[:dir |
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9612
"/        |vsnDir|
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9613
"/
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9614
"/        (dir asFilename isDirectory) ifTrue:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9615
"/            vsnDir := dir , '\' , Smalltalk versionString.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9616
"/            (vsnDir asFilename isDirectory) ifTrue:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9617
"/                (sysPath includes:vsnDir) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9618
"/                    sysPath add:vsnDir.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9619
"/                ]
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9620
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9621
"/            (sysPath includes:dir) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9622
"/                sysPath add:dir.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9623
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9624
"/        ]
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9625
"/    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9626
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9627
    ^ sysPath
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9628
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9629
    "Modified: / 24.12.1999 / 00:29:18 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9630
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9631
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9632
stxBinDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9633
    "ask the registry for the binary directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9634
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9635
    |k p|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9636
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9637
    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9638
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9639
	p := k valueNamed:'BinDir'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9640
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9641
    ^ p
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9642
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9643
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9644
     OperatingSystem stxBinDirPath
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9645
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9646
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9647
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9648
stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9649
    "ask the registry for the lib directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9650
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  9651
    (Array
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9652
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9653
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'))
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9654
    do:[:eachKeyToTry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9655
	|k p|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9656
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9657
	k := RegistryEntry key:eachKeyToTry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9658
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9659
	    p := k valueNamed:'LibDir'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9660
	    k closeKey.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9661
	    ^ p
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9662
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9663
    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9664
    ^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9665
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9666
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9667
     OperatingSystem stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9668
    "
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9669
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9670
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9671
stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9672
    "ask the registry for the package directory"
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9673
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9674
    |k p|
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9675
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9676
    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9677
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9678
	p := k valueNamed:'PackageDirPath'.
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9679
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9680
    ^ p
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9681
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9682
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9683
     OperatingSystem stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9684
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9685
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9686
    "Created: / 24.12.1999 / 00:11:12 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9687
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9688
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9689
!Win32OperatingSystem class methodsFor:'printing support'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9690
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9691
abortDoc: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9692
    ^ self primAbortDoc:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9693
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9694
    "Created: / 02-08-2006 / 12:52:12 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9695
    "Modified: / 04-10-2006 / 11:34:37 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9696
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9697
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9698
closePrinter:handle
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9699
    self primClosePrinter:handle
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9700
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9701
    "Created: / 28-07-2006 / 17:55:59 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9702
    "Modified: / 04-10-2006 / 11:34:34 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9703
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9704
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9705
createPrinterDC:driverName device:deviceName output:outputMedium initData:driverData
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9706
    |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9707
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9708
    h := self primCreatePrinterDC:driverName device:deviceName output:outputMedium initData:driverData.
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9709
"/    h notNil ifTrue:[
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9710
"/        ^ (Win32Handle newAddress:h address) registerForFinalization
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9711
"/    ].
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9712
    ^ h
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9713
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9714
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9715
     |p hPrinter driverNm mediumNm deviceNm driverData hDC|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9716
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9717
     p := self getPrinters first.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9718
     driverNm := p attributes at:#driverName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9719
     mediumNm := p attributes at:#medium.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9720
     deviceNm := p printerName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9721
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9722
     hPrinter := self openPrinter:deviceNm.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9723
     driverData := self getDocumentProperties:nil hPrinter:hPrinter pDeviceName:deviceNm.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9724
     self primClosePrinter:hPrinter.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9725
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9726
     hDC := self createPrinterDC:driverNm device:deviceNm output:mediumNm initData:driverData.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9727
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9728
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9729
    "Created: / 27-07-2006 / 16:22:34 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
  9730
    "Modified: / 16-04-2007 / 13:09:16 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9731
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9732
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9733
deletePrinterDC: hwndArg
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9734
    |return|
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9735
    return := self primDeletePrinterDC:hwndArg .
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9736
    ^return
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9737
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9738
    "Created: / 27-07-2006 / 16:22:34 / fm"
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9739
!
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9740
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9741
documentPropertiesDialogFor:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName devModeInput:pDevModeInputOrNil
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9742
    |nBytesNeeded hPrinter rslt devModeOutput|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9743
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9744
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9745
#define DM_UPDATE           1
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9746
#define DM_COPY             2
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9747
#define DM_PROMPT           4
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9748
#define DM_MODIFY           8
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9749
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9750
#define DM_IN_BUFFER        DM_MODIFY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9751
#define DM_IN_PROMPT        DM_PROMPT
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9752
#define DM_OUT_BUFFER       DM_COPY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9753
#define DM_OUT_DEFAULT      DM_UPDATE
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9754
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9755
    nBytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9756
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9757
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9758
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9759
	   pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9760
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9761
	   fMode:0.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9762
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9763
    devModeOutput := DevModeStructure new:(nBytesNeeded * 2 "never trust MS !!").
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9764
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9765
    rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9766
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9767
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9768
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9769
	   pDevModeOutput:devModeOutput
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9770
	   pDevModeInput:pDevModeInputOrNil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9771
	   fMode:4+2.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9772
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9773
    ^ devModeOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9774
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9775
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9776
     |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9777
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9778
     h := self openPrinter:'\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9779
     self documentPropertiesDialogFor:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4' devModeInput:nil
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9780
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9781
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9782
    "Created: / 27-07-2006 / 15:39:21 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9783
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9784
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9785
endDoc: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9786
    ^ self primEndDoc:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9787
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9788
    "Created: / 27-07-2006 / 19:46:19 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9789
    "Modified: / 28-07-2006 / 19:23:03 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9790
    "Modified: / 04-10-2006 / 11:35:01 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9791
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9792
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9793
endPage: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9794
    ^ self primEndPage:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9795
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9796
    "Created: / 27-07-2006 / 19:45:28 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9797
    "Modified: / 28-07-2006 / 18:49:40 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9798
    "Modified: / 04-10-2006 / 11:35:06 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9799
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9800
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9801
getDefaultPrinterName
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9802
    "returns the default printer name"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9803
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9804
    ^ (self getProfileString:'windows' key:'device' default:'')
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9805
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9806
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9807
     OperatingSystem getDefaultPrinterName
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9808
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9809
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9810
    "Created: / 02-08-2006 / 17:25:34 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9811
    "Modified: / 04-10-2006 / 11:35:18 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9812
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9813
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9814
getDeviceCaps:hwndArg index: index
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9815
    ^ self primGetDeviceCaps:hwndArg index: index
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9816
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9817
    "Created: / 28-07-2006 / 17:45:27 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9818
    "Modified: / 04-10-2006 / 11:35:29 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9819
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9820
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9821
getDocumentProperties:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9822
    |nBytesNeeded rslt devModeOutput|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9823
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9824
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9825
#define DM_UPDATE           1
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9826
#define DM_COPY             2
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9827
#define DM_PROMPT           4
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9828
#define DM_MODIFY           8
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9829
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9830
#define DM_IN_BUFFER        DM_MODIFY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9831
#define DM_IN_PROMPT        DM_PROMPT
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9832
#define DM_OUT_BUFFER       DM_COPY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9833
#define DM_OUT_DEFAULT      DM_UPDATE
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9834
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9835
    nBytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9836
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9837
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9838
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9839
	   pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9840
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9841
	   fMode:0.
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9842
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9843
    nBytesNeeded < 0 ifTrue:[^nil].
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9844
    devModeOutput := DevModeStructure new:(nBytesNeeded * 2 "never trust MS !!").
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9845
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9846
    rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9847
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9848
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9849
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9850
	   pDevModeOutput:devModeOutput
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9851
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9852
	   fMode:2.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9853
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9854
     ^ devModeOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9855
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9856
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9857
     |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9858
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9859
     h := self openPrinter:'\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9860
     self getDocumentProperties:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4'
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9861
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9862
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9863
    "Created: / 27-07-2006 / 15:38:03 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9864
    "Modified: / 31-07-2006 / 13:02:02 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9865
    "Modified: / 04-10-2006 / 11:35:39 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9866
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9867
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9868
getPrinterInfo2: printerName
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9869
    |hPrinter rslt informationBuffer bytesNeeded sizeBytesArray|
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9870
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9871
     hPrinter := self openPrinter: printerName .
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9872
     sizeBytesArray := ByteArray new:4.
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9873
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9874
     bytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9875
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9876
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9877
		informationBuffer: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9878
		bufferSize: 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9879
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9880
     bytesNeeded := sizeBytesArray longAt:1.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9881
     informationBuffer := PrinterInfo2Structure new: bytesNeeded.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9882
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9883
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9884
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9885
		informationBuffer:informationBuffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9886
		bufferSize: bytesNeeded
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9887
		bufferNeededSize:sizeBytesArray.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9888
     self closePrinter: printerName.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9889
     ^informationBuffer
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9890
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9891
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9892
     OperatingSystem getPrinterInfo2:(OperatingSystem getDefaultPrinterName)
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9893
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9894
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9895
    "Created: / 01-08-2006 / 13:47:19 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9896
    "Modified: / 04-10-2006 / 11:36:41 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9897
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9898
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9899
getPrinters
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9900
    "return a collection of PrinterInfos"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9901
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9902
    |printerNames collectedInfo|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9903
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9904
    printerNames := self getPrintersNames.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9905
    collectedInfo := OrderedCollection new.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9906
    printerNames do:[:eachName |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9907
	|fn vol attributes nm deviceInfo infoFields driverName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9908
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9909
	attributes := Dictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9910
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9911
	fn := eachName asFilename.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9912
	vol := fn volume.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9913
	vol notEmptyOrNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9914
	    (vol startsWith:'\\') ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9915
		"/ a remote printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9916
		attributes at:#isRemotePrinter put:true.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9917
		attributes at:#remotePrinterName put:(fn baseName).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9918
		attributes at:#remotePrinterHost put:(fn directoryName copyFrom:3).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9919
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9920
		"/ some other printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9921
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9922
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9923
	    "/ some other printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9924
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9925
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9926
	deviceInfo := self getProfileString:'PrinterPorts' key:eachName default:''.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9927
	"gives us smething like 'winspool,Ne00:,15,45',
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9928
	 which is: driverName, deviceName, ? , ?"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9929
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9930
	infoFields := deviceInfo asCollectionOfSubstringsSeparatedBy:$,.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9931
	driverName := infoFields at:1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9932
	2 to: infoFields size by:3 do:[:i |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9933
	    |medium longName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9934
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9935
	    medium := infoFields at:i.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9936
	    longName := eachName ,',' , driverName , ',' , medium.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9937
	    attributes at:#driverName put:driverName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9938
	    attributes at:#longName put:longName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9939
	    attributes at:#medium put:medium.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9940
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9941
	    collectedInfo add:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9942
		(AbstractOperatingSystem::PrinterInfo new
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9943
		    printerName:eachName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9944
		    attributes:attributes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9945
		    setDocumentProperties;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9946
		    yourself)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9947
	].
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9948
    ].
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9949
    ^ collectedInfo
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9950
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9951
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9952
     OperatingSystem getPrinters
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9953
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9954
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9955
    "Created: / 27-07-2006 / 12:18:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9956
    "Modified: / 31-07-2006 / 13:06:04 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9957
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9958
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9959
getPrintersNames
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9960
    "return a collection of Printer names"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9961
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9962
    |printerNames|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9963
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9964
    printerNames := (self getProfileString:'PrinterPorts' key:nil default:'')
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9965
		       asCollectionOfSubstringsSeparatedBy:(Character value:0).
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9966
    printerNames := printerNames reject:[:nm | nm isEmpty].
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9967
    ^printerNames
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9968
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9969
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9970
     OperatingSystem getPrintersNames
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9971
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9972
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9973
    "Created: / 27-07-2006 / 17:55:46 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9974
    "Modified: / 04-10-2006 / 11:37:41 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9975
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9976
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9977
getTextExtentPoint: handle string: lpString size: pSize
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  9978
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  9979
   ^self primGetTextExtentPoint: handle string: lpString count: lpString size size: pSize
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9980
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9981
    "Created: / 03-08-2006 / 11:17:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9982
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9983
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9984
getTextMetrics: deviceContext lpMetrics: textMetrics
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9985
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9986
    ^self primGetTextMetrics: deviceContext lpMetrics: textMetrics
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9987
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9988
    "Created: / 02-08-2006 / 16:07:07 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9989
    "Modified: / 04-10-2006 / 11:37:49 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9990
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9991
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9992
openPrinter:name
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9993
    |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9994
19346
Claus Gittinger <cg@exept.de>
parents: 19339
diff changeset
  9995
    hh := ByteArray new:(ExternalAddress pointerSize).
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9996
    rslt := self primOpenPrinter:name handleHolder:hh ignored:nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9997
    rslt ifFalse:[^ nil].
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9998
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9999
    h := Win32PrinterHandle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10000
    h registerForFinalization.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10001
    ^ h
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10002
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10003
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10004
     self openPrinter:'\\http://exept.exept.de:631\lj4'
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10005
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10006
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10007
    "Created: / 27-07-2006 / 14:40:41 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10008
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10009
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10010
primAbortDoc:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10011
    <apicall: int32 "AbortDoc" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10012
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10013
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10014
    "Created: / 02-08-2006 / 12:52:32 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10015
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10016
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10017
primClosePrinter:handle
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10018
    <apicall: bool "ClosePrinter" ( handle ) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10019
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10020
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10021
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10022
     |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10023
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10024
     hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10025
     rslt := self primOpenPrinter:'\\http://exept.exept.de:631\lj4' handleHolder:hh ignored: nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10026
     h := Win32PrinterHandle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10027
     self primClosePrinter: h.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10028
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10029
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10030
    "Created: / 27-07-2006 / 14:47:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10031
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10032
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10033
primCreatePrinterDC:driverName device:deviceName output:outputMedium initData:driverData
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10034
    <apicall: handle "CreateDCA" ( pointer pointer pointer pointer ) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10035
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10036
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10037
    "Modified: / 27-07-2006 / 16:26:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10038
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10039
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10040
primDeletePrinterDC: hwndArg
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10041
    <apicall: bool "DeleteDC" ( handle ) module: "gdi32.dll" >
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10042
    self primitiveFailed.
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10043
!
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10044
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10045
primDocumentProperties:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName pDevModeOutput:pDevModeOutput pDevModeInput:pDevModeInput fMode:fMode
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10046
    <apicall: int32 "DocumentPropertiesA" ( handle handle lpstr pointer pointer uint32) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10047
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10048
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10049
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10050
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10051
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10052
     hPrinter := self openPrinter:'\\http://exept.exept.de:631\lj4' .
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10053
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10054
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10055
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10056
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10057
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10058
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10059
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10060
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10061
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10062
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10063
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10064
    "Created: / 27-07-2006 / 15:02:14 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10065
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10066
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10067
primEndDoc:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10068
    <apicall: int32 "EndDoc" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10069
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10070
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10071
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10072
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10073
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10074
     hPrinter := self openPrinter:'\\http://exept.exept.de:631\lj4' .
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10075
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10076
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10077
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10078
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10079
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10080
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10081
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10082
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10083
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10084
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10085
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10086
    "Created: / 27-07-2006 / 19:31:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10087
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10088
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10089
primEndPage:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10090
    <apicall: int32 "EndPage" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10091
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10092
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10093
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10094
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10095
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10096
     hPrinter := self openPrinter:'\\http://exept.exept.de:631\lj4' .
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10097
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10098
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10099
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10100
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10101
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10102
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10103
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10104
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10105
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10106
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10107
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10108
    "Created: / 27-07-2006 / 19:30:50 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10109
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10110
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10111
primGetDeviceCaps:hwndArg index: index
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10112
    "Returns driver specific information about the device"
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10113
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10114
    <apicall: int32 "GetDeviceCaps" (handle int32) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10115
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10116
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10117
    "Modified: / 01-08-2006 / 16:13:05 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10118
    "Modified: / 04-10-2006 / 11:38:06 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10119
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10120
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10121
primGetPrinter:hwndArg level:index informationBuffer:informationBuffer bufferSize:bufferSize bufferNeededSize:bufferNeededSize
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10122
    <apicall: bool "GetPrinterA" (handle dword pointer dword pointer) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10123
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10124
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10125
"
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10126
|hPrinter rslt printerName informationBuffer bytesNeeded sizeBytesArray ok|
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10127
     printerName := '\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10128
     hPrinter := self openPrinter: printerName .
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10129
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10130
     sizeBytesArray := ByteArray new:4.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10131
     ok := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10132
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10133
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10134
		informationBuffer: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10135
		bufferSize: 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10136
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10137
     bytesNeeded := sizeBytesArray longAt:1.
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10138
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10139
     informationBuffer := PrinterInfo2Structure new: bytesNeeded.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10140
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10141
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10142
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10143
		informationBuffer:informationBuffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10144
		bufferSize: bytesNeeded
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10145
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10146
     self assert: rslt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10147
     informationBuffer inspect.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10148
     self closePrinter: printerName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10149
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10150
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10151
    "Modified: / 01-08-2006 / 12:39:26 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10152
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10153
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
 10154
primGetTextExtentPoint: handle string: lpString count: nCount size: pSize
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10155
    <apicall: bool "GetTextExtentPointA" (handle pointer int32 pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10156
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10157
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10158
    "Created: / 03-08-2006 / 11:06:23 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10159
    "Modified: / 04-10-2006 / 11:38:21 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10160
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10161
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10162
primGetTextMetrics: deviceContext lpMetrics: textMetrics
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10163
    <apicall: bool "GetTextMetricsA" (handle pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10164
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10165
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10166
    "Modified: / 02-08-2006 / 16:17:51 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10167
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10168
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10169
primOpenPrinter:name handleHolder:handleHolder ignored: ignored
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10170
    <apicall: bool "OpenPrinterA" ( lpstr lpstr lpstr ) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10171
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10172
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10173
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10174
     |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10175
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10176
     hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10177
     rslt := self primOpenPrinter:'\\http://exept.exept.de:631\lj4' handleHolder:hh ignored: nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10178
     h := Win32Handle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10179
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10180
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10181
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10182
    "Created: / 27-07-2006 / 14:39:35 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10183
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10184
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10185
primSetTextAlign:handle with:fMode
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10186
    <apicall: bool "SetTextAlign" (handle int16) module: "gdi32.dll" >
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10187
    "SetTextAlign"
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10188
    "gdi32.dll"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10189
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10190
    self primitiveFailed.
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10191
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10192
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10193
primSetViewportOrgEx: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10194
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10195
    <apicall: bool "SetViewportOrgEx" (handle int16 int16 pointer) module: "gdi32.dll" >
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10196
    self primitiveFailed.
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10197
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10198
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10199
primStartDoc:hwndArg docInfo: aDocInfo
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10200
    "Returns a jobId"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10201
    <apicall: int32 "StartDocA" (handle pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10202
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10203
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10204
    "Modified: / 31-07-2006 / 11:47:10 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10205
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10206
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10207
primStartPage:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10208
    <apicall: int32 "StartPage" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10209
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10210
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10211
    "Created: / 27-07-2006 / 19:02:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10212
    "Modified: / 31-07-2006 / 11:47:06 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10213
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10214
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10215
setTextAlign: fMode to: handle
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10216
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10217
    self primSetTextAlign: handle with: fMode
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10218
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10219
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10220
setViewportOrg: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10221
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10222
    self primSetViewportOrgEx: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10223
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10224
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10225
startDoc: deviceContext docInfo: docInfoStruct
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10226
    ^self primStartDoc:deviceContext docInfo: docInfoStruct
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10227
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10228
    "Created: / 27-07-2006 / 19:42:39 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10229
    "Modified: / 04-10-2006 / 11:38:30 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10230
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10231
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10232
startPage: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10233
    ^self primStartPage:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10234
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10235
    "Created: / 27-07-2006 / 19:43:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10236
    "Modified: / 28-07-2006 / 18:48:58 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10237
    "Modified: / 04-10-2006 / 11:38:34 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10238
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10239
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10240
!Win32OperatingSystem class methodsFor:'private'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10241
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10242
mapLanguage:aWindowsLanguageString
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10243
    "map a windows language string to ISO languageCode_languageTerritory format"
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10244
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10245
    |windowsLanguageString|
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10246
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10247
    windowsLanguageString := aWindowsLanguageString asUppercase.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10248
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10249
    #('DEU'     'de_DE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10250
      'DES'     'de_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10251
      'DEA'     'de_AT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10252
      'DAN'     'da_DA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10253
      'ENA'     'en_AU'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10254
      'ENC'     'en_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10255
      'ENG'     'en_GB'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10256
      'ENI'     'en_IR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10257
      'ENU'     'en_US'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10258
      'ENZ'     'en_NZ'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10259
      'FRA'     'fr_FR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10260
      'FRB'     'fr_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10261
      'FRC'     'fr_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10262
      'FRS'     'fr_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10263
      'ITA'     'it_IT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10264
      'ITS'     'it_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10265
      'ESM'     'es_MX'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10266
      'ESN'     'es_ES'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10267
      'ESP'     'es'            "Castillian"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10268
      'NLB'     'nl_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10269
      'NLD'     'nl_NL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10270
      'CSY'     'cs_CS'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10271
      'ELL'     'el_EL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10272
      'NON'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10273
      'NOR'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10274
     ) pairWiseDo:[:key :mappedValue|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10275
	key = windowsLanguageString ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10276
	    ^ mappedValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10277
	]
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10278
    ].
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10279
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10280
    "no mapping"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10281
    ^ windowsLanguageString.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10282
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10283
    "
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10284
     self mapLanguage:'DEU'
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10285
    "
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10286
!
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10287
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10288
osProcessStatusClass
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10289
    ^ OSProcessStatus
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10290
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10291
    "Created: / 12.6.1998 / 16:30:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10292
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10293
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10294
!Win32OperatingSystem class methodsFor:'regional settings'!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10295
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10296
country
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10297
	"Answer the current system value for country."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10298
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10299
    ^self queryNationalProfileString: 'iCountry' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10300
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10301
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10302
	self country
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10303
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10304
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10305
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10306
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10307
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10308
countryName
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10309
	"Answer the current system value for country name."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10310
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10311
    ^self queryNationalProfileString: 'sCountry' default: 'Deutschland'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10312
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10313
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10314
	self countryName
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10315
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10316
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10317
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10318
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10319
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10320
dateFormat
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10321
    "Answer the current system value for date format.
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10322
     Answer DfMDY = Month-Day-Year
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10323
	    DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10324
	    DfYMD = Year-Month-Day."
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10325
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10326
    |separatorString code|
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10327
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10328
    separatorString := self dateSeparator.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10329
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10330
    code := self dateFormatCode.
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10331
    code = 0 ifTrue:[ ^ '%(mon)', separatorString, '%(day)', separatorString, '%(year)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10332
    code = 1 ifTrue:[ ^ '%(day)', separatorString, '%(mon)', separatorString, '%(year)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10333
    code = 2 ifTrue:[ ^ '%(year)', separatorString, '%(mon)', separatorString, '%(day)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10334
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10335
    ^ '%(day)', separatorString, '%(mon)', separatorString, '%(year)'
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10336
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10337
    "
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10338
     self dateFormat
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10339
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10340
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10341
    "Modified: / 22-12-2006 / 16:43:30 / User"
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10342
    "Modified: / 28-03-2011 / 17:10:01 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10343
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10344
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10345
dateFormatCode
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10346
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10347
	 Answer DfMDY = Month-Day-Year = 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10348
		DfDMY = Day-Month-Year = 1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10349
		DfYMD = Year-Month-Day = 2"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10350
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10351
    ^self queryNationalProfileInt: 'iDate' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10352
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10353
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10354
	self dateFormatCode
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10355
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10356
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10357
    "Modified: / 22-12-2006 / 16:45:53 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10358
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10359
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10360
dateSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10361
	"Answer the current system value for date separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10362
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10363
    ^self queryNationalProfileString: 'sDate' default: '/'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10364
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10365
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10366
	self dateSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10367
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10368
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10369
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10370
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10371
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10372
decimalSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10373
	"Answer the current system value for decimal separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10374
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10375
    ^self queryNationalProfileString: 'sDecimal' default: '.'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10376
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10377
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10378
	self decimalSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10379
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10380
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10381
    "Created: / 22-12-2006 / 16:45:11 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10382
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10383
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10384
isDateFormatDMY
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10385
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10386
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10387
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10388
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10389
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10390
    ^self dateFormatCode = 1
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10391
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10392
    "Created: / 18-01-2007 / 14:56:23 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10393
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10394
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10395
isDateFormatMDY
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10396
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10397
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10398
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10399
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10400
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10401
    ^self dateFormatCode = 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10402
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10403
    "Created: / 18-01-2007 / 14:56:07 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10404
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10405
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10406
isDateFormatYMD
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10407
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10408
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10409
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10410
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10411
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10412
    ^self dateFormatCode = 2
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10413
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10414
    "Created: / 18-01-2007 / 14:56:30 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10415
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10416
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10417
isTimeFormat12Hour
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10418
	"Answer whether the current system time format is 12-hour."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10419
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10420
    ^self timeFormat = 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10421
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10422
    "Created: / 22-12-2006 / 16:48:17 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10423
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10424
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10425
primGetProfileInt: appName keyName: keyName default: anInt
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10426
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10427
    <apicall: uint32 "GetProfileIntA" ( lpstr lpstr uint32) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10428
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10429
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10430
    "Created: / 22-12-2006 / 16:17:18 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10431
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10432
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10433
primGetProfileString: appName keyName: keyName default: defaultStr returnedString: retStr size: anInt
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10434
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10435
    <apicall: uint32 "GetProfileStringA" ( lpstr lpstr lpstr lpstr uint32) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10436
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10437
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10438
    "Created: / 22-12-2006 / 16:20:23 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10439
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10440
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10441
queryNationalProfileInt: aKeyName default: defaultValue
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10442
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10443
    | answer |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10444
    answer := self primGetProfileInt: 'Intl'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10445
	keyName: aKeyName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10446
	default: -1 asUnsigned32.
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10447
    ^answer = -1 asUnsigned32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10448
	ifTrue: [ defaultValue ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10449
	ifFalse: [ answer ]
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10450
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10451
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10452
    self queryNationalProfileInt: 'iDate' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10453
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10454
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10455
    "Modified: / 22-12-2006 / 16:23:05 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10456
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10457
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10458
queryNationalProfileString: aKeyName default: defaultValue
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10459
	"Answer the string value of key aKeyName in
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10460
	the [Intl] application section of the WIN.INI profile file.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10461
	Answer defaultValue if aKeyName cannot be found."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10462
    | extString result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10463
    extString := String new: 80.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10464
    result := self primGetProfileString: 'Intl'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10465
	keyName: aKeyName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10466
	default: ''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10467
	returnedString: extString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10468
	size: extString size.
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10469
    ^result > 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10470
	ifTrue: [extString copyFrom: 1 to: result]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10471
	ifFalse: [ defaultValue ]
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10472
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10473
    "Created: / 22-12-2006 / 16:13:01 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10474
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10475
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10476
thousandsSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10477
	"Answer the current system value
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10478
	for the thousands separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10479
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10480
    ^self queryNationalProfileString: 'sThousand' default: ','
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10481
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10482
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10483
	self thousandsSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10484
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10485
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10486
    "Created: / 22-12-2006 / 16:46:50 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10487
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10488
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10489
timeFormat
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10490
	"Answer the current system value for time format."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10491
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10492
    ^self queryNationalProfileInt: 'iTime' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10493
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10494
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10495
	self timeFormat
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10496
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10497
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10498
    "Created: / 22-12-2006 / 16:48:27 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10499
! !
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
 10500
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10501
!Win32OperatingSystem class methodsFor:'registry support'!
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10502
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10503
registryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10504
    "provide access to the registryEntry class"
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10505
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10506
    ^ RegistryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10507
! !
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10508
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10509
!Win32OperatingSystem class methodsFor:'serial port support'!
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10510
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10511
serialPortAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10512
    "provide access to the serial port class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10513
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10514
    ^ Win32SerialPortHandle
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10515
! !
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10516
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
 10517
!Win32OperatingSystem class methodsFor:'shell operations'!
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
 10518
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10519
openApplicationForDocument:fileOrUrl operation:operationSymbol mimeType:mimeType
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10520
    "open a windows-shell application to present the document contained in aFilenameOrString.
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10521
     This looks for the files extension, and is typically used to present help-files,
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10522
     html documents, pdf documents etc.
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10523
     operationSymbol is one of:
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10524
	open
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10525
	edit
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10526
	explore
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10527
	print
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10528
    "
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10529
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10530
    self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10531
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10532
	lpOperation:operationSymbol
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10533
	lpFile:fileOrUrl asString
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10534
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10535
	lpDirectory:nil         "/ uses the current directory
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10536
	nShowCmd:#SW_SHOWNORMAL.
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10537
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10538
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10539
    "
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10540
     self openApplicationForDocument: Filename currentDirectory operation:#open
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10541
     self openApplicationForDocument: 'C:\' operation:#open
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10542
     self openApplicationForDocument: '..\..\doc\books\ArtOfSmalltalk\artMissing186187Fix1.pdf' asFilename operation:#open
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10543
     self openApplicationForDocument: 'http://www.exept.de' asFilename operation:#open
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10544
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10545
     self openApplicationForDocument: 'C:\WINDOWS\Help\clipbrd.chm' asFilename operation:#open
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10546
    "
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10547
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10548
    "Created: / 04-08-2006 / 18:04:52 / fm"
13284
d3828897bd5b comment/format in: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 13224
diff changeset
 10549
    "Modified: / 05-02-2011 / 16:25:31 / cg"
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 10550
! !
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 10551
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10552
!Win32OperatingSystem class methodsFor:'socket support'!
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10553
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10554
socketAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10555
    "provide access to the socket handle class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10556
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10557
    ^ Win32SocketHandle
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10558
! !
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10559
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10560
!Win32OperatingSystem class methodsFor:'system management'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10561
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10562
exitWindows
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10563
    "do not use - may be removed without notice"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10564
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10565
    self exitWindows:#shutdown confirm:'Do you really want to shutdown the system'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10566
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10568
exitWindows:how confirm:confirmationMessageOrNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10569
    "this method is temporary -
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10570
     since my windows system menu crashes so often
7850
087b4ca01736 comment & unneeded method removed
ca
parents: 7841
diff changeset
 10571
     (even CTRL-ALT-DEL does no longer function, but ST/X is still alive),
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10572
     I added this in order to be able to shutdown w95 cleanly"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10573
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10574
    confirmationMessageOrNil notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10575
	(Dialog confirm:confirmationMessageOrNil) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10576
	    ^ false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10577
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10578
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10579
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10580
    int flag;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10581
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10582
    if (how == @symbol(shutdown)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10583
	flag = EWX_SHUTDOWN;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10584
    } else if (how == @symbol(reboot)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10585
	flag = EWX_REBOOT;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10586
    } else if (how == @symbol(logoff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10587
	flag = EWX_LOGOFF;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10588
    } else if (how == @symbol(forceShutdown)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10589
	flag = EWX_SHUTDOWN | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10590
    } else if (how == @symbol(forceReboot)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10591
	flag = EWX_REBOOT | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10592
    } else if (how == @symbol(forceLogoff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10593
	flag = EWX_LOGOFF | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10594
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10595
	RETURN (false);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10596
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10597
    RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10598
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10599
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10600
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10601
!Win32OperatingSystem class methodsFor:'time and date'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10602
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10603
computeOSTimeFromYear:y month:m day:d hour:h minute:min second:s millisecond:millis utc:utcBoolean
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10604
    "return the OS-dependent time for the given time and day.
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10605
     The arguments are assumed to be in localtime including
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10606
     any daylight saving adjustings."
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10607
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10608
    |osTime|
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10609
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10610
%{
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10611
    if (__bothSmallInteger(y, m)
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10612
     && __bothSmallInteger(d, h)
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10613
     && __bothSmallInteger(min, s)
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10614
     && __isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10615
	SYSTEMTIME sysTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10616
	FILETIME fileTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10617
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10618
	sysTime.wHour = __intVal(h);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10619
	sysTime.wMinute = __intVal(min);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10620
	sysTime.wSecond = __intVal(s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10621
	sysTime.wMilliseconds = __intVal(millis);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10622
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10623
	sysTime.wYear = __intVal(y);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10624
	sysTime.wMonth = __intVal(m);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10625
	sysTime.wDay = __intVal(d);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10626
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10627
	if (sysTime.wYear < 1602) goto outOfRange;   // not 1601 - so we don't have to care for timezone
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10628
	if (sysTime.wYear > 9999) goto outOfRange;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10629
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10630
	if (utcBoolean != true) {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10631
	    // adjust for local time
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10632
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10633
	    // TzSpecificLocalTimeToSystemTime() is not supported in Win2000
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10634
	    // - but we do not support Win2k any longer as of 2014
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10635
#ifdef __BORLANDC__
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10636
	    {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10637
		typedef BOOL (WINAPI *P_TzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10638
		static P_TzSpecificLocalTimeToSystemTime pTzSpecificLocalTimeToSystemTime;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10639
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10640
		if (pTzSpecificLocalTimeToSystemTime == NULL) {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10641
		    pTzSpecificLocalTimeToSystemTime =
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10642
			(P_TzSpecificLocalTimeToSystemTime)
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10643
			    GetProcAddress ( GetModuleHandle ("kernel32.dll"),
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10644
							      "TzSpecificLocalTimeToSystemTime");
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10645
		}
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10646
		if (!pTzSpecificLocalTimeToSystemTime(0, &sysTime, &sysTime))
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10647
		    goto error;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10648
	    }
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10649
#else
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10650
	    if (!TzSpecificLocalTimeToSystemTime(0, &sysTime, &sysTime))
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10651
		goto error;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10652
#endif
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10653
	}
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10654
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10655
	if (! SystemTimeToFileTime(&sysTime, &fileTime))
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10656
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10657
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10658
	osTime = FileTimeToOsTime1970(&fileTime);
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10659
    }
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10660
outOfRange: ;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10661
error: ;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10662
%}.
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10663
    osTime notNil ifTrue:[
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10664
	"/ rebias to 1970 by subtracting the number of millis from 1.1.1601 to 1.1.1970
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10665
	"/ ^ osTime - self osTimeOf19700101. -- already done
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10666
	^ osTime
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10667
    ].
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10668
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10669
    "Error, some invalid date ot time"
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10670
    ^ TimeConversionError raiseRequest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10671
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10672
    "
12820
bb674e2ebc2a changed:
Stefan Vogel <sv@exept.de>
parents: 12818
diff changeset
 10673
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10674
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10675
     OperatingSystem computeOSTimeFromYear:2014 month:7 day:1 hour:0 minute:0 second:0 millisecond:0
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10676
    "
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10677
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10678
    "Modified: / 07-07-2010 / 16:56:56 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10679
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10680
17007
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10681
epochEndOSTime
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10682
    "private interface for timestamp to ask the OS what the maximum time
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10683
     (in milliseconds since the Unix epoch, 1.1.1970) is."
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10684
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10685
    "Windows has a 64 Unix 100ns osTime internally, which goes from 0 (1601)
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10686
     to 16r7FFFFFFFFFFFFFFF."
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10687
    "/ ^ (16r7FFFFFFFFFFFFFFF // 10000) - self osTimeOf19700101
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10688
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10689
    "/ but I changed the interface to use unix-biased times as well
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10690
    ^ (SmallInteger maxVal * 2 + 1) * 1000
17007
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10691
!
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10692
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10693
epochStartOSTime
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10694
    "private interface for timestamp to ask the OS what the minimum time
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10695
     (in milliseconds since the Unix epoch, 1.1.1970) is."
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10696
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10697
    "Windows epoch starts at 1.1.1601."
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10698
    "/ ^ self osTimeOf19700101 negated
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10699
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10700
    "/ but I changed the interface to use unix-biased times as well
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10701
    ^ 0
17007
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10702
!
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10703
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10704
getMicrosecondTime
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10705
    "This returns a microsecond timer value.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10706
     The returned value is a 64bit value
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10707
     (which is the number of microseconds since the system's boot time -
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10708
      but you should not depend on that because it is system specific.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10709
     Only use for relative delta-times."
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10710
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10711
%{  /* NOCONTEXT */
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10712
    static int frequencyKnown = 0;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10713
    static LONGLONG ticksPerSecond;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10714
    static LONGLONG divisor;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10715
    LONGLONG tick;     // A point in time
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10716
    LONGLONG micros;
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10717
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10718
    if (! frequencyKnown) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10719
	// get the high resolution counter's accuracy
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10720
	QueryPerformanceFrequency(&ticksPerSecond);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10721
	frequencyKnown = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10722
	divisor = ticksPerSecond / (LONGLONG)1000000;
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10723
    }
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10724
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10725
    // what time is it?
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10726
    QueryPerformanceCounter(&tick);
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10727
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10728
    micros = tick / divisor;
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10729
    RETURN ( __MKLARGEINT64(1, (micros & 0xFFFFFFFF), (micros >> 32)) );
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10730
%}
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10731
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10732
     |t1 t2 dT|
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10733
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10734
     t1 := self getMicrosecondTime.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10735
     Delay waitForSeconds:1.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10736
     t2 := self getMicrosecondTime.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10737
     dT := t2 - t1
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10738
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10739
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10740
     |t1 t2 dT|
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10741
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10742
     t1 := self getMillisecondTime.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10743
     Delay waitForSeconds:1.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10744
     t2 := self getMillisecondTime.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10745
     dT := t2 - t1
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10746
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10747
!
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10748
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10749
getMillisecondTime
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10750
    "This returns the millisecond timers value.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10751
     The range is limited to 0..1fffffff (i.e. the SmallInteger range) to avoid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10752
     LargeInteger arithmetic when doing timeouts and delays.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10753
     Since this value is wrapping around in regular intervals (approx. every 6.21 days),
11800
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10754
     this can only be used for short relative time deltas.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10755
     Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10756
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10757
     BAD DESIGN:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10758
	This should be changed to return some instance of RelativeTime,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10759
	and these computations moved there.
11800
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10760
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10761
     Don't use this method in application code since it is an internal (private)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10762
     interface. For compatibility with ST-80, use Time millisecondClockValue.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10763
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10764
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10765
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10766
12838
9b773959a7c7 changed: #getMillisecondTime
Stefan Vogel <sv@exept.de>
parents: 12837
diff changeset
 10767
    RETURN ( __mkSmallInteger(GetTickCount() & 0x1FFFFFFF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10768
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10769
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10770
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10771
getOSTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10772
    "This returns the OS time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10773
     The base of the returned value is not consistent across
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10774
     different OS's - some return the number of millis since jan, 1st 1970;
16947
9a1173183b4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16474
diff changeset
 10775
     others since 1600. Here, the original value of the OS is rebiased to 1.1.1970,
9a1173183b4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16474
diff changeset
 10776
     meaning that the returned value has the number of seconds since 1970 subtracted,
9a1173183b4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16474
diff changeset
 10777
     so the returned value is consistent across ST/X's running on different systems.
9a1173183b4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16474
diff changeset
 10778
9a1173183b4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16474
diff changeset
 10779
     Don't use this method in application code since it is an internal (private)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10780
     interface. For compatibility with ST-80, use Time>>millisecondClockValue.
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10781
     or use instances of Time, Date or Timestamp to work with."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10782
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10783
    |osTime|
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10784
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10785
%{
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10786
    FILETIME fileTime;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10787
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10788
    GetSystemTimeAsFileTime(&fileTime);
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10789
    osTime = FileTimeToOsTime1970(&fileTime);
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10790
%}.
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10791
    "/ rebias to 1970 by subtracting the number of millis from 1.1.1601 to 1.1.1970
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10792
    "/ ^ osTime - self osTimeOf19700101 -- already done.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10793
    ^ osTime
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10794
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10795
    "
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10796
     OperatingSystem getOSTime.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10797
     Delay waitForSeconds:0.2.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10798
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10799
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10800
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10801
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10802
getTimezoneInformation
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10803
    "get information about the OS's timezone setting. See documentation in
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10804
     AbstractOperatingSystem::TimeZoneInformation for details"
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10805
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10806
    ^ self getTimezoneInformationForYear:nil.
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10807
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10808
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10809
     self getTimezoneInformation
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10810
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10811
!
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10812
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10813
getTimezoneInformationForYear:anIntegerOrNil
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10814
    "get information about the OS's timezone setting. See documentation in
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10815
     AbstractOperatingSystem::TimeZoneInformation for details"
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10816
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10817
    |error bias standardName
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10818
     standardDate_y standardDate_m standardDate_d standardDate_wd
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10819
     standardDate_h standardDate_min standardDate_s
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10820
     standardBias
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10821
     daylightName
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10822
     daylightDate_y daylightDate_m daylightDate_d daylightDate_wd
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10823
     daylightDate_h daylightDate_min daylightDate_s
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10824
     daylightBias info|
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10825
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10826
%{
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10827
    TIME_ZONE_INFORMATION tzInfo;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10828
    DWORD retVal;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10829
    WCHAR nm[33];
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10830
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10831
    if (anIntegerOrNil == nil) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10832
	retVal = GetTimeZoneInformation(&tzInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10833
	switch (retVal) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10834
	    case TIME_ZONE_ID_STANDARD:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10835
	    case TIME_ZONE_ID_DAYLIGHT:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10836
	    case TIME_ZONE_ID_UNKNOWN:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10837
		break;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10838
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10839
	    default:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10840
	    case TIME_ZONE_ID_INVALID:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10841
		error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10842
		goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10843
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10844
    } else if (__isSmallInteger(anIntegerOrNil)) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10845
	int year = __intVal(anIntegerOrNil);
18628
6d7c70420471 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18548
diff changeset
 10846
#if defined(__BORLANDC__) || defined(__MINGW32__)
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10847
	{
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10848
	    typedef BOOL (WINAPI *P_GetTimeZoneInformationForYear)(
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10849
					USHORT,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10850
					LPTIME_ZONE_INFORMATION, // - should be, but is not defined: PDYNAMIC_TIME_ZONE_INFORMATION,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10851
					LPTIME_ZONE_INFORMATION);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10852
	    static P_GetTimeZoneInformationForYear pGetTimeZoneInformationForYear;
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10853
	    static int haveTriedToGet_P_GetTimeZoneInformationForYear = 0;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10854
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10855
	    if (! haveTriedToGet_P_GetTimeZoneInformationForYear) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10856
		pGetTimeZoneInformationForYear =
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10857
		    (P_GetTimeZoneInformationForYear)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTimeZoneInformationForYear");
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10858
		haveTriedToGet_P_GetTimeZoneInformationForYear = 1;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10859
	    }
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10860
	    if (pGetTimeZoneInformationForYear == NULL) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10861
		error = __mkSmallInteger(@symbol(primitiveFailed));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10862
		goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10863
	    } else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10864
		if (!pGetTimeZoneInformationForYear(year, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10865
		    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10866
		    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10867
		}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10868
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10869
	}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10870
#else
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10871
	if (!GetTimeZoneInformationForYear(year, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10872
	    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10873
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10874
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10875
#endif
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10876
    } else {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10877
	error = @symbol(badArgument);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10878
	goto out;
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10879
    }
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10880
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10881
    bias = __mkSmallInteger(tzInfo.Bias);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10882
    memmove(nm, tzInfo.StandardName, 32*sizeof(WCHAR));
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10883
    nm[32] = 0;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10884
    standardName = __MKU16STRING(nm);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10885
    standardDate_y = __mkSmallInteger(tzInfo.StandardDate.wYear);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10886
    standardDate_m = __mkSmallInteger(tzInfo.StandardDate.wMonth);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10887
    standardDate_d = __mkSmallInteger(tzInfo.StandardDate.wDay);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10888
    standardDate_wd = __mkSmallInteger(tzInfo.StandardDate.wDayOfWeek);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10889
    standardDate_h = __mkSmallInteger(tzInfo.StandardDate.wHour);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10890
    standardDate_min = __mkSmallInteger(tzInfo.StandardDate.wMinute);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10891
    standardDate_s = __mkSmallInteger(tzInfo.StandardDate.wSecond);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10892
    standardBias =  __mkSmallInteger(tzInfo.StandardBias);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10893
    memmove(nm, tzInfo.DaylightName, 32*sizeof(WCHAR));
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10894
    nm[32] = 0;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10895
    daylightName = __MKU16STRING(nm);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10896
    daylightDate_y = __mkSmallInteger(tzInfo.DaylightDate.wYear);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10897
    daylightDate_m = __mkSmallInteger(tzInfo.DaylightDate.wMonth);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10898
    daylightDate_d = __mkSmallInteger(tzInfo.DaylightDate.wDay);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10899
    daylightDate_wd = __mkSmallInteger(tzInfo.DaylightDate.wDayOfWeek);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10900
    daylightDate_h = __mkSmallInteger(tzInfo.DaylightDate.wHour);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10901
    daylightDate_min = __mkSmallInteger(tzInfo.DaylightDate.wMinute);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10902
    daylightDate_s = __mkSmallInteger(tzInfo.DaylightDate.wSecond);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10903
    daylightBias =  __mkSmallInteger(tzInfo.DaylightBias);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10904
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10905
out:;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10906
%}.
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10907
    error notNil ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10908
	self primitiveFailed:error.
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10909
    ].
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10910
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10911
    info := self timeZoneInfoClass new.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10912
    info
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10913
	bias:bias
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10914
	name:standardName standardBias:standardBias
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10915
	daylightName:daylightName daylightBias:daylightBias.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10916
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10917
    standardDate_m ~~ 0 ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10918
	info standardYear:standardDate_y standardMonth:standardDate_m standardDay:standardDate_d
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10919
	     standardWeekDay:standardDate_wd standardHour:standardDate_h standardMinute:standardDate_min.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10920
    ].
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10921
    daylightDate_m ~~ 0 ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10922
	info daylightYear:daylightDate_y daylightMonth:daylightDate_m daylightDay:daylightDate_d
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10923
	     daylightWeekDay:daylightDate_wd daylightHour:daylightDate_h daylightMinute:daylightDate_min.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10924
    ].
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10925
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10926
    ^ info
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10927
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10928
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10929
     self getTimezoneInformationForYear:2014
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10930
     self getTimezoneInformationForYear:2015
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10931
     self getTimezoneInformationForYear:1977
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10932
     self getTimezoneInformationForYear:nil
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10933
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10934
!
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10935
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10936
osTimeOf19700101
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10937
    "the number of millis from 1.1.1601 to 1.1.1970"
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10938
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10939
    ^ 11644473600000
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10940
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10941
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10942
      self computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10943
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10944
!
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10945
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10946
sleep:numberOfSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10947
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10948
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10949
    "cease ANY action for some time. This suspends the whole smalltalk
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10950
     (unix-) process for some time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10951
     Not really useful since not even low-prio processes and interrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10952
     handling will run during the sleep.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10953
     Use either OperatingSystem>>millisecondDelay: (which makes all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10954
     threads sleep, but handles interrupts) or use a Delay (which makes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10955
     only the calling thread sleep)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10956
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10957
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10958
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10959
    if (__isSmallInteger(numberOfSeconds)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10960
	sleep(__intVal(numberOfSeconds));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10961
	RETURN ( self );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10962
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10963
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10964
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10965
     argument not integer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10966
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10967
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10968
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10969
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10970
     OperatingSystem sleep:2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10971
    "
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10972
!
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10973
17042
f381b63198e1 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17023
diff changeset
 10974
timeInfoFromSeconds:osSeconds milliseconds:osMilliSeconds localTime:isLocalTime
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10975
    "return a timeInfo structure containing values for the given OS-millisecond value.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10976
     An internal helper"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10977
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10978
    |year month day hour minute second millis utcOffset isDst
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10979
     dst yDay weekDay info reason tLow tHigh t error |
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10980
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
 10981
    t := (osSeconds * 1000) + osMilliSeconds "+ self osTimeOf19700101 -- done in C".
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10982
    tLow := (t bitAnd:16rFFFFFFFF).
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10983
    tHigh := t bitShift:-32.
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10984
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10985
%{
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10986
    FILETIME fileTime;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10987
    SYSTEMTIME sysTime, *sysTimePtr;
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10988
    INT _utcOffset, _stdUtcOffset;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10989
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10990
    /* try cache */
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10991
    {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10992
	OBJ lastOsTimeLow, lastOsTimeHi, lastTimeInfo;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10993
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10994
	lastOsTimeLow = @global(LastOsTimeLow);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10995
	lastOsTimeHi = @global(LastOsTimeHi);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10996
	if (__isInteger(lastOsTimeLow)
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10997
	     && (__unsignedLongIntVal(lastOsTimeLow) == __unsignedLongIntVal(tLow))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10998
	     && lastOsTimeHi
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10999
	     && (__unsignedLongIntVal(lastOsTimeHi) == __unsignedLongIntVal(tHigh))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11000
	     && (@global(LastTimeInfoIsLocal) == isLocalTime)
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11001
	) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11002
	    lastTimeInfo = @global(LastTimeInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11003
	    if (lastTimeInfo != nil) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11004
		RETURN (lastTimeInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11005
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11006
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11007
    }
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11008
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
 11009
    if (!OsTime1970ToFileTime(tLow, tHigh, &fileTime))
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11010
	goto out;
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11011
    if (!FileTimeToSystemTime(&fileTime, &sysTime))
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11012
	goto out;
16948
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
 11013
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11014
    if (isLocalTime == false) { // easy: UTC time
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11015
	sysTimePtr = &sysTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11016
	utcOffset = __mkSmallInteger(0);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11017
	isDst = false;
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11018
    } else {  // local time: have to convert and find out about DST
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11019
	TIME_ZONE_INFORMATION tzInfo;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11020
	LONGLONG longTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11021
	SYSTEMTIME localSysTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11022
	FILETIME localFileTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11023
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11024
	sysTimePtr = &localSysTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11025
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11026
	if (!SystemTimeToTzSpecificLocalTime(NULL, &sysTime, &localSysTime))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11027
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11028
	if (!SystemTimeToFileTime(&localSysTime, &localFileTime))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11029
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11030
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11031
	// all the rest is computing the UTC offset and whether DST applies
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11032
	longTime = ((LONGLONG)fileTime.dwHighDateTime << 32) + fileTime.dwLowDateTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11033
	longTime -= ((LONGLONG)localFileTime.dwHighDateTime << 32) + localFileTime.dwLowDateTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11034
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11035
	// utcOffset is the difference from UTC to local time including possible DST
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11036
	_utcOffset = longTime / 10000000;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11037
	utcOffset = __mkSmallInteger(_utcOffset);
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11038
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11039
# if defined(__BORLANDC__) || defined(__MINGW32__)
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11040
	{
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11041
	    typedef BOOL (WINAPI *P_GetTimeZoneInformationForYear)(
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11042
					USHORT,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11043
					LPTIME_ZONE_INFORMATION, // - should be, but is not defined: PDYNAMIC_TIME_ZONE_INFORMATION,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11044
					LPTIME_ZONE_INFORMATION);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11045
	    static P_GetTimeZoneInformationForYear pGetTimeZoneInformationForYear;
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11046
	    static int haveTriedToGet_P_GetTimeZoneInformationForYear = 0;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11047
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11048
	    if (! haveTriedToGet_P_GetTimeZoneInformationForYear) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11049
		pGetTimeZoneInformationForYear =
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11050
		    (P_GetTimeZoneInformationForYear)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTimeZoneInformationForYear");
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11051
		haveTriedToGet_P_GetTimeZoneInformationForYear = 1;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11052
	    }
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11053
	    if (pGetTimeZoneInformationForYear == NULL) {
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11054
		// ignore this error and fall back to GetTimeZoneInformation()
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11055
		reason = @symbol(NoGetTimeZoneInformationForYear);
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11056
	    } else {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11057
		if (pGetTimeZoneInformationForYear(localSysTime.wYear, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11058
		    _stdUtcOffset = (tzInfo.Bias + tzInfo.StandardBias) * 60;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11059
		    isDst = (_stdUtcOffset != _utcOffset) ? true : false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11060
		} else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11061
		    // ignore this error and fall back to GetTimeZoneInformation()
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11062
		    reason = @symbol(GetTimeZoneInformationForYearFailed);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11063
		    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11064
		}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11065
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11066
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11067
# else
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11068
	if (GetTimeZoneInformationForYear(localSysTime.wYear, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11069
	    _stdUtcOffset = (tzInfo.Bias + tzInfo.StandardBias) * 60;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11070
	    isDst = (_stdUtcOffset != _utcOffset) ? true : false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11071
	} else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11072
	    // ignore this error and fall back to GetTimeZoneInformation()
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11073
	    reason = @symbol(GetTimeZoneInformationForYearFailed);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11074
	    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11075
	}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11076
# endif
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11077
	// this code is a fallback for WIN XP
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11078
	if (isDst == nil) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11079
	    DWORD retVal = GetTimeZoneInformation(&tzInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11080
	    switch (retVal) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11081
		case TIME_ZONE_ID_STANDARD:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11082
		case TIME_ZONE_ID_DAYLIGHT:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11083
		case TIME_ZONE_ID_UNKNOWN:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11084
		    // nonDstOffset is the difference from UTC to local time without DST
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11085
		    _stdUtcOffset = (tzInfo.Bias + tzInfo.StandardBias) * 60;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11086
		    isDst = (_stdUtcOffset != _utcOffset) ? true : false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11087
		    break;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11088
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11089
		// these are errors, which may occur, if the
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11090
		// Windows OS has not been setupm correctly.
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11091
		// We ignore these errors here, but we don't know if DST applies.
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11092
		// Assume that there is no DST.
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11093
		default:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11094
		case TIME_ZONE_ID_INVALID:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11095
		    isDst = false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11096
		    reason = @symbol(TIME_ZONE_ID_INVALID);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11097
		    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11098
		    break;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11099
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11100
	}  // End WINXP backward compatibility
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11101
    }
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11102
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11103
    hour = __mkSmallInteger(sysTimePtr->wHour);
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11104
    minute = __mkSmallInteger(sysTimePtr->wMinute);
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11105
    second = __mkSmallInteger(sysTimePtr->wSecond);
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11106
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11107
    year = __mkSmallInteger(sysTimePtr->wYear);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11108
    month = __mkSmallInteger(sysTimePtr->wMonth);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11109
    day = __mkSmallInteger(sysTimePtr->wDay);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11110
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11111
    millis = __mkSmallInteger(sysTimePtr->wMilliseconds);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11112
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11113
    weekDay = __mkSmallInteger(sysTimePtr->wDayOfWeek == 0 ? 7 : sysTimePtr->wDayOfWeek);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11114
out:;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11115
%}.
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11116
"/    '--> REASON: ' errorPrint. reason errorPrintCR. '--> ERROR: ' errorPrint. error errorPrintCR.
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11117
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 11118
    year isNil ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11119
	TimeConversionError raiseErrorString:' - out of range'.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 11120
    ].
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 11121
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11122
    info := self timeInfoClass new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11123
    info
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11124
	year:year
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11125
	month:month
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11126
	day:day
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11127
	hours:hour
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11128
	minutes:minute
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11129
	seconds:second
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11130
	milliseconds:millis
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11131
	utcOffset:utcOffset
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11132
	dst:isDst
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11133
	dayInYear:yDay
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11134
	dayInWeek:weekDay.
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 11135
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 11136
    LastTimeInfo := info.
16948
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
 11137
    LastOsTimeLow := tLow.
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
 11138
    LastOsTimeHi := tHigh.
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 11139
    LastTimeInfoIsLocal := isLocalTime.
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 11140
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11141
    ^ info
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11142
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11143
    "
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11144
    self assert:(Timestamp year:1994 month:2 day:1 hour:12 minute:0 second:0) timeInfo dst not
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11145
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11146
    DST in MEZ in 1994:
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11147
      self assert:(Timestamp year:1994 month:7 day:1 hour:12 minute:0 second:0) timeInfo dst
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11148
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11149
     no DST in MEZ in 1970:
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11150
      self assert:(Timestamp year:1977 month:7 day:1 hour:12 minute:0 second:0) timeInfo dst not
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11151
    "
9431
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 11152
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 11153
    "Modified: / 06-07-2006 / 18:18:56 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11154
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11156
!Win32OperatingSystem class methodsFor:'users & groups'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11157
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11158
getApplicationDataDirectoryFor:appName
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11159
    "return the directory, where user-and-application-specific private files are to be
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11160
     located (ini-files, preferences etc.).
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11161
     Under windows, something like 'C:\Users\Administrator\AppData\Roaming\<appName>'
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11162
     is returned, here, the fallback ~/.<appName> is returned.
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11163
     Notice that only the name is returned; the directory is not guaranteed to exist."
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11164
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11165
    "{ Pragma: +optSpace }"
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11166
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11167
    |appDataDirFromEnv appDataDirFromRegistry|
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11168
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11169
    appDataDirFromEnv := self getEnvironment:'APPDATA'.
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11170
    appDataDirFromEnv notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11171
	^ appDataDirFromEnv , '\' , appName
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 11172
    ].
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 11173
    appDataDirFromRegistry :=
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11174
	(self registryEntry key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11175
	    valueNamed:'AppData'.
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11176
    appDataDirFromRegistry notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11177
	^ appDataDirFromRegistry , '\' , appName
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11178
    ].
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11179
    ^ super getApplicationDataDirectoryFor:appName
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11180
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11181
    "
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 11182
     OperatingSystem getApplicationDataDirectoryFor:'expecco'
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11183
    "
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11184
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11185
    "Created: / 29-07-2010 / 12:13:12 / sr"
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11186
!
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11187
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11188
getDesktopDirectory
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11189
    "return the name of the users desktop directory (i.e. yours)."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11190
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11191
    "{ Pragma: +optSpace }"
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11192
10543
442329e05841 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10542
diff changeset
 11193
    |dir path|
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11194
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11195
    path := (self registryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11196
		key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11197
	    valueNamed:'Desktop'.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11198
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11199
    path isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11200
	"Fallback"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11201
	dir := self getHomeDirectory.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11202
	dir isNil ifTrue:[ ^ nil ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11203
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11204
	path := dir , '\Desktop'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11205
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11206
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
 11207
    (self isValidPath:path) ifFalse:[ ^ nil ].
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11208
    ^ path
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11209
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11210
    "
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11211
     OperatingSystem getDesktopDirectory
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11212
    "
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11213
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11214
    "Created: / 16-05-2007 / 13:23:43 / cg"
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11215
!
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11216
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11217
getDocumentsDirectory
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11218
    "return the name of the users 'Documents' directory."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11219
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11220
    "{ Pragma: +optSpace }"
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11221
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11222
    |dir|
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11223
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11224
    dir := (self registryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11225
		key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11226
	    valueNamed:'Personal'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11227
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11228
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11229
	dir := self getHomeDirectory.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11230
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11231
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11232
    ^ dir.
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11233
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11234
    "
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11235
     OperatingSystem getDocumentsDirectory
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11236
    "
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11237
!
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11238
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11239
getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11240
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11241
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11242
    "return the current users (thats you) effective numeric group id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11243
     This is only different from getGroupID, if you have ST/X running
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11244
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11245
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11246
    ^ self getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11247
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11248
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11249
     OperatingSystem getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11250
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11251
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11252
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11253
getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11254
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11255
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11256
    "return the current users (thats you) effective numeric user id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11257
     This is only different from getUserID, if you have ST/X running
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11258
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11259
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11260
    ^ self getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11261
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11262
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11263
     OperatingSystem getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11264
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11265
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11266
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11267
getFullUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11268
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11269
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11270
    "return a string with the users full name - if available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11271
     If not, return the login name as a fallBack."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11272
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11273
    |info gecos|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11274
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11275
    info := self userInfoOf:userID.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11276
    (info notNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11277
    and:[info includesKey:#gecos]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11278
	gecos := info at:#gecos.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11279
	(gecos includes:$,) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11280
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11281
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11282
	^ gecos
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11283
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11284
    ^ self getUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11285
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11286
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11287
     OperatingSystem getFullUserNameFromID:0
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11288
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11289
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11290
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11291
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11292
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11293
    "Modified: 15.7.1996 / 12:44:21 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11294
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11295
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11296
getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11297
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11298
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11299
    "return the current users (thats you) numeric group id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11300
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11301
    ^ 1 "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11302
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11303
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11304
     OperatingSystem getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11305
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11306
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11307
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11308
getGroupNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11309
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11310
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11311
    "return the group-name-string for a given numeric group-id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11312
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11313
    ^ '???' "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11314
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11315
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11316
     OperatingSystem getGroupNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11317
     OperatingSystem getGroupNameFromID:10
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11318
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11319
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11320
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11321
getHomeDirectory
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11322
    "return the name of the users home directory (i.e. yours)."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11323
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11324
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11325
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11326
    |dir|
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11327
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11328
    dir := self getEnvironment:'USERPROFILE'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11329
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11330
	dir := '.'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11331
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11332
    ^ dir.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11333
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11334
    "
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
 11335
     OperatingSystem getHomeDirectory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11336
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11337
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
 11338
    "Modified: / 16.2.2000 / 09:17:55 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11339
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11340
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11341
getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11342
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11343
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11344
    "return a string with the users login name (thats yours)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11345
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11346
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11347
    static char cachedName[64];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11348
    static firstCall = 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11349
#ifndef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11350
    extern char *getenv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11351
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11352
    char *name = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11353
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11354
    if (firstCall) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11355
	DWORD nameSize = sizeof(cachedName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11356
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11357
	if (GetUserName(cachedName, &nameSize) == TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11358
	    name = cachedName;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11359
	    firstCall = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11360
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11361
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11362
	name = cachedName;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11363
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11364
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11365
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11366
     * try a few common environment variables ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11367
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11368
    if (! name || (name[0] == 0) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11369
	name = getenv("LOGIN");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11370
	if (! name || (name[0] == 0) ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11371
	    name = getenv("LOGNAME");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11372
	    if (! name || (name[0] == 0) ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11373
		name = getenv("USER");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11374
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11375
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11376
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11377
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11378
     * nope - I really font know who you are.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11379
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11380
    if (! name || (name[0] == 0) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11381
	name = "you";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11382
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11383
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11384
    RETURN ( __MKSTRING(name) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11385
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11386
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11387
     OperatingSystem getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11388
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11389
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11390
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11391
getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11392
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11393
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11394
    "return the current users (thats you) numeric user id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11395
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11396
    ^ 1 "just a dummy for systems which do not have userIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11397
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11398
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11399
     OperatingSystem getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11400
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11401
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11402
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11403
getUserNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11404
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11405
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11406
    "return the user-name-string for a given numeric user-id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11407
     This is the login name, not the fullName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11408
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11409
    aNumber == self getUserID ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11410
	^ self getLoginName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11411
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11412
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11413
    ^ '? (' , aNumber printString , ')'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11414
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11415
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11416
     OperatingSystem getUserNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11417
     OperatingSystem getUserNameFromID:100
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11418
     OperatingSystem getUserNameFromID:9991
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11419
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11420
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11421
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11422
isRunningWithElevatedRootOrAdminRights
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11423
    "return true, if a NORMAL user is running with elevated admin rights."
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11424
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11425
%{
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11426
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11427
    HANDLE h_Process;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11428
    HANDLE h_Token;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11429
    TOKEN_ELEVATION t_TokenElevation;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11430
    TOKEN_ELEVATION_TYPE e_ElevationType;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11431
    DWORD dw_TokenLength;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11432
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11433
    h_Process = GetCurrentProcess();
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11434
    if (OpenProcessToken(h_Process,TOKEN_READ,&h_Token) == FALSE) {
15877
a752f474d7a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15874
diff changeset
 11435
	console_printf("Error: Couldn't open the process token\n");
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11436
	goto getOutOfHere;
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11437
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11438
    if (GetTokenInformation(h_Token,TokenElevation,&t_TokenElevation,sizeof(t_TokenElevation),&dw_TokenLength) == FALSE) {
15877
a752f474d7a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15874
diff changeset
 11439
	console_printf("Error: Couldn't retrieve the elevation right of the current process token\n");
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11440
	CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11441
	goto getOutOfHere;
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11442
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11443
    if (t_TokenElevation.TokenIsElevated != 0) {
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11444
	if (GetTokenInformation(h_Token,TokenElevationType,&e_ElevationType,sizeof(e_ElevationType),&dw_TokenLength) == FALSE) {
15877
a752f474d7a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15874
diff changeset
 11445
	    console_printf("Error: Couldn't retrieve the elevation token class\n");
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11446
	    CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11447
	    goto getOutOfHere;
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11448
	} else {
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11449
	    if (e_ElevationType == TokenElevationTypeFull || e_ElevationType == TokenElevationTypeDefault) {
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11450
		CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11451
		RETURN(true);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11452
	    }
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11453
	    CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11454
	    RETURN(false);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11455
	}
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11456
    } else {
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11457
	CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11458
	RETURN(false);
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11459
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11460
getOutOfHere: ;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11461
%}.
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11462
    "/ self primitiveFailed.
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11463
    ^ false
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11464
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11465
    "Modified: / 17-12-2013 / 17:12:23 / cg"
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11466
!
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11467
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11468
isRunningWithRootOrAdminRights
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11469
    "read some registry entry which only Admin can read;
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11470
     if we can, we are; otherwise, we are not."
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11471
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11472
%{
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11473
    SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11474
    PSID AdministratorsGroup;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11475
    BOOL IsInAdminGroup = FALSE;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11476
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11477
    // Initialize SID.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11478
    if( !AllocateAndInitializeSid( &NtAuthority,
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11479
				   2,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11480
				   SECURITY_BUILTIN_DOMAIN_RID,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11481
				   DOMAIN_ALIAS_RID_ADMINS,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11482
				   0, 0, 0, 0, 0, 0,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11483
				   &AdministratorsGroup))
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11484
    {
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11485
	// Initializing SID Failed.
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11486
	RETURN( false );
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11487
    }
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11488
    // Check whether the token is present in admin group.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11489
    if( !CheckTokenMembership( NULL,
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11490
			       AdministratorsGroup,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11491
			       &IsInAdminGroup ))
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11492
    {
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11493
	// Error occurred.
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11494
	IsInAdminGroup = FALSE;
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11495
    }
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11496
    // Free SID and return.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11497
    FreeSid(AdministratorsGroup);
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11498
    RETURN( IsInAdminGroup ? true : false);
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11499
%}.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11500
    "/ seems not to work...
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11501
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11502
"/    "/ RegOpenKey(HKEY_USERS, "S-1-5-19", &key)
15835
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11503
"/    (RegistryEntry key:'HKEY_USERS') notNil ifTrue:[
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11504
"/        (RegistryEntry key:'HKEY_USERS/S-1-5-19') notNil ifTrue:[
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11505
"/            ^ true
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11506
"/        ]
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11507
"/    ].
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11508
    ^ false.
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11509
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11510
    "
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11511
     OperatingSystem isRunningWithRootOrAdminRights
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11512
    "
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11513
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11514
    "Created: / 28-11-2013 / 14:00:02 / cg"
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11515
!
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11516
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11517
userInfoOf:aNameOrID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11518
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11519
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11520
    "return a dictionary filled with userinfo. The argument can be either
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11521
     a string with the users name or its numeric id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11522
     Notice, that DOS systems only provide a very limited set of information.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11523
     Portable applications may want to check the systemType and NOT depend
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11524
     on all keys to be present in the returned dictionary."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11525
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
 11526
    |info name "uid gid" dir|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11527
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11528
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11529
    name isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11530
	aNameOrID == self getUserID ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11531
	    name := self getLoginName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11532
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11533
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11534
    name notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11535
	info at:#name put:name.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11536
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11537
	info at:#name put:'unknown'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11538
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11539
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11540
	aNameOrID == self getUserID ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11541
	    dir := self getHomeDirectory
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11542
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11543
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11544
    dir notNil ifTrue:[info at:#dir put:dir].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11545
    "/ uid notNil ifTrue:[info at:#uid put:uid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11546
    "/ gid  notNil ifTrue:[info at:#gid put:gid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11547
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11548
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11549
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11550
     OperatingSystem userInfoOf:'root'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11551
     OperatingSystem userInfoOf:1
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11552
     OperatingSystem userInfoOf:'claus'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11553
     OperatingSystem userInfoOf:'fooBar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11554
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11555
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11556
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11557
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11558
!Win32OperatingSystem class methodsFor:'waiting for events'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11559
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11560
blockingChildProcessWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11561
     "return true, if childProcessWait: blocks, if no children are ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11562
      On those systems, we must be somewhat careful when looking out for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11563
      a subprocesses status (to avoid blocking)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11564
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11565
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11566
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11568
childProcessWait:blocking pid:pidToWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11569
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11570
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11571
    "get status changes from child processes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11572
     Return an OSProcessStatus or nil, if no process has terminated.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11573
     If blocking is true, we wait until a process changed state,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11574
     otherwise we return immediately.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11575
     Note that win32 needs to know the HANDLE of the process on which
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11576
     it waits.  In case of an error, THIS ALWAYS WAITS and then times out."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11577
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11578
    |pid status code core|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11579
%{
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 11580
//#define PROCESSDEBUG_CHILDPROCESSWAIT
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11581
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 11582
    int endStatus;
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11583
    DWORD exitCode;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11584
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
 11585
    if (__isExternalAddressLike(pidToWait) ) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11586
	HANDLE __pidToWait = _HANDLEVal(pidToWait);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11587
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11588
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11589
	console_printf("childProcessWait %x b %d\n",__pidToWait,blocking==true);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11590
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11591
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11592
	if (blocking == true) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11593
#ifdef DO_WRAP_CALLS
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11594
	    do {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11595
		__threadErrno = 0;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11596
		// do not cast to INT - will loose sign bit then!
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11597
		endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, __pidToWait, INFINITE);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11598
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11599
#else
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11600
	    endStatus = WaitForSingleObject(__pidToWait, INFINITE);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11601
	    if (endStatus < 0) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11602
		__threadErrno = __WIN32_ERR(GetLastError());
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11603
	    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11604
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11605
	    if (endStatus == WAIT_TIMEOUT) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11606
		if (blocking==true)
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11607
		    status = @symbol(timeout);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11608
		else {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11609
		    status = @symbol(continue);
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11610
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11611
		    console_printf("ret nil\n");
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11612
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11613
		    RETURN(nil);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11614
		}
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11615
	    } else if (endStatus == WAIT_OBJECT_0) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11616
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11617
	    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11618
	}
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11619
12625
6b04dbbeb379 changed: #childProcessWait:pid:
Claus Gittinger <cg@exept.de>
parents: 12616
diff changeset
 11620
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11621
	console_printf("GetExitCodeProcess\n");
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11622
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11623
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11624
	if (GetExitCodeProcess(__pidToWait, &exitCode)) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11625
	    if (exitCode == STILL_ACTIVE) {
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11626
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11627
		console_printf("exitCode: STILL_ACTIVE\n");
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11628
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11629
		RETURN(nil);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11630
	    }
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11631
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11632
	    console_printf("exitCode %d\n", exitCode);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11633
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11634
	    status = @symbol(exit);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11635
	    code = __mkSmallInteger(exitCode);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11636
	    core = false;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11637
	    pid = pidToWait;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11638
	} else {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11639
	    code = __mkSmallInteger(GetLastError());
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11640
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11641
	    console_printf("GetExitCodeProcess failed: error=%d\n", GetLastError());
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11642
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11643
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11644
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11645
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11646
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11647
    (status isNil or:[pid isNil]) ifTrue:[
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11648
	^ self primitiveFailed:code
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11649
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11650
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11651
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11652
"/ show:' code: '; show:code; show:' core:'; showCR:core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11653
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11654
    ^ OSProcessStatus pid:pid status:status code:code core:core
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11655
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11656
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11657
numAvailableForReadOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11658
    "return the number of bytes available for reading, without blocking."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11659
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11660
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11661
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11662
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11663
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11664
  readableInto:readableResultFdArray writableInto:writableResultFdArray exceptionInto:exceptionResultFdArray
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11665
  withTimeOut:millis
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11666
    "wait for any fd in readFdArray (an Array of integers) to become ready for reading,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11667
     writeFdArray to become ready for writing,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11668
     or exceptFdArray to arrive exceptional data (i.e. out-of-band data).
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11669
     Timeout after t milliseconds or - if the timeout time is 0 - immediately..
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11670
     Empty fd-sets will always wait. Zero time can be used to poll file-
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11671
     descriptors (i.e. to check if I/O possible without blocking).
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11672
     The corresponding filedescriptors which are ready are returned in readableResultFdArray,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11673
     writableResultFdArray and exceptionResultFdArray respectively.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11674
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11675
     Return the (overall) number of selected filedescriptors.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11676
     readableResultFdArray, writableResultFdArray and exceptionResultFdArray will
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11677
     get a nil-value stored into the slot after the last valid fileDescriptor;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11678
     Thus, the caller can simply scan these arrays upTo the end or a nil value."
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11679
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11680
%{
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11681
//#define SELECTDEBUGWIN32
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11682
//#define SELECT3DEBUGWIN32
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11683
#define MAXHANDLE 128
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 11684
    int i, idx;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11685
    INT t;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11686
    int numHandles;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11687
    DWORD res;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11688
    HANDLE hArray[MAXHANDLE+1];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11689
    int retArray[MAXHANDLE];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11690
    int readCount, writeCount, exceptCount;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11691
    int resultSizeReadable = 0, resultSizeWritable = 0, resultSizeException = 0;
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11692
    int cntR = 0, cntW = 0, cntE = 0, cntAll = 0;
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11693
    int *pcntR = &cntR, *pcntW = &cntW, *pcntE = &cntE;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11694
    fd_set readFds;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11695
    fd_set writeFds;
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
 11696
    fd_set exceptFds;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11697
    int hasSockets;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11698
    int hasPipes;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11699
    int pass = 1;       // perform up to 2 passes
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11700
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11701
    if (readableResultFdArray != nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11702
	if (! __isArrayLike(readableResultFdArray)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11703
	    goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11704
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11705
	resultSizeReadable = __arraySize(readableResultFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11706
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11707
    if (writableResultFdArray != nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11708
	if (! __isArrayLike(writableResultFdArray)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11709
	    goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11710
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11711
	resultSizeWritable = __arraySize(writableResultFdArray);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11712
	if (readableResultFdArray == writableResultFdArray) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11713
	    // allow common result set for read/write/except
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11714
	    pcntW = &cntR;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11715
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11716
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11717
    if (exceptionResultFdArray != nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11718
	if (! __isArrayLike(exceptionResultFdArray)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11719
	    goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11720
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11721
	resultSizeException = __arraySize(exceptionResultFdArray);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11722
	if (exceptionResultFdArray == readableResultFdArray) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11723
	    // allow common result set for read/write/except
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11724
	    pcntE = &cntR;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11725
	} else if (exceptionResultFdArray == writableResultFdArray) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11726
	    pcntE = &cntW;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11727
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11728
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11729
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11730
    if (__isNonNilObject(readFdArray)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11731
	if (! __isArrayLike(readFdArray)) goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11732
	readCount = __arraySize(readFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11733
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11734
	readCount = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11735
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11736
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11737
    if (__isNonNilObject(writeFdArray)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11738
	if (! __isArrayLike(writeFdArray)) goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11739
	writeCount = __arraySize(writeFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11740
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11741
	writeCount = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11742
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11743
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11744
    if (__isNonNilObject(exceptFdArray)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11745
	if (! __isArrayLike(exceptFdArray)) goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11746
	exceptCount = __arraySize(exceptFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11747
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11748
	exceptCount = 0;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11749
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11750
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11751
pollAgain:
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11752
    FD_ZERO(&readFds);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11753
    FD_ZERO(&writeFds);
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
 11754
    FD_ZERO(&exceptFds);
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11755
    numHandles = hasSockets = hasPipes = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11756
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11757
    for (i = 0; (i < readCount) && (numHandles < MAXHANDLE); i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11758
	OBJ fd = __arrayVal(readFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11759
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11760
	if (fd != nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11761
	    if (__Class(fd) == @global(Win32SocketHandle)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11762
		FD_SET (_HANDLEVal(fd), &readFds);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11763
		hasSockets++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11764
	    } else if (__isSmallInteger(fd)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11765
		DWORD canRead;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11766
		if (PeekNamedPipe(_get_osfhandle(__intVal(fd)), 0, 0, 0, &canRead, 0)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11767
		    if (canRead > 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11768
			if (*pcntR < resultSizeReadable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11769
			    __arrayVal(readableResultFdArray)[*pcntR] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11770
			}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11771
			(*pcntR)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11772
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11773
		} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11774
		    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11775
		    RETURN (__mkSmallInteger(-1));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11776
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11777
		hasPipes++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11778
	    } else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11779
		hArray  [numHandles] = _HANDLEVal(fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11780
		retArray[numHandles] = i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11781
		++numHandles;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11782
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11783
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11784
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11785
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11786
    for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE); i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11787
	OBJ fd = __arrayVal(writeFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11788
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11789
	if (fd != nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11790
	    if (__Class(fd) == @global(Win32SocketHandle)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11791
		FD_SET (_HANDLEVal(fd), &writeFds);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11792
		hasSockets++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11793
	    } else if (__isSmallInteger(fd)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11794
		// kludge: assume that pipes can alway be written
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11795
	       if (*pcntW < resultSizeWritable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11796
		    __arrayVal(writableResultFdArray)[*pcntW] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11797
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11798
		(*pcntW)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11799
		// there is no pipe to check
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11800
	    } else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11801
		hArray  [numHandles] = _HANDLEVal(fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11802
		retArray[numHandles] = i + 10000;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11803
		++numHandles;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11804
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11805
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11806
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11807
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11808
    for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE); i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11809
	OBJ fdOrPid = __arrayVal(exceptFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11810
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11811
	if (fdOrPid != nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11812
	    if (__Class(fdOrPid) == @global(Win32SocketHandle)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11813
		FD_SET (_HANDLEVal(fdOrPid), &exceptFds);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11814
		hasSockets++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11815
	    } else if (__isExternalAddressLike(fdOrPid)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11816
		// a PID
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11817
		hArray  [numHandles] = _HANDLEVal(fdOrPid);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11818
		retArray[numHandles] = i + 20000;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11819
		++numHandles;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11820
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11821
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11822
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11823
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11824
    if (hasSockets) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11825
	struct timeval tv = {0, 0};
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11826
	int nReady;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11827
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11828
#ifdef SELECT3DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11829
	console_printf("select hasSockets = %d\n", hasSockets);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11830
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11831
	nReady = select(1 , &readFds, &writeFds, &exceptFds, &tv);  // first parameter to select is ignored in windows
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11832
	if (nReady < 0) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11833
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11834
	    console_printf("error in select %d %d\n", nReady, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11835
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11836
	    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11837
	    RETURN (__mkSmallInteger(-1));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11838
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11839
	if (nReady > 0) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11840
#ifdef SELECT3DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11841
	    console_printf("select nReady %d of %d\n", nReady, hasSockets);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11842
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11843
	    for (i = 0; i < readCount; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11844
		OBJ fd = __arrayVal(readFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11845
		if ((__Class(fd) == @global(Win32SocketHandle)) && FD_ISSET(_HANDLEVal(fd), &readFds)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11846
		    if (*pcntR < resultSizeReadable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11847
			__arrayVal(readableResultFdArray)[*pcntR] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11848
			__STORE(readableResultFdArray, fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11849
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11850
		    (*pcntR)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11851
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11852
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11853
	    for (i = 0; i < writeCount; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11854
		OBJ fd = __arrayVal(writeFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11855
		if ((__Class(fd) == @global(Win32SocketHandle)) && FD_ISSET(_HANDLEVal(fd), &writeFds)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11856
		    if (*pcntW < resultSizeWritable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11857
			__arrayVal(writableResultFdArray)[*pcntW] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11858
			__STORE(writableResultFdArray, fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11859
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11860
		    (*pcntW)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11861
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11862
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11863
	    for (i = 0; i < exceptCount; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11864
		OBJ fd = __arrayVal(exceptFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11865
		if ((__Class(fd) == @global(Win32SocketHandle)) && FD_ISSET(_HANDLEVal(fd), &exceptFds)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11866
		    if (*pcntE < resultSizeException) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11867
			__arrayVal(exceptionResultFdArray)[*pcntE] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11868
			__STORE(exceptionResultFdArray, fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11869
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11870
		    (*pcntE)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11871
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11872
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11873
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11874
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11875
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11876
    if (pass > 1)       // perform maximum 2 passes
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11877
	goto done;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11878
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11879
    if (cntAll) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11880
	// check for other handles and return immediately, no timeout
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11881
	t = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11882
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11883
	if (__isSmallInteger(millis)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11884
	    t = __intVal(millis);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11885
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11886
	    if (t <= 0 && numHandles == 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11887
		RETURN (__mkSmallInteger(0));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11888
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11889
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11890
	    t = INFINITE;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11891
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11892
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11893
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11894
    if (numHandles == 0 && t == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11895
	// nothing to do and no wait
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11896
	goto done;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11897
    }
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11898
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11899
#ifdef SELECT3DEBUGWIN32
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11900
    console_printf("wait numhandles = %d timeout = %d\n", numHandles, t);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11901
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11902
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11903
    res = __vmWait(numHandles, hArray, MAXHANDLE, t);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11904
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11905
    if (res == WAIT_TIMEOUT) {
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11906
#ifdef SELECT3DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11907
	console_printf("- timeOut; ret nil\n" );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11908
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11909
	if (t != 0 && (hasSockets || hasPipes)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11910
	    // if not a single handle is ready, poll sockets an pipes again
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11911
	    pass = 2;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11912
	    goto pollAgain;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11913
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11914
	goto done;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11915
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11916
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11917
    if (res == WAIT_FAILED) {
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11918
#ifdef SELECT2DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11919
	console_printf("- error %d (last %d); ret -1\n", __threadErrno, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11920
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11921
	if (__threadErrno == EINTR) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11922
	    @global(LastErrorNumber) = nil;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11923
	    RETURN (__mkSmallInteger(0));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11924
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11925
	    if (@global(InfoPrinting) == true) {
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11926
//                console_fprintf(stderr, "Win32OS [info]: select errno = %d (last %d)\n", __threadErrno, GetLastError());
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11927
		console_printf("Win32OS [info]: select errno = %d (last %d)\n", __threadErrno, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11928
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11929
	    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11930
	    RETURN (__mkSmallInteger(-1));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11931
	}
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11932
    }
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11933
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11934
    if (numHandles) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11935
	if (res == numHandles) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11936
	    // vmwait() added an IRQ event to the handles, and this one has been triggered
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11937
	    if (1 /* @global(InfoPrinting) == true */) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11938
		console_fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11939
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11940
	    goto done;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11941
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11942
	if ((res < 0) || (res >= numHandles)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11943
	    console_printf("- res=%d error1 %d\n", res, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11944
	    goto done;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11945
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11946
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11947
	idx = retArray[res];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11948
	cntAll++;
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 11949
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11950
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11951
	console_printf("wait Handles res %d idx %d numHandles %d --- ", res, idx, numHandles);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11952
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11953
	if (idx < 10000) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11954
	    if (*pcntR < resultSizeReadable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11955
		OBJ temp = __arrayVal(readFdArray)[idx];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11956
		__arrayVal(readableResultFdArray)[*pcntR] = temp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11957
		__STORE(readableResultFdArray, temp);
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11958
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11959
		console_printf("read ready: %x\n", __externalAddressVal(temp));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11960
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11961
		(*pcntR)++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11962
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11963
	} else if (idx < 20000) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11964
	    if (*pcntW < resultSizeWritable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11965
		OBJ temp = __arrayVal(writeFdArray)[idx-10000];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11966
		__arrayVal(writableResultFdArray)[*pcntW] = temp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11967
		__STORE(writableResultFdArray, temp);
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 11968
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11969
		console_printf("write ready: %x\n", temp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11970
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11971
		(*pcntW)++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11972
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11973
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11974
	    if (*pcntE < resultSizeException) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11975
		OBJ temp = __arrayVal(exceptFdArray)[idx-20000];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11976
		__arrayVal(exceptionResultFdArray)[*pcntE] = temp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11977
		__STORE(exceptionResultFdArray, temp);
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11978
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11979
		console_printf("except ready: %x\n", temp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11980
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11981
		(*pcntE)++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11982
	    }
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11983
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11984
	    else
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11985
		console_printf("cntE: %d, resultSizeException: %d\n", *pcntE, resultSizeException);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11986
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11987
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11988
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11989
    if (t != 0 && (hasSockets || hasPipes)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11990
	// back after timeout, maybe some sockets or pipes did wake up
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11991
	// in the meantime?
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11992
	pass = 2;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11993
	goto pollAgain;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11994
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11995
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11996
done:
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11997
    /* add a delimiter */
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11998
    if (*pcntR < resultSizeReadable) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11999
	__arrayVal(readableResultFdArray)[*pcntR] = nil;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12000
    }
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12001
    if (*pcntW < resultSizeWritable) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12002
	__arrayVal(writableResultFdArray)[*pcntW] = nil;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12003
    }
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12004
    if (*pcntE < resultSizeException) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12005
	__arrayVal(exceptionResultFdArray)[*pcntE] = nil;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12006
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12007
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12008
    @global(LastErrorNumber) = nil;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12009
    RETURN (__mkSmallInteger(cntAll));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12011
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12012
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12013
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12014
     timeout argument not integer,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12015
     or any fd-array nonNil and not an array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12016
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12017
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12018
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12019
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12021
setBlocking:aBoolean on:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12022
    "set/clear the blocking attribute - if set (which is the default)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12023
     a read on the fileDescriptor will block until data is available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12024
     If cleared, a read operation will immediately return with a value of
15923
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12025
     nil.
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12026
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12027
     Ignored in windows. Windows calls operate in their own thread,
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12028
     so non-blocking mode doesn't make sense."
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12029
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12030
    ^ true
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12031
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12032
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12033
waitForMultipleObjects:fdOrHandleArray withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12034
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12035
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12036
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12037
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12038
     Return the fd if I/O ok, nil if timed-out or interrupted."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12039
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12040
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12041
#ifndef MAXHANDLE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12042
# define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12043
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12044
    INT t;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12045
    int res;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12046
    HANDLE hArray[MAXHANDLE];
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12047
    int idxArray[MAXHANDLE];
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12048
    INT i, count, hIdx;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12049
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
 12050
    if (! __isArrayLike(fdOrHandleArray)) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12051
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12052
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12053
    count = __arraySize(fdOrHandleArray);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12054
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12055
    for (hIdx=0, i=0; i<count; i++) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12056
	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12057
	HANDLE h;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12058
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12059
	if (fdOrHandle != nil) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12060
	    if (__isExternalAddressLike(fdOrHandle)) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12061
		h = _HANDLEVal(fdOrHandle);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12062
	    } else {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12063
		if (__isSmallInteger(fdOrHandle)) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12064
		    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12065
		} else {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12066
		    goto fail;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12067
		}
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12068
	    }
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12069
	    hArray[hIdx] = h;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12070
	    idxArray[hIdx++] = i;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12071
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12072
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12073
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12074
    if (__isSmallInteger(millis)) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12075
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12076
    } else {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12077
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12078
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12079
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12080
#ifdef DO_WRAP_CALLS
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12081
    if (t != 0) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12082
	do {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12083
	    __threadErrno = 0;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12084
	    // do not cast to INT - will loose sign bit then!
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12085
	    res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, hIdx, hArray, FALSE, t);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12086
	} while ((res < 0) && (__threadErrno == EINTR));
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12087
    } else
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12088
#endif
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12089
    {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12090
	res = WaitForMultipleObjects(hIdx, hArray, FALSE, t);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12091
	if (res < 0) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12092
	    __threadErrno = __WIN32_ERR(GetLastError());
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12093
	}
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12094
    }
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12095
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12096
    if (res == WAIT_FAILED) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12097
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12098
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12099
    if (res == WAIT_TIMEOUT) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12100
	RETURN (nil);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12101
    }
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12102
    if ((res >= WAIT_OBJECT_0) && (res < (WAIT_OBJECT_0+hIdx))) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12103
	RETURN (__arrayVal(fdOrHandleArray)[idxArray[res-WAIT_OBJECT_0]]);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12104
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12105
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12106
    RETURN (nil);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12107
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12108
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12109
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12110
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12111
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12112
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12113
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12114
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12115
waitForSingleObject:fdOrHandle withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12116
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12117
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12118
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12119
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12120
     Return the fd if I/O ok, nil if timed-out or interrupted."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12121
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12122
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12123
    INT t;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12124
    int res;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12125
    HANDLE h = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12126
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
 12127
    if (__isExternalAddressLike(fdOrHandle)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12128
	h = _HANDLEVal(fdOrHandle);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12129
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12130
	if (__isSmallInteger(fdOrHandle)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12131
	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12132
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12133
	    goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12134
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12135
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12136
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12137
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12138
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12139
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12140
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12141
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12142
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12143
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 12144
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12145
	__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12146
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12147
	res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h,  t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12148
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12149
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12150
    res = WaitForSingleObject(h, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 12151
    if (res < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12152
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 12153
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12154
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12155
    if (res == WAIT_FAILED) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12156
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12157
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12158
    if (res == WAIT_TIMEOUT) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12159
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12160
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12161
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12162
    RETURN (fdOrHandle);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12163
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12164
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12165
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12166
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12167
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12168
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12169
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12170
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12171
!Win32OperatingSystem::DevModeStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12172
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12173
bitsPerPel
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12174
    ^ self unsignedLongAt: 1+104
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12175
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12176
    "Created: / 27-07-2006 / 15:14:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12177
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12178
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12179
collate
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12180
    ^ self signedInt16At: 1+68 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12181
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12182
    "Created: / 01-08-2006 / 09:56:38 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12183
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12184
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12185
collate: n
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12186
    ^ self signedInt16At: 1+68 put: n MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12187
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12188
    "Created: / 01-08-2006 / 09:58:07 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12189
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12190
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12191
color
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12192
    ^ self signedInt16At: 1+60 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12193
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12194
    "Created: / 27-07-2006 / 15:31:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12195
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12196
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12197
copies
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12198
    ^ self signedInt16At: 1+54 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12199
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12200
    "Created: / 27-07-2006 / 15:30:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12201
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12202
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12203
copies: n
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12204
    ^ self signedInt16At: 1+54 put: n MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12205
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12206
    "Created: / 27-07-2006 / 15:36:39 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12207
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12208
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12209
deviceName
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12210
    ^ self stringAt: 1+0 size: 32
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12211
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12212
    "Created: / 27-07-2006 / 15:15:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12213
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12214
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12215
orientation
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12216
    ^ self signedInt16At: 1+44 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12217
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12218
    "Created: / 27-07-2006 / 15:34:57 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12219
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12220
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12221
orientation: orientationInt
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12222
    ^ self signedInt16At: 1+44 put: orientationInt MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12223
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12224
    "Created: / 27-07-2006 / 15:36:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12225
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12226
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12227
paperLength
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12228
    ^ self signedInt16At: 1+48 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12229
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12230
    "Created: / 27-07-2006 / 15:32:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12231
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12232
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12233
paperSize
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12234
    ^ self signedInt16At: 1+46 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12235
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12236
    "Created: / 27-07-2006 / 15:32:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12237
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12238
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12239
paperSize:funnyMSPaperSizeCode
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12240
    ^ self signedInt16At: 1+46 put: funnyMSPaperSizeCode MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12241
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12242
    "Created: / 27-07-2006 / 15:35:53 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12243
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12244
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12245
paperWidth
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12246
    ^ self signedInt16At: 1+50 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12247
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12248
    "Created: / 27-07-2006 / 15:32:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12249
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12250
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12251
printQuality
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12252
    ^ self signedInt16At: 1+58 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12253
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12254
    "Created: / 27-07-2006 / 15:33:58 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12255
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12256
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12257
printQuality: qualityInteger
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12258
    ^ self signedInt16At: 1+58 put: qualityInteger MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12259
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12260
    "Created: / 27-07-2006 / 15:36:20 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12261
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12262
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12263
scale
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12264
    ^ self signedInt16At: 1+52 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12265
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12266
    "Created: / 27-07-2006 / 15:33:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12267
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12268
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12269
scale: percent
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12270
    ^ self signedInt16At: 1+52 put: percent MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12271
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12272
    "Created: / 27-07-2006 / 15:36:05 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12273
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12274
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12275
!Win32OperatingSystem::DocInfoStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12276
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12277
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12278
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12279
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12280
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12281
    "Created: / 02-08-2006 / 16:21:01 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12282
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12283
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12284
sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12285
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12286
^20
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12287
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12288
    "Created: / 02-08-2006 / 16:21:10 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12289
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12290
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12291
!Win32OperatingSystem::DocInfoStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12292
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12293
cbSize
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12294
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12295
^self longAt: 0+1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12296
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12297
    "Created: / 28-07-2006 / 18:36:02 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12298
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12299
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12300
cbSize: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12301
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12302
self longAt: 0+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12303
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12304
    "Created: / 28-07-2006 / 18:37:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12305
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12306
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12307
fwType
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12308
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12309
^self longAt: 16+1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12310
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12311
    "Created: / 28-07-2006 / 18:37:44 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12312
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12313
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12314
fwType: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12315
"Set a DWORD fwType"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12316
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12317
self longAt: 16+1 put:aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12318
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12319
    "Created: / 28-07-2006 / 18:38:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12320
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12321
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12322
lpszDocName
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12323
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12324
^(ExternalBytes address:(self unsignedLongAt: 4+1)) stringAt:1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12325
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12326
    "Created: / 03-08-2006 / 15:06:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12327
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12328
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12329
lpszDocName: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12330
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12331
^self unsignedLongAt: 4+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12332
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12333
    "Created: / 03-08-2006 / 15:08:32 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12334
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12335
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12336
lpszOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12337
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12338
^(ExternalBytes address:(self unsignedLongAt: 8+1)) stringAt:1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12339
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12340
    "Created: / 03-08-2006 / 15:07:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12341
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12342
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12343
lpszOutput: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12344
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12345
^self unsignedLongAt: 8+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12346
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12347
    "Created: / 03-08-2006 / 15:08:49 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12348
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12349
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12350
!Win32OperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12351
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12352
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT sourcePath:lP fullName:fullName alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12353
    ^ self basicNew
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12354
	type:t mode:m uid:u gid:g size:s
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12355
	id:i accessed:aT modified:mT created:cT
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12356
	sourcePath:lP
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12357
	fullName:fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12358
	alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12359
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12360
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12361
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12362
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12363
accessTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12364
    "return accessed"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12365
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12366
    ^ accessed
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12367
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12368
    "Created: / 1.2.2002 / 11:05:49 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12369
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12370
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12371
alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12372
    "return the files other name (DOS name on windows).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12373
     Nil if there is no other name"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12374
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12375
    |path idx|
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12376
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12377
    path := self alternativePathName.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12378
    path notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12379
	idx := path lastIndexOf:$\ startingAt:path size-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12380
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12381
	    path := path copyFrom:(idx+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12382
	].
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12383
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12384
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12385
    ^ path
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12386
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12387
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12388
	'C:\' asFilename info alternativeName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12389
	'C:\Dokumente und Einstellungen\' asFilename info alternativeName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12390
	'C:\Dokumente und Einstellungen' asFilename info alternativeName
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12391
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12392
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12393
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12394
alternativePathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12395
    "return the files real name (non-DOS name on windows).
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12396
     Nil if there is no other name"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12397
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12398
    "/ access lazily...
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12399
    alternativePathName isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12400
	alternativePathName := (OperatingSystem getShortPathName:sourcePath) asSingleByteString.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12401
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12402
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12403
    ^ alternativePathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12404
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12405
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12406
	'C:\' asFilename info alternativePathName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12407
	'C:\Dokumente und Einstellungen' asFilename info alternativePathName
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12408
    "
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12409
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12410
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12411
creationTime
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12412
    ^ created
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12413
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12414
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12415
fileSize
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12416
    "return size"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12417
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12418
    ^ size
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12419
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12420
    "Created: / 1.2.2002 / 11:06:15 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12421
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12422
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12423
fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12424
    "return the files real name (non-DOS name on windows).
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12425
     Nil if there is no other name"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12426
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12427
    |path idx|
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12428
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12429
    path := self fullPathName.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12430
    path notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12431
	idx := path lastIndexOf:$\ startingAt:path size-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12432
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12433
	    path := path copyFrom:(idx+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12434
	].
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12435
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12436
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12437
    ^ path
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12438
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12439
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12440
	'\' asFilename info fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12441
	'C:\' asFilename info fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12442
	'C:\Dokumente und Einstellungen' asFilename info fullName
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12443
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12444
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12445
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12446
fullPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12447
    "return the files real name (non-DOS name on windows).
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12448
     Nil if there is no other name"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12449
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12450
    "/ access lazily...
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12451
    fullPathName isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12452
	fullPathName := OperatingSystem getLongPathName:sourcePath.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12453
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12454
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12455
    ^ fullPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12456
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12457
    "
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12458
	'C:\' asFilename info fullPathName
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12459
	'C:\Dokumente und Einstellungen' asFilename info fullPathName
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12460
    "
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12461
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12462
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12463
gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12464
    "return gid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12465
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12466
    ^ gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12467
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12468
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12469
id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12470
    "return id"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12471
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12472
    ^ id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12473
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12474
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12475
linkTargetPath
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12476
    "for symbolic links only: return the path where the symbolic link points to"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12477
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12478
    "/ access lazily...
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12479
    linkTargetPath isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12480
	type == #symbolicLink ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12481
	    linkTargetPath := OperatingSystem getLinkTarget:sourcePath.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12482
	]
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12483
    ].
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12484
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12485
    ^ linkTargetPath
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12486
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12487
    "Modified: / 07-02-2007 / 10:31:56 / cg"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12488
!
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12489
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12490
mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12491
    "return mode"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12492
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12493
    ^ mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12494
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12495
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12496
modificationTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12497
    "return modified"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12498
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12499
    ^ modified
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12500
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12501
    "Created: / 1.2.2002 / 11:06:33 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12502
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12503
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12504
numLinks
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12505
    "DOS has no hardLinks - return 1"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12506
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12507
    ^ 1
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12508
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12509
    "Created: / 1.2.2002 / 11:07:04 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12510
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12511
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12512
path
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12513
    "for symbolic links only: return the path where the symbolic link points to.
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12514
     bad named method - left here for backward compatibility"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12515
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12516
    ^ self linkTargetPath.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12517
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12518
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12519
size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12520
    "return size"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12521
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12522
    ^ size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12523
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12524
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12525
sourcePath
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12526
    ^ sourcePath
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12527
!
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12528
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12529
statusChangeTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12530
    "return statusChanged"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12531
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12532
    ^ statusChanged ? modified
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12533
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12534
    "Created: / 1.2.2002 / 11:07:27 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12535
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12536
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12537
type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12538
    "return type"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12539
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12540
    ^ type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12541
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12542
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12543
uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12544
    "return uid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12545
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12546
    ^ uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12547
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12548
10585
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12549
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing-vms'!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12550
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12551
fixedHeaderSize
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12552
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12553
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12554
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12555
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12556
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12557
recordAttributes
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12558
    "return the recordAttributes (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12559
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12560
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12561
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12562
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12563
recordFormat
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12564
    "return the recordFormat (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12565
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12566
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12567
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12568
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12569
recordFormatNumeric
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12570
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12571
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12572
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12573
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12574
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12575
recordSize
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12576
    "return the recordSize (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12577
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12578
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12579
! !
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12580
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12581
!Win32OperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12582
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12583
accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12584
    "return accessed"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12585
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12586
    <resource: #obsolete>
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12587
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12588
    self obsoleteMethodWarning:'use #accessTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12589
    ^ accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12590
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12591
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12592
at:key
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12593
    "backward compatibility access: in previous releases, IdentityDictionaries
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12594
     were used to hold my information. Allow access via key messages.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12595
     This method will vanish - use the proper access protocol."
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12596
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12597
    ^ self perform:key
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12598
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12599
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12600
modified
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12601
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
 12602
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12603
    self obsoleteMethodWarning:'use #modificationTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12604
    ^ modified
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12605
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12606
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12607
statusChanged
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12608
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
 12609
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12610
    self obsoleteMethodWarning:'use #statusChangeTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12611
    ^ statusChanged
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12612
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12613
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12614
!Win32OperatingSystem::FileStatusInfo methodsFor:'private accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12615
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12616
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT sourcePath:lP fullName:name1 alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12617
    type := t.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12618
    mode := m.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12619
    uid := u.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12620
    gid := g.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12621
    size := s.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12622
    id := i.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12623
    accessed := aT.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12624
    modified := mT.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12625
    created := cT.
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12626
    sourcePath := lP.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12627
    fullPathName := name1.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12628
    alternativePathName := name2.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12629
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12630
10585
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12631
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries-access'!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12632
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12633
isGroupExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12634
    ^ mode bitTest:8r10
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12635
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12636
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12637
      'smalltalk.rc' asFilename info isGroupExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12638
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12639
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12640
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12641
isGroupReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12642
    ^ mode bitTest:8r40
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12643
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12644
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12645
      'smalltalk.rc' asFilename info isGroupReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12646
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12647
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12648
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12649
isGroupWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12650
    ^ mode bitTest:8r20
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12651
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12652
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12653
      'smalltalk.rc' asFilename info isGroupWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12654
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12655
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12656
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12657
isOwnerExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12658
    ^ mode bitTest:8r100
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12659
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12660
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12661
      'smalltalk.rc' asFilename info isOwnerExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12662
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12663
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12664
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12665
isOwnerReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12666
    ^ mode bitTest:8r400
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12667
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12668
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12669
      'smalltalk.rc' asFilename info isOwnerReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12670
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12671
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12672
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12673
isOwnerWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12674
    ^ mode bitTest:8r200
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12675
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12676
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12677
      'smalltalk.rc' asFilename info isOwnerWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12678
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12679
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12680
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12681
isWorldExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12682
    ^ mode bitTest:8r1
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12683
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12684
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12685
      'smalltalk.rc' asFilename info isWorldExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12686
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12687
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12688
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12689
isWorldReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12690
    ^ mode bitTest:8r4
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12691
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12692
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12693
      'smalltalk.rc' asFilename info isWorldReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12694
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12695
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12696
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12697
isWorldWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12698
    ^ mode bitTest:8r2
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12699
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12700
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12701
      'smalltalk.rc' asFilename info isWorldWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12702
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12703
! !
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12704
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12705
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries-type'!
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12706
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12707
isBlockSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12708
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12709
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12710
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12711
isCharacterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12712
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12713
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12714
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12715
isDirectory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12716
    ^ type == #directory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12717
!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12718
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12719
isFifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12720
    ^ type == #fifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12721
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12722
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12723
isRegular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12724
    ^ type == #regular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12725
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12726
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12727
isSocket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12728
    ^ type == #socket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12729
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12730
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12731
isSpecialFile
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12732
    ^ (type ~~ #directory
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12733
	and:[type ~~ #remoteDirectory
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12734
	and:[type ~~ #regular
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12735
	and:[type ~~ #symbolicLink
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12736
    ]]])
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12737
!
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12738
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12739
isSymbolicLink
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12740
    ^ type == #symbolicLink
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12741
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12742
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12743
isUnknown
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12744
    ^ type == #unknown
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12745
!
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12746
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12747
isValid
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12748
    "answer true if the fileInfo is valid"
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12749
    ^ type notNil
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12750
! !
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12751
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 12752
!Win32OperatingSystem::OSProcessStatus class methodsFor:'documentation'!
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 12753
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12754
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12755
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12756
    This is an auxillary class, that holds information about status changes of
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12757
    operating system processes (these are no smalltalk processes!!).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12758
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12759
    [Instance variables:]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12760
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12761
	pid     <Integer>       OS-Process identifier
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12762
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12763
	status  <Symbol>        either #exit #signal #stop #continue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12764
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12765
	code    <Integer>       either exitcode or signalnumber
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12766
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12767
	core    <Boolean>       true if core has been dumped
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12768
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12769
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12770
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12771
	Stefan Vogel
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12772
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12773
    [see also:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12774
	OperatingSystem
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12775
"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12776
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12777
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12778
!Win32OperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12779
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12780
pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12781
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12782
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12783
    ^ self new pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12784
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12785
    "Created: 28.12.1995 / 14:16:14 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12786
    "Modified: 30.4.1996 / 18:25:00 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12787
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12788
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12789
processCreationFailure
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12790
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12791
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12792
    ^ self new pid:-1 status:#failure code:-1 core:false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12793
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12794
    "Created: 28.12.1995 / 14:35:29 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12795
    "Modified: 30.4.1996 / 18:25:05 / cg"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12796
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12797
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12798
!Win32OperatingSystem::OSProcessStatus methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12799
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12800
code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12801
    "return the exitcode / signalNumber"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12802
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12803
    ^ code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12804
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12805
    "Created: 28.12.1995 / 14:05:07 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12806
    "Modified: 30.4.1996 / 18:26:23 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12807
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12808
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12809
core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12810
    "return true if core has been dumped, false otherwise"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12811
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12812
    ^ core == true
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12813
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12814
    "Modified: 28.12.1995 / 14:14:38 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12815
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12816
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12817
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12818
    "return the pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12819
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12820
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12821
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12822
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12823
    "Modified: 30.4.1996 / 18:26:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12824
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12825
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12826
status
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12827
    "return status as a Symbol;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12828
     one of #exit #signal #stop #continue"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12829
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12830
    ^ status
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12831
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12832
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12833
    "Modified: 30.4.1996 / 18:26:54 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12834
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12835
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12836
!Win32OperatingSystem::OSProcessStatus methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12837
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12838
pid:newPid status:newStatus code:newCode core:newCore
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12839
    pid := newPid.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12840
    status := newStatus.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12841
    code := newCode.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12842
    core := newCore.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12843
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12844
    "Created: 28.12.1995 / 14:18:22 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12845
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12846
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12847
!Win32OperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12848
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12849
code:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12850
    "set the exitCode"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12851
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12852
    code := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12853
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12854
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12855
    "Modified: 30.4.1996 / 18:25:18 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12856
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12857
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12858
core:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12859
    "set core"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12860
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12861
    core := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12862
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12863
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12864
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12865
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12866
pid:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12867
    "set pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12868
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12869
    pid := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12870
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12871
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12872
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12873
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12874
status:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12875
    "set status"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12876
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12877
    status := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12878
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12879
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12880
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12881
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12882
!Win32OperatingSystem::OSProcessStatus methodsFor:'queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12883
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12884
couldNotExecute
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12885
    "return true when a command could not be executed"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12886
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12887
    ^ status == #exit and:[code = 127].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12888
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12889
    "Created: 28.12.1995 / 15:43:17 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12890
    "Modified: 30.4.1996 / 18:27:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12891
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12892
16411
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12893
isError
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12894
    "true if process terminated with error"
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12895
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12896
    ^ status == #exit and:[code ~= 0]
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12897
!
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12898
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12899
stillAlive
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12900
    "true if process is still alive"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12901
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12902
    ^ status == #stop or:[status == #continue]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12903
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12904
    "Created: 28.12.1995 / 14:27:26 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12905
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12906
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12907
success
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12908
    "true if process terminated successfully"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12909
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12910
    ^ status == #exit and:[code = 0]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12911
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12912
    "Created: 28.12.1995 / 14:13:05 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12913
    "Modified: 28.12.1995 / 14:13:41 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12914
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12915
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12916
!Win32OperatingSystem::PECOFFConstants class methodsFor:'documentation'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12917
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12918
documentation
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12919
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12920
    COFF machine type IDs.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12921
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12922
    [author:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12923
	Jan Vrany
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12924
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12925
    [instance variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12926
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12927
    [class variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12928
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12929
    [see also:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12930
	Microsoft Portable Executable and Common Object File Format Specification,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12931
	section 6. Machine Types
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12932
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12933
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12934
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12935
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12936
!Win32OperatingSystem::PECOFFConstants class methodsFor:'initialization'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12937
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12938
initialize
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12939
    "Invoked at system start or when the class is dynamically loaded."
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12940
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12941
    "/ See Microsoft Portable Executable and Common Object File Format Specification,
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12942
    "/ section 4
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12943
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12944
    PE_Signature_OFFSET_OFFSET := 16r3C.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12945
    PE_Signature := #[80 69 0 0].
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12946
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12947
    "/ See Microsoft Portable Executable and Common Object File Format Specification,
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12948
    "/ section 5
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12949
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12950
    COFF_HEADER_SIZE := 20.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12951
    COFF_HEADER_Machine_OFFSET := 0.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12952
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12953
    "/ See Microsoft Portable Executable and Common Object File Format Specification,
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12954
    "/ section 6
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12955
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12956
    IMAGE_FILE_MACHINE_UNKNOWN := 16r0.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12957
    IMAGE_FILE_MACHINE_AM33 := 16r1D3.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12958
    IMAGE_FILE_MACHINE_AMD64 := 16r8664.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12959
    IMAGE_FILE_MACHINE_ARM := 16r1C0.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12960
    IMAGE_FILE_MACHINE_ARMNT := 16r1C4.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12961
    IMAGE_FILE_MACHINE_ARM64 := 16rAA64.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12962
    IMAGE_FILE_MACHINE_EBC := 16rEBC.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12963
    IMAGE_FILE_MACHINE_I386 := 16r14C.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12964
    IMAGE_FILE_MACHINE_IA64 := 16r200.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12965
    IMAGE_FILE_MACHINE_M32R := 16r9041.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12966
    IMAGE_FILE_MACHINE_MIPS16 := 16r266.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12967
    IMAGE_FILE_MACHINE_MIPSFPU := 16r366.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12968
    IMAGE_FILE_MACHINE_MIPSFPU16 := 16r466.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12969
    IMAGE_FILE_MACHINE_POWERPC := 16r1F0.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12970
    IMAGE_FILE_MACHINE_POWEPCFP := 16r1F1.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12971
    IMAGE_FILE_MACHINE_R4000 := 16r166.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12972
    IMAGE_FILE_MACHINE_SH3 := 16r1A2.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12973
    IMAGE_FILE_MACHINE_SH3DSP := 16r1A3.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12974
    IMAGE_FILE_MACHINE_SH4 := 16r1A6.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12975
    IMAGE_FILE_MACHINE_SH5 := 16r1A8.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12976
    IMAGE_FILE_MACHINE_THUMB := 16r1C2.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12977
    IMAGE_FILE_MACHINE_WCEMIPSV2 := 16r169.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12978
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12979
    "Modified: / 16-03-2015 / 13:34:57 / jv"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12980
    "Modified: / 16-03-2015 / 18:14:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12981
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12982
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12983
!Win32OperatingSystem::PECOFFFileHeader class methodsFor:'documentation'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12984
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12985
documentation
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12986
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12987
    Inteances of COFFFileHeader provides an access to various
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12988
    information about executables / .dlls on Windows
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12989
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12990
    [author:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12991
	Jan Vrany <jan.vrany@fit.cvut.cz>
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12992
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12993
    [instance variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12994
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12995
    [class variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12996
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12997
    [see also:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 12998
	Microsoft Portable Executable and Common Object File Format Specification
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 12999
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13000
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13001
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13002
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13003
!Win32OperatingSystem::PECOFFFileHeader class methodsFor:'instance creation'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13004
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13005
fromFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13006
    "Returns a COFFFileHeader of given file.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13007
     If the given file is not a regular file or
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13008
     of it's not an PE file them an error is thrown."
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13009
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13010
    ^ self new initializeOnFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13011
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13012
    "Created: / 16-03-2015 / 14:33:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13013
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13014
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13015
!Win32OperatingSystem::PECOFFFileHeader methodsFor:'accessing'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13016
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13017
machine
19367
b7eef79ceeb8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19346
diff changeset
 13018
   ^ data unsignedInt16At: COFF_HEADER_Machine_OFFSET + 1 MSB: false
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13019
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13020
    "Created: / 16-03-2015 / 14:29:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13021
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13022
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13023
!Win32OperatingSystem::PECOFFFileHeader methodsFor:'initialization'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13024
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13025
initializeOnFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13026
    file := aStringOrFilename asFilename.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13027
    file exists ifFalse:[
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13028
	self error:'Given file does not exist'.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13029
	^ nil
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13030
    ].
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13031
    file isRegularFile ifFalse:[
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13032
	self error:'Given file is not a regular file'.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13033
	^ nil
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13034
    ].
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13035
    file readingFileDo:[ :s |
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13036
	| sig |
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13037
	s binary.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13038
	s position: PE_Signature_OFFSET_OFFSET.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13039
	s position: (s nextUnsignedLongMSB: false).
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13040
	sig := s next: PE_Signature size.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13041
	sig = PE_Signature ifFalse:[
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13042
	    self error: 'Given file is not a valid PE file (no valid PE signature found)'.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13043
	    ^ nil
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13044
	].
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13045
	data := s next: COFF_HEADER_SIZE
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13046
    ].
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13047
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13048
    "Created: / 16-03-2015 / 14:34:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13049
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13050
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13051
!Win32OperatingSystem::PECOFFFileHeader methodsFor:'queries'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13052
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13053
isFor32BitArchitecture
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13054
    ^ { IMAGE_FILE_MACHINE_I386 . IMAGE_FILE_MACHINE_ARM . IMAGE_FILE_MACHINE_ARMNT } includes: self machine
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13055
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13056
    "Created: / 18-03-2015 / 09:54:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13057
!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13058
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13059
isFor64BitArchitecture
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13060
    ^ { IMAGE_FILE_MACHINE_AMD64 . IMAGE_FILE_MACHINE_IA64 . IMAGE_FILE_MACHINE_ARM64 } includes: self machine
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13061
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13062
    "Created: / 18-03-2015 / 09:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13063
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13064
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13065
!Win32OperatingSystem::PerformanceData class methodsFor:'accessing'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13066
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13067
counterIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13068
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13069
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13070
	self counterIndexTextDictionary
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13071
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13072
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13073
    CounterIndexTextDictionary isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13074
	self synchronized:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13075
	    CounterIndexTextDictionary isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13076
		|performanceText counterIndexTextDictionary|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13077
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13078
		performanceText := self getPerformanceText valueNamed:'Counter'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13079
		counterIndexTextDictionary := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13080
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13081
		1 to:performanceText size by:2 do:[:index|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13082
		    counterIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13083
		].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13084
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13085
		CounterIndexTextDictionary := counterIndexTextDictionary.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13086
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13087
	].
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13088
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13089
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13090
    ^ CounterIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13091
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13092
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13093
helpIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13094
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13095
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13096
	self helpIndexTextDictionary
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13097
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13098
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13099
    HelpIndexTextDictionary isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13100
	self synchronized:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13101
	    HelpIndexTextDictionary isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13102
		|performanceText helpIndexTextDictionary|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13103
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13104
		performanceText := self getPerformanceText valueNamed:'Help'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13105
		helpIndexTextDictionary := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13106
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13107
		1 to:performanceText size by:2 do:[:index|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13108
		    helpIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13109
		].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13110
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13111
		HelpIndexTextDictionary := helpIndexTextDictionary.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13112
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13113
	].
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13114
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13115
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13116
    ^ HelpIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13117
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13118
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13119
!Win32OperatingSystem::PerformanceData class methodsFor:'accessing subclasses'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13120
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13121
diskIO
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13122
    ^ DiskIO current
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13123
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13124
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13125
global
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13126
    ^ Global current
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13127
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13128
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13129
memory
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13130
    ^ Memory current
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13131
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13132
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13133
network
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13134
    ^ Network current
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13135
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13136
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13137
process
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13138
    ^ Process current
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13139
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13140
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13141
processor
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13142
    ^ Processor current
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13143
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13144
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13145
!Win32OperatingSystem::PerformanceData class methodsFor:'documentation'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13146
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13147
documentation
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13148
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13149
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13150
	VISTA:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13151
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 13152
	Wer versucht unter Vista die Registy HKEY_PERFORMANCE_DATA abzufragen wird zunächst enttäuscht.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 13153
	Die UAC UserAccessControl verhindern dies nämlich (selbs für den admin).
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13154
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13155
	Um dies zu umgehen:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13156
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13157
	To turn off UAC
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13158
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13159
	1. Click Start, and then click Control Panel.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13160
	2. In Control Panel, click User Accounts.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13161
	3. In the User Accounts window, click User Accounts.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13162
	4. In the User Accounts tasks window, click Turn User Account Control on or off.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13163
	5. If UAC is currently configured in Admin Approval Mode, the User Account Control message appears. Click Continue.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13164
	6. Clear the Use User Account Control (UAC) to help protect your computer check box, and then click OK.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13165
	7. Click Restart Now to apply the change right away, or click Restart Later and close the User Accounts tasks window.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13166
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13167
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13168
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13169
examples
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13170
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13171
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13172
	######################################### PRIMITIVE
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13173
	self getUsedMemoryInPercentage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13174
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13175
	self getPhysicalMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13176
	self getPhysicalMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13177
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13178
	self getFreePhysicalMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13179
	self getFreePhysicalMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13180
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13181
	self getPageFileSizeInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13182
	self getPageFileSizeInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13183
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13184
	self getFreePageFileSizeInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13185
	self getFreePageFileSizeInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13186
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13187
	self getVirtualMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13188
	self getVirtualMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13189
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13190
	######################################### REGISTRY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13191
	self helpIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13192
	self counterIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13193
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13194
	self global getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13195
	self global getObjectNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13196
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13197
	self processor getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13198
	self processor processorUsage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13199
	self processor processorUsageFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13200
	self processor interruptsPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13201
	self processor interruptsPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13202
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13203
	self process getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13204
	self process processUsage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13205
	self process processUsageFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13206
	self process runningProcesses.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13207
	self process runningProcessNameList.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13208
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13209
	self network getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13210
	self network kBytesReceivedPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13211
	self network kBytesReceivedPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13212
	self network kBytesSentPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13213
	self network kBytesSentPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13214
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13215
	self memory getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13216
	self memory availableMBytes.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13217
	self memory availableKBytes.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13218
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13219
	self diskIO getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13220
	self diskIO diskSpaceFreeInMegaByte.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13221
	self diskIO diskQueueLength.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13222
	self diskIO diskTransfersPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13223
	self diskIO diskTransfersPerSecondFromlast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13224
	self diskIO diskReadsPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13225
	self diskIO diskReadsPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13226
	self diskIO diskWritesPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13227
	self diskIO diskWritesPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13228
	self diskIO diskBytesPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13229
	self diskIO diskBytesPerSecondFromLast.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13230
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13231
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13232
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13233
!Win32OperatingSystem::PerformanceData class methodsFor:'initialization'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13234
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13235
initialize
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13236
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13237
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13238
	self initialize
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13239
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13240
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13241
    PerformanceText := CounterIndexTextDictionary := HelpIndexTextDictionary := nil.
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13242
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13243
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13244
!Win32OperatingSystem::PerformanceData class methodsFor:'private'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13245
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13246
getPerformanceText
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13247
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13248
    PerformanceText isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13249
	PerformanceText := Win32OperatingSystem registryEntry key:'HKEY_PERFORMANCE_TEXT'.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13250
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13251
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13252
    ^ PerformanceText
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13253
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13254
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13255
!Win32OperatingSystem::PerformanceData class methodsFor:'queries - memory'!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13256
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13257
getFreePageFileSizeInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13258
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13259
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13260
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13261
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13262
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13263
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13264
	ret = __mkSmallInteger(mState.dwAvailPageFile / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13265
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13266
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13267
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13268
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13269
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13270
	self getFreePageFileSizeInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13271
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13272
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13273
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13274
getFreePageFileSizeInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13275
    ^ (self getFreePageFileSizeInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13276
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13277
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13278
	self getFreePageFileSizeInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13279
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13280
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13281
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13282
getFreePhysicalMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13283
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13284
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13285
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13286
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13287
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13288
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13289
	ret = __mkSmallInteger(mState.dwAvailPhys / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13290
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13291
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13292
    ^ ret
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 13293
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 13294
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13295
	self getFreePhysicalMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13296
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13297
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13298
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13299
getFreePhysicalMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13300
    ^ (self getFreePhysicalMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13301
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13302
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13303
	self getFreePhysicalMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13304
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13305
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13306
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13307
getPageFileSizeInKB
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13308
    ^ self getPageFileSizeInMB * 1024
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13309
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13310
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13311
	self getPageFileSizeInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13312
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13313
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13314
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13315
getPageFileSizeInMB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13316
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13317
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13318
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13319
	SYSTEM_INFO sInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13320
	GetSystemInfo(&sInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13321
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13322
	ret = __mkSmallInteger(sInfo.dwPageSize);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13323
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13324
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13325
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13326
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13327
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13328
	self getPageFileSizeInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13329
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13330
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13331
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13332
getPhysicalMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13333
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13334
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13335
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13336
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13337
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13338
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13339
	ret = __mkSmallInteger(mState.dwTotalPhys / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13340
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13341
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13342
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13343
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13344
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13345
	self getPhysicalMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13346
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13347
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13348
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13349
getPhysicalMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13350
    ^ (self getPhysicalMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13351
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13352
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13353
	self getPhysicalMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13354
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13355
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13356
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13357
getUsedMemoryInPercentage
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13358
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13359
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13360
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13361
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13362
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13363
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13364
	ret = __mkSmallInteger(mState.dwMemoryLoad);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13365
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13366
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13367
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13368
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13369
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13370
	self getUsedMemoryInPercentage
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13371
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13372
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13373
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13374
getVirtualMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13375
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13376
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13377
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13378
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13379
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13380
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13381
	ret = __mkSmallInteger(mState.dwTotalVirtual / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13382
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13383
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13384
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13385
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13386
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13387
	self getVirtualMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13388
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13389
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13390
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13391
getVirtualMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13392
    ^ (self getVirtualMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13393
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13394
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13395
	self getVirtualMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13396
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13397
! !
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13398
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13399
!Win32OperatingSystem::PerformanceData methodsFor:'accessing'!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13400
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13401
objectArray
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13402
    ^ objectArray
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13403
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13404
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13405
perfFreq
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13406
    ^ perfFreq
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13407
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13408
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13409
perfTime
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13410
    ^ perfTime
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13411
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13412
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13413
perfTime100nSec
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13414
    ^ perfTime100nSec
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13415
! !
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13416
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13417
!Win32OperatingSystem::PerformanceData methodsFor:'setup'!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13418
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13419
fromRawBytes:st_data
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13420
    |
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13421
    getNameBlock getCounterValueBlock
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13422
    st_perfTime st_perfFreq st_perfTime100nSec
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13423
    st_objectArray st_counterArray st_instanceArray
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13424
    st_perObject st_perCounter st_perInstance
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13425
    |
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13426
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13427
%{
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13428
    //declarate counters
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13429
    int objectIterator, counterIterator, instanceIterator, numObjectTypes;
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13430
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13431
    //declarate pointers
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13432
    PERF_DATA_BLOCK *perfData;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13433
    PERF_OBJECT_TYPE *perfObjectPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13434
    PERF_COUNTER_DEFINITION *perfCounterPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13435
    PERF_INSTANCE_DEFINITION *perfInstancePtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13436
    PERF_COUNTER_BLOCK *perfCounterBlockPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13437
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13438
    #define PERF_SIZE_MASK        (PERF_SIZE_DWORD|PERF_SIZE_LARGE|PERF_SIZE_ZERO|PERF_SIZE_VARIABLE_LEN)
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13439
    #define PERF_TYPE_MASK        (PERF_TYPE_NUMBER|PERF_TYPE_COUNTER|PERF_TYPE_TEXT|PERF_TYPE_ZERO)
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13440
    #define PERF_NUMBERTYPE_MASK  (PERF_NUMBER_HEX|PERF_NUMBER_DECIMAL|PERF_NUMBER_DEC_1000)
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13441
#ifdef PERF_COUNTER_PRECISION
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13442
    #define PERF_COUNTERTYPE_MASK (PERF_COUNTER_VALUE|PERF_COUNTER_RATE|PERF_COUNTER_FRACTION|PERF_COUNTER_BASE|PERF_COUNTER_ELAPSED|PERF_COUNTER_QUEUELEN|PERF_COUNTER_HISTOGRAM|PERF_COUNTER_PRECISION)
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13443
#else
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13444
    #define PERF_COUNTERTYPE_MASK (PERF_COUNTER_VALUE|PERF_COUNTER_RATE|PERF_COUNTER_FRACTION|PERF_COUNTER_BASE|PERF_COUNTER_ELAPSED|PERF_COUNTER_QUEUELEN|PERF_COUNTER_HISTOGRAM)
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13445
#endif
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13446
    #define PERF_TEXTTYPE_MASK    (PERF_TEXT_UNICODE|PERF_TEXT_ASCII)
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13447
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13448
    if (!__isByteArray(st_data)) RETURN (nil);
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13449
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13450
    //setup start pointer
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13451
    perfData = (PERF_DATA_BLOCK *)(__ByteArrayInstPtr(st_data)->ba_element);
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13452
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13453
    //get header data
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13454
    st_perfTime = __MKINT64(&(perfData->PerfTime));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13455
    st_perfFreq = __MKINT64(&(perfData->PerfFreq));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13456
    st_perfTime100nSec = __MKINT64(&(perfData->PerfTime100nSec));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13457
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13458
    //setup object array and initialize its pointer
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13459
    numObjectTypes = perfData->NumObjectTypes;
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13460
    st_objectArray = __ARRAY_NEW_INT(numObjectTypes);
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13461
    perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfData + perfData->HeaderLength);
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13462
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13463
    //iterate all following objetcs
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13464
    for (objectIterator=0; objectIterator<numObjectTypes; objectIterator++) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13465
	//add the st_perObject dictionary to st_objectArray
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13466
	st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13467
	__AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13468
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13469
	//get the object data
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13470
	__AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13471
	__AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13472
	__AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13473
	__AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13474
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13475
	//setup counter array and initialize its pointer
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13476
	st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13477
	perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13478
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13479
	//add the st_counterArray to st_perObject dictionary
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13480
	__AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13481
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13482
	//iterate all following counter definition
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13483
	for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13484
	    //add the st_perCounter dictionary to st_counterArray
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13485
	    st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13486
	    __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13487
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13488
	    //get the counter data
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13489
	    __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13490
	    __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13491
	    __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13492
	    __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13493
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13494
	    //put the counter type size
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13495
	    switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13496
		case PERF_SIZE_DWORD:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13497
		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13498
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13499
		case PERF_SIZE_LARGE:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13500
		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13501
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13502
		case PERF_SIZE_ZERO:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13503
		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13504
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13505
		case PERF_SIZE_VARIABLE_LEN:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13506
		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13507
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13508
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13509
	    switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13510
		case PERF_TYPE_NUMBER:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13511
		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13512
		    switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13513
			case PERF_NUMBER_HEX:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13514
			    __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13515
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13516
			case PERF_NUMBER_DECIMAL:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13517
			    __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13518
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13519
			case PERF_NUMBER_DEC_1000:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13520
			    __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13521
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13522
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13523
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13524
		case PERF_TYPE_COUNTER:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13525
		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13526
		    switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13527
			case PERF_COUNTER_VALUE:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13528
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13529
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13530
			case PERF_COUNTER_RATE:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13531
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13532
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13533
			case PERF_COUNTER_FRACTION:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13534
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13535
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13536
			case PERF_COUNTER_BASE:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13537
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13538
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13539
			case PERF_COUNTER_ELAPSED:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13540
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13541
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13542
			case PERF_COUNTER_QUEUELEN:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13543
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13544
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13545
			case PERF_COUNTER_HISTOGRAM:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13546
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13547
			    break;
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13548
#ifdef PERF_COUNTER_PRECISION
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13549
			case PERF_COUNTER_PRECISION:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13550
			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13551
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13552
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13553
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13554
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13555
		case PERF_TYPE_TEXT:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13556
		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13557
		    switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13558
			case PERF_TEXT_UNICODE:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13559
			    __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13560
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13561
			case PERF_TEXT_ASCII:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13562
			    __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13563
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13564
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13565
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13566
		case PERF_TYPE_ZERO:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13567
		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13568
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13569
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13570
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13571
	    //setup the counter pointer to the next counter definition
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13572
	    perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13573
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13574
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13575
	//goon dependent on the count of instances
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13576
	if (perfObjectPtr->NumInstances < 1) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13577
	    perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13578
	    __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13579
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13580
	    //setup the instance pointer to the end of all counters
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13581
	    perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13582
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13583
	    //setup st_instanceArray and add it to st_perObject
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13584
	    st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13585
	    __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13586
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13587
	    //iterate the instances
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13588
	    for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13589
		//setup st_perInstance and add it to st_instanceArray
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13590
		st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13591
		__AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13592
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13593
		//get the instance data
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13594
		__AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13595
		__AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13596
		__AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13597
		__AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13598
		__AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13599
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13600
		//setup the instance pointer to the its end
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13601
		perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13602
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13603
		//setup the counter block pointer
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13604
		perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13605
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13606
		//get the instance raw data
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13607
		__AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13608
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13609
		//setup the instance pointer to the next instance
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13610
		perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13611
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13612
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13613
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13614
	//setup the object pointer to the next object
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13615
	perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13616
    }
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13617
%}.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13618
    objectArray := st_objectArray.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13619
    perfTime := st_perfTime.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13620
    perfFreq := st_perfFreq.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13621
    perfTime100nSec := st_perfTime100nSec.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13622
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13623
    getNameBlock := [:i|
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13624
	self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13625
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13626
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13627
    getCounterValueBlock := [:counter :rawData|
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13628
	|offset counterValue|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13629
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13630
	offset := counter at:#CounterOffset.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13631
	offset >= rawData size ifTrue:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13632
	    counterValue := nil.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13633
	] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13634
	    (counter at:#SIZE) == #LARGE ifTrue:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13635
		counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13636
	    ] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13637
		(counter at:#SIZE) == #DWORD ifTrue:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13638
		    counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13639
		] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13640
		    self halt:'unhandled counter-size; please check'.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13641
		].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13642
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13643
	].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13644
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13645
	counterValue
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13646
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13647
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13648
    objectArray do:[:anObject|
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13649
	"setup the object name"
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13650
	anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13651
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13652
	"setup the name and a counter value array to each counter"
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13653
	(anObject at:#Counters) do:[:aCounter|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13654
	    aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13655
	    aCounter at:#CounterValueArray put:OrderedCollection new.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13656
	].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13657
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13658
	(anObject at:#NumInstances) < 1 ifTrue:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13659
	    |rawData|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13660
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13661
	    rawData := anObject at:#RawData.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13662
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13663
	    (anObject at:#Counters) do:[:aCounter|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13664
		(aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13665
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13666
	] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13667
	    (anObject at:#Instances) do:[:anInstance|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13668
		|rawData|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13669
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13670
		rawData := anInstance at:#RawData.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13671
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13672
		anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyButLast:1).
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13673
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13674
		(anObject at:#Counters) do:[:aCounter|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13675
		    (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13676
		].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13677
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13678
	].
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13679
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13680
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13681
    ^ self
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13682
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13683
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13684
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'accessing'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13685
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13686
cachedResults
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13687
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13688
    cachedResults isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13689
	cachedResults := IdentityDictionary new.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13690
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13691
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13692
    ^ cachedResults
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13693
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13694
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13695
lastData
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13696
    ^ lastData
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13697
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13698
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13699
lastData:something
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13700
    lastData := something.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13701
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13702
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13703
lastTimestamp
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13704
    ^ lastTimestamp
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13705
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13706
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13707
lastTimestamp:something
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13708
    lastTimestamp := something.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13709
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13710
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13711
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13712
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13713
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13714
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13715
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13716
	returns the time a data stays alive, in milliseconds
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13717
	before we push a new call and overwrite the data
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13718
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13719
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13720
    ^ self subclassResponsibility
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13721
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13722
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13723
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13724
    ^ self subclassResponsibility
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13725
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13726
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13727
indexedNameNumbered
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13728
    ^ self indexedName asInteger
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13729
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13730
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13731
timedQueryMilliseconds
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13732
    ^ 100
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13733
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13734
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13735
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'private'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13736
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13737
data
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13738
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13739
    self synchronized:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13740
	|lastTS|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13741
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13742
	lastTS := self lastTimestamp.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13743
	lastTS isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13744
	    ^ self dataBasic
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13745
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13746
	    Timestamp now asMilliseconds - lastTS >= self aliveTime ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13747
		^ self dataBasic
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13748
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13749
		^ self lastData
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13750
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13751
	].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13752
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13753
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13754
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13755
dataBasic
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13756
    |regEntry|
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13757
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13758
    regEntry := (Win32OperatingSystem registryEntry key:'HKEY_PERFORMANCE_DATA') valueNamed:self indexedName asString.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 13759
    self assert:(regEntry notNil).
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13760
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13761
    self lastTimestamp:Timestamp now asMilliseconds.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13762
    self lastData:(Win32OperatingSystem::PerformanceData new fromRawBytes:regEntry).
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13763
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13764
    ^ self lastData
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13765
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13766
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13767
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13768
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13769
getCounterNameIndexArray
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13770
    |data object debugBlock|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13771
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13772
    data := self data.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13773
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13774
    self indexedNameNumbered == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13775
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13776
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13777
	object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == self indexedNameNumbered] ifNone:[self error:'counter not found'].
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13778
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13779
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13780
    ^ (object at:#Counters) collect:[:el|Array with:(el at:#CounterNameTitle) with:(el at:#CounterNameTitleIndex)].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13781
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13782
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13783
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - timed'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13784
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13785
getPerSecondFromLast:aSelector
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13786
    |cachedResult return|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13787
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13788
    cachedResult := self cachedResults at:aSelector ifAbsent:nil.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13789
    cachedResult notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13790
	|currentResult|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13791
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13792
	currentResult := self perform:aSelector.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13793
	return := self getPerSecondViaResult1:cachedResult result2:currentResult.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13794
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13795
	self cachedResults at:aSelector put:currentResult.
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13796
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13797
	self cachedResults at:aSelector put:(self perform:aSelector).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13798
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13799
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13800
    ^ return
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13801
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13802
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13803
getPerSecondViaPerformBlock:performBlock
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13804
    |result1 result2 runTimeInNS runTimeInS values1 values2 globalResult|
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13805
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13806
    self assert:(self aliveTime < self timedQueryMilliseconds).
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13807
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13808
    result1 := performBlock value.
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13809
    Delay waitForMilliseconds:self timedQueryMilliseconds.
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13810
    result2 := performBlock value.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13811
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13812
    runTimeInNS := ((result2 at:#time100nSec) - (result1 at:#time100nSec)) * 100.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13813
    runTimeInS := runTimeInNS / 1000 / 1000 / 1000.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13814
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13815
    values1 := result1 at:#values.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13816
    values2 := result2 at:#values.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13817
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13818
    globalResult := Dictionary new.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13819
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13820
    values2 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13821
	|difference|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13822
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13823
	difference := (values2 at:key) - (values1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13824
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13825
	runTimeInS = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13826
	    globalResult at:key put:0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13827
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13828
	    globalResult at:key put:(difference / runTimeInS) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13829
	].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13830
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13831
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13832
    ^ globalResult
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13833
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13834
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13835
getPerSecondViaResult1:result1 result2:result2
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13836
    |runTimeInNS runTimeInS values1 values2 globalResult|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13837
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13838
    runTimeInNS := ((result2 at:#time100nSec) - (result1 at:#time100nSec)) * 100.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13839
    runTimeInS := runTimeInNS / 1000 / 1000 / 1000.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13840
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13841
    values1 := result1 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13842
    values2 := result2 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13843
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13844
    globalResult := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13845
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13846
    values2 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13847
	|difference|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13848
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13849
	difference := (values2 at:key) - (values1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13850
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13851
	runTimeInS = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13852
	    globalResult at:key put:0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13853
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13854
	    globalResult at:key put:(difference / runTimeInS) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13855
	].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13856
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13857
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13858
    ^ globalResult
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13859
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13860
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13861
getUsageFromLast:aSelector
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13862
    |cachedResult return|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13863
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13864
    cachedResult := self cachedResults at:aSelector ifAbsent:nil.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13865
    cachedResult notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13866
	|currentResult|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13867
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13868
	currentResult := self perform:aSelector.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13869
	return := self getUsageViaResult1:cachedResult result2:currentResult.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13870
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13871
	self cachedResults at:aSelector put:currentResult.
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13872
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13873
	self cachedResults at:aSelector put:(self perform:aSelector).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13874
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13875
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13876
    ^ return
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13877
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13878
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13879
getUsageViaPerformBlock:performBlock
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13880
    |result1 result2 deltaTIn100Ns value1 value2 globalResult|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13881
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13882
    self assert:(self aliveTime < self timedQueryMilliseconds).
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13883
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13884
    result1 := performBlock value.
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13885
    Delay waitForMilliseconds:self timedQueryMilliseconds.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13886
    result2 := performBlock value.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13887
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13888
    globalResult := Dictionary new.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13889
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13890
    deltaTIn100Ns := (result2 at:#time100nSec) - (result1 at:#time100nSec).
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13891
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13892
    value1 := result1 at:#values.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13893
    value2 := result2 at:#values.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13894
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13895
    value1 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13896
	|diff dPerSecond load1024 res|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13897
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13898
	diff := (value2 at:key) - (value1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13899
	diff := diff bitShift:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13900
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13901
	deltaTIn100Ns = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13902
	    dPerSecond := 0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13903
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13904
	    dPerSecond := (diff / deltaTIn100Ns) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13905
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13906
	load1024 := 1024 - dPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13907
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13908
	res := (load1024 / 1024 * 100) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13909
	res < 0 ifTrue:[res := 0].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13910
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13911
	globalResult at:key put:res.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13912
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13913
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13914
    ^ globalResult
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13915
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13916
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13917
getUsageViaResult1:result1 result2:result2
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13918
    |deltaTIn100Ns value1 value2 globalResult|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13919
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13920
    globalResult := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13921
    deltaTIn100Ns := (result2 at:#time100nSec) - (result1 at:#time100nSec).
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13922
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13923
    value1 := result1 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13924
    value2 := result2 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13925
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13926
    value1 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13927
	|diff dPerSecond load1024 res|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13928
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13929
	diff := (value2 at:key) - (value1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13930
	diff := diff bitShift:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13931
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13932
	deltaTIn100Ns = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13933
	    dPerSecond := 0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13934
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13935
	    dPerSecond := (diff / deltaTIn100Ns) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13936
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13937
	load1024 := 1024 - dPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13938
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13939
	res := (load1024 / 1024 * 100) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13940
	res < 0 ifTrue:[res := 0].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13941
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13942
	globalResult at:key put:res.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13943
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13944
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13945
    ^ globalResult
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13946
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13947
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13948
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - values'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13949
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13950
getBasicValuesByCounter:counterIndex
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13951
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:false
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13952
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13953
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13954
getBasicValuesByCounter:counterIndex timed:aBoolean
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13955
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:aBoolean
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13956
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13957
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13958
getBasicValuesByObject:objectIndex counter:counterIndex
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13959
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:false
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13960
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13961
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13962
getBasicValuesByObject:objectIndex counter:counterIndex timed:aBoolean
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13963
    |data object counter values debugBlock numInstances|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13964
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13965
    debugBlock := [:obj|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13966
	^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13967
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13968
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13969
    data := self dataBasic.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13970
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13971
    objectIndex == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13972
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13973
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13974
	object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == objectIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13975
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13976
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13977
    counter := (object at:#Counters) detect:[:aCounter|(aCounter at:#CounterNameTitleIndex) == counterIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13978
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13979
    values := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13980
    numInstances := object at:#NumInstances.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13981
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13982
    numInstances > 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13983
	1 to:numInstances do:[:idx|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13984
	    |value instanceName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13985
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13986
	    value := (counter at:#CounterValueArray) at:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13987
	    instanceName := ((object at:#Instances) at:idx) at:#Name.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13988
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13989
	    values at:instanceName put:value.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13990
	].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13991
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13992
	values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13993
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13994
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13995
    aBoolean ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13996
	|return|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13997
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13998
	return := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13999
	return at:#time put:data perfTime.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14000
	return at:#frequence put:data perfFreq.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14001
	return at:#time100nSec put:data perfTime100nSec.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14002
	return at:#values put:values.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14003
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14004
	^ return
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14005
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14006
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14007
    ^ values
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14008
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14009
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14010
getValuesByCounter:counterIndex
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14011
    ^ self getValuesByObject:0 counter:counterIndex timed:false
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14012
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14013
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14014
getValuesByCounter:counterIndex timed:aBoolean
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14015
    ^ self getValuesByObject:0 counter:counterIndex timed:aBoolean
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14016
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14017
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14018
getValuesByObject:objectIndex counter:counterIndex
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14019
    ^ self getValuesByObject:0 counter:counterIndex timed:false
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14020
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14021
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14022
getValuesByObject:objectIndex counter:counterIndex timed:aBoolean
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14023
    |data object counter values debugBlock numInstances|
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14024
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14025
    debugBlock := [:obj|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14026
	^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14027
    ].
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14028
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14029
    data := self data.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14030
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14031
    objectIndex == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14032
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14033
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14034
	object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == objectIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14035
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14036
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14037
    counter := (object at:#Counters) detect:[:aCounter|(aCounter at:#CounterNameTitleIndex) == counterIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14038
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14039
    values := Dictionary new.
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14040
    numInstances := object at:#NumInstances.
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14041
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14042
    numInstances > 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14043
	1 to:numInstances do:[:idx|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14044
	    |value instanceName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14045
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14046
	    value := (counter at:#CounterValueArray) at:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14047
	    instanceName := ((object at:#Instances) at:idx) at:#Name.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14048
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14049
	    values at:instanceName put:value.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14050
	].
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14051
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14052
	values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14053
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14054
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14055
    aBoolean ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14056
	|return|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14057
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14058
	return := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14059
	return at:#time put:data perfTime.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14060
	return at:#frequence put:data perfFreq.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14061
	return at:#time100nSec put:data perfTime100nSec.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14062
	return at:#values put:values.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14063
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14064
	^ return
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14065
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14066
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14067
    ^ values
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14068
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14069
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14070
!Win32OperatingSystem::PerformanceData::DiskIO class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14071
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14072
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14073
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14074
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14075
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14076
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14077
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14078
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14079
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14080
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14081
!Win32OperatingSystem::PerformanceData::DiskIO methodsFor:'definition'!
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14082
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14083
aliveTime
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14084
    ^ 80
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14085
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14086
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14087
indexedName
10704
5063fe06352c *** empty log message ***
sr
parents: 10702
diff changeset
 14088
    ^ '236'
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14089
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14090
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14091
!Win32OperatingSystem::PerformanceData::DiskIO methodsFor:'queries'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14092
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14093
diskBytes
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14094
    ^ self getValuesByCounter:218 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14095
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14096
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14097
	self current diskBytes
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14098
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14099
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14100
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14101
diskBytesBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14102
    ^ self getBasicValuesByCounter:218 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14103
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14104
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14105
	self current diskBytesBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14106
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14107
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14108
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14109
diskBytesPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14110
    ^ self getPerSecondViaPerformBlock:[self diskBytes]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14111
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14112
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14113
	self current diskBytesPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14114
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14115
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14116
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14117
diskBytesPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14118
    ^ self getPerSecondFromLast:#diskBytesBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14119
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14120
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14121
	self current diskBytesPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14122
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14123
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14124
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14125
diskQueueLength
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14126
    ^ self getValuesByCounter:198
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14127
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14128
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14129
	self current diskQueueLength
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14130
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14131
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14132
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14133
diskRead
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14134
    ^ self getValuesByCounter:214 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14135
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14136
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14137
	self current diskRead
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14138
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14139
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14140
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14141
diskReadBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14142
    ^ self getBasicValuesByCounter:214 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14143
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14144
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14145
	self current diskReadBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14146
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14147
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14148
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14149
diskReadsPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14150
    ^ self getPerSecondViaPerformBlock:[self diskRead]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14151
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14152
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14153
	self current diskReadsPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14154
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14155
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14156
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14157
diskReadsPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14158
    ^ self getPerSecondFromLast:#diskReadBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14159
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14160
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14161
	self current diskReadsPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14162
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14163
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14164
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14165
diskSpaceFreeInMegaByte
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14166
    ^ self getValuesByCounter:408
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14167
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14168
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14169
	self current diskSpaceFreeInMegaByte
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14170
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14171
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14172
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14173
diskTransfers
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14174
    ^ self getValuesByCounter:212 timed:true
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14175
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14176
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14177
	self current diskTransfers
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14178
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14179
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14180
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14181
diskTransfersBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14182
    ^ self getBasicValuesByCounter:212 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14183
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14184
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14185
	self current diskTransfersBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14186
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14187
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14188
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14189
diskTransfersPerSecond
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 14190
    ^ self getPerSecondViaPerformBlock:[self diskTransfers]
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14191
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14192
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14193
	self current diskTransfersPerSecond
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14194
    "
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14195
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14196
10757
a5e2e0f500df *** empty log message ***
sr
parents: 10756
diff changeset
 14197
diskTransfersPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14198
    ^ self getPerSecondFromLast:#diskTransfersBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14199
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14200
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14201
	self current diskTransfersPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14202
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14203
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14204
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14205
diskWrite
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14206
    ^ self getValuesByCounter:216 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14207
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14208
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14209
	self current diskWrite
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14210
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14211
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14212
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14213
diskWriteBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14214
    ^ self getBasicValuesByCounter:216 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14215
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14216
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14217
	self current diskWriteBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14218
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14219
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14220
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14221
diskWritesPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14222
    ^ self getPerSecondViaPerformBlock:[self diskWrite]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14223
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14224
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14225
	self current diskWritesPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14226
    "
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14227
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14228
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14229
diskWritesPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14230
    ^ self getPerSecondFromLast:#diskWriteBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14231
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14232
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14233
	self current diskWritesPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14234
    "
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14235
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14236
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14237
!Win32OperatingSystem::PerformanceData::Global class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14238
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14239
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14240
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14241
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14242
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14243
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14244
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14245
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14246
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14247
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14248
!Win32OperatingSystem::PerformanceData::Global methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14249
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14250
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14251
    ^ 200
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14252
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14253
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14254
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14255
    ^ 'Global'
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14256
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14257
10706
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14258
!Win32OperatingSystem::PerformanceData::Global methodsFor:'queries'!
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14259
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14260
getCounterNameIndexArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14261
    self error:'Global implements objects only'.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14262
!
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14263
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14264
getObjectNameIndexArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14265
    |data indexNameArray|
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14266
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14267
    data := self data.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14268
    indexNameArray := OrderedCollection new.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14269
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14270
    data objectArray do:[:anObject|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14271
	|index name|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14272
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14273
	index := anObject at:#ObjectNameTitleIndex.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14274
	name := Win32OperatingSystem::PerformanceData counterIndexTextDictionary at:index.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14275
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14276
	indexNameArray add:(Array with:name with:index).
10706
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14277
    ].
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14278
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14279
    ^ indexNameArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14280
! !
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14281
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14282
!Win32OperatingSystem::PerformanceData::Memory class methodsFor:'accessing'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14283
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14284
current
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14285
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14286
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14287
	TheOneAndOnlyInstance := self new.
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14288
    ].
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14289
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14290
    ^ TheOneAndOnlyInstance
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14291
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14292
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14293
!Win32OperatingSystem::PerformanceData::Memory methodsFor:'definitions'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14294
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14295
aliveTime
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14296
    ^ 80
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14297
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14298
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14299
indexedName
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14300
    ^ '4'
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14301
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14302
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14303
!Win32OperatingSystem::PerformanceData::Memory methodsFor:'queries'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14304
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14305
availableKBytes
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14306
    ^ self getValuesByCounter:1380
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14307
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14308
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14309
	self current availableKBytes
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14310
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14311
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14312
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14313
availableMBytes
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14314
    ^ self getValuesByCounter:1382
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14315
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14316
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14317
	self current availableMBytes
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14318
    "
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14319
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14320
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14321
!Win32OperatingSystem::PerformanceData::Network class methodsFor:'accessing'!
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14322
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14323
current
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14324
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14325
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14326
	TheOneAndOnlyInstance := self new.
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14327
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14328
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14329
    ^ TheOneAndOnlyInstance
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14330
! !
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14331
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14332
!Win32OperatingSystem::PerformanceData::Network methodsFor:'definition'!
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14333
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14334
aliveTime
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14335
    ^ 80
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14336
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14337
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14338
indexedName
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14339
    ^ '510'
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14340
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14341
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14342
timedQueryMilliseconds
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14343
    ^ 200
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14344
! !
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14345
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14346
!Win32OperatingSystem::PerformanceData::Network methodsFor:'queries'!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14347
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14348
bytesReceived
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14349
    ^ self getValuesByCounter:264 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14350
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14351
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14352
	self current bytesReceived
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14353
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14354
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14355
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14356
bytesReceivedBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14357
    ^ self getBasicValuesByCounter:264 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14358
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14359
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14360
	self current bytesReceivedBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14361
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14362
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14363
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14364
bytesReceivedPerSecond
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14365
    ^ self getPerSecondViaPerformBlock:[self bytesReceived]
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14366
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14367
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14368
	self current bytesReceivedPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14369
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14370
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14371
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14372
bytesReceivedPerSecondFromlast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14373
    ^ self getPerSecondFromLast:#bytesReceivedBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14374
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14375
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14376
	self current bytesReceivedPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14377
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14378
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14379
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14380
bytesSent
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14381
    ^ self getValuesByCounter:506 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14382
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14383
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14384
	self current bytesSent
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14385
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14386
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14387
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14388
bytesSentBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14389
    ^ self getBasicValuesByCounter:506 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14390
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14391
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14392
	self current bytesSentBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14393
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14394
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14395
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14396
bytesSentPerSecond
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14397
    ^ self getPerSecondViaPerformBlock:[self bytesSent]
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14398
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14399
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14400
	self current bytesSentPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14401
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14402
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14403
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14404
bytesSentPerSecondFromlast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14405
    ^ self getPerSecondFromLast:#bytesSentBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14406
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14407
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14408
	self current bytesSentPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14409
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14410
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14411
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14412
kBytesReceivedPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14413
    |modifiedDictionary|
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14414
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14415
    modifiedDictionary := Dictionary new.
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14416
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14417
    (self getPerSecondViaPerformBlock:[self bytesReceived]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14418
	modifiedDictionary at:key put:(value / 1024).
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14419
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14420
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14421
    ^ modifiedDictionary
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14422
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14423
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14424
	self current kBytesReceivedPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14425
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14426
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14427
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14428
kBytesReceivedPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14429
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14430
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14431
    return := self bytesReceivedPerSecondFromlast.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14432
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14433
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14434
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14435
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14436
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14437
	modifiedDictionary at:key put:(value / 1024).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14438
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14439
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14440
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14441
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14442
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14443
	self current kBytesReceivedPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14444
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14445
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14446
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14447
kBytesSentPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14448
    |modifiedDictionary|
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14449
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14450
    modifiedDictionary := Dictionary new.
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14451
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14452
    (self getPerSecondViaPerformBlock:[self bytesSent]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14453
	modifiedDictionary at:key put:(value / 1024).
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14454
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14455
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14456
    ^ modifiedDictionary
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14457
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14458
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14459
	self current kBytesSentPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14460
    "
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14461
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14462
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14463
kBytesSentPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14464
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14465
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14466
    return := self bytesSentPerSecondFromlast.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14467
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14468
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14469
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14470
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14471
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14472
	modifiedDictionary at:key put:(value / 1024).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14473
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14474
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14475
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14476
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14477
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14478
	self current kBytesSentPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14479
    "
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14480
! !
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14481
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14482
!Win32OperatingSystem::PerformanceData::Process class methodsFor:'accessing'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14483
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14484
current
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14485
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14486
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14487
	TheOneAndOnlyInstance := self new.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14488
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14489
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14490
    ^ TheOneAndOnlyInstance
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14491
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14492
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14493
!Win32OperatingSystem::PerformanceData::Process methodsFor:'definition'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14494
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14495
aliveTime
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14496
    ^ 80
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14497
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14498
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14499
indexedName
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14500
    ^ '230'
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14501
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14502
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14503
!Win32OperatingSystem::PerformanceData::Process methodsFor:'queries'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14504
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14505
processTime
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14506
    ^ self getValuesByCounter:6 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14507
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14508
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14509
	self current processTime
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14510
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14511
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14512
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14513
processTimeBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14514
    ^ self getBasicValuesByCounter:6 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14515
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14516
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14517
	self current processTimeBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14518
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14519
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14520
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14521
processUsage
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14522
    |modifiedDictionary|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14523
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14524
    modifiedDictionary := Dictionary new.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14525
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14526
    (self getUsageViaPerformBlock:[self processTime]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14527
	modifiedDictionary at:key put:(100 - value).
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14528
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14529
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14530
    ^ modifiedDictionary
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14531
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14532
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14533
	self current processUsage
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14534
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14535
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14536
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14537
processUsageFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14538
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14539
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14540
    return := self getUsageFromLast:#processTimeBasic.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14541
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14542
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14543
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14544
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14545
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14546
	modifiedDictionary at:key put:(100 - value).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14547
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14548
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14549
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14550
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14551
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14552
	self current processUsageFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14553
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14554
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14555
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14556
runningProcessNameList
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14557
    "_Total ~ pseudo process; Idle ~ pseudo process represents the free resources"
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14558
    ^ (self data objectArray first at:#Instances) collect:[:el|el at:#Name]
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14559
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14560
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14561
	self current runningProcessNameList
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14562
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14563
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14564
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14565
runningProcesses
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14566
    "_Total ~ pseudo process; Idle ~ pseudo process represents the free resources"
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14567
    ^ (self data objectArray first at:#NumInstances)
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14568
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14569
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14570
	self current runningProcesses
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14571
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14572
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14573
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14574
!Win32OperatingSystem::PerformanceData::Processor class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14575
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14576
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14577
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14578
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14579
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14580
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14581
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14582
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14583
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14584
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14585
!Win32OperatingSystem::PerformanceData::Processor methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14586
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14587
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14588
    ^ 80
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14589
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14590
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14591
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14592
    ^ '238'
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14593
! !
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14594
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14595
!Win32OperatingSystem::PerformanceData::Processor methodsFor:'queries'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14596
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14597
interrupts
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14598
    ^ self getValuesByCounter:148 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14599
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14600
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14601
	self current interrupts
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14602
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14603
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14604
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14605
interruptsBasic
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14606
    ^ self getBasicValuesByCounter:148 timed:true
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14607
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14608
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14609
	self current interruptsBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14610
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14611
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14612
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14613
interruptsPerSecond
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 14614
    ^ self getPerSecondViaPerformBlock:[self interrupts]
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14615
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14616
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14617
	self current interruptsPerSecond
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14618
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14619
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14620
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14621
interruptsPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14622
    ^ self getPerSecondFromLast:#interruptsBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14623
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14624
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14625
	self current interruptsPerSecondFromLast
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14626
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14627
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14628
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14629
processorTime
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14630
    ^ self getValuesByCounter:6 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14631
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14632
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14633
	self current processorTime
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14634
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14635
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14636
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14637
processorTimeBasic
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14638
    ^ self getBasicValuesByCounter:6 timed:true
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14639
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14640
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14641
	self current processorTimeBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14642
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14643
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14644
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14645
processorUsage
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14646
    ^ self getUsageViaPerformBlock:[self processorTime]
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14647
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14648
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14649
	self current processorUsage
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14650
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14651
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14652
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14653
processorUsageFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14654
    ^ self getUsageFromLast:#processorTimeBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14655
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14656
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14657
	self current processorUsageFromLast
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14658
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14659
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14660
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14661
!Win32OperatingSystem::PrinterInfo2Structure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14662
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14663
defaultPriority
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14664
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14665
    |defaultPriority|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14666
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14667
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14668
	Transcript showCR: 'PrinterInfo2 error getting defaultPriority - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14669
	defaultPriority := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14670
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14671
	defaultPriority := self unsignedLongAt:(60 + 1)
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14672
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14673
    ^ defaultPriority
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14674
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14675
    "Created: / 01-08-2006 / 12:46:50 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14676
    "Modified: / 16-04-2007 / 13:08:33 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14677
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14678
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14679
pComment
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14680
    |pComment|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14681
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14682
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14683
	Transcript showCR: 'PrinterInfo2 error getting pComment - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14684
	pComment := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14685
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14686
	pComment := self unsignedLongAt:(20 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14687
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14688
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
 14689
    ^ pComment == 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14690
	ifTrue:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14691
	ifFalse:[ (ExternalBytes address:pComment) stringAt:1 ]
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14692
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14693
    "Created: / 01-08-2006 / 14:02:55 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14694
    "Modified: / 16-04-2007 / 13:08:39 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14695
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14696
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14697
pDriverName
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14698
    |pName|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14699
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14700
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14701
	Transcript showCR: 'PrinterInfo2 error getting pDriverName - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14702
	pName := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14703
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14704
	pName := self unsignedLongAt:(16 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14705
    ].
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14706
    pName == 0 ifTrue:[^ ''].
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14707
    ^ (ExternalBytes address:pName) stringAt:1
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14708
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14709
    "Created: / 01-08-2006 / 14:05:18 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14710
    "Modified: / 16-04-2007 / 13:08:43 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14711
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14712
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14713
pLocation
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14714
    |pLocation externalBytes|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14715
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14716
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14717
	Transcript showCR: 'PrinterInfo2 error getting pLocation - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14718
	pLocation := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14719
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14720
	pLocation := self unsignedLongAt:(24 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14721
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14722
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14723
    pLocation == 0 ifTrue:[^ nil].
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14724
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14725
    externalBytes := ExternalBytes address:pLocation.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14726
    ^ externalBytes isEmpty
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14727
	ifTrue:[ nil ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14728
	ifFalse:[ externalBytes stringAt:1 ]
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14729
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14730
    "Created: / 01-08-2006 / 14:03:21 / fm"
10098
7cb05f4cac0b *** empty log message ***
fm
parents: 10026
diff changeset
 14731
    "Modified: / 18-10-2006 / 12:06:45 / User"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14732
    "Modified: / 16-04-2007 / 13:08:27 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14733
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14734
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14735
priority
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14736
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14737
    |priority|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14738
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14739
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14740
	Transcript showCR: 'PrinterInfo2 error getting priority - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14741
	priority := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14742
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14743
	priority := self unsignedLongAt: 56 + 1
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14744
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14745
    ^ priority
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14746
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14747
    "Created: / 01-08-2006 / 14:40:08 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14748
    "Modified: / 16-04-2007 / 13:09:02 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14749
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14750
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14751
status
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14752
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14753
    |status|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14754
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14755
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14756
	Transcript showCR: 'PrinterInfo2 error getting status - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14757
	status := -1.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14758
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14759
	status := self unsignedLongAt: 72 + 1
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14760
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14761
    ^ status
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14762
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14763
    "Created: / 31-07-2006 / 11:08:05 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14764
    "Modified: / 16-04-2007 / 13:08:59 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14765
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14766
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14767
!Win32OperatingSystem::RegistryEntry class methodsFor:'defaults'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14768
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14769
rootKeyNames
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14770
    "returns a collection of root keyNames"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14771
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14772
    ^ #(
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14773
	'HKEY_CLASSES_ROOT'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14774
	'HKEY_CURRENT_USER'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14775
	'HKEY_LOCAL_MACHINE'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14776
	'HKEY_USERS'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14777
	'HKEY_PERFORMANCE_DATA'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14778
	'HKEY_CURRENT_CONFIG'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14779
	'HKEY_DYN_DATA'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14780
      )
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14781
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14782
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14783
separator
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14784
    "returns the registry-key-path separator character"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14785
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14786
    ^$\
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14787
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14788
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14789
!Win32OperatingSystem::RegistryEntry class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14790
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14791
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14792
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14793
    Interface to a WIN32 registry.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14794
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14795
    As this is a private class, access it via
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14796
	Win32OperatingSystem registryEntry
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14797
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14798
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14799
	Claus Gittinger (initial version & cleanup)
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14800
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14801
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14802
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14803
examples
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14804
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14805
    retrieve an existing entry by key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14806
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14807
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14808
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14809
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14810
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14811
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14812
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14813
    retrieve a non-existing entry by key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14814
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14815
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14816
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14817
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14818
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14819
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14820
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14821
    ask a keys value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14822
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14823
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14824
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14825
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14826
	Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14827
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14828
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14829
	Transcript showCR:(k valueNamed:'CurrentVersion').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14830
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14831
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14832
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14833
    create a sub-key (if not already present):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14834
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14835
	|k subKey|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14836
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14837
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14838
	subKey := k createSubKeyNamed:'RegistryDemo'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14839
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14840
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14841
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14842
    change a keys value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14843
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14844
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14845
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14846
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14847
	k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14848
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14849
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14850
    delete a value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14851
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14852
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14853
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14854
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14855
	k deleteValueNamed:'FooBarBaz'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14856
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14857
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14858
    delete a key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14859
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14860
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14861
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14862
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14863
	k deleteSubKeyNamed:'RegistryDemo'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14864
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14865
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14866
    enumerate keys:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14867
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14868
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14869
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14870
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14871
	k subKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14872
	    Transcript showCR:subKey path
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14873
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14874
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14875
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14876
    enumerate all keys (recursive):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14877
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14878
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14879
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14880
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14881
	k allSubKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14882
	    Transcript showCR:subKey path
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14883
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14884
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14885
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14886
    fetch value by index:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14887
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14888
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14889
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14890
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14891
	Transcript showCR:(k valueNameAtIndex:0)
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14892
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14893
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14894
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14895
    enumerate value names:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14896
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14897
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14898
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14899
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14900
	k valueNamesDo:[:nm  |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14901
	   Transcript showCR:nm.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14902
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14903
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14904
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14905
    enumerate values:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14906
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14907
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14908
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14909
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14910
	k valueNamesAndValuesDo:[:nm :val |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14911
	    Transcript showCR:(nm , ' -> ' , val storeString).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14912
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14913
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14914
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14915
    search for a value (where does NT store the domain ?):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14916
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14917
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14918
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14919
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\System'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14920
	k subKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14921
	    subKey subKeysDo:[:subSubKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14922
		|tcp params|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14923
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14924
		(subSubKey path asLowercase endsWith:'services') ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14925
		    tcp := subSubKey subKeyNamed:'tcpip'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14926
		    tcp notNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14927
			params := tcp subKeyNamed:'parameters'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14928
			params notNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14929
			    Transcript showCR:'Domain is found in ' , params path ,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14930
					' value: ' , (params valueNamed:'Domain').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14931
			    params close.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14932
			].
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14933
			tcp close.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14934
		    ]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14935
		]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14936
	    ]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14937
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14938
									[exEnd]
14514
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 14939
    register an exe for shell-open:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14940
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14941
	|k stx shell open cmd st_af edit st owl list id|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14942
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14943
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Classes\Applications'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14944
	stx := k createSubKeyNamed:'SmalltalkX.exe'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14945
	shell := stx createSubKeyNamed:'shell'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14946
	open := shell createSubKeyNamed:'open'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14947
	cmd := open createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14948
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14949
			 ' ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14950
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14951
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Classes'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14952
	st_af := k createSubKeyNamed:'st_auto_file'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14953
	shell := st_af createSubKeyNamed:'shell'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14954
	open := shell createSubKeyNamed:'open'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14955
	cmd := open createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14956
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14957
			 ' --open ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14958
	edit := shell createSubKeyNamed:'edit'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14959
	cmd := edit createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14960
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14961
			 ' --edit ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14962
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14963
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14964
	st := k createSubKeyNamed:'.st'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14965
	owl := st createSubKeyNamed:'OpenWithList'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14966
	list := owl valueNames.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14967
	(list contains:[:k | (owl valueNamed:k) = 'SmalltalkX.exe']) ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14968
	    Transcript showCR:'already registered.'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14969
	] ifFalse:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14970
	    id := ($a to:$z) detect:[:k | (list includes:(k asString)) not] ifNone:nil.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14971
	    owl valueNamed:id asString put:'SmalltalkX.exe'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14972
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14973
									[exEnd]
14514
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 14974
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 14975
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14976
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14977
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14978
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14979
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14980
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14981
!Win32OperatingSystem::RegistryEntry class methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14982
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14983
initialize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14984
    Lobby := Registry new.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14985
    ObjectMemory addDependent:self.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14986
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14987
    HKEY_CLASSES_ROOT     := %{ __MKEXTERNALADDRESS(HKEY_CLASSES_ROOT) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14988
    HKEY_CURRENT_USER     := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_USER) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14989
    HKEY_LOCAL_MACHINE    := %{ __MKEXTERNALADDRESS(HKEY_LOCAL_MACHINE) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14990
    HKEY_USERS            := %{ __MKEXTERNALADDRESS(HKEY_USERS) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14991
    HKEY_PERFORMANCE_DATA := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14992
    HKEY_CURRENT_CONFIG   := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_CONFIG) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14993
    HKEY_DYN_DATA         := %{ __MKEXTERNALADDRESS(HKEY_DYN_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14994
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14995
%{
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14996
#ifndef HKEY_PERFORMANCE_TEXT
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14997
    /* sigh - not defined with borland-cc */
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14998
# define HKEY_PERFORMANCE_TEXT  (( HKEY ) (ULONG_PTR)((LONG)0x80000050) )
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14999
#endif
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15000
#ifndef HKEY_PERFORMANCE_NLSTEXT
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15001
    /* sigh - not defined with borland-cc */
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15002
# define HKEY_PERFORMANCE_NLSTEXT  (( HKEY ) (ULONG_PTR)((LONG)0x80000060) )
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15003
#endif
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15004
%}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15005
    HKEY_PERFORMANCE_TEXT    := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_TEXT) %}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15006
    HKEY_PERFORMANCE_NLSTEXT := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_NLSTEXT) %}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15007
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15008
    "
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15009
     self initialize
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15010
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15011
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15012
    "Created: / 19.5.1999 / 21:39:57 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15013
    "Modified: / 19.5.1999 / 22:45:31 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15014
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15015
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15016
rootKeyValueFor:specialKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15017
    "returns one of the root keys or nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15018
     (these are shared and not finalized, as opposed to all other keys)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15019
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15020
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15021
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15022
    specialKeyStringOrSymbol = #'HKEY_CLASSES_ROOT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15023
	^ HKEY_CLASSES_ROOT.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15024
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15025
    specialKeyStringOrSymbol = #'HKEY_CURRENT_USER' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15026
	^ HKEY_CURRENT_USER.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15027
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15028
    specialKeyStringOrSymbol = #'HKEY_LOCAL_MACHINE' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15029
	^ HKEY_LOCAL_MACHINE.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15030
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15031
    specialKeyStringOrSymbol = #'HKEY_USERS' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15032
	^ HKEY_USERS.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15033
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15034
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_DATA' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15035
	^ HKEY_PERFORMANCE_DATA.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15036
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15037
    specialKeyStringOrSymbol = #'HKEY_CURRENT_CONFIG' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15038
	^ HKEY_CURRENT_CONFIG.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15039
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15040
    specialKeyStringOrSymbol = #'HKEY_DYN_DATA' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15041
	^ HKEY_DYN_DATA.
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15042
    ].
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15043
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_TEXT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15044
	^ HKEY_PERFORMANCE_TEXT.
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15045
    ].
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15046
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_NLSTEXT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15047
	^ HKEY_PERFORMANCE_NLSTEXT.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15048
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15049
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15050
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15051
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15052
    "Created: / 19.5.1999 / 21:40:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15053
    "Modified: / 24.12.1999 / 00:02:06 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15054
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15055
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15056
update:something with:aParameter from:changedObject
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15057
    "handle image restarts and refetch registry handles"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15058
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15059
    (something == #returnFromSnapshot) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15060
	self initialize
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15061
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15062
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15063
    "Created: 15.6.1996 / 15:14:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15064
    "Modified: 24.2.1997 / 22:08:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15065
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15066
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15067
!Win32OperatingSystem::RegistryEntry class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15068
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15069
immediateHandle:aHandleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15070
    |h newEntry|
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15071
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15072
    aHandleValue isInteger ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15073
	h := ExternalAddress newAddress:aHandleValue
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15074
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15075
	h := aHandleValue
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15076
    ].
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15077
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15078
    "/ rootKeys are not registered for RegClose ...
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15079
    newEntry := self basicNew setHandle:h path:nil.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15080
    newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15081
    ^ newEntry.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15082
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15083
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15084
     RegistryEntry immediateHandle:16r80000002
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15085
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15086
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15087
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15088
key:aKeyNamePath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15089
    "retrieve an entry by full path name (starting at a root)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15090
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15091
    ^ self key:aKeyNamePath flags:nil createIfAbsent:false
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15092
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15093
    "
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15094
     self key:'HKEY_LOCAL_MACHINE'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15095
     self key:'HKEY_LOCAL_MACHINE\Software'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15096
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15097
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15098
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15099
    "
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15100
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15101
    "Modified: / 19-01-2011 / 15:59:36 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15102
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15103
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15104
key:aKeyNamePath createIfAbsent:createIfAbsent
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15105
    "retrieve an entry by full path name (starting at a root)"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15106
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15107
    ^ self key:aKeyNamePath flags:nil createIfAbsent:createIfAbsent
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15108
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15109
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15110
     self key:'HKEY_LOCAL_MACHINE'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15111
     self key:'HKEY_LOCAL_MACHINE\Software'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15112
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15113
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15114
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15115
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15116
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15117
    "Created: / 19-01-2011 / 15:59:21 / cg"
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15118
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15119
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15120
key:aKeyNamePath flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15121
    "retrieve an entry by full path name (starting at a root).
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15122
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15123
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15124
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15125
	or nil, to access the key (32/64) for the current application"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15126
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15127
    ^ self key:aKeyNamePath flags:flags createIfAbsent:false
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15128
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15129
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15130
     self key:'HKEY_LOCAL_MACHINE'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15131
     self key:'HKEY_LOCAL_MACHINE\Software'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15132
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15133
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15134
     (self key:'HKEY_CURRENT_USER\Console' flags:#KEY_WOW64_64KEY) subKeys
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15135
     (self key:'HKEY_CURRENT_USER\Console' flags:#KEY_WOW64_32KEY) subKeys
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15136
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15137
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15138
    "Modified: / 19-01-2011 / 15:59:36 / cg"
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15139
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15140
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15141
key:aKeyNamePath flags:flags createIfAbsent:createIfAbsent
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15142
    "retrieve an entry by full path name (starting at a root).
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15143
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15144
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15145
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15146
	or nil, to access the key (32/64) for the current application"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15147
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15148
    |idx first rest root|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15149
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15150
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15151
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15152
    idx := aKeyNamePath indexOf:(self separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15153
    idx == 0 ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15154
	first := aKeyNamePath.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15155
	rest := nil.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15156
    ] ifFalse:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15157
	first := aKeyNamePath copyTo:idx-1.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15158
	rest := aKeyNamePath copyFrom:idx+1
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15159
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15160
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15161
    first := first asUppercase.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15162
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15163
    "/ the first is a pseudo name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15164
    root := self rootKey:first.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15165
    root isNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15166
	^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15167
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15168
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15169
    rest size == 0 ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15170
	^ root
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15171
    ].
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15172
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15173
    Error handle:[:ex |
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15174
	^ nil
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15175
    ] do:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15176
	^ root subKeyNamed:rest flags:flags createIfAbsent:createIfAbsent.
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15177
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15178
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15179
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15180
     self key:'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15181
     self key:'HKEY_LOCAL_MACHINE\Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15182
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15183
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15184
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID' flags:#KEY_WOW64_64KEY) valueNamed:''
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15185
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15186
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15187
    "Created: / 19-01-2011 / 15:59:21 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15188
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15189
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15190
rootKey:aRootKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15191
    "retrieve one of the root entries by name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15192
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15193
    |keyVal|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15194
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15195
    keyVal := self rootKeyValueFor:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15196
    keyVal isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15197
    "/ rootKeys are not registered for RegClose ...
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15198
    ^ self basicNew setHandle:keyVal path:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15199
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15200
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15201
     RegistryEntry rootKey:#'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15202
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15203
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15204
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15205
!Win32OperatingSystem::RegistryEntry class methodsFor:'misc queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15206
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15207
classIDOf:applicationName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15208
    |k clsIDString|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15209
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15210
    k := self key:'HKEY_CLASSES_ROOT\',applicationName,'\CLSID'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15211
    k isNil ifTrue:[ ^ nil ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15212
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15213
    clsIDString := k defaultValue.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15214
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15215
    ^ UUID fromString:clsIDString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15216
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15217
    "
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
 15218
     self classIDOf:'MicrosoftWorks.WordProcessor'
9167
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
 15219
     self classIDOf:'AcroPDF.PDF'
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
 15220
     self classIDOf:'PDF.PdfCtrl.5'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15221
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15222
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15223
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15224
commandTemplateToOpenMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15225
    "given a mimeType, retrieve the command-template of an application for opening the document.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15226
     Return nil, if no such application is known.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15227
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15228
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15229
    ^ self commandTemplateToOpenSuffix:(self extensionForMimeType:mimeType)
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15230
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15231
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15232
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'application/pdf'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15233
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'audio/mp3'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15234
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'video/avi'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15235
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'application/x-zip-compressed'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15236
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15237
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15238
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15239
commandTemplateToOpenSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15240
    "given a suffix, retrieve the command template for an application to print the document.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15241
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15242
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15243
    ^ self shellCommandTemplateFor:'open' onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15244
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15245
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15246
     self commandTemplateToOpenSuffix:'pdf'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15247
     self commandTemplateToOpenSuffix:'zip'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15248
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15249
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15250
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15251
commandTemplateToPrintMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15252
    "given a mimeType, retrieve the command-template of an application for printing the document.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15253
     Return nil, if no such application is known.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15254
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15255
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15256
    ^ self commandTemplateToPrintSuffix:(self extensionForMimeType:mimeType)
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15257
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15258
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15259
     Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:'application/pdf'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15260
     Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:'audio/mp3'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15261
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15262
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15263
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15264
commandTemplateToPrintSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15265
    "given a suffix, retrieve the command template for an application to open the document.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15266
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15267
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15268
    ^ self shellCommandTemplateFor:'print' onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15269
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15270
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15271
     self commandTemplateToPrintSuffix:'pdf'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15272
     self commandTemplateToPrintSuffix:'zip'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15273
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15274
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15275
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15276
executableForMimeType:mimeType
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15277
    "given a mimeType, retrieve the path to an application from the registry"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15278
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15279
    <resource: #obsolete>
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15280
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15281
    self obsoleteMethodWarning:'use commandTemplateToOpenMimeType:'.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15282
    ^ self commandTemplateToOpenMimeType:mimeType
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15283
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15284
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15285
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/pdf'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15286
     Win32OperatingSystem::RegistryEntry executableForMimeType:'audio/mp3'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15287
     Win32OperatingSystem::RegistryEntry executableForMimeType:'video/avi'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15288
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/x-zip-compressed'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15289
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15290
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15291
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15292
executableForSuffix:suffixArg
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15293
    "given a suffix, retrieve the path to an application from the registry"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15294
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15295
    <resource: #obsolete>
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15296
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15297
    self obsoleteMethodWarning:'use commandTemplateToOpenSuffix:'.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15298
    ^ self commandTemplateToOpenSuffix:suffixArg.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15299
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15300
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15301
     self executableForSuffix:'pdf'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15302
     self executableForSuffix:'zip'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15303
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15304
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15305
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15306
extensionForMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15307
    "HELPER: given a mimeType, retrieve the file extension or nil (if unknown)"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15308
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15309
    |k suffix|
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15310
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15311
    k := self key:'HKEY_CLASSES_ROOT\MIME\Database\Content Type\',mimeType.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15312
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15313
	suffix := k valueNamed:'extension'.
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15314
    ].
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15315
    ^ suffix
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15316
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15317
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15318
shellCommandTemplateFor:operation onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15319
    "HELPER: given a suffix, and an operation, retrieve a command template for an application"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15320
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 15321
    |k fkey cmd suffix redirect|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15322
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15323
    suffix := suffixArg.
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15324
    suffix isNil ifTrue:[^ nil].
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15325
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15326
    (suffix startsWith:'.') ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15327
	suffix := suffix copyFrom:2
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15328
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15329
    k := self key:'HKEY_CLASSES_ROOT\.',suffix.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15330
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15331
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15332
	fkey := (k valueNamed:'').
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15333
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15334
    fkey isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15335
	fkey := suffix,'_auto_file'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15336
    ].
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 15337
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15338
    fkey notEmptyOrNil ifTrue:[
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 15339
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15340
	redirect := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15341
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15342
	k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\CurVer').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15343
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15344
	    redirect := k defaultValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15345
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15346
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15347
	redirect isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15348
	     k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (fkey) , '\shell\',operation,'\command').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15349
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15350
	     k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (redirect) , '\shell\',operation,'\command').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15351
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15352
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15353
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15354
	    cmd := k defaultValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15355
	].
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15356
    ].
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15357
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15358
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15359
    ^ cmd
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15360
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15361
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15362
!Win32OperatingSystem::RegistryEntry class methodsFor:'registry access'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15363
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15364
stringValueFor:valueName atKey:keyPath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15365
    "convenient accessing method;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15366
     Looks for a string value under keyPath;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15367
     returns nil if either not found, or no string value"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15368
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15369
    |k v|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15370
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15371
    k := self key:keyPath.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15372
    k isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15373
    v := k valueNamed:valueName.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15374
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15375
    v isString ifFalse:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15376
    ^ v
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15377
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15378
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15379
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15380
	stringValueFor:'Content Type'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15381
	atKey:'HKEY_CLASSES_ROOT\.au'
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15382
    "
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15383
! !
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15384
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15385
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15386
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15387
handleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15388
    ^ handle address
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15389
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15390
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15391
isNew
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15392
    "answer true, if this key hats just be created, false if it did already exist"
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15393
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15394
    ^ isNew ? false
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15395
!
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15396
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15397
name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15398
    "return the keys name component (subKey name within my
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15399
     parent key)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15400
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15401
    |idx|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15402
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15403
    idx := path lastIndexOf:(self class separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15404
    idx == 0 ifTrue:[^ path].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15405
    ^ path copyFrom:idx+1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15406
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15407
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15408
path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15409
    "return the keys full key path name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15410
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15411
    ^ path.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15412
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15413
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15414
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing subkeys'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15415
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15416
createSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15417
    "create a new key below mySelf and return a new registry entry for it.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15418
     If it already exists, return it.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15419
     Return nil if the new key cannot be created."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15420
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15421
    ^ self subKeyNamed:subKeyString flags:nil createIfAbsent:true
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15422
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15423
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15424
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15425
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15426
     top := self key:'HKEY_CURRENT_USER'.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15427
     sub := top createSubKeyNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15428
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15429
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15430
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15431
createSubKeyNamed:subKeyString flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15432
    "create a new key below mySelf and return a new registry entry for it.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15433
     If it already exists, return it.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15434
     Return nil if the new key cannot be created.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15435
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15436
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15437
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15438
	or nil, to access the key (32/64) for the current application"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15439
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15440
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15441
    ^ self subKeyNamed:subKeyString flags:flags createIfAbsent:true
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15442
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15443
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15444
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15445
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15446
     top := self key:'HKEY_CURRENT_USER'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15447
     sub := top createSubKeyNamed:'FooBarBaz' flags:nil.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15448
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15449
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15450
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15451
deleteSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15452
    "delete a key below mySelf.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15453
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15454
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15455
    ^ self deleteSubKeyNamed:subKeyString flags:nil
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15456
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15457
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15458
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15459
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15460
     top := self key:'HKEY_CURRENT_USER'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15461
     sub := top createSubKeyNamed:'FooBarBaz'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15462
     top deleteSubKeyNamed:'FooBarBaz'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15463
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15464
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15465
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15466
deleteSubKeyNamed:subKeyString flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15467
    "delete a key below mySelf.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15468
     Return true on success.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15469
     flags may be one of:
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15470
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15471
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15472
	or nil, to access the key (32/64) for the current application.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15473
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15474
     CAVEAT: due to a missing library entry in the BCC system,
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15475
	     the flags are currently ignored"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15476
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15477
    |subKeyStringZ errorNumber|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15478
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15479
    subKeyStringZ := subKeyString asUnicode16StringZ.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15480
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15481
%{
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15482
#ifndef KEY_WOW64_64KEY
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15483
// this is missing in BCC header files
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15484
# define KEY_WOW64_64KEY    0x0100
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15485
# define KEY_WOW64_32KEY    0x0200
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15486
#endif
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15487
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15488
    HKEY myKey, subKey = 0;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15489
    int _retVal;
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15490
    int _flags = 0;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15491
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15492
    if (flags != nil) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15493
	if (flags == @symbol(KEY_WOW64_64KEY)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15494
	    _flags = KEY_WOW64_64KEY;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15495
	} else if (flags == @symbol(KEY_WOW64_32KEY)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15496
	    _flags = KEY_WOW64_32KEY;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15497
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15498
	    errorNumber = @symbol(badArgument2);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15499
	    goto out;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15500
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15501
    }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15502
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15503
    if (__isExternalAddressLike(__INST(handle))
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15504
     && __isUnicode16String(subKeyStringZ)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15505
	myKey = (HKEY)__externalAddressVal(__INST(handle));
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15506
#ifdef __BORLANDC__
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15507
	_retVal = RegDeleteKeyW(myKey, __unicode16StringVal(subKeyStringZ));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15508
#else
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15509
	_retVal = RegDeleteKeyExW(myKey,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15510
		    __unicode16StringVal(subKeyStringZ),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15511
		    _flags,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15512
		    0); // reserved
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15513
#endif
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15514
	if (_retVal == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15515
	    RETURN (true);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15516
	}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15517
	if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15518
	 && (_retVal != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15519
	    errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15520
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15521
    }
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15522
out:;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15523
%}.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15524
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15525
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15526
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15527
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15528
    ^ false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15529
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15530
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15531
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15532
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15533
     top := self key:'HKEY_CURRENT_USER'.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15534
     sub := top createSubKeyNamed:'FooBarBaz'.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15535
     top deleteSubKeyNamed:'FooBarBaz' flags:nil.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15536
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15537
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15538
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15539
remoteKeyOnHost:hostName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15540
    "return the corresponding registry entry from
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15541
     a remote computers registry."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15542
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15543
    |newEntry remoteHandle errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15544
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15545
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15546
    HKEY myKey, remoteKey = 0;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15547
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15548
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15549
    if (__isExternalAddressLike(__INST(handle)) && __isStringLike(hostName)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15550
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15551
	if ((_retVal = RegConnectRegistryA(__stringVal(hostName), myKey, &remoteKey)) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15552
	    remoteHandle = __MKEXTERNALADDRESS(remoteKey);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15553
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15554
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15555
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15556
		errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15557
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15558
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15559
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15560
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15561
    remoteHandle notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15562
	newEntry := self class basicNew setHandle:remoteHandle path:path.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15563
	newEntry registerForFinalization.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15564
	^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15565
    ].
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15566
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15567
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15568
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15569
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15570
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15571
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15572
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15573
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15574
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15575
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15576
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15577
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15578
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15579
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15580
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15581
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15582
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15583
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15584
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15585
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15586
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15587
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15588
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15589
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15590
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15591
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15592
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15593
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15594
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15595
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15596
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15597
subKeyAtIndex:subKeyIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15598
    "return a new registry entry below mySelf for the given subKey index.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15599
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15600
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15601
    |subKeyName subKeyClassName errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15602
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15603
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15604
    HKEY myKey, subKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15605
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15606
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15607
    char classNameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15608
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15609
    FILETIME modificationTime;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15610
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15611
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15612
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15613
     && __isSmallInteger(subKeyIndex)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15614
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15615
	if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15616
			 nameBuffer, &nameSize,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15617
			 NULL,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15618
			 classNameBuffer, &classNameSize,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15619
			 &modificationTime)) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15620
	    nameBuffer[nameSize] = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15621
	    classNameBuffer[classNameSize] = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15622
	    subKeyName = __MKSTRING(nameBuffer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15623
	    subKeyClassName = __MKSTRING(classNameBuffer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15624
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15625
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15626
	     && (_retVal != ERROR_FILE_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15627
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15628
		errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15629
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15630
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15631
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15632
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15633
    subKeyName notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15634
	^ self subKeyNamed:subKeyName.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15635
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15636
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15637
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15638
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15639
    ^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15640
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15641
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15642
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15643
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15644
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15645
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15646
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15647
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15648
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15649
subKeyNameAndClassAtIndex:subKeyIndex
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15650
    "return the name and className of the given subKey at index as a pair.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15651
     Return nil if no such key exists"
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15652
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15653
    |subKeyName subKeyClassName errorNumber|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15654
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15655
%{
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15656
    HKEY myKey, subKey = 0;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15657
    char nameBuffer[256];
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15658
    DWORD nameSize = sizeof(nameBuffer) - 1;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15659
    char classNameBuffer[256];
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15660
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15661
    FILETIME modificationTime;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15662
    int _retVal;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15663
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15664
    if (__isExternalAddressLike(__INST(handle))
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15665
     && __isSmallInteger(subKeyIndex)) {
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15666
	myKey = (HKEY)__externalAddressVal(__INST(handle));
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15667
	if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15668
			 nameBuffer, &nameSize,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15669
			 NULL,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15670
			 classNameBuffer, &classNameSize,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15671
			 &modificationTime)) == ERROR_SUCCESS) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15672
	    nameBuffer[nameSize] = '\0';
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15673
	    classNameBuffer[classNameSize] = '\0';
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15674
	    subKeyName = __MKSTRING(nameBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15675
	    subKeyClassName = __MKSTRING(classNameBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15676
	} else {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15677
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15678
	     && (_retVal != ERROR_FILE_NOT_FOUND)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15679
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15680
		errorNumber = __MKSMALLINT(_retVal);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15681
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15682
	}
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15683
    }
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15684
%}.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15685
    subKeyName notNil ifTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15686
	^ {subKeyName . subKeyClassName}.
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15687
    ].
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15688
    errorNumber notNil ifTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15689
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15690
    ].
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15691
    ^ nil
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15692
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15693
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15694
     |top sub|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15695
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15696
     top := self key:'HKEY_LOCAL_MACHINE'.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15697
     sub := top subKeyNameAndClassAtIndex:0
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15698
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15699
!
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15700
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15701
subKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15702
    "return a new registry entry below mySelf with the given subKey.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15703
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15704
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15705
    ^ self subKeyNamed:subKeyString flags:nil createIfAbsent:false
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15706
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15707
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15708
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15709
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15710
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15711
     sub := top subKeyNamed:'Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15712
    "
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15713
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15714
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15715
subKeyNamed:subKeyString createIfAbsent:createIfAbsent
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15716
    "return a new registry entry below mySelf with the given subKey.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15717
     If no such key exists and createIfAbsent is true, the key is created.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15718
     Otherwise, nil is returned"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15719
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15720
    ^ self subKeyNamed:subKeyString flags:nil createIfAbsent:createIfAbsent
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15721
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15722
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15723
subKeyNamed:subKeyString flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15724
    "return a new registry entry below mySelf with the given subKey.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15725
     Return nil if no such key exists.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15726
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15727
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15728
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15729
	or nil, to access the key (32/64) for the current application"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15730
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15731
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15732
    ^ self subKeyNamed:subKeyString flags:flags createIfAbsent:false
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15733
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15734
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15735
subKeyNamed:subKeyString flags:flags createIfAbsent:createIfAbsent
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15736
    "return a new registry entry below mySelf with the given subKey.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15737
     If no such key exists and createIfAbsent is true, the key is created.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15738
     Otherwise, nil is returned.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15739
     flags may be one of:
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15740
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15741
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15742
	or nil, to access the key (32/64) for the current application"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15743
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15744
    |subKeyStringZ newEntry subHandle errorNumber disposition|
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15745
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15746
    subKeyStringZ := subKeyString asUnicode16StringZ.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15747
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15748
%{
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15749
#ifndef KEY_WOW64_64KEY
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15750
// this is missing in BCC header files
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15751
# define KEY_WOW64_64KEY    0x0100
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15752
# define KEY_WOW64_32KEY    0x0200
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15753
#endif
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15754
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15755
    HKEY myKey, subKey = 0;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15756
    int _retVal;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15757
    int _flags = 0;
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15758
    int _disposition = 0;
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15759
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15760
    if (flags != nil) {
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15761
	if (flags == @symbol(KEY_WOW64_64KEY)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15762
	    _flags = KEY_WOW64_64KEY;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15763
	} else if (flags == @symbol(KEY_WOW64_32KEY)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15764
	    _flags = KEY_WOW64_32KEY;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15765
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15766
	    errorNumber = @symbol(badArgument2);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15767
	    goto out;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15768
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15769
    }
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15770
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15771
    if (__isExternalAddressLike(__INST(handle))
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15772
	&& __isUnicode16String(subKeyStringZ)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15773
	myKey = (HKEY)__externalAddressVal(__INST(handle));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15774
	if (createIfAbsent == true) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15775
	    _retVal = RegCreateKeyExW(myKey,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15776
			__unicode16StringVal(subKeyStringZ),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15777
			0,      // reserved
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15778
			NULL,   // class
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15779
			0,      // options
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15780
			KEY_ALL_ACCESS|_flags,   // rights
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15781
			NULL,   // securityAttributes - handle cannot be inherited
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15782
			&subKey,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15783
			&_disposition);  // disposition (created vs. opened)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15784
	    disposition = _disposition == REG_CREATED_NEW_KEY ? true : false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15785
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15786
	    _retVal = RegOpenKeyExW(myKey,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15787
			__unicode16StringVal(subKeyStringZ),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15788
			0,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15789
			KEY_ALL_ACCESS|_flags,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15790
			&subKey);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15791
	    disposition = false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15792
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15793
	if (_retVal == ERROR_SUCCESS) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15794
	    subHandle = __MKEXTERNALADDRESS(subKey);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15795
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15796
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15797
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15798
		errorNumber = __MKSMALLINT(_retVal);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15799
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15800
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15801
    }
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15802
out:;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15803
%}.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15804
    subHandle notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15805
	newEntry := self class basicNew
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15806
			setHandle:subHandle
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15807
			path:((path ? '?') , self class separator asString , subKeyString)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15808
			isNew:disposition.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15809
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15810
	newEntry registerForFinalization.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15811
	^ newEntry.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15812
    ].
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15813
    errorNumber notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15814
	(OperatingSystem errorHolderForNumber:errorNumber) reportProceedableError.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15815
    ].
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15816
    ^ nil
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15817
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15818
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15819
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15820
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15821
     top := self key:'HKEY_LOCAL_MACHINE'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15822
     sub := top subKeyNamed:'Software' flags:nil createIfAbsent:false
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15823
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15824
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15825
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15826
     top := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15827
     top valueNamed:'CurrentVersion'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15828
     sub := top subKeyNamed:'1.8' flags:#KEY_WOW64_64KEY createIfAbsent:false.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15829
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15830
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15831
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15832
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing values'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15833
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15834
defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15835
    ^ self valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15836
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15837
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15838
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15839
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15840
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15841
11623
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15842
defaultValue:datum
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15843
    "store a value; the value type depends upon the stored value:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15844
	ByteArray       -> REG_BINARY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15845
	String          -> REG_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15846
	Array of string -> REG_MULTI_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15847
	Integer         -> REG_DWORD
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15848
	nil             -> REG_NONE
11623
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15849
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15850
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15851
    ^ self valueNamed:'' put:datum
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15852
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15853
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15854
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15855
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15856
!
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15857
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15858
deleteValueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15859
    "delete a value.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15860
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15861
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15862
    |errorNumber|
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15863
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15864
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15865
    HKEY myKey;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15866
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15867
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15868
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15869
     && __isStringLike(aValueName)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15870
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15871
	if ((_retVal = RegDeleteValueA(myKey, __stringVal(aValueName))) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15872
	    RETURN (true);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15873
	}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15874
	if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15875
	 && (_retVal != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15876
	    errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15877
	}
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15878
    }
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15879
%}.
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15880
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15881
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15882
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15883
    ^ false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15884
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15885
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15886
valueNameAtIndex:valueIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15887
    "return a values name for the given value index.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15888
     Return nil if no such value exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15889
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15890
    |valueName errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15891
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15892
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15893
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15894
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15895
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15896
    DWORD valueType;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15897
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15898
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15899
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15900
     && __isSmallInteger(valueIndex)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15901
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15902
	if ((_retVal = RegEnumValueA(myKey, __intVal(valueIndex),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15903
			 nameBuffer, &nameSize,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15904
			 NULL,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15905
			 &valueType,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15906
			 NULL, NULL)) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15907
	    nameBuffer[nameSize] = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15908
	    valueName = __MKSTRING(nameBuffer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15909
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15910
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15911
	     && (_retVal != ERROR_FILE_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15912
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15913
		errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15914
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15915
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15916
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15917
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15918
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15919
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15920
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15921
    ^ valueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15922
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15923
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15924
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15925
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15926
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15927
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15928
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15929
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15930
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15931
valueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15932
    "retrieve a value; the returned object depends upon the type:
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15933
	REG_BINARY      -> ByteArray
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15934
	REG_SZ          -> String
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15935
	REG_MULTI_SZ    -> Array of strings
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15936
	REG_DWORD       -> Integer
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15937
	REG_NONE        -> nil
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15938
    "
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15939
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15940
    |stringArray retVal errorNumber|
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15941
19335
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
 15942
%{  /* STACK: 20000 */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15943
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15944
    DWORD valueType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15945
    union {
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15946
	DWORD dWord;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15947
	unsigned char dWordBytes[4];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15948
	unsigned char smallDataBuffer[1024*16];
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15949
    } quickData;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15950
    int val;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15951
    DWORD dataSize = sizeof(quickData);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15952
    unsigned char *dataBuffer = NULL;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15953
#define xxUSE_UNICODE
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15954
#ifdef USE_UNICODE
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15955
# define xRegQueryValueEx  RegQueryValueExW
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 15956
# define CHAR             short
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15957
#else
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15958
# define RegQueryValueEx  RegQueryValueExA
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 15959
# define CHAR             char
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15960
#endif
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15961
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15962
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15963
     && __isStringLike(aValueName)) {
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15964
	int ret;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15965
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15966
	myKey = (HKEY)__externalAddressVal(__INST(handle));
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15967
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15968
	/*
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15969
	 * try to get it with one call ...
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15970
	 */
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15971
	ret = RegQueryValueEx(myKey, __stringVal(aValueName),
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15972
			 NULL,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15973
			 &valueType,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15974
			 (char *)&quickData,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15975
			 &dataSize);
10692
043cb2920c0a *** empty log message ***
sr
parents: 10690
diff changeset
 15976
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15977
	console_printf("dataSize=%d\n", dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15978
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15979
	while (ret == ERROR_MORE_DATA) {
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15980
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15981
	    console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15982
	    console_printf("valueType=%d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15983
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15984
	    /*
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15985
	     * nope - need another one ...
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15986
	     */
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15987
	    if (myKey = HKEY_PERFORMANCE_DATA) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15988
		dataSize = dataSize * 2;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15989
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15990
	    switch (valueType) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15991
		case REG_BINARY:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15992
		case REG_MULTI_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15993
		    dataBuffer = malloc(dataSize);;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15994
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15995
		case REG_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15996
		    dataBuffer = malloc(dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15997
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15998
		default:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15999
		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16000
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16001
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16002
	    if (dataBuffer) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16003
		ret = RegQueryValueEx(myKey, __stringVal(aValueName),
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16004
				 NULL,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16005
				 &valueType,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16006
				 dataBuffer,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16007
				 &dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16008
	    } else {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16009
		break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16010
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16011
	    if (myKey != HKEY_PERFORMANCE_DATA) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16012
		if (ret != ERROR_SUCCESS) break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16013
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16014
	}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16015
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16016
	if (ret == ERROR_SUCCESS) {
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16017
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16018
	    console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16019
	    console_printf("valueType=%d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16020
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16021
	    switch (valueType) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16022
		case REG_NONE:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16023
		    /* RETURN (@symbol(none));  */
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16024
		    retVal = nil;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16025
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16026
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16027
		case REG_BINARY:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16028
		    retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16029
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16030
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16031
		case REG_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16032
		case REG_EXPAND_SZ:
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16033
#ifdef USE_UNICODE
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16034
		    retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16035
#else
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16036
		    retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16037
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16038
		    break;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16039
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16040
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16041
		case REG_DWORD:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16042
		    /* int in native format */
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16043
		    retVal = __MKUINT(quickData.dWord);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16044
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16045
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16046
		case REG_DWORD_LITTLE_ENDIAN:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16047
		    val = quickData.dWordBytes[3];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16048
		    val = (val << 8) | quickData.dWordBytes[2];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16049
		    val = (val << 8) | quickData.dWordBytes[1];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16050
		    val = (val << 8) | quickData.dWordBytes[0];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16051
		    retVal = __MKUINT(val);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16052
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16053
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16054
		case REG_DWORD_BIG_ENDIAN:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16055
		    val = quickData.dWordBytes[0];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16056
		    val = (val << 8) | quickData.dWordBytes[1];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16057
		    val = (val << 8) | quickData.dWordBytes[2];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16058
		    val = (val << 8) | quickData.dWordBytes[3];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16059
		    retVal = __MKUINT(val);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16060
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16061
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16062
		case REG_MULTI_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16063
		    {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16064
			CHAR *cp, *cp0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16065
			int ns, i;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16066
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16067
			cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16068
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16069
			console_printf("**************\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16070
			for (i=0;i<50;i++) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16071
			  console_printf("%x ", cp0[i]);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16072
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16073
			console_printf("\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16074
			for (i=0;i<50;i++) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16075
			  if (cp0[i] == 0)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16076
			    console_printf("\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16077
			  else
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16078
			    console_printf("%c", cp0[i]);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16079
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16080
			console_printf("\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16081
			console_printf("**************\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16082
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16083
			cp = cp0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16084
			ns = 0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16085
			while (*cp) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16086
			    while (*cp++) ;;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16087
			    ns++;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16088
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16089
			stringArray = __ARRAY_NEW_INT(ns);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16090
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16091
			i = 0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16092
			while (*cp0) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16093
			    OBJ s;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16094
			    CHAR *cp;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16095
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16096
			    cp = cp0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16097
			    while (*cp++) ;;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16098
#ifdef USE_UNICODE
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16099
			    s = __MKU16STRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16100
#else
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16101
			    s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16102
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16103
			    cp0 = cp;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16104
			    i++;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16105
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16106
			retVal = stringArray;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16107
			break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16108
		    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16109
		default:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16110
		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16111
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16112
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16113
	} else {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16114
	    if ((ret != ERROR_PATH_NOT_FOUND)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16115
	     && (ret != ERROR_FILE_NOT_FOUND)) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16116
		errorNumber = __MKSMALLINT(ret);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16117
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16118
	}
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16119
    }
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16120
    if (dataBuffer) free(dataBuffer);
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16121
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16122
    errorNumber notNil ifTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16123
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16124
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16125
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16126
    ^ retVal
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16127
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16128
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16129
     |key|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16130
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16131
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16132
     key valueNamed:'CurrentVersion'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16133
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16134
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16135
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16136
valueNamed:aValueName put:datum
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16137
    "store a value; the value type depends upon the stored value:
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16138
	ByteArray       -> REG_BINARY
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16139
	String          -> REG_SZ
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16140
	Array of string -> REG_MULTI_SZ
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16141
	Integer         -> REG_DWORD
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16142
	nil             -> REG_NONE
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16143
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16144
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16145
    |data stringArray errorNumber|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16146
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16147
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16148
    DWORD valueType = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16149
    int val;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16150
    DWORD dataSize = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16151
    unsigned char *dataPointer = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16152
    int datumOk = 1, mustFreeData = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16153
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16154
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 16155
     && __isStringLike(aValueName)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16156
	int ret;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16157
	OBJ cls;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16158
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16159
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16160
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16161
	if (datum == nil) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16162
	    valueType = REG_NONE;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16163
	    dataSize = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16164
	} else if (__isSmallInteger(datum)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16165
	    valueType = REG_DWORD;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16166
	    val = __intVal(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16167
	    dataPointer = (unsigned char *)(&val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16168
	    dataSize = sizeof(val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16169
	} else if (__isStringLike(datum)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16170
	    valueType = REG_SZ;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16171
	    dataPointer = __stringVal(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16172
	    dataSize = __stringSize(datum) + 1;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16173
	} else if (__Class(datum) == ByteArray) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16174
	    valueType = REG_BINARY;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16175
	    dataPointer = __ByteArrayInstPtr(datum)->ba_element;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16176
	    dataSize = __byteArraySize(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16177
	} else if (__Class(datum) == LargeInteger) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16178
	    valueType = REG_DWORD;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16179
	    val = __longIntVal(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16180
	    if (val) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16181
		dataPointer = (unsigned char *)(&val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16182
		dataSize = sizeof(val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16183
	    } else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16184
		datumOk = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16185
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16186
	} else if (__Class(datum) == Array) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16187
	    int i = 0, ns = 0, totalSize = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16188
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16189
	    valueType = REG_MULTI_SZ;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16190
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16191
	    /*
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16192
	     * must allocate a local buffer
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16193
	     * find size ...
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16194
	     */
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16195
	    for (i=0; i<__arraySize(datum); i++) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16196
		OBJ s = __ArrayInstPtr(datum)->a_element[i];
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16197
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16198
		if (__isStringLike(s)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16199
		    totalSize += __stringSize(s) + 1;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16200
		} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16201
		    datumOk = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16202
		    break;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16203
		}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16204
		ns++;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16205
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16206
	    if (datumOk) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16207
		char *cp;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16208
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16209
		/*
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16210
		 * allocate and fill...
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16211
		 */
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16212
		totalSize ++;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16213
		dataPointer = (char *)(malloc(totalSize));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16214
		mustFreeData = 1;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16215
		cp = dataPointer;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16216
		for (i=0; i<__arraySize(datum); i++) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16217
		    OBJ s = __ArrayInstPtr(datum)->a_element[i];
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16218
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16219
		    strcpy(cp, __stringVal(s));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16220
		    cp += __stringSize(s);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16221
		    *cp++ = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16222
		}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16223
		*cp++ = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16224
		dataSize = totalSize;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16225
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16226
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16227
	    datumOk = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16228
	}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16229
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16230
	if (datumOk) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16231
	    ret = RegSetValueExA(myKey, __stringVal(aValueName),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16232
				0, valueType,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16233
				dataPointer, dataSize);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16234
	    if (mustFreeData) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16235
		free(dataPointer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16236
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16237
	    if (ret == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16238
		RETURN (true);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16239
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16240
	    if ((ret != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16241
	     && (ret != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16242
		errorNumber = __MKSMALLINT(ret);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16243
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16244
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16245
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16246
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16247
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16248
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16249
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16250
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16251
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16252
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16253
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16254
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16255
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16256
     key valueNamed:'CurrentVersion' put:'3.5.2'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16257
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16258
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16259
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16260
!Win32OperatingSystem::RegistryEntry methodsFor:'enumeration'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16261
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16262
allSubKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16263
    "recursively evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16264
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16265
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16266
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16267
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16268
    [true] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16269
	subEntry := self subKeyAtIndex:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16270
	subEntry isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16271
	    ^self
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16272
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16273
	aBlock value:subEntry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16274
	subEntry allSubKeysDo:aBlock.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16275
	subEntry close.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16276
	idx := idx + 1.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16277
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16278
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16279
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16280
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16281
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16282
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16283
     top allSubKeysDo:[:subEntry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16284
	Transcript showCR:subEntry path
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16285
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16286
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16287
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16288
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16289
subKeyNamesAndClassesDo:aTwoArgBlock
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16290
    "evaluate aBlock for all subKeys names and class names below the receiver"
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16291
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16292
    |idx nameAndClassNameOrNil|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16293
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16294
    idx := 0.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16295
    [true] whileTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16296
	nameAndClassNameOrNil := self subKeyNameAndClassAtIndex:idx.
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16297
	nameAndClassNameOrNil isNil ifTrue:[
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16298
	    ^self
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16299
	].
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16300
	aTwoArgBlock value:nameAndClassNameOrNil first value:nameAndClassNameOrNil second.
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16301
	idx := idx + 1.
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16302
    ]
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16303
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16304
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16305
     |top sub|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16306
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16307
     top := self key:'HKEY_LOCAL_MACHINE'.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16308
     top subKeyNamesAndClassesDo:[:nm :cls |
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16309
	Transcript showCR:('name: ',nm,' class: ',cls)
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16310
     ]
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16311
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16312
!
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16313
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16314
subKeys
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16315
    "return a collection of subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16316
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16317
    |idx subEntry subKeys|
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16318
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16319
    subKeys := OrderedCollection new.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16320
    self subKeysDo:[:k | subKeys add:k].
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16321
    ^ subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16322
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16323
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16324
     |top sub|
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16325
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16326
     top := self key:'HKEY_LOCAL_MACHINE'.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16327
     top subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16328
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16329
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16330
    "Created: / 23.12.1999 / 22:15:22 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16331
    "Modified: / 23.12.1999 / 22:15:44 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16332
!
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16333
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16334
subKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16335
    "evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16336
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16337
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16338
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16339
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16340
    [true] whileTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16341
	subEntry := self subKeyAtIndex:idx.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16342
	subEntry isNil ifTrue:[
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16343
	    ^self
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16344
	].
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16345
	aBlock value:subEntry.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16346
	subEntry close.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16347
	idx := idx + 1.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16348
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16349
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16350
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16351
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16352
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16353
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16354
     top subKeysDo:[:subEntry |
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16355
	Transcript showCR:subEntry path
19532
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16356
     ]
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16357
    "
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16358
    "
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16359
     |top sub|
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16360
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16361
     top := self key:'HKEY_LOCAL_MACHINE'.
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16362
     OSErrorHolder noPermissionsSignal handle:[:ex |
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16363
	ex proceed
19532
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16364
     ] do:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16365
	 top subKeysDo:[:subEntry |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16366
	    Transcript showCR:subEntry path
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16367
	 ]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16368
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16369
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16370
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16371
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16372
valueNames
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16373
    "evaluate aBlock for all value names"
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16374
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16375
    ^ Array streamContents:[:s |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16376
	self valueNamesDo:[:nm | s nextPut:nm]
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16377
    ].
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16378
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16379
    "Created: / 18-01-2011 / 20:24:52 / cg"
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16380
!
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16381
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16382
valueNamesAndValuesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16383
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16384
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16385
    self valueNamesDo:[:nm |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16386
	aBlock value:nm value:(self valueNamed:nm)
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16387
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16388
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16389
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16390
     |key|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16391
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16392
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16393
     key valueNamesAndValuesDo:[:nm :val |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16394
	Transcript showCR:(nm , ' -> ' , val storeString).
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16395
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16396
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16397
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16398
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16399
valueNamesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16400
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16401
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16402
    |idx valueName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16403
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16404
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16405
    [true] whileTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16406
	valueName := self valueNameAtIndex:idx.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16407
	valueName isNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16408
	    ^self
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16409
	].
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16410
	aBlock value:valueName.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16411
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16412
    ]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16413
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16414
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16415
!Win32OperatingSystem::RegistryEntry methodsFor:'instance release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16416
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16417
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16418
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16419
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16420
    self closeKey.
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16421
    self unregisterForFinalization.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16422
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16423
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16424
closeKey
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16425
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16426
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16427
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16428
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16429
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16430
    if (__isExternalAddressLike(__INST(handle))) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16431
	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16432
	__INST(handle) = nil;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16433
	RegCloseKey(myKey);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16434
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16435
%}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16436
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16437
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16438
finalizationLobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16439
    ^ Lobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16440
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16441
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16442
finalize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16443
    "some entry has been collected - close it"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16444
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16445
    handle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16446
	self closeKey.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16447
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16448
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16449
    "Created: / 19.5.1999 / 22:39:52 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16450
    "Modified: / 19.5.1999 / 22:44:50 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16451
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16452
11135
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16453
!Win32OperatingSystem::RegistryEntry methodsFor:'printing & storing'!
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16454
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16455
printOn:aStream
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 16456
    aStream
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16457
	nextPutAll:self className;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16458
	nextPut:$(;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16459
	nextPutAll:path;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16460
	nextPut:$).
11135
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16461
! !
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16462
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16463
!Win32OperatingSystem::RegistryEntry methodsFor:'private'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16464
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16465
setHandle:aHandle path:aPathString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16466
    handle := aHandle.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16467
    path := aPathString.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16468
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16469
    "Created: / 19.5.1999 / 22:27:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16470
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16471
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16472
setHandle:aHandle path:aPathString isNew:disposition
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16473
    handle := aHandle.
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16474
    path := aPathString.
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16475
    isNew := disposition.
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16476
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16477
    "Created: / 19.5.1999 / 22:27:05 / cg"
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16478
!
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16479
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16480
setupForHandleValue:integerHandleValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16481
    "not normally used - given an integer address,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16482
     return a registry entry. This is provided to
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16483
     allow for future root keys to be added at the smalltalk level"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16484
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16485
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16486
    HKEY key;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16487
    OBJ t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16488
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16489
    key = (HKEY)__longIntVal(integerHandleValue);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16490
    if (! key) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16491
	RETURN (nil);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16492
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16493
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16494
    t = __MKEXTERNALADDRESS(key); __INST(handle) = t; __STORE(self, t);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16495
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16496
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16497
    "Created: / 19.5.1999 / 21:45:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16498
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16499
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16500
!Win32OperatingSystem::TextMetricsStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16501
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16502
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16503
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16504
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16505
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16506
    "Created: / 02-08-2006 / 16:20:02 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16507
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16508
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 16509
sizeInBytes
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16510
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16511
  ^53
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16512
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16513
    "Created: / 02-08-2006 / 16:20:09 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16514
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16515
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16516
!Win32OperatingSystem::TextMetricsStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16517
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16518
tmDefaultChar
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16519
    ^self byteAt: 46 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16520
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16521
    "Created: / 02-08-2006 / 16:15:35 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16522
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16523
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16524
tmExternalLeading
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16525
    ^self longAt: 16 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16526
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16527
    "Created: / 02-08-2006 / 16:17:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16528
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16529
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16530
tmHeight
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16531
    ^self longAt: 0 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16532
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16533
    "Created: / 02-08-2006 / 16:16:38 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16534
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16535
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16536
!Win32OperatingSystem::Win32ChangeNotificationHandle class methodsFor:'documentation'!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16537
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16538
documentation
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16539
"
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16540
    I represent a handle on change notifications (directory changes).
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16541
    I can be waited upon in a WaitForHandle / WaitForMultipleObjects call.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16542
"
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16543
! !
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16544
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16545
!Win32OperatingSystem::Win32ChangeNotificationHandle methodsFor:'release'!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16546
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16547
close
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16548
    "close the handle"
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16549
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16550
    self closeHandle.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16551
    self unregisterForFinalization.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16552
! !
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16553
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16554
!Win32OperatingSystem::Win32IOHandle class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16555
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16556
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16557
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16558
    I represent a handle on which I/O is possible.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16559
    Typical instances are File-Handles, Socket-Handles etc.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16560
"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16561
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16562
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16563
!Win32OperatingSystem::Win32IOHandle methodsFor:'io'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16564
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16565
readBytes:count into:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16566
    "read count bytes into a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16567
     Return the number of bytes read (negative on error)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16568
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16569
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16570
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16571
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16572
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16573
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16574
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16575
    int nRead = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16576
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16577
    DWORD cntWanted, offs, cntRead;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16578
    int bufferSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16579
    char miniBuffer[32];
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 16580
    int ok;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16581
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16582
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16583
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16584
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16585
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16586
    if (! __bothSmallInteger(count, firstIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16587
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16588
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16589
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16590
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16591
    if (cntWanted <= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16592
	errSym = @symbol(badCount);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16593
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16594
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16595
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16596
    if (offs < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16597
	errSym = @symbol(badOffset);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16598
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16599
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16600
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16601
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16602
    if (! bufferIsExternalBytes) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16603
	if (__isByteArray(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16604
	    bufferSize = __byteArraySize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16605
	} else if (__isString(aByteBuffer)) {  // not isStringLike here !
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16606
	    bufferSize = __stringSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16607
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16608
	    errSym = @symbol(badBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16609
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16610
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16611
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16612
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16613
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16614
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16615
	if (cntWanted <= sizeof(miniBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16616
	    extPtr = miniBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16617
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16618
	    extPtr = malloc(cntWanted);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16619
	    mustFreeBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16620
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16621
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16622
	OBJ sz;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16623
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16624
	extPtr = (char *)(__externalBytesAddress(aByteBuffer));
14667
f6a830b971f3 care for externalAddress being NULL before accessing an external buffer's contents
Claus Gittinger <cg@exept.de>
parents: 14636
diff changeset
 16625
	if (extPtr == NULL) goto bad;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16626
	sz = __externalBytesSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16627
	if (! __isSmallInteger(sz)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16628
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16629
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16630
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16631
	bufferSize = __smallIntegerVal(sz);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16632
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16633
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16634
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16635
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16636
	extPtr = extPtr + offs;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16637
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16638
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16639
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16640
	__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 16641
	// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16642
	ok = (int)(STX_API_NOINT_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16643
    } while(__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16644
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16645
    if (ok == TRUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16646
	if (! bufferIsExternalBytes) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16647
	    /* copy over */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16648
	    memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16649
	    if (mustFreeBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16650
		free(extPtr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16651
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16652
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16653
	RETURN (__mkSmallInteger(cntRead));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16654
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16655
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16656
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16657
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16658
    if (mustFreeBuffer) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16659
	free(extPtr);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16660
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16661
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16662
9154
d7f8a015da92 more com experiments
Claus Gittinger <cg@exept.de>
parents: 9153
diff changeset
 16663
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16664
	self error:'invalid argument(s): ', errSym.
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 16665
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16666
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 16667
    ].
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 16668
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16669
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16670
     |h buff n|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16671
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16672
     h := self basicNew.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16673
     buff := ByteArray new:10.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16674
     n := h readBytes:10 into:buff startingAt:1.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16675
     Transcript show:n; show:' '; showCR:buff.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16676
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16677
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16678
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16679
readWaitWithTimeoutMs:millis
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16680
    "return true if a timeout occurred"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16681
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16682
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16683
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16684
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16685
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16686
    DWORD res;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16687
    INT t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16688
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16689
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16690
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16691
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16692
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16693
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16694
#if 0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16695
    if (ioctlsocket((SOCKET)hFile, FIONREAD, &res)==0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16696
	/* its a socket */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16697
	if (res > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16698
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16699
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16700
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16701
    if (PeekNamedPipe(hFile, 0, 0, 0, &res, 0)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16702
	/* its a namedPipe */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16703
	if (res > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16704
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16705
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16706
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16707
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16708
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16709
	t = __intVal(millis);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16710
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16711
	t = INFINITE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16712
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16713
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16714
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16715
	__threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16716
	res = WaitForSingleObject(hFile, t);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16717
    } while (__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16718
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16719
    switch (res) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16720
	case WAIT_OBJECT_0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16721
	    /* signalled */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16722
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16723
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16724
	case WAIT_TIMEOUT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16725
	    /* signalled */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16726
	    RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16727
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16728
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16729
	case WAIT_ABANDONED:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16730
	    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16731
	    goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16732
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16733
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16734
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16735
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16736
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16737
     timeout argument not integer,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16738
     or any fd-array nonNil and not an array
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16739
     or not supported by OS
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16740
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16741
    ^ self primitiveFailed
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16742
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16743
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16744
seekTo:newPosition from:whence
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16745
    "whence is one of:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16746
	#begin
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16747
	#current
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16748
	#end
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16749
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16750
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16751
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16752
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16753
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16754
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16755
    DWORD moveHow;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16756
    LONG posLo, posHi = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16757
    __uint64__ pos64, newPos64;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16758
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16759
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16760
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16761
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16762
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16763
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16764
    if (whence == @symbol(begin)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16765
	moveHow = FILE_BEGIN;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16766
    } else if (whence == @symbol(current)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16767
	moveHow = FILE_CURRENT;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16768
    } else if (whence == @symbol(end)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16769
	moveHow = FILE_END;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16770
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16771
	errSym = @symbol(badArgument2);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16772
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16773
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16774
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16775
    if (__signedLong64IntVal(newPosition, &pos64) == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16776
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16777
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16778
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16779
#if __POINTER_SIZE__ == 8
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16780
    posLo = pos64 & 0xFFFFFFFF;
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16781
    posHi = (pos64 >> 32) & 0xFFFFFFFF;
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16782
#else
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16783
    posLo = pos64.lo;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16784
    posHi = pos64.hi;
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16785
#endif
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16786
    posLo = SetFilePointer(hFile, posLo, &posHi, moveHow);
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16787
    if (posLo == 0xFFFFFFFF) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16788
	int lastError;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16789
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16790
	/* can be either an error, or a valid low-word */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16791
	lastError = GetLastError();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16792
	if (lastError != NO_ERROR) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16793
	    errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16794
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16795
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16796
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16797
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16798
    if (posHi == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16799
	RETURN (__MKUINT( posLo ));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16800
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16801
#if __POINTER_SIZE__ == 8
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 16802
    newPos64 = (__uint64__)posLo | ((__uint64__)posHi << 32);
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16803
    RETURN ( __MKUINT(newPos64) );
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16804
#else
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16805
    newPos64.lo = posLo;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16806
    newPos64.hi = posHi;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16807
    RETURN ( __MKUINT64(&newPos64) );
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16808
#endif
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16809
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16810
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16811
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16812
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16813
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16814
	self error:'invalid argument(s): ', errSym.
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16815
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16816
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16817
    ].
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16818
!
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16819
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16820
writeBytes:count from:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16821
    "write count bytes from a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16822
     Return the number of bytes written (negative on error)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16823
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16824
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16825
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16826
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16827
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16828
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16829
    int nWritten = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16830
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16831
    DWORD cntWanted, offs, cntWritten;
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16832
    int bufferSize;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16833
    char miniBuffer[32];
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 16834
    int ok;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16835
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16836
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16837
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16838
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16839
    }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16840
    if (! __bothSmallInteger(count, firstIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16841
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16842
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16843
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16844
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16845
    if (cntWanted <= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16846
	errSym = @symbol(badCount);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16847
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16848
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16849
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16850
    if (offs < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16851
	errSym = @symbol(badOffset);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16852
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16853
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16854
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16855
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16856
    if (! bufferIsExternalBytes) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16857
	if (__isByteArray(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16858
	    bufferSize = __byteArraySize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16859
	} else if (__isStringLike(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16860
	    bufferSize = __stringSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16861
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16862
	    errSym = @symbol(badBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16863
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16864
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16865
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16866
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16867
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16868
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16869
	if (cntWanted <= sizeof(miniBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16870
	    extPtr = miniBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16871
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16872
	    extPtr = malloc(cntWanted);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16873
	    mustFreeBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16874
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16875
	memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16876
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16877
	extPtr = (char *)(__externalBytesAddress(aByteBuffer));
14667
f6a830b971f3 care for externalAddress being NULL before accessing an external buffer's contents
Claus Gittinger <cg@exept.de>
parents: 14636
diff changeset
 16878
	if (extPtr == NULL) goto bad;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16879
	bufferSize = __externalBytesSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16880
	if (! __isSmallInteger(bufferSize)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16881
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16882
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16883
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16884
	bufferSize = __smallIntegerVal(bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16885
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16886
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16887
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16888
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16889
	extPtr = extPtr + offs;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16890
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16891
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16892
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16893
	__threadErrno = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 16894
	// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16895
	ok = (int)(STX_API_NOINT_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */));
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16896
    } while(__threadErrno == EINTR);
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16897
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16898
    if (ok == TRUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16899
	if (mustFreeBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16900
	    free(extPtr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16901
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16902
	RETURN (__mkSmallInteger(cntWritten));
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16903
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16904
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16905
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16906
bad: ;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16907
    if (mustFreeBuffer) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16908
	free(extPtr);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16909
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16910
%}.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16911
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16912
	self error:'invalid argument(s): ', errSym.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16913
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16914
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16915
    ].
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16916
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16917
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16918
     |h buff n|
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16919
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16920
     h := self basicNew.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16921
     h setFileDescriptor:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16922
     buff := '12345678901234567890'.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16923
     n := h writeBytes:10 from:buff startingAt:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16924
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16925
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16926
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16927
!Win32OperatingSystem::Win32IOHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16928
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16929
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16930
    "close the file"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16931
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 16932
    self closeHandle.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16933
    self unregisterForFinalization.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16934
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16935
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16936
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'accessing - types'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16937
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16938
displayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16939
    "answer a Dictionary containing displayTypes symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16940
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16941
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16942
    DisplayTypeMappingTable notNil ifTrue:[ ^ DisplayTypeMappingTable ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16943
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16944
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16945
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16946
    __AT_PUT_(symbTable , @symbol(GENERIC),      __MKUINT( RESOURCEDISPLAYTYPE_GENERIC ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16947
    __AT_PUT_(symbTable , @symbol(DOMAIN),       __MKUINT( RESOURCEDISPLAYTYPE_DOMAIN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16948
    __AT_PUT_(symbTable , @symbol(SERVER),       __MKUINT( RESOURCEDISPLAYTYPE_SERVER ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16949
    __AT_PUT_(symbTable , @symbol(SHARE),        __MKUINT( RESOURCEDISPLAYTYPE_SHARE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16950
    __AT_PUT_(symbTable , @symbol(FILE),         __MKUINT( RESOURCEDISPLAYTYPE_FILE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16951
    __AT_PUT_(symbTable , @symbol(GROUP),        __MKUINT( RESOURCEDISPLAYTYPE_GROUP ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16952
    __AT_PUT_(symbTable , @symbol(NETWORK),      __MKUINT( RESOURCEDISPLAYTYPE_NETWORK ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16953
    __AT_PUT_(symbTable , @symbol(ROOT),         __MKUINT( RESOURCEDISPLAYTYPE_ROOT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16954
    __AT_PUT_(symbTable , @symbol(SHAREADMIN),   __MKUINT( RESOURCEDISPLAYTYPE_SHAREADMIN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16955
    __AT_PUT_(symbTable , @symbol(DIRECTORY),    __MKUINT( RESOURCEDISPLAYTYPE_DIRECTORY ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16956
    __AT_PUT_(symbTable , @symbol(TREE),         __MKUINT( RESOURCEDISPLAYTYPE_TREE ) );
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 16957
#ifdef RESOURCEDISPLAYTYPE_NDSCONTAINER
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16958
    __AT_PUT_(symbTable , @symbol(NDSCONTAINER), __MKUINT( RESOURCEDISPLAYTYPE_NDSCONTAINER ) );
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 16959
#endif
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16960
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16961
    DisplayTypeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16962
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16963
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16964
	DisplayTypeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16965
	DisplayTypeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16966
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16967
    ^ DisplayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16968
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16969
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16970
scopeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16971
    "answer a Dictionary with scopes mapping symbol to integer and vice verca"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16972
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16973
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16974
    ScopeMappingTable notNil ifTrue:[ ^ ScopeMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16975
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16976
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16977
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16978
    __AT_PUT_(symbTable, @symbol(CONNECTED),  __MKUINT( RESOURCE_CONNECTED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16979
    __AT_PUT_(symbTable, @symbol(CONTEXT),    __MKUINT( RESOURCE_CONTEXT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16980
    __AT_PUT_(symbTable, @symbol(GLOBALNET),  __MKUINT( RESOURCE_GLOBALNET ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16981
    __AT_PUT_(symbTable, @symbol(REMEMBERED), __MKUINT( RESOURCE_REMEMBERED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16982
    __AT_PUT_(symbTable, @symbol(RECENT),     __MKUINT( RESOURCE_RECENT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16983
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16984
    ScopeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16985
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16986
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16987
	ScopeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16988
	ScopeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16989
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16990
    ^ ScopeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16991
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16992
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16993
typeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16994
    "answer a Dictionary containing types symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16995
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16996
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16997
    TypeMappingTable notNil ifTrue:[ ^ TypeMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16998
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16999
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17000
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17001
    __AT_PUT_(symbTable , @symbol(ANY),      __MKUINT( RESOURCETYPE_ANY ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17002
    __AT_PUT_(symbTable , @symbol(DISK),     __MKUINT( RESOURCETYPE_DISK ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17003
    __AT_PUT_(symbTable , @symbol(PRINT),    __MKUINT( RESOURCETYPE_PRINT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17004
    __AT_PUT_(symbTable , @symbol(UNKNOWN),  __MKUINT( RESOURCETYPE_UNKNOWN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17005
    __AT_PUT_(symbTable , @symbol(RESERVED), __MKUINT( RESOURCETYPE_RESERVED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17006
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17007
    TypeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17008
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17009
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17010
	TypeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17011
	TypeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17012
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17013
    ^ TypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17014
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17015
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17016
usageMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17017
    "answer a Dictionary containing usages symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17018
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17019
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17020
    UsageMappingTable notNil ifTrue:[ ^ UsageMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17021
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17022
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17023
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17024
    __AT_PUT_(symbTable , @symbol(NULL),          __MKUINT( 0 ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17025
    __AT_PUT_(symbTable , @symbol(CONNECTABLE),   __MKUINT( RESOURCEUSAGE_CONNECTABLE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17026
    __AT_PUT_(symbTable , @symbol(CONTAINER),     __MKUINT( RESOURCEUSAGE_CONTAINER ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17027
    __AT_PUT_(symbTable , @symbol(ATTACHED),      __MKUINT( RESOURCEUSAGE_ATTACHED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17028
    __AT_PUT_(symbTable , @symbol(ALL),           __MKUINT( RESOURCEUSAGE_ALL ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17029
    __AT_PUT_(symbTable , @symbol(NOLOCALDEVICE), __MKUINT( RESOURCEUSAGE_NOLOCALDEVICE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17030
    __AT_PUT_(symbTable , @symbol(SIBLING),       __MKUINT( RESOURCEUSAGE_SIBLING ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17031
    __AT_PUT_(symbTable , @symbol(RESERVED),      __MKUINT( RESOURCEUSAGE_RESERVED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17032
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17033
    UsageMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17034
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17035
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17036
	UsageMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17037
	UsageMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17038
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17039
    ^ UsageMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17040
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17041
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17042
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'fetch resources'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17043
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17044
fetchResourcesStartingAt: aNetworkResourceOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17045
    withScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17046
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17047
    "Fetch all resources from the given network resource or if nil the root system.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17048
     On success a collection of al network resources is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17049
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17050
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17051
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17052
    self fetchResourcesStartingAt: nil withScope: #GLOBALNET type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17053
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17054
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17055
    | stream networkResources |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17056
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17057
    [
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17058
	stream := self openAt: aNetworkResourceOrNil
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17059
	    withScope: aScope type: aType usage: aUsage onError: aBlock.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17060
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17061
	stream notNil ifTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17062
	    |next|
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17063
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17064
	    networkResources := OrderedCollection new.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17065
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17066
	    [ (next := stream nextOrNil) notNil ] whileTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17067
		networkResources add:next.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17068
	    ].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17069
	]
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17070
    ] ensure:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17071
	stream notNil ifTrue:[ stream close ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17072
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17073
    ^ networkResources.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17074
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17075
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17076
fetchSystemResourcesWithScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17077
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17078
    "Fetch all system resources.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17079
     On success a collection of al network resources is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17080
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17081
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17082
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17083
    self fetchSystemResourcesWithScope: #GLOBALNET type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17084
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17085
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17086
    self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17087
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17088
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17089
    self fetchSystemResourcesWithScope: #REMEMBERED type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17090
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17091
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17092
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17093
    ^ self fetchResourcesStartingAt: nil
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17094
	    withScope: aScope type: aType usage: aUsage onError: aBlock
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17095
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17096
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17097
fetchVirtualDrives
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17098
    "answer a collection of virtual drive resources
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17099
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17100
     self fetchVirtualDrives
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17101
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17102
    ^ self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0 onError: nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17103
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17104
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17105
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'opening'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17106
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17107
openAt: aResourceOrNil withScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17108
    "Open a handle for network resource enumeratation starting at the given NetworkResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17109
     or if nil on the system root. On success the handle will is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17110
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17111
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17112
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17113
    OperatingSystem networkResourceAccessor openOn:nil withScope:#GLOBALNET  type:#ANY  usage:0 onError:nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17114
    OperatingSystem networkResourceAccessor openOn:nil withScope:#REMEMBERED type:#DISK usage:0 onError:nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17115
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17116
    | resourceHandle errorNumber enumScope enumUsage enumType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17117
      resScope resType resUsage resDisplayType resComment resLocalName resRemoteName resProvider |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17118
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17119
    "/ map symbols to integer values.. on error an exception is raised
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17120
    aScope isInteger ifTrue:[ enumScope := aScope ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17121
		    ifFalse:[ enumScope := self scopeMappingTable at:aScope ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17122
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17123
    aUsage isInteger ifTrue:[ enumUsage := aUsage ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17124
		    ifFalse:[ enumUsage := self usageMappingTable at:aUsage ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17125
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17126
    aType isInteger ifTrue:[ enumType := aType ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17127
		   ifFalse:[ enumType := self typeMappingTable at:aType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17128
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17129
    aResourceOrNil notNil ifTrue:[ | checkAndGetString |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17130
	resScope := aResourceOrNil scope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17131
	resScope isInteger ifFalse:[ resScope := self scopeMappingTable at:resScope ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17132
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17133
	resType := aResourceOrNil type.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17134
	resType isInteger ifFalse:[ resType := self typeMappingTable at: resType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17135
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17136
	resUsage := aResourceOrNil usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17137
	resUsage isInteger ifFalse:[ resUsage := self usageMappingTable at: resUsage ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17138
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17139
	resDisplayType := aResourceOrNil displayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17140
	resDisplayType isInteger ifFalse:[ resDisplayType := self displayTypeMappingTable at:resDisplayType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17141
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17142
	checkAndGetString := [: aString| |string|
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17143
	    aString notNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17144
		self isUsingUnicode
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17145
		    ifTrue: [ string := aString asUnicode16String  ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17146
		    ifFalse:[ string := aString asSingleByteString ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17147
	    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17148
	    string
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17149
	].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17150
	resRemoteName  := checkAndGetString value:( aResourceOrNil remoteName ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17151
	resLocalName   := checkAndGetString value:( aResourceOrNil localName ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17152
	resComment     := checkAndGetString value:( aResourceOrNil comment ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17153
	resProvider    := checkAndGetString value:( aResourceOrNil provider ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17154
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17155
    resourceHandle := self new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17156
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17157
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17158
    HANDLE __hEnum;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17159
    int    __errno;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17160
    DWORD  __scope = __unsignedLongIntVal( enumScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17161
    DWORD  __usage = __unsignedLongIntVal( enumUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17162
    DWORD  __type  = __unsignedLongIntVal( enumType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17163
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17164
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17165
    char           __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17166
    LPNETRESOURCE  __lpnetRes = (LPNETRESOURCE) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17167
    char *         __cp = __buffer + sizeof(NETRESOURCE);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17168
    char *         __sp;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17169
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17170
    wchar_t        __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17171
    LPNETRESOURCEW __lpnetRes = (LPNETRESOURCEW) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17172
    wchar_t *      __cp = __buffer + sizeof(NETRESOURCEW);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17173
    wchar_t *      __sp;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17174
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17175
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17176
    if( resScope == nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17177
	__lpnetRes = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17178
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17179
	int __sz;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17180
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17181
	ZeroMemory( __buffer, (__cp - __buffer) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17182
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17183
	__lpnetRes->dwScope       = __unsignedLongIntVal( resScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17184
	__lpnetRes->dwType        = __unsignedLongIntVal( resType  );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17185
	__lpnetRes->dwUsage       = __unsignedLongIntVal( resUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17186
	__lpnetRes->dwDisplayType = __unsignedLongIntVal( resDisplayType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17187
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17188
	if( resRemoteName != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17189
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17190
	    __sp = __stringVal(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17191
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17192
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17193
	    __sp = __unicode16StringVal(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17194
	    __sz = __unicode16StringSize(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17195
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17196
	    for( __lpnetRes->lpRemoteName = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17197
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17198
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17199
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17200
	if( resLocalName != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17201
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17202
	    __sp = __stringVal(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17203
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17204
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17205
	    __sp = __unicode16StringVal(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17206
	    __sz = __unicode16StringSize(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17207
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17208
	    for( __lpnetRes->lpLocalName = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17209
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17210
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17211
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17212
	if( resComment != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17213
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17214
	    __sp = __stringVal(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17215
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17216
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17217
	    __sp = __unicode16StringVal(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17218
	    __sz = __unicode16StringSize(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17219
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17220
	    for( __lpnetRes->lpComment = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17221
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17222
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17223
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17224
	if( resProvider != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17225
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17226
	    __sp = __stringVal(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17227
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17228
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17229
	    __sp = __unicode16StringVal(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17230
	    __sz = __unicode16StringSize(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17231
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17232
	    for( __lpnetRes->lpProvider = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17233
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17234
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17235
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17236
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17237
#ifdef DO_WRAP_CALLS
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17238
    do {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17239
	__threadErrno = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17240
#ifdef USE_ANSI_NETWORKRESOURCES
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 17241
	// do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 17242
	__errno = (int)(STX_API_NOINT_CALL5( "WNetOpenEnumA",  WNetOpenEnumA,  __scope, __type, __usage, __lpnetRes, & __hEnum ));
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17243
#else
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 17244
	// do not cast to INT - will loose sign bit then!
19339
8d679a172fab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19338
diff changeset
 17245
	__errno = (int)(STX_API_NOINT_CALL5( "WNetOpenEnumW", WNetOpenEnumW, __scope, __type, __usage, __lpnetRes, & __hEnum ));
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17246
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17247
    } while ((__errno < 0) && (__threadErrno == EINTR));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17248
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17249
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17250
#ifdef USE_ANSI_NETWORKRESOURCES
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17251
    __errno = WNetOpenEnumA ( __scope, __type, __usage, __lpnetRes, & __hEnum );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17252
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17253
    __errno = WNetOpenEnumW( __scope, __type, __usage, __lpnetRes, & __hEnum );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17254
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17255
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17256
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17257
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17258
    if( __errno == NO_ERROR ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17259
	__externalAddressVal(resourceHandle) = (void *) __hEnum;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17260
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17261
	resourceHandle = nil;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17262
	errorNumber    = __mkSmallInteger( __errno );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17263
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17264
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17265
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17266
    resourceHandle isNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17267
	aBlock notNil ifTrue:[ aBlock value: errorNumber ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17268
	^ nil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17269
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17270
    resourceHandle registerForFinalization.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17271
    ^ resourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17272
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17273
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17274
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'testing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17275
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17276
isUsingUnicode
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17277
    "answer true if we are using unicode; has effect to the open and next operation"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17278
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17279
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17280
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17281
    RETURN( false );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17282
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17283
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17284
    ^ true
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17285
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17286
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17287
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'queries'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17288
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17289
atEnd
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17290
    "answer true if the stream is at the end (no longer valid)"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17291
    ^ (self address == 0)
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17292
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17293
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17294
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'reading'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17295
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17296
nextOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17297
    "answer the next NetworkResource or nil (no more resource available);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17298
     if no more resource is available the stream is closed"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17299
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17300
    | scope type usage displayType comment localName remoteName provider |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17301
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17302
    self atEnd ifTrue:[ ^ nil ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17303
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17304
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17305
    HANDLE __hEnum = (HANDLE)(__externalAddressVal(self));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17306
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17307
    if ((__hEnum == 0) || (__hEnum == INVALID_HANDLE_VALUE)) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17308
	__externalAddressVal(self) = (HANDLE)0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17309
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17310
	DWORD           __entries = 1;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17311
	DWORD           __bufSize = 8192;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17312
	int             __errno;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17313
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17314
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17315
	char            __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17316
	LPNETRESOURCE   __lpNetRes  = (LPNETRESOURCE)  __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17317
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17318
	ZeroMemory( __buffer, sizeof(NETRESOURCE) );
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17319
	__errno = WNetEnumResourceA ( __hEnum , & __entries , __lpNetRes, & __bufSize );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17320
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17321
	wchar_t         __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17322
	LPNETRESOURCEW  __lpNetRes  = (LPNETRESOURCEW) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17323
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17324
	ZeroMemory( __buffer, sizeof(NETRESOURCEW) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17325
	__errno = WNetEnumResourceW ( __hEnum , & __entries , __lpNetRes, & __bufSize );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17326
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17327
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17328
	if( (__errno  == NO_ERROR) && (__entries == 1) ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17329
	    scope       = __MKUINT( __lpNetRes->dwScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17330
	    type        = __MKUINT( __lpNetRes->dwType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17331
	    usage       = __MKUINT( __lpNetRes->dwUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17332
	    displayType = __MKUINT( __lpNetRes->dwDisplayType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17333
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17334
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17335
	    if( __lpNetRes->lpRemoteName != 0 ) { remoteName =  __MKSTRING( __lpNetRes->lpRemoteName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17336
	    if( __lpNetRes->lpLocalName  != 0 ) { localName  =  __MKSTRING( __lpNetRes->lpLocalName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17337
	    if( __lpNetRes->lpComment    != 0 ) { comment    =  __MKSTRING( __lpNetRes->lpComment ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17338
	    if( __lpNetRes->lpProvider   != 0 ) { provider   =  __MKSTRING( __lpNetRes->lpProvider ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17339
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17340
	    if( __lpNetRes->lpRemoteName != 0 ) { remoteName =  __MKU16STRING( __lpNetRes->lpRemoteName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17341
	    if( __lpNetRes->lpLocalName  != 0 ) { localName  =  __MKU16STRING( __lpNetRes->lpLocalName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17342
	    if( __lpNetRes->lpComment    != 0 ) { comment    =  __MKU16STRING( __lpNetRes->lpComment ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17343
	    if( __lpNetRes->lpProvider   != 0 ) { provider   =  __MKU16STRING( __lpNetRes->lpProvider ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17344
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17345
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17346
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17347
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17348
    scope notNil ifTrue:[ |netResource|
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17349
	netResource := NetworkResource new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17350
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17351
	"map integer values to symbol excluding the usage..."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17352
	netResource scope: (self class scopeMappingTable at:scope ifAbsent:[scope]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17353
	netResource type:  (self class typeMappingTable  at:type ifAbsent:[type]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17354
	netResource displayType: (self class displayTypeMappingTable at:displayType ifAbsent:[displayType]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17355
	netResource usage: usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17356
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17357
	netResource remoteName: remoteName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17358
	netResource localName: localName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17359
	netResource comment: comment.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17360
	netResource provider: provider.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17361
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17362
	^ netResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17363
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17364
    self close.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17365
    ^ nil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17366
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17367
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17368
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'release'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17369
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17370
closeHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17371
    "close the handle"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17372
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17373
    self address == 0 ifTrue:[ ^ self ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17374
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17375
    HANDLE __hEnum = (HANDLE)(__externalAddressVal(self));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17376
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17377
    if (__hEnum) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17378
	__externalAddressVal(self) = (HANDLE)0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17379
	WNetCloseEnum(__hEnum);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17380
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17381
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17382
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17383
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17384
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'accessing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17385
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17386
comment
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17387
    "comment supplied by the network provider or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17388
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17389
    ^ comment
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17390
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17391
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17392
comment: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17393
    "comment supplied by the network provider or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17394
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17395
    comment := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17396
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17397
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17398
displayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17399
    "The display options for the network object in a network browsing user interface"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17400
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17401
    ^ displayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17402
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17403
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17404
displayType: theDisplayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17405
    "The display options for the network object in a network browsing user interface"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17406
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17407
    displayType := theDisplayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17408
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17409
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17410
localName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17411
    "if the scope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED,
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17412
     this specifies the name of a local device. This member is NULL if the connection
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17413
     does not use a device."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17414
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17415
    ^ localName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17416
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17417
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17418
localName: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17419
    "if the scope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED,
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17420
     this specifies the name of a local device. This member is NULL if the connection
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17421
     does not use a device."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17422
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17423
    localName := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17424
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17425
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17426
provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17427
    "the name of the provider that owns the resource or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17428
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17429
    ^ provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17430
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17431
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17432
provider: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17433
    "the name of the provider that owns the resource or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17434
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17435
    provider := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17436
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17437
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17438
remoteName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17439
    "If the resource is a network resource, this specifies the remote network name.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17440
     If the resource is a current or persistent connection, this specifies the network
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17441
     name associated with the name pointed to by the localName"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17442
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17443
    ^ remoteName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17444
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17445
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17446
remoteName: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17447
    "If the resource is a network resource, this specifies the remote network name.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17448
     If the resource is a current or persistent connection, this specifies the network
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17449
     name associated with the name pointed to by the localName"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17450
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17451
    remoteName := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17452
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17453
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17454
scope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17455
    "The scope of the enumeration
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17456
	RESOURCE_CONNECTED RESOURCE_GLOBALNET RESOURCE_REMEMBERED
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17457
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17458
    ^ scope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17459
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17460
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17461
scope: theScope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17462
    "The scope of the enumeration
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17463
	RESOURCE_CONNECTED RESOURCE_GLOBALNET RESOURCE_REMEMBERED
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17464
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17465
    scope := theScope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17466
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17467
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17468
type
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17469
    "describes the type of the resource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17470
	RESOURCETYPE_ANY  RESOURCETYPE_DISK  RESOURCETYPE_PRINT
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17471
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17472
    ^ type
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17473
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17474
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17475
type: theType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17476
    "describes the type of the resource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17477
	RESOURCETYPE_ANY  RESOURCETYPE_DISK  RESOURCETYPE_PRINT
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17478
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17479
    type := theType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17480
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17481
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17482
usage
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17483
    "a set of bit flags (INTEGER) describing how the resource can be used"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17484
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17485
    ^ usage
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17486
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17487
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17488
usage: anInteger
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17489
    "a set of bit flags (INTEGER) describing how the resource can be used"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17490
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17491
    usage := anInteger.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17492
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17493
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17494
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'printing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17495
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17496
printOn: aStream
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17497
    "print self on a stream"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17498
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17499
    | paction |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17500
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17501
    paction := [: anIdentifier :theValue |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17502
	anIdentifier printOn: aStream.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17503
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17504
	theValue notNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17505
	    theValue isInteger ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17506
		theValue printOn:aStream base:2 showRadix:true.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17507
	    ] ifFalse:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17508
		theValue isSymbol ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17509
		    theValue printOn: aStream.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17510
		] ifFalse:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17511
		    aStream nextPut: $". theValue printOn: aStream. aStream nextPut: $"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17512
		]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17513
	    ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17514
	].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17515
	aStream cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17516
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17517
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17518
    aStream nextPutAll: 'NetworkResource {'; cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17519
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17520
    paction value: '  Scope:        ' value:scope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17521
    paction value: '  Type:         ' value:type.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17522
    paction value: '  DisplayType:  ' value:displayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17523
    paction value: '  Usage(mask):  ' value:usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17524
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17525
    aStream cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17526
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17527
    paction value: '  RemoteName:   ' value:remoteName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17528
    paction value: '  LocalName:    ' value:localName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17529
    paction value: '  Comment       ' value:comment.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17530
    paction value: '  Provider      ' value:provider.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17531
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17532
    aStream nextPut: $}; cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17533
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17534
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17535
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'queries'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17536
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17537
isResourceContainer
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17538
    "answer true if the resource is a resource container"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17539
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17540
    | flag |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17541
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17542
    usage isInteger ifFalse:[ ^ usage = #CONTAINER ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17543
    flag := usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17544
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17545
    DWORD __usage = __unsignedLongIntVal( flag );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17546
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17547
    if( __usage & RESOURCEUSAGE_CONTAINER ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17548
	RETURN( true );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17549
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17550
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17551
    ^ false
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17552
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17553
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17554
!Win32OperatingSystem::Win32PrinterHandle methodsFor:'release'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17555
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17556
closeHandle
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17557
    self address ~~ 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17558
	OperatingSystem primClosePrinter:self.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17559
    ]
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17560
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17561
    "Created: / 27-07-2006 / 14:48:37 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17562
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17563
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17564
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17565
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17566
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17567
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17568
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17569
16334
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17570
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'comparing'!
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17571
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17572
= aWin32ProcessHandle
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17573
    ^ aWin32ProcessHandle class == self class and:[pid = aWin32ProcessHandle pid]
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17574
!
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17575
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17576
hash
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17577
    ^ pid hash
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17578
! !
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17579
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17580
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'printing & storing'!
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17581
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17582
printOn:aStream
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17583
    "return a printed representation of the receiver"
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17584
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17585
    super printOn:aStream.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17586
    aStream nextPutAll:' pid:'.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17587
    pid printOn:aStream.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17588
! !
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17589
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17590
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'opening'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17591
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17592
open:portName baudRate:baudRate stopBitsType:stopBitsType
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17593
		    parityType:parityType dataBits:dataBits
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17594
		    inFlowCtrl:inFlowCtrlType outFlowCtrl:outFlowCtrlType
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17595
		    xOnChar:xOnChar xOffChar:xOffChar
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17596
    "portName: COM%d
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17597
     baudRate: Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17598
     stopBitsType: #stop1, #stop2 or #stop1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17599
     parityType: #odd, #even or #none
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17600
     dataBits: #integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17601
     inFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17602
     outFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17603
     xOnChar: Character or Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17604
     xOffChar: Character or Integer"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17605
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17606
    |errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17607
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17608
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17609
    HANDLE port;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17610
    COMMTIMEOUTS timeouts;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17611
    DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17612
    char *__portName;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17613
    int __setBaudRate = 1,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17614
	__setDataBits = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17615
	__setXOnChar = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17616
	__setXOffChar = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17617
	__setInFlowCtrl = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17618
	__setOutFlowCtrl = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17619
	__setStopBits = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17620
	__setParityType = 1;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17621
    int __baudRate, __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17622
    int __xOnChar, __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17623
    int __inFlowCtrl, __outFlowCtrl;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17624
    int __stopBits, __parityType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17625
#   define XONOFF       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17626
#   define HARDWARE     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17627
#   define STOP1     1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17628
#   define STOP2     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17629
#   define STOP1_5   3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17630
#   define ODD       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17631
#   define EVEN      2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17632
#   define NONE      3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17633
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 17634
    if (__isStringLike(portName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17635
	__portName = __stringVal(portName);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17636
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17637
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17638
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17639
    if (__isSmallInteger(baudRate)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17640
	__baudRate = __intVal(baudRate);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17641
    } else if (baudRate == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17642
	__setBaudRate = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17643
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17644
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17645
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17646
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17647
    if (__isSmallInteger(dataBits)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17648
	__dataBits = __intVal(dataBits);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17649
    } else if (dataBits == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17650
	__setDataBits = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17651
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17652
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17653
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17654
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17655
    if (__isSmallInteger(xOnChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17656
	__xOnChar = __intVal(xOnChar);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17657
    } else if (__isCharacter(xOnChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17658
	__xOnChar = __intVal(_characterVal(xOnChar));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17659
    } else if (xOnChar == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17660
	__setXOnChar = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17661
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17662
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17663
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17664
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17665
    if (__isSmallInteger(xOffChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17666
	__xOffChar = __intVal(xOffChar);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17667
    } else if (__isCharacter(xOffChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17668
	__xOffChar = __intVal(_characterVal(xOffChar));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17669
    } else if (xOffChar == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17670
	__setXOffChar = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17671
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17672
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17673
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17674
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17675
    if (inFlowCtrlType == @symbol(xOnOff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17676
	__inFlowCtrl = XONOFF;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17677
    } else if (inFlowCtrlType == @symbol(hardware)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17678
	__inFlowCtrl = HARDWARE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17679
    } else if (inFlowCtrlType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17680
	__setInFlowCtrl = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17681
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17682
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17683
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17684
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17685
    if (outFlowCtrlType == @symbol(xOnOff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17686
	__outFlowCtrl = XONOFF;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17687
    } else if (outFlowCtrlType == @symbol(hardware)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17688
	__outFlowCtrl = HARDWARE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17689
    } else if (outFlowCtrlType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17690
	__setOutFlowCtrl = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17691
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17692
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17693
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17694
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17695
    if (stopBitsType == @symbol(stop1)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17696
	__stopBits = STOP1;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17697
    } else if (stopBitsType == @symbol(stop2)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17698
	__stopBits = STOP2;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17699
    } else if (stopBitsType == @symbol(stop1_5)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17700
	__stopBits = STOP1_5;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17701
    } else if (stopBitsType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17702
	__setStopBits = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17703
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17704
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17705
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17706
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17707
    port = CreateFile(__portName,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17708
	      GENERIC_READ | GENERIC_WRITE,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17709
	      0,             /* comm devices must be opened with exclusive access */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17710
	      NULL,          /* no security attrs */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17711
	      OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17712
	      0,             /* no overlapped I/O */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17713
	      NULL           /* hTemplate must be NULL for comm devices */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17714
	   );
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17715
    if (port == INVALID_HANDLE_VALUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17716
	console_fprintf(stderr, "Win32OS [info]: serial port open failed\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17717
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17718
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17719
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17720
    /* Flush the driver */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17721
    PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17722
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17723
    /* Set driver buffer sizes */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17724
    SetupComm( port, 4096 /*SERIAL_IN_QUEUE_SIZE*/, 4096 /*SERIAL_OUT_QUEUE_SIZE*/);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17725
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17726
    /* Reset timeout constants */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17727
    timeouts.ReadIntervalTimeout= 0xFFFFFFFF;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17728
    timeouts.ReadTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17729
    timeouts.ReadTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17730
    timeouts.WriteTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17731
    timeouts.WriteTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17732
    SetCommTimeouts( port, &timeouts );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17733
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17734
    /* Set communication parameters */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17735
    ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17736
    dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17737
    GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17738
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17739
    if (__setBaudRate) dcb.BaudRate = __baudRate;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17740
    if (__setDataBits) dcb.ByteSize = __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17741
    if (__setXOnChar)  dcb.XonChar = __xOnChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17742
    if (__setXOffChar) dcb.XoffChar = __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17743
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17744
    if (__setStopBits) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17745
	/* set stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17746
	switch(__stopBits) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17747
	    case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17748
	    case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17749
	    case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17750
	    default: goto errExit;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17751
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17752
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17753
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17754
    if (__setParityType) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17755
	/* set parity */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17756
	switch(__parityType) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17757
	    case NONE: dcb.Parity = NOPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17758
	    case ODD: dcb.Parity = ODDPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17759
	    case EVEN: dcb.Parity = EVENPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17760
	    default: goto errExit;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17761
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17762
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17763
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17764
    if (__setInFlowCtrl) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17765
	/* set control flow */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17766
	dcb.fInX = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17767
	dcb.fDtrControl = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17768
	if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE;  /* XOn/XOff handshaking */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17769
	if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE;  /* hardware handshaking */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17770
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17771
    if (__setOutFlowCtrl) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17772
	dcb.fOutX = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17773
	dcb.fOutxCtsFlow = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17774
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17775
	if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE;  /* XOn/XOff handshaking */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17776
	if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE;  /* hardware handshaking */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17777
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17778
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17779
    if (SetCommState(port, &dcb)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17780
	RETURN( true );
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17781
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17782
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
 17783
    console_fprintf(stderr, "Win32OS [info]: serial port comm-setup failed\n");
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17784
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17785
    /* fall into */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17786
errExit: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17787
    CloseHandle(port);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17788
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17789
failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17790
#   undef XONOFF
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17791
#   undef HARDWARE
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17792
#   undef STOP1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17793
#   undef STOP2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17794
#   undef STOP1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17795
#   undef ODD
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17796
#   undef EVEN
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17797
#   undef NONE
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17798
%}.
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17799
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17800
	self error:'invalid argument(s)'.
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17801
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17802
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17803
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17804
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17805
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17806
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17807
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17808
closeHandle
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17809
    "close the handle"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17810
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17811
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17812
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17813
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17814
    if (port) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 17815
	__externalAddressVal(self) = (HANDLE)0;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 17816
	PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 17817
	CloseHandle(port);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17818
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17819
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17820
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17821
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17822
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'setup'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17823
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17824
baudRate:newRate
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17825
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17826
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17827
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17828
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17829
     && __isSmallInteger(newRate)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17830
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17831
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17832
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17833
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17834
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17835
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17836
	dcb.BaudRate = __intVal(newRate);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17837
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17838
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17839
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17840
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17841
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17842
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17843
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17844
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17845
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17846
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17847
dataBits:newNumberOfBits
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17848
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17849
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17850
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17851
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17852
     && __isSmallInteger(newNumberOfBits)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17853
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17854
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17855
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17856
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17857
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17858
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17859
	dcb.ByteSize = __intVal(newNumberOfBits);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17860
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17861
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17862
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17863
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17864
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17865
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17866
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17867
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17868
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17869
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17870
parityType:newParityTypeSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17871
    "newParityTypeSymbol must be one of #odd, #even or #none (or nil)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17872
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17873
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17874
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17875
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17876
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17877
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17878
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17879
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17880
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17881
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17882
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17883
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17884
	if ((newParityTypeSymbol == nil) || (newParityTypeSymbol == @symbol(none))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17885
	    dcb.Parity = NOPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17886
	} else if (newParityTypeSymbol == @symbol(odd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17887
	    dcb.Parity = ODDPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17888
	} else if (newParityTypeSymbol == @symbol(even)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17889
	    dcb.Parity = EVENPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17890
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17891
	    goto failure;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17892
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17893
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17894
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17895
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17896
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17897
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17898
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17899
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17900
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17901
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17902
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17903
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17904
stopBitsType:newStopBitsSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17905
    "newParityTypeSymbol must be one of #stop1, #stop2 or #stop1_5"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17906
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17907
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17908
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17909
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17910
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17911
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17912
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17913
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17914
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17915
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17916
	if (newStopBitsSymbol == @symbol(stop1)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17917
	    dcb.Parity = 0 /* STOP1 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17918
	} else if (newStopBitsSymbol == @symbol(stop2)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17919
	    dcb.Parity = 2 /* STOP2 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17920
	} else if (newStopBitsSymbol == @symbol(stop1_5)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17921
	    dcb.Parity = 1 /* STOP1_5 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17922
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17923
	    goto failure;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17924
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17925
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17926
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17927
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17928
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17929
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17930
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17931
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17932
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17933
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17934
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17935
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17936
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'constants'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17937
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17938
protocolCodeOf:aNameOrNumber
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17939
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17940
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17941
    aNameOrNumber isNumber ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17942
    aNameOrNumber isNil ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17943
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17944
    aNameOrNumber = 'tcp' ifTrue:[^ 6].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17945
    aNameOrNumber = 'udp' ifTrue:[^ 17].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17946
    aNameOrNumber = 'raw' ifTrue:[^ 255].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17947
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17948
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17949
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17950
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17951
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17952
     self protocolCodeOf:#tcp
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17953
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17954
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17955
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17956
protocolSymbolOf:anInteger
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17957
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17958
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17959
    anInteger isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17960
    anInteger isSymbol ifTrue:[^ anInteger].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17961
14889
eaddf47af679 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14854
diff changeset
 17962
    anInteger ==   0 ifTrue:[ ^ #ip ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17963
    anInteger ==   6 ifTrue:[ ^ #tcp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17964
    anInteger ==  17 ifTrue:[ ^ #udp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17965
    anInteger == 255 ifTrue:[ ^ #raw ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17966
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17967
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17968
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17969
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17970
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17971
     self protocolSymbolOf:6
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17972
    "
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17973
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17974
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17975
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'instance creation'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17976
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17977
new
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17978
    "return an initialized instance"
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17979
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17980
    ^ self basicNew initialize.
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17981
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17982
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17983
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'queries'!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17984
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17985
getAddressInfo:hostNameOrNil serviceName:serviceNameOrNil domain:domainArg type:typeArg protocol:protoArg flags:flags
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17986
    "answer an Array of socket addresses for serviceName on hostName.
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17987
     Domain, type, protocol may be nil or specify a hint for the socket
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17988
     addresses to be returned."
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17989
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17990
    |error errorString result domain type proto hostName serviceName port|
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17991
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17992
    domain := OperatingSystem domainCodeOf:domainArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17993
    type := OperatingSystem socketTypeCodeOf:typeArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17994
    proto := self protocolCodeOf:protoArg.
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17995
    serviceNameOrNil notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 17996
	serviceName := serviceNameOrNil printString.      "convert integer port numbers"
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 17997
	serviceNameOrNil isInteger ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 17998
	    port := serviceNameOrNil.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 17999
	].
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18000
    ]. "ifFalse:[serviceName := nil]"
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18001
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18002
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18003
%{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18004
#if 1 || !defined(AI_NUMERICHOST)
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18005
%}.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18006
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18007
    "have to convert serviceName and hostName to single byte strings
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18008
     until we implement getAddrInfoW() for Borland C.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18009
     If we really have 16-bit hostnames, this fails with #primitiveFailed"
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18010
    hostNameOrNil notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18011
	hostName := hostNameOrNil asSingleByteStringIfPossible.
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18012
    ].  "ifFalse:[hostName := nil] is nil anyway"
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18013
    serviceName notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18014
	serviceName := serviceName asSingleByteStringIfPossible.
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18015
    ].
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18016
%{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18017
#endif // !AI_NUMERICHOST
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18018
%}.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18019
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18020
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18021
%{ /* STACK:32000 */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18022
#if !defined(NO_SOCKET)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18023
    char *__hostName, *__serviceName;
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 18024
    char __hostNameCopy[1024], __serviceNameCopy[256];
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 18025
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 18026
    int cnt = 0;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18027
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18028
    if (hostName == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18029
	__hostName = 0;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18030
    } else if (__isStringLike(hostName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18031
	strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18032
	__hostName = __hostNameCopy;
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18033
    } else if (__isUnicode16String(hostName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18034
	error = @symbol(unsupportedUnicodeName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18035
	errorString = __MKSTRING("Unicode hostnames are not yet supported");
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18036
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18037
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18038
	error = @symbol(badArgument1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18039
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18040
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18041
    if (serviceName == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18042
	__serviceName = 0;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18043
    } else if (__isStringLike(serviceName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18044
	strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18045
	__serviceName = __serviceNameCopy;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18046
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18047
	error = @symbol(badArgument2);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18048
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18049
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18050
    if (__hostName == 0 && __serviceName == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18051
	error = @symbol(badArgument);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18052
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18053
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18054
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18055
{
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18056
# if defined(AI_NUMERICHOST)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18057
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18058
     * Use getaddrinfo()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18059
     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18060
    struct addrinfo hints;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18061
    struct addrinfo *info = NULL, *infop;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18062
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18063
    memset(&hints, 0, sizeof(hints));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18064
    if (__isSmallInteger(domain))
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18065
	hints.ai_family = __intVal(domain);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18066
    if (__isSmallInteger(type))
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18067
	hints.ai_socktype = __intVal(type);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18068
    if (__isSmallInteger(proto))
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18069
	hints.ai_protocol = __intVal(proto);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18070
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18071
    do {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18072
# ifdef DO_WRAP_CALLS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18073
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18074
	    __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18075
	    // do not cast to INT - will loose sign bit then!
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 18076
	    ret = (int)(STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info));
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18077
	} while ((ret < 0) && (__threadErrno == EINTR));
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18078
# else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18079
	__BEGIN_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18080
	ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18081
	__END_INTERRUPTABLE__
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18082
# endif
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18083
    } while (ret != 0 && __threadErrno == EINTR);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18084
    if (ret != 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18085
	switch (ret) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18086
	case EAI_FAMILY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18087
	    error = @symbol(badProtocol);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18088
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18089
	case EAI_SOCKTYPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18090
	    error = @symbol(badSocketType);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18091
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18092
	case EAI_BADFLAGS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18093
	    error = @symbol(badFlags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18094
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18095
	case EAI_NONAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18096
	    error = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18097
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18098
	case EAI_SERVICE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18099
	    error = @symbol(unknownService);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18100
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18101
	case EAI_MEMORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18102
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18103
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18104
	case EAI_FAIL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18105
	    error = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18106
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18107
	case EAI_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18108
	    error = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18109
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18110
	default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18111
	    error = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18112
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18113
	errorString = __MKSTRING(gai_strerror(ret));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18114
	goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18115
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18116
    for (cnt=0, infop=info; infop; infop=infop->ai_next)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18117
	cnt++;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18118
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18119
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18120
    if (result == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18121
	error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18122
	goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18123
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18124
    for (infop=info, cnt=0; infop; infop=infop->ai_next, cnt++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18125
	OBJ o, resp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18126
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18127
	resp = __ARRAY_NEW_INT(6);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18128
	if (resp == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18129
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18130
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18131
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18132
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18133
	__ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18134
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18135
	__ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18136
	__ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18137
	__ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18138
	__ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18139
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18140
	__PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18141
	o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18142
	__UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18143
	if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18144
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18145
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18146
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18147
	memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18148
       __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18149
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18150
	if (infop->ai_canonname) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18151
	    __PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18152
	    o = __MKSTRING(infop->ai_canonname);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18153
	    __UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18154
	    if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18155
		error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18156
		goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18157
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18158
	    __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18159
	}
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18160
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18161
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18162
err:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18163
    if (info) freeaddrinfo(info);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18164
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18165
# else /* ! AI_NUMERICHOST =============================================================*/
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18166
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18167
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18168
     * Use getservbyname() / gethostByName()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18169
     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18170
    struct hostent *hp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18171
    char **addrpp;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18172
    int __port = 0;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18173
    int i;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18174
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18175
    if (__isSmallInteger(port)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18176
	__port = htons(__smallIntegerVal(port));
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18177
    } else if (__serviceName) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18178
	struct servent *sp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18179
	char *__proto = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18180
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18181
	if (__isStringLike(protoArg))
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18182
	    __proto = __stringVal(protoArg);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18183
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18184
	sp = getservbyname(__serviceName, __proto);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18185
	if (sp == NULL) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18186
	    __port = atoi(__serviceName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18187
	    if (__port <= 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18188
		errorString = @symbol(unknownService);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18189
		error = __mkSmallInteger(-3);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18190
		goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18191
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18192
	    __port = htons(__port);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18193
	} else
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18194
	    __port = sp->s_port;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18195
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18196
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18197
    if (__hostName) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18198
	int err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18199
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18200
	do {
15604
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 18201
# if 0 && defined(DO_WRAP_CALLS)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18202
	    /* This does not work - the structure is allocated in thread local storage */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18203
	    hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18204
	    if ((INT)hp < 0) hp = NULL;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18205
# else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18206
	    /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18207
	     * uses a static data area, but allocates it in thread local storage
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18208
	     */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18209
	    // __BEGIN_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18210
	    hp = gethostbyname(__hostName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18211
	    // __END_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18212
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18213
	} while ((hp == NULL
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18214
		  && (err = WSAGetLastError()) == EINTR));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18215
	if (hp == 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18216
	    switch (err) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18217
	    case HOST_NOT_FOUND:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18218
		errorString = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18219
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18220
	    case NO_ADDRESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18221
		errorString = @symbol(noAddress);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18222
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18223
	    case NO_RECOVERY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18224
		errorString = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18225
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18226
	    case TRY_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18227
		errorString = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18228
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18229
	    default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18230
		errorString = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18231
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18232
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18233
	    error = __mkSmallInteger(err);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18234
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18235
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18236
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18237
	if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18238
	    errorString = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18239
	    error = __mkSmallInteger(-2);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18240
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18241
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18242
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18243
	for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18244
	    cnt++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18245
	addrpp = hp->h_addr_list;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18246
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18247
	cnt = 1;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18248
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18249
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18250
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18251
    if (result == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18252
	error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18253
	goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18254
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18255
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18256
    for (i = 0; i < cnt; i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18257
	OBJ o, resp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18258
	struct sockaddr_in *sa;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18259
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18260
	resp = __ARRAY_NEW_INT(6);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18261
	if (resp == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18262
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18263
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18264
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18265
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18266
	__ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18267
	__ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18268
	__ArrayInstPtr(resp)->a_element[2] = type; __STORE(resp, type);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18269
	__ArrayInstPtr(resp)->a_element[3] = proto; __STORE(resp, proto);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18270
	__PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18271
	o = __BYTEARRAY_NEW_INT(sizeof(*sa));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18272
	__UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18273
	if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18274
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18275
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18276
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18277
	__ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18278
	sa = (struct sockaddr_in *)__byteArrayVal(o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18279
	sa->sin_port = __port;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18280
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18281
	if (__hostName) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18282
	    sa->sin_family = hp->h_addrtype;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18283
	    memcpy(&sa->sin_addr, *addrpp, hp->h_length);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18284
	    __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18285
	    if (hp->h_name) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18286
		__PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18287
		o = __MKSTRING(hp->h_name);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18288
		__UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18289
		if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18290
		    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18291
		    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18292
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18293
		__ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18294
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18295
	    addrpp++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18296
	} else{
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18297
	    if (__isSmallInteger(domain))
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18298
		sa->sin_family = __intVal(domain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18299
	    else
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18300
		sa->sin_family = AF_INET;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18301
	    __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18302
	}
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18303
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18304
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18305
err:;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18306
# endif /* ! AI_NUMERICHOST */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18307
}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18308
#else /* ! HAS_SOCKET */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18309
    error = @symbol(notImplemented);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18310
#endif
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18311
exitPrim:;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18312
%}.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18313
    error notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18314
	|request|
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18315
	request := SocketAddressInfo new
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18316
	    domain:domainArg;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18317
	    type:typeArg;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18318
	    protocol:protoArg;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18319
	    canonicalName:hostName;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18320
	    serviceName:serviceName.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18321
	^ (HostNameLookupError new
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18322
		parameter:error;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18323
		messageText:' - ', (errorString ? error printString);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18324
		request:request) raiseRequest.
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18325
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18326
    1 to:result size do:[:i |
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18327
	|entry dom info|
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18328
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18329
	info := SocketAddressInfo new.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18330
	entry := result at:i.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18331
	info flags:(entry at:1).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18332
	info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18333
	info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18334
	info protocol:(self protocolSymbolOf:(entry at:4)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18335
	info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18336
	info canonicalName:(entry at:6).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18337
	result at:i put:info
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18338
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18339
    ^ result
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18340
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18341
    "
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18342
     self getAddressInfo:'localhost' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18343
	    domain:nil type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18344
     self getAddressInfo:'localhost' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18345
	    domain:#AF_INET type:#stream protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18346
     self getAddressInfo:'localhost' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18347
	    domain:#AF_INET type:#stream protocol:#tcp flags:nil
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18348
     self getAddressInfo:'localhost' serviceName:10
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18349
	    domain:#AF_INET type:#stream protocol:#tcp flags:nil
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18350
     self getAddressInfo:'localhost' serviceName:'10'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18351
	    domain:#AF_INET type:#stream protocol:#tcp flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18352
     self getAddressInfo:'blurb.exept.de' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18353
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18354
     self getAddressInfo:'1.2.3.4' serviceName:'bla'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18355
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18356
     self getAddressInfo:'localhost' serviceName:'echo'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18357
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18358
     self getAddressInfo:nil serviceName:'echo'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18359
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18360
     self getAddressInfo:nil serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18361
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18362
     self getAddressInfo:'www.google.de' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18363
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18364
     self getAddressInfo:'exeptn' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18365
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18366
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18367
     self getAddressInfo:'localhost' asUnicode16String serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18368
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18369
     self getAddressInfo:'ützlbrützl' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18370
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18371
     self getAddressInfo:'ützlbrützl' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18372
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18373
     self getAddressInfo:'путин.ру' asUnicode16String serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18374
	    domain:nil type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18375
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18376
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18377
17595
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18378
getNameInfo:socketAddressIn wantHostName:wantHostName wantServiceName:wantServiceName datagram:useDatagram flags:flags
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18379
    "answer an Array containing the hostName and serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18380
     in socketAddress.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18381
     This is the generic version of getHostByAddr, however, if supported by the OS,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18382
     this returns multiple hostnames (if appropriate)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18383
17595
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18384
    |socketAddress error errorString hostName serviceName|
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18385
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18386
    socketAddress := socketAddressIn.
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18387
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18388
%{   /* STACK:32000 */
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18389
#if !defined(NI_NUMERICHOST)
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18390
%}.
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18391
    "if the getNameInfo() syscall is not present (as in Borland),
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18392
     convert mapped IPv4 to IPv6Addresses back to IPv4,
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18393
     so that these addresses can be resolved"
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18394
    socketAddress := socketAddress asIPv4SocketAddressIfPossible.
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18395
%{
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18396
#endif // !defined(NI_NUMERICHOST)
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18397
%}.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18398
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18399
%{  /* STACK:32000 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18400
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18401
#if !defined(NO_SOCKET)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18402
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18403
# ifndef NI_MAXHOST
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18404
#  define NI_MAXHOST 256
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18405
#  define NI_MAXSERV 64
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18406
# endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18407
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18408
    char host[NI_MAXHOST];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18409
    char service[NI_MAXSERV];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18410
    char *hp = 0, *sp = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18411
    int hsz = 0, ssz = 0;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 18412
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 18413
    int __flags;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18414
    char *bp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18415
    int nInstBytes, sockAddrSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18416
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18417
    if (wantHostName == true) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18418
	hp = host;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18419
	hsz = sizeof(host);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18420
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18421
    if (wantServiceName == true) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18422
	sp = service;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18423
	ssz = sizeof(service);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18424
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18425
    if (hp == 0 && sp == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18426
	error = @symbol(badArgument);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18427
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18428
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18429
    if (!__isBytes(socketAddress)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18430
	error = @symbol(badArgument1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18431
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18432
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18433
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18434
    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18435
    sockAddrSize = __byteArraySize(socketAddress);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18436
    sockAddrSize -= nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18437
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18438
    if (!__isSmallInteger(flags)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18439
	error = @symbol(badArgument5);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18440
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18441
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18442
    __flags = __intVal(flags);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18443
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18444
#if defined(NI_NUMERICHOST)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18445
    if (useDatagram == true) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18446
	__flags |= NI_DGRAM;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18447
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18448
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18449
    {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18450
	bp = (char *)(__byteArrayVal(socketAddress));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18451
	bp += nInstBytes;
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18452
# ifdef DO_WRAP_CALLS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18453
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18454
	    __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18455
	    // do not cast to INT - will loose sign bit then!
19339
8d679a172fab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19338
diff changeset
 18456
	    ret = (int)(STX_WSA_NOINT_CALL7( "getnameinfo", getnameinfo, (struct sockaddr *)bp, (INT)sockAddrSize, hp, (INT)hsz, sp, (INT)ssz, (INT)__flags));
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18457
	} while ((ret < 0) && (__threadErrno == EINTR));
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18458
# else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18459
	__BEGIN_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18460
	ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18461
			  hp, hsz, sp, ssz, __flags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18462
	__END_INTERRUPTABLE__
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18463
# endif
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18464
    } while (ret != 0 && __threadErrno == EINTR);
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18465
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18466
    if (ret != 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18467
	switch (ret) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18468
	    case EAI_FAMILY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18469
		error = @symbol(badProtocol);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18470
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18471
	    case EAI_SOCKTYPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18472
		error = @symbol(badSocketType);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18473
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18474
	    case EAI_BADFLAGS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18475
		error = @symbol(badFlags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18476
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18477
	    case EAI_NONAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18478
		error = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18479
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18480
	    case EAI_SERVICE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18481
		error = @symbol(unknownService);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18482
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18483
	    case EAI_MEMORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18484
		error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18485
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18486
	    case EAI_FAIL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18487
		error = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18488
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18489
	    case EAI_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18490
		error = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18491
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18492
	    default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18493
		error = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18494
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18495
	errorString = __MKSTRING(gai_strerror(ret));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18496
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18497
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18498
# else /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18499
    {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18500
	/*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18501
	 * Do it using gethostbyaddr()
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18502
	 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18503
	struct sockaddr_in *sa;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18504
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18505
	if (sockAddrSize < sizeof(*sa)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18506
	    error = @symbol(badArgument1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18507
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18508
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18509
	bp = (char *)(__byteArrayVal(socketAddress));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18510
	bp += nInstBytes;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18511
	sa = (struct sockaddr_in *)bp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18512
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18513
	if (sp) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18514
	    struct servent *servp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18515
	    char *__proto = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18516
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18517
	    __proto = (useDatagram == true ? "udp" : "tcp");
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18518
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18519
	    servp = getservbyport(sa->sin_port, __proto);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18520
	    if (servp) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18521
		sp = servp->s_name;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18522
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18523
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18524
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18525
	if (sa->sin_family == AF_INET6) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18526
	    if (sp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18527
		serviceName = __MKSTRING(sp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18528
	    error = @symbol(AF_INET6);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18529
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18530
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18531
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18532
	if (hp) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18533
	    struct hostent *hostp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18534
	    int err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18535
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18536
	    do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18537
		/* must refetch in loop */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18538
		bp = (char *)(__byteArrayVal(socketAddress));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18539
		bp += nInstBytes;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18540
		sa = (struct sockaddr_in *)bp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18541
		/* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18542
		 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18543
		hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18544
		/* __END_INTERRUPTABLE__ */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18545
	    } while ((hostp == NULL)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18546
		      && ((err = WSAGetLastError()) == EINTR)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18547
	    );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18548
	    if (hostp == 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18549
		switch (err) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18550
		case HOST_NOT_FOUND:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18551
		    errorString = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18552
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18553
		case NO_ADDRESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18554
		    errorString = @symbol(noAddress);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18555
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18556
		case NO_RECOVERY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18557
		    errorString = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18558
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18559
		case TRY_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18560
		    errorString = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18561
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18562
		default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18563
		    errorString = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18564
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18565
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18566
		error = __mkSmallInteger(err);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18567
		goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18568
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18569
	    hp = hostp->h_name;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18570
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18571
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18572
# endif /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18573
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18574
    if (hp)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18575
	hostName = __MKSTRING(hp);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18576
    if (sp)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18577
	serviceName = __MKSTRING(sp);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18578
err:;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18579
#else
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18580
    error = @symbol(notImplemented);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18581
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18582
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18583
    error notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18584
	(error == #AF_INET6 or:[errorString == #noAddress]) ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18585
	    "This is a socket address of wrong size - probably an IPv6SocketAddres on a system where
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18586
	     the getNetByAddr() syscall is not supported"
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18587
	    ^ Array
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18588
		with:socketAddress hostAddressString
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18589
		with:serviceName.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18590
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18591
	error isSymbol ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18592
	    self primitiveFailed:error.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18593
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18594
	^ (HostAddressLookupError new
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18595
		parameter:error;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18596
		messageText:' - ', (errorString ? error printString);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18597
		request:thisContext message) raiseRequest.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18598
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18599
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18600
    ^ Array with:hostName with:serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18601
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18602
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18603
     self getNameInfo:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18604
	(self getAddressInfo:'localhost' serviceName:'echo'
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18605
		domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18606
	 wantHostName:true wantServiceName:true datagram:false flags:0
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18607
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18608
     self getNameInfo:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18609
	(self getAddressInfo:'exept.exept.de' serviceName:'echo'
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18610
		domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18611
	 wantHostName:true wantServiceName:true datagram:false flags:0
15604
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 18612
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 18613
     self getNameInfo:(IPSocketAddress hostAddress:#[1 2 3 4])
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18614
	 wantHostName:true wantServiceName:true datagram:false flags:0
17594
1f6f1ece1bb0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17521
diff changeset
 18615
1f6f1ece1bb0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17521
diff changeset
 18616
     self getNameInfo:(IPv6SocketAddress localHost port:21)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18617
	 wantHostName:true wantServiceName:true datagram:false flags:0
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18618
    "
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18619
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18620
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18621
!Win32OperatingSystem::Win32SocketHandle methodsFor:'initialization'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18622
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18623
initialize
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18624
%{ /* NOCONTEXT */
18548
1a1879f23a05 Mingw fixes
Stefan Vogel <sv@exept.de>
parents: 18543
diff changeset
 18625
	__ExternalAddressInstPtr(self)->e_address = (void *)(INVALID_SOCKET);
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18626
%}
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18627
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18628
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18629
      self new
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18630
      self new isValid
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18631
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18632
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18633
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18634
!Win32OperatingSystem::Win32SocketHandle methodsFor:'queries'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18635
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18636
handleType
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 18637
    ^ #socketHandle
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18638
!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18639
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18640
isValid
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18641
%{  /* NOCONTEXT */
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18642
    SOCKET sock = (SOCKET)(__externalAddressVal(self));
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18643
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18644
    RETURN(sock == INVALID_SOCKET ? false : true);
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18645
%}.
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18646
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18647
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18648
      self new isValid
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18649
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18650
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18651
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18652
!Win32OperatingSystem::Win32SocketHandle methodsFor:'release'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18653
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18654
closeHandle
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18655
    "close the handle"
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18656
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18657
%{ /* NOCONTEXT */
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18658
    SOCKET sock = (SOCKET)(__externalAddressVal(self));
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18659
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18660
    if (sock != INVALID_SOCKET) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18661
	__externalAddressVal(self) = (void *)(INVALID_SOCKET);
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 18662
	closesocket(sock);
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18663
    }
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18664
%}.
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18665
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18666
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18667
!Win32OperatingSystem::Win32SocketHandle methodsFor:'testing'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18668
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18669
isSocketHandle
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18670
    ^ true
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18671
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18672
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18673
!Win32OperatingSystem::WinPointStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18674
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18675
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18676
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18677
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18678
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18679
    "Created: / 03-08-2006 / 10:37:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18680
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18681
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 18682
sizeInBytes
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18683
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18684
^8
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18685
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18686
    "Created: / 03-08-2006 / 10:38:06 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18687
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18688
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18689
!Win32OperatingSystem::WinPointStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18690
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18691
asPoint
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18692
	"Private - Answer the receiver as a Point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18693
    ^self x @ self y
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18694
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18695
    "Created: / 03-08-2006 / 10:45:55 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18696
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18697
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18698
x
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18699
	"Private - Answer the x coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18700
    ^self longAt: 0 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18701
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18702
    "Created: / 03-08-2006 / 10:46:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18703
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18704
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18705
x: anInteger
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18706
	"Private - Set the x coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18707
    self longAt: 0 + 1 put: anInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18708
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18709
    "Created: / 03-08-2006 / 10:46:41 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18710
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18711
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18712
y
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18713
	"Private - Answer the y coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18714
    ^self longAt: 4 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18715
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18716
    "Created: / 03-08-2006 / 10:46:26 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18717
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18718
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18719
y: anInteger
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18720
	"Private - Set the y coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18721
    self longAt: 4 + 1 put: anInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18722
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18723
    "Created: / 03-08-2006 / 10:46:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18724
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18725
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18726
!Win32OperatingSystem::WinPointStructure methodsFor:'printing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18727
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18728
printOn: aStream
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18729
	"Append a textual representation of the receiver to aStream."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18730
    aStream nextPutAll: self class name, ' { ', self asPoint printString, ' } '
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18731
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18732
    "Created: / 03-08-2006 / 10:45:40 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18733
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18734
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18735
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18736
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18737
version
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18738
    ^ '$Header$'
12154
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 18739
!
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 18740
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 18741
version_CVS
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18742
    ^ '$Header$'
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18743
!
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18744
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18745
version_SVN
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18746
    ^ '$Id$'
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18747
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18748
! !
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 18749
14730
a4cc809df4f1 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14667
diff changeset
 18750
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 18751
Win32OperatingSystem initialize!
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 18752
Win32OperatingSystem::PECOFFConstants initialize!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 18753
Win32OperatingSystem::PerformanceData initialize!
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 18754
Win32OperatingSystem::RegistryEntry initialize!